comp-hub 0.0.113 → 0.0.115
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/dist/index.js +1 -1
- package/dist/website/dist/assets/{atom-one-dark-BFQCq35N.js → atom-one-dark-CMFPIuLm.js} +1 -1
- package/dist/website/dist/assets/{index-CpR-gO1D.js → index-B4sTJbBw.js} +1 -1
- package/dist/website/dist/assets/{index-BvHtAQJ6.js → index-B9j-Dtc8.js} +1 -1
- package/dist/website/dist/assets/{index-DSitPX3c.js → index-BEav7lOm.js} +1 -1
- package/dist/website/dist/assets/{index-Df35dpVA.js → index-BH6NwLy-.js} +2 -2
- package/dist/website/dist/assets/{index-Z7-k1yyE.js → index-Bibf8zX6.js} +1 -1
- package/dist/website/dist/assets/{index-Jbn8LmD6.js → index-BzLvpGyb.js} +1 -1
- package/dist/website/dist/assets/{index-Co3pVMNN.js → index-CKjVNRgN.js} +1 -1
- package/dist/website/dist/assets/{index-ihzkMZPo.js → index-CQuOLxxx.js} +1 -1
- package/dist/website/dist/assets/{index-8UBYsfSv.js → index-CTlKpgoK.js} +1 -1
- package/dist/website/dist/assets/{index-BymI4fQr.js → index-CcKVOPyo.js} +10 -10
- package/dist/website/dist/assets/{index-lST4jsLg.js → index-CcOWLkQv.js} +1 -1
- package/dist/website/dist/assets/{index-ZOeEdiZ1.js → index-CnpCr086.js} +1 -1
- package/dist/website/dist/assets/{index-BE0u3Bab.js → index-DHkTiLFU.js} +1 -1
- package/dist/website/dist/assets/index-DMfBsXT1.js +1 -0
- package/dist/website/dist/assets/{index-FpiPNIBz.js → index-SeVeFBYm.js} +1 -1
- package/dist/website/dist/assets/{index-7vz6VOEt.js → index-X93VA_va.js} +1 -1
- package/dist/website/dist/assets/{index.vue_vue_type_script_setup_true_lang-wj7dKlz7.js → index.vue_vue_type_script_setup_true_lang-CWN6kyJn.js} +1 -1
- package/dist/website/dist/assets/{index.vue_vue_type_script_setup_true_lang-BxHkprFF.js → index.vue_vue_type_script_setup_true_lang-DJPU20Dv.js} +1 -1
- package/dist/website/dist/assets/{index.vue_vue_type_script_setup_true_lang-DM_RSm5-.js → index.vue_vue_type_script_setup_true_lang-Dm6ZgcMX.js} +1 -1
- package/dist/website/dist/assets/{index.vue_vue_type_script_setup_true_lang-CdnZ1p5K.js → index.vue_vue_type_script_setup_true_lang-RkJc2Cxx.js} +1 -1
- package/dist/website/dist/assets/{index.vue_vue_type_style_index_0_lang-26LZD4nL.js → index.vue_vue_type_style_index_0_lang-UJiIYWdS.js} +1 -1
- package/dist/website/dist/assets/{md5-Bt-65bnm.js → md5-_aBD2we8.js} +1 -1
- package/dist/website/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/website/dist/assets/index-JMXlVqZB.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var __webpack_modules__={62542:e=>{function webpackEmptyAsyncContext(e){return Promise.resolve().then((()=>{var r=new Error("Cannot find module '"+e+"'");r.code="MODULE_NOT_FOUND";throw r}))}webpackEmptyAsyncContext.keys=()=>[];webpackEmptyAsyncContext.resolve=webpackEmptyAsyncContext;webpackEmptyAsyncContext.id=62542;e.exports=webpackEmptyAsyncContext},35378:(e,r,n)=>{const{Bootstrap:i}=n(41836);i.configure({imports:n(60137),moduleDetector:false}).run()},62002:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const i=n(51466);const s=n(74761);const o=n(96878);const a=n(44348);const c=n(40934);r["default"]={v1Comp:i,v1Email:s,v1Oss:o,v1Token:a,v1User:c}},51466:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.compcontrollerVersions=r.compcontrollerUpload=r.compcontrollerUpdateobjectid=r.compcontrollerUpdate=r.compcontrollerSoftdelete=r.compcontrollerMycomps=r.compcontrollerInfobyname=r.compcontrollerInfobyid=r.compcontrollerDownload=r.compcontrollerDelete=r.compcontrollerComps=r.compcontrollerCollectedcomps=r.compcontrollerCollect=r.compcontrollerCheckversioncorrect=r.compcontrollerCheckversion=r.compcontrollerCheckcompexistbyname=r.compcontrollerCheckcompexistbyid=r.compcontrollerCheckcompexistbyhash=void 0;const i=n(10954);async function compcontrollerCheckcompexistbyhash(e,r){return(0,i.default)("/api/v1/comp/checkCompExistByHash",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCheckcompexistbyhash=compcontrollerCheckcompexistbyhash;async function compcontrollerCheckcompexistbyid(e,r){return(0,i.default)("/api/v1/comp/checkCompExistById",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCheckcompexistbyid=compcontrollerCheckcompexistbyid;async function compcontrollerCheckcompexistbyname(e,r){return(0,i.default)("/api/v1/comp/checkCompExistByName",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCheckcompexistbyname=compcontrollerCheckcompexistbyname;async function compcontrollerCheckversion(e,r){return(0,i.default)("/api/v1/comp/checkVersion",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCheckversion=compcontrollerCheckversion;async function compcontrollerCheckversioncorrect(e,r){return(0,i.default)("/api/v1/comp/checkVersionCorrect",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCheckversioncorrect=compcontrollerCheckversioncorrect;async function compcontrollerCollect(e,r){return(0,i.default)("/api/v1/comp/collect",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCollect=compcontrollerCollect;async function compcontrollerCollectedcomps(e,r){return(0,i.default)("/api/v1/comp/collectedComps",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCollectedcomps=compcontrollerCollectedcomps;async function compcontrollerComps(e,r){return(0,i.default)("/api/v1/comp/comps",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerComps=compcontrollerComps;async function compcontrollerDelete(e,r){return(0,i.default)("/api/v1/comp/delete",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerDelete=compcontrollerDelete;async function compcontrollerDownload(e,r){return(0,i.default)("/api/v1/comp/download",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerDownload=compcontrollerDownload;async function compcontrollerInfobyid(e,r){return(0,i.default)("/api/v1/comp/infoById",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerInfobyid=compcontrollerInfobyid;async function compcontrollerInfobyname(e,r){return(0,i.default)("/api/v1/comp/infoByName",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerInfobyname=compcontrollerInfobyname;async function compcontrollerMycomps(e,r){return(0,i.default)("/api/v1/comp/myComps",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerMycomps=compcontrollerMycomps;async function compcontrollerSoftdelete(e,r){return(0,i.default)("/api/v1/comp/softDelete",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerSoftdelete=compcontrollerSoftdelete;async function compcontrollerUpdate(e,r){return(0,i.default)("/api/v1/comp/update",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerUpdate=compcontrollerUpdate;async function compcontrollerUpdateobjectid(e,r){return(0,i.default)("/api/v1/comp/updateObjectId",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerUpdateobjectid=compcontrollerUpdateobjectid;async function compcontrollerUpload(e,r){return(0,i.default)("/api/v1/comp/upload",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerUpload=compcontrollerUpload;async function compcontrollerVersions(e,r){return(0,i.default)("/api/v1/comp/versions",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerVersions=compcontrollerVersions},74761:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.emailcontrollerSendcode=void 0;const i=n(10954);async function emailcontrollerSendcode(e,r){return(0,i.default)("/api/v1/email/sendCode",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.emailcontrollerSendcode=emailcontrollerSendcode},96878:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.osscontrollerPutpolicy=r.osscontrollerGetsts=r.osscontrollerCompossdir=void 0;const i=n(10954);async function osscontrollerCompossdir(e){return(0,i.default)("/api/v1/oss/compOssDir",{method:"POST",...e||{}})}r.osscontrollerCompossdir=osscontrollerCompossdir;async function osscontrollerGetsts(e){return(0,i.default)("/api/v1/oss/getSts",{method:"POST",...e||{}})}r.osscontrollerGetsts=osscontrollerGetsts;async function osscontrollerPutpolicy(e,r){return(0,i.default)("/api/v1/oss/putPolicy",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.osscontrollerPutpolicy=osscontrollerPutpolicy},44348:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.tokencontrollerRefresh=void 0;const i=n(10954);async function tokencontrollerRefresh(e){return(0,i.default)("/api/v1/token/refresh",{method:"POST",...e||{}})}r.tokencontrollerRefresh=tokencontrollerRefresh},40934:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.usercontrollerWhoami=r.usercontrollerUserinfo=r.usercontrollerUpdateemail=r.usercontrollerSetallowemaillogin=r.usercontrollerLogin=r.usercontrollerCheckpassword=r.usercontrollerCheckemail=r.usercontrollerChangepassword=r.usercontrollerChangenickname=r.usercontrollerChangeavatar=void 0;const i=n(10954);async function usercontrollerChangeavatar(e,r){return(0,i.default)("/api/v1/user/changeAvatar",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerChangeavatar=usercontrollerChangeavatar;async function usercontrollerChangenickname(e,r){return(0,i.default)("/api/v1/user/changeNickname",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerChangenickname=usercontrollerChangenickname;async function usercontrollerChangepassword(e,r){return(0,i.default)("/api/v1/user/changePassword",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerChangepassword=usercontrollerChangepassword;async function usercontrollerCheckemail(e,r){return(0,i.default)("/api/v1/user/checkEmail",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerCheckemail=usercontrollerCheckemail;async function usercontrollerCheckpassword(e){return(0,i.default)("/api/v1/user/checkPassword",{method:"POST",...e||{}})}r.usercontrollerCheckpassword=usercontrollerCheckpassword;async function usercontrollerLogin(e,r){return(0,i.default)("/api/v1/user/login",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerLogin=usercontrollerLogin;async function usercontrollerSetallowemaillogin(e,r){return(0,i.default)("/api/v1/user/setAllowEmailLogin",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerSetallowemaillogin=usercontrollerSetallowemaillogin;async function usercontrollerUpdateemail(e,r){return(0,i.default)("/api/v1/user/updateEmail",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerUpdateemail=usercontrollerUpdateemail;async function usercontrollerUserinfo(e){return(0,i.default)("/api/v1/user/userInfo",{method:"POST",...e||{}})}r.usercontrollerUserinfo=usercontrollerUserinfo;async function usercontrollerWhoami(e){return(0,i.default)("/api/v1/user/whoAmI",{method:"POST",...e||{}})}r.usercontrollerWhoami=usercontrollerWhoami},10839:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.resUtil=r.getResType=r.SuccessWrapper=r.getListItemRes=r.ListRes=r.ApiRes=void 0;const o=n(66466);class ApiRes{}i([(0,o.ApiProperty)({description:"状态码",example:0,required:true}),s("design:type",Number)],ApiRes.prototype,"code",void 0);i([(0,o.ApiProperty)({description:"响应消息",example:"OK",required:true}),s("design:type",String)],ApiRes.prototype,"message",void 0);i([(0,o.ApiProperty)({description:"业务数据",required:true}),s("design:type",Object)],ApiRes.prototype,"data",void 0);r.ApiRes=ApiRes;class ListRes{}i([(0,o.ApiProperty)({description:"列表数据"}),s("design:type",Array)],ListRes.prototype,"rows",void 0);i([(0,o.ApiProperty)({description:"总记录数",example:100}),s("design:type",Number)],ListRes.prototype,"total",void 0);i([(0,o.ApiProperty)({description:"当前页码",example:1}),s("design:type",Number)],ListRes.prototype,"page",void 0);i([(0,o.ApiProperty)({description:"每页记录数",example:10}),s("design:type",Number)],ListRes.prototype,"pageSize",void 0);r.ListRes=ListRes;const a=new Map;function getListItemRes(e){const r=`${e.name}ListRes`;if(a.has(r)){return a.get(r)}class SpecificListRes extends ListRes{}i([(0,o.ApiProperty)({type:[e],description:"列表数据"}),s("design:type",Array)],SpecificListRes.prototype,"rows",void 0);Object.defineProperty(SpecificListRes,"name",{value:r,writable:false});a.set(r,SpecificListRes);return SpecificListRes}r.getListItemRes=getListItemRes;function SuccessWrapper(e){class Successed{}i([(0,o.ApiProperty)({description:"状态码"}),s("design:type",Number)],Successed.prototype,"code",void 0);i([(0,o.ApiProperty)({description:"消息"}),s("design:type",String)],Successed.prototype,"message",void 0);i([(0,o.ApiProperty)({type:e}),s("design:type",Object)],Successed.prototype,"data",void 0);return Successed}r.SuccessWrapper=SuccessWrapper;function getResType(e){const r=`${e.name}Res`;if(a.has(r)){return a.get(r)}class SpecificResponse extends ApiRes{}i([(0,o.ApiProperty)({type:e,required:true}),s("design:type",Object)],SpecificResponse.prototype,"data",void 0);Object.defineProperty(SpecificResponse,"name",{value:r,writable:false});a.set(r,SpecificResponse);return SpecificResponse}r.getResType=getResType;r.resUtil={success:(e=null,r="OK",n=0)=>({code:n,message:r,data:e}),error:(e="Error",r=1,n=null)=>({code:r,message:e,data:n})}},5808:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]={FILE_MANAGER_DIRNAME:{adapter:"local",storages:["local"],dirname:"local://"},COMP_DEFAULT_FIELD:[{name:"__id__",label:"组件ID",required:true,default:""},{name:"name",label:"组件名称",required:true,default:""},{name:"version",label:"版本号",required:true,default:"1.0.0"}],PREBUILD_MODULE_DIR:"/node_modules/.prebuild_module",MODULE_LOAD_PREFIX:"/_module_load_prefix_",COMP_PREVIEW_PREFIX:"/_comp_preview_prefix_",COMP_TEMP_DIR:"/.comp_hub_temp",COMP_SUBMIT_FILE_CHECKING:{totalSize:1024*1024*10,totalNum:30},CACHE_KEY:{STS_TOKEN:"oss:sts:token",STS_EXPIRE_TIME:"oss:sts:expire"},OSS_CUSTOM_DOMAIN:"https://oss.comphub.cn",REMOTE_SERVICE_URL:"https://api.comphub.cn:5696"}},82919:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const i=n(5808);const s=n(80994);const{logLevel:o=""}=s(process.argv.slice(2));r["default"]={keys:"1755564797722_8890",koa:{globalPrefix:"/api"},midwayLogger:{default:{transports:{console:{level:"all"}}},clients:{appLogger:{level:o||"info"},coreLogger:{level:o||"info"}}},cacheManager:{clients:{default:{store:"memory"}}},...i.default}},50849:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]={}},3574:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]={koa:{port:null}}},85903:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MainConfiguration=void 0;const o=n(45573);const a=n(78305);const c=n(30794);const u=n(7252);const p=n(16313);const g=n(66792);const v=n(39718);const b=n(82919);const _=n(50849);const E=n(16928);const x=n(79896);const T=n(5783);const w=n(66466);const C=n(58139);const A=n(5808);const k=n(79896);const P=n(10954);const I=n(16378);const R=n(65543);const N=n(80994);const L=N(process.argv.slice(2));async function configBuild(e,r,n){const i=e.getEnv();let s=process.cwd();r.info("cwd:",s);r.info("env:",i);if(i==="local"&&L?.dir){s=E.resolve(s,"../",L?.dir)}const o=E.join(s,"comphub.json");let a={};try{const e=(0,x.readFileSync)(o,"utf8");a=JSON.parse(e)}catch(e){r.warn("未配置comphub.json文件")}r.info("comphub.json:",JSON.stringify(a));if(a.debuggerCwd){s=a.debuggerCwd}const c=E.join(n,i==="local"?"../website":"website","dist");const u=E.join(s,a.srcPath||"");const p=E.join(s,A.default.PREBUILD_MODULE_DIR);await k.promises.mkdir(p,{recursive:true});const g=a.port||3e3;const v=a.remoteServer||A.default.REMOTE_SERVICE_URL;const b={websitePath:c,prebuildModulePath:p,cwd:s,port:g,srcPath:u,remoteServer:v,logLevel:a.logLevel||"warn",debuggerCwd:a.debuggerCwd||""};e.setAttr("comphubConfig",b);r.debug("comphubConfig:",b);P.default.defaults.baseURL=b.remoteServer;return{koa:{port:g},staticFile:{dirs:{default:{prefix:"/dist",dir:c},[A.default.MODULE_LOAD_PREFIX]:{prefix:A.default.MODULE_LOAD_PREFIX,dir:p,maxAge:0},[A.default.COMP_PREVIEW_PREFIX]:{prefix:A.default.COMP_PREVIEW_PREFIX,dir:b.srcPath,maxAge:0}}},httpProxy:{strategy:{__remote__:{match:/\/__remote__\/(.*)$/,target:`${b.remoteServer}/$1`}}}}}let B=class MainConfiguration{async onConfigLoad(){return configBuild(this.app,this.logger,__dirname)}async onReady(){this.app.useMiddleware([v.ReportMiddleware]);this.app.useFilter([g.BadRequestErrorFilter,p.DefaultErrorFilter])}async onServerReady(e){const r=await e.getAsync(a.Framework);const n=r.getServer();const i=n.address();const s=this.app.getEnv();if(i){if(typeof i!=="string"&&"port"in i){this.logger.info("[34mcomp-hub访问地址:",`[34mhttp://127.0.0.1:${i.port}[0m`);if(s==="local"){this.logger.info("[34mswagger-ui:",`[34mhttp://127.0.0.1:${i.port}/swagger-ui/index.html[0m`)}}else if(typeof i==="string"){this.logger.info("服务器启动成功",`地址: ${i}`)}}}};i([(0,o.Logger)("coreLogger"),s("design:type",Object)],B.prototype,"logger",void 0);i([(0,o.App)("koa"),s("design:type",Object)],B.prototype,"app",void 0);B=i([(0,o.Configuration)({imports:[a,c,T,C,I,R,{component:u,enabledEnvironment:["local"]},{component:w,enabledEnvironment:["local"]}],importConfigs:[{default:b,local:_}]})],B);r.MainConfiguration=B},66404:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.SpaController=void 0;const o=n(45573);const a=n(79896);const c=n(16928);const u=n(66466);const p=n(15766);let g=class SpaController{async index(){this.ctx.redirect("/dist/")}async spa(){const e=this.configService.comphubConfig();const{websitePath:r}=e;const n=(0,c.resolve)(r,"index.html");return(0,a.readFileSync)(n,"utf-8")}};i([(0,o.Inject)(),s("design:type",Object)],g.prototype,"ctx",void 0);i([(0,o.App)(),s("design:type",Object)],g.prototype,"app",void 0);i([(0,o.Inject)(),s("design:type",p.ConfigService)],g.prototype,"configService",void 0);i([(0,o.Get)("/"),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],g.prototype,"index",null);i([(0,o.Get)("/dist/*"),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],g.prototype,"spa",null);g=i([(0,u.ApiExcludeController)(),(0,o.Controller)("/",{ignoreGlobalPrefix:true})],g);r.SpaController=g},91557:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};var o=this&&this.__param||function(e,r){return function(n,i){r(n,i,e)}};Object.defineProperty(r,"__esModule",{value:true});r.CompController=void 0;const a=n(45573);const c=n(56491);const u=n(15766);const p=n(66466);const g=n(4019);const v=n(33845);const b=n(10839);const _=n(93305);let E=class CompController{async dir(e){const r=await this.compService.getCompDir(e.compPath);return b.resUtil.success(r)}async file(e){const{filePath:r}=e;const n=await this.compService.getCompFile(r);return b.resUtil.success({content:n})}async check(e){const r=await this.compService.checkCompConfig(e.compPath);return b.resUtil.success(r)}async updateVersion(e){const{compPath:r,version:n}=e;await this.compService.updateCompVersion(r,n);return b.resUtil.success()}async generateCompJson(e){const{compPath:r}=e;await this.compService.generateCompJson(r);return b.resUtil.success()}async dep(e){const{compPath:r}=e;const n=await this.compService.getCompDep(r);return b.resUtil.success(n)}async preBuildAll(e){const{deps:r}=e;const n=await this.compService.preBuildAll(r);return b.resUtil.success(n)}async comphubConfig(){const e=this.configService.comphubConfig();return b.resUtil.success(e)}async otherConfig(){const e=this.configService.otherConfig();return b.resUtil.success(e)}async checkCompRepeat(e){const{compPath:r}=e;const n=await this.compService.checkCompRepeat(r);return b.resUtil.success(n)}async submit(e){await this.compService.submitComp(e);return b.resUtil.success()}async update(e){await this.compService.updateComp(e);return b.resUtil.success()}async download(e){const r=await this.compService.downloadComp(e);if(r?.isRepeat){return b.resUtil.success({isRepeat:true})}return b.resUtil.success({isRepeat:false})}async compById(e){const{compId:r}=e;const n=await this.compService.getCompById(r);return b.resUtil.success(n)}async compFilesOssSignedUrl(e){const r=await this.compService.getCompFilesOssSignedUrl(e);return b.resUtil.success(r)}async packageJson(){const e=await this.compService.getPackageJsonContent();return b.resUtil.success(e)}};i([(0,a.App)(),s("design:type",Object)],E.prototype,"app",void 0);i([(0,a.Inject)(),s("design:type",c.CompService)],E.prototype,"compService",void 0);i([(0,a.Inject)(),s("design:type",u.ConfigService)],E.prototype,"configService",void 0);i([(0,p.ApiOperation)({summary:"获取组件目录"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.CompFileVo)}),(0,a.Post)("/dir"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.CompDirDto]),s("design:returntype",Promise)],E.prototype,"dir",null);i([(0,p.ApiOperation)({summary:"获取组件目录内指定文件的内容"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.CompFileContentVo)}),(0,a.Post)("/file"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.CompFileDto]),s("design:returntype",Promise)],E.prototype,"file",null);i([(0,p.ApiOperation)({summary:"检查组件配置是否符合规范"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.CompCheckVo)}),(0,a.Post)("/check"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.CompCheckDto]),s("design:returntype",Promise)],E.prototype,"check",null);i([(0,p.ApiOperation)({summary:"更新组件版本号"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:b.ApiRes}),(0,a.Post)("/updateVersion"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.UpdateVersionDto]),s("design:returntype",Promise)],E.prototype,"updateVersion",null);i([(0,p.ApiOperation)({summary:"生成组件指纹文件"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:b.ApiRes}),(0,a.Post)("/generateCompJson"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.GenerateCompJsonDto]),s("design:returntype",Promise)],E.prototype,"generateCompJson",null);i([(0,p.ApiOperation)({summary:"获取组件依赖关系"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.ImportScanResultVo)}),(0,a.Post)("/dep"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.DepDto]),s("design:returntype",Promise)],E.prototype,"dep",null);i([(0,p.ApiOperation)({summary:"模块预构建整页"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.PreBuildVo)}),(0,a.Post)("/preBuildAll"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.PreBuildAllDto]),s("design:returntype",Promise)],E.prototype,"preBuildAll",null);i([(0,p.ApiOperation)({summary:"获取comphubConfig配置"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.ComphubConfigVo)}),(0,a.Post)("/comphubConfig"),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],E.prototype,"comphubConfig",null);i([(0,p.ApiOperation)({summary:"获取其他配置"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.OtherConfigVo)}),(0,a.Post)("/otherConfig"),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],E.prototype,"otherConfig",null);i([(0,p.ApiOperation)({summary:"检查组件是否重复"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.CompSimilarListVO)}),(0,a.Post)("/checkCompRepeat",{middleware:[_.TokenMiddleware]}),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.CheckCompRepeatDto]),s("design:returntype",Promise)],E.prototype,"checkCompRepeat",null);i([(0,p.ApiOperation)({summary:"提交组件"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:b.ApiRes}),(0,a.Post)("/submit",{middleware:[_.TokenMiddleware]}),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.SubmitCompDto]),s("design:returntype",Promise)],E.prototype,"submit",null);i([(0,p.ApiOperation)({summary:"更新组件"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:b.ApiRes}),(0,a.Post)("/update",{middleware:[_.TokenMiddleware]}),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.UpdateCompDto]),s("design:returntype",Promise)],E.prototype,"update",null);i([(0,p.ApiOperation)({summary:"下载组件"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.DownloadCompVo)}),(0,a.Post)("/download",{middleware:[_.TokenMiddleware]}),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.DownloadCompDto]),s("design:returntype",Promise)],E.prototype,"download",null);i([(0,p.ApiOperation)({summary:"通过id在本地查询组件"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.CompByIdVo)}),(0,a.Post)("/compById"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.CompByIdDto]),s("design:returntype",Promise)],E.prototype,"compById",null);i([(0,p.ApiOperation)({summary:"获取组件文件夹下所有文件的oss签名访问地址"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.CompFilesOssSignedUrlVo)}),(0,a.Post)("/compFilesOssSignedUrl",{middleware:[_.TokenMiddleware]}),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.CompFilesOssSignedUrlDto]),s("design:returntype",Promise)],E.prototype,"compFilesOssSignedUrl",null);i([(0,p.ApiOperation)({summary:"获取package.json"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:b.ApiRes}),(0,a.Post)("/packageJson"),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],E.prototype,"packageJson",null);E=i([(0,p.ApiTags)(["v1-comp"]),(0,a.Controller)("/v1/comp")],E);r.CompController=E},81179:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};var o=this&&this.__param||function(e,r){return function(n,i){r(n,i,e)}};Object.defineProperty(r,"__esModule",{value:true});r.OssController=void 0;const a=n(45573);const c=n(66466);const u=n(10839);const p=n(17583);const g=n(2809);const v=n(66959);const b=n(93305);let _=class OssController{async fileSignUrl(e){const{objectId:r}=e;const n=await this.ossService.getDownloadSts();const i=await this.ossService.getFilePreviewUrl(n,r);return u.resUtil.success({signUrl:i})}};i([(0,a.App)(),s("design:type",Object)],_.prototype,"app",void 0);i([(0,a.Inject)(),s("design:type",v.OssService)],_.prototype,"ossService",void 0);i([(0,c.ApiOperation)({summary:"获取图片访问地址",description:"获取图片访问地址"}),(0,c.ApiResponse)({status:200,description:"返回结果",type:(0,u.getResType)(g.SignedUrlVO)}),(0,a.Post)("/fileSignUrl",{middleware:[b.TokenMiddleware]}),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[p.SignedUrlDto]),s("design:returntype",Promise)],_.prototype,"fileSignUrl",null);_=i([(0,c.ApiTags)(["v1-oss"]),(0,a.Controller)("/v1/oss")],_);r.OssController=_},69322:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};var o=this&&this.__param||function(e,r){return function(n,i){r(n,i,e)}};Object.defineProperty(r,"__esModule",{value:true});r.VuefinderController=void 0;const a=n(45573);const c=n(87360);const u=n(66466);const p=n(33988);let g=class VuefinderController{async index(e){const r=await this.vuefinderService.getVuefinder(e.path,e.q);return r}};i([(0,a.App)(),s("design:type",Object)],g.prototype,"app",void 0);i([(0,a.Inject)(),s("design:type",c.VuefinderService)],g.prototype,"vuefinderService",void 0);i([(0,u.ApiOperation)({summary:"查询文件"}),(0,a.Get)("/index"),o(0,(0,a.Query)()),s("design:type",Function),s("design:paramtypes",[p.VueFinderIndexDto]),s("design:returntype",Promise)],g.prototype,"index",null);g=i([(0,u.ApiTags)(["v1-vuefinder"]),(0,a.Controller)("/v1/vuefinder")],g);r.VuefinderController=g},4019:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.CompFilesOssSignedUrlDto=r.DownloadCompDto=r.UpdateCompDto=r.SubmitCompDto=r.PreBuildAllDto=r.CompFileDto=r.UpdateVersionDto=r.CheckCompRepeatDto=r.CompByIdDto=r.DepDto=r.GenerateCompJsonDto=r.CompCheckDto=r.CompDirDto=void 0;const o=n(66466);class CompPathDto{}i([(0,o.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),s("design:type",String)],CompPathDto.prototype,"compPath",void 0);class CompIdDto{}i([(0,o.ApiProperty)({required:true,description:"组件id",example:"123"}),s("design:type",String)],CompIdDto.prototype,"compId",void 0);class CompDirDto extends CompPathDto{}r.CompDirDto=CompDirDto;class CompCheckDto extends CompPathDto{}r.CompCheckDto=CompCheckDto;class GenerateCompJsonDto extends CompPathDto{}r.GenerateCompJsonDto=GenerateCompJsonDto;class DepDto extends CompPathDto{}r.DepDto=DepDto;class CompByIdDto extends CompIdDto{}r.CompByIdDto=CompByIdDto;class CheckCompRepeatDto extends CompPathDto{}r.CheckCompRepeatDto=CheckCompRepeatDto;class UpdateVersionDto extends CompPathDto{}i([(0,o.ApiProperty)({required:true,description:"组件版本号",example:"1.0.0"}),s("design:type",String)],UpdateVersionDto.prototype,"version",void 0);r.UpdateVersionDto=UpdateVersionDto;class CompFileDto{}i([(0,o.ApiProperty)({required:true,description:"组件文件路径",example:"/src/components/MyComp/index.vue"}),s("design:type",String)],CompFileDto.prototype,"filePath",void 0);r.CompFileDto=CompFileDto;class PreBuildAllDto{}i([(0,o.ApiProperty)({required:true,description:"组件依赖",example:["axios","md5"]}),s("design:type",Array)],PreBuildAllDto.prototype,"deps",void 0);r.PreBuildAllDto=PreBuildAllDto;class ImportDetailDto{}i([(0,o.ApiProperty)({description:"是否默认导入",example:false}),s("design:type",Boolean)],ImportDetailDto.prototype,"default",void 0);i([(0,o.ApiProperty)({description:"命名导入列表",type:[String],example:["ElButton"]}),s("design:type",Array)],ImportDetailDto.prototype,"named",void 0);i([(0,o.ApiProperty)({description:"是否命名空间导入",example:false}),s("design:type",Boolean)],ImportDetailDto.prototype,"namespace",void 0);i([(0,o.ApiProperty)({description:"库版本(仅第三方库存在)",required:false,example:"^2.10.5"}),s("design:type",String)],ImportDetailDto.prototype,"version",void 0);class PreviewItemDto{}i([(0,o.ApiProperty)({required:true,description:"组件入口",example:["/src/components/MyComp/index.vue"]}),s("design:type",Array)],PreviewItemDto.prototype,"path",void 0);i([(0,o.ApiProperty)({required:true,description:"入口描述",example:"这是一个组件"}),s("design:type",String)],PreviewItemDto.prototype,"desc",void 0);let a=class SubmitCompDto{};i([(0,o.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),s("design:type",String)],a.prototype,"compPath",void 0);i([(0,o.ApiProperty)({type:"object",required:true,description:"组件依赖",additionalProperties:{type:()=>ImportDetailDto}}),s("design:type",Object)],a.prototype,"dep",void 0);i([(0,o.ApiProperty)({type:"array",required:true,description:"组件预览数据",items:{$ref:(0,o.getSchemaPath)(PreviewItemDto)}}),s("design:type",Array)],a.prototype,"previewConfigs",void 0);i([(0,o.ApiProperty)({required:true,description:"组件描述",example:"这是一个组件"}),s("design:type",String)],a.prototype,"desc",void 0);i([(0,o.ApiProperty)({required:false,description:"组件背景颜色",example:"#f0f0f0"}),s("design:type",String)],a.prototype,"bgColor",void 0);i([(0,o.ApiProperty)({required:false,description:"是否允许重复",example:true}),s("design:type",Boolean)],a.prototype,"allowRepeat",void 0);a=i([(0,o.ApiExtraModel)(PreviewItemDto)],a);r.SubmitCompDto=a;class UpdateCompDto extends a{}i([(0,o.ApiProperty)({required:true,description:"组件id",example:"123"}),s("design:type",String)],UpdateCompDto.prototype,"compId",void 0);r.UpdateCompDto=UpdateCompDto;class DownloadCompDto extends CompIdDto{}i([(0,o.ApiProperty)({required:true,description:"组件下载路径",example:"/src/components/MyComp"}),s("design:type",String)],DownloadCompDto.prototype,"savePath",void 0);i([(0,o.ApiProperty)({required:false,description:"是否覆盖",example:true}),s("design:type",Boolean)],DownloadCompDto.prototype,"isCover",void 0);i([(0,o.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),s("design:type",String)],DownloadCompDto.prototype,"compName",void 0);i([(0,o.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),s("design:type",String)],DownloadCompDto.prototype,"version",void 0);r.DownloadCompDto=DownloadCompDto;class CompFilesOssSignedUrlDto{}i([(0,o.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),s("design:type",String)],CompFilesOssSignedUrlDto.prototype,"compName",void 0);i([(0,o.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),s("design:type",String)],CompFilesOssSignedUrlDto.prototype,"version",void 0);i([(0,o.ApiProperty)({required:true,description:"对象存储id",example:"123"}),s("design:type",String)],CompFilesOssSignedUrlDto.prototype,"objectId",void 0);i([(0,o.ApiProperty)({required:true,description:"组件文件路径",example:"MyComp/index.vue"}),s("design:type",Array)],CompFilesOssSignedUrlDto.prototype,"files",void 0);r.CompFilesOssSignedUrlDto=CompFilesOssSignedUrlDto},17583:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.SignedUrlDto=void 0;const o=n(66466);const a=n(30794);class SignedUrlDto{}i([(0,a.Rule)(a.RuleType.string().required().error(new Error("对象id不能为空"))),(0,o.ApiProperty)({example:"xcxcxdas",description:"对象id",required:true}),s("design:type",String)],SignedUrlDto.prototype,"objectId",void 0);r.SignedUrlDto=SignedUrlDto},33988:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.VueFinderIndexDto=void 0;const o=n(66466);class VueFinderIndexDto{}i([(0,o.ApiProperty)({required:true,description:"文件路径"}),s("design:type",String)],VueFinderIndexDto.prototype,"path",void 0);i([(0,o.ApiProperty)({required:true,description:"查询关键词"}),s("design:type",String)],VueFinderIndexDto.prototype,"q",void 0);r.VueFinderIndexDto=VueFinderIndexDto},66792:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.BadRequestErrorFilter=void 0;const s=n(45573);const o=n(10839);let a=class BadRequestErrorFilter{async catch(e,r){r.logger.error("BadRequestError==>",e);return o.resUtil.error(e.message,e.status)}};a=i([(0,s.Catch)(s.httpError.BadRequestError)],a);r.BadRequestErrorFilter=a},16313:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.DefaultErrorFilter=void 0;const s=n(45573);let o=class DefaultErrorFilter{async catch(e,r){try{r.logger.error("remote server request error:",e);const n=JSON.parse(e.message);return{...n}}catch(n){r.logger.error(e)}return{code:e.status??500,message:e.message}}};o=i([(0,s.Catch)()],o);r.DefaultErrorFilter=o},53441:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.NotFoundFilter=void 0;const s=n(45573);let o=class NotFoundFilter{async catch(e,r){r.redirect("/404.html")}};o=i([(0,s.Catch)(s.httpError.NotFoundError)],o);r.NotFoundFilter=o},60137:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.Configuration=void 0;var o=n(85903);Object.defineProperty(r,"Configuration",{enumerable:true,get:function(){return o.MainConfiguration}});s(n(51466),r);s(n(74761),r);s(n(96878),r);s(n(44348),r);s(n(40934),r);s(n(62002),r);s(n(10839),r);s(n(5808),r);s(n(82919),r);s(n(50849),r);s(n(3574),r);s(n(66404),r);s(n(91557),r);s(n(81179),r);s(n(69322),r);s(n(4019),r);s(n(17583),r);s(n(33988),r);s(n(66792),r);s(n(16313),r);s(n(53441),r);s(n(87135),r);s(n(61667),r);s(n(39718),r);s(n(93305),r);s(n(56491),r);s(n(15766),r);s(n(64648),r);s(n(66959),r);s(n(8492),r);s(n(87360),r);s(n(35505),r);s(n(99579),r);s(n(25147),r);s(n(15199),r);s(n(10954),r);s(n(39565),r);s(n(30765),r);s(n(33845),r);s(n(2809),r)},87135:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},61667:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},39718:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.ReportMiddleware=void 0;const s=n(45573);let o=class ReportMiddleware{resolve(){return async(e,r)=>{const n=Date.now();const i=await r();e.logger.debug(`rt = ${Date.now()-n}ms`);return i}}static getName(){return"report"}};o=i([(0,s.Middleware)()],o);r.ReportMiddleware=o},93305:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.TokenMiddleware=void 0;const s=n(45573);const o=n(10954);let a=class TokenMiddleware{resolve(){return async(e,r)=>{(0,o.setHeader)(e.header);await r()}}static getName(){return"token"}};a=i([(0,s.Middleware)()],a);r.TokenMiddleware=a},56491:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.CompService=void 0;const o=n(45573);const a=n(16928);const c=n(79896);const u=n(15766);const p=n(25147);const g=n(99579);const v=n(15199);const b=n(5808);const _=n(51466);const E=n(96878);const x=n(66959);const T=n(64648);const w=n(70857);const C=n(72136);let A=class CompService{async getCompDir(e){const{srcPath:r}=this.configService.comphubConfig();const n=b.default.FILE_MANAGER_DIRNAME;const i=a.join(e.replace(n.dirname,`${r}${a.sep}`));const s=await(0,p.readFileTree)(i);return s}async getCompFile(e){const r=await c.promises.readFile(e,"utf-8");return r}getCompFullPath(e){const{srcPath:r}=this.configService.comphubConfig();const n=b.default.FILE_MANAGER_DIRNAME;e=e.replace(n.dirname,"");const i=a.join(r,e);return i}checkCompEntryIndex(e){const r=this.getCompFullPath(e);const n=a.join(r,"index.vue");if(!c.existsSync(n)){return false}return true}checkCompJson(e){const r=this.getCompFullPath(e);const n=a.join(r,"comp.json");if(!c.existsSync(n)){return false}return true}checkCompJsonFormat(e){const r=b.default.COMP_DEFAULT_FIELD;const n=Object.keys(e);const i=r.every((e=>{if(e.required){return n.includes(e.name)}else{return true}}));if(!i){return false}const s=(0,p.validateVersion)(e.version);return s}async checkCompConfig(e){const r=a.basename(e);const n=this.checkCompEntryIndex(e);const i=this.checkCompJson(e);const s={entryIndex:n?a.join(r,"index.vue"):"",compHash:i?a.join(r,"comp.json"):"",compJsonIsOk:""};const o=this.getCompFullPath(e);const c=a.join(o,"comp.json");await this.getCompFile(c).then((e=>{const r=JSON.parse(e);const n=this.checkCompJsonFormat(r);s.compJsonIsOk=n?e:""})).catch((e=>{this.ctx.logger.error("读取comp.json文件失败",e);s.compJsonIsOk=""}));return s}async updateCompVersion(e,r){const n=(0,p.validateVersion)(r);if(!n){throw new o.httpError.BadRequestError("版本号格式错误")}const i=this.getCompFullPath(e);const s=a.join(i,"comp.json");const u=await this.getCompFile(s);const g=JSON.parse(u);g.version=r;const v=JSON.stringify(g,null,2);await c.promises.writeFile(s,v)}async updateCompJson(e,r){const n=this.getCompFullPath(e);const i=a.join(n,"comp.json");const s=await this.getCompFile(i);const o=r(JSON.parse(s));await c.promises.writeFile(i,JSON.stringify(o,null,4))}async readCompVersion(e){const r=this.getCompFullPath(e);const n=a.join(r,"comp.json");const i=await this.getCompFile(n);const s=JSON.parse(i);return s.version}async getCompSize(e){const r=this.getCompFullPath(e);const n=await(0,p.dirSize)(r);return n}initCompJson(){const e=b.default.COMP_DEFAULT_FIELD;return e.reduce(((e,r)=>{const n={};if(r.required){n[r.name]=r.default}return{...e,...n}}),{})}async generateCompJson(e){const r=this.getCompFullPath(e);const n=this.checkCompJson(e);if(n){throw new o.httpError.BadRequestError("组件已存在comp.json文件")}const i=a.basename(r);const s=this.initCompJson();s.name=i;await c.promises.writeFile(a.join(r,"comp.json"),JSON.stringify(s,null,4))}async getCompDep(e){const{cwd:r}=this.configService.comphubConfig();const n=this.getCompFullPath(e);const i=await(0,v.getModuleEntry)(n,r);return i}async preBuildAll(e){const{cwd:r}=this.configService.comphubConfig();const n=this.app.getConfig("PREBUILD_MODULE_DIR");const i=a.join(r,n);const s=await(0,v.prebundleAll)(i,e,r);return s}async uploadFolderToOss({compFullPath:e,version:r,ossData:n}){const i=a.basename(e);const s=await(0,p.readDirRecursively)(e);const o=s.map((r=>{const n=c.statSync(r).size;const i=r.replace(e,"");return{filePath:i,fileFullPath:r,size:n}}));o.sort(((e,r)=>r.size-e.size));let u="";let g="";const v=[];for(let e=0;e<o.length;e++){const{filePath:s,fileFullPath:p}=o[e];const b={...n,key:a.join(n.key,i,r,s).replaceAll(a.sep,"/")};const _=c.createReadStream(p);try{await this.ossService.uploadFileToOss(b,_);v.push(b.key)}catch(e){g=s;u=e.message;break}}if(u){if(v.length){console.log("已经上传完成的文件:",v)}if(u.includes("Your proposed upload exceeds the maximum allowed size")){throw new Error(`组件上传失败,文件${g}大小超过限制`)}throw new Error(u)}}async getCompHashMap(e){const r=await this.hashService.getDirHashList(e);r.forEach((r=>{r.path=r.path.replace(e,"").replaceAll(a.sep,"/")}));const n=r.filter((e=>e.path!=="/comp.json"));const i=n.map((e=>`${e.path}=${e.hash}`)).join(";");return{fileHashList:n,compHash:(0,g.getStringHash)(i)}}async checkCompByFuzzyHash(e){const r=this.getCompFullPath(e);const n=await this.getCompHashMap(r);return n}async checkCompRepeat(e){const r=this.getCompFullPath(e);const n=await this.getCompHashMap(r);const i=await(0,_.compcontrollerCheckcompexistbyhash)({...n}).catch((e=>{throw new Error(e)}));return i.data}async submitComp(e){const{compPath:r,dep:n,previewConfigs:i,desc:s,bgColor:u,allowRepeat:g}=e;const v=this.getCompFullPath(r);const x=await this.getCompHashMap(v);const T=this.checkCompEntryIndex(r);if(!T){throw new o.httpError.BadRequestError("组件入口文件不存在")}const w=a.basename(v);const C=await(0,p.readDirRecursively)(v);const A=await this.getCompSize(r);const{totalSize:k,totalNum:P}=b.default.COMP_SUBMIT_FILE_CHECKING;if(C.length>P){throw new o.httpError.BadRequestError(`组件提交文件数量超过限制${P}个`)}if(A>k){throw new o.httpError.BadRequestError(`组件提交文件大小超过限制${Math.floor(k/1024/1024)}MB`)}const I=await this.readCompVersion(r);const R=C.map((e=>({name:a.basename(e),size:c.statSync(e).size,path:e.replace(v,"").replaceAll(a.sep,"/")})));const N=await(0,_.compcontrollerUpload)({name:w,dep:n,previewConfigs:i,desc:s,version:I,size:await this.getCompSize(r),files:R,bgColor:u,hashMap:x,allowRepeat:g}).catch((e=>{throw new Error(e)}));const L=N.data._id;await this.updateCompJson(r,(e=>({...e,name:w,__id__:L})));const B=await(0,E.osscontrollerCompossdir)().catch((e=>{throw new Error(e)}));const{componentDir:j}=B.data;const U=await(0,E.osscontrollerPutpolicy)({type:j}).catch((async e=>{await(0,_.compcontrollerDelete)({compId:L}).catch((()=>{throw new Error(e)}));throw new Error(e)}));await this.uploadFolderToOss({compFullPath:v,version:I,ossData:U.data}).catch((async e=>{await(0,_.compcontrollerDelete)({compId:L}).catch((e=>{throw new Error(e)}));throw new o.httpError.BadRequestError(e)}));const{key:q}=U.data;await(0,_.compcontrollerUpdateobjectid)({compId:L,objectId:`${j}${q}`}).catch((async e=>{await(0,_.compcontrollerDelete)({compId:L}).catch((e=>{throw new Error(e)}));throw new Error(e)}))}async updateComp(e){const{compId:r,compPath:n,dep:i,previewConfigs:s,desc:u,bgColor:g}=e;const v=this.getCompFullPath(n);const b=await this.getCompHashMap(v);const x=this.checkCompEntryIndex(n);if(!x){throw new o.httpError.BadRequestError("组件入口文件不存在")}const T=await(0,_.compcontrollerInfobyid)({compId:r}).catch((e=>{throw new Error(e)}));const{objectId:w,version:C}=T.data;const A=a.basename(v);const k=await this.readCompVersion(n);const P=await(0,p.readDirRecursively)(v);const I=P.map((e=>({name:a.basename(e),size:c.statSync(e).size,path:e.replace(v,"").replaceAll(a.sep,"/")})));const R=await(0,_.compcontrollerUpdate)({compId:r,name:A,dep:i,previewConfigs:s,desc:u,version:k,size:await this.getCompSize(n),files:I,bgColor:g,hashMap:b}).catch((e=>{throw new Error(e)}));const{isFileChange:N}=R.data;if(!N&&C===k){return}const L=await(0,E.osscontrollerCompossdir)().catch((e=>{throw new Error(e)}));const{componentDir:B}=L.data;const j=await(0,E.osscontrollerPutpolicy)({type:B}).catch((e=>{throw new Error(e)}));const U={...j.data,key:w.replace(j.data.dir,"")};await this.uploadFolderToOss({compFullPath:v,version:k,ossData:U}).catch((async e=>{throw new o.httpError.BadRequestError(e)}));await this.updateCompJson(n,(e=>({...e,name:A,__id__:r})))}async downloadComp(e){const{compId:r,savePath:n,isCover:i,compName:s,version:o}=e;const{srcPath:u}=this.configService.comphubConfig();const g=n.replace(b.default.FILE_MANAGER_DIRNAME.dirname,"").replace(/[/\\]/g,a.sep);const v=a.join(u,g,s);if(!i&&c.existsSync(v)){return{isRepeat:true}}const E=w.tmpdir();this.ctx.logger.debug("临时文件夹",E);const x=a.join(E,b.default.COMP_TEMP_DIR);const T=await(0,_.compcontrollerInfobyid)({compId:r,version:o}).catch((e=>{throw new Error(e)}));const{files:A,objectId:k}=T.data;const P=a.join(x,k,s,o);const{files:I}=await(0,p.readDirRecursively)(P).then((e=>({files:e}))).catch((()=>({files:[]})));if(A.length===I.length){await C.copy(P,v);this.ctx.logger.debug("组件缓存文件和服务器文件一致,直接复制缓存文件");return}const R=await(0,_.compcontrollerDownload)({compId:r,version:o}).catch((e=>{throw new Error(e)}));const{files:N,version:L,compName:B}=R.data;const j=N.map((e=>{const r=a.join(k,B,L,e.path);return{path:r.replace(/[/\\]/g,"/")}}));const U=await this.ossService.getDownloadSts();await this.ossService.downloadFileToPath(U,j,x);const q=a.join(x,k,B,L);await C.copy(q,v)}async findCompJsonPath(e){const r=await(0,p.readDirRecursively)(e);this.ctx.logger.debug("项目文件数量:",r.length);const n=r.filter((e=>e.endsWith("comp.json")));return n}async getCompById(e){const{srcPath:r}=this.configService.comphubConfig();this.ctx.logger.debug("srcPath",r);const n=await this.findCompJsonPath(r);this.ctx.logger.debug("组件文件数量:",n.length);const i=n.map((async e=>{const r=await c.promises.readFile(e,"utf8");const n=JSON.parse(r);return{...n,path:a.dirname(e)}}));const s=await Promise.all(i);const o=s.find((r=>r.__id__===e));if(!o){return null}this.ctx.logger.debug("compFile:",o);const u=b.default.FILE_MANAGER_DIRNAME.dirname;const escapeRegExp=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");const p={path:u+o.path.replace(r,"").replace(new RegExp(escapeRegExp(a.sep),"g"),"/").slice(1),dirname:u,basename:a.basename(o.path)};return p}async getCompFilesOssSignedUrl(e){const{compName:r,version:n,objectId:i,files:s}=e;const o=await this.ossService.getDownloadSts();const c=s.map((async e=>{const s=a.join(i,r,n,e);const c=await this.ossService.getFilePreviewUrl(o,s.replace(/[/\\]/g,"/"));return{path:e,signedUrl:c}}));const u=await Promise.all(c);return{signedUrls:u}}async getPackageJsonContent(){const e=this.configService.comphubConfig();return(0,v.getPackageJson)(e.cwd)}};i([(0,o.App)(),s("design:type",Object)],A.prototype,"app",void 0);i([(0,o.Inject)(),s("design:type",u.ConfigService)],A.prototype,"configService",void 0);i([(0,o.Inject)(),s("design:type",x.OssService)],A.prototype,"ossService",void 0);i([(0,o.Inject)(),s("design:type",T.HashService)],A.prototype,"hashService",void 0);i([(0,o.Inject)(),s("design:type",Object)],A.prototype,"ctx",void 0);A=i([(0,o.Provide)()],A);r.CompService=A},15766:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.ConfigService=void 0;const o=n(45573);const a=n(16928);let c=class ConfigService{comphubConfig(){const e=this.app.getAttr("comphubConfig");return e}otherConfig(){return{pathSeparator:a.sep}}};i([(0,o.App)(),s("design:type",Object)],c.prototype,"app",void 0);c=i([(0,o.Provide)()],c);r.ConfigService=c},64648:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.HashService=void 0;const o=n(45573);const a=n(25147);const c=n(99579);const u=n(39565);let p=class HashService{async getDirHashList(e){const r=await(0,a.readDirRecursively)(e);const n=await Promise.all(r.map((async e=>{const{hash:r,fileContent:n}=await(0,c.getFileHash)(e);const i={path:e,hash:r};if(e.endsWith(".vue")){const e=await(0,u.vueSyntaxString)(n);i.fuzzyHash=await(0,c.getStringFuzzyHash)(e);i.blockSize=parseInt(i.fuzzyHash.split(":")[0],10);i.prefix=i.fuzzyHash.split(":")[1].slice(0,16)}return i})));const i=[...n].sort(((e,r)=>e.path.localeCompare(r.path)));return i}};i([(0,o.App)(),s("design:type",Object)],p.prototype,"app",void 0);p=i([(0,o.Provide)()],p);r.HashService=p},66959:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.OssService=void 0;const o=n(45573);const a=n(96454);const c=n(87269);const u=n(25147);const p=n(14391);const g=n(16928);const v=n(79896);const b=n(16378);const _=n(5808);const E=n(96878);const x=n(22296);const T=n(3706);let w=class OssService{async getDownloadSts(){const e=await this.cache.get(_.default.CACHE_KEY.STS_TOKEN);if(e){return e}const r=await(0,E.osscontrollerGetsts)().catch((e=>{throw new Error(e)}));const n=new Date(r.data.Expiration).getTime()-1*60*1e3;await this.cache.set(_.default.CACHE_KEY.STS_EXPIRE_TIME,n);const i=n-Date.now();this.ctx.logger.debug("STS过期时间",T(n).format("YYYY-MM-DD HH:mm:ss"));this.cache.set(_.default.CACHE_KEY.STS_TOKEN,r.data,i);return r.data}createOssClient(e){const r={endpoint:_.default.OSS_CUSTOM_DOMAIN,authorizationV4:true,cname:true,...e};return new p(r)}createOssFormData(e,r){const n=new a;const i=e.dir+e.key;n.append("success_action_status","200");n.append("policy",e.policy);n.append("x-oss-signature",e.signature);n.append("x-oss-signature-version",e.x_oss_signature_version);n.append("x-oss-credential",e.x_oss_credential);n.append("x-oss-date",e.x_oss_date);n.append("key",i);n.append("x-oss-security-token",e.security_token);n.append("x-oss-forbid-overwrite","true");n.append("Cache-Control","public, max-age=31536000");n.append("file",r);return{host:e.host,filePath:i,formData:n}}async uploadFileToOss(e,r){const{host:n,formData:i}=this.createOssFormData(e,r);const s=await c.default.post(n,i,{headers:{...i.getHeaders()}}).catch((async e=>{const r=e.response.data;const n=await(0,u.parseXml)(r).catch((()=>{throw new Error("解析xml失败")}));if(n?.Error){throw new Error(n.Error.Message)}throw new Error("组件上传失败")}));if(s.status!==200){throw new Error(s.data)}}async downloadFileToPath(e,r,n){const i=this.createOssClient({region:e.region,accessKeyId:e.AccessKeyId,accessKeySecret:e.AccessKeySecret,stsToken:e.SecurityToken,bucket:e.bucket,refreshSTSToken:async()=>{const e=await this.getDownloadSts();return{accessKeyId:e.AccessKeyId,accessKeySecret:e.AccessKeySecret,stsToken:e.SecurityToken}}});const s=r.map((async e=>{const{path:r}=e;const s=g.join(n,r);const o=g.dirname(s);if(!v.existsSync(o)){v.mkdirSync(o,{recursive:true})}return await i.get(r,s)}));return await Promise.all(s)}async getFilePreviewUrl(e,r){const n=x(r);const i=await this.cache.get(_.default.CACHE_KEY.STS_EXPIRE_TIME);const s=await this.cache.get(n);const o=Math.floor((Number(i)-Date.now())/1e3);if(s&&o>0){return s}const a=this.createOssClient({region:e.region,accessKeyId:e.AccessKeyId,accessKeySecret:e.AccessKeySecret,stsToken:e.SecurityToken,bucket:e.bucket,refreshSTSToken:async()=>{const e=await this.getDownloadSts();return{accessKeyId:e.AccessKeyId,accessKeySecret:e.AccessKeySecret,stsToken:e.SecurityToken}}});this.ctx.logger.debug("文件地址过期时间:",o,"秒",Math.floor(o/60),"分钟");const c=a.signatureUrl(r,{expires:o});await this.cache.set(n,c,o*1e3);this.ctx.logger.debug("缓存预览URL",r);return c}};i([(0,o.Inject)(),s("design:type",Object)],w.prototype,"ctx",void 0);i([(0,o.InjectClient)(b.CachingFactory,"default"),s("design:type",Object)],w.prototype,"cache",void 0);w=i([(0,o.Provide)()],w);r.OssService=w},8492:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.TerminalService=void 0;const o=n(45573);const a=n(35317);const c=n(15766);const u=n(9367);const p=n(20629);const g=n(73024);const v=n(51455);const b=n(25147);const _=n(67855);let E=class TerminalService{constructor(){this.subprocess=null;this.cwd="";this.tabIndex=0}getPrompt(){return`${this.cwd}`}smartDecode(e){if(!e||e.length===0)return"";const r=p.detect(e)||"gbk";return u.decode(e,r)}async shutdown(e=5e3){const r=this.subprocess;if(!r||r.killed){this.ctx.emit("output",{cwd:this.getPrompt()});return}return new Promise((n=>{let i=false;const done=()=>{if(!i){i=true;n(0)}};r.once("exit",done);_(r.pid,"SIGTERM",(e=>{if(e){this.ctx.emit("output",{err:e.message})}}));const s=setTimeout((()=>{_(r.pid,"SIGKILL",(e=>{if(e){this.ctx.emit("output",{err:e.message})}done()}))}),e);r.once("exit",(()=>clearTimeout(s)))}))}async folderExists(e){try{await(0,v.access)(e,g.constants.F_OK|g.constants.R_OK);return true}catch{return false}}async execCmd({cwd:e,oldCwd:r,command:n}){if(!await this.folderExists(e)){this.ctx.emit("output",{err:`${e} 路径不存在`});this.ctx.emit("output",{cwd:r});return}this.cwd=e;if(!n.trim()){this.ctx.emit("output",{cwd:this.getPrompt()});return}if(n==="^C"){await this.shutdown();return}this.subprocess=(0,a.spawn)(n,{shell:true,cwd:e,stdio:["pipe","pipe","pipe"]});this.subprocess.stdout.on("data",(e=>{this.ctx.emit("output",{stdout:this.smartDecode(e)})}));this.subprocess.stderr.on("data",(e=>{this.ctx.emit("output",{stderr:this.smartDecode(e)})}));this.subprocess.on("close",((e,r)=>{this.subprocess=null;this.ctx.emit("output",{cwd:this.getPrompt(),command:n})}));this.subprocess.on("error",(e=>{this.ctx.emit("output",{err:e.message})}))}async cmdTab({cwd:e,lastWord:r}){let n=await(0,b.readDirFiles)(e);if(r){n=n.filter((e=>e.name.startsWith(r)))}if(n.length===0){return}this.tabIndex=(this.tabIndex+1)%n.length;const i=n[this.tabIndex];this.ctx.emit("output",{tab:i.name})}};i([(0,o.Inject)(),s("design:type",c.ConfigService)],E.prototype,"configService",void 0);i([(0,o.Inject)(),s("design:type",Object)],E.prototype,"ctx",void 0);E=i([(0,o.Provide)()],E);r.TerminalService=E},87360:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.VuefinderService=void 0;const o=n(45573);const a=n(16928);const c=n(79896);const u=n(5808);const p=n(15766);let g=class VuefinderService{async getVuefinder(e,r){const n=u.default.FILE_MANAGER_DIRNAME;const{srcPath:i}=this.configService.comphubConfig();const s=e||n.dirname;if(e){e=e.replace(n.dirname,`${i}${a.sep}`)}const o=e||i;const p=await c.promises.readdir(o);const g=p.map((async e=>{const r=a.join(o,e);const i=await c.promises.stat(r);const u=s===n.dirname?`${s}${e}`:`${s}/${e}`;return{type:i.isDirectory()?"dir":"file",path:u,visibility:"public",last_modified:Math.floor(i.mtimeMs/1e3),extra_metadata:[],basename:e,file_size:i.size,extension:a.extname(e).slice(1),storage:n.storages[0],dirname:n.dirname}}));const v=await Promise.all(g);v.sort(((e,r)=>{if(e.type!==r.type){return e.type==="dir"?-1:1}return e.basename.localeCompare(r.basename)}));if(r==="index"){return{adapter:n.adapter,storages:n.storages,dirname:s,files:[...v]}}else if(r==="subfolders"){const e=v.filter((e=>e.type==="dir")).map((e=>({adapter:n.adapter,path:e.path,basename:e.basename})));return e}}};i([(0,o.App)(),s("design:type",Object)],g.prototype,"app",void 0);i([(0,o.Inject)(),s("design:type",p.ConfigService)],g.prototype,"configService",void 0);g=i([(0,o.Provide)()],g);r.VuefinderService=g},35505:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.TerminalSocketController=void 0;const o=n(45573);const a=n(8492);let c=class TerminalSocketController{async onConnection(){this.ctx.logger.debug(`新客户端连接:${this.ctx.id}`)}async onDisConnection(){this.ctx.logger.debug(`客户端断开连接:${this.ctx.id}`);await this.terminalService.shutdown()}async onCommand(e){this.terminalService.execCmd(e)}async onTab(e){this.terminalService.cmdTab(e)}};i([(0,o.Inject)(),s("design:type",Object)],c.prototype,"ctx",void 0);i([(0,o.Inject)(),s("design:type",a.TerminalService)],c.prototype,"terminalService",void 0);i([(0,o.OnWSConnection)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],c.prototype,"onConnection",null);i([(0,o.OnWSDisConnection)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],c.prototype,"onDisConnection",null);i([(0,o.OnWSMessage)("command"),s("design:type",Function),s("design:paramtypes",[Object]),s("design:returntype",Promise)],c.prototype,"onCommand",null);i([(0,o.OnWSMessage)("tab"),s("design:type",Function),s("design:paramtypes",[Object]),s("design:returntype",Promise)],c.prototype,"onTab",null);c=i([(0,o.WSController)("/terminal")],c);r.TerminalSocketController=c},99579:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.getStringFuzzyHash=r.getStringHash=r.getFileHash=void 0;const i=n(79896);const s=n(76982);const o=n(93177);async function getFileHash(e,r="sha256"){try{const n=await i.promises.readFile(e,"utf8");return{hash:(0,s.createHash)(r).update(n).digest("hex"),fileContent:n}}catch(r){console.error(`计算文件哈希失败: ${e}`,r.message);return null}}r.getFileHash=getFileHash;function getStringHash(e,r="sha256"){return(0,s.createHash)(r).update(e).digest("hex")}r.getStringHash=getStringHash;function getStringFuzzyHash(e){return o.digest(e)}r.getStringFuzzyHash=getStringFuzzyHash},25147:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.readPackageJson=r.getVueVersion=r.readDirFiles=r.parseXml=r.calculateHash=r.validateVersion=r.dirSize=r.readFileTree=r.readDirRecursively=void 0;const i=n(79896);const s=n(16928);const o=n(76982);const a=n(758).parseString;async function readDirRecursively(e,r){const defaultFilter=(e,r)=>!(r.isDirectory()&&r.name==="node_modules");const n=r??defaultFilter;async function walk(e,r){const o=await i.promises.readdir(e,{withFileTypes:true});await Promise.all(o.map((async i=>{const o=s.resolve(e,i.name);const a=await n(o,i);if(!a)return;if(i.isDirectory()){await walk(o,r)}else if(i.isFile()){r.push(o)}})))}const o=[];await walk(e,o);return o}r.readDirRecursively=readDirRecursively;async function readFileTree(e){const r=await i.promises.stat(e);if(!r.isDirectory()){throw new Error(`${e} is not a directory`)}async function buildFileTree(e){const r=s.basename(e);const n=await i.promises.stat(e);if(!n.isDirectory()){return{name:r,path:e,type:"file"}}const o={name:r,path:e,type:"directory",children:[]};const a=await i.promises.readdir(e,{withFileTypes:true});for(const r of a){const n=s.join(e,r.name);const i=await buildFileTree(n);o.children.push(i)}return o}return buildFileTree(e)}r.readFileTree=readFileTree;async function dirSize(e){let r=0;const n=await i.promises.readdir(e,{withFileTypes:true});await Promise.all(n.map((async n=>{const o=s.join(e,n.name);if(n.isDirectory()){r+=await dirSize(o)}else{r+=(await i.promises.stat(o)).size}})));return r}r.dirSize=dirSize;function validateVersion(e){const r=/^\d+\.\d+\.\d+$/;return r.test(e)}r.validateVersion=validateVersion;function calculateHash(e){return(0,o.createHash)("sha256").update(e).digest("hex").slice(0,8)}r.calculateHash=calculateHash;function parseXml(e){return new Promise(((r,n)=>{a(e,((e,i)=>{if(e){n(e);return}r(i)}))}))}r.parseXml=parseXml;async function readDirFiles(e){const r=await i.promises.readdir(e,{withFileTypes:true});return r.map((e=>({...e,type:e.isDirectory()?"directory":"file"})))}r.readDirFiles=readDirFiles;function getVueVersion(e){if(e.startsWith("2")||e.startsWith("~2")||e.startsWith("^2")){return 2}if(e.startsWith("3")||e.startsWith("~3")||e.startsWith("^3")){return 3}throw new Error("vue版本错误")}r.getVueVersion=getVueVersion;async function readPackageJson(e){const r=await i.promises.readFile(e,"utf8");const n=JSON.parse(r);return n}r.readPackageJson=readPackageJson},15199:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.prebundleAll=r.getModuleEntry=r.getPackageJson=void 0;const i=n(30765);const s=n(16928);const o=n(79896);const a=n(64713);const c=n(25147);const u=n(45573);function findModuleVersion(e,r){if(e.dependencies&&e.dependencies[r]){return e.dependencies[r]}if(e.devDependencies&&e.devDependencies[r]){return e.devDependencies[r]}return null}async function getPackageJson(e){const r=s.join(e,"package.json");return(0,c.readPackageJson)(r)}r.getPackageJson=getPackageJson;async function getModuleEntry(e,r){const n=await getPackageJson(r);const s=findModuleVersion(n,"vue");const o=await(0,i.detectImports)(e,["@"],s);const a=o.thirdParty;if(!a["vue"]){a["vue"]={default:false}}for(const e in a){a[e].version=findModuleVersion(n,e)}return o}r.getModuleEntry=getModuleEntry;async function prebundleAll(e,r,n){const i=await getPackageJson(n);const p=r.reduce(((e,r)=>{const n=findModuleVersion(i,r);if(!n){return e}if(r==="vue"){const i=(0,c.getVueVersion)(n);if(i===3){e[r]="vue/dist/vue.esm-bundler.js"}else{e[r]=r}}else{e[r]=r}return e}),{});await o.promises.mkdir(e,{recursive:true});const g={entryPoints:p,bundle:true,format:"esm",splitting:true,outdir:e,entryNames:"[name]-[hash]",chunkNames:"chunk-[hash]",outExtension:{".js":".js"},metafile:true,write:true,target:"esnext",sourcemap:false};if(process.env.NODE_ENV==="local"){const e=(0,u.getCurrentApplicationContext)();const r=await e.getAsync("configService");const{cwd:n}=r.comphubConfig();g.absWorkingDir=n;g.nodePaths=[s.join(n,"node_modules")]}try{const e=await(0,a.build)(g);const r={};for(const[n,i]of Object.entries(e.metafile.outputs)){if(i.entryPoint){const e=Object.keys(p);const i=e.find((e=>n.includes(e)));r[i]=s.basename(n)}}return{entryNameToFile:r}}catch(e){return{error:String(e)}}}r.prebundleAll=prebundleAll},10954:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.setHeader=void 0;const i=n(87269);let s=null;const setHeader=e=>{s=e};r.setHeader=setHeader;const o=i.default.create({timeout:1e4});o.interceptors.request.use((e=>{e.headers["authorization"]=s.authorization;e.headers["x-csrf-token"]=s["x-csrf-token"];e.headers["cookie"]=s.cookie;return e}),(e=>Promise.reject(e)));o.interceptors.response.use((async e=>{if(e.data.code!==0){return Promise.reject(JSON.stringify(e.data))}return e.data}),(e=>Promise.reject(e)));r["default"]=o},39565:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.vueSyntaxString=void 0;const i=n(81192);const s=n(91489);const o=n(5429);const a=n(50148);const c=n(12123);const u=n(4145);function getAst(e){const r=(0,o.parse)(e,{sourceType:"module",errorRecovery:true,plugins:["typescript","jsx"]});(0,a.default)(r,{VariableDeclaration(e){if(e.node.declarations.length<=1)return;const{kind:r,declarations:n}=e.node;e.replaceWithMultiple(n.map((e=>({type:"VariableDeclaration",kind:r,declarations:[e]}))))}});return r}function getBindingNames(e){const r=[];const walk=e=>{if(e.type==="Identifier")r.push(e.name);if(e.type==="ArrayPattern")e.elements.forEach(walk);if(e.type==="ObjectPattern")e.properties.forEach((e=>walk(e.key||e.value)));if(e.type==="RestElement")walk(e.argument);if(e.type==="AssignmentPattern")walk(e.left)};walk(e);return r}function removeUnusedVariables(e){const r=new Set;(0,a.default)(e,{ReferencedIdentifier(e){r.add(e.node.name)}});(0,a.default)(e,{VariableDeclarator(e){const n=getBindingNames(e.node.id);if(n.length&&!n.some((e=>r.has(e)))){e.remove()}},FunctionDeclaration(e){if(e.node.id&&!r.has(e.node.id.name)){e.remove()}}})}function renameVariables(e){let r=0;const n=new Map;(0,a.default)(e,{Identifier(e){const{node:i,parent:s}=e;if(s.type==="VariableDeclarator"&&s.id===i||s.type==="FunctionDeclaration"&&s.id===i){if(!n.has(i.name))n.set(i.name,`v${r++}`);i.name=n.get(i.name)}if(n.has(i.name))i.name=n.get(i.name)},NumericLiteral(e){e.node.value=0},StringLiteral(e){e.node.value="S"},ObjectExpression(e){e.node.properties.forEach((e=>{if(e.type==="ObjectProperty"&&!e.computed&&(e.key.type==="StringLiteral"||e.key.type==="NumericLiteral")){e.key.type="StringLiteral";e.key.value="S"}}))}})}async function processVueTemplate(e){const r=await(0,u.minify)(e,{removeComments:true,collapseWhitespace:true,removeEmptyElements:false,caseSensitive:true,trimCustomFragments:true});const{code:n}=(0,i.compileTemplate)({source:r,filename:"component.vue",id:"template"});return n.replace(/\s+/g," ").trim()}async function vueSyntaxString(e){let r="";const{descriptor:n}=(0,i.parse)(e);const o=n.script||n.scriptSetup;if(!o)return r;const a=await(0,s.minify)(o.content);if(!a.code)return r;const u=getAst(a.code);removeUnusedVariables(u);renameVariables(u);const{code:p}=(0,c.default)(u,{comments:false});r+=p.replace(/\s+/g," ").trim();if(n.template){const e=await processVueTemplate(n.template.content);r+=e}return r}r.vueSyntaxString=vueSyntaxString},30765:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.detectImports=void 0;const i=n(16928);const s=n(79896);const o=n(5429);const a=n(81192);const c=n(50148);const u=n(98995);const p=n(25147);const isBuiltin=e=>u.builtinModules.includes(e)||u.builtinModules.includes(`node:${e}`);const getUIlibsNameByTag=(e,r)=>{const n=[];for(const i of e){if(i.startsWith("el-")){const e=(0,p.getVueVersion)(r);if(e===2){n.push("element-ui")}else if(e===3){n.push("element-plus")}}}return n};const walk=(e,r=new Set)=>{if(!e)return r;if(e.type===1){const n=e.tag;if(/^[a-z]/.test(n)&&n.includes("-")){r.add(n)}if(e.children&&e.children.length){e.children.forEach((e=>walk(e,r)))}}if(e.children&&e.children.length){e.children.forEach((e=>walk(e,r)))}return r};const collectTargetFiles=async(e,r=[".js",".ts",".vue"])=>{const n=[];const walk=async e=>{const o=await s.promises.readdir(e,{withFileTypes:true});for(const s of o){const o=i.join(e,s.name);if(s.isDirectory())await walk(o);else if(r.some((e=>s.name.endsWith(e))))n.push(o)}};await walk(e);return n};const readCode=async e=>{try{const r=await s.promises.readFile(e,"utf8");if(e.endsWith(".vue")){const{descriptor:e}=(0,a.parse)(r);const n=e.scriptSetup?.content??e.script?.content??null;const i=e?.template??null;return{script:n,template:i}}return{script:r}}catch{return null}};const extractDetailsFromSpecifiers=(e,r)=>{const n={default:false,named:[],namespace:false,files:[r]};e.forEach((e=>{switch(e.type){case"ImportDefaultSpecifier":n.default=true;break;case"ImportNamespaceSpecifier":n.namespace=true;break;case"ImportSpecifier":{const r=e.imported.type==="Identifier"?e.imported.name:e.imported.value;if(!n.named.includes(r))n.named.push(r);break}}}));return n};const getImportType=(e,r)=>{if(e.startsWith("./")||e.startsWith("../"))return"relative-path";const n=e.split("/")[0];const i=r.some((r=>e.startsWith(`${r}/`)));if(!isBuiltin(n)&&!i&&!e.startsWith("/"))return"third-party";return"unknown"};const mergeImportDetails=(e,r)=>({default:e.default||r.default,named:[...new Set([...e.named,...r.named])],namespace:e.namespace||r.namespace,files:[...new Set([...e.files,...r.files])]});const parseImportsInFile=async e=>{const{script:r,template:n}=await readCode(e);if(!r)return{uiLibs:[],imports:[],template:n};const i=o.parse(r,{sourceType:"module",plugins:["jsx","typescript","importMeta","topLevelAwait"]});const s=[];(0,c.default)(i,{ImportDeclaration(r){s.push({source:r.node.source.value,...extractDetailsFromSpecifiers(r.node.specifiers,e)})}});return{template:n,imports:s}};const mergeThirdParty=(e,r)=>{for(const n of r){if(!e.has(n)){if(n==="element-ui"){e.set(n,{default:true})}else if(n==="element-plus"){e.set(n,{default:false})}}}};async function detectImports(e,r=["@"],n){const s=i.resolve(e);const o=await collectTargetFiles(s);let a=[];const c=new Map;const u=new Map;for(const e of o){const{template:i,imports:s}=await parseImportsInFile(e);if(i){const e=walk(i?.ast);const r=getUIlibsNameByTag([...e],n);a=[...new Set([...a,...r])]}for(const{source:e,...n}of s){const i=getImportType(e,r);const s={...n};const o=i==="third-party"?c:u;const a=i==="third-party"?e.split("/")[0]:e;const p=o.get(a);o.set(a,p?mergeImportDetails(p,s):s)}}mergeThirdParty(c,a);return{thirdParty:Object.fromEntries(c),unknown:Object.fromEntries(u)}}r.detectImports=detectImports},33845:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.CompSimilarListVO=r.CompFilesOssSignedUrlVo=r.DownloadCompVo=r.CompByIdVo=r.OtherConfigVo=r.ComphubConfigVo=r.PreBuildVo=r.ImportScanResultVo=r.CompCheckVo=r.CompFileContentVo=r.CompFileVo=r.FileType=r.CompSimilarListItemVO=void 0;const o=n(66466);class CompSimilarListItemVO{}i([(0,o.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件ID",required:true}),s("design:type",String)],CompSimilarListItemVO.prototype,"id",void 0);i([(0,o.ApiProperty)({example:"组件名称",description:"组件名称",required:true}),s("design:type",String)],CompSimilarListItemVO.prototype,"name",void 0);r.CompSimilarListItemVO=CompSimilarListItemVO;var a;(function(e){e["FILE"]="file";e["DIRECTORY"]="directory"})(a=r.FileType||(r.FileType={}));class CompFileVo{}i([(0,o.ApiProperty)({description:"组件文件名称",example:"index.vue",required:true}),s("design:type",String)],CompFileVo.prototype,"name",void 0);i([(0,o.ApiProperty)({description:"组件文件路径",example:"/src/components/MyComp/index.vue",required:true}),s("design:type",String)],CompFileVo.prototype,"path",void 0);i([(0,o.ApiProperty)({description:"组件文件类型",example:"file",required:true,enum:a}),s("design:type",String)],CompFileVo.prototype,"type",void 0);i([(0,o.ApiProperty)({description:"子节点",type:"array",items:{$ref:()=>(0,o.getSchemaPath)(CompFileVo)}}),s("design:type",Array)],CompFileVo.prototype,"children",void 0);r.CompFileVo=CompFileVo;class CompFileContentVo{}i([(0,o.ApiProperty)({description:"组件文件内容",example:'import { defineComponent } from "vue";\n\nexport default defineComponent({...})',required:true}),s("design:type",String)],CompFileContentVo.prototype,"content",void 0);r.CompFileContentVo=CompFileContentVo;class CompCheckVo{}i([(0,o.ApiProperty)({description:"组件入口文件",required:true}),s("design:type",String)],CompCheckVo.prototype,"entryIndex",void 0);i([(0,o.ApiProperty)({description:"组件配置文件",required:true}),s("design:type",String)],CompCheckVo.prototype,"compHash",void 0);i([(0,o.ApiProperty)({description:"组件配置文件检查结果",required:true}),s("design:type",String)],CompCheckVo.prototype,"compJsonIsOk",void 0);r.CompCheckVo=CompCheckVo;class ImportDetailVo{}i([(0,o.ApiProperty)({description:"是否默认导入",example:false,required:true}),s("design:type",Boolean)],ImportDetailVo.prototype,"default",void 0);i([(0,o.ApiProperty)({description:"命名导入列表",type:[String],example:["ElButton"],required:false}),s("design:type",Array)],ImportDetailVo.prototype,"named",void 0);i([(0,o.ApiProperty)({description:"是否命名空间导入",example:false,required:false}),s("design:type",Boolean)],ImportDetailVo.prototype,"namespace",void 0);i([(0,o.ApiProperty)({description:"涉及文件列表",type:[String],required:false}),s("design:type",Array)],ImportDetailVo.prototype,"files",void 0);i([(0,o.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),s("design:type",String)],ImportDetailVo.prototype,"version",void 0);class ImportScanResultVo{}i([(0,o.ApiProperty)({type:"object",required:true,additionalProperties:{type:()=>ImportDetailVo}}),s("design:type",Object)],ImportScanResultVo.prototype,"thirdParty",void 0);i([(0,o.ApiProperty)({type:"object",additionalProperties:{type:()=>ImportDetailVo}}),s("design:type",Object)],ImportScanResultVo.prototype,"unknown",void 0);r.ImportScanResultVo=ImportScanResultVo;class PreBuildVo{}i([(0,o.ApiProperty)({description:"预构建模块对应文件",required:false,example:{vue:"vue-hash.js"}}),s("design:type",Object)],PreBuildVo.prototype,"entryNameToFile",void 0);i([(0,o.ApiProperty)({description:"错误信息",required:false,example:"报错信息"}),s("design:type",String)],PreBuildVo.prototype,"error",void 0);r.PreBuildVo=PreBuildVo;class ComphubConfigVo{}i([(0,o.ApiProperty)({description:"组件库网站目录",required:true,example:"/src/components"}),s("design:type",String)],ComphubConfigVo.prototype,"websitePath",void 0);i([(0,o.ApiProperty)({description:"当前工作目录",required:true,example:"/src/components"}),s("design:type",String)],ComphubConfigVo.prototype,"cwd",void 0);i([(0,o.ApiProperty)({description:"当前服务器启动端口",required:true,example:3e3}),s("design:type",Number)],ComphubConfigVo.prototype,"port",void 0);i([(0,o.ApiProperty)({description:"组件库源目录",required:true,example:"/src/components"}),s("design:type",String)],ComphubConfigVo.prototype,"srcPath",void 0);r.ComphubConfigVo=ComphubConfigVo;class OtherConfigVo{}i([(0,o.ApiProperty)({description:"系统路径分隔符",required:true,example:"\\"}),s("design:type",String)],OtherConfigVo.prototype,"pathSeparator",void 0);r.OtherConfigVo=OtherConfigVo;class CompByIdVo{}i([(0,o.ApiProperty)({description:"组件文件路径",example:"local:///MyComp/index.vue",required:true}),s("design:type",String)],CompByIdVo.prototype,"path",void 0);i([(0,o.ApiProperty)({description:"文件选择器目录别名",example:"local://",required:true}),s("design:type",String)],CompByIdVo.prototype,"dirname",void 0);r.CompByIdVo=CompByIdVo;class DownloadCompVo{}i([(0,o.ApiProperty)({description:"组件是否重复",example:true,required:true}),s("design:type",Boolean)],DownloadCompVo.prototype,"isRepeat",void 0);r.DownloadCompVo=DownloadCompVo;class signedUrlItem{}i([(0,o.ApiProperty)({description:"文件路径",example:"/src/components/MyComp/index.vue",required:true}),s("design:type",String)],signedUrlItem.prototype,"path",void 0);i([(0,o.ApiProperty)({description:"文件oss签名访问地址",example:"https://comp-hub.oss-cn-beijing.aliyuncs.com/src/components/MyComp/index.vue?x-oss-security-token=...",required:true}),s("design:type",String)],signedUrlItem.prototype,"signedUrl",void 0);let c=class CompFilesOssSignedUrlVo{};i([(0,o.ApiProperty)({description:"文件oss签名访问地址列表",type:"array",items:{$ref:(0,o.getSchemaPath)(signedUrlItem)},required:true}),s("design:type",Array)],c.prototype,"signedUrls",void 0);c=i([(0,o.ApiExtraModel)(signedUrlItem)],c);r.CompFilesOssSignedUrlVo=c;let u=class CompSimilarListVO{};i([(0,o.ApiProperty)({type:"array",items:{$ref:(0,o.getSchemaPath)(CompSimilarListItemVO)},description:"相似组件列表",required:true}),s("design:type",Array)],u.prototype,"similarList",void 0);u=i([(0,o.ApiExtraModel)(CompSimilarListItemVO)],u);r.CompSimilarListVO=u},2809:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.SignedUrlVO=void 0;const o=n(66466);class SignedUrlVO{}i([(0,o.ApiProperty)({example:"xxxx",description:"带签名的访问地址",required:true}),s("design:type",String)],SignedUrlVO.prototype,"signUrl",void 0);r.SignedUrlVO=SignedUrlVO},55664:(e,r)=>{"use strict";const n={suspectRx:/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*\:/};r.parse=function(e,...i){const s=typeof i[0]==="object"&&i[0];const o=i.length>1||!s?i[0]:undefined;const a=i.length>1&&i[1]||s||{};const c=JSON.parse(e,o);if(a.protoAction==="ignore"){return c}if(!c||typeof c!=="object"){return c}if(!e.match(n.suspectRx)){return c}r.scan(c,a);return c};r.scan=function(e,r={}){let n=[e];while(n.length){const e=n;n=[];for(const i of e){if(Object.prototype.hasOwnProperty.call(i,"__proto__")){if(r.protoAction!=="remove"){throw new SyntaxError("Object contains forbidden prototype property")}delete i.__proto__}for(const e in i){const r=i[e];if(r&&typeof r==="object"){n.push(i[e])}}}}};r.safeParse=function(e,n){try{return r.parse(e,n)}catch(e){return null}}},4051:(e,r,n)=>{"use strict";const i=n(15676);const s=n(7185);const o=n(41584);const a=n(73299);const c={};e.exports=function(e,r,n={}){i(e&&typeof e==="object","Invalid defaults value: must be an object");i(!r||r===true||typeof r==="object","Invalid source value: must be true, falsy or an object");i(typeof n==="object","Invalid options: must be an object");if(!r){return null}if(n.shallow){return c.applyToDefaultsWithShallow(e,r,n)}const a=s(e);if(r===true){return a}const u=n.nullOverride!==undefined?n.nullOverride:false;return o(a,r,{nullOverride:u,mergeArrays:false})};c.applyToDefaultsWithShallow=function(e,r,n){const u=n.shallow;i(Array.isArray(u),"Invalid keys");const p=new Map;const g=r===true?null:new Set;for(let n of u){n=Array.isArray(n)?n:n.split(".");const i=a(e,n);if(i&&typeof i==="object"){p.set(i,g&&a(r,n)||i)}else if(g){g.add(n)}}const v=s(e,{},p);if(!g){return v}for(const e of g){c.reachCopy(v,r,e)}const b=n.nullOverride!==undefined?n.nullOverride:false;return o(v,r,{nullOverride:b,mergeArrays:false})};c.reachCopy=function(e,r,n){for(const e of n){if(!(e in r)){return}const n=r[e];if(typeof n!=="object"||n===null){return}r=n}const i=r;let s=e;for(let e=0;e<n.length-1;++e){const r=n[e];if(typeof s[r]!=="object"){s[r]={}}s=s[r]}s[n[n.length-1]]=i}},15676:(e,r,n)=>{"use strict";const i=n(214);const s={};e.exports=function(e,...r){if(e){return}if(r.length===1&&r[0]instanceof Error){throw r[0]}throw new i(r)}},7185:(e,r,n)=>{"use strict";const i=n(73299);const s=n(60265);const o=n(53829);const a={needsProtoHack:new Set([s.set,s.map,s.weakSet,s.weakMap])};e.exports=a.clone=function(e,r={},n=null){if(typeof e!=="object"||e===null){return e}let i=a.clone;let c=n;if(r.shallow){if(r.shallow!==true){return a.cloneWithShallow(e,r)}i=e=>e}else if(c){const r=c.get(e);if(r){return r}}else{c=new Map}const u=s.getInternalProto(e);if(u===s.buffer){return Buffer&&Buffer.from(e)}if(u===s.date){return new Date(e.getTime())}if(u===s.regex){return new RegExp(e)}const p=a.base(e,u,r);if(p===e){return e}if(c){c.set(e,p)}if(u===s.set){for(const n of e){p.add(i(n,r,c))}}else if(u===s.map){for(const[n,s]of e){p.set(n,i(s,r,c))}}const g=o.keys(e,r);for(const n of g){if(n==="__proto__"){continue}if(u===s.array&&n==="length"){p.length=e.length;continue}const o=Object.getOwnPropertyDescriptor(e,n);if(o){if(o.get||o.set){Object.defineProperty(p,n,o)}else if(o.enumerable){p[n]=i(e[n],r,c)}else{Object.defineProperty(p,n,{enumerable:false,writable:true,configurable:true,value:i(e[n],r,c)})}}else{Object.defineProperty(p,n,{enumerable:true,writable:true,configurable:true,value:i(e[n],r,c)})}}return p};a.cloneWithShallow=function(e,r){const n=r.shallow;r=Object.assign({},r);r.shallow=false;const s=new Map;for(const r of n){const n=i(e,r);if(typeof n==="object"||typeof n==="function"){s.set(n,n)}}return a.clone(e,r,s)};a.base=function(e,r,n){if(n.prototype===false){if(a.needsProtoHack.has(r)){return new r.constructor}return r===s.array?[]:{}}const i=Object.getPrototypeOf(e);if(i&&i.isImmutable){return e}if(r===s.array){const e=[];if(i!==r){Object.setPrototypeOf(e,i)}return e}if(a.needsProtoHack.has(r)){const e=new i.constructor;if(i!==r){Object.setPrototypeOf(e,i)}return e}return Object.create(i)}},41058:(e,r,n)=>{"use strict";const i=n(60265);const s={mismatched:null};e.exports=function(e,r,n){n=Object.assign({prototype:true},n);return!!s.isDeepEqual(e,r,n,[])};s.isDeepEqual=function(e,r,n,o){if(e===r){return e!==0||1/e===1/r}const a=typeof e;if(a!==typeof r){return false}if(e===null||r===null){return false}if(a==="function"){if(!n.deepFunction||e.toString()!==r.toString()){return false}}else if(a!=="object"){return e!==e&&r!==r}const c=s.getSharedType(e,r,!!n.prototype);switch(c){case i.buffer:return Buffer&&Buffer.prototype.equals.call(e,r);case i.promise:return e===r;case i.regex:return e.toString()===r.toString();case s.mismatched:return false}for(let n=o.length-1;n>=0;--n){if(o[n].isSame(e,r)){return true}}o.push(new s.SeenEntry(e,r));try{return!!s.isDeepEqualObj(c,e,r,n,o)}finally{o.pop()}};s.getSharedType=function(e,r,n){if(n){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(r)){return s.mismatched}return i.getInternalProto(e)}const o=i.getInternalProto(e);if(o!==i.getInternalProto(r)){return s.mismatched}return o};s.valueOf=function(e){const r=e.valueOf;if(r===undefined){return e}try{return r.call(e)}catch(e){return e}};s.hasOwnEnumerableProperty=function(e,r){return Object.prototype.propertyIsEnumerable.call(e,r)};s.isSetSimpleEqual=function(e,r){for(const n of Set.prototype.values.call(e)){if(!Set.prototype.has.call(r,n)){return false}}return true};s.isDeepEqualObj=function(e,r,n,o,a){const{isDeepEqual:c,valueOf:u,hasOwnEnumerableProperty:p}=s;const{keys:g,getOwnPropertySymbols:v}=Object;if(e===i.array){if(o.part){for(const e of r){for(const r of n){if(c(e,r,o,a)){return true}}}}else{if(r.length!==n.length){return false}for(let e=0;e<r.length;++e){if(!c(r[e],n[e],o,a)){return false}}return true}}else if(e===i.set){if(r.size!==n.size){return false}if(!s.isSetSimpleEqual(r,n)){const e=new Set(Set.prototype.values.call(n));for(const n of Set.prototype.values.call(r)){if(e.delete(n)){continue}let r=false;for(const i of e){if(c(n,i,o,a)){e.delete(i);r=true;break}}if(!r){return false}}}}else if(e===i.map){if(r.size!==n.size){return false}for(const[e,i]of Map.prototype.entries.call(r)){if(i===undefined&&!Map.prototype.has.call(n,e)){return false}if(!c(i,Map.prototype.get.call(n,e),o,a)){return false}}}else if(e===i.error){if(r.name!==n.name||r.message!==n.message){return false}}const b=u(r);const _=u(n);if((r!==b||n!==_)&&!c(b,_,o,a)){return false}const E=g(r);if(!o.part&&E.length!==g(n).length&&!o.skip){return false}let x=0;for(const e of E){if(o.skip&&o.skip.includes(e)){if(n[e]===undefined){++x}continue}if(!p(n,e)){return false}if(!c(r[e],n[e],o,a)){return false}}if(!o.part&&E.length-x!==g(n).length){return false}if(o.symbols!==false){const e=v(r);const i=new Set(v(n));for(const s of e){if(!o.skip||!o.skip.includes(s)){if(p(r,s)){if(!p(n,s)){return false}if(!c(r[s],n[s],o,a)){return false}}else if(p(n,s)){return false}}i.delete(s)}for(const e of i){if(p(n,e)){return false}}}return true};s.SeenEntry=class{constructor(e,r){this.obj=e;this.ref=r}isSame(e,r){return this.obj===e&&this.ref===r}}},214:(e,r,n)=>{"use strict";const i=n(35265);const s={};e.exports=class extends Error{constructor(e){const n=e.filter((e=>e!=="")).map((e=>typeof e==="string"?e:e instanceof Error?e.message:i(e)));super(n.join(" ")||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,r.assert)}}}},98972:e=>{"use strict";const r={};e.exports=function(e){if(!e){return""}let n="";for(let i=0;i<e.length;++i){const s=e.charCodeAt(i);if(r.isSafe(s)){n+=e[i]}else{n+=r.escapeHtmlChar(s)}}return n};r.escapeHtmlChar=function(e){const n=r.namedHtml.get(e);if(n){return n}if(e>=256){return"&#"+e+";"}const i=e.toString(16).padStart(2,"0");return`&#x${i};`};r.isSafe=function(e){return r.safeCharCodes.has(e)};r.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]);r.safeCharCodes=function(){const e=new Set;for(let r=32;r<123;++r){if(r>=97||r>=65&&r<=90||r>=48&&r<=57||r===32||r===46||r===44||r===45||r===58||r===95){e.add(r)}}return e}()},33574:e=>{"use strict";const r={};e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},8836:e=>{"use strict";const r={};e.exports=function(){}},41584:(e,r,n)=>{"use strict";const i=n(15676);const s=n(7185);const o=n(53829);const a={};e.exports=a.merge=function(e,r,n){i(e&&typeof e==="object","Invalid target value: must be an object");i(r===null||r===undefined||typeof r==="object","Invalid source value: must be null, undefined, or an object");if(!r){return e}n=Object.assign({nullOverride:true,mergeArrays:true},n);if(Array.isArray(r)){i(Array.isArray(e),"Cannot merge array onto an object");if(!n.mergeArrays){e.length=0}for(let i=0;i<r.length;++i){e.push(s(r[i],{symbols:n.symbols}))}return e}const c=o.keys(r,n);for(let i=0;i<c.length;++i){const o=c[i];if(o==="__proto__"||!Object.prototype.propertyIsEnumerable.call(r,o)){continue}const u=r[o];if(u&&typeof u==="object"){if(e[o]===u){continue}if(!e[o]||typeof e[o]!=="object"||Array.isArray(e[o])!==Array.isArray(u)||u instanceof Date||Buffer&&Buffer.isBuffer(u)||u instanceof RegExp){e[o]=s(u,{symbols:n.symbols})}else{a.merge(e[o],u,n)}}else{if(u!==null&&u!==undefined){e[o]=u}else if(n.nullOverride){e[o]=u}}}return e}},73299:(e,r,n)=>{"use strict";const i=n(15676);const s={};e.exports=function(e,r,n){if(r===false||r===null||r===undefined){return e}n=n||{};if(typeof n==="string"){n={separator:n}}const o=Array.isArray(r);i(!o||!n.separator,"Separator option is not valid for array-based chain");const a=o?r:r.split(n.separator||".");let c=e;for(let e=0;e<a.length;++e){let o=a[e];const u=n.iterables&&s.iterables(c);if(Array.isArray(c)||u==="set"){const e=Number(o);if(Number.isInteger(e)){o=e<0?c.length+e:e}}if(!c||typeof c==="function"&&n.functions===false||!u&&c[o]===undefined){i(!n.strict||e+1===a.length,"Missing segment",o,"in reach path ",r);i(typeof c==="object"||n.functions===true||typeof c!=="function","Invalid segment",o,"in reach path ",r);c=n.default;break}if(!u){c=c[o]}else if(u==="set"){c=[...c][o]}else{c=c.get(o)}}return c};s.iterables=function(e){if(e instanceof Set){return"set"}if(e instanceof Map){return"map"}}},35265:e=>{"use strict";const r={};e.exports=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}}},60265:(e,r)=>{"use strict";const n={};r=e.exports={array:Array.prototype,buffer:Buffer&&Buffer.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype};n.typeMap=new Map([["[object Error]",r.error],["[object Map]",r.map],["[object Promise]",r.promise],["[object Set]",r.set],["[object WeakMap]",r.weakMap],["[object WeakSet]",r.weakSet]]);r.getInternalProto=function(e){if(Array.isArray(e)){return r.array}if(Buffer&&e instanceof Buffer){return r.buffer}if(e instanceof Date){return r.date}if(e instanceof RegExp){return r.regex}if(e instanceof Error){return r.error}const i=Object.prototype.toString.call(e);return n.typeMap.get(i)||r.generic}},53829:(e,r)=>{"use strict";const n={};r.keys=function(e,r={}){return r.symbols!==false?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},97541:(e,r,n)=>{"use strict";const i=n(15676);const s={};r.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(e,r){r=r||{};const n=[].concat(r.before||[]);const s=[].concat(r.after||[]);const o=r.group||"?";const a=r.sort||0;i(!n.includes(o),`Item cannot come before itself: ${o}`);i(!n.includes("?"),"Item cannot come before unassociated items");i(!s.includes(o),`Item cannot come after itself: ${o}`);i(!s.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(e)){e=[e]}for(const r of e){const e={seq:this._items.length,sort:a,before:n,after:s,group:o,node:r};this._items.push(e)}if(!r.manual){const e=this._sort();i(e,"item",o!=="?"?`added into group ${o}`:"","created a dependencies error")}return this.nodes}merge(e){if(!Array.isArray(e)){e=[e]}for(const r of e){if(r){for(const e of r._items){this._items.push(Object.assign({},e))}}}this._items.sort(s.mergeSort);for(let e=0;e<this._items.length;++e){this._items[e].seq=e}const r=this._sort();i(r,"merge created a dependencies error");return this.nodes}sort(){const e=this._sort();i(e,"sort created a dependencies error");return this.nodes}_sort(){const e={};const r=Object.create(null);const n=Object.create(null);for(const i of this._items){const s=i.seq;const o=i.group;n[o]=n[o]||[];n[o].push(s);e[s]=i.before;for(const e of i.after){r[e]=r[e]||[];r[e].push(s)}}for(const r in e){const i=[];for(const s in e[r]){const o=e[r][s];n[o]=n[o]||[];i.push(...n[o])}e[r]=i}for(const i in r){if(n[i]){for(const s of n[i]){e[s].push(...r[i])}}}const i={};for(const r in e){const n=e[r];for(const e of n){i[e]=i[e]||[];i[e].push(r)}}const s={};const o=[];for(let e=0;e<this._items.length;++e){let r=e;if(i[e]){r=null;for(let e=0;e<this._items.length;++e){if(s[e]===true){continue}if(!i[e]){i[e]=[]}const n=i[e].length;let o=0;for(let r=0;r<n;++r){if(s[i[e][r]]){++o}}if(o===n){r=e;break}}}if(r!==null){s[r]=true;o.push(r)}}if(o.length!==this._items.length){return false}const a={};for(const e of this._items){a[e.seq]=e}this._items=[];this.nodes=[];for(const e of o){const r=a[e];this.nodes.push(r.node);this._items.push(r)}return true}};s.mergeSort=(e,r)=>e.sort===r.sort?0:e.sort<r.sort?-1:1},36153:function(e,r,n){e=n.nmd(e);(function(r,i){if(true){i(e,n(69551),n(99535));e.exports=def(e)}else{}function def(e){return"default"in e.exports?e.exports.default:e.exports}})(this,(function(e,r,n){"use strict";var i=Object.create;var s=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.getPrototypeOf;var u=Object.prototype.hasOwnProperty;var __commonJS=(e,r)=>function __require(){return r||(0,e[a(e)[0]])((r={exports:{}}).exports,r),r.exports};var __export=(e,r)=>{for(var n in r)s(e,n,{get:r[n],enumerable:true})};var __copyProps=(e,r,n,i)=>{if(r&&typeof r==="object"||typeof r==="function"){for(let c of a(r))if(!u.call(e,c)&&c!==n)s(e,c,{get:()=>r[c],enumerable:!(i=o(r,c))||i.enumerable})}return e};var __toESM=(e,r,n)=>(n=e!=null?i(c(e)):{},__copyProps(r||!e||!e.__esModule?s(n,"default",{value:e,enumerable:true}):n,e));var __toCommonJS=e=>__copyProps(s({},"__esModule",{value:true}),e);var p=__commonJS({"umd:@jridgewell/sourcemap-codec"(e,n){n.exports=r}});var g=__commonJS({"umd:@jridgewell/trace-mapping"(e,r){r.exports=n}});var v={};__export(v,{GenMapping:()=>P,addMapping:()=>addMapping,addSegment:()=>addSegment,allMappings:()=>allMappings,fromMap:()=>fromMap,maybeAddMapping:()=>maybeAddMapping,maybeAddSegment:()=>maybeAddSegment,setIgnore:()=>setIgnore,setSourceContent:()=>setSourceContent,toDecodedMap:()=>toDecodedMap,toEncodedMap:()=>toEncodedMap});e.exports=__toCommonJS(v);var b=class{constructor(){this._indexes={__proto__:null};this.array=[]}};function cast(e){return e}function get(e,r){return cast(e)._indexes[r]}function put(e,r){const n=get(e,r);if(n!==void 0)return n;const{array:i,_indexes:s}=cast(e);const o=i.push(r);return s[r]=o-1}function remove(e,r){const n=get(e,r);if(n===void 0)return;const{array:i,_indexes:s}=cast(e);for(let e=n+1;e<i.length;e++){const r=i[e];i[e-1]=r;s[r]--}s[r]=void 0;i.pop()}var _=__toESM(p());var E=__toESM(g());var x=0;var T=1;var w=2;var C=3;var A=4;var k=-1;var P=class{constructor({file:e,sourceRoot:r}={}){this._names=new b;this._sources=new b;this._sourcesContent=[];this._mappings=[];this.file=e;this.sourceRoot=r;this._ignoreList=new b}};function cast2(e){return e}function addSegment(e,r,n,i,s,o,a,c){return addSegmentInternal(false,e,r,n,i,s,o,a,c)}function addMapping(e,r){return addMappingInternal(false,e,r)}var maybeAddSegment=(e,r,n,i,s,o,a,c)=>addSegmentInternal(true,e,r,n,i,s,o,a,c);var maybeAddMapping=(e,r)=>addMappingInternal(true,e,r);function setSourceContent(e,r,n){const{_sources:i,_sourcesContent:s}=cast2(e);const o=put(i,r);s[o]=n}function setIgnore(e,r,n=true){const{_sources:i,_sourcesContent:s,_ignoreList:o}=cast2(e);const a=put(i,r);if(a===s.length)s[a]=null;if(n)put(o,a);else remove(o,a)}function toDecodedMap(e){const{_mappings:r,_sources:n,_sourcesContent:i,_names:s,_ignoreList:o}=cast2(e);removeEmptyFinalLines(r);return{version:3,file:e.file||void 0,names:s.array,sourceRoot:e.sourceRoot||void 0,sources:n.array,sourcesContent:i,mappings:r,ignoreList:o.array}}function toEncodedMap(e){const r=toDecodedMap(e);return Object.assign({},r,{mappings:(0,_.encode)(r.mappings)})}function fromMap(e){const r=new E.TraceMap(e);const n=new P({file:r.file,sourceRoot:r.sourceRoot});putAll(cast2(n)._names,r.names);putAll(cast2(n)._sources,r.sources);cast2(n)._sourcesContent=r.sourcesContent||r.sources.map((()=>null));cast2(n)._mappings=(0,E.decodedMappings)(r);if(r.ignoreList)putAll(cast2(n)._ignoreList,r.ignoreList);return n}function allMappings(e){const r=[];const{_mappings:n,_sources:i,_names:s}=cast2(e);for(let e=0;e<n.length;e++){const o=n[e];for(let n=0;n<o.length;n++){const a=o[n];const c={line:e+1,column:a[x]};let u=void 0;let p=void 0;let g=void 0;if(a.length!==1){u=i.array[a[T]];p={line:a[w]+1,column:a[C]};if(a.length===5)g=s.array[a[A]]}r.push({generated:c,source:u,original:p,name:g})}}return r}function addSegmentInternal(e,r,n,i,s,o,a,c,u){const{_mappings:p,_sources:g,_sourcesContent:v,_names:b}=cast2(r);const _=getIndex(p,n);const E=getColumnIndex(_,i);if(!s){if(e&&skipSourceless(_,E))return;return insert(_,E,[i])}assert(o);assert(a);const x=put(g,s);const T=c?put(b,c):k;if(x===v.length)v[x]=u!=null?u:null;if(e&&skipSource(_,E,x,o,a,T)){return}return insert(_,E,c?[i,x,o,a,T]:[i,x,o,a])}function assert(e){}function getIndex(e,r){for(let n=e.length;n<=r;n++){e[n]=[]}return e[r]}function getColumnIndex(e,r){let n=e.length;for(let i=n-1;i>=0;n=i--){const n=e[i];if(r>=n[x])break}return n}function insert(e,r,n){for(let n=e.length;n>r;n--){e[n]=e[n-1]}e[r]=n}function removeEmptyFinalLines(e){const{length:r}=e;let n=r;for(let r=n-1;r>=0;n=r,r--){if(e[r].length>0)break}if(n<r)e.length=n}function putAll(e,r){for(let n=0;n<r.length;n++)put(e,r[n])}function skipSourceless(e,r){if(r===0)return true;const n=e[r-1];return n.length===1}function skipSource(e,r,n,i,s,o){if(r===0)return false;const a=e[r-1];if(a.length===1)return false;return n===a[T]&&i===a[w]&&s===a[C]&&o===(a.length===5?a[A]:k)}function addMappingInternal(e,r,n){const{generated:i,source:s,original:o,name:a,content:c}=n;if(!s){return addSegmentInternal(e,r,i.line-1,i.column,null,null,null,null,null)}assert(o);return addSegmentInternal(e,r,i.line-1,i.column,s,o.line-1,o.column,a,c)}}))},59445:function(e){(function(r,n){true?e.exports=n():0})(this,(function(){"use strict";const e=/^[\w+.-]+:\/\//;const r=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;const n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function isAbsoluteUrl(r){return e.test(r)}function isSchemeRelativeUrl(e){return e.startsWith("//")}function isAbsolutePath(e){return e.startsWith("/")}function isFileUrl(e){return e.startsWith("file:")}function isRelative(e){return/^[.?#]/.test(e)}function parseAbsoluteUrl(e){const n=r.exec(e);return makeUrl(n[1],n[2]||"",n[3],n[4]||"",n[5]||"/",n[6]||"",n[7]||"")}function parseFileUrl(e){const r=n.exec(e);const i=r[2];return makeUrl("file:","",r[1]||"","",isAbsolutePath(i)?i:"/"+i,r[3]||"",r[4]||"")}function makeUrl(e,r,n,i,s,o,a){return{scheme:e,user:r,host:n,port:i,path:s,query:o,hash:a,type:7}}function parseUrl(e){if(isSchemeRelativeUrl(e)){const r=parseAbsoluteUrl("http:"+e);r.scheme="";r.type=6;return r}if(isAbsolutePath(e)){const r=parseAbsoluteUrl("http://foo.com"+e);r.scheme="";r.host="";r.type=5;return r}if(isFileUrl(e))return parseFileUrl(e);if(isAbsoluteUrl(e))return parseAbsoluteUrl(e);const r=parseAbsoluteUrl("http://foo.com/"+e);r.scheme="";r.host="";r.type=e?e.startsWith("?")?3:e.startsWith("#")?2:4:1;return r}function stripPathFilename(e){if(e.endsWith("/.."))return e;const r=e.lastIndexOf("/");return e.slice(0,r+1)}function mergePaths(e,r){normalizePath(r,r.type);if(e.path==="/"){e.path=r.path}else{e.path=stripPathFilename(r.path)+e.path}}function normalizePath(e,r){const n=r<=4;const i=e.path.split("/");let s=1;let o=0;let a=false;for(let e=1;e<i.length;e++){const r=i[e];if(!r){a=true;continue}a=false;if(r===".")continue;if(r===".."){if(o){a=true;o--;s--}else if(n){i[s++]=r}continue}i[s++]=r;o++}let c="";for(let e=1;e<s;e++){c+="/"+i[e]}if(!c||a&&!c.endsWith("/..")){c+="/"}e.path=c}function resolve(e,r){if(!e&&!r)return"";const n=parseUrl(e);let i=n.type;if(r&&i!==7){const e=parseUrl(r);const s=e.type;switch(i){case 1:n.hash=e.hash;case 2:n.query=e.query;case 3:case 4:mergePaths(n,e);case 5:n.user=e.user;n.host=e.host;n.port=e.port;case 6:n.scheme=e.scheme}if(s>i)i=s}normalizePath(n,i);const s=n.query+n.hash;switch(i){case 2:case 3:return s;case 4:{const i=n.path.slice(1);if(!i)return s||".";if(isRelative(r||e)&&!isRelative(i)){return"./"+i+s}return i+s}case 5:return n.path+s;default:return n.scheme+"//"+n.user+n.host+n.port+n.path+s}}return resolve}))},91391:function(e,r,n){e=n.nmd(e);(function(r,i){if(true){i(e,n(36153),n(99535));e.exports=def(e)}else{}function def(e){return"default"in e.exports?e.exports.default:e.exports}})(this,(function(e,r,n){"use strict";var i=Object.create;var s=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.getPrototypeOf;var u=Object.prototype.hasOwnProperty;var __commonJS=(e,r)=>function __require(){return r||(0,e[a(e)[0]])((r={exports:{}}).exports,r),r.exports};var __export=(e,r)=>{for(var n in r)s(e,n,{get:r[n],enumerable:true})};var __copyProps=(e,r,n,i)=>{if(r&&typeof r==="object"||typeof r==="function"){for(let c of a(r))if(!u.call(e,c)&&c!==n)s(e,c,{get:()=>r[c],enumerable:!(i=o(r,c))||i.enumerable})}return e};var __toESM=(e,r,n)=>(n=e!=null?i(c(e)):{},__copyProps(r||!e||!e.__esModule?s(n,"default",{value:e,enumerable:true}):n,e));var __toCommonJS=e=>__copyProps(s({},"__esModule",{value:true}),e);var p=__commonJS({"umd:@jridgewell/trace-mapping"(e,r){r.exports=n}});var g=__commonJS({"umd:@jridgewell/gen-mapping"(e,n){n.exports=r}});var v={};__export(v,{SourceMapConsumer:()=>E,SourceMapGenerator:()=>x});e.exports=__toCommonJS(v);var b=__toESM(p());var _=__toESM(g());var E=class _SourceMapConsumer{constructor(e,r){const n=this._map=new b.AnyMap(e,r);this.file=n.file;this.names=n.names;this.sourceRoot=n.sourceRoot;this.sources=n.resolvedSources;this.sourcesContent=n.sourcesContent;this.version=n.version}static fromSourceMap(e,r){if(e.toDecodedMap){return new _SourceMapConsumer(e.toDecodedMap(),r)}return new _SourceMapConsumer(e.toJSON(),r)}get mappings(){return(0,b.encodedMappings)(this._map)}originalPositionFor(e){return(0,b.originalPositionFor)(this._map,e)}generatedPositionFor(e){return(0,b.generatedPositionFor)(this._map,e)}allGeneratedPositionsFor(e){return(0,b.allGeneratedPositionsFor)(this._map,e)}hasContentsOfAllSources(){if(!this.sourcesContent||this.sourcesContent.length!==this.sources.length){return false}for(const e of this.sourcesContent){if(e==null){return false}}return true}sourceContentFor(e,r){const n=(0,b.sourceContentFor)(this._map,e);if(n!=null){return n}if(r){return null}throw new Error(`"${e}" is not in the SourceMap.`)}eachMapping(e,r){(0,b.eachMapping)(this._map,r?e.bind(r):e)}destroy(){}};var x=class _SourceMapGenerator{constructor(e){this._map=e instanceof _.GenMapping?e:new _.GenMapping(e)}static fromSourceMap(e){return new _SourceMapGenerator((0,_.fromMap)(e))}addMapping(e){(0,_.maybeAddMapping)(this._map,e)}setSourceContent(e,r){(0,_.setSourceContent)(this._map,e,r)}toJSON(){return(0,_.toEncodedMap)(this._map)}toString(){return JSON.stringify(this.toJSON())}toDecodedMap(){return(0,_.toDecodedMap)(this._map)}}}))},69551:function(e,r,n){e=n.nmd(e);(function(r,n){if(true){n(e);e.exports=def(e)}else{}function def(e){return"default"in e.exports?e.exports.default:e.exports}})(this,(function(e){"use strict";var r=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var __export=(e,n)=>{for(var i in n)r(e,i,{get:n[i],enumerable:true})};var __copyProps=(e,o,a,c)=>{if(o&&typeof o==="object"||typeof o==="function"){for(let u of i(o))if(!s.call(e,u)&&u!==a)r(e,u,{get:()=>o[u],enumerable:!(c=n(o,u))||c.enumerable})}return e};var __toCommonJS=e=>__copyProps(r({},"__esModule",{value:true}),e);var o={};__export(o,{decode:()=>decode,decodeGeneratedRanges:()=>decodeGeneratedRanges,decodeOriginalScopes:()=>decodeOriginalScopes,encode:()=>encode,encodeGeneratedRanges:()=>encodeGeneratedRanges,encodeOriginalScopes:()=>encodeOriginalScopes});e.exports=__toCommonJS(o);var a=",".charCodeAt(0);var c=";".charCodeAt(0);var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var p=new Uint8Array(64);var g=new Uint8Array(128);for(let e=0;e<u.length;e++){const r=u.charCodeAt(e);p[e]=r;g[r]=e}function decodeInteger(e,r){let n=0;let i=0;let s=0;do{const r=e.next();s=g[r];n|=(s&31)<<i;i+=5}while(s&32);const o=n&1;n>>>=1;if(o){n=-2147483648|-n}return r+n}function encodeInteger(e,r,n){let i=r-n;i=i<0?-i<<1|1:i<<1;do{let r=i&31;i>>>=5;if(i>0)r|=32;e.write(p[r])}while(i>0);return r}function hasMoreVlq(e,r){if(e.pos>=r)return false;return e.peek()!==a}var v=1024*16;var b=typeof TextDecoder!=="undefined"?new TextDecoder:typeof Buffer!=="undefined"?{decode(e){const r=Buffer.from(e.buffer,e.byteOffset,e.byteLength);return r.toString()}}:{decode(e){let r="";for(let n=0;n<e.length;n++){r+=String.fromCharCode(e[n])}return r}};var _=class{constructor(){this.pos=0;this.out="";this.buffer=new Uint8Array(v)}write(e){const{buffer:r}=this;r[this.pos++]=e;if(this.pos===v){this.out+=b.decode(r);this.pos=0}}flush(){const{buffer:e,out:r,pos:n}=this;return n>0?r+b.decode(e.subarray(0,n)):r}};var E=class{constructor(e){this.pos=0;this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){const{buffer:r,pos:n}=this;const i=r.indexOf(e,n);return i===-1?r.length:i}};var x=[];function decodeOriginalScopes(e){const{length:r}=e;const n=new E(e);const i=[];const s=[];let o=0;for(;n.pos<r;n.pos++){o=decodeInteger(n,o);const e=decodeInteger(n,0);if(!hasMoreVlq(n,r)){const r=s.pop();r[2]=o;r[3]=e;continue}const a=decodeInteger(n,0);const c=decodeInteger(n,0);const u=c&1;const p=u?[o,e,0,0,a,decodeInteger(n,0)]:[o,e,0,0,a];let g=x;if(hasMoreVlq(n,r)){g=[];do{const e=decodeInteger(n,0);g.push(e)}while(hasMoreVlq(n,r))}p.vars=g;i.push(p);s.push(p)}return i}function encodeOriginalScopes(e){const r=new _;for(let n=0;n<e.length;){n=_encodeOriginalScopes(e,n,r,[0])}return r.flush()}function _encodeOriginalScopes(e,r,n,i){const s=e[r];const{0:o,1:c,2:u,3:p,4:g,vars:v}=s;if(r>0)n.write(a);i[0]=encodeInteger(n,o,i[0]);encodeInteger(n,c,0);encodeInteger(n,g,0);const b=s.length===6?1:0;encodeInteger(n,b,0);if(s.length===6)encodeInteger(n,s[5],0);for(const e of v){encodeInteger(n,e,0)}for(r++;r<e.length;){const s=e[r];const{0:o,1:a}=s;if(o>u||o===u&&a>=p){break}r=_encodeOriginalScopes(e,r,n,i)}n.write(a);i[0]=encodeInteger(n,u,i[0]);encodeInteger(n,p,0);return r}function decodeGeneratedRanges(e){const{length:r}=e;const n=new E(e);const i=[];const s=[];let o=0;let a=0;let c=0;let u=0;let p=0;let g=0;let v=0;let b=0;do{const e=n.indexOf(";");let r=0;for(;n.pos<e;n.pos++){r=decodeInteger(n,r);if(!hasMoreVlq(n,e)){const e=s.pop();e[2]=o;e[3]=r;continue}const _=decodeInteger(n,0);const E=_&1;const T=_&2;const w=_&4;let C=null;let A=x;let k;if(E){const e=decodeInteger(n,a);c=decodeInteger(n,a===e?c:0);a=e;k=[o,r,0,0,e,c]}else{k=[o,r,0,0]}k.isScope=!!w;if(T){const e=u;const r=p;u=decodeInteger(n,u);const i=e===u;p=decodeInteger(n,i?p:0);g=decodeInteger(n,i&&r===p?g:0);C=[u,p,g]}k.callsite=C;if(hasMoreVlq(n,e)){A=[];do{v=o;b=r;const e=decodeInteger(n,0);let i;if(e<-1){i=[[decodeInteger(n,0)]];for(let r=-1;r>e;r--){const e=v;v=decodeInteger(n,v);b=decodeInteger(n,v===e?b:0);const r=decodeInteger(n,0);i.push([r,v,b])}}else{i=[[e]]}A.push(i)}while(hasMoreVlq(n,e))}k.bindings=A;i.push(k);s.push(k)}o++;n.pos=e+1}while(n.pos<r);return i}function encodeGeneratedRanges(e){if(e.length===0)return"";const r=new _;for(let n=0;n<e.length;){n=_encodeGeneratedRanges(e,n,r,[0,0,0,0,0,0,0])}return r.flush()}function _encodeGeneratedRanges(e,r,n,i){const s=e[r];const{0:o,1:c,2:u,3:p,isScope:g,callsite:v,bindings:b}=s;if(i[0]<o){catchupLine(n,i[0],o);i[0]=o;i[1]=0}else if(r>0){n.write(a)}i[1]=encodeInteger(n,s[1],i[1]);const _=(s.length===6?1:0)|(v?2:0)|(g?4:0);encodeInteger(n,_,0);if(s.length===6){const{4:e,5:r}=s;if(e!==i[2]){i[3]=0}i[2]=encodeInteger(n,e,i[2]);i[3]=encodeInteger(n,r,i[3])}if(v){const{0:e,1:r,2:o}=s.callsite;if(e!==i[4]){i[5]=0;i[6]=0}else if(r!==i[5]){i[6]=0}i[4]=encodeInteger(n,e,i[4]);i[5]=encodeInteger(n,r,i[5]);i[6]=encodeInteger(n,o,i[6])}if(b){for(const e of b){if(e.length>1)encodeInteger(n,-e.length,0);const r=e[0][0];encodeInteger(n,r,0);let i=o;let s=c;for(let r=1;r<e.length;r++){const o=e[r];i=encodeInteger(n,o[1],i);s=encodeInteger(n,o[2],s);encodeInteger(n,o[0],0)}}}for(r++;r<e.length;){const s=e[r];const{0:o,1:a}=s;if(o>u||o===u&&a>=p){break}r=_encodeGeneratedRanges(e,r,n,i)}if(i[0]<u){catchupLine(n,i[0],u);i[0]=u;i[1]=0}else{n.write(a)}i[1]=encodeInteger(n,p,i[1]);return r}function catchupLine(e,r,n){do{e.write(c)}while(++r<n)}function decode(e){const{length:r}=e;const n=new E(e);const i=[];let s=0;let o=0;let a=0;let c=0;let u=0;do{const e=n.indexOf(";");const r=[];let p=true;let g=0;s=0;while(n.pos<e){let i;s=decodeInteger(n,s);if(s<g)p=false;g=s;if(hasMoreVlq(n,e)){o=decodeInteger(n,o);a=decodeInteger(n,a);c=decodeInteger(n,c);if(hasMoreVlq(n,e)){u=decodeInteger(n,u);i=[s,o,a,c,u]}else{i=[s,o,a,c]}}else{i=[s]}r.push(i);n.pos++}if(!p)sort(r);i.push(r);n.pos=e+1}while(n.pos<=r);return i}function sort(e){e.sort(sortComparator)}function sortComparator(e,r){return e[0]-r[0]}function encode(e){const r=new _;let n=0;let i=0;let s=0;let o=0;for(let u=0;u<e.length;u++){const p=e[u];if(u>0)r.write(c);if(p.length===0)continue;let g=0;for(let e=0;e<p.length;e++){const c=p[e];if(e>0)r.write(a);g=encodeInteger(r,c[0],g);if(c.length===1)continue;n=encodeInteger(r,c[1],n);i=encodeInteger(r,c[2],i);s=encodeInteger(r,c[3],s);if(c.length===4)continue;o=encodeInteger(r,c[4],o)}}return r.flush()}}))},99535:function(e,r,n){e=n.nmd(e);(function(r,i){if(true){i(e,n(59445),n(69551));e.exports=def(e)}else{}function def(e){return"default"in e.exports?e.exports.default:e.exports}})(this,(function(e,r,n){"use strict";var i=Object.create;var s=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.getPrototypeOf;var u=Object.prototype.hasOwnProperty;var __commonJS=(e,r)=>function __require(){return r||(0,e[a(e)[0]])((r={exports:{}}).exports,r),r.exports};var __export=(e,r)=>{for(var n in r)s(e,n,{get:r[n],enumerable:true})};var __copyProps=(e,r,n,i)=>{if(r&&typeof r==="object"||typeof r==="function"){for(let c of a(r))if(!u.call(e,c)&&c!==n)s(e,c,{get:()=>r[c],enumerable:!(i=o(r,c))||i.enumerable})}return e};var __toESM=(e,r,n)=>(n=e!=null?i(c(e)):{},__copyProps(r||!e||!e.__esModule?s(n,"default",{value:e,enumerable:true}):n,e));var __toCommonJS=e=>__copyProps(s({},"__esModule",{value:true}),e);var p=__commonJS({"umd:@jridgewell/sourcemap-codec"(e,r){r.exports=n}});var g=__commonJS({"umd:@jridgewell/resolve-uri"(e,n){n.exports=r}});var v={};__export(v,{AnyMap:()=>FlattenMap,FlattenMap:()=>FlattenMap,GREATEST_LOWER_BOUND:()=>L,LEAST_UPPER_BOUND:()=>N,TraceMap:()=>B,allGeneratedPositionsFor:()=>allGeneratedPositionsFor,decodedMap:()=>decodedMap,decodedMappings:()=>decodedMappings,eachMapping:()=>eachMapping,encodedMap:()=>encodedMap,encodedMappings:()=>encodedMappings,generatedPositionFor:()=>generatedPositionFor,isIgnored:()=>isIgnored,originalPositionFor:()=>originalPositionFor,presortedDecodedMap:()=>presortedDecodedMap,sourceContentFor:()=>sourceContentFor,traceSegment:()=>traceSegment});e.exports=__toCommonJS(v);var b=__toESM(p());var _=__toESM(g());function stripFilename(e){if(!e)return"";const r=e.lastIndexOf("/");return e.slice(0,r+1)}function resolver(e,r){const n=stripFilename(e);const i=r?r+"/":"";return e=>(0,_.default)(i+(e||""),n)}var E=0;var x=1;var T=2;var w=3;var C=4;var A=1;var k=2;function maybeSort(e,r){const n=nextUnsortedSegmentLine(e,0);if(n===e.length)return e;if(!r)e=e.slice();for(let i=n;i<e.length;i=nextUnsortedSegmentLine(e,i+1)){e[i]=sortSegments(e[i],r)}return e}function nextUnsortedSegmentLine(e,r){for(let n=r;n<e.length;n++){if(!isSorted(e[n]))return n}return e.length}function isSorted(e){for(let r=1;r<e.length;r++){if(e[r][E]<e[r-1][E]){return false}}return true}function sortSegments(e,r){if(!r)e=e.slice();return e.sort(sortComparator)}function sortComparator(e,r){return e[E]-r[E]}var P=false;function binarySearch(e,r,n,i){while(n<=i){const s=n+(i-n>>1);const o=e[s][E]-r;if(o===0){P=true;return s}if(o<0){n=s+1}else{i=s-1}}P=false;return n-1}function upperBound(e,r,n){for(let i=n+1;i<e.length;n=i++){if(e[i][E]!==r)break}return n}function lowerBound(e,r,n){for(let i=n-1;i>=0;n=i--){if(e[i][E]!==r)break}return n}function memoizedState(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function memoizedBinarySearch(e,r,n,i){const{lastKey:s,lastNeedle:o,lastIndex:a}=n;let c=0;let u=e.length-1;if(i===s){if(r===o){P=a!==-1&&e[a][E]===r;return a}if(r>=o){c=a===-1?0:a}else{u=a}}n.lastKey=i;n.lastNeedle=r;return n.lastIndex=binarySearch(e,r,c,u)}function buildBySources(e,r){const n=r.map(buildNullArray);for(let i=0;i<e.length;i++){const s=e[i];for(let e=0;e<s.length;e++){const o=s[e];if(o.length===1)continue;const a=o[x];const c=o[T];const u=o[w];const p=n[a];const g=p[c]||(p[c]=[]);const v=r[a];let b=upperBound(g,u,memoizedBinarySearch(g,u,v,c));v.lastIndex=++b;insert(g,b,[u,i,o[E]])}}return n}function insert(e,r,n){for(let n=e.length;n>r;n--){e[n]=e[n-1]}e[r]=n}function buildNullArray(){return{__proto__:null}}function parse(e){return typeof e==="string"?JSON.parse(e):e}var FlattenMap=function(e,r){const n=parse(e);if(!("sections"in n)){return new B(n,r)}const i=[];const s=[];const o=[];const a=[];const c=[];recurse(n,r,i,s,o,a,c,0,0,Infinity,Infinity);const u={version:3,file:n.file,names:a,sources:s,sourcesContent:o,mappings:i,ignoreList:c};return presortedDecodedMap(u)};function recurse(e,r,n,i,s,o,a,c,u,p,g){const{sections:v}=e;for(let e=0;e<v.length;e++){const{map:b,offset:_}=v[e];let E=p;let x=g;if(e+1<v.length){const r=v[e+1].offset;E=Math.min(p,c+r.line);if(E===p){x=Math.min(g,u+r.column)}else if(E<p){x=u+r.column}}addSection(b,r,n,i,s,o,a,c+_.line,u+_.column,E,x)}}function addSection(e,r,n,i,s,o,a,c,u,p,g){const v=parse(e);if("sections"in v)return recurse(...arguments);const b=new B(v,r);const _=i.length;const A=o.length;const k=decodedMappings(b);const{resolvedSources:P,sourcesContent:I,ignoreList:R}=b;append(i,P);append(o,b.names);if(I)append(s,I);else for(let e=0;e<P.length;e++)s.push(null);if(R)for(let e=0;e<R.length;e++)a.push(R[e]+_);for(let e=0;e<k.length;e++){const r=c+e;if(r>p)return;const i=getLine(n,r);const s=e===0?u:0;const o=k[e];for(let e=0;e<o.length;e++){const n=o[e];const a=s+n[E];if(r===p&&a>=g)return;if(n.length===1){i.push([a]);continue}const c=_+n[x];const u=n[T];const v=n[w];i.push(n.length===4?[a,c,u,v]:[a,c,u,v,A+n[C]])}}}function append(e,r){for(let n=0;n<r.length;n++)e.push(r[n])}function getLine(e,r){for(let n=e.length;n<=r;n++)e[n]=[];return e[r]}var I="`line` must be greater than 0 (lines start at line 1)";var R="`column` must be greater than or equal to 0 (columns start at column 0)";var N=-1;var L=1;var B=class{constructor(e,r){const n=typeof e==="string";if(!n&&e._decodedMemo)return e;const i=parse(e);const{version:s,file:o,names:a,sourceRoot:c,sources:u,sourcesContent:p}=i;this.version=s;this.file=o;this.names=a||[];this.sourceRoot=c;this.sources=u;this.sourcesContent=p;this.ignoreList=i.ignoreList||i.x_google_ignoreList||void 0;const g=resolver(r,c);this.resolvedSources=u.map(g);const{mappings:v}=i;if(typeof v==="string"){this._encoded=v;this._decoded=void 0}else if(Array.isArray(v)){this._encoded=void 0;this._decoded=maybeSort(v,n)}else if(i.sections){throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`)}else{throw new Error(`invalid source map: ${JSON.stringify(i)}`)}this._decodedMemo=memoizedState();this._bySources=void 0;this._bySourceMemos=void 0}};function cast(e){return e}function encodedMappings(e){var r,n;return(n=(r=cast(e))._encoded)!=null?n:r._encoded=(0,b.encode)(cast(e)._decoded)}function decodedMappings(e){var r;return(r=cast(e))._decoded||(r._decoded=(0,b.decode)(cast(e)._encoded))}function traceSegment(e,r,n){const i=decodedMappings(e);if(r>=i.length)return null;const s=i[r];const o=traceSegmentInternal(s,cast(e)._decodedMemo,r,n,L);return o===-1?null:s[o]}function originalPositionFor(e,r){let{line:n,column:i,bias:s}=r;n--;if(n<0)throw new Error(I);if(i<0)throw new Error(R);const o=decodedMappings(e);if(n>=o.length)return OMapping(null,null,null,null);const a=o[n];const c=traceSegmentInternal(a,cast(e)._decodedMemo,n,i,s||L);if(c===-1)return OMapping(null,null,null,null);const u=a[c];if(u.length===1)return OMapping(null,null,null,null);const{names:p,resolvedSources:g}=e;return OMapping(g[u[x]],u[T]+1,u[w],u.length===5?p[u[C]]:null)}function generatedPositionFor(e,r){const{source:n,line:i,column:s,bias:o}=r;return generatedPosition(e,n,i,s,o||L,false)}function allGeneratedPositionsFor(e,r){const{source:n,line:i,column:s,bias:o}=r;return generatedPosition(e,n,i,s,o||N,true)}function eachMapping(e,r){const n=decodedMappings(e);const{names:i,resolvedSources:s}=e;for(let e=0;e<n.length;e++){const o=n[e];for(let n=0;n<o.length;n++){const a=o[n];const c=e+1;const u=a[0];let p=null;let g=null;let v=null;let b=null;if(a.length!==1){p=s[a[1]];g=a[2]+1;v=a[3]}if(a.length===5)b=i[a[4]];r({generatedLine:c,generatedColumn:u,source:p,originalLine:g,originalColumn:v,name:b})}}}function sourceIndex(e,r){const{sources:n,resolvedSources:i}=e;let s=n.indexOf(r);if(s===-1)s=i.indexOf(r);return s}function sourceContentFor(e,r){const{sourcesContent:n}=e;if(n==null)return null;const i=sourceIndex(e,r);return i===-1?null:n[i]}function isIgnored(e,r){const{ignoreList:n}=e;if(n==null)return false;const i=sourceIndex(e,r);return i===-1?false:n.includes(i)}function presortedDecodedMap(e,r){const n=new B(clone(e,[]),r);cast(n)._decoded=e.mappings;return n}function decodedMap(e){return clone(e,decodedMappings(e))}function encodedMap(e){return clone(e,encodedMappings(e))}function clone(e,r){return{version:e.version,file:e.file,names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,mappings:r,ignoreList:e.ignoreList||e.x_google_ignoreList}}function OMapping(e,r,n,i){return{source:e,line:r,column:n,name:i}}function GMapping(e,r){return{line:e,column:r}}function traceSegmentInternal(e,r,n,i,s){let o=memoizedBinarySearch(e,i,r,n);if(P){o=(s===N?upperBound:lowerBound)(e,i,o)}else if(s===N)o++;if(o===-1||o===e.length)return-1;return o}function sliceGeneratedPositions(e,r,n,i,s){let o=traceSegmentInternal(e,r,n,i,L);if(!P&&s===N)o++;if(o===-1||o===e.length)return[];const a=P?i:e[o][E];if(!P)o=lowerBound(e,a,o);const c=upperBound(e,a,o);const u=[];for(;o<=c;o++){const r=e[o];u.push(GMapping(r[A]+1,r[k]))}return u}function generatedPosition(e,r,n,i,s,o){var a;n--;if(n<0)throw new Error(I);if(i<0)throw new Error(R);const{sources:c,resolvedSources:u}=e;let p=c.indexOf(r);if(p===-1)p=u.indexOf(r);if(p===-1)return o?[]:GMapping(null,null);const g=(a=cast(e))._bySources||(a._bySources=buildBySources(decodedMappings(e),cast(e)._bySourceMemos=c.map(memoizedState)));const v=g[p][n];if(v==null)return o?[]:GMapping(null,null);const b=cast(e)._bySourceMemos[p];if(o)return sliceGeneratedPositions(v,b,n,i,s);const _=traceSegmentInternal(v,b,n,i,s);if(_===-1)return GMapping(null,null);const E=v[_];return GMapping(E[A]+1,E[k])}}))},99582:(e,r,n)=>{const{parse:i,format:s}=n(87016);const{pathToRegexp:o,compile:a,parse:c}=n(84868);e.exports=Layer;function Layer(e,r,n,i={}){this.opts=i;this.name=this.opts.name||null;this.methods=[];this.paramNames=[];this.stack=Array.isArray(n)?n:[n];for(const e of r){const r=this.methods.push(e.toUpperCase());if(this.methods[r-1]==="GET")this.methods.unshift("HEAD")}for(let n=0;n<this.stack.length;n++){const i=this.stack[n];const s=typeof i;if(s!=="function")throw new Error(`${r.toString()} \`${this.opts.name||e}\`: \`middleware\` must be a function, not \`${s}\``)}this.path=e;this.regexp=o(e,this.paramNames,this.opts)}Layer.prototype.match=function(e){return this.regexp.test(e)};Layer.prototype.params=function(e,r,n={}){for(let e=r.length,i=0;i<e;i++){if(this.paramNames[i]){const e=r[i];if(e&&e.length>0)n[this.paramNames[i].name]=e?safeDecodeURIComponent(e):e}}return n};Layer.prototype.captures=function(e){return this.opts.ignoreCaptures?[]:e.match(this.regexp).slice(1)};Layer.prototype.url=function(e,r){let n=e;const o=this.path.replace(/\(\.\*\)/g,"");if(typeof e!=="object"){n=Array.prototype.slice.call(arguments);if(typeof n[n.length-1]==="object"){r=n[n.length-1];n=n.slice(0,-1)}}const u=a(o,{encode:encodeURIComponent,...r});let p;const g=c(o);let v={};if(Array.isArray(n)){for(let e=g.length,r=0,i=0;r<e;r++){if(g[r].name)v[g[r].name]=n[i++]}}else if(g.some((e=>e.name))){v=e}else if(!r){r=e}p=u(v);if(r&&r.query){p=i(p);if(typeof r.query==="string"){p.search=r.query}else{p.search=undefined;p.query=r.query}return s(p)}return p};Layer.prototype.param=function(e,r){const{stack:n}=this;const i=this.paramNames;const middleware=function(n,i){return r.call(this,n.params[e],n,i)};middleware.param=e;const s=i.map((function(e){return e.name}));const o=s.indexOf(e);if(o>-1){n.some((function(e,r){if(!e.param||s.indexOf(e.param)>o){n.splice(r,0,middleware);return true}}))}return this};Layer.prototype.setPrefix=function(e){if(this.path){this.path=this.path!=="/"||this.opts.strict===true?`${e}${this.path}`:e;this.paramNames=[];this.regexp=o(this.path,this.paramNames,this.opts)}return this};function safeDecodeURIComponent(e){try{return decodeURIComponent(e)}catch{return e}}},10126:(e,r,n)=>{const i=n(48972);const s=n(78024);const o=n(50806);const{pathToRegexp:a}=n(84868);const c=n(99582);const u=n(2830)("koa-router");e.exports=Router;function Router(e={}){if(!(this instanceof Router))return new Router(e);this.opts=e;this.methods=this.opts.methods||["HEAD","OPTIONS","GET","PUT","PATCH","POST","DELETE"];this.exclusive=Boolean(this.opts.exclusive);this.params={};this.stack=[];this.host=this.opts.host}for(const p of o){function setMethodVerb(e){Router.prototype[e]=function(r,n,i){if(typeof n==="string"||n instanceof RegExp){i=Array.prototype.slice.call(arguments,2)}else{i=Array.prototype.slice.call(arguments,1);n=r;r=null}if(typeof n!=="string"&&!(n instanceof RegExp)&&(!Array.isArray(n)||n.length===0))throw new Error(`You have to provide a path when adding a ${e} handler`);this.register(n,[e],i,{name:r});return this}}setMethodVerb(p)}Router.prototype.del=Router.prototype["delete"];Router.prototype.use=function(){const e=this;const r=Array.prototype.slice.call(arguments);let n;if(Array.isArray(r[0])&&typeof r[0][0]==="string"){const s=r[0];for(const o of s){e.use.apply(e,[o].concat(r.slice(1)))}return this}const i=typeof r[0]==="string";if(i)n=r.shift();for(const u of r){if(u.router){const p=Object.assign(Object.create(Router.prototype),u.router,{stack:[...u.router.stack]});for(let g=0;g<p.stack.length;g++){const v=p.stack[g];const b=Object.assign(Object.create(c.prototype),v);if(n)b.setPrefix(n);if(e.opts.prefix)b.setPrefix(e.opts.prefix);e.stack.push(b);p.stack[g]=b}if(e.params){function setRouterParams(r){const n=r;for(const r of n){p.param(r,e.params[r])}}setRouterParams(Object.keys(e.params))}}else{const _=[];a(e.opts.prefix||"",_);const E=e.opts.prefix&&_.length;e.register(n||"([^/]*)",[],u,{end:false,ignoreCaptures:!i&&!E})}}return this};Router.prototype.prefix=function(e){e=e.replace(/\/$/,"");this.opts.prefix=e;for(let r=0;r<this.stack.length;r++){const n=this.stack[r];n.setPrefix(e)}return this};Router.prototype.routes=Router.prototype.middleware=function(){const e=this;const r=function dispatch(r,n){u("%s %s",r.method,r.path);const s=e.matchHost(r.host);if(!s){return n()}const o=e.opts.routerPath||r.newRouterPath||r.path||r.routerPath;const a=e.match(o,r.method);let c;if(r.matched){r.matched.push.apply(r.matched,a.path)}else{r.matched=a.path}r.router=e;if(!a.route)return n();const p=a.pathAndMethod;const g=p[p.length-1];r._matchedRoute=g.path;if(g.name){r._matchedRouteName=g.name}c=(e.exclusive?[g]:p).reduce((function(e,r){e.push((function(e,n){e.captures=r.captures(o,e.captures);e.params=e.request.params=r.params(o,e.captures,e.params);e.routerPath=r.path;e.routerName=r.name;e._matchedRoute=r.path;if(r.name){e._matchedRouteName=r.name}return n()}));return e.concat(r.stack)}),[]);return i(c)(r,n)};r.router=this;return r};Router.prototype.allowedMethods=function(e={}){const r=this.methods;return function allowedMethods(n,i){return i().then((function(){const i={};if(!n.status||n.status===404){for(let e=0;e<n.matched.length;e++){const r=n.matched[e];for(let e=0;e<r.methods.length;e++){const n=r.methods[e];i[n]=n}}const o=Object.keys(i);if(!~r.indexOf(n.method)){if(e.throw){const r=typeof e.notImplemented==="function"?e.notImplemented():new s.NotImplemented;throw r}else{n.status=501;n.set("Allow",o.join(", "))}}else if(o.length>0){if(n.method==="OPTIONS"){n.status=200;n.body="";n.set("Allow",o.join(", "))}else if(!i[n.method]){if(e.throw){const r=typeof e.methodNotAllowed==="function"?e.methodNotAllowed():new s.MethodNotAllowed;throw r}else{n.status=405;n.set("Allow",o.join(", "))}}}}}))}};Router.prototype.all=function(e,r,n){if(typeof r==="string"){n=Array.prototype.slice.call(arguments,2)}else{n=Array.prototype.slice.call(arguments,1);r=e;e=null}if(typeof r!=="string"&&!(r instanceof RegExp)&&(!Array.isArray(r)||r.length===0))throw new Error("You have to provide a path when adding an all handler");this.register(r,o,n,{name:e});return this};Router.prototype.redirect=function(e,r,n){if(typeof e==="symbol"||e[0]!=="/"){e=this.url(e);if(e instanceof Error)throw e}if(typeof r==="symbol"||r[0]!=="/"&&!r.includes("://")){r=this.url(r);if(r instanceof Error)throw r}return this.all(e,(e=>{e.redirect(r);e.status=n||301}))};Router.prototype.register=function(e,r,n,i={}){const s=this;const{stack:o}=this;if(Array.isArray(e)){for(const o of e){s.register.call(s,o,r,n,i)}return this}const a=new c(e,r,n,{end:i.end===false?i.end:true,name:i.name,sensitive:i.sensitive||this.opts.sensitive||false,strict:i.strict||this.opts.strict||false,prefix:i.prefix||this.opts.prefix||"",ignoreCaptures:i.ignoreCaptures});if(this.opts.prefix){a.setPrefix(this.opts.prefix)}for(let e=0;e<Object.keys(this.params).length;e++){const r=Object.keys(this.params)[e];a.param(r,this.params[r])}o.push(a);u("defined route %s %s",a.methods,a.path);return a};Router.prototype.route=function(e){const r=this.stack;for(let n=r.length,i=0;i<n;i++){if(r[i].name&&r[i].name===e)return r[i]}return false};Router.prototype.url=function(e,r){const n=this.route(e);if(n){const e=Array.prototype.slice.call(arguments,1);return n.url.apply(n,e)}return new Error(`No route found for name: ${String(e)}`)};Router.prototype.match=function(e,r){const n=this.stack;let i;const s={path:[],pathAndMethod:[],route:false};for(let o=n.length,a=0;a<o;a++){i=n[a];u("test %s %s",i.path,i.regexp);if(i.match(e)){s.path.push(i);if(i.methods.length===0||~i.methods.indexOf(r)){s.pathAndMethod.push(i);if(i.methods.length>0)s.route=true}}}return s};Router.prototype.matchHost=function(e){const{host:r}=this;if(!r){return true}if(!e){return false}if(typeof r==="string"){return e===r}if(typeof r==="object"&&r instanceof RegExp){return r.test(e)}};Router.prototype.param=function(e,r){this.params[e]=r;for(let n=0;n<this.stack.length;n++){const i=this.stack[n];i.param(e,r)}return this};Router.url=function(e){const r=Array.prototype.slice.call(arguments,1);return c.prototype.url.apply({path:e},r)}},50335:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.AsyncHooksContextManager=void 0;const i=n(45573);const s=n(90290);class AsyncHooksContextManager{constructor(){this._contexts=new Map;this._stack=[];this._asyncHook=s.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){var e;return(e=this._stack[this._stack.length-1])!==null&&e!==void 0?e:i.ASYNC_ROOT_CONTEXT}with(e,r,n,...i){this._enterContext(e);try{return r.call(n,...i)}finally{this._exitContext()}}enable(){this._asyncHook.enable();return this}disable(){this._asyncHook.disable();this._contexts.clear();this._stack=[];return this}_init(e,r){if(r==="TIMERWRAP")return;const n=this._stack[this._stack.length-1];if(n!==undefined){this._contexts.set(e,n)}}_destroy(e){this._contexts.delete(e)}_before(e){const r=this._contexts.get(e);if(r!==undefined){this._enterContext(r)}}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}bind(e,r){if(typeof r==="function"){const n=this;const contextWrapper=function(...i){return n.with(e,(()=>r.apply(this,i)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:r.length});return contextWrapper}return r}}r.AsyncHooksContextManager=AsyncHooksContextManager},82535:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.AsyncLocalStorageContextManager=void 0;const i=n(45573);const s=n(90290);class AsyncLocalStorageContextManager{constructor(){this._asyncLocalStorage=new s.AsyncLocalStorage}active(){var e;return(e=this._asyncLocalStorage.getStore())!==null&&e!==void 0?e:i.ASYNC_ROOT_CONTEXT}with(e,r,n,...i){const s=n==null?r:r.bind(n);return this._asyncLocalStorage.run(e,s,...i)}enable(){return this}disable(){this._asyncLocalStorage.disable();return this}bind(e,r){if(typeof r==="function"){const n=this;const contextWrapper=function(...i){return n.with(e,(()=>r.apply(this,i)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:r.length});return contextWrapper}return r}}r.AsyncLocalStorageContextManager=AsyncLocalStorageContextManager},78593:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.createContextManager=r.isSemverGreaterThanOrEqualTo=void 0;s(n(50335),r);s(n(82535),r);var o=n(32041);Object.defineProperty(r,"isSemverGreaterThanOrEqualTo",{enumerable:true,get:function(){return o.isSemverGreaterThanOrEqualTo}});Object.defineProperty(r,"createContextManager",{enumerable:true,get:function(){return o.createContextManager}})},32041:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.createContextManager=r.isSemverGreaterThanOrEqualTo=void 0;const i=n(82535);const s=n(50335);const o=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z-]+(?:\.[\da-z-]+)*))?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)?)?$/i;function isSemverGreaterThanOrEqualTo(e,r){const n=o.exec(e);const i=o.exec(r);if(n&&i){if(n[1]===i[1]&&n[2]===i[2]&&n[3]===i[3]&&n[4]===i[4]){return true}return gteString(n[1],i[1])||n[1]===i[1]&>eString(n[2],i[2])||n[1]===i[1]&&n[2]===i[2]&>eString(n[3],i[3])||n[1]===i[1]&&n[2]===i[2]&&n[3]===i[3]&>eString(n[4],i[4])}return false}r.isSemverGreaterThanOrEqualTo=isSemverGreaterThanOrEqualTo;function gteString(e,r){const n=parseInt(e,10);const i=parseInt(r,10);return n>i}function createContextManager(){const e=isSemverGreaterThanOrEqualTo(process.version,"14.8.0")?i.AsyncLocalStorageContextManager:s.AsyncHooksContextManager;return new e}r.createContextManager=createContextManager},87102:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Bootstrap=r.BootstrapStarter=void 0;const i=n(45573);const s=n(16928);const o=n(84416);const a=n(78593);const c=n(56095);const u=n(59625);class BootstrapStarter{constructor(){this.globalOptions={}}configure(e={}){this.globalOptions=e;return this}async init(){this.appDir=this.globalOptions.appDir=this.globalOptions.appDir||process.cwd();this.baseDir=this.globalOptions.baseDir=this.getBaseDir();if(process.env["MIDWAY_FORK_MODE"]){if(process.env["MIDWAY_FORK_MODE"]==="cluster"){this.eventBus=new c.ChildProcessEventBus({isWorker:true})}else if(process.env["MIDWAY_FORK_MODE"]==="thread"){this.eventBus=new c.ThreadEventBus({isWorker:true})}}if(!this.globalOptions.moduleLoadType){const e=await(0,i.loadModule)((0,s.join)(this.appDir,"package.json"),{safeLoad:true,enableCache:false});this.globalOptions.moduleLoadType=(e===null||e===void 0?void 0:e.type)==="module"?"esm":"commonjs"}this.applicationContext=await(0,i.initializeGlobalApplicationContext)({asyncContextManager:(0,a.createContextManager)(),loggerFactory:o.loggers,...this.globalOptions});return this.applicationContext}async run(){this.applicationContext=await this.init();if(this.eventBus){await this.eventBus.start();if(process.env["MIDWAY_STICKY_MODE"]==="true"){const e=this.applicationContext.get(i.MidwayApplicationManager);const r=e.getApplication("socketIO");(0,u.setupWorker)(r)}}const e=this.applicationContext.get(i.MidwayFrameworkService);if(!e.getMainApp()){throw new i.MidwayMainFrameworkMissingError}}async stop(){if(this.applicationContext){await(0,i.destroyGlobalApplicationContext)(this.applicationContext)}if(this.eventBus){await this.eventBus.stop()}}getApplicationContext(){return this.applicationContext}getBaseDir(){if(this.globalOptions.baseDir){return this.globalOptions.baseDir}if((0,i.isTypeScriptEnvironment)()){return(0,s.join)(this.appDir,"src")}else{return(0,s.join)(this.appDir,"dist")}}}r.BootstrapStarter=BootstrapStarter;class Bootstrap{static configure(e={}){this.configured=true;if(!this.logger&&!e.logger){this.logger=this.bootstrapLoggerFactory.createLogger("bootstrap",{enableError:false,enableFile:false,enableConsole:true});if(e.logger===false){if(this.logger["disableConsole"]){this.logger["disableConsole"]()}else{this.logger["level"]="none"}}e.logger=this.logger}else{this.logger=this.logger||e.logger}if(e.appDir&&e.appDir!==process.cwd()){process.chdir(e.appDir)}this.getStarter().configure(e);return this}static getStarter(){if(!this.starter){this.starter=new BootstrapStarter}return this.starter}static async run(){if(!this.configured){this.configure()}process.once("SIGINT",this.onSignal.bind(this,"SIGINT"));process.once("SIGQUIT",this.onSignal.bind(this,"SIGQUIT"));process.once("SIGTERM",this.onSignal.bind(this,"SIGTERM"));process.once("exit",this.onExit.bind(this));this.uncaughtExceptionHandler=this.uncaughtExceptionHandler.bind(this);process.on("uncaughtException",this.uncaughtExceptionHandler);this.unhandledRejectionHandler=this.unhandledRejectionHandler.bind(this);process.on("unhandledRejection",this.unhandledRejectionHandler);return this.getStarter().run().then((()=>{this.logger.info("[midway:bootstrap] current app started");global["MIDWAY_BOOTSTRAP_APP_READY"]=true;return this.getApplicationContext()})).catch((e=>{this.logger.error(e);process.exit(1)}))}static async stop(){await this.getStarter().stop();process.removeListener("uncaughtException",this.uncaughtExceptionHandler);process.removeListener("unhandledRejection",this.unhandledRejectionHandler);this.reset();global["MIDWAY_BOOTSTRAP_APP_READY"]=false}static reset(){this.configured=false;this.starter=null;this.bootstrapLoggerFactory.close()}static async onSignal(e){this.logger.info("[midway:bootstrap] receive signal %s, closing",e);try{await this.stop();this.logger.info("[midway:bootstrap] close done, exiting with code:0");process.exit(0)}catch(e){this.logger.error("[midway:bootstrap] close with error: ",e);process.exit(1)}}static onExit(e){this.logger.info("[midway:bootstrap] exit with code:%s",e)}static uncaughtExceptionHandler(e){if(!(e instanceof Error)){e=new Error(String(e))}if(e.name==="Error"){e.name="unhandledExceptionError"}this.logger.error(e)}static unhandledRejectionHandler(e){if(!(e instanceof Error)){const r=new Error(String(e));if(e){if(e.name)r.name=e.name;if(e.message)r.message=e.message;if(e.stack)r.stack=e.stack}e=r}if(e.name==="Error"){e.name="unhandledRejectionError"}this.logger.error(e)}static getApplicationContext(){return this.getStarter().getApplicationContext()}}r.Bootstrap=Bootstrap;Bootstrap.configured=false;Bootstrap.bootstrapLoggerFactory=new o.MidwayLoggerContainer},41836:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.setupStickyMaster=r.AbstractForkManager=r.ClusterManager=r.BootstrapStarter=r.Bootstrap=void 0;s(n(20651),r);var o=n(87102);Object.defineProperty(r,"Bootstrap",{enumerable:true,get:function(){return o.Bootstrap}});Object.defineProperty(r,"BootstrapStarter",{enumerable:true,get:function(){return o.BootstrapStarter}});var a=n(10985);Object.defineProperty(r,"ClusterManager",{enumerable:true,get:function(){return a.ClusterManager}});var c=n(60727);Object.defineProperty(r,"AbstractForkManager",{enumerable:true,get:function(){return c.AbstractForkManager}});var u=n(59625);Object.defineProperty(r,"setupStickyMaster",{enumerable:true,get:function(){return u.setupStickyMaster}})},20651:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},60727:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.AbstractForkManager=void 0;const i=n(70857);const s=n(39023);const o=n(71470);const a=n(24434);const c=n(39023);const u=(0,c.debuglog)("midway:bootstrap");class AbstractForkManager{constructor(e){this.options=e;this.reforks=[];this.disconnectCount=0;this.unexpectedCount=0;this.disconnects={};this.hub=new a.EventEmitter;this.workers=new Map;this.isClosing=false;e.count=e.count||i.cpus().length-1;e.refork=e.refork!==false;e.limit=e.limit||60;e.duration=e.duration||6e4;e.logger=e.logger||console;e.workerInitTimeout=e.workerInitTimeout||3e4;this.eventBus=this.createEventBus({initTimeout:e.workerInitTimeout})}async start(){u("Start manager with options: %j",this.options);this.bindWorkerDisconnect((e=>{u(" - worker(%s): trigger event = disconnect",this.getWorkerId(e));const r=this.options.logger[e["disableRefork"]?"info":"error"];this.disconnectCount++;const n=this.isWorkerDead(e);if(n){u(" - worker(%s): worker is dead",this.getWorkerId(e));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork, because worker:%s exit event emit before disconnect",(0,o.logDate)(),process.pid,this.getWorkerId(e));return}if(e["disableRefork"]){u(" - worker(%s): worker is disableRefork(maybe terminated by master)",this.getWorkerId(e));r("[%s] [bootstrap:master:%s] don't fork, because worker:%s will be kill soon",(0,o.logDate)(),process.pid,this.getWorkerId(e));return}this.disconnects[this.getWorkerId(e)]=(0,o.logDate)();this.tryToRefork(e)}));this.bindWorkerExit(((e,r,n)=>{u(" - worker(%s): trigger event = exit",this.getWorkerId(e));this.workers.delete(this.getWorkerId(e));if(e["disableRefork"]){return}const i=!!this.disconnects[this.getWorkerId(e)];u(" - worker(%s): isExpected=%s",this.getWorkerId(e),i);if(i){delete this.disconnects[this.getWorkerId(e)];return}u(" - worker(%s): isWorkerDead=%s",this.getWorkerId(e),this.isWorkerDead(e));if(this.isWorkerDead(e)){return}u(" - worker(%s): unexpectedCount will add");this.unexpectedCount++;this.tryToRefork(e);this.onUnexpected(e,r,n)}));this.bindClose();this.hub.on("reachReforkLimit",this.onReachReforkLimit.bind(this));setImmediate((()=>{if(process.listeners("uncaughtException").length===0){process.on("uncaughtException",this.onerror.bind(this))}}));for(let e=0;e<this.options.count;e++){const e=this.createWorker();u(" - worker(%s) created",this.getWorkerId(e));this.eventBus.addWorker(e);this.workers.set(this.getWorkerId(e),e)}await this.eventBus.start()}tryToRefork(e){if(this.allowRefork()){u(" - worker(%s): allow refork and will fork new",this.getWorkerId(e));const r=this.createWorker(e);this.workers.set(this.getWorkerId(r),r);this.options.logger.info("[%s] [bootstrap:master:%s] new worker:%s fork (state: %s)",(0,o.logDate)(),process.pid,this.getWorkerId(r),r["state"]);this.eventBus.addWorker(r)}else{u(" - worker(%s): forbidden refork and will stop",this.getWorkerId(e));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork new work (refork: %s)",(0,o.logDate)(),process.pid,this.options.refork)}}allowRefork(){if(!this.options.refork||this.isClosing){return false}const e=this.reforks.push(Date.now());if(e>this.options.limit){this.reforks.shift()}const r=this.reforks[this.reforks.length-1]-this.reforks[0];const n=this.reforks.length<this.options.limit||r>this.options.duration;if(!n){this.hub.emit("reachReforkLimit")}return n}onerror(e){if(!e){return}this.options.logger.error("[%s] [bootstrap:master:%s] master uncaughtException: %s",(0,o.logDate)(),process.pid,e.stack);this.options.logger.error(e);this.options.logger.error("(total %d disconnect, %d unexpected exit)",this.disconnectCount,this.unexpectedCount)}onUnexpected(e,r,n){const i=e.hasOwnProperty("exitedAfterDisconnect")?"exitedAfterDisconnect":"suicide";const a=new Error(s.format("worker:%s died unexpected (code: %s, signal: %s, %s: %s, state: %s)",this.getWorkerId(e),r,n,i,e[i],e["state"]));a.name="WorkerDiedUnexpectedError";this.options.logger.error("[%s] [bootstrap:master:%s] (total %d disconnect, %d unexpected exit) %s",(0,o.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount,a.stack)}onReachReforkLimit(){this.options.logger.error("[%s] [bootstrap:master:%s] worker died too fast (total %d disconnect, %d unexpected exit)",(0,o.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount)}async killWorker(e,r){await this.closeWorker(e);await Promise.race([(0,a.once)(e,"exit"),(0,o.sleep)(r)]);if(e.killed)return;(e.process||e).kill("SIGKILL")}async stop(e=2e3){u("run close");this.isClosing=true;await this.eventBus.stop();for(const r of this.workers.values()){r["disableRefork"]=true;await this.killWorker(r,e)}if(this.exitListener){await this.exitListener()}}hasWorker(e){return this.workers.has(e)}getWorker(e){return this.workers.get(e)}getWorkerIds(){return Array.from(this.workers.keys())}onStop(e){this.exitListener=e}bindClose(){process.once("SIGINT",this.onSignal.bind(this,"SIGINT"));process.once("SIGQUIT",this.onSignal.bind(this,"SIGQUIT"));process.once("SIGTERM",this.onSignal.bind(this,"SIGTERM"));process.once("exit",this.onMasterExit.bind(this))}async onSignal(e){if(!this.isClosing){this.options.logger.info("[bootstrap:master] receive signal %s, closing",e);try{await this.stop();this.options.logger.info("[bootstrap:master] close done, exiting with code:0");process.exit(0)}catch(e){this.options.logger.error("[midway:master] close with error: ",e);process.exit(1)}}}onMasterExit(e){this.options.logger.info("[bootstrap:master] exit with code:%s",e)}}r.AbstractForkManager=AbstractForkManager},10985:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ClusterManager=void 0;const i=n(56095);const s=n(60727);const o=n(29907);const a=n(39023);const c=n(45573);const u=(0,a.debuglog)("midway:bootstrap");class ClusterManager extends s.AbstractForkManager{constructor(e={}){super(e);this.options=e;e.args=e.args||[];e.execArgv=e.execArgv||[];if((0,c.isTypeScriptEnvironment)()){e.execArgv.push(...["--require","ts-node/register"])}}createWorker(){if(o["setupPrimary"]){o["setupPrimary"](this.options)}else if(o["setupMaster"]){o["setupMaster"](this.options)}return o.fork({MIDWAY_FORK_MODE:"cluster",MIDWAY_STICKY_MODE:this.options.sticky?"true":"false",...this.options.env})}bindWorkerDisconnect(e){u("Bind cluster.disconnect event");o.on("disconnect",e)}bindWorkerExit(e){u("Bind cluster.exit event");o.on("exit",e)}getWorkerId(e){return String(e.process.pid)}isWorkerDead(e){return e.isDead()}closeWorker(e){e.kill("SIGTERM")}createEventBus(e){return new i.ChildProcessEventBus(e)}isPrimary(){return!o.isWorker}}r.ClusterManager=ClusterManager},59625:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.setupWorker=r.setupStickyMaster=void 0;const i=n(29907);const s=n(76982);const randomId=()=>(0,s.randomBytes)(8).toString("hex");function setupStickyMaster(e,r={}){const n={loadBalancingMethod:"least-connection",...r};const s=new Map;const o=/sid=([\w-]{20})/;let a=0;const computeWorkerId=e=>{const r=o.exec(e);if(r){const e=r[1];const n=s.get(e);if(n&&i.workers[n]){return n}}switch(n.loadBalancingMethod){case"random":{const e=Object.keys(i.workers);return e[Math.floor(Math.random()*e.length)]}case"round-robin":{const e=Object.keys(i.workers);a++;if(a>=e.length){a=0}return e[a]}case"least-connection":let e;for(const r in i.workers){const n=i.workers[r];if(e===undefined){e=n}else{const r=n["clientsCount"]||0;const i=e["clientsCount"]||0;if(r<i){e=n}}}return e.id}};e.on("connection",(e=>{let r,n;const sendCallback=r=>{if(r){e.destroy()}};e.on("data",(s=>{let o="utf-8";let a=s.toString(o);if(r&&n){i.workers[r].send({type:"sticky:http-chunk",data:a,encoding:o,connectionId:n},sendCallback);return}r=computeWorkerId(a);const c=!(a.startsWith("GET")||a.substring(0,a.indexOf("\r\n\r\n")).includes("pgrade: websocket"));if(a.startsWith("POST")&&a.includes("multipart/form-data")){o="base64";a=s.toString("base64")}e.pause();if(c){n=randomId()}i.workers[r].send({type:"sticky:connection",data:a,encoding:o,connectionId:n},e,{keepOpen:c},sendCallback)}))}));e.on("request",(e=>{e.on("data",(()=>{}))}));i.on("message",((e,{type:r,data:i})=>{switch(r){case"sticky:connection":s.set(i,e.id);if(n.loadBalancingMethod==="least-connection"){e["clientsCount"]=(e["clientsCount"]||0)+1}break;case"sticky:disconnection":s.delete(i);if(n.loadBalancingMethod==="least-connection"){e["clientsCount"]--}break}}))}r.setupStickyMaster=setupStickyMaster;function setupWorker(e){const r=new Map;process.on("message",(({type:n,data:i,encoding:s,connectionId:o},a)=>{switch(n){case"sticky:connection":if(!a){return}e.httpServer.emit("connection",a);a.emit("data",Buffer.from(i,s));a.resume();if(o){r.set(o,a);a.on("close",(()=>{r.delete(o)}))}break;case"sticky:http-chunk":{const e=r.get(o);if(e){e.emit("data",Buffer.from(i,s))}}}}));const ignoreError=()=>{};e.engine.on("connection",(e=>{process.send({type:"sticky:connection",data:e.id},ignoreError);e.once("close",(()=>{process.send({type:"sticky:disconnection",data:e.id},ignoreError)}))}))}r.setupWorker=setupWorker},71470:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.sleep=r.logDate=void 0;function logDate(){const e=new Date;let r=e.getDate();if(r<10){r="0"+r}let n=e.getMonth()+1;if(n<10){n="0"+n}let i=e.getHours();if(i<10){i="0"+i}let s=e.getMinutes();if(s<10){s="0"+s}let o=e.getSeconds();if(o<10){o="0"+o}let a=e.getMilliseconds();if(a<10){a="00"+a}else if(a<100){a="0"+a}return e.getFullYear()+"-"+n+"-"+r+" "+i+":"+s+":"+o+"."+a}r.logDate=logDate;async function sleep(e){return new Promise((r=>{setTimeout(r,e)}))}r.sleep=sleep},54033:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.multiCaching=r.createCache=r.caching=void 0;const i=n(32884);const s=n(62387);async function caching(e,r){if(e==="memory"){const e=(0,s.memoryStore)(r);return createCache(e,r)}if(typeof e==="function"){const n=await e(r);return createCache(n,r)}return createCache(e,r)}r.caching=caching;function createCache(e,r){return{wrap:async(n,s,o)=>(0,i.coalesceAsync)(n,(async()=>{const a=await e.get(n);if(a===undefined){const r=await s();const i=typeof o==="function"?o(r):o;await e.set(n,r,i);return r}else if(r===null||r===void 0?void 0:r.refreshThreshold){const c=typeof o==="function"?o(a):o;const u=await e.ttl(n);if(u!==-1&&u<r.refreshThreshold){(0,i.coalesceAsync)(`+++${n}`,s).then((r=>e.set(n,r,c)))}}return a})),store:e,del:r=>e.del(r),get:r=>e.get(r),set:(r,n,i)=>e.set(r,n,i),reset:()=>e.reset(),methodWrap:async(n,s,o,a)=>(0,i.coalesceAsync)(n,(async()=>{const c=await e.get(n);if(c===undefined){const r=await s(...o);const i=typeof a==="function"?a(r):a;await e.set(n,r,i);return r}else if(r===null||r===void 0?void 0:r.refreshThreshold){const u=typeof a==="function"?a(c):a;const p=await e.ttl(n);if(p!==-1&&p<r.refreshThreshold){(0,i.coalesceAsync)(`+++${n}`,(()=>s(...o))).then((r=>e.set(n,r,u)))}}return c}))}}r.createCache=createCache;function multiCaching(e){const get=async r=>{for(const n of e){try{const e=await n.get(r);if(e!==undefined)return e}catch(e){}}};const set=async(r,n,i)=>{await Promise.all(e.map((e=>e.set(r,n,i))))};return{get:get,set:set,del:async r=>{await Promise.all(e.map((e=>e.del(r))))},async wrap(r,n,i){let s;let o=0;for(;o<e.length;o++){try{s=await e[o].get(r);if(s!==undefined)break}catch(e){}}if(s===undefined){const e=await n();const s=typeof i==="function"?i(e):i;await set(r,e,s);return e}else{const a=typeof i==="function"?i(s):i;Promise.all(e.slice(0,o).map((e=>e.set(r,s,a)))).then();e[o].wrap(r,n,i).then()}return s},reset:async()=>{await Promise.all(e.map((e=>e.reset())))},mget:async(...r)=>{const n=new Array(r.length).fill(undefined);for(const i of e){if(n.every((e=>e!==undefined)))break;try{const e=await i.store.mget(...r);e.forEach(((e,r)=>{if(n[r]===undefined&&e!==undefined)n[r]=e}))}catch(e){}}return n},mset:async(r,n)=>{await Promise.all(e.map((e=>e.store.mset(r,n))))},mdel:async(...r)=>{await Promise.all(e.map((e=>e.store.mdel(...r))))},methodWrap:async(r,n,i,s)=>{let o;let a=0;for(;a<e.length;a++){try{o=await e[a].get(r);if(o!==undefined)break}catch(e){}}if(o===undefined){const e=await n(...i);const o=typeof s==="function"?s(e):s;await set(r,e,o);return e}else{const c=typeof s==="function"?s(o):s;Promise.all(e.slice(0,a).map((e=>e.set(r,o,c)))).then();e[a].methodWrap(r,n,i,s).then()}return o}}}r.multiCaching=multiCaching},1554:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});s(n(54033),r);s(n(62387),r);s(n(65327),r)},32884:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.coalesceAsync=void 0;const n=new Map;async function coalesceAsync(e,r){if(!hasKey(e)){addKey(e);try{const n=await Promise.resolve(r());coalesce({key:e,result:n});return n}catch(r){coalesce({key:e,error:r});throw r}}return enqueue(e)}r.coalesceAsync=coalesceAsync;function hasKey(e){return n.has(e)}function addKey(e){n.set(e,[])}function removeKey(e){n.delete(e)}function addCallbackToKey(e,r){const i=getCallbacksByKey(e);i.push(r);n.set(e,i)}function getCallbacksByKey(e){var r;return(r=n.get(e))!==null&&r!==void 0?r:[]}function enqueue(e){return new Promise(((r,n)=>{const i={resolve:r,reject:n};addCallbackToKey(e,i)}))}function dequeue(e){const r=getCallbacksByKey(e);removeKey(e);return r}function coalesce(e){const{key:r,error:n,result:i}=e;dequeue(r).forEach((e=>{if(n){e.reject(n)}else{e.resolve(i)}}))}},62387:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.memoryStore=void 0;const i=n(37584);const s=n(15364);function clone(e){if(typeof e==="object"&&e!==null){return s(e)}return e}function memoryStore(e){var r;const n=(e===null||e===void 0?void 0:e.shouldCloneBeforeSet)!==false;const s=(r=e===null||e===void 0?void 0:e.isCacheable)!==null&&r!==void 0?r:e=>e!==undefined;const o={ttlAutopurge:true,...e,max:(e===null||e===void 0?void 0:e.max)||500,ttl:(e===null||e===void 0?void 0:e.ttl)!==undefined?e.ttl:0};const a=new i(o);return{async del(e){a.delete(e)},get:async e=>a.get(e),keys:async()=>[...a.keys()],mget:async(...e)=>e.map((e=>a.get(e))),async mset(e,r){const i={ttl:r!==undefined?r:o.ttl};for(const[r,o]of e){if(!s(o))throw new Error(`no cacheable value ${JSON.stringify(o)}`);if(n)a.set(r,clone(o),i);else a.set(r,o,i)}},async mdel(...e){for(const r of e)a.delete(r)},async reset(){a.clear()},ttl:async e=>a.getRemainingTTL(e),async set(e,r,i){if(!s(r))throw new Error(`no cacheable value ${JSON.stringify(r)}`);if(n)r=clone(r);const c=i!==undefined?i:o.ttl;a.set(e,r,{ttl:c})},get calculatedSize(){return a.calculatedSize},get size(){return a.size},dump:()=>a.dump(),load:(...e)=>a.load(...e)}}r.memoryStore=memoryStore},65327:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},12096:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.CacheConfiguration=r.getClassMethodDefaultCacheKey=void 0;const o=n(45573);const a=n(78335);const c=n(9956);function getClassMethodDefaultCacheKey(e,r){return e.name+"-"+(0,o.getProviderUUId)(e)+"-"+r}r.getClassMethodDefaultCacheKey=getClassMethodDefaultCacheKey;let u=class CacheConfiguration{async onReady(e){this.cacheService=await e.getAsync(c.CachingFactory);this.decoratorService.registerMethodHandler(a.CACHE_DECORATOR_KEY,(({target:e,propertyName:r,metadata:n})=>{if(!n.cacheKey){n.cacheKey=getClassMethodDefaultCacheKey(e,r)}return{around:async e=>{let r=n.cacheKey;const i=this.cacheService.get(n.cacheInstanceName);if(typeof r==="function"){r=await r({methodArgs:e.args,ctx:e.target[o.REQUEST_OBJ_CTX_KEY],target:e.target})}if(typeof r==="string"){return i.methodWrap(r,e.proceed,e.args,n.ttl)}else{return e.proceed(...e.args)}}}}))}};i([(0,o.Inject)(),s("design:type",o.MidwayDecoratorService)],u.prototype,"decoratorService",void 0);u=i([(0,o.Configuration)({namespace:"cacheManager",importConfigs:[{default:{cacheManager:{}}}]})],u);r.CacheConfiguration=u},78335:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Caching=r.CACHE_DECORATOR_KEY=void 0;const i=n(45573);r.CACHE_DECORATOR_KEY="cache-manager:caching";function Caching(e,n,s){if(typeof n==="number"){s=n;n=undefined}return(0,i.createCustomMethodDecorator)(r.CACHE_DECORATOR_KEY,{cacheInstanceName:e,cacheKey:n,ttl:s})}r.Caching=Caching},9956:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.CachingFactory=void 0;const o=n(45573);const a=n(1554);let c=class CachingFactory extends o.ServiceFactory{async init(){await this.initClients(this.cacheManagerConfig)}async createClient(e,r){if(Array.isArray(e.store)){const n=[];for(const i of e.store){if(typeof i==="string"){if(!this.has(i)){throw new o.MidwayCommonError(`cache instance "${i}" not found in "${r}", please check your configuration.`)}n.push(this.get(i))}else if(typeof i==="function"){n.push(await i())}else if(i["wrap"]){n.push(i["wrap"])}else if(typeof i==="object"){if(typeof i.store==="function"){i.store=await i.store(i["options"]||{},this.applicationContext)}if(!i.store){throw new o.MidwayCommonError(`cache instance "${r}" store is undefined, please check your configuration.`)}n.push(await(0,a.caching)(i.store,i["options"]))}else{throw new o.MidwayCommonError("invalid cache config")}}return await(0,a.multiCaching)(n)}else{if(typeof e.store==="function"){e.store=await e.store(e["options"]||{},this.applicationContext)}if(!e.store){throw new o.MidwayCommonError(`cache instance "${r}" store is undefined, please check your configuration.`)}return await(0,a.caching)(e.store,e["options"])}}getName(){return"cache-manager"}getCaching(e){return this.get(e)}getMultiCaching(e){return this.get(e)}};i([(0,o.Config)("cacheManager"),s("design:type",Object)],c.prototype,"cacheManagerConfig",void 0);i([(0,o.ApplicationContext)(),s("design:type",Object)],c.prototype,"applicationContext",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],c.prototype,"init",null);c=i([(0,o.Provide)(),(0,o.Scope)(o.ScopeEnum.Singleton)],c);r.CachingFactory=c},16378:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.CacheManager=r.getClassMethodDefaultCacheKey=r.Configuration=void 0;var o=n(12096);Object.defineProperty(r,"Configuration",{enumerable:true,get:function(){return o.CacheConfiguration}});Object.defineProperty(r,"getClassMethodDefaultCacheKey",{enumerable:true,get:function(){return o.getClassMethodDefaultCacheKey}});s(n(31597),r);s(n(9956),r);s(n(78335),r);r.CacheManager=n(1554);s(n(58811),r)},31597:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},58811:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.createRedisStore=void 0;const i=n(45573);const getVal=e=>JSON.stringify(e)||'"undefined"';function createRedisStore(e){return async(r,n)=>{const{RedisServiceFactory:s}=(0,i.safeRequire)("@midwayjs/redis");const o=await n.getAsync(s);const a=o.get(e);return createStore(a,r)}}r.createRedisStore=createRedisStore;function createStore(e,r){const n=(r===null||r===void 0?void 0:r.isCacheable)||(e=>e!==undefined&&e!==null);const keys=r=>e.keys(r);return{async get(r){const n=await e.get(r);if(n===undefined||n===null)return undefined;else{try{return JSON.parse(n)}catch(e){return n}}},async set(s,o,a){if(!n(o))throw new i.MidwayCommonError(`"${o}" is not a cacheable value`);const c=a===undefined?r===null||r===void 0?void 0:r.ttl:a;if(c!==undefined&&c!==0)await e.set(s,getVal(o),"PX",c);else await e.set(s,getVal(o))},async mset(s,o){const a=o===undefined?r===null||r===void 0?void 0:r.ttl:o;if(a!==undefined&&a!==0){const r=e.multi();for(const[e,o]of s){if(!n(o))throw new i.MidwayCommonError(`"${getVal(o)}" is not a cacheable value`);r.set(e,getVal(o),"PX",a)}await r.exec()}else await e.mset(s.flatMap((([e,r])=>{if(!n(r))throw new Error(`"${getVal(r)}" is not a cacheable value`);return[e,getVal(r)]})))},mget:(...r)=>e.mget(r).then((e=>e.map((e=>{if(e===null||e===undefined){return undefined}else{try{return JSON.parse(e)}catch(r){return e}}})))),async mdel(...r){await e.del(r)},async del(r){await e.del(r)},ttl:async r=>e.pttl(r),keys:(e="*")=>keys(e),reset:()=>{throw new i.MidwayCommonError("flushdb() is too dangerous, if necessary, please use redisServiceFactory.get(client) to get the instance and call it manually.")},isCacheable:n}}},9589:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Cookie=void 0;const i=n(42613);const s=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;const o=/^(?:none|lax|strict)$/i;class Cookie{constructor(e,r,n){i(s.test(e),"argument name is invalid");i(!r||s.test(r),"argument value is invalid");this.name=e;this.value=r||"";this.attrs=mergeDefaultAttrs(n);i(!this.attrs.path||s.test(this.attrs.path),"argument option path is invalid");i(!this.attrs.domain||s.test(this.attrs.domain),"argument option domain is invalid");i(!this.attrs.sameSite||this.attrs.sameSite===true||o.test(this.attrs.sameSite),"argument option sameSite is invalid");if(!r){this.attrs.expires=new Date(0);this.attrs.maxAge=null}}toString(){return this.name+"="+this.value}toHeader(){let e=this.toString();const r=this.attrs;if(r.path)e+="; path="+r.path;const n=typeof r.maxAge==="string"?parseInt(r.maxAge,10):r.maxAge;if(n){e+="; max-age="+Math.round(n/1e3);r.expires=new Date(Date.now()+n)}if(r.expires)e+="; expires="+r.expires.toUTCString();if(r.domain)e+="; domain="+r.domain;if(r.sameSite)e+="; samesite="+(r.sameSite===true?"strict":r.sameSite.toLowerCase());if(r.secure)e+="; secure";if(r.httpOnly)e+="; httponly";if(r.priority)e+="; priority="+r.priority;if(r.partitioned)e+="; partitioned";return e}}r.Cookie=Cookie;const a=["path","expires","domain","httpOnly","secure","partitioned","maxAge","overwrite","sameSite","priority"];function mergeDefaultAttrs(e){const r={path:"/",httpOnly:true,secure:false,overwrite:false,sameSite:false,partitioned:false};if(!e)return r;for(let n=0;n<a.length;n++){const i=a[n];if(i in e)r[i]=e[i]}return r}},84320:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.urlSafeDecode=r.urlSafeEncode=r.Cookies=void 0;const i=n(42613);const s=n(9589);const o=n(83856);const a=n(38552);const c=Symbol("midwayCookies:keysArray");const u=Symbol("midwayCookies:keys");const p=new Map;class Cookies{constructor(e,r,n,i){var s;this[c]=r?[].concat(r):r;this._defaultCookieOptions=n;this._defaultGetCookieOptions=i;this.ctx=e;this.secure=(s=n===null||n===void 0?void 0:n.secure)!==null&&s!==void 0?s:this.ctx.secure;this.app=e.app}get keys(){if(!this[u]){const e=this[c];i(Array.isArray(e),".keys required for encrypt/sign cookies");const r=p.get(e);if(r){this[u]=r}else{this[u]=new o.Keygrip(this[c]);p.set(e,this[u])}}return this[u]}get(e,r){r=Object.assign({},this._defaultGetCookieOptions||{},r);const n=computeSigned(r);const i=this.ctx.get("cookie");if(!i)return;const s=i.match(getPattern(e));if(!s)return;let o=s[1];if(!r.encrypt&&!n)return o;if(n){const r=e+".sig";const n=this.get(r,{signed:false});if(!n)return;const i=e+"="+o;const s=this.keys.verify(i,n);if(s<0){this.set(r,null,{path:"/",signed:false});return}if(s>0){this.set(r,this.keys.sign(i),{signed:false})}return o}o=urlSafeDecode(o);const a=this.keys.decrypt(o);if(a===null||a===void 0?void 0:a.value){return a.value.toString()}return undefined}set(e,r,n){if(!n&&typeof r!=="string"){n=r;r=""}n=Object.assign({},this._defaultCookieOptions,n);const i=computeSigned(n);r=r||"";if(!this.secure&&n.secure){throw new Error("Cannot send secure cookie over unencrypted connection")}let o=this.ctx.response.get("set-cookie")||[];if(!Array.isArray(o))o=[o];if(n.encrypt){r=r&&urlSafeEncode(this.keys.encrypt(r))}if(r.length>4093){this.app.emit("cookieLimitExceed",{name:e,value:r,ctx:this.ctx})}const a=this.ctx.get("user-agent");if(n.sameSite&&typeof n.sameSite==="string"&&n.sameSite.toLowerCase()==="none"){if(!this.secure||a&&!this.isSameSiteNoneCompatible(a)){n.sameSite=false}}if(n.partitioned){if(!this.secure||!a||a&&!this.isPartitionedCompatible(a)){n.partitioned=false}}if(n.partitioned&&n.removeUnpartitioned){const r=n.overwrite;if(r){n.overwrite=false;o=ignoreCookiesByName(o,e)}const a=Object.assign({},n,{partitioned:false});const c=new s.Cookie(e,"",a);if(n.secure===undefined)c.attrs.secure=this.secure;o=pushCookie(o,c);if(i){c.name+=".sig";o=ignoreCookiesByName(o,c.name);o=pushCookie(o,c)}}if(n.priority){if(!a||a&&!this.isPriorityCompatible(a)){n.priority=undefined}}const c=new s.Cookie(e,r,n);if(n.secure===undefined)c.attrs.secure=this.secure;o=pushCookie(o,c);if(i){c.value=r&&this.keys.sign(c.toString());c.name+=".sig";o=pushCookie(o,c)}this.ctx.set("set-cookie",o);return this}isSameSiteNoneCompatible(e){const r=this.parseChromiumAndMajorVersion(e);if(r.chromium&&r.majorVersion){return r.majorVersion>=80}return(0,a.isSameSiteNoneCompatible)(e)}isPartitionedCompatible(e){const r=this.parseChromiumAndMajorVersion(e);if(r.chromium&&r.majorVersion){return r.majorVersion>=114}return false}parseChromiumAndMajorVersion(e){if(!this.uaParseResult){const r=/Chrom[^ /]+\/(\d+)[.\d]* /.exec(e);if(!r)return{chromium:false,majorVersion:undefined};this.uaParseResult={chromium:true,majorVersion:parseInt(r[1])}}return this.uaParseResult}isPriorityCompatible(e){const r=this.parseChromiumAndMajorVersion(e);if(r.chromium&&r.majorVersion){return r.majorVersion>=81}return false}}r.Cookies=Cookies;const g=new Map;function getPattern(e){const r=g.get(e);if(r)return r;const n=new RegExp("(?:^|;) *"+e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)");g.set(e,n);return n}function computeSigned(e){if(e.encrypt)return false;return e.signed!==false}function pushCookie(e,r){if(r.attrs.overwrite){e=ignoreCookiesByName(e,r.name)}e.push(r.toHeader());return e}function ignoreCookiesByName(e,r){const n=`${r}=`;return e.filter((e=>!e.startsWith(n)))}function urlSafeEncode(e){return e.replace(/\+/g,"-").replace(/\//g,"_")}r.urlSafeEncode=urlSafeEncode;function urlSafeDecode(e){return e.replace(/-/g,"+").replace(/_/g,"/")}r.urlSafeDecode=urlSafeDecode},78439:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});s(n(81580),r);s(n(84320),r)},81580:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},83856:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Keygrip=void 0;const i=n(42613);const s=n(39023);const o=n(76982);const a=n(30451);const c=(0,s.debuglog)("midway:cookies");const u={"/":"_","+":"-","=":""};class Keygrip{constructor(e){i(Array.isArray(e)&&e.length,"keys must be provided and should be an array");this.keys=e;this.hash="sha256"}encrypt(e,r){r=r||this.keys[0];try{e=String(e);const n=getAlgorithm();const i=(0,o.randomBytes)(64);const s=(0,o.randomBytes)(16);const a=Math.floor(Math.random()*(99999-1e4+1))+1e4;const c=deriveKeyFromPassword(r,i,Math.floor(a*.47+1337));const u=(0,o.createCipheriv)(n,c,s);const p=Buffer.concat([u.update(e,"utf8"),u.final()]);const g=u.getAuthTag();const v=Buffer.concat([i,s,g,Buffer.from(a.toString()),p]).toString("hex");return getEncryptedPrefix()+v}catch(e){c("crypt error",e.stack);return undefined}}decrypt(e,r){if(!r){const r=this.keys;for(let n=0;n<r.length;n++){const i=this.decrypt(e,r[n]);if(i!==false)return{value:i,index:n}}return false}try{const n=getAlgorithm();const i=e.split(getEncryptedPrefix());if(i.length!==2){return void 0}else{e=i[1]}const s=Buffer.from(e,"hex");const a=s.slice(0,64);const c=s.slice(64,80);const u=s.slice(80,96);const p=parseInt(s.slice(96,101).toString("utf-8"),10);const g=s.slice(101);const v=deriveKeyFromPassword(r,a,Math.floor(p*.47+1337));const b=(0,o.createDecipheriv)(n,v,c);b.setAuthTag(u);return b.update(g,"binary","utf-8")+b.final("utf-8")}catch(e){c("crypt error",e.stack);return false}}sign(e,r){r=r||this.keys[0];return(0,o.createHmac)(this.hash,r).update(e).digest("base64").replace(/\/|\+|=/g,(e=>u[e]))}verify(e,r){const n=this.keys;for(let i=0;i<n.length;i++){if(a(Buffer.from(r),Buffer.from(this.sign(e,n[i])))){c("data %s match key %s",e,n[i]);return i}}return-1}}r.Keygrip=Keygrip;function getAlgorithm(){return"aes-256-gcm"}function getEncryptedPrefix(){return"enc::"}function deriveKeyFromPassword(e,r,n){return(0,o.pbkdf2Sync)(e,r,n,32,"sha512")}},31630:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.BaseFramework=void 0;const o=n(87270);const a=n(77404);const c=n(8351);const u=n(34005);const p=n(14057);const g=n(73440);const v=n(41560);const b=n(70426);const _=n(91044);const E=n(66134);const x=n(43762);const T=n(67072);const w=n(39023);const C=n(46905);const A=n(81347);const k=w.debuglog("midway:debug");class BaseFramework{constructor(e){this.applicationContext=e;this.defaultContext={};this.middlewareManager=this.createMiddlewareManager();this.filterManager=this.createFilterManager();this.guardManager=this.createGuardManager();this.composeMiddleware=null}async init(){var e,r;this.configurationOptions=(e=this.configure())!==null&&e!==void 0?e:{};this.contextLoggerApplyLogger=(r=this.configurationOptions.contextLoggerApplyLogger)!==null&&r!==void 0?r:"appLogger";this.contextLoggerFormat=this.configurationOptions.contextLoggerFormat;this.logger=this.loggerService.getLogger("coreLogger");this.appLogger=this.loggerService.getLogger("appLogger");return this}isEnable(){return true}async initialize(e){this.bootstrapOptions=e;await this.beforeContainerInitialize(e);await this.containerInitialize(e);await this.afterContainerInitialize(e);await this.containerDirectoryLoad(e);await this.afterContainerDirectoryLoad(e);await this.applicationInitialize(e);await this.containerReady(e);await this.afterContainerReady(e);await this.mockService.runSimulatorAppSetup(this.app)}async containerInitialize(e){}async containerDirectoryLoad(e){}async containerReady(e){if(!this.app.getApplicationContext){this.defineApplicationProperties()}}getApplicationContext(){return this.applicationContext}getConfiguration(e){return this.configService.getConfiguration(e)}getCurrentEnvironment(){return this.environmentService.getCurrentEnvironment()}getApplication(){return this.app}createContextLogger(e,r){if(r&&r!=="appLogger"){const n=this.getLogger(r);let i=e.getAttr(a.REQUEST_CTX_LOGGER_CACHE_KEY);if(!i){i=new Map;e.setAttr(a.REQUEST_CTX_LOGGER_CACHE_KEY,i)}if(i.has(r)){return i.get(r)}const s=this.loggerService.createContextLogger(e,n);i.set(r,s);return s}else{const n=this.getLogger(r!==null&&r!==void 0?r:this.contextLoggerApplyLogger);if(e["_logger"]){return e["_logger"]}e["_logger"]=this.loggerService.createContextLogger(e,n,{contextFormat:this.contextLoggerFormat});return e["_logger"]}}async stop(){await this.mockService.runSimulatorAppTearDown(this.app);await this.beforeStop()}getAppDir(){return this.informationService.getAppDir()}getBaseDir(){return this.informationService.getBaseDir()}defineApplicationProperties(e={},r=[]){const n={getBaseDir:()=>this.getBaseDir(),getAppDir:()=>this.getAppDir(),getEnv:()=>this.getCurrentEnvironment(),getApplicationContext:()=>this.getApplicationContext(),getConfig:e=>this.getConfiguration(e),getFrameworkType:()=>{if(this["getFrameworkType"]){return this["getFrameworkType"]()}},getProcessType:()=>o.MidwayProcessTypeEnum.APPLICATION,getCoreLogger:()=>this.getCoreLogger(),getLogger:e=>this.getLogger(e),createLogger:(e,r={})=>this.createLogger(e,r),getFramework:()=>this,getProjectName:()=>this.getProjectName(),createAnonymousContext:e=>{const r=e||Object.create(this.defaultContext);if(!r.startTime){r.startTime=Date.now()}if(!r.logger){r.logger=this.createContextLogger(r)}if(!r.requestContext){r.requestContext=new u.MidwayRequestContainer(r,this.getApplicationContext());r.requestContext.ready()}if(!r.getLogger){r.getLogger=e=>this.createContextLogger(r,e)}r.setAttr=(e,n)=>{r.requestContext.setAttr(e,n)};r.getAttr=e=>r.requestContext.getAttr(e);r.getApp=()=>this.getApplication();return r},addConfigObject:e=>{this.configService.addObject(e)},setAttr:(e,r)=>{this.getApplicationContext().setAttr(e,r)},getAttr:e=>this.getApplicationContext().getAttr(e),useMiddleware:e=>this.useMiddleware(e),getMiddleware:()=>this.getMiddleware(),useFilter:e=>this.useFilter(e),useGuard:e=>this.useGuard(e),getNamespace:()=>this.getNamespace()};for(const e of r){delete n[e]}Object.assign(this.app,n,e)}async beforeStop(){}async beforeContainerInitialize(e){}async afterContainerInitialize(e){}async afterContainerDirectoryLoad(e){}async afterContainerReady(e){}async applyMiddleware(e){var r;if(!this.composeMiddleware){if(!this.applicationContext.hasObject(a.ASYNC_CONTEXT_MANAGER_KEY)){const e=this.configService.getConfiguration("asyncContextManager.enable")||false;const n=e?((r=this.bootstrapOptions)===null||r===void 0?void 0:r.asyncContextManager)||new C.NoopContextManager:new C.NoopContextManager;if(e){n.enable()}this.applicationContext.registerObject(a.ASYNC_CONTEXT_MANAGER_KEY,n)}this.middlewareManager.insertFirst((async(e,r)=>{const n=C.ASYNC_ROOT_CONTEXT.setValue(a.ASYNC_CONTEXT_KEY,e);const i=this.applicationContext.get(a.ASYNC_CONTEXT_MANAGER_KEY);return await i.with(n,(async()=>{await this.mockService.runSimulatorContextSetup(e,this.app);this.mockService.applyContextMocks(this.app,e);let n=undefined;try{const i=await r();n=await this.filterManager.runResultFilter(i,e)}catch(r){n=await this.filterManager.runErrorFilter(r,e)}finally{await this.mockService.runSimulatorContextTearDown(e,this.app)}if(n.error){throw n.error}return n.result}))}));k(`[core]: Compose middleware = [${this.middlewareManager.getNames()}]`);this.composeMiddleware=await this.middlewareService.compose(this.middlewareManager,this.app);await this.filterManager.init(this.applicationContext)}if(e){e=Array.isArray(e)?e:[e];return await this.middlewareService.compose([this.composeMiddleware,...e],this.app)}return this.composeMiddleware}getLogger(e){var r;return(r=this.loggerService.getLogger(e))!==null&&r!==void 0?r:this.appLogger}getCoreLogger(){return this.logger}createLogger(e,r={}){return this.loggerService.createLogger(e,r)}getProjectName(){return this.informationService.getProjectName()}getFrameworkName(){return this.constructor.name}useMiddleware(e){this.middlewareManager.insertLast(e)}getMiddleware(){return this.middlewareManager}useFilter(e){return this.filterManager.useFilter(e)}useGuard(e){return this.guardManager.addGlobalGuard(e)}async runGuard(e,r,n){return this.guardManager.runGuard(e,r,n)}createMiddlewareManager(){return new _.ContextMiddlewareManager}createFilterManager(){return new x.FilterManager}createGuardManager(){return new A.GuardManager}setNamespace(e){this.namespace=e}getNamespace(){return this.namespace}}i([(0,c.Inject)(),s("design:type",b.MidwayLoggerService)],BaseFramework.prototype,"loggerService",void 0);i([(0,c.Inject)(),s("design:type",p.MidwayEnvironmentService)],BaseFramework.prototype,"environmentService",void 0);i([(0,c.Inject)(),s("design:type",g.MidwayConfigService)],BaseFramework.prototype,"configService",void 0);i([(0,c.Inject)(),s("design:type",v.MidwayInformationService)],BaseFramework.prototype,"informationService",void 0);i([(0,c.Inject)(),s("design:type",E.MidwayMiddlewareService)],BaseFramework.prototype,"middlewareService",void 0);i([(0,c.Inject)(),s("design:type",T.MidwayMockService)],BaseFramework.prototype,"mockService",void 0);i([(0,c.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],BaseFramework.prototype,"init",null);r.BaseFramework=BaseFramework},51926:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.MidwayApplicationManager=void 0;const s=n(87270);const o=n(8351);let a=class MidwayApplicationManager{constructor(){this.globalFrameworkMap=new Map;this.globalFrameworkTypeMap=new WeakMap}addFramework(e,r){this.globalFrameworkMap.set(e,r);if(r["getFrameworkType"]){this.globalFrameworkTypeMap.set(r["getFrameworkType"](),r)}}getFramework(e){if(typeof e==="string"){if(this.globalFrameworkMap.has(e)){return this.globalFrameworkMap.get(e)}}else{if(this.globalFrameworkTypeMap.has(e)){return this.globalFrameworkTypeMap.get(e)}}}getApplication(e){if(typeof e==="string"){if(this.globalFrameworkMap.has(e)){return this.globalFrameworkMap.get(e).getApplication()}}else{if(this.globalFrameworkTypeMap.has(e)){return this.globalFrameworkTypeMap.get(e).getApplication()}}}getApplications(e){if(!e){return Array.from(this.globalFrameworkMap.values()).map((e=>e.getApplication())).filter((e=>!!e))}else{return e.map((e=>this.getApplication(e))).filter((e=>!!e))}}};a=i([(0,o.Provide)(),(0,o.Scope)(s.ScopeEnum.Singleton)],a);r.MidwayApplicationManager=a},46905:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.NoopContextManager=r.ASYNC_ROOT_CONTEXT=void 0;class AsyncBaseContext{constructor(e){const r=this;r._currentContext=e?new Map(e):new Map;r.getValue=e=>r._currentContext.get(e);r.setValue=(e,n)=>{const i=new AsyncBaseContext(r._currentContext);i._currentContext.set(e,n);return i};r.deleteValue=e=>{const n=new AsyncBaseContext(r._currentContext);n._currentContext.delete(e);return n}}}r.ASYNC_ROOT_CONTEXT=new AsyncBaseContext;class NoopContextManager{active(){return r.ASYNC_ROOT_CONTEXT}with(e,r,n,...i){return r.call(n,...i)}bind(e,r){return r}enable(){return this}disable(){return this}}r.NoopContextManager=NoopContextManager},7647:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.DataListener=void 0;const o=n(8351);class DataListener{async init(){this.innerData=await this.initData();await this.onData(this.setData.bind(this))}setData(e){this.innerData=e}getData(){return this.innerData}async stop(){await this.destroyListener()}async destroyListener(){}}i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],DataListener.prototype,"init",null);i([(0,o.Destroy)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],DataListener.prototype,"stop",null);r.DataListener=DataListener},50771:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.globModels=r.formatGlobString=r.DataSourceManager=void 0;const o=n(90428);const a=n(86248);const c=n(30266);const u=n(16928);const p=n(73171);const g=n(77404);const v=n(39023);const b=n(86110);const _=n(8351);const E=n(14057);const x=n(60340);const T=(0,v.debuglog)("midway:debug");class DataSourceManager{constructor(){this.dataSource=new Map;this.options={};this.modelMapping=new WeakMap;this.dataSourcePriority={}}async initDataSource(e,r){var n;this.options=e;if(!this.options.dataSource){throw new a.MidwayParameterError("[DataSourceManager] must set options.dataSource.")}if(typeof r==="string"){r={baseDir:r,entitiesConfigKey:"entities"}}for(const i in e.dataSource){const s=e.dataSource[i];const o=s[r.entitiesConfigKey];if(o){const e=new Set;for(const s of o){if(typeof s==="string"){const o=await globModels(s,r.baseDir,(n=this.environmentService)===null||n===void 0?void 0:n.getModuleLoadType());for(const r of o){e.add(r);this.modelMapping.set(r,i)}}else{e.add(s);this.modelMapping.set(s,i)}}s[r.entitiesConfigKey]=Array.from(e);T(`[core]: DataManager load ${s[r.entitiesConfigKey].length} models from ${i}.`)}const a={cacheInstance:e.cacheInstance,validateConnection:e.validateConnection};await this.createInstance(s,i,a)}}getDataSource(e){return this.dataSource.get(e)}hasDataSource(e){return this.dataSource.has(e)}getDataSourceNames(){return Array.from(this.dataSource.keys())}getAllDataSources(){return this.dataSource}async isConnected(e){const r=this.getDataSource(e);return r?this.checkConnected(r):false}async createInstance(e,r,n){const i=n&&typeof n.cacheInstance==="boolean"?n.cacheInstance:true;const s=n&&n.validateConnection||false;const c=(0,o.extend)(true,{},this.options["default"],e);const u=await this.createDataSource(c,r);if(i&&r&&u){this.dataSource.set(r,u)}if(s){if(!u){throw new a.MidwayCommonError(`[DataSourceManager] ${r} initialization failed.`)}const e=await this.checkConnected(u);if(!e){throw new a.MidwayCommonError(`[DataSourceManager] ${r} is not connected.`)}}return u}getDataSourceNameByModel(e){return this.modelMapping.get(e)}async stop(){const e=Array.from(this.dataSource.values());await Promise.all(e.map((e=>this.destroyDataSource(e))));this.dataSource.clear()}getDefaultDataSourceName(){if(this.innerDefaultDataSourceName===undefined){if(this.options["defaultDataSourceName"]){this.innerDefaultDataSourceName=this.options["defaultDataSourceName"]}else if(this.dataSource.size===1){this.innerDefaultDataSourceName=Array.from(this.dataSource.keys())[0]}else{this.innerDefaultDataSourceName=""}}return this.innerDefaultDataSourceName}getDataSourcePriority(e){return this.priorityManager.getPriority(this.dataSourcePriority[e])}isHighPriority(e){return this.priorityManager.isHighPriority(this.dataSourcePriority[e])}isMediumPriority(e){return this.priorityManager.isMediumPriority(this.dataSourcePriority[e])}isLowPriority(e){return this.priorityManager.isLowPriority(this.dataSourcePriority[e])}}i([(0,_.Inject)(),s("design:type",String)],DataSourceManager.prototype,"appDir",void 0);i([(0,_.Inject)(),s("design:type",E.MidwayEnvironmentService)],DataSourceManager.prototype,"environmentService",void 0);i([(0,_.Inject)(),s("design:type",x.MidwayPriorityManager)],DataSourceManager.prototype,"priorityManager",void 0);r.DataSourceManager=DataSourceManager;function formatGlobString(e){let r;if(!/^\*/.test(e)){e="/"+e}const n=(0,u.parse)(e);if(n.base&&(/\*/.test(n.base)||n.ext)){r=[e]}else{r=[...g.DEFAULT_PATTERN.map((r=>(0,u.join)(e,r)))]}return r}r.formatGlobString=formatGlobString;async function globModels(e,r,n){const i=formatGlobString(e);const s=[];const o=(0,c.run)(i,{cwd:r,ignore:g.IGNORE_PATTERN});for(const e of o){const r=await(0,b.loadModule)(e,{loadMode:n});if(p.Types.isClass(r)){s.push(r)}else{for(const e in r){const n=r[e];if(p.Types.isClass(n)){s.push(n)}}}}return s}r.globModels=globModels},11207:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.CustomModuleDetector=r.ESModuleFileDetector=r.CommonJSFileDetector=r.AbstractFileDetector=void 0;const i=n(73171);const s=n(30266);const o=n(86248);const a=n(77404);const c=n(8351);const u=n(86110);class AbstractFileDetector{constructor(e){this.options=e;this.extraDetectorOptions={}}setExtraDetectorOptions(e){this.extraDetectorOptions=e}}r.AbstractFileDetector=AbstractFileDetector;const p=["**/**.tsx"].concat(a.DEFAULT_PATTERN);const g=["**/logs/**","**/run/**","**/public/**","**/app/view/**","**/app/views/**","**/app/extend/**","**/node_modules/**","**/**.test.ts","**/**.test.js","**/__test__/**"].concat(a.IGNORE_PATTERN);class CommonJSFileDetector extends AbstractFileDetector{constructor(){super(...arguments);this.duplicateModuleCheckSet=new Map}run(e){if(this.getType()==="commonjs"){return this.loadSync(e)}else{return this.loadAsync(e)}}loadSync(e){var r;this.options=this.options||{};const n=[].concat((r=this.options.loadDir)!==null&&r!==void 0?r:e.get("baseDir"));for(const r of n){const n=(0,s.run)(p.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:r,ignore:g.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(e,r)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&i.Types.isClass(e)){const n=(0,c.getProviderName)(e);if(n){if(this.duplicateModuleCheckSet.has(n)){throw new o.MidwayDuplicateClassNameError(n,r.srcPath,this.duplicateModuleCheckSet.get(n))}else{this.duplicateModuleCheckSet.set(n,r.srcPath)}}}};for(const r of n){const n=require(r);e.bindClass(n,{namespace:this.options.namespace,srcPath:r,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}async loadAsync(e){var r;this.options=this.options||{};const n=[].concat((r=this.options.loadDir)!==null&&r!==void 0?r:e.get("baseDir"));for(const r of n){const n=(0,s.run)(p.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:r,ignore:g.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(e,r)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&i.Types.isClass(e)){const n=(0,c.getProviderName)(e);if(n){if(this.duplicateModuleCheckSet.has(n)){throw new o.MidwayDuplicateClassNameError(n,r.srcPath,this.duplicateModuleCheckSet.get(n))}else{this.duplicateModuleCheckSet.set(n,r.srcPath)}}}};for(const r of n){const n=await(0,u.loadModule)(r,{loadMode:"esm"});e.bindClass(n,{namespace:this.options.namespace,srcPath:r,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}getType(){return"commonjs"}}r.CommonJSFileDetector=CommonJSFileDetector;class ESModuleFileDetector extends CommonJSFileDetector{getType(){return"module"}}r.ESModuleFileDetector=ESModuleFileDetector;class CustomModuleDetector extends AbstractFileDetector{async run(e){for(const r of this.options.modules){e.bindClass(r,{namespace:this.options.namespace,createFrom:"module"})}}}r.CustomModuleDetector=CustomModuleDetector},43762:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.FilterManager=void 0;const i=n(8351);const s=n(86110);class FilterManager{constructor(){this.errFilterList=[];this.successFilterList=[];this.exceptionMap=new WeakMap;this.defaultErrFilter=undefined;this.matchFnList=[];this.protoMatchList=[]}useFilter(e){if(!Array.isArray(e)){e=[e]}for(const r of e){if((0,i.getClassMetadata)(i.CATCH_KEY,r)){this.errFilterList.push(r)}if((0,i.getClassMetadata)(i.MATCH_KEY,r)){this.successFilterList.push(r)}}}async init(e){for(const r of this.errFilterList){const n=await e.getAsync(r);const s=(0,i.getClassMetadata)(i.CATCH_KEY,r);if(s&&s.catchTargets){s.catchOptions=s.catchOptions||{};for(const e of s.catchTargets){this.exceptionMap.set(e,{filter:n,catchOptions:s.catchOptions});if(s.catchOptions["matchPrototype"]){this.protoMatchList.push((r=>{if(r instanceof e){return e}else{return false}}))}}}else{this.defaultErrFilter=n}}for(const r of this.successFilterList){const n=await e.getAsync(r);const o=(0,i.getClassMetadata)(i.MATCH_KEY,r);if(o&&o.matchPattern){this.matchFnList.push({matchFn:(0,s.toPathMatch)(o.matchPattern),target:n})}}}async runErrorFilter(e,r,n,i){let s,o;let a=false;if(this.exceptionMap.has(e.constructor)){a=true;const o=this.exceptionMap.get(e.constructor);s=await o.filter.catch(e,r,n,i)}if(!a&&this.protoMatchList.length){let o;for(const r of this.protoMatchList){o=r(e);if(o){break}}if(o){a=true;const c=this.exceptionMap.get(o);s=await c.filter.catch(e,r,n,i)}}if(!a&&this.defaultErrFilter){a=true;s=await this.defaultErrFilter.catch(e,r,n,i)}if(!a){o=e}return{result:s,error:o}}async runResultFilter(e,r,n,i){let s=e;for(const e of this.matchFnList){if(e.matchFn(r,n)){s=await e.target.match(s,r,n,i)}}return{result:s,error:undefined}}}r.FilterManager=FilterManager},81347:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.GuardManager=void 0;const i=n(8351);class GuardManager extends Array{addGlobalGuard(e){if(!Array.isArray(e)){this.push(e)}else{this.push(...e)}}async runGuard(e,r,n){for(const i of this){const s=await e.requestContext.getAsync(i);const o=await s.canActivate(e,r,n);if(!o){return false}}const s=(0,i.getClassMetadata)(i.GUARD_KEY,r);if(s){for(const i of s){const s=await e.requestContext.getAsync(i);const o=await s.canActivate(e,r,n);if(!o){return false}}}const o=(0,i.getPropertyMetadata)(i.GUARD_KEY,r,n);if(o){for(const i of o){const s=await e.requestContext.getAsync(i);const o=await s.canActivate(e,r,n);if(!o){return false}}}return true}}r.GuardManager=GuardManager},94853:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DefaultConsoleLoggerFactory=r.LoggerFactory=void 0;class LoggerFactory{}r.LoggerFactory=LoggerFactory;class DefaultConsoleLoggerFactory{constructor(){this.instance=new Map}createLogger(e,r){this.instance.set(e,console);return console}getLogger(e){return this.instance.get(e)}close(e){}removeLogger(e){}getDefaultMidwayLoggerConfig(){return{midwayLogger:{default:{},clients:{coreLogger:{},appLogger:{}}}}}createContextLogger(e,r,n){return r}getClients(){return this.instance}getClientKeys(){return Array.from(this.instance.keys())}}r.DefaultConsoleLoggerFactory=DefaultConsoleLoggerFactory},91044:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.createMiddleware=r.ContextMiddlewareManager=void 0;class ContextMiddlewareManager extends Array{insertFirst(e){if(Array.isArray(e)){this.unshift(...e)}else{this.unshift(e)}}insertLast(e){if(Array.isArray(e)){this.push(...e)}else{this.push(e)}}insertBefore(e,r){if(typeof r!=="number"){r=this.findItemIndex(r)}if(Array.isArray(e)){this.splice(r,0,...e)}else{this.splice(r,0,e)}}insertAfter(e,r){if(typeof r!=="number"){r=this.findItemIndex(r)}if(Array.isArray(e)){this.splice(r+1,0,...e)}else{this.splice(r+1,0,e)}}findAndInsertAfter(e,r){e=this.findItem(e);r=this.findItem(r);if(!e||!r||e===r){return}if(r){const n=this.remove(e);if(n){this.insertAfter(n,r)}}}findAndInsertBefore(e,r){e=this.findItem(e);r=this.findItem(r);if(!e||!r||e===r){return}if(r){const n=this.remove(e);if(n){this.insertBefore(n,r)}}}findAndInsertFirst(e){const r=this.remove(e);if(r){this.insertFirst(r)}}findAndInsertLast(e){const r=this.remove(e);if(r){this.insertLast(r)}}findItemIndex(e){if(typeof e==="number"){return e}else if(typeof e==="string"){return this.findIndex((r=>this.getMiddlewareName(r)===e))}else{return this.findIndex((r=>r===e))}}findItem(e){if(typeof e==="number"){if(e>=0&&e<=this.length-1){return this[e]}}else if(typeof e==="string"){return this.find((r=>this.getMiddlewareName(r)===e))}else{return e}}getMiddlewareName(e){var r,n,i;if(e["middleware"]){return(r=e.name)!==null&&r!==void 0?r:this.getMiddlewareName(e["middleware"])}return(i=(n=e.getName&&e.getName())!==null&&n!==void 0?n:e._name)!==null&&i!==void 0?i:e.name}remove(e){if(typeof e==="number"&&e!==-1){return this.splice(e,1)[0]}else{const r=this.findItemIndex(e);if(r!==-1){return this.splice(r,1)[0]}}}push(...e){e.forEach((e=>{if(typeof e!=="string"&&!this.getMiddlewareName(e)){e._name="anonymous"}}));return super.push(...e)}unshift(...e){e.forEach((e=>{if(typeof e!=="string"&&!this.getMiddlewareName(e)){e._name="anonymous"}}));return super.unshift(...e)}getNames(){return this.map((e=>this.getMiddlewareName(e)))}}r.ContextMiddlewareManager=ContextMiddlewareManager;function createMiddleware(e,r,n){return{middleware:e,options:r,name:n}}r.createMiddleware=createMiddleware},4334:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayInitializerPerformanceManager=r.MidwayPerformanceManager=void 0;const i=n(82987);class MidwayPerformanceManager{constructor(e){this.group=e;this.observer=null;this.marks=new Set;this.measures=new Set}static getInstance(e){if(!this.instances.has(e)){this.instances.set(e,new MidwayPerformanceManager(e))}return this.instances.get(e)}formatKey(e,r){return`${this.group}:${e}-${r}`}markStart(e){const r=this.formatKey(e,"start");i.performance.mark(r);this.marks.add(r)}markEnd(e){const r=this.formatKey(e,"start");const n=this.formatKey(e,"end");const s=`${this.group}:${e}`;i.performance.mark(n);this.marks.add(n);i.performance.measure(s,r,n);this.measures.add(s)}observeMeasure(e){if(this.observer){return}this.observer=new i.PerformanceObserver((r=>{const n=r.getEntries().filter((e=>e.name.startsWith(`${this.group}:`)));if(n.length>0){e({getEntries:()=>n})}}));this.observer.observe({entryTypes:["measure"]});return this.observer}disconnect(){if(this.observer){this.observer.disconnect();this.observer=null}}clean(){this.marks.forEach((e=>{try{i.performance.clearMarks(e)}catch(r){console.warn(`Failed to clear mark ${e}: ${r}`)}}));this.marks.clear();this.measures.forEach((e=>{try{i.performance.clearMeasures(e)}catch(r){console.warn(`Failed to clear measure ${e}: ${r}`)}}));this.measures.clear();this.disconnect()}static cleanAll(){this.instances.forEach((e=>e.clean()));this.instances.clear()}static getInitialPerformanceEntries(){const e=[];i.performance===null||i.performance===void 0?void 0:i.performance.getEntries().forEach((r=>{if(r.name.startsWith(this.DEFAULT_GROUP.INITIALIZE)){e.push(r.toJSON())}}));return e}}r.MidwayPerformanceManager=MidwayPerformanceManager;MidwayPerformanceManager.instances=new Map;MidwayPerformanceManager.DEFAULT_GROUP={INITIALIZE:"MidwayInitialize"};class MidwayInitializerPerformanceManager{static markStart(e){const r=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);r.markStart(e)}static markEnd(e){const r=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);r.markEnd(e)}static frameworkInitializeStart(e){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${e}`)}static frameworkInitializeEnd(e){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${e}`)}static frameworkRunStart(e){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${e}`)}static frameworkRunEnd(e){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${e}`)}static lifecycleStart(e,r){this.markStart(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${e}:${r}`)}static lifecycleEnd(e,r){this.markEnd(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${e}:${r}`)}}r.MidwayInitializerPerformanceManager=MidwayInitializerPerformanceManager;MidwayInitializerPerformanceManager.MEASURE_KEYS={INITIALIZE:"Initialize",METADATA_PREPARE:"MetadataPrepare",DETECTOR_PREPARE:"DetectorPrepare",DEFINITION_PREPARE:"DefinitionPrepare",CONFIG_LOAD:"ConfigLoad",LOGGER_PREPARE:"LoggerPrepare",FRAMEWORK_PREPARE:"FrameworkPrepare",FRAMEWORK_INITIALIZE:"FrameworkInitialize",FRAMEWORK_RUN:"FrameworkRun",LIFECYCLE_PREPARE:"LifecyclePrepare",PRELOAD_MODULE_PREPARE:"PreloadModulePrepare"}},60340:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.MidwayPriorityManager=r.DEFAULT_PRIORITY=void 0;const s=n(8351);const o=n(87270);r.DEFAULT_PRIORITY={L1:"High",L2:"Medium",L3:"Low"};let a=class MidwayPriorityManager{constructor(){this.priorityList=r.DEFAULT_PRIORITY;this.defaultPriority=r.DEFAULT_PRIORITY.L2}getCurrentPriorityList(){return this.priorityList}getDefaultPriority(){return this.defaultPriority}isHighPriority(e=r.DEFAULT_PRIORITY.L2){return e===r.DEFAULT_PRIORITY.L1}isMediumPriority(e=r.DEFAULT_PRIORITY.L2){return e===r.DEFAULT_PRIORITY.L2}isLowPriority(e=r.DEFAULT_PRIORITY.L2){return e===r.DEFAULT_PRIORITY.L3}getPriority(e){return e||this.getDefaultPriority()}};a=i([(0,s.Provide)(),(0,s.Scope)(o.ScopeEnum.Singleton)],a);r.MidwayPriorityManager=a},37940:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.ServiceFactory=void 0;const o=n(90428);const a=n(60340);const c=n(8351);class ServiceFactory{constructor(){this.clients=new Map;this.options={}}async initClients(e={}){this.options=e;if(e.client){e.clients=e.clients||{};e.clients["default"]=e.clients["default"]||{};(0,o.extend)(true,e.clients["default"],e.client)}if(e.clients){for(const r of Object.keys(e.clients)){await this.createInstance(e.clients[r],r)}}this.clientPriority=e.priority||{}}get(e="default"){return this.clients.get(e)}has(e){return this.clients.has(e)}async createInstance(e,r){e=(0,o.extend)(true,{},this.options["default"],e);const n=await this.createClient(e,r);if(n){if(r){this.clients.set(r,n)}return n}}async destroyClient(e,r){}async stop(){for(const[e,r]of this.clients.entries()){await this.destroyClient(r,e)}}getDefaultClientName(){return this.options["defaultClientName"]}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}getClientPriority(e){return this.priorityManager.getPriority(this.clientPriority[e])}isHighPriority(e){return this.priorityManager.isHighPriority(this.clientPriority[e])}isMediumPriority(e){return this.priorityManager.isMediumPriority(this.clientPriority[e])}isLowPriority(e){return this.priorityManager.isLowPriority(this.clientPriority[e])}}i([(0,c.Inject)(),s("design:type",a.MidwayPriorityManager)],ServiceFactory.prototype,"priorityManager",void 0);r.ServiceFactory=ServiceFactory},53924:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TypedResourceManager=void 0;class TypedResourceManager{constructor(e){this.typedResourceInitializerOptions=e;this.resourceMap=new Map;this.resourceBindingMap=new Map}async createResource(e,r){const n=await this.typedResourceInitializerOptions.resourceInitialize(r,e);this.resourceMap.set(e,n);return n}async init(){for(const e of Object.keys(this.typedResourceInitializerOptions.initializeValue)){const r=this.typedResourceInitializerOptions.initializeValue[e];const n=this.typedResourceInitializerOptions.initializeClzProvider[e];const i=await this.createResource(e,r);const s=await this.typedResourceInitializerOptions.resourceBinding(n,r,i,e);if(s){this.resourceBindingMap.set(e,s)}}}async startParallel(){const e=[];for(const[r,n]of this.resourceMap.entries()){e.push(this.typedResourceInitializerOptions.resourceStart(n,this.typedResourceInitializerOptions.initializeValue[r],this.resourceBindingMap.get(r)))}await Promise.all(e)}async start(){for(const[e,r]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceStart(r,this.typedResourceInitializerOptions.initializeValue[e],this.resourceBindingMap.get(e))}}async destroyParallel(){const e=[];for(const[r,n]of this.resourceMap.entries()){e.push(this.typedResourceInitializerOptions.resourceDestroy(n,this.typedResourceInitializerOptions.initializeValue[r]))}await Promise.all(e)}async destroy(){for(const[e,r]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceDestroy(r,this.typedResourceInitializerOptions.initializeValue[e])}this.resourceMap.clear();this.resourceBindingMap.clear()}getResource(e){return this.resourceMap.get(e)}}r.TypedResourceManager=TypedResourceManager},12888:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.WebControllerGenerator=void 0;const i=n(8351);const s=n(39023);const o=n(87270);const a=n(86248);const c=n(66134);const u=s.debuglog("midway:debug");class WebControllerGenerator{constructor(e,r){this.app=e;this.midwayWebRouterService=r}generateKoaController(e){return async(r,n)=>{if(e.controllerClz&&typeof e.method==="string"){const n=await this.app.getFramework().runGuard(r,e.controllerClz,e.method);if(!n){throw new a.httpError.ForbiddenError}}const s=[r,n];let o;if(typeof e.method!=="string"){o=await e.method(r,n)}else{const n=await r.requestContext.getAsync(e.id);o=await n[e.method].apply(n,s)}if(o!==undefined){if(o===null){r.response._body=null;r.response._midwayControllerNullBody=true}else{r.body=o}}if(Array.isArray(e.responseMetadata)&&e.responseMetadata.length){for(const n of e.responseMetadata){switch(n.type){case i.WEB_RESPONSE_HTTP_CODE:r.status=n.code;break;case i.WEB_RESPONSE_HEADER:for(const e in(n===null||n===void 0?void 0:n.setHeaders)||{}){r.set(e,n.setHeaders[e])}break;case i.WEB_RESPONSE_CONTENT_TYPE:r.type=n.contentType;break;case i.WEB_RESPONSE_REDIRECT:r.status=n.code;r.redirect(n.url);return}}}}}async loadMidwayController(e){var r,n;const i=await this.midwayWebRouterService.getRouterTable();const s=await this.midwayWebRouterService.getRoutePriorityList();const a=this.app.getApplicationContext();const p=this.app.getCoreLogger();const g=a.get(c.MidwayMiddlewareService);for(const c of s){a.bindClass(c.routerModule);p.debug(`Load Controller "${c.controllerId}", prefix=${c.prefix}`);u(`[core]: Load Controller "${c.controllerId}", prefix=${c.prefix}`);const s=this.createRouter({prefix:c.prefix,...c.routerOptions});c.middleware=(r=c.middleware)!==null&&r!==void 0?r:[];if(c.middleware.length){const e=await g.compose(c.middleware,this.app);s.use(e)}const v=i.get(c.prefix);for(const e of v){const r=[];e.middleware=(n=e.middleware)!==null&&n!==void 0?n:[];if(e.middleware.length){const n=await g.compose(e.middleware,this.app);r.push(n)}if(this.app.getFrameworkType()===o.MidwayFrameworkType.WEB_KOA){if(typeof e.url==="string"&&/\*$/.test(e.url)){e.url=e.url.replace("*","(.*)")}}const i=[e.routerName,e.url,...r,this.generateController(e)];p.debug(`Load Router "${e.requestMethod.toUpperCase()} ${e.url}"`);u(`[core]: Load Router "${e.requestMethod.toUpperCase()} ${e.url}"`);s[e.requestMethod.toLowerCase()].apply(s,i)}e&&e(s)}}}r.WebControllerGenerator=WebControllerGenerator},49211:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const i=n(86110);r["default"]=e=>{const r=(0,i.isDevelopmentEnvironment)((0,i.getCurrentEnvironment)());return{core:{healthCheckTimeout:1e3},asyncContextManager:{enable:false},midwayLogger:{default:{level:"info"},clients:{coreLogger:{level:r?"info":"warn"},appLogger:{aliasName:"logger"}}},debug:{recordConfigMergeOrder:r}}}},77404:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.SINGLETON_CONTAINER_CTX=r.IGNORE_PATTERN=r.DEFAULT_PATTERN=r.ASYNC_CONTEXT_MANAGER_KEY=r.ASYNC_CONTEXT_KEY=r.REQUEST_CTX_LOGGER_CACHE_KEY=r.HTTP_SERVER_KEY=r.CONTAINER_OBJ_SCOPE=r.REQUEST_OBJ_CTX_KEY=r.REQUEST_CTX_KEY=r.MIDWAY_LOGGER_WRITEABLE_DIR=r.FUNCTION_INJECT_KEY=r.KEYS=void 0;r.KEYS={OBJECTS_ELEMENT:"objects",OBJECT_ELEMENT:"object",IMPORT_ELEMENT:"import",PROPERTY_ELEMENT:"property",LIST_ELEMENT:"list",MAP_ELEMENT:"map",ENTRY_ELEMENT:"entry",VALUE_ELEMENT:"value",PROPS_ELEMENT:"props",PROP_ELEMENT:"prop",SET_ELEMENT:"set",CONSTRUCTOR_ARG_ELEMENT:"constructor-arg",REF_ELEMENT:"ref",JSON_ELEMENT:"json",CONFIGURATION_ELEMENT:"configuration",ID_ATTRIBUTE:"id",PATH_ATTRIBUTE:"path",DIRECT_ATTRIBUTE:"direct",AUTOWIRE_ATTRIBUTE:"autowire",ASYNC_ATTRIBUTE:"async",NAME_ATTRIBUTE:"name",REF_ATTRIBUTE:"ref",KEY_ATTRIBUTE:"key",VALUE_ATTRIBUTE:"value",TYPE_ATTRIBUTE:"type",EXTERNAL_ATTRIBUTE:"external",OBJECT_ATTRIBUTE:"object",RESOURCE_ATTRIBUTE:"resource",SCOPE_ATTRIBUTE:"scope",ASPECT_ELEMENT:"aspect",AROUND_ELEMENT:"around",EXPRESSION_ATTRIBUTE:"expression",EXECUTE_ATTRIBUTE:"execute"};r.FUNCTION_INJECT_KEY="midway:function_inject_key";r.MIDWAY_LOGGER_WRITEABLE_DIR="MIDWAY_LOGGER_WRITEABLE_DIR";r.REQUEST_CTX_KEY="ctx";r.REQUEST_OBJ_CTX_KEY="_req_ctx";r.CONTAINER_OBJ_SCOPE="_obj_scope";r.HTTP_SERVER_KEY="_midway_http_server";r.REQUEST_CTX_LOGGER_CACHE_KEY="_midway_ctx_logger_cache";r.ASYNC_CONTEXT_KEY=Symbol("ASYNC_CONTEXT_KEY");r.ASYNC_CONTEXT_MANAGER_KEY="MIDWAY_ASYNC_CONTEXT_MANAGER_KEY";r.DEFAULT_PATTERN=["**/**.ts","**/**.js","**/**.mts","**/**.mjs","**/**.cts","**/**.cjs"];r.IGNORE_PATTERN=["**/**.d.ts","**/**.d.mts","**/**.d.cts"];r.SINGLETON_CONTAINER_CTX={_MAIN_CTX_:true}},12922:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayContainer=void 0;const i=n(8351);const s=n(65061);const o=n(39023);const a=n(7755);const c=n(87270);const u=n(77404);const p=n(78028);const g=n(86271);const v=n(6282);const b=n(14057);const _=n(73440);const E=n(24434);const x=n(86248);const T=n(73171);const w=n(86110);const C=o.debuglog("midway:debug");const A=o.debuglog("midway:bind");const k=9;class ContainerConfiguration{constructor(e){this.container=e;this.loadedMap=new WeakMap;this.namespaceList=[];this.configurationOptionsList=[]}load(e){let r=i.MAIN_MODULE_KEY;const n=this.getConfigurationExport(e);if(!n.length)return;for(let e=0;e<n.length;e++){const o=n[e];if(this.loadedMap.get(o)){continue}let a;if(o instanceof s.FunctionalConfiguration){a=o.getConfigurationOptions()}else{a=(0,i.getClassMetadata)(i.CONFIGURATION_KEY,o)}this.loadedMap.set(o,true);if(a){if(a.namespace!==undefined){r=a.namespace;this.namespaceList.push(r)}this.configurationOptionsList.push(a);C(`[core]: load configuration in namespace="${r}"`);this.addImports(a.imports);this.addImportObjects(a.importObjects);this.addImportConfigs(a.importConfigs);this.addImportConfigFilter(a.importConfigFilter);this.bindConfigurationClass(o,r)}}this.container.bindClass(e,{namespace:r})}addImportConfigs(e){if(e){if(Array.isArray(e)){this.container.get(_.MidwayConfigService).add(e)}else{this.container.get(_.MidwayConfigService).addObject(e)}}}addImportConfigFilter(e){if(e){this.container.get(_.MidwayConfigService).addFilter(e)}}addImports(e=[]){var r;for(let n of e){if(!n)continue;if(typeof n==="string"){n=require(n)}if("Configuration"in n){this.load(n)}else if("component"in n){if(n===null||n===void 0?void 0:n.enabledEnvironment){if((r=n===null||n===void 0?void 0:n.enabledEnvironment)===null||r===void 0?void 0:r.includes(this.container.get(b.MidwayEnvironmentService).getCurrentEnvironment())){this.load(n.component)}}else{this.load(n.component)}}else{this.load(n)}}}addImportObjects(e){if(e){const r=Object.keys(e);for(const n of r){if(typeof e[n]!==undefined){this.container.registerObject(n,e[n])}}}}bindConfigurationClass(e,r){if(e instanceof s.FunctionalConfiguration){}else{(0,i.saveProviderId)(undefined,e);const n=(0,i.getProviderUUId)(e);this.container.bind(n,e,{namespace:r,scope:c.ScopeEnum.Singleton})}const n=(0,i.listModule)(i.CONFIGURATION_KEY);const o=n.find((r=>r.target===e));if(!o){(0,i.saveModule)(i.CONFIGURATION_KEY,{target:e,namespace:r})}}getConfigurationExport(e){const r=[];if(T.Types.isClass(e)||T.Types.isFunction(e)||e instanceof s.FunctionalConfiguration){r.push(e)}else{for(const n in e){const i=e[n];if(T.Types.isClass(i)||T.Types.isFunction(i)||i instanceof s.FunctionalConfiguration){r.push(i)}}}return r}getNamespaceList(){return this.namespaceList}getConfigurationOptionsList(){return this.configurationOptionsList}}class MidwayContainer{constructor(e){this._resolverFactory=null;this._registry=null;this._identifierMapping=null;this.moduleMap=null;this.parent=null;this.ctx=u.SINGLETON_CONTAINER_CTX;this.attrMap=new Map;this._namespaceSet=null;this.parent=e;this.init()}init(){this.registerObject(u.REQUEST_CTX_KEY,this.ctx)}get objectCreateEventTarget(){if(!this._objectCreateEventTarget){this._objectCreateEventTarget=new E}return this._objectCreateEventTarget}get registry(){if(!this._registry){this._registry=new a.ObjectDefinitionRegistry}return this._registry}set registry(e){this._registry=e}get managedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new v.ManagedResolverFactory(this)}return this._resolverFactory}get identifierMapping(){if(!this._identifierMapping){this._identifierMapping=this.registry.getIdentifierRelation()}return this._identifierMapping}get namespaceSet(){if(!this._namespaceSet){this._namespaceSet=new Set}return this._namespaceSet}load(e){var r,n,i;if(!Array.isArray(e)){e=[e]}const s=new ContainerConfiguration(this);for(const r of e){if(r){s.load(r)}}for(const e of s.getNamespaceList()){this.namespaceSet.add(e);C(`[core]: load configuration in namespace="${e}" complete`)}const o=(r=s.getConfigurationOptionsList())!==null&&r!==void 0?r:[];const a=(n=o.find((e=>!e.namespace)))!==null&&n!==void 0?n:{};this.fileDetector=(i=a.detector)!==null&&i!==void 0?i:this.fileDetector;if(this.fileDetector){this.fileDetector.setExtraDetectorOptions({conflictCheck:a.conflictCheck,...a.detectorOptions})}}loadDefinitions(){if(this.fileDetector){return this.fileDetector.run(this)}}bindClass(e,r){if(T.Types.isClass(e)||T.Types.isFunction(e)){this.bindModule(e,r)}else{for(const n in e){const i=e[n];if(T.Types.isClass(i)||T.Types.isFunction(i)){this.bindModule(i,r)}}}}bind(e,r,n){var s;if(T.Types.isClass(e)||T.Types.isFunction(e)){return this.bindModule(e,r)}if(this.registry.hasDefinition(e)){return}if(n===null||n===void 0?void 0:n.bindHook){n.bindHook(r,n)}let o;if(T.Types.isClass(r)){o=new p.ObjectDefinition;o.name=(0,i.getProviderName)(r)}else{o=new g.FunctionDefinition;if(!T.Types.isAsyncFunction(r)){o.asynchronous=false}o.name=o.id}o.path=r;o.id=e;o.srcPath=(n===null||n===void 0?void 0:n.srcPath)||null;o.namespace=(n===null||n===void 0?void 0:n.namespace)||"";o.scope=(n===null||n===void 0?void 0:n.scope)||c.ScopeEnum.Request;o.createFrom=n===null||n===void 0?void 0:n.createFrom;if(o.srcPath){C(`[core]: bind id "${o.name} (${o.srcPath}) ${e}"`)}else{C(`[core]: bind id "${o.name}" ${e}`)}const a=(0,i.getPropertyInject)(r);for(const e in a){const r=a[e];A(`${" ".repeat(k)}inject properties => [${JSON.stringify(r)}]`);const n=new v.ManagedReference;n.args=r.args;n.name=r.value;n.injectMode=r["injectMode"];o.properties.set(r["targetKey"],n)}const u=(0,i.getClassExtendedMetadata)(i.INJECT_CUSTOM_PROPERTY,r);for(const e in u){const r=u[e];o.handlerProps.push(r)}const b=(s=(0,i.getObjectDefinition)(r))!==null&&s!==void 0?s:{};if(b.initMethod){A(`${" ".repeat(k)}register initMethod = ${b.initMethod}`);o.initMethod=b.initMethod}if(b.destroyMethod){A(`${" ".repeat(k)}register destroyMethod = ${b.destroyMethod}`);o.destroyMethod=b.destroyMethod}if(b.scope){A(`${" ".repeat(k)}register scope = ${b.scope}`);o.scope=b.scope}if(b.allowDowngrade){A(`${" ".repeat(k)}register allowDowngrade = ${b.allowDowngrade}`);o.allowDowngrade=b.allowDowngrade}this.objectCreateEventTarget.emit(c.ObjectLifeCycleEvent.BEFORE_BIND,r,{context:this,definition:o,replaceCallback:e=>{o=e}});if(o){this.registry.registerDefinition(o.id,o)}}bindModule(e,r){if(T.Types.isClass(e)){const n=(0,i.getProviderUUId)(e);if(n){this.identifierMapping.saveClassRelation(e,r===null||r===void 0?void 0:r.namespace);this.bind(n,e,r)}else{}}else{const n=e[u.FUNCTION_INJECT_KEY];if(n&&n.id){if(!n.scope){n.scope=c.ScopeEnum.Request}const i=w.Utils.generateRandomId();this.identifierMapping.saveFunctionRelation(n.id,i);this.bind(i,e,{scope:n.scope,namespace:r.namespace,srcPath:r.srcPath,createFrom:r.createFrom})}}}setFileDetector(e){this.fileDetector=e}createChild(){return new MidwayContainer(this)}setAttr(e,r){this.attrMap.set(e,r)}getAttr(e){return this.attrMap.get(e)}getIdentifier(e){return(0,i.getProviderUUId)(e)}getManagedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new v.ManagedResolverFactory(this)}return this._resolverFactory}async stop(){await this.getManagedResolverFactory().destroyCache();this.registry.clearAll()}ready(){return this.loadDefinitions()}get(e,r,n){var i;r=r!==null&&r!==void 0?r:[];n=n!==null&&n!==void 0?n:{originName:e};if(typeof e!=="string"){n.originName=e.name;e=this.getIdentifier(e)}if(this.registry.hasObject(e)){return this.registry.getObject(e)}const s=this.registry.getDefinition(e);if(!s&&this.parent){return this.parent.get(e,r)}if(!s){throw new x.MidwayDefinitionNotFoundError((i=n===null||n===void 0?void 0:n.originName)!==null&&i!==void 0?i:e)}return this.getManagedResolverFactory().create({definition:s,args:r})}async getAsync(e,r,n){var i;r=r!==null&&r!==void 0?r:[];n=n!==null&&n!==void 0?n:{originName:e};if(typeof e!=="string"){n.originName=e.name;e=this.getIdentifier(e)}if(this.registry.hasObject(e)){return this.registry.getObject(e)}const s=this.registry.getDefinition(e);if(!s&&this.parent){return this.parent.getAsync(e,r)}if(!s){throw new x.MidwayDefinitionNotFoundError((i=n===null||n===void 0?void 0:n.originName)!==null&&i!==void 0?i:e)}return this.getManagedResolverFactory().createAsync({definition:s,args:r})}registerObject(e,r){this.registry.registerObject(e,r)}onBeforeBind(e){this.objectCreateEventTarget.on(c.ObjectLifeCycleEvent.BEFORE_BIND,e)}onBeforeObjectCreated(e){this.objectCreateEventTarget.on(c.ObjectLifeCycleEvent.BEFORE_CREATED,e)}onObjectCreated(e){this.objectCreateEventTarget.on(c.ObjectLifeCycleEvent.AFTER_CREATED,e)}onObjectInit(e){this.objectCreateEventTarget.on(c.ObjectLifeCycleEvent.AFTER_INIT,e)}onBeforeObjectDestroy(e){this.objectCreateEventTarget.on(c.ObjectLifeCycleEvent.BEFORE_DESTROY,e)}saveModule(e,r){if(!this.moduleMap.has(e)){this.moduleMap.set(e,new Set)}this.moduleMap.get(e).add(r)}listModule(e){return Array.from(this.moduleMap.get(e)||{})}transformModule(e){this.moduleMap=new Map(e)}hasNamespace(e){return this.namespaceSet.has(e)}getNamespaceList(){return Array.from(this.namespaceSet)}hasDefinition(e){return this.registry.hasDefinition(e)}hasObject(e){return this.registry.hasObject(e)}getInstanceScope(e){if(e[u.CONTAINER_OBJ_SCOPE]){return e[u.CONTAINER_OBJ_SCOPE]}return undefined}}r.MidwayContainer=MidwayContainer},7755:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ObjectDefinitionRegistry=void 0;const i=n(8351);const s="_id_default_";class LegacyIdentifierRelation extends Map{saveClassRelation(e,r){const n=(0,i.getProviderUUId)(e);this.set(n,n);if(n){const s=(0,i.getProviderId)(e);if(s){this.set(s,n)}this.set((0,i.getProviderName)(e),n);if(r){this.set(r+":"+(0,i.getProviderName)(e),n)}}}saveFunctionRelation(e,r){this.set(r,r);this.set(e,r)}hasRelation(e){return this.has(e)}getRelation(e){return this.get(e)}}class ObjectDefinitionRegistry extends Map{constructor(){super(...arguments);this.singletonIds=[];this._identifierRelation=new LegacyIdentifierRelation}get identifierRelation(){if(!this._identifierRelation){this._identifierRelation=new LegacyIdentifierRelation}return this._identifierRelation}set identifierRelation(e){this._identifierRelation=e}get identifiers(){const e=[];for(const r of this.keys()){if(r.indexOf(s)===-1){e.push(r)}}return e}get count(){return this.size}getSingletonDefinitionIds(){return this.singletonIds}getDefinitionByName(e){const r=[];for(const n of this.values()){const i=n;if(i.name===e){r.push(i)}}return r}registerDefinition(e,r){if(r.isSingletonScope()){this.singletonIds.push(e)}this.set(e,r)}getDefinition(e){var r;e=(r=this.identifierRelation.getRelation(e))!==null&&r!==void 0?r:e;return this.get(e)}removeDefinition(e){this.delete(e)}hasDefinition(e){var r;e=(r=this.identifierRelation.getRelation(e))!==null&&r!==void 0?r:e;return this.has(e)}clearAll(){this.singletonIds=[];this.clear()}hasObject(e){var r;e=(r=this.identifierRelation.getRelation(e))!==null&&r!==void 0?r:e;return this.has(s+e)}registerObject(e,r){this.set(s+e,r)}getObject(e){var r;e=(r=this.identifierRelation.getRelation(e))!==null&&r!==void 0?r:e;return this.get(s+e)}getIdentifierRelation(){return this.identifierRelation}setIdentifierRelation(e){this.identifierRelation=e}}r.ObjectDefinitionRegistry=ObjectDefinitionRegistry},6282:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ManagedResolverFactory=r.ManagedReference=void 0;const i=n(77404);const s=n(87270);const o=n(39023);const a=n(86248);const c=o.debuglog("midway:managedresolver");const u=o.debuglog("midway:debug");class ManagedReference{constructor(){this.type=i.KEYS.REF_ELEMENT}}r.ManagedReference=ManagedReference;class RefResolver{constructor(e){this.factory=e}get type(){return i.KEYS.REF_ELEMENT}resolve(e,r){var n;const i=e;if(i.injectMode===s.InjectModeEnum.Class&&!((n=this.factory.context.parent)!==null&&n!==void 0?n:this.factory.context).hasDefinition(i.name)){if(r==="loggerService"){throw new a.MidwayInconsistentVersionError}else{throw new a.MidwayMissingImportComponentError(r)}}return this.factory.context.get(i.name,i.args,{originName:r})}async resolveAsync(e,r){var n;const i=e;if(i.injectMode===s.InjectModeEnum.Class&&!((n=this.factory.context.parent)!==null&&n!==void 0?n:this.factory.context).hasDefinition(i.name)){if(r==="loggerService"){throw new a.MidwayInconsistentVersionError}else{throw new a.MidwayMissingImportComponentError(r)}}return this.factory.context.getAsync(i.name,i.args,{originName:r})}}class ManagedResolverFactory{constructor(e){this.resolvers={};this.creating=new Map;this.singletonCache=new Map;this.context=e;this.resolvers={ref:new RefResolver(this)}}registerResolver(e){this.resolvers[e.type]=e}resolveManaged(e,r){const n=this.resolvers[e.type];if(!n||n.type!==e.type){throw new a.MidwayResolverMissingError(e.type)}return n.resolve(e,r)}async resolveManagedAsync(e,r){const n=this.resolvers[e.type];if(!n||n.type!==e.type){throw new a.MidwayResolverMissingError(e.type)}return n.resolveAsync(e,r)}create(e){const{definition:r,args:n}=e;if(r.isSingletonScope()&&this.singletonCache.has(r.id)){return this.singletonCache.get(r.id)}let o=this.createProxyReference(r);if(o){return o}this.compareAndSetCreateStatus(r);if(r.hasDependsOn()){for(const e of r.dependsOn){this.context.get(e,n)}}u(`[core]: Create id = "${r.name}" ${r.id}.`);const c=r.creator.load();let p=[];if(n&&Array.isArray(n)&&n.length>0){p=n}this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.BEFORE_CREATED,c,{constructorArgs:p,definition:r,context:this.context});o=r.creator.doConstruct(c,p,this.context);if(r.isRequestScope()&&r.constructor.name==="ObjectDefinition"){Object.defineProperty(o,i.REQUEST_OBJ_CTX_KEY,{value:this.context.get(i.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(r.properties){const e=r.properties.propertyKeys();for(const n of e){this.checkSingletonInvokeRequest(r,n);try{o[n]=this.resolveManaged(r.properties.get(n),n)}catch(e){if(a.MidwayDefinitionNotFoundError.isClosePrototypeOf(e)){const n=r.path.name;e.updateErrorMsg(n)}this.removeCreateStatus(r,true);throw e}}}this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.AFTER_CREATED,o,{context:this.context,definition:r,replaceCallback:e=>{o=e}});r.creator.doInit(o);this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.AFTER_INIT,o,{context:this.context,definition:r});if(r.id){if(r.isSingletonScope()){this.singletonCache.set(r.id,o);this.setInstanceScope(o,s.ScopeEnum.Singleton)}else if(r.isRequestScope()){this.context.registerObject(r.id,o);this.setInstanceScope(o,s.ScopeEnum.Request)}else{this.setInstanceScope(o,s.ScopeEnum.Prototype)}}this.removeCreateStatus(r,true);return o}async createAsync(e){const{definition:r,args:n}=e;if(r.isSingletonScope()&&this.singletonCache.has(r.id)){c(`id = ${r.id}(${r.name}) get from singleton cache.`);return this.singletonCache.get(r.id)}let o=this.createProxyReference(r);if(o){c(`id = ${r.id}(${r.name}) from proxy reference.`);return o}this.compareAndSetCreateStatus(r);if(r.hasDependsOn()){for(const e of r.dependsOn){c("id = %s init depend %s.",r.id,e);await this.context.getAsync(e,n)}}u(`[core]: Create id = "${r.name}" ${r.id}.`);const p=r.creator.load();let g=[];if(n&&Array.isArray(n)&&n.length>0){g=n}this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.BEFORE_CREATED,p,{constructorArgs:g,context:this.context});o=await r.creator.doConstructAsync(p,g,this.context);if(!o){this.removeCreateStatus(r,false);throw new a.MidwayCommonError(`${r.id} construct return undefined`)}if(r.isRequestScope()&&r.constructor.name==="ObjectDefinition"){c("id = %s inject ctx",r.id);Object.defineProperty(o,i.REQUEST_OBJ_CTX_KEY,{value:this.context.get(i.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(r.properties){const e=r.properties.propertyKeys();for(const n of e){this.checkSingletonInvokeRequest(r,n);try{o[n]=await this.resolveManagedAsync(r.properties.get(n),n)}catch(e){if(a.MidwayDefinitionNotFoundError.isClosePrototypeOf(e)){const n=r.path.name;e.updateErrorMsg(n)}this.removeCreateStatus(r,false);throw e}}}this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.AFTER_CREATED,o,{context:this.context,definition:r,replaceCallback:e=>{o=e}});await r.creator.doInitAsync(o);this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.AFTER_INIT,o,{context:this.context,definition:r});if(r.id){if(r.isSingletonScope()){c(`id = ${r.id}(${r.name}) set to singleton cache`);this.singletonCache.set(r.id,o);this.setInstanceScope(o,s.ScopeEnum.Singleton)}else if(r.isRequestScope()){c(`id = ${r.id}(${r.name}) set to register object`);this.context.registerObject(r.id,o);this.setInstanceScope(o,s.ScopeEnum.Request)}else{this.setInstanceScope(o,s.ScopeEnum.Prototype)}}this.removeCreateStatus(r,true);return o}async destroyCache(){for(const e of this.singletonCache.keys()){const r=this.context.registry.getDefinition(e);if(r.creator){const n=this.singletonCache.get(e);this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.BEFORE_DESTROY,n,{context:this.context,definition:r});await r.creator.doDestroyAsync(n)}}this.singletonCache.clear();this.creating.clear()}removeCreateStatus(e,r){if(this.creating.has(e.id)){this.creating.set(e.id,false)}return true}isCreating(e){return this.creating.has(e.id)&&this.creating.get(e.id)}compareAndSetCreateStatus(e){if(!this.creating.has(e.id)||!this.creating.get(e.id)){this.creating.set(e.id,true)}}createProxyReference(e){if(this.isCreating(e)){c("create proxy for %s.",e.id);if(!this.depthFirstSearch(e.id,e)){c("id = %s after dfs return null",e.id);return null}return new Proxy({__is_proxy__:true,__target_id__:e.id},{get:(r,n)=>{let i;if(e.isRequestScope()){i=this.context.registry.getObject(e.id)}else if(e.isSingletonScope()){i=this.singletonCache.get(e.id)}else{i=this.context.get(e.id)}if(i){if(typeof i[n]==="function"){return i[n].bind(i)}return i[n]}return undefined}})}return null}depthFirstSearch(e,r,n){var i;if(r){c("dfs for %s == %s start.",e,r.id);if(r.properties){const s=r.properties.propertyKeys();if(s.indexOf(e)>-1){c("dfs exist in properties %s == %s.",e,r.id);return true}for(const o of s){if(!Array.isArray(n)){n=[e]}let s=o;const a=r.properties.get(o);if(a&&a.name){s=(i=this.context.identifierMapping.getRelation(a.name))!==null&&i!==void 0?i:a.name}if(s===e){c("dfs exist in properties key %s == %s.",e,r.id);return true}if(n.indexOf(s)>-1){c("dfs depth circular %s == %s, %s, %j.",e,r.id,s,n);continue}else{n.push(s);c("dfs depth push %s == %s, %j.",e,s,n)}let u=this.context.registry.getDefinition(s);if(!u&&this.context.parent){u=this.context.parent.registry.getDefinition(s)}if(this.depthFirstSearch(e,u,n)){c("dfs exist in sub tree %s == %s subId = %s.",e,r.id,u.id);return true}}}c("dfs for %s == %s end.",e,r.id)}return false}getObjectEventTarget(){if(this.context.parent){return this.context.parent.objectCreateEventTarget}return this.context.objectCreateEventTarget}checkSingletonInvokeRequest(e,r){if(e.isSingletonScope()){const n=e.properties.get(r);if(this.context.hasDefinition(n===null||n===void 0?void 0:n.name)){const r=this.context.registry.getDefinition(n.name);if(r.isRequestScope()&&!r.allowDowngrade){throw new a.MidwaySingletonInjectRequestError(e.path.name,r.path.name)}}}return true}setInstanceScope(e,r){if(typeof e==="object"){if(r===s.ScopeEnum.Request&&e[i.REQUEST_OBJ_CTX_KEY]===i.SINGLETON_CONTAINER_CTX){r=s.ScopeEnum.Singleton}Object.defineProperty(e,i.CONTAINER_OBJ_SCOPE,{value:r,writable:false,enumerable:false,configurable:false})}}}r.ManagedResolverFactory=ManagedResolverFactory},20233:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.providerWrapper=void 0;const i=n(77404);function providerWrapper(e){for(const r of e){Object.defineProperty(r.provider,i.FUNCTION_INJECT_KEY,{value:r,writable:false})}}r.providerWrapper=providerWrapper},34005:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayRequestContainer=void 0;const i=n(12922);const s=n(8351);const o=n(77404);class MidwayRequestContainer extends i.MidwayContainer{constructor(e,r){super(r);this.applicationContext=r;this.registry.setIdentifierRelation(this.applicationContext.registry.getIdentifierRelation());this.ctx=e;this.registerObject(o.REQUEST_CTX_KEY,e);this.registerObject("res",{});if(e.logger){this.registerObject("logger",e.logger)}}init(){}get(e,r){if(typeof e!=="string"){e=this.getIdentifier(e)}if(this.registry.hasObject(e)){return this.registry.getObject(e)}const n=this.applicationContext.registry.getDefinition(e);if(n){if(n.isRequestScope()||n.id===s.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().create({definition:n,args:r})}}if(this.parent){return this.parent.get(e,r)}}async getAsync(e,r){if(typeof e!=="string"){e=this.getIdentifier(e)}if(this.registry.hasObject(e)){return this.registry.getObject(e)}const n=this.applicationContext.registry.getDefinition(e);if(n){if(n.isRequestScope()||n.id===s.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().createAsync({definition:n,args:r})}}if(this.parent){return this.parent.getAsync(e,r)}}async ready(){}getContext(){return this.ctx}}r.MidwayRequestContainer=MidwayRequestContainer},86409:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Aspect=void 0;const i=n(8351);const s=n(92139);const o=n(87270);function Aspect(e,r,n){return function(a){(0,i.saveModule)(i.ASPECT_KEY,a);const c=[].concat(e);for(const e of c){(0,i.attachClassMetadata)(i.ASPECT_KEY,{aspectTarget:e,match:r,priority:n},a)}(0,s.Scope)(o.ScopeEnum.Singleton)(a);(0,i.Provide)()(a)}}r.Aspect=Aspect},4166:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Autoload=void 0;const i=n(7679);const s=n(6960);function Autoload(){return function(e){(0,i.savePreloadModule)(e);(0,s.Provide)()(e)}}r.Autoload=Autoload},65963:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Configuration=void 0;const i=n(8351);function Configuration(e={}){return r=>{(0,i.saveClassMetadata)(i.CONFIGURATION_KEY,e,r)}}r.Configuration=Configuration},89183:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Match=r.Catch=void 0;const i=n(7679);const s=n(96695);const o=n(92139);const a=n(6960);const c=n(87270);function Catch(e,r={}){return function(n){const u=e?[].concat(e):undefined;(0,i.saveClassMetadata)(s.CATCH_KEY,{catchTargets:u,catchOptions:r},n);(0,o.Scope)(c.ScopeEnum.Singleton)(n);(0,a.Provide)()(n)}}r.Catch=Catch;function Match(e=true){return function(r){(0,i.saveClassMetadata)(s.MATCH_KEY,{matchPattern:e},r);(0,o.Scope)(c.ScopeEnum.Singleton)(r);(0,a.Provide)()(r)}}r.Match=Match},12629:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApplicationContext=r.Logger=r.App=r.Config=r.Plugin=r.Framework=void 0;const i=n(8351);const s=n(87270);function Framework(){return e=>{(0,i.saveModule)(i.FRAMEWORK_KEY,e);(0,i.Scope)(s.ScopeEnum.Singleton)(e);(0,i.Provide)()(e)}}r.Framework=Framework;function Plugin(e){return(0,i.createCustomPropertyDecorator)(i.PLUGIN_KEY,{identifier:e})}r.Plugin=Plugin;function Config(e){return(0,i.createCustomPropertyDecorator)(i.CONFIG_KEY,{identifier:e})}r.Config=Config;function App(e){return(0,i.createCustomPropertyDecorator)(i.APPLICATION_KEY,{type:e})}r.App=App;function Logger(e){return(0,i.createCustomPropertyDecorator)(i.LOGGER_KEY,{identifier:e})}r.Logger=Logger;function ApplicationContext(){return(0,i.createCustomPropertyDecorator)(i.APPLICATION_CONTEXT_KEY,{})}r.ApplicationContext=ApplicationContext},26748:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Guard=r.UseGuard=void 0;const i=n(7679);const s=n(87270);const o=n(96695);const a=n(6960);const c=n(92139);function UseGuard(e){return(r,n,s)=>{if(!Array.isArray(e)){e=[e]}if(n){(0,i.savePropertyMetadata)(o.GUARD_KEY,e,r,n)}else{(0,i.saveClassMetadata)(o.GUARD_KEY,e,r)}}}r.UseGuard=UseGuard;function Guard(){return e=>{(0,a.Provide)()(e);(0,c.Scope)(s.ScopeEnum.Singleton)(e)}}r.Guard=Guard},87216:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.InjectClient=r.Inject=void 0;const i=n(7679);const s=n(96695);function Inject(e){return function(r,n){(0,i.savePropertyInject)({target:r,targetKey:n,identifier:e})}}r.Inject=Inject;function InjectClient(e,r){return(0,i.createCustomPropertyDecorator)(s.FACTORY_SERVICE_CLIENT_KEY,{serviceFactoryClz:e,clientName:r})}r.InjectClient=InjectClient},42801:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Middleware=void 0;const i=n(8351);const s=n(87270);function Middleware(){return e=>{(0,i.Scope)(s.ScopeEnum.Singleton)(e);(0,i.Provide)()(e)}}r.Middleware=Middleware},78735:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Mock=void 0;const i=n(8351);const s=n(87270);function Mock(){return e=>{(0,i.saveModule)(i.MOCK_KEY,e);(0,i.Scope)(s.ScopeEnum.Singleton)(e);(0,i.Provide)()(e)}}r.Mock=Mock},92139:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Singleton=r.Scope=r.Destroy=r.Init=void 0;const i=n(7679);const s=n(6960);const o=n(87270);function Init(){return function(e,r){(0,i.saveObjectDefinition)(e,{initMethod:r})}}r.Init=Init;function Destroy(){return function(e,r){(0,i.saveObjectDefinition)(e,{destroyMethod:r})}}r.Destroy=Destroy;function Scope(e,r){return function(n){(0,i.saveObjectDefinition)(n,{scope:e,...r})}}r.Scope=Scope;function Singleton(){return function(e){Scope(o.ScopeEnum.Singleton)(e);(0,s.Provide)()(e)}}r.Singleton=Singleton},2765:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Pipe=void 0;const i=n(8351);const s=n(87270);function Pipe(){return e=>{(0,i.Scope)(s.ScopeEnum.Singleton)(e);(0,i.Provide)()(e)}}r.Pipe=Pipe},14767:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Pipeline=void 0;const i=n(7679);const s=n(96695);function Pipeline(e){return(0,i.createCustomPropertyDecorator)(s.PIPELINE_IDENTIFIER,{valves:e})}r.Pipeline=Pipeline},6960:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Provide=void 0;const i=n(7679);function Provide(e){return function(r){return(0,i.saveProviderId)(e,r)}}r.Provide=Provide},96695:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TAGGED_CLS=r.INJECT_CUSTOM_PARAM=r.INJECT_CUSTOM_METHOD=r.INJECT_CUSTOM_PROPERTY=r.INJECT_TAG=r.NAMED_TAG=r.CLASS_KEY_CONSTRUCTOR=r.APPLICATION_CONTEXT_KEY=r.APPLICATION_KEY=r.LOGGER_KEY=r.PLUGIN_KEY=r.CONFIG_KEY=r.MS_HSF_METHOD_KEY=r.MS_DUBBO_METHOD_KEY=r.MS_GRPC_METHOD_KEY=r.MS_PROVIDER_KEY=r.MS_PRODUCER_KEY=r.MS_CONSUMER_KEY=r.RPC_DUBBO_KEY=r.RPC_GRPC_KEY=r.HSF_KEY=r.WS_EVENT_KEY=r.WS_CONTROLLER_KEY=r.MODULE_TASK_QUEUE_OPTIONS=r.MODULE_TASK_QUEUE_KEY=r.MODULE_TASK_TASK_LOCAL_OPTIONS=r.MODULE_TASK_TASK_LOCAL_KEY=r.MODULE_TASK_METADATA=r.MODULE_TASK_KEY=r.WEB_RESPONSE_RENDER=r.WEB_RESPONSE_CONTENT_TYPE=r.WEB_RESPONSE_HEADER=r.WEB_RESPONSE_REDIRECT=r.WEB_RESPONSE_HTTP_CODE=r.WEB_RESPONSE_KEY=r.WEB_ROUTER_PARAM_KEY=r.WEB_ROUTER_KEY=r.CONTROLLER_KEY=r.SERVERLESS_FUNC_KEY=r.FUNC_KEY=r.FACTORY_SERVICE_CLIENT_KEY=r.MOCK_KEY=r.GUARD_KEY=r.MATCH_KEY=r.CATCH_KEY=r.ASPECT_KEY=r.FRAMEWORK_KEY=r.CONFIGURATION_KEY=r.SCHEDULE_KEY=r.ALL=void 0;r.PRIVATE_META_DATA_KEY=r.MAIN_MODULE_KEY=r.LIFECYCLE_IDENTIFIER_PREFIX=r.PIPELINE_IDENTIFIER=r.OBJ_DEF_CLS=r.TAGGED_FUN=void 0;r.ALL="common:all_value_key";r.SCHEDULE_KEY="common:schedule";r.CONFIGURATION_KEY="common:configuration";r.FRAMEWORK_KEY="common:framework";r.ASPECT_KEY="common:aspect";r.CATCH_KEY="common:catch";r.MATCH_KEY="common:match";r.GUARD_KEY="common:guard";r.MOCK_KEY="common:mock";r.FACTORY_SERVICE_CLIENT_KEY="common:service_factory:client";r.FUNC_KEY="faas:func";r.SERVERLESS_FUNC_KEY="faas:serverless:function";r.CONTROLLER_KEY="web:controller";r.WEB_ROUTER_KEY="web:router";r.WEB_ROUTER_PARAM_KEY="web:router_param";r.WEB_RESPONSE_KEY="web:response";r.WEB_RESPONSE_HTTP_CODE="web:response_http_code";r.WEB_RESPONSE_REDIRECT="web:response_redirect";r.WEB_RESPONSE_HEADER="web:response_header";r.WEB_RESPONSE_CONTENT_TYPE="web:response_content_type";r.WEB_RESPONSE_RENDER="web:response_render";r.MODULE_TASK_KEY="task:task";r.MODULE_TASK_METADATA="task:task:options";r.MODULE_TASK_TASK_LOCAL_KEY="task:task:task_local";r.MODULE_TASK_TASK_LOCAL_OPTIONS="task:task:task_local:options";r.MODULE_TASK_QUEUE_KEY="task:task:queue";r.MODULE_TASK_QUEUE_OPTIONS="task:task:queue:options";r.WS_CONTROLLER_KEY="ws:controller";r.WS_EVENT_KEY="ws:event";r.HSF_KEY="rpc:hsf";r.RPC_GRPC_KEY="rpc:grpc";r.RPC_DUBBO_KEY="rpc:dubbo";r.MS_CONSUMER_KEY="ms:consumer";r.MS_PRODUCER_KEY="ms:producer";r.MS_PROVIDER_KEY="ms:provider";r.MS_GRPC_METHOD_KEY="ms:grpc:method";r.MS_DUBBO_METHOD_KEY="ms:dubbo:method";r.MS_HSF_METHOD_KEY="ms:hsf:method";r.CONFIG_KEY="config";r.PLUGIN_KEY="plugin";r.LOGGER_KEY="logger";r.APPLICATION_KEY="__midway_framework_app__";r.APPLICATION_CONTEXT_KEY="__midway_application_context__";r.CLASS_KEY_CONSTRUCTOR="midway:class_key_constructor";r.NAMED_TAG="named";r.INJECT_TAG="inject";r.INJECT_CUSTOM_PROPERTY="inject_custom_property";r.INJECT_CUSTOM_METHOD="inject_custom_method";r.INJECT_CUSTOM_PARAM="inject_custom_param";r.TAGGED_CLS="injection:tagged_class";r.TAGGED_FUN="injection:tagged_function";r.OBJ_DEF_CLS="injection:object_definition_class";r.PIPELINE_IDENTIFIER="__pipeline_identifier__";r.LIFECYCLE_IDENTIFIER_PREFIX="__lifecycle__";r.MAIN_MODULE_KEY="__main__";r.PRIVATE_META_DATA_KEY="__midway_private_meta_data__"},7679:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.createCustomParamDecorator=r.createCustomMethodDecorator=r.createCustomPropertyDecorator=r.getMethodReturnTypes=r.getPropertyType=r.getMethodParamTypes=r.BaseType=r.isProvide=r.getProviderUUId=r.getProviderName=r.getProviderId=r.saveProviderId=r.getObjectDefinition=r.saveObjectDefinition=r.getPropertyInject=r.savePropertyInject=r.transformTypeFromTSDesign=r.clearAllModule=r.resetModule=r.listModule=r.clearBindContainer=r.bindContainer=r.saveModule=r.listPreloadModule=r.savePreloadModule=r.getPropertyMetadata=r.attachPropertyMetadata=r.savePropertyMetadata=r.listPropertyDataFromClass=r.getPropertyDataFromClass=r.attachPropertyDataToClass=r.savePropertyDataToClass=r.getClassMetadata=r.getClassExtendedMetadata=r.attachClassMetadata=r.saveClassMetadata=r.DecoratorManager=r.INJECT_CLASS_KEY_PREFIX=r.PRELOAD_MODULE_KEY=void 0;n(80477);const i=n(87270);const s=n(96695);const o=n(73171);const a=n(88504);const c=n(86110);const u=n(29837);const p=n(39023).debuglog("midway:core");r.PRELOAD_MODULE_KEY="INJECTION_PRELOAD_MODULE_KEY";r.INJECT_CLASS_KEY_PREFIX="INJECTION_CLASS_META_DATA";class DecoratorManager extends Map{constructor(){super(...arguments);this.injectClassKeyPrefix=r.INJECT_CLASS_KEY_PREFIX;this.injectClassMethodKeyPrefix="INJECTION_CLASS_METHOD_META_DATA";this.injectMethodKeyPrefix="INJECTION_METHOD_META_DATA"}saveModule(e,r){if(this.container){return this.container.saveModule(e,r)}if(!this.has(e)){this.set(e,new Set)}this.get(e).add(r)}listModule(e){if(this.container){return this.container.listModule(e)}return Array.from(this.get(e)||{})}resetModule(e){this.set(e,new Set)}bindContainer(e){this.container=e;this.container.transformModule(this)}static getDecoratorClassKey(e){return e.toString()+"_CLS"}static removeDecoratorClassKeySuffix(e){return e.toString().replace("_CLS","")}static getDecoratorMethodKey(e){return e.toString()+"_METHOD"}static getDecoratorClsExtendedKey(e){return e.toString()+"_EXT"}static getDecoratorClsMethodPrefix(e){return e.toString()+"_CLS_METHOD"}static getDecoratorClsMethodKey(e,r){return DecoratorManager.getDecoratorClsMethodPrefix(e)+":"+r.toString()}static getDecoratorMethod(e,r){return DecoratorManager.getDecoratorMethodKey(e)+"_"+r.toString()}static saveMetadata(e,r,n,i){if(typeof r==="object"&&r.constructor){r=r.constructor}let s;if(Reflect.hasOwnMetadata(e,r)){s=Reflect.getMetadata(e,r)}else{s=new Map}s.set(n,i);Reflect.defineMetadata(e,s,r)}static attachMetadata(e,r,n,i,s,o="one"){if(typeof r==="object"&&r.constructor){r=r.constructor}let a;if(Reflect.hasOwnMetadata(e,r)){a=Reflect.getMetadata(e,r)}else{a=new Map}if(!a.has(n)){if(s){a.set(n,{})}else{a.set(n,[])}}if(s){if(o==="one"){a.get(n)[s]=i}else{if(a.get(n)[s]){a.get(n)[s].push(i)}else{a.get(n)[s]=[i]}}}else{a.get(n).push(i)}Reflect.defineMetadata(e,a,r)}static getMetadata(e,r,n){if(typeof r==="object"&&r.constructor){r=r.constructor}let i;if(!Reflect.hasOwnMetadata(e,r)){i=new Map;Reflect.defineMetadata(e,i,r)}else{i=Reflect.getMetadata(e,r)}if(!n){return i}return i.get(n)}saveMetadata(e,r,n,i){if(i){const s=DecoratorManager.getDecoratorMethod(e,i);DecoratorManager.saveMetadata(this.injectMethodKeyPrefix,n,s,r)}else{const i=DecoratorManager.getDecoratorClassKey(e);DecoratorManager.saveMetadata(this.injectClassKeyPrefix,n,i,r)}}attachMetadata(e,r,n,i,s,o){if(i){const a=DecoratorManager.getDecoratorMethod(e,i);DecoratorManager.attachMetadata(this.injectMethodKeyPrefix,n,a,r,s,o)}else{const i=DecoratorManager.getDecoratorClassKey(e);DecoratorManager.attachMetadata(this.injectClassKeyPrefix,n,i,r,s,o)}}getMetadata(e,r,n){if(n){const i=DecoratorManager.getDecoratorMethod(e,n);return DecoratorManager.getMetadata(this.injectMethodKeyPrefix,r,i)}else{const n=`${DecoratorManager.getDecoratorClassKey(e)}`;return DecoratorManager.getMetadata(this.injectClassKeyPrefix,r,n)}}savePropertyDataToClass(e,r,n,i){const s=DecoratorManager.getDecoratorClsMethodKey(e,i);DecoratorManager.saveMetadata(this.injectClassMethodKeyPrefix,n,s,r)}attachPropertyDataToClass(e,r,n,i,s){const o=DecoratorManager.getDecoratorClsMethodKey(e,i);DecoratorManager.attachMetadata(this.injectClassMethodKeyPrefix,n,o,r,s)}getPropertyDataFromClass(e,r,n){const i=DecoratorManager.getDecoratorClsMethodKey(e,n);return DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,r,i)}listPropertyDataFromClass(e,r){const n=DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,r);const i=[];for(const[r,s]of n){if(r.indexOf(DecoratorManager.getDecoratorClsMethodPrefix(e))!==-1){i.push(s)}}return i}}r.DecoratorManager=DecoratorManager;let g=new DecoratorManager;if(typeof global==="object"){if(global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]){console.warn('DecoratorManager not singleton and please check @midwayjs/core version by "npm ls @midwayjs/core"');const e=(0,u.getModuleRequirePathList)("@midwayjs/core");if(e.length){console.info("The module may be located in:");e.forEach(((e,r)=>{console.info(`${r+1}. ${e}`)}))}g=global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]}else{global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]=g}}function saveClassMetadata(e,r,n,i){if(i&&typeof r==="object"){const i=g.getMetadata(e,n);if(!i){return g.saveMetadata(e,r,n)}if(Array.isArray(i)){return g.saveMetadata(e,i.concat(r),n)}else{return g.saveMetadata(e,Object.assign(i,r),n)}}else{return g.saveMetadata(e,r,n)}}r.saveClassMetadata=saveClassMetadata;function attachClassMetadata(e,r,n,i,s){return g.attachMetadata(e,r,n,undefined,i,s)}r.attachClassMetadata=attachClassMetadata;function getClassExtendedMetadata(e,r,n,i){if(i===undefined){i=true}const s=DecoratorManager.getDecoratorClsExtendedKey(e);let o=g.getMetadata(s,r,n);if(i&&o!==undefined){return o}const a=Reflect.getPrototypeOf(r);if(a&&a.constructor!==Object){o=(0,c.merge)(getClassExtendedMetadata(e,a,n,i),g.getMetadata(e,r,n))}g.saveMetadata(s,o||null,r,n);return o}r.getClassExtendedMetadata=getClassExtendedMetadata;function getClassMetadata(e,r){return g.getMetadata(e,r)}r.getClassMetadata=getClassMetadata;function savePropertyDataToClass(e,r,n,i){return g.savePropertyDataToClass(e,r,n,i)}r.savePropertyDataToClass=savePropertyDataToClass;function attachPropertyDataToClass(e,r,n,i,s){return g.attachPropertyDataToClass(e,r,n,i,s)}r.attachPropertyDataToClass=attachPropertyDataToClass;function getPropertyDataFromClass(e,r,n){return g.getPropertyDataFromClass(e,r,n)}r.getPropertyDataFromClass=getPropertyDataFromClass;function listPropertyDataFromClass(e,r){return g.listPropertyDataFromClass(e,r)}r.listPropertyDataFromClass=listPropertyDataFromClass;function savePropertyMetadata(e,r,n,i){return g.saveMetadata(e,r,n,i)}r.savePropertyMetadata=savePropertyMetadata;function attachPropertyMetadata(e,r,n,i){return g.attachMetadata(e,r,n,i)}r.attachPropertyMetadata=attachPropertyMetadata;function getPropertyMetadata(e,r,n){return g.getMetadata(e,r,n)}r.getPropertyMetadata=getPropertyMetadata;function savePreloadModule(e){return saveModule(r.PRELOAD_MODULE_KEY,e)}r.savePreloadModule=savePreloadModule;function listPreloadModule(){return listModule(r.PRELOAD_MODULE_KEY)}r.listPreloadModule=listPreloadModule;function saveModule(e,r){if((0,o.isClass)(r)){saveProviderId(undefined,r)}return g.saveModule(e,r)}r.saveModule=saveModule;function bindContainer(e){return g.bindContainer(e)}r.bindContainer=bindContainer;function clearBindContainer(){return g.container=null}r.clearBindContainer=clearBindContainer;function listModule(e,r){const n=g.listModule(e);if(r){return n.filter(r)}else{return n}}r.listModule=listModule;function resetModule(e){return g.resetModule(e)}r.resetModule=resetModule;function clearAllModule(){p("--- clear all module here ---");return g.clear()}r.clearAllModule=clearAllModule;function transformTypeFromTSDesign(e){if((0,o.isNullOrUndefined)(e)){return{name:"undefined",isBaseType:true,originDesign:e}}switch(e.name){case"String":return{name:"string",isBaseType:true,originDesign:e};case"Number":return{name:"number",isBaseType:true,originDesign:e};case"Boolean":return{name:"boolean",isBaseType:true,originDesign:e};case"Symbol":return{name:"symbol",isBaseType:true,originDesign:e};case"Object":return{name:"object",isBaseType:true,originDesign:e};case"Function":return{name:"function",isBaseType:true,originDesign:e};default:return{name:e.name,isBaseType:false,originDesign:e}}}r.transformTypeFromTSDesign=transformTypeFromTSDesign;function savePropertyInject(e){let r=e.identifier;let n=i.InjectModeEnum.Identifier;if(!r){const s=getPropertyType(e.target,e.targetKey);if(!s.isBaseType&&(0,o.isClass)(s.originDesign)&&isProvide(s.originDesign)){r=getProviderUUId(s.originDesign);n=i.InjectModeEnum.Class}if(!r){r=e.targetKey;n=i.InjectModeEnum.PropertyName}}attachClassMetadata(s.INJECT_TAG,{targetKey:e.targetKey,value:r,args:e.args,injectMode:n},e.target,e.targetKey)}r.savePropertyInject=savePropertyInject;function getPropertyInject(e,r){return getClassExtendedMetadata(s.INJECT_TAG,e,undefined,r)}r.getPropertyInject=getPropertyInject;function saveObjectDefinition(e,r={}){saveClassMetadata(s.OBJ_DEF_CLS,r,e,true);return e}r.saveObjectDefinition=saveObjectDefinition;function getObjectDefinition(e){return getClassExtendedMetadata(s.OBJ_DEF_CLS,e)}r.getObjectDefinition=getObjectDefinition;function saveProviderId(e,r){if(isProvide(r)){if(e){const n=getClassMetadata(s.TAGGED_CLS,r);if(n.id!==e){n.id=e;saveClassMetadata(s.TAGGED_CLS,n,r);p(`update provide: ${r.name} -> ${n.uuid}`)}}}else{const n=(0,c.generateRandomId)();saveClassMetadata(s.TAGGED_CLS,{id:e,originName:r.name,uuid:n,name:(0,a.camelCase)(r.name)},r);p(`save provide: ${r.name} -> ${n}`)}return r}r.saveProviderId=saveProviderId;function getProviderId(e){const r=getClassMetadata(s.TAGGED_CLS,e);if(r&&r.id){return r.id}}r.getProviderId=getProviderId;function getProviderName(e){const r=getClassMetadata(s.TAGGED_CLS,e);if(r&&r.name){return r.name}}r.getProviderName=getProviderName;function getProviderUUId(e){const r=getClassMetadata(s.TAGGED_CLS,e);if(r&&r.uuid){return r.uuid}}r.getProviderUUId=getProviderUUId;function isProvide(e){return!!getClassMetadata(s.TAGGED_CLS,e)}r.isProvide=isProvide;var v;(function(e){e["Boolean"]="boolean";e["Number"]="number";e["String"]="string"})(v=r.BaseType||(r.BaseType={}));function getMethodParamTypes(e,r){if((0,o.isClass)(e)){e=e.prototype}return Reflect.getMetadata("design:paramtypes",e,r)}r.getMethodParamTypes=getMethodParamTypes;function getPropertyType(e,r){return transformTypeFromTSDesign(Reflect.getMetadata("design:type",e,r))}r.getPropertyType=getPropertyType;function getMethodReturnTypes(e,r){if((0,o.isClass)(e)){e=e.prototype}return Reflect.getMetadata("design:returntype",e,r)}r.getMethodReturnTypes=getMethodReturnTypes;function createCustomPropertyDecorator(e,r,n=true){return function(i,o){attachClassMetadata(s.INJECT_CUSTOM_PROPERTY,{propertyName:o,key:e,metadata:r,impl:n},i,o)}}r.createCustomPropertyDecorator=createCustomPropertyDecorator;function createCustomMethodDecorator(e,r,n={impl:true}){if(typeof n==="boolean"){n={impl:n}}if(n.impl===undefined){n.impl=true}return function(i,o,a){attachClassMetadata(s.INJECT_CUSTOM_METHOD,{propertyName:o,key:e,metadata:r,options:n},i)}}r.createCustomMethodDecorator=createCustomMethodDecorator;function createCustomParamDecorator(e,r,n={impl:true}){if(typeof n==="boolean"){n={impl:n}}if(n.impl===undefined){n.impl=true}return function(i,o,a){attachClassMetadata(s.INJECT_CUSTOM_PARAM,{key:e,parameterIndex:a,propertyName:o,metadata:r,options:n},i,o,"multi")}}r.createCustomParamDecorator=createCustomParamDecorator},60719:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ServerlessTrigger=r.ServerlessFunction=void 0;const i=n(8351);const s=n(87270);function ServerlessFunction(e){return(r,n,s)=>{(0,i.savePropertyMetadata)(i.SERVERLESS_FUNC_KEY,e,r,n)}}r.ServerlessFunction=ServerlessFunction;function ServerlessTrigger(e,r={}){return(n,o,a)=>{var c;if(e===s.ServerlessTriggerType.HTTP||e===s.ServerlessTriggerType.API_GATEWAY){r["method"]=(c=r["method"])!==null&&c!==void 0?c:"get"}(0,i.saveModule)(i.FUNC_KEY,n.constructor);r=r||{};(0,i.attachClassMetadata)(i.FUNC_KEY,{type:e,methodName:o,metadata:r},n)}}r.ServerlessTrigger=ServerlessTrigger},8351:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});s(n(6960),r);s(n(87216),r);s(n(14767),r);s(n(86409),r);s(n(4166),r);s(n(65963),r);s(n(92139),r);s(n(12629),r);s(n(89183),r);s(n(42801),r);s(n(26748),r);s(n(2765),r);s(n(78735),r);s(n(60719),r);s(n(24016),r);s(n(23565),r);s(n(73697),r);s(n(96915),r);s(n(96695),r);s(n(7679),r);s(n(18783),r);s(n(16682),r);s(n(89941),r);s(n(61681),r);s(n(55550),r);s(n(96558),r);s(n(68036),r);s(n(70657),r);s(n(79916),r);s(n(98485),r);s(n(10425),r)},18783:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Consumer=void 0;const i=n(8351);const s=n(87270);function Consumer(e,r={}){return n=>{(0,i.saveModule)(i.MS_CONSUMER_KEY,n);(0,i.saveClassMetadata)(i.MS_CONSUMER_KEY,{type:e,metadata:r},n);(0,i.Scope)(s.ScopeEnum.Request)(n);(0,i.Provide)()(n)}}r.Consumer=Consumer},61681:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.KafkaListener=void 0;const i=n(8351);function KafkaListener(e,r={}){return(n,s)=>{r.topic=e;r.propertyKey=s;(0,i.attachPropertyDataToClass)(i.MS_CONSUMER_KEY,r,n,s)}}r.KafkaListener=KafkaListener},16682:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DubboMethod=r.GrpcMethod=r.GrpcStreamTypeEnum=r.Provider=void 0;const i=n(8351);const s=n(87270);function Provider(e,r={}){return n=>{(0,i.saveModule)(i.MS_PROVIDER_KEY,n);(0,i.saveClassMetadata)(i.MS_PROVIDER_KEY,{type:e,metadata:r},n);(0,i.Scope)(s.ScopeEnum.Request)(n);(0,i.Provide)()(n)}}r.Provider=Provider;var o;(function(e){e["BASE"]="base";e["DUPLEX"]="ServerDuplexStream";e["READABLE"]="ServerReadableStream";e["WRITEABLE"]="ServerWritableStream"})(o=r.GrpcStreamTypeEnum||(r.GrpcStreamTypeEnum={}));function GrpcMethod(e={}){return(r,n,s)=>{if(!e.type){e.type=o.BASE}(0,i.savePropertyMetadata)(i.MS_GRPC_METHOD_KEY,{methodName:e.methodName||n,type:e.type,onEnd:e.onEnd},r,n);return s}}r.GrpcMethod=GrpcMethod;function DubboMethod(e){return(r,n,s)=>{(0,i.attachClassMetadata)(i.MS_DUBBO_METHOD_KEY,{methodName:e||n},r);return s}}r.DubboMethod=DubboMethod},89941:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.RabbitMQListener=void 0;const i=n(8351);function RabbitMQListener(e,r={}){return(n,s)=>{r.queueName=e;r.propertyKey=s;(0,i.attachPropertyDataToClass)(i.MS_CONSUMER_KEY,r,n,s)}}r.RabbitMQListener=RabbitMQListener},55550:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.HSF=void 0;const i=n(8351);const s=n(87270);function HSF(e={}){return r=>{(0,i.saveModule)(i.HSF_KEY,r);(0,i.saveClassMetadata)(i.HSF_KEY,e,r);(0,i.Scope)(s.ScopeEnum.Request)(r);(0,i.Provide)()(r)}}r.HSF=HSF},96558:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Queue=void 0;const i=n(8351);const s=n(96695);function Queue(e){return function(r){(0,i.saveModule)(s.MODULE_TASK_QUEUE_KEY,r);(0,i.saveClassMetadata)(s.MODULE_TASK_QUEUE_OPTIONS,{options:e,name:r.name},r);(0,i.Provide)()(r)}}r.Queue=Queue},79916:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Schedule=void 0;const i=n(8351);const s=n(87270);function Schedule(e){return function(r){(0,i.saveModule)(i.SCHEDULE_KEY,r);(0,i.saveClassMetadata)(i.SCHEDULE_KEY,e,r);(0,i.Scope)(s.ScopeEnum.Request)(r);(0,i.Provide)()(r)}}r.Schedule=Schedule},68036:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Task=void 0;const i=n(8351);const s=n(96695);function Task(e){return function(r,n,o){(0,i.saveModule)(s.MODULE_TASK_KEY,r.constructor);(0,i.attachClassMetadata)(s.MODULE_TASK_METADATA,{options:e,propertyKey:n,value:o.value,name:r.constructor.name},r)}}r.Task=Task},70657:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TaskLocal=void 0;const i=n(8351);const s=n(96695);function TaskLocal(e){return function(r,n,o){(0,i.saveModule)(s.MODULE_TASK_TASK_LOCAL_KEY,r.constructor);(0,i.attachClassMetadata)(s.MODULE_TASK_TASK_LOCAL_OPTIONS,{options:e,propertyKey:n,value:o.value},r)}}r.TaskLocal=TaskLocal},24016:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Controller=void 0;const i=n(8351);const s=n(87270);function Controller(e="/",r={middleware:[],sensitive:true}){return n=>{(0,i.saveModule)(i.CONTROLLER_KEY,n);if(e)(0,i.saveClassMetadata)(i.CONTROLLER_KEY,{prefix:e,routerOptions:r},n);(0,i.Scope)(s.ScopeEnum.Request)(n);(0,i.Provide)()(n)}}r.Controller=Controller},23565:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Fields=r.Queries=r.RequestIP=r.RequestPath=r.Files=r.File=r.Headers=r.Param=r.Query=r.Body=r.Session=r.createRequestParamDecorator=r.RouteParamTypes=void 0;const i=n(8351);var s;(function(e){e["QUERY"]="query";e["BODY"]="body";e["PARAM"]="param";e["HEADERS"]="headers";e["SESSION"]="session";e["FILESTREAM"]="file_stream";e["FILESSTREAM"]="files_stream";e["NEXT"]="next";e["REQUEST_PATH"]="request_path";e["REQUEST_IP"]="request_ip";e["QUERIES"]="queries";e["FIELDS"]="fields";e["CUSTOM"]="custom"})(s=r.RouteParamTypes||(r.RouteParamTypes={}));const createParamMapping=function(e){return(r,n={})=>{let s=r;if(Array.isArray(r)&&n.pipes===undefined){n.pipes=r;s=undefined}return(0,i.createCustomParamDecorator)(i.WEB_ROUTER_PARAM_KEY,{type:e,propertyData:s},n)}};const createRequestParamDecorator=function(e,r){r=r||{};if(Array.isArray(r)){r={pipes:r}}return createParamMapping(s.CUSTOM)(e,r)};r.createRequestParamDecorator=createRequestParamDecorator;const Session=(e,r)=>createParamMapping(s.SESSION)(e,{pipes:r});r.Session=Session;const Body=(e,r)=>createParamMapping(s.BODY)(e,{pipes:r});r.Body=Body;const Query=(e,r)=>createParamMapping(s.QUERY)(e,{pipes:r});r.Query=Query;const Param=(e,r)=>createParamMapping(s.PARAM)(e,{pipes:r});r.Param=Param;const Headers=(e,r)=>createParamMapping(s.HEADERS)(e,{pipes:r});r.Headers=Headers;const File=(e,r)=>createParamMapping(s.FILESTREAM)(e,{pipes:r});r.File=File;const Files=(e,r)=>createParamMapping(s.FILESSTREAM)(e,{pipes:r});r.Files=Files;const RequestPath=e=>createParamMapping(s.REQUEST_PATH)(undefined,{pipes:e});r.RequestPath=RequestPath;const RequestIP=e=>createParamMapping(s.REQUEST_IP)(undefined,{pipes:e});r.RequestIP=RequestIP;const Queries=(e,r)=>createParamMapping(s.QUERIES)(e,{pipes:r});r.Queries=Queries;const Fields=(e,r)=>createParamMapping(s.FIELDS)(e,{pipes:r});r.Fields=Fields},73697:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.All=r.Head=r.Options=r.Patch=r.Put=r.Del=r.Get=r.Post=r.RequestMapping=r.RequestMethod=void 0;const i=n(8351);r.RequestMethod={GET:"get",POST:"post",PUT:"put",DELETE:"delete",PATCH:"patch",ALL:"all",OPTIONS:"options",HEAD:"head"};const s={path:"/",requestMethod:r.RequestMethod.GET,routerName:null,middleware:[]};const RequestMapping=(e=s)=>{const n=e.path||"/";const o=e.requestMethod||r.RequestMethod.GET;const a=e.routerName;const c=e.middleware;return(r,s,u)=>{var p;(0,i.attachClassMetadata)(i.WEB_ROUTER_KEY,{path:n,requestMethod:o,routerName:a,method:s,middleware:c,summary:(e===null||e===void 0?void 0:e.summary)||"",description:(e===null||e===void 0?void 0:e.description)||"",ignoreGlobalPrefix:(p=e===null||e===void 0?void 0:e.ignoreGlobalPrefix)!==null&&p!==void 0?p:false},r);return u}};r.RequestMapping=RequestMapping;const createMappingDecorator=e=>(n,i={middleware:[]})=>(0,r.RequestMapping)(Object.assign(i,{requestMethod:e,path:n}));r.Post=createMappingDecorator(r.RequestMethod.POST);r.Get=createMappingDecorator(r.RequestMethod.GET);r.Del=createMappingDecorator(r.RequestMethod.DELETE);r.Put=createMappingDecorator(r.RequestMethod.PUT);r.Patch=createMappingDecorator(r.RequestMethod.PATCH);r.Options=createMappingDecorator(r.RequestMethod.OPTIONS);r.Head=createMappingDecorator(r.RequestMethod.HEAD);r.All=createMappingDecorator(r.RequestMethod.ALL)},96915:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.createRender=r.ContentType=r.SetHeader=r.HttpCode=r.Redirect=void 0;const i=n(8351);function Redirect(e,r=302){return(n,s,o)=>{(0,i.attachPropertyMetadata)(i.WEB_RESPONSE_KEY,{type:i.WEB_RESPONSE_REDIRECT,url:e,code:r},n,s);return o}}r.Redirect=Redirect;function HttpCode(e){return(r,n,s)=>{(0,i.attachPropertyMetadata)(i.WEB_RESPONSE_KEY,{type:i.WEB_RESPONSE_HTTP_CODE,code:e},r,n);return s}}r.HttpCode=HttpCode;function SetHeader(e,r){return(n,s,o)=>{let a={};if(r){a[e]=r}else{a=e}(0,i.attachPropertyMetadata)(i.WEB_RESPONSE_KEY,{type:i.WEB_RESPONSE_HEADER,setHeaders:a},n,s);return o}}r.SetHeader=SetHeader;function ContentType(e){return(r,n,s)=>{(0,i.attachPropertyMetadata)(i.WEB_RESPONSE_KEY,{type:i.WEB_RESPONSE_CONTENT_TYPE,contentType:e},r,n);return s}}r.ContentType=ContentType;function createRender(e){return e=>(r,n,s)=>{(0,i.attachPropertyMetadata)(i.WEB_RESPONSE_KEY,{type:i.WEB_RESPONSE_RENDER,templateName:e},r,n);return s}}r.createRender=createRender},98485:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.WSController=void 0;const i=n(8351);const s=n(87270);function WSController(e="/",r={middleware:[],connectionMiddleware:[]}){return n=>{(0,i.saveModule)(i.WS_CONTROLLER_KEY,n);(0,i.saveClassMetadata)(i.WS_CONTROLLER_KEY,{namespace:e,routerOptions:r},n);(0,i.Scope)(s.ScopeEnum.Request)(n);(0,i.Provide)()(n)}}r.WSController=WSController},10425:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.OnConnection=r.OnDisConnection=r.Emit=r.OnMessage=r.WSBroadCast=r.WSEmit=r.OnWSMessage=r.OnWSDisConnection=r.OnWSConnection=r.WSEventTypeEnum=void 0;const i=n(8351);var s;(function(e){e["ON_CONNECTION"]="ws:onConnection";e["ON_DISCONNECTION"]="ws:onDisconnection";e["ON_MESSAGE"]="ws:onMessage";e["ON_SOCKET_ERROR"]="ws:onSocketError";e["EMIT"]="ws:Emit";e["BROADCAST"]="ws:broadcast"})(s=r.WSEventTypeEnum||(r.WSEventTypeEnum={}));function OnWSConnection(e={}){return(r,n,o)=>{(0,i.attachClassMetadata)(i.WS_EVENT_KEY,{eventType:s.ON_CONNECTION,propertyName:n,eventOptions:e,descriptor:o},r.constructor)}}r.OnWSConnection=OnWSConnection;function OnWSDisConnection(){return(e,r,n)=>{(0,i.attachClassMetadata)(i.WS_EVENT_KEY,{eventType:s.ON_DISCONNECTION,propertyName:r,descriptor:n},e.constructor)}}r.OnWSDisConnection=OnWSDisConnection;function OnWSMessage(e,r={}){return(n,o,a)=>{(0,i.attachClassMetadata)(i.WS_EVENT_KEY,{eventType:s.ON_MESSAGE,messageEventName:e,propertyName:o,eventOptions:r,descriptor:a},n.constructor)}}r.OnWSMessage=OnWSMessage;function WSEmit(e,r=[]){return(n,o,a)=>{(0,i.attachClassMetadata)(i.WS_EVENT_KEY,{eventType:s.EMIT,propertyName:o,messageEventName:e,roomName:[].concat(r),descriptor:a},n.constructor)}}r.WSEmit=WSEmit;function WSBroadCast(e="",r=[]){return(n,o,a)=>{(0,i.attachClassMetadata)(i.WS_EVENT_KEY,{eventType:s.BROADCAST,propertyName:o,messageEventName:e,roomName:[].concat(r),descriptor:a},n.constructor)}}r.WSBroadCast=WSBroadCast;r.OnMessage=OnWSMessage;r.Emit=WSEmit;r.OnDisConnection=OnWSDisConnection;r.OnConnection=OnWSConnection},86271:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.FunctionDefinition=void 0;const i=n(87270);const s=n(88797);class FunctionWrapperCreator extends s.ObjectCreator{doConstruct(e,r,n){if(!e){return null}return e(n,r)}async doConstructAsync(e,r,n){if(!e){return null}return e(n,r)}}class FunctionDefinition{constructor(){this.constructorArgs=[];this.namespace="";this.asynchronous=true;this.handlerProps=[];this.allowDowngrade=false;this.innerAutowire=false;this.innerScope=i.ScopeEnum.Singleton;this.creator=new FunctionWrapperCreator(this)}getAttr(e){}hasAttr(e){return false}hasConstructorArgs(){return false}hasDependsOn(){return false}isAsync(){return this.asynchronous}isDirect(){return false}isExternal(){return false}set scope(e){this.innerScope=e}isSingletonScope(){return this.innerScope===i.ScopeEnum.Singleton}isRequestScope(){return this.innerScope===i.ScopeEnum.Request}setAttr(e,r){}}r.FunctionDefinition=FunctionDefinition},88797:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ObjectCreator=void 0;const i=n(86248);const s=n(73171);class ObjectCreator{constructor(e){this.definition=e}load(){let e=null;if(typeof this.definition.path==="string"){if(!this.definition.path){return e}const r=this.definition.path;if(this.definition.export){e=require(r)[this.definition.export]}else{e=require(r)}}else{e=this.definition.path}return e}doConstruct(e,r){if(!e){return Object.create(null)}let n;if(this.definition.constructMethod){n=e[this.definition.constructMethod].apply(e,r)}else{n=Reflect.construct(e,r)}return n}async doConstructAsync(e,r){if(!e){return Object.create(null)}let n;if(this.definition.constructMethod){const i=e[this.definition.constructMethod];if(s.Types.isAsyncFunction(i)){n=await i.apply(e,r)}else{n=i.apply(e,r)}}else{n=Reflect.construct(e,r)}return n}doInit(e){const r=e;if(this.definition.initMethod&&r[this.definition.initMethod]){if(s.Types.isGeneratorFunction(r[this.definition.initMethod])||s.Types.isAsyncFunction(r[this.definition.initMethod])){throw new i.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}else{const e=r[this.definition.initMethod].call(r);if(s.Types.isPromise(e)){throw new i.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}}}}async doInitAsync(e){const r=e;if(this.definition.initMethod&&r[this.definition.initMethod]){const e=r[this.definition.initMethod];if(s.Types.isAsyncFunction(e)){await e.call(r)}else{if(e.length===1){await new Promise((n=>{e.call(r,n)}))}else{e.call(r)}}}}doDestroy(e){if(this.definition.destroyMethod&&e[this.definition.destroyMethod]){e[this.definition.destroyMethod].call(e)}}async doDestroyAsync(e){if(this.definition.destroyMethod&&e[this.definition.destroyMethod]){const r=e[this.definition.destroyMethod];if(s.Types.isAsyncFunction(r)){await r.call(e)}else{if(r.length===1){await new Promise((n=>{r.call(e,n)}))}else{r.call(e)}}}}}r.ObjectCreator=ObjectCreator},78028:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ObjectDefinition=void 0;const i=n(87270);const s=n(79855);const o=n(88797);class ObjectDefinition{constructor(){this._attrs=new Map;this._asynchronous=false;this.scope=i.ScopeEnum.Singleton;this.creator=null;this.id=null;this.name=null;this.initMethod=null;this.destroyMethod=null;this.constructMethod=null;this.constructorArgs=[];this.path=null;this.export=null;this.dependsOn=[];this.properties=new s.ObjectProperties;this.namespace="";this.handlerProps=[];this.allowDowngrade=false;this.creator=new o.ObjectCreator(this)}set asynchronous(e){this._asynchronous=e}isAsync(){return this._asynchronous}isSingletonScope(){return this.scope===i.ScopeEnum.Singleton}isRequestScope(){return this.scope===i.ScopeEnum.Request}hasDependsOn(){return this.dependsOn.length>0}hasConstructorArgs(){return this.constructorArgs.length>0}getAttr(e){return this._attrs.get(e)}hasAttr(e){return this._attrs.has(e)}setAttr(e,r){this._attrs.set(e,r)}}r.ObjectDefinition=ObjectDefinition},79855:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ObjectProperties=void 0;class ObjectProperties extends Map{propertyKeys(){return Array.from(this.keys())}getProperty(e,r){if(this.has(e)){return this.get(e)}return r}setProperty(e,r){return this.set(e,r)}}r.ObjectProperties=ObjectProperties},25895:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayHttpError=r.MidwayError=r.registerErrorCode=void 0;const i=n(58611);const s=new Set;function registerErrorCode(e,r){if(s.has(e)){throw new MidwayError(`Error group ${e} is duplicated, please check before adding.`)}else{s.add(e)}const n={};for(const i in r){n[i]=e.toUpperCase()+"_"+String(r[i]).toUpperCase()}return n}r.registerErrorCode=registerErrorCode;class MidwayError extends Error{constructor(e,r,n){super(e);if(!r||typeof r==="object"){n=r;r="MIDWAY_10000"}this.name=this.constructor.name;this.code=r;this.cause=n===null||n===void 0?void 0:n.cause}}r.MidwayError=MidwayError;class MidwayHttpError extends MidwayError{constructor(e,r,n,s){super(e?typeof e==="string"?e:e.message:i.STATUS_CODES[r],n!==null&&n!==void 0?n:String(r),s);if(e&&e["stack"]){this.stack=e["stack"]}this.status=r}}r.MidwayHttpError=MidwayHttpError},36904:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayEmptyValueError=r.MidwayInvalidConfigPropertyError=r.MidwayMainFrameworkMissingError=r.MidwayCodeInvokeTimeoutError=r.MidwayInvokeForbiddenError=r.MidwayRetryExceededMaxTimesError=r.MidwayDuplicateControllerOptionsError=r.MidwayDuplicateClassNameError=r.MidwayInconsistentVersionError=r.MidwayUtilHttpClientTimeoutError=r.MidwayMissingImportComponentError=r.MidwaySingletonInjectRequestError=r.MidwayUseWrongMethodError=r.MidwayDuplicateRouteError=r.MidwayResolverMissingError=r.MidwayInvalidConfigError=r.MidwayConfigMissingError=r.MidwayFeatureNotImplementedError=r.MidwayFeatureNoLongerSupportedError=r.MidwayDefinitionNotFoundError=r.MidwayParameterError=r.MidwayCommonError=r.FrameworkErrorEnum=void 0;const i=n(25895);r.FrameworkErrorEnum=(0,i.registerErrorCode)("midway",{UNKNOWN:1e4,COMMON:10001,PARAM_TYPE:10002,DEFINITION_NOT_FOUND:10003,FEATURE_NO_LONGER_SUPPORTED:10004,FEATURE_NOT_IMPLEMENTED:10004,MISSING_CONFIG:10006,MISSING_RESOLVER:10007,DUPLICATE_ROUTER:10008,USE_WRONG_METHOD:10009,SINGLETON_INJECT_REQUEST:10010,MISSING_IMPORTS:10011,UTIL_HTTP_TIMEOUT:10012,INCONSISTENT_VERSION:10013,INVALID_CONFIG:10014,DUPLICATE_CLASS_NAME:10015,DUPLICATE_CONTROLLER_PREFIX_OPTIONS:10016,RETRY_OVER_MAX_TIME:10017,INVOKE_METHOD_FORBIDDEN:10018,CODE_INVOKE_TIMEOUT:10019,MAIN_FRAMEWORK_MISSING:10020,INVALID_CONFIG_PROPERTY:10021,EMPTY_VALUE:10022});class MidwayCommonError extends i.MidwayError{constructor(e){super(e,r.FrameworkErrorEnum.COMMON)}}r.MidwayCommonError=MidwayCommonError;class MidwayParameterError extends i.MidwayError{constructor(e){super(e!==null&&e!==void 0?e:"Parameter type not match",r.FrameworkErrorEnum.PARAM_TYPE)}}r.MidwayParameterError=MidwayParameterError;class MidwayDefinitionNotFoundError extends i.MidwayError{static isClosePrototypeOf(e){return e?e[MidwayDefinitionNotFoundError.type]===MidwayDefinitionNotFoundError.type:false}constructor(e){super(`${e} is not valid in current context`,r.FrameworkErrorEnum.DEFINITION_NOT_FOUND);this[MidwayDefinitionNotFoundError.type]=MidwayDefinitionNotFoundError.type}updateErrorMsg(e){const r=this.message.split(" is not valid in current context")[0];this.message=`${r} in class ${e} is not valid in current context`}}r.MidwayDefinitionNotFoundError=MidwayDefinitionNotFoundError;MidwayDefinitionNotFoundError.type=Symbol.for("#NotFoundError");class MidwayFeatureNoLongerSupportedError extends i.MidwayError{constructor(e){super("This feature no longer supported \n"+e,r.FrameworkErrorEnum.FEATURE_NO_LONGER_SUPPORTED)}}r.MidwayFeatureNoLongerSupportedError=MidwayFeatureNoLongerSupportedError;class MidwayFeatureNotImplementedError extends i.MidwayError{constructor(e){super("This feature not implemented \n"+e,r.FrameworkErrorEnum.FEATURE_NOT_IMPLEMENTED)}}r.MidwayFeatureNotImplementedError=MidwayFeatureNotImplementedError;class MidwayConfigMissingError extends i.MidwayError{constructor(e){super(`Can't found config key "${e}" in your config, please set it first`,r.FrameworkErrorEnum.MISSING_CONFIG)}}r.MidwayConfigMissingError=MidwayConfigMissingError;class MidwayInvalidConfigError extends i.MidwayError{constructor(e){super("Invalid config file \n"+e,r.FrameworkErrorEnum.INVALID_CONFIG)}}r.MidwayInvalidConfigError=MidwayInvalidConfigError;class MidwayResolverMissingError extends i.MidwayError{constructor(e){super(`Resolver "${e}" is missing.`,r.FrameworkErrorEnum.MISSING_RESOLVER)}}r.MidwayResolverMissingError=MidwayResolverMissingError;class MidwayDuplicateRouteError extends i.MidwayError{constructor(e,n,i){super(`Duplicate router "${e}" at "${n}" and "${i}"`,r.FrameworkErrorEnum.DUPLICATE_ROUTER)}}r.MidwayDuplicateRouteError=MidwayDuplicateRouteError;class MidwayUseWrongMethodError extends i.MidwayError{constructor(e,n,i){const s=i?`${i} not valid by ${e}, Use ${n} instead!`:`You should not invoked by ${e}, Use ${n} instead!`;super(s,r.FrameworkErrorEnum.USE_WRONG_METHOD)}}r.MidwayUseWrongMethodError=MidwayUseWrongMethodError;class MidwaySingletonInjectRequestError extends i.MidwayError{constructor(e,n){const i=`${e} with singleton scope can't implicitly inject ${n} with request scope directly, please add "@Scope(ScopeEnum.Request, { allowDowngrade: true })" in ${n} or use "ctx.requestContext.getAsync(${n})".`;super(i,r.FrameworkErrorEnum.SINGLETON_INJECT_REQUEST)}}r.MidwaySingletonInjectRequestError=MidwaySingletonInjectRequestError;class MidwayMissingImportComponentError extends i.MidwayError{constructor(e){const n=`"${e}" can't inject and maybe forgot add "{imports: [***]}" in @Configuration.`;super(n,r.FrameworkErrorEnum.MISSING_IMPORTS)}}r.MidwayMissingImportComponentError=MidwayMissingImportComponentError;class MidwayUtilHttpClientTimeoutError extends i.MidwayError{constructor(e){super(e,r.FrameworkErrorEnum.UTIL_HTTP_TIMEOUT)}}r.MidwayUtilHttpClientTimeoutError=MidwayUtilHttpClientTimeoutError;class MidwayInconsistentVersionError extends i.MidwayError{constructor(){const e='We find a latest dependency package installed, please remove the lock file and use "npm update" to upgrade all dependencies first.';super(e,r.FrameworkErrorEnum.INCONSISTENT_VERSION)}}r.MidwayInconsistentVersionError=MidwayInconsistentVersionError;class MidwayDuplicateClassNameError extends i.MidwayError{constructor(e,n,i){super(`"${e}" duplicated between "${n}" and "${i}"`,r.FrameworkErrorEnum.DUPLICATE_CLASS_NAME)}}r.MidwayDuplicateClassNameError=MidwayDuplicateClassNameError;class MidwayDuplicateControllerOptionsError extends i.MidwayError{constructor(e,n,i){super(`"Prefix ${e}" with duplicated controller options between "${n}" and "${i}"`,r.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS)}}r.MidwayDuplicateControllerOptionsError=MidwayDuplicateControllerOptionsError;class MidwayRetryExceededMaxTimesError extends i.MidwayError{constructor(e,n,i){super(`Invoke "${e}" retries exceeded the maximum number of times(${n}), error: ${i.message}`,r.FrameworkErrorEnum.RETRY_OVER_MAX_TIME,{cause:i})}}r.MidwayRetryExceededMaxTimesError=MidwayRetryExceededMaxTimesError;class MidwayInvokeForbiddenError extends i.MidwayError{constructor(e,n){super(`Invoke "${n?n.name:"unknown"}.${e}" is forbidden.`,r.FrameworkErrorEnum.INVOKE_METHOD_FORBIDDEN)}}r.MidwayInvokeForbiddenError=MidwayInvokeForbiddenError;class MidwayCodeInvokeTimeoutError extends i.MidwayError{constructor(e,n){super(`Invoke "${e}" running timeout(${n}ms)`,r.FrameworkErrorEnum.CODE_INVOKE_TIMEOUT)}}r.MidwayCodeInvokeTimeoutError=MidwayCodeInvokeTimeoutError;class MidwayMainFrameworkMissingError extends i.MidwayError{constructor(){super("Main framework missing, please check your configuration.",r.FrameworkErrorEnum.MAIN_FRAMEWORK_MISSING)}}r.MidwayMainFrameworkMissingError=MidwayMainFrameworkMissingError;class MidwayInvalidConfigPropertyError extends i.MidwayError{constructor(e,n){super(`Invalid config property "${e}", ${n?`only ${n.join(",")} can be set`:"please check your configuration"}.`,r.FrameworkErrorEnum.INVALID_CONFIG_PROPERTY)}}r.MidwayInvalidConfigPropertyError=MidwayInvalidConfigPropertyError;class MidwayEmptyValueError extends i.MidwayError{constructor(e){super(e!==null&&e!==void 0?e:"There is an empty value got and it is not allowed.",r.FrameworkErrorEnum.EMPTY_VALUE)}}r.MidwayEmptyValueError=MidwayEmptyValueError},91438:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.httpError=r.GatewayTimeoutError=r.ServiceUnavailableError=r.BadGatewayError=r.NotImplementedError=r.InternalServerErrorError=r.TooManyRequestsError=r.UnprocessableEntityError=r.UnsupportedMediaTypeError=r.PayloadTooLargeError=r.GoneError=r.ConflictError=r.RequestTimeoutError=r.NotAcceptableError=r.ForbiddenError=r.NotFoundError=r.UnauthorizedError=r.BadRequestError=r.HttpStatus=void 0;const i=n(25895);var s;(function(e){e[e["CONTINUE"]=100]="CONTINUE";e[e["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";e[e["PROCESSING"]=102]="PROCESSING";e[e["EARLYHINTS"]=103]="EARLYHINTS";e[e["OK"]=200]="OK";e[e["CREATED"]=201]="CREATED";e[e["ACCEPTED"]=202]="ACCEPTED";e[e["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";e[e["NO_CONTENT"]=204]="NO_CONTENT";e[e["RESET_CONTENT"]=205]="RESET_CONTENT";e[e["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";e[e["AMBIGUOUS"]=300]="AMBIGUOUS";e[e["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";e[e["FOUND"]=302]="FOUND";e[e["SEE_OTHER"]=303]="SEE_OTHER";e[e["NOT_MODIFIED"]=304]="NOT_MODIFIED";e[e["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";e[e["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";e[e["BAD_REQUEST"]=400]="BAD_REQUEST";e[e["UNAUTHORIZED"]=401]="UNAUTHORIZED";e[e["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";e[e["FORBIDDEN"]=403]="FORBIDDEN";e[e["NOT_FOUND"]=404]="NOT_FOUND";e[e["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";e[e["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";e[e["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";e[e["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";e[e["CONFLICT"]=409]="CONFLICT";e[e["GONE"]=410]="GONE";e[e["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";e[e["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";e[e["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";e[e["URI_TOO_LONG"]=414]="URI_TOO_LONG";e[e["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";e[e["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";e[e["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";e[e["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";e[e["MISDIRECTED"]=421]="MISDIRECTED";e[e["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";e[e["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";e[e["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";e[e["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";e[e["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";e[e["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";e[e["BAD_GATEWAY"]=502]="BAD_GATEWAY";e[e["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";e[e["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";e[e["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(s=r.HttpStatus||(r.HttpStatus={}));class BadRequestError extends i.MidwayHttpError{constructor(e){super(e,s.BAD_REQUEST)}}r.BadRequestError=BadRequestError;class UnauthorizedError extends i.MidwayHttpError{constructor(e){super(e,s.UNAUTHORIZED)}}r.UnauthorizedError=UnauthorizedError;class NotFoundError extends i.MidwayHttpError{constructor(e){super(e,s.NOT_FOUND)}}r.NotFoundError=NotFoundError;class ForbiddenError extends i.MidwayHttpError{constructor(e){super(e,s.FORBIDDEN)}}r.ForbiddenError=ForbiddenError;class NotAcceptableError extends i.MidwayHttpError{constructor(e){super(e,s.NOT_ACCEPTABLE)}}r.NotAcceptableError=NotAcceptableError;class RequestTimeoutError extends i.MidwayHttpError{constructor(e){super(e,s.REQUEST_TIMEOUT)}}r.RequestTimeoutError=RequestTimeoutError;class ConflictError extends i.MidwayHttpError{constructor(e){super(e,s.CONFLICT)}}r.ConflictError=ConflictError;class GoneError extends i.MidwayHttpError{constructor(e){super(e,s.GONE)}}r.GoneError=GoneError;class PayloadTooLargeError extends i.MidwayHttpError{constructor(e){super(e,s.PAYLOAD_TOO_LARGE)}}r.PayloadTooLargeError=PayloadTooLargeError;class UnsupportedMediaTypeError extends i.MidwayHttpError{constructor(e){super(e,s.UNSUPPORTED_MEDIA_TYPE)}}r.UnsupportedMediaTypeError=UnsupportedMediaTypeError;class UnprocessableEntityError extends i.MidwayHttpError{constructor(e){super(e,s.UNPROCESSABLE_ENTITY)}}r.UnprocessableEntityError=UnprocessableEntityError;class TooManyRequestsError extends i.MidwayHttpError{constructor(e){super(e,s.TOO_MANY_REQUESTS)}}r.TooManyRequestsError=TooManyRequestsError;class InternalServerErrorError extends i.MidwayHttpError{constructor(e){super(e,s.INTERNAL_SERVER_ERROR)}}r.InternalServerErrorError=InternalServerErrorError;class NotImplementedError extends i.MidwayHttpError{constructor(e){super(e,s.NOT_IMPLEMENTED)}}r.NotImplementedError=NotImplementedError;class BadGatewayError extends i.MidwayHttpError{constructor(e){super(e,s.BAD_GATEWAY)}}r.BadGatewayError=BadGatewayError;class ServiceUnavailableError extends i.MidwayHttpError{constructor(e){super(e,s.SERVICE_UNAVAILABLE)}}r.ServiceUnavailableError=ServiceUnavailableError;class GatewayTimeoutError extends i.MidwayHttpError{constructor(e){super(e,s.GATEWAY_TIMEOUT)}}r.GatewayTimeoutError=GatewayTimeoutError;r.httpError={BadRequestError:BadRequestError,UnauthorizedError:UnauthorizedError,NotFoundError:NotFoundError,ForbiddenError:ForbiddenError,NotAcceptableError:NotAcceptableError,RequestTimeoutError:RequestTimeoutError,ConflictError:ConflictError,GoneError:GoneError,PayloadTooLargeError:PayloadTooLargeError,UnsupportedMediaTypeError:UnsupportedMediaTypeError,UnprocessableEntityError:UnprocessableEntityError,TooManyRequestsError:TooManyRequestsError,InternalServerErrorError:InternalServerErrorError,NotImplementedError:NotImplementedError,BadGatewayError:BadGatewayError,ServiceUnavailableError:ServiceUnavailableError,GatewayTimeoutError:GatewayTimeoutError}},86248:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.httpError=r.HttpStatus=void 0;s(n(25895),r);var o=n(91438);Object.defineProperty(r,"HttpStatus",{enumerable:true,get:function(){return o.HttpStatus}});Object.defineProperty(r,"httpError",{enumerable:true,get:function(){return o.httpError}});s(n(36904),r)},65061:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.createConfiguration=r.FunctionalConfiguration=void 0;class FunctionalConfiguration{constructor(e){this.options=e;this.readyHandler=()=>{};this.stopHandler=()=>{};this.configLoadHandler=()=>{};this.serverReadyHandler=()=>{}}onConfigLoad(e,r){if(typeof e==="function"){this.configLoadHandler=e}else{return this.configLoadHandler(e,r)}return this}onReady(e,r){if(typeof e==="function"){this.readyHandler=e}else{return this.readyHandler(e,r)}return this}onServerReady(e,r){if(typeof e==="function"){this.serverReadyHandler=e}else{return this.serverReadyHandler(e,r)}return this}onStop(e,r){if(typeof e==="function"){this.stopHandler=e}else{return this.stopHandler(e,r)}return this}getConfigurationOptions(){return this.options}}r.FunctionalConfiguration=FunctionalConfiguration;const createConfiguration=e=>new FunctionalConfiguration(e);r.createConfiguration=createConfiguration},45573:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayPerformanceManager=r.TypedResourceManager=r.HttpServerResponse=r.ServerResponse=r.FORMAT=r.FileUtils=r.PathFileUtil=r.Types=r.retryWith=r.retryWithAsync=r.extend=r.Utils=r.sleep=r.isTypeScriptEnvironment=r.wrapAsync=r.wrapMiddleware=r.pathMatching=r.transformRequestObjectByType=r.deprecatedOutput=r.delegateTargetAllPrototypeMethod=r.delegateTargetProperties=r.delegateTargetMethod=r.delegateTargetPrototypeMethod=r.loadModule=r.safeRequire=r.safelyGet=r.ASYNC_ROOT_CONTEXT=r.MidwayPriorityManager=r.DEFAULT_PRIORITY=r.DataSourceManager=r.WebRouterCollector=r.MidwayServerlessFunctionService=r.MidwayWebRouterService=r.MidwayHealthService=r.MidwayMockService=r.MidwayDecoratorService=r.MidwayMiddlewareService=r.MidwayLifeCycleService=r.MidwayAspectService=r.MidwayFrameworkService=r.MidwayLoggerService=r.MidwayInformationService=r.MidwayEnvironmentService=r.MidwayConfigService=r.FunctionalConfiguration=r.createConfiguration=r.BaseFramework=r.MidwayRequestContainer=void 0;s(n(87270),r);s(n(12922),r);var o=n(34005);Object.defineProperty(r,"MidwayRequestContainer",{enumerable:true,get:function(){return o.MidwayRequestContainer}});var a=n(31630);Object.defineProperty(r,"BaseFramework",{enumerable:true,get:function(){return a.BaseFramework}});s(n(20233),r);s(n(77404),r);var c=n(65061);Object.defineProperty(r,"createConfiguration",{enumerable:true,get:function(){return c.createConfiguration}});Object.defineProperty(r,"FunctionalConfiguration",{enumerable:true,get:function(){return c.FunctionalConfiguration}});var u=n(73440);Object.defineProperty(r,"MidwayConfigService",{enumerable:true,get:function(){return u.MidwayConfigService}});var p=n(14057);Object.defineProperty(r,"MidwayEnvironmentService",{enumerable:true,get:function(){return p.MidwayEnvironmentService}});var g=n(41560);Object.defineProperty(r,"MidwayInformationService",{enumerable:true,get:function(){return g.MidwayInformationService}});var v=n(70426);Object.defineProperty(r,"MidwayLoggerService",{enumerable:true,get:function(){return v.MidwayLoggerService}});var b=n(65338);Object.defineProperty(r,"MidwayFrameworkService",{enumerable:true,get:function(){return b.MidwayFrameworkService}});var _=n(59550);Object.defineProperty(r,"MidwayAspectService",{enumerable:true,get:function(){return _.MidwayAspectService}});var E=n(1026);Object.defineProperty(r,"MidwayLifeCycleService",{enumerable:true,get:function(){return E.MidwayLifeCycleService}});var x=n(66134);Object.defineProperty(r,"MidwayMiddlewareService",{enumerable:true,get:function(){return x.MidwayMiddlewareService}});var T=n(14625);Object.defineProperty(r,"MidwayDecoratorService",{enumerable:true,get:function(){return T.MidwayDecoratorService}});var w=n(67072);Object.defineProperty(r,"MidwayMockService",{enumerable:true,get:function(){return w.MidwayMockService}});var C=n(34292);Object.defineProperty(r,"MidwayHealthService",{enumerable:true,get:function(){return C.MidwayHealthService}});var A=n(64259);Object.defineProperty(r,"MidwayWebRouterService",{enumerable:true,get:function(){return A.MidwayWebRouterService}});var k=n(42986);Object.defineProperty(r,"MidwayServerlessFunctionService",{enumerable:true,get:function(){return k.MidwayServerlessFunctionService}});Object.defineProperty(r,"WebRouterCollector",{enumerable:true,get:function(){return k.WebRouterCollector}});var P=n(50771);Object.defineProperty(r,"DataSourceManager",{enumerable:true,get:function(){return P.DataSourceManager}});var I=n(60340);Object.defineProperty(r,"DEFAULT_PRIORITY",{enumerable:true,get:function(){return I.DEFAULT_PRIORITY}});Object.defineProperty(r,"MidwayPriorityManager",{enumerable:true,get:function(){return I.MidwayPriorityManager}});s(n(720),r);s(n(94853),r);s(n(37940),r);s(n(7647),r);s(n(11207),r);s(n(12888),r);s(n(91044),r);s(n(43762),r);s(n(51926),r);s(n(33216),r);s(n(86248),r);var R=n(46905);Object.defineProperty(r,"ASYNC_ROOT_CONTEXT",{enumerable:true,get:function(){return R.ASYNC_ROOT_CONTEXT}});s(n(8351),r);s(n(7679),r);s(n(96695),r);var N=n(86110);Object.defineProperty(r,"safelyGet",{enumerable:true,get:function(){return N.safelyGet}});Object.defineProperty(r,"safeRequire",{enumerable:true,get:function(){return N.safeRequire}});Object.defineProperty(r,"loadModule",{enumerable:true,get:function(){return N.loadModule}});Object.defineProperty(r,"delegateTargetPrototypeMethod",{enumerable:true,get:function(){return N.delegateTargetPrototypeMethod}});Object.defineProperty(r,"delegateTargetMethod",{enumerable:true,get:function(){return N.delegateTargetMethod}});Object.defineProperty(r,"delegateTargetProperties",{enumerable:true,get:function(){return N.delegateTargetProperties}});Object.defineProperty(r,"delegateTargetAllPrototypeMethod",{enumerable:true,get:function(){return N.delegateTargetAllPrototypeMethod}});Object.defineProperty(r,"deprecatedOutput",{enumerable:true,get:function(){return N.deprecatedOutput}});Object.defineProperty(r,"transformRequestObjectByType",{enumerable:true,get:function(){return N.transformRequestObjectByType}});Object.defineProperty(r,"pathMatching",{enumerable:true,get:function(){return N.pathMatching}});Object.defineProperty(r,"wrapMiddleware",{enumerable:true,get:function(){return N.wrapMiddleware}});Object.defineProperty(r,"wrapAsync",{enumerable:true,get:function(){return N.wrapAsync}});Object.defineProperty(r,"isTypeScriptEnvironment",{enumerable:true,get:function(){return N.isTypeScriptEnvironment}});Object.defineProperty(r,"sleep",{enumerable:true,get:function(){return N.sleep}});Object.defineProperty(r,"Utils",{enumerable:true,get:function(){return N.Utils}});var L=n(90428);Object.defineProperty(r,"extend",{enumerable:true,get:function(){return L.extend}});s(n(17816),r);s(n(7269),r);s(n(66027),r);s(n(9527),r);var B=n(73724);Object.defineProperty(r,"retryWithAsync",{enumerable:true,get:function(){return B.retryWithAsync}});Object.defineProperty(r,"retryWith",{enumerable:true,get:function(){return B.retryWith}});var j=n(73171);Object.defineProperty(r,"Types",{enumerable:true,get:function(){return j.Types}});var U=n(29837);Object.defineProperty(r,"PathFileUtil",{enumerable:true,get:function(){return U.PathFileUtil}});var q=n(93879);Object.defineProperty(r,"FileUtils",{enumerable:true,get:function(){return q.FileUtils}});var V=n(85439);Object.defineProperty(r,"FORMAT",{enumerable:true,get:function(){return V.FORMAT}});var z=n(14233);Object.defineProperty(r,"ServerResponse",{enumerable:true,get:function(){return z.ServerResponse}});Object.defineProperty(r,"HttpServerResponse",{enumerable:true,get:function(){return z.HttpServerResponse}});var K=n(53924);Object.defineProperty(r,"TypedResourceManager",{enumerable:true,get:function(){return K.TypedResourceManager}});var W=n(4334);Object.defineProperty(r,"MidwayPerformanceManager",{enumerable:true,get:function(){return W.MidwayPerformanceManager}})},87270:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayProcessTypeEnum=r.ObjectLifeCycleEvent=r.ServerlessTriggerType=r.MidwayFrameworkType=r.FrameworkType=r.MSListenerType=r.MSProviderType=r.InjectModeEnum=r.ScopeEnum=void 0;var n;(function(e){e["Singleton"]="Singleton";e["Request"]="Request";e["Prototype"]="Prototype"})(n=r.ScopeEnum||(r.ScopeEnum={}));var i;(function(e){e["Identifier"]="Identifier";e["Class"]="Class";e["PropertyName"]="PropertyName"})(i=r.InjectModeEnum||(r.InjectModeEnum={}));var s;(function(e){e["DUBBO"]="dubbo";e["GRPC"]="gRPC"})(s=r.MSProviderType||(r.MSProviderType={}));var o;(function(e){e["RABBITMQ"]="rabbitmq";e["MQTT"]="mqtt";e["KAFKA"]="kafka";e["REDIS"]="redis"})(o=r.MSListenerType||(r.MSListenerType={}));class FrameworkType{}r.FrameworkType=FrameworkType;class MidwayFrameworkType extends FrameworkType{constructor(e){super();this.name=e}}r.MidwayFrameworkType=MidwayFrameworkType;MidwayFrameworkType.WEB=new MidwayFrameworkType("@midwayjs/web");MidwayFrameworkType.WEB_KOA=new MidwayFrameworkType("@midwayjs/web-koa");MidwayFrameworkType.WEB_EXPRESS=new MidwayFrameworkType("@midwayjs/express");MidwayFrameworkType.FAAS=new MidwayFrameworkType("@midwayjs/faas");MidwayFrameworkType.MS_GRPC=new MidwayFrameworkType("@midwayjs/grpc");MidwayFrameworkType.MS_RABBITMQ=new MidwayFrameworkType("@midwayjs/rabbitmq");MidwayFrameworkType.MS_KAFKA=new MidwayFrameworkType("@midwayjs/kafka");MidwayFrameworkType.WS_IO=new MidwayFrameworkType("@midwayjs/socketio");MidwayFrameworkType.WS=new MidwayFrameworkType("@midwayjs/ws");MidwayFrameworkType.SERVERLESS_APP=new MidwayFrameworkType("@midwayjs/serverless-app");MidwayFrameworkType.CUSTOM=new MidwayFrameworkType("");MidwayFrameworkType.EMPTY=new MidwayFrameworkType("empty");MidwayFrameworkType.LIGHT=new MidwayFrameworkType("light");MidwayFrameworkType.TASK=new MidwayFrameworkType("@midwayjs/task");var a;(function(e){e["EVENT"]="event";e["HTTP"]="http";e["API_GATEWAY"]="apigw";e["OS"]="os";e["CDN"]="cdn";e["LOG"]="log";e["TIMER"]="timer";e["MQ"]="mq";e["KAFKA"]="kafka";e["HSF"]="hsf";e["MTOP"]="mtop";e["SSR"]="ssr"})(a=r.ServerlessTriggerType||(r.ServerlessTriggerType={}));var c;(function(e){e["BEFORE_BIND"]="beforeBind";e["BEFORE_CREATED"]="beforeObjectCreated";e["AFTER_CREATED"]="afterObjectCreated";e["AFTER_INIT"]="afterObjectInit";e["BEFORE_DESTROY"]="beforeObjectDestroy"})(c=r.ObjectLifeCycleEvent||(r.ObjectLifeCycleEvent={}));var u;(function(e){e["APPLICATION"]="APPLICATION";e["AGENT"]="AGENT"})(u=r.MidwayProcessTypeEnum||(r.MidwayProcessTypeEnum={}))},97996:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ServerResponse=void 0;class ServerResponse{constructor(e){this.isSuccess=true;this.ctx=e}json(e){return Object.getPrototypeOf(this).constructor.JSON_TPL(e,this.isSuccess,this.ctx)}text(e){return Object.getPrototypeOf(this).constructor.TEXT_TPL(e,this.isSuccess,this.ctx)}blob(e){return Object.getPrototypeOf(this).constructor.BLOB_TPL(e,this.isSuccess,this.ctx)}success(){this.isSuccess=true;return this}fail(){this.isSuccess=false;return this}}r.ServerResponse=ServerResponse;ServerResponse.TEXT_TPL=(e,r,n)=>e;ServerResponse.JSON_TPL=(e,r,n)=>{if(r){return{success:"true",data:e}}else{return{success:"false",message:e||"fail"}}};ServerResponse.BLOB_TPL=(e,r,n)=>e},78053:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.HttpServerResponse=void 0;const i=n(79896);const s=n(97996);const o=n(73156);const a=n(56109);const c=n(16928);class HttpServerResponse extends s.ServerResponse{constructor(e){super(e)}status(e){this.ctx.res.statusCode=e;return this}header(e,r){this.ctx.res.setHeader(e,r);return this}headers(e){if(this.ctx.res.setHeaders){this.ctx.res.setHeaders(new Map(Object.entries(e)))}else{for(const r in e){this.header(r,e[r])}}return this}json(e){this.header("Content-Type","application/json");return Object.getPrototypeOf(this).constructor.JSON_TPL(e,this.isSuccess,this.ctx)}text(e){this.header("Content-Type","text/plain");return Object.getPrototypeOf(this).constructor.TEXT_TPL(e,this.isSuccess,this.ctx)}file(e,r){this.header("Content-Type",r||"application/octet-stream");this.header("Content-Disposition",`attachment; filename=${(0,c.basename)(e)}`);return Object.getPrototypeOf(this).constructor.FILE_TPL(typeof e==="string"?(0,i.createReadStream)(e):e,this.isSuccess,this.ctx)}blob(e,r){this.header("Content-Type",r||"application/octet-stream");return Object.getPrototypeOf(this).constructor.BLOB_TPL(e,this.isSuccess,this.ctx)}html(e){this.header("Content-Type","text/html");return Object.getPrototypeOf(this).constructor.HTML_TPL(e,this.isSuccess,this.ctx)}redirect(e,r=302){this.status(r);if(this.ctx.redirect){return this.ctx.redirect(e)}else if(this.ctx.res.redirect){return this.ctx.res.redirect(e)}else{this.header("Location",e)}}sse(e={}){return new o.ServerSendEventStream(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.SSE_TPL,...e})}stream(e={}){return new a.HttpStreamResponse(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.STREAM_TPL,...e})}}r.HttpServerResponse=HttpServerResponse;HttpServerResponse.FILE_TPL=(e,r,n)=>e;HttpServerResponse.SSE_TPL=(e,r)=>e;HttpServerResponse.STREAM_TPL=(e,r)=>e;HttpServerResponse.HTML_TPL=(e,r,n)=>e},14233:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.HttpServerResponse=r.ServerResponse=void 0;var i=n(97996);Object.defineProperty(r,"ServerResponse",{enumerable:true,get:function(){return i.ServerResponse}});var s=n(78053);Object.defineProperty(r,"HttpServerResponse",{enumerable:true,get:function(){return s.HttpServerResponse}})},73156:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ServerSendEventStream=void 0;const i=n(2203);class ServerSendEventStream extends i.Transform{constructor(e,r={}){super({objectMode:true,...r});this.isActive=false;this.ctx=e;this.closeEvent=r.closeEvent||"close";this.options=r;this.ctx.req.on("close",this.handleClose.bind(this))}_transform(e,r,n){try{let r,i="data: ";const s=/^\s*:\s*/;const o=[];if(!this.isActive){this.isActive=true;const e={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(const r in e){this.ctx.res.setHeader(r,e[r])}this.ctx.req.socket.setTimeout(0);this.ctx.req.socket.setNoDelay(true);this.ctx.req.socket.setKeepAlive(true);o.push(": ok")}const a=e;if(a.event)o.push("event: "+a.event);if(a.retry)o.push("retry: "+a.retry);if(a.id)o.push("id: "+a.id);if(typeof a.data==="object"){r=JSON.stringify(a.data);o.push(i+r)}else if(typeof a.data==="undefined"){o.push(i)}else{a.data=String(a.data);if(a.data.search(s)!==-1){a.data=a.data.replace(s,"");i=": "}a.data=a.data.replace(/(\r\n|\r|\n)/g,"\n");r=a.data.split(/\n/);for(let e=0,n=r.length;e<n;++e){const s=r[e];if(e+1===n){o.push(i+s)}else{o.push(i+s)}}}this.push(o.join("\n")+"\n\n");n()}catch(e){this.ctx.logger.error(e);this.sendError(e);this.end();n(e)}}sendError(e){this.send({event:"error",data:e.message||"An error occurred"})}sendEnd(e){e.event=this.closeEvent;this.send(e)}send(e){super.write(this.options.tpl(e,this.ctx))}handleClose(){this.end()}}r.ServerSendEventStream=ServerSendEventStream},56109:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.HttpStreamResponse=void 0;const i=n(2203);class HttpStreamResponse extends i.Transform{constructor(e,r={}){super({objectMode:true,...r});this.isActive=false;this.ctx=e;this.options=r}_transform(e,r,n){try{if(!this.isActive){this.isActive=true;this.ctx.res.statusCode=200;this.ctx.res.setHeader("Transfer-Encoding","chunked");this.ctx.res.setHeader("Cache-Control","no-cache");this.ctx.req.socket.setTimeout(0)}if(typeof e==="string"){this.ctx.res.write(e)}else{this.ctx.res.write(JSON.stringify(e))}n()}catch(e){this.ctx.logger.error(e);this.end();this.ctx.res.end();n(e)}}send(e){if(!this.writable){return}this.write(this.options.tpl(e,this.ctx))}sendError(e){this.ctx.logger.error(e);this.end();this.ctx.res.end()}_flush(e){this.ctx.res.end();e()}}r.HttpStreamResponse=HttpStreamResponse},59550:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayAspectService=void 0;const o=n(14006);const a=n(87270);const c=n(8351);const u=n(73171);let p=class MidwayAspectService{constructor(e){this.applicationContext=e}async loadAspect(){const e=(0,c.listModule)(c.ASPECT_KEY);let r=[];for(const n of e){const e=(0,c.getClassMetadata)(c.ASPECT_KEY,n);r=r.concat(e.map((e=>{e.aspectModule=n;return e})))}r.sort(((e,r)=>(r.priority||0)-(e.priority||0)));for(const e of r){const r=await this.applicationContext.getAsync(e.aspectModule);await this.addAspect(r,e)}}async addAspect(e,r){const n=r.aspectTarget;const i=Object.getOwnPropertyNames(n.prototype);const s=r.match?o(r.match):()=>true;for(const r of i){if(r==="constructor"||!s(r)){continue}const i=Object.getOwnPropertyDescriptor(n.prototype,r);if(!i||i.writable===false){continue}this.interceptPrototypeMethod(n,r,e)}}interceptPrototypeMethod(e,r,n){const i=e.prototype[r];if(u.Types.isAsyncFunction(e.prototype[r])){e.prototype[r]=async function(...e){var s,o,a;let c,u;const newProceed=(...e)=>i.apply(this,e);const p={methodName:r,target:this,args:e,proceed:newProceed,proceedIsAsyncFunction:true};if(typeof n==="function"){n=n()}try{await((s=n.before)===null||s===void 0?void 0:s.call(n,p));if(n.around){u=await n.around(p)}else{u=await i.call(this,...p.args)}p.proceed=undefined;const e=await((o=n.afterReturn)===null||o===void 0?void 0:o.call(n,p,u));u=typeof e==="undefined"?u:e;return u}catch(e){p.proceed=undefined;c=e;if(n.afterThrow){await n.afterThrow(p,c)}else{throw e}}finally{await((a=n.after)===null||a===void 0?void 0:a.call(n,p,u,c))}}}else{e.prototype[r]=function(...e){var s,o,a;let c,u;const newProceed=(...e)=>i.apply(this,e);const p={methodName:r,target:this,args:e,proceed:newProceed,proceedIsAsyncFunction:false};if(typeof n==="function"){n=n()}try{(s=n.before)===null||s===void 0?void 0:s.call(n,p);if(n.around){u=n.around(p)}else{u=i.call(this,...p.args)}p.proceed=undefined;const e=(o=n.afterReturn)===null||o===void 0?void 0:o.call(n,p,u);u=typeof e==="undefined"?u:e;return u}catch(e){p.proceed=undefined;c=e;if(n.afterThrow){n.afterThrow(p,c)}else{throw e}}finally{(a=n.after)===null||a===void 0?void 0:a.call(n,p,u,c)}}}}};p=i([(0,c.Provide)(),(0,c.Scope)(a.ScopeEnum.Singleton),s("design:paramtypes",[Object])],p);r.MidwayAspectService=p},73440:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayConfigService=void 0;const o=n(16928);const a=n(87270);const c=n(86110);const u=n(79896);const p=n(39023);const g=n(14057);const v=n(41560);const b=n(90428);const _=n(86248);const E=n(8351);const x=n(73171);const T=p.debuglog("midway:debug");let w=class MidwayConfigService{constructor(){this.envDirMap=new Map;this.aliasMap={prod:"production",unittest:"test"};this.configMergeOrder=[];this.configuration={};this.isReady=false;this.externalObject=[];this.configFilterList=[]}init(){this.appInfo={pkg:this.informationService.getPkg(),name:this.informationService.getProjectName(),baseDir:this.informationService.getBaseDir(),appDir:this.informationService.getAppDir(),HOME:this.informationService.getHome(),root:this.informationService.getRoot(),env:this.environmentService.getCurrentEnvironment()}}add(e){for(const r of e){if(typeof r==="string"){if(/\.\w+$/.test(r)){const e=this.getConfigEnv(r);const n=this.getEnvSet(e);n.add(r);if(this.aliasMap[e]){this.getEnvSet(this.aliasMap[e]).add(r)}}else{const e=(0,u.statSync)(r);if(e.isDirectory()){const e=(0,u.readdirSync)(r);this.add(e.map((e=>(0,o.join)(r,e))))}}}else{for(const e in r){this.getEnvSet(e).add(r[e]);if(this.aliasMap[e]){this.getEnvSet(this.aliasMap[e]).add(r[e])}}}}}addObject(e,r=false){if(this.isReady){e=this.runWithFilter(e);if(!e){T("[config]: Filter config and got undefined will be drop it");return}this.configMergeOrder.push({env:"default",extraPath:"",value:e});if(r){this.configuration=(0,b.extend)(true,e,this.configuration)}else{(0,b.extend)(true,this.configuration,e)}}else{this.externalObject.push(e)}}getEnvSet(e){if(!this.envDirMap.has(e)){this.envDirMap.set(e,new Set)}return this.envDirMap.get(e)}getConfigEnv(e){const r=(0,o.basename)(e);const n=r.split(".");const i=n.pop();if(i!=="js"&&i!=="ts"){return i}return n.pop()}load(){if(this.isReady)return;const e=this.getEnvSet("default");const r=this.getEnvSet(this.environmentService.getCurrentEnvironment());const n={};const i=e.size;for(const[s,o]of[...e,...r].entries()){let e=this.loadConfig(o);if(x.Types.isFunction(e)){e=e.apply(null,[this.appInfo,n])}if(!e){continue}e=this.runWithFilter(e);if(!e){T("[config]: Filter config and got undefined will be drop it");continue}if(typeof o==="string"){T("[config]: Loaded config %s, %j",o,e)}else{T("[config]: Loaded config %j",e)}this.configMergeOrder.push({env:s<i?"default":this.environmentService.getCurrentEnvironment(),extraPath:o,value:e});(0,b.extend)(true,n,e)}if(this.externalObject.length){for(let e of this.externalObject){if(e){e=this.runWithFilter(e);if(!e){T("[config]: Filter config and got undefined will be drop it");continue}T("[config]: Loaded external object %j",e);(0,b.extend)(true,n,e);this.configMergeOrder.push({env:"default",extraPath:"",value:e})}}}this.configuration=n;this.isReady=true}getConfiguration(e){if(e){return(0,c.safelyGet)(e,this.configuration)}return this.configuration}getConfigMergeOrder(){return this.configMergeOrder}loadConfig(e){let r=typeof e==="string"?require(e):e;if(r&&r.__esModule){if(r&&r.default){if(Object.keys(r).length>1){throw new _.MidwayInvalidConfigError(`${e} should not have both a default export and named export`)}r=r.default}}return r}clearAllConfig(){this.configuration={}}clearConfigMergeOrder(){this.configMergeOrder.length=0}addFilter(e){this.configFilterList.push(e)}runWithFilter(e){for(const r of this.configFilterList){T(`[config]: Filter config by filter = "${r.name||"anonymous filter"}"`);e=r(e);T("[config]: Filter config result = %j",e)}return e}getAppInfo(){return this.appInfo}};i([(0,E.Inject)(),s("design:type",g.MidwayEnvironmentService)],w.prototype,"environmentService",void 0);i([(0,E.Inject)(),s("design:type",v.MidwayInformationService)],w.prototype,"informationService",void 0);i([(0,E.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],w.prototype,"init",null);w=i([(0,E.Provide)(),(0,E.Scope)(a.ScopeEnum.Singleton)],w);r.MidwayConfigService=w},14625:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayDecoratorService=void 0;const o=n(8351);const a=n(87270);const c=n(59550);const u=n(86248);const p=n(39023);const g=n(73171);const v=p.debuglog("midway:debug");let b=class MidwayDecoratorService{constructor(e){this.applicationContext=e;this.propertyHandlerMap=new Map;this.methodDecoratorMap=new Map;this.parameterDecoratorMap=new Map;this.parameterDecoratorPipes=new Map}init(){this.applicationContext.onBeforeBind((e=>{const r=(0,o.getClassMetadata)(o.INJECT_CUSTOM_METHOD,e);if(r){for(const n of r){const{propertyName:r,key:i,metadata:s,options:o}=n;if(!o||!o.impl){continue}this.aspectService.interceptPrototypeMethod(e,r,(()=>{const n=this.methodDecoratorMap.get(i);if(!n){throw new u.MidwayCommonError(`Method Decorator "${i}" handler not found, please register first.`)}return n({target:e,propertyName:r,metadata:s})}))}}const n=(0,o.getClassMetadata)(o.INJECT_CUSTOM_PARAM,e);if(n){for(const r of Object.keys(n)){this.aspectService.interceptPrototypeMethod(e,r,(()=>({before:async i=>{const s=[...i.args];for(const a of n[r]){const{propertyName:r,key:n,metadata:c,parameterIndex:p,options:b}=a;let _;if(b&&b.impl){_=this.parameterDecoratorMap.get(n);if(!_){throw new u.MidwayCommonError(`Parameter Decorator "${n}" handler not found, please register first.`)}}else{_=async({parameterIndex:e,originArgs:r})=>r[e]}const E=(0,o.getMethodParamTypes)(e,r);let x=false;try{s[p]=await _({metadata:c,propertyName:r,parameterIndex:p,target:e,originArgs:s,originParamType:E[p],instance:i.target})}catch(e){x=true;if((b===null||b===void 0?void 0:b.throwError)===true){throw e}else{v(`[core]: Parameter decorator throw error and use origin args, ${e.stack}`)}}if(x){continue}const T=[...this.parameterDecoratorPipes.get(n)||[],...(b===null||b===void 0?void 0:b.pipes)||[]];for(const e of T){let r;if("transform"in e){r=e["transform"].bind(e)}else if((0,g.isClass)(e)){const n=await this.applicationContext.getAsync(e);r=n.transform.bind(n)}else if(typeof e==="function"){r=e}else{throw new u.MidwayParameterError("Pipe must be a function or implement PipeTransform interface")}s[p]=await r(s[p],{metaType:(0,o.transformTypeFromTSDesign)(E[p]),metadata:c,target:i.target,methodName:i.methodName})}}i.args=s}})))}}}));this.applicationContext.onObjectCreated(((e,r)=>{if(this.propertyHandlerMap.size>0&&Array.isArray(r.definition.handlerProps)){for(const n of r.definition.handlerProps){this.defineGetterPropertyValue(n,e,this.getHandler(n.key))}}}));this.registerPropertyHandler(o.APPLICATION_CONTEXT_KEY,((e,r)=>this.applicationContext))}registerPropertyHandler(e,r){v(`[core]: Register property decorator key="${e}"`);this.propertyHandlerMap.set(e,r)}registerMethodHandler(e,r){v(`[core]: Register method decorator key="${e}"`);this.methodDecoratorMap.set(e,r)}registerParameterHandler(e,r){v(`[core]: Register parameter decorator key="${e}"`);this.parameterDecoratorMap.set(e,r)}registerParameterPipes(e,r){if(!this.parameterDecoratorPipes.has(e)){this.parameterDecoratorPipes.set(e,[])}this.parameterDecoratorPipes.set(e,this.parameterDecoratorPipes.get(e).concat(r))}defineGetterPropertyValue(e,r,n){if(e&&n){if(e.propertyName){Object.defineProperty(r,e.propertyName,{get:()=>{var i;return n(e.propertyName,(i=e.metadata)!==null&&i!==void 0?i:{},r)},configurable:true,enumerable:true})}}}getHandler(e){if(this.propertyHandlerMap.has(e)){return this.propertyHandlerMap.get(e)}}};i([(0,o.Inject)(),s("design:type",c.MidwayAspectService)],b.prototype,"aspectService",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],b.prototype,"init",null);b=i([(0,o.Provide)(),(0,o.Scope)(a.ScopeEnum.Singleton),s("design:paramtypes",[Object])],b);r.MidwayDecoratorService=b},14057:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.MidwayEnvironmentService=void 0;const s=n(87270);const o=n(86110);const a=n(8351);let c=class MidwayEnvironmentService{constructor(){this.moduleLoadType="commonjs"}getCurrentEnvironment(){if(!this.environment){this.environment=(0,o.getCurrentEnvironment)()}return this.environment}setCurrentEnvironment(e){this.environment=e}isDevelopmentEnvironment(){return(0,o.isDevelopmentEnvironment)(this.environment)}setModuleLoadType(e){this.moduleLoadType=e}getModuleLoadType(){return this.moduleLoadType}isPkgEnvironment(){return typeof process["pkg"]!=="undefined"}};c=i([(0,a.Provide)(),(0,a.Scope)(s.ScopeEnum.Singleton)],c);r.MidwayEnvironmentService=c},65338:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayFrameworkService=void 0;const o=n(8351);const a=n(87270);const c=n(73440);const u=n(70426);const p=n(31630);const g=n(720);const v=n(14625);const b=n(59550);const _=n(51926);const E=n(39023);const x=n(86248);const T=n(77404);const w=n(4334);const C=E.debuglog("midway:debug");let A=class MidwayFrameworkService{constructor(e,r){this.applicationContext=e;this.globalOptions=r;this.globalFrameworkList=[]}async init(){var e,r;this.decoratorService.registerPropertyHandler(o.CONFIG_KEY,((e,r)=>{var n;if(r.identifier===o.ALL){return this.configService.getConfiguration()}else{return this.configService.getConfiguration((n=r.identifier)!==null&&n!==void 0?n:e)}}));this.decoratorService.registerPropertyHandler(o.LOGGER_KEY,((e,r)=>{var n;return this.loggerService.getLogger((n=r.identifier)!==null&&n!==void 0?n:e)}));this.decoratorService.registerPropertyHandler(o.PIPELINE_IDENTIFIER,((e,r,n)=>{var i,s;return new g.MidwayPipelineService((s=(i=n[T.REQUEST_OBJ_CTX_KEY])===null||i===void 0?void 0:i.requestContext)!==null&&s!==void 0?s:this.applicationContext,r.valves)}));this.decoratorService.registerPropertyHandler(o.APPLICATION_KEY,((e,r)=>{if(r.type){const e=this.applicationManager.getApplication(r.type);if(!e){throw new x.MidwayCommonError(`Framework ${r.type} not Found`)}return e}else{return this.getMainApp()}}));this.decoratorService.registerPropertyHandler(o.PLUGIN_KEY,((e,r)=>{var n;return this.getMainApp()[(n=r.identifier)!==null&&n!==void 0?n:e]}));this.decoratorService.registerPropertyHandler(o.FACTORY_SERVICE_CLIENT_KEY,((e,r)=>{const n=this.applicationContext.get(r.serviceFactoryClz);const i=r.clientName||n.getDefaultClientName();if(i&&n.has(i)){return n.get(i)}else{if(!i){throw new x.MidwayParameterError(`Please set clientName or options.defaultClientName for ${r.serviceFactoryClz.name}).`)}else{throw new x.MidwayParameterError(`ClientName(${i} not found in ${r.serviceFactoryClz.name}).`)}}}));let n=(0,o.listModule)(o.FRAMEWORK_KEY);n=filterProtoFramework(n);C(`[core]: Found Framework length = ${n.length}`);if(n.length){for(const r of n){if(!this.applicationContext.hasDefinition((0,o.getProviderUUId)(r))){C(`[core]: Found Framework "${r.name}" but missing definition, skip initialize.`);continue}const n=await this.applicationContext.getAsync(r,[this.applicationContext]);if(n.isEnable()){w.MidwayInitializerPerformanceManager.frameworkInitializeStart(n.getFrameworkName());await n.initialize({applicationContext:this.applicationContext,namespace:n.getNamespace(),...this.globalOptions});w.MidwayInitializerPerformanceManager.frameworkInitializeEnd(n.getFrameworkName());C(`[core]: Found Framework "${n.getFrameworkName()}" and initialize.`)}else{C(`[core]: Found Framework "${n.getFrameworkName()}" and delay initialize.`)}const i=this.applicationContext.registry.getDefinition((0,o.getProviderUUId)(r));n.setNamespace(i===null||i===void 0?void 0:i.namespace);this.applicationManager.addFramework((e=i===null||i===void 0?void 0:i.namespace)!==null&&e!==void 0?e:n.getFrameworkName(),n);this.globalFrameworkList.push(n)}let i;const s=this.applicationContext.getNamespaceList();for(const e of s){const r=this.applicationManager.getApplication(e);if(r){i=e;break}}global["MIDWAY_MAIN_FRAMEWORK"]=this.mainFramework=(r=this.applicationManager.getFramework(i))!==null&&r!==void 0?r:this.globalFrameworkList[0];C(`[core]: Current main Framework is "${i}".`)}await this.aspectService.loadAspect()}getMainApp(){var e;return(e=this.mainFramework)===null||e===void 0?void 0:e.getApplication()}getMainFramework(){return this.mainFramework}getFramework(e){return this.applicationManager.getFramework(e)}async runFramework(){const e=this.applicationContext.getNamespaceList();this.globalFrameworkList=this.globalFrameworkList.sort(((r,n)=>e.indexOf(r.getNamespace())-e.indexOf(n.getNamespace())));for(const e of this.globalFrameworkList){if(e.isEnable()){w.MidwayInitializerPerformanceManager.frameworkRunStart(e.getFrameworkName());await e.run();C(`[core]: Found Framework "${e.getFrameworkName()}" and run.`);w.MidwayInitializerPerformanceManager.frameworkRunEnd(e.getFrameworkName())}}}async stopFramework(){await Promise.all(Array.from(this.globalFrameworkList).map((e=>e.stop())))}};i([(0,o.Inject)(),s("design:type",c.MidwayConfigService)],A.prototype,"configService",void 0);i([(0,o.Inject)(),s("design:type",u.MidwayLoggerService)],A.prototype,"loggerService",void 0);i([(0,o.Inject)(),s("design:type",b.MidwayAspectService)],A.prototype,"aspectService",void 0);i([(0,o.Inject)(),s("design:type",v.MidwayDecoratorService)],A.prototype,"decoratorService",void 0);i([(0,o.Inject)(),s("design:type",_.MidwayApplicationManager)],A.prototype,"applicationManager",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],A.prototype,"init",null);A=i([(0,o.Provide)(),(0,o.Scope)(a.ScopeEnum.Singleton),s("design:paramtypes",[Object,Object])],A);r.MidwayFrameworkService=A;function filterProtoFramework(e){const r=[];for(const n of e){let e=Object.getPrototypeOf(n);while(e.name&&e.name!==p.BaseFramework.name){r.push(e);e=Object.getPrototypeOf(e)}}return e.filter((e=>!r.includes(e)))}},34292:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayHealthService=void 0;const o=n(8351);const a=n(87270);const c=n(73440);const u=n(86110);let p=class MidwayHealthService{constructor(){this.healthCheckTimeout=1e3;this.healthCheckMethods=[]}async init(e){const r=this.configService.getConfiguration("core.healthCheckTimeout")||1e3;this.setCheckTimeout(r);for(const r of e){if(r.instance&&r.instance["onHealthCheck"]){this.healthCheckMethods.push({item:r.instance["onHealthCheck"].bind(r.instance),meta:{namespace:r.namespace}})}}}async getStatus(){const e=await(0,u.createPromiseTimeoutInvokeChain)({promiseItems:this.healthCheckMethods.map((e=>({item:e.item(this.applicationContext),meta:e.meta}))),timeout:this.healthCheckTimeout,methodName:"configuration.onHealthCheck",onSuccess:(e,r)=>{if(e["status"]!==undefined){return{namespace:r.namespace,...e}}else{return{status:false,namespace:r.namespace,reason:"configuration.onHealthCheck return value must be object and contain status field"}}},onFail:(e,r)=>({status:false,namespace:r.namespace,reason:e.message})});const r=e.find((e=>!e.status));return{status:!r,namespace:r===null||r===void 0?void 0:r.namespace,reason:r===null||r===void 0?void 0:r.reason,results:e}}setCheckTimeout(e){this.healthCheckTimeout=e}};i([(0,o.Inject)(),s("design:type",c.MidwayConfigService)],p.prototype,"configService",void 0);i([(0,o.ApplicationContext)(),s("design:type",Object)],p.prototype,"applicationContext",void 0);p=i([(0,o.Provide)(),(0,o.Scope)(a.ScopeEnum.Singleton)],p);r.MidwayHealthService=p},41560:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayInformationService=void 0;const o=n(87270);const a=n(86110);const c=n(16928);const u=n(8351);const p=n(79896);let g=class MidwayInformationService{init(){if(this.baseDir){if(!this.appDir){this.appDir=(0,c.dirname)(this.baseDir)}const e=(0,c.join)(this.appDir,"package.json");if((0,p.existsSync)(e)){const r=(0,p.readFileSync)(e,{encoding:"utf-8"});this.pkg=JSON.parse(r)}else{this.pkg={}}}else{this.pkg={}}}getAppDir(){return this.appDir}getBaseDir(){return this.baseDir}getHome(){return(0,a.getUserHome)()}getPkg(){return this.pkg}getProjectName(){var e;return((e=this.pkg)===null||e===void 0?void 0:e["name"])||""}getRoot(){const e=(0,a.isDevelopmentEnvironment)((0,a.getCurrentEnvironment)());return e?this.getAppDir():this.getHome()}};i([(0,u.Inject)(),s("design:type",String)],g.prototype,"appDir",void 0);i([(0,u.Inject)(),s("design:type",String)],g.prototype,"baseDir",void 0);i([(0,u.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],g.prototype,"init",null);g=i([(0,u.Provide)(),(0,u.Scope)(o.ScopeEnum.Singleton)],g);r.MidwayInformationService=g},1026:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayLifeCycleService=void 0;const o=n(87270);const a=n(8351);const c=n(65061);const u=n(65338);const p=n(73440);const g=n(39023);const v=n(67072);const b=n(34292);const _=n(4334);const E=(0,g.debuglog)("midway:debug");let x=class MidwayLifeCycleService{constructor(e){this.applicationContext=e;this.lifecycleInstanceList=[]}async init(){await this.mockService.initSimulation();const e=(0,a.listModule)(a.CONFIGURATION_KEY);E(`[core]: Found Configuration length = ${e.length}`);for(const r of e){if(r.target instanceof c.FunctionalConfiguration){r.instance=r.target}else{E(`[core]: Lifecycle run ${r.namespace} init`);r.instance=await this.applicationContext.getAsync(r.target)}r.instance&&this.lifecycleInstanceList.push(r)}await this.healthService.init(this.lifecycleInstanceList);await Promise.all([this.runObjectLifeCycle(this.lifecycleInstanceList,"onBeforeObjectCreated"),this.runObjectLifeCycle(this.lifecycleInstanceList,"onObjectCreated"),this.runObjectLifeCycle(this.lifecycleInstanceList,"onObjectInit"),this.runObjectLifeCycle(this.lifecycleInstanceList,"onBeforeObjectDestroy")]);await this.runContainerLifeCycle(this.lifecycleInstanceList,"onConfigLoad",(e=>{if(e){this.configService.addObject(e)}}));await this.mockService.runSimulatorSetup();await this.runContainerLifeCycle(this.lifecycleInstanceList,"onReady");await this.frameworkService.runFramework();await this.runContainerLifeCycle(this.lifecycleInstanceList,"onServerReady");if(!this.configService.getConfiguration("debug.recordConfigMergeOrder")){this.configService.clearConfigMergeOrder()}}async stop(){await this.mockService.runSimulatorTearDown();const e=(0,a.listModule)(a.CONFIGURATION_KEY)||[];for(const r of e.reverse()){let e;if(r.target instanceof c.FunctionalConfiguration){e=r.target}else{e=await this.applicationContext.getAsync(r.target)}await this.runContainerLifeCycle(e,"onStop")}await this.frameworkService.stopFramework()}async runContainerLifeCycle(e,r,n){if(Array.isArray(e)){for(const i of e){if(typeof i.instance[r]==="function"){E(`[core]: Lifecycle run ${i.instance.constructor.name} ${r}`);_.MidwayInitializerPerformanceManager.lifecycleStart(i.namespace,r);const e=await i.instance[r](this.applicationContext,this.frameworkService.getMainApp());if(n){n(e)}_.MidwayInitializerPerformanceManager.lifecycleEnd(i.namespace,r)}}}else{if(typeof e[r]==="function"){const i=e.constructor.name;E(`[core]: Lifecycle run ${i} ${r}`);_.MidwayInitializerPerformanceManager.lifecycleStart(i,r);const s=await e[r](this.applicationContext,this.frameworkService.getMainApp());if(n){n(s)}_.MidwayInitializerPerformanceManager.lifecycleEnd(i,r)}}}async runObjectLifeCycle(e,r){for(const n of e){if(typeof n.instance[r]==="function"){E(`[core]: Lifecycle run ${n.instance.constructor.name} ${r}`);return await this.applicationContext[r](n.instance[r].bind(n.instance))}}}getLifecycleInstanceList(){return this.lifecycleInstanceList}};i([(0,a.Inject)(),s("design:type",u.MidwayFrameworkService)],x.prototype,"frameworkService",void 0);i([(0,a.Inject)(),s("design:type",p.MidwayConfigService)],x.prototype,"configService",void 0);i([(0,a.Inject)(),s("design:type",v.MidwayMockService)],x.prototype,"mockService",void 0);i([(0,a.Inject)(),s("design:type",b.MidwayHealthService)],x.prototype,"healthService",void 0);i([(0,a.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],x.prototype,"init",null);x=i([(0,a.Provide)(),(0,a.Scope)(o.ScopeEnum.Singleton),s("design:paramtypes",[Object])],x);r.MidwayLifeCycleService=x},70426:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayLoggerService=void 0;const o=n(8351);const a=n(73440);const c=n(37940);const u=n(87270);const p=n(94853);const g=n(86248);let v=class MidwayLoggerService extends c.ServiceFactory{constructor(e,r={}){super();this.applicationContext=e;this.globalOptions=r;this.lazyLoggerConfigMap=new Map;this.aliasLoggerMap=new Map}init(){var e;const r=this.configService.getConfiguration("loggerFactory");this.loggerFactory=r||this.globalOptions["loggerFactory"]||new p.DefaultConsoleLoggerFactory;if(!this.loggerFactory.getDefaultMidwayLoggerConfig){throw new g.MidwayFeatureNoLongerSupportedError("please upgrade your @midwayjs/logger to latest version")}const n=this.loggerFactory.getDefaultMidwayLoggerConfig(this.configService.getAppInfo());this.configService.addObject(n,true);this.initClients(this.configService.getConfiguration("midwayLogger"));(e=this.applicationContext)===null||e===void 0?void 0:e.registerObject("logger",this.getLogger("appLogger"))}createClient(e,r){if(e.aliasName){this.aliasLoggerMap.set(e.aliasName,r)}if(!e.lazyLoad){this.loggerFactory.createLogger(r,e)}else{delete e["lazyLoad"];this.lazyLoggerConfigMap.set(r,e)}}getName(){return"logger"}createLogger(e,r){delete r["aliasName"];return this.loggerFactory.createLogger(e,r)}getLogger(e){if(this.aliasLoggerMap.has(e)){e=this.aliasLoggerMap.get(e)}const r=this.loggerFactory.getLogger(e);if(r){return r}if(this.lazyLoggerConfigMap.has(e)){this.createClient(this.lazyLoggerConfigMap.get(e),e);this.lazyLoggerConfigMap.delete(e)}return this.loggerFactory.getLogger(e)}getCurrentLoggerFactory(){return this.loggerFactory}createContextLogger(e,r,n){return this.loggerFactory.createContextLogger(e,r,n)}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}};i([(0,o.Inject)(),s("design:type",a.MidwayConfigService)],v.prototype,"configService",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],v.prototype,"init",null);v=i([(0,o.Provide)(),(0,o.Scope)(u.ScopeEnum.Singleton),s("design:paramtypes",[Object,Object])],v);r.MidwayLoggerService=v},66134:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayMiddlewareService=void 0;const o=n(8351);const a=n(87270);const c=n(86248);const u=n(86110);const p=n(73171);const g=n(39023);const v=(0,g.debuglog)("midway:debug");let b=class MidwayMiddlewareService{constructor(e){this.applicationContext=e}async compose(e,r,n){var i;if(!Array.isArray(e)){throw new c.MidwayParameterError("Middleware stack must be an array")}const s=[];for(let n of e){if(p.Types.isClass(n)||typeof n==="string"||(n===null||n===void 0?void 0:n["middleware"])){let e=(i=n===null||n===void 0?void 0:n["middleware"])!==null&&i!==void 0?i:n;const o=n===null||n===void 0?void 0:n["options"];let a=n===null||n===void 0?void 0:n["name"];if(typeof e==="string"&&!this.applicationContext.hasDefinition(e)){throw new c.MidwayCommonError(`Middleware definition of "${e}" not found in midway container`)}const p=await this.applicationContext.getAsync(e);if(p){a=a!==null&&a!==void 0?a:p.constructor.name;e=await p.resolve(r,o);if(!e){continue}if(!p.match&&!p.ignore){if(!e.name){e._name=a}s.push(e)}else{const r=(0,u.pathMatching)({match:p.match,ignore:p.ignore,thisResolver:p});n=(n,i,s)=>{if(!r(n))return i();return e(n,i,s)};n._name=a;s.push(n)}}else{throw new c.MidwayCommonError("Middleware must have resolve method!")}}else{s.push(n)}}const composeFn=(e,r)=>{const i=(0,u.isIncludeProperty)(e,"body");let o=-1;return dispatch(0);function dispatch(a){if(a<=o)return Promise.reject(new c.MidwayCommonError("next() called multiple times"));o=a;let u=s[a];if(a===s.length)u=r;if(!u)return Promise.resolve();const p=`${n?`${n}.`:""}${o} ${u._name||u.name||"anonymous"}`;const g=Date.now();v(`[middleware]: in ${p} +0`);try{if(i){return Promise.resolve(u(e,dispatch.bind(null,a+1),{index:o})).then((r=>{if(r!==undefined){e["body"]=r}else if(e["body"]!==undefined){r=e["body"]}v(`[middleware]: out ${p} +${Date.now()-g} with body`);return r}))}else{return Promise.resolve(u(e,dispatch.bind(null,a+1),{index:o})).then((e=>{v(`[middleware]: out ${p} +${Date.now()-g}`);return e}))}}catch(e){v(`[middleware]: out ${p} +${Date.now()-g} with err ${e.message}`);return Promise.reject(e)}}};if(n){composeFn._name=n}return composeFn}};b=i([(0,o.Provide)(),(0,o.Scope)(a.ScopeEnum.Singleton),s("design:paramtypes",[Object])],b);r.MidwayMiddlewareService=b},67072:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};var o;Object.defineProperty(r,"__esModule",{value:true});r.MidwayMockService=void 0;const a=n(87270);const c=n(8351);const u=n(73171);let p=o=class MidwayMockService{constructor(e){this.applicationContext=e;this.mocks=new Map;this.contextMocks=new Map;this.cache=new Map;this.simulatorList=[]}async init(){if(o.prepareMocks.length>0){for(const e of o.prepareMocks){this.mockProperty(e.obj,e.key,e.value,e.group)}o.prepareMocks=[]}}static mockClassProperty(e,r,n,i="default"){this.mockProperty(e.prototype,r,n,i)}static mockProperty(e,r,n,i="default"){this.prepareMocks.push({obj:e,key:r,value:n,group:i})}mockClassProperty(e,r,n,i="default"){return this.mockProperty(e.prototype,r,n,i)}mockProperty(e,r,n,i="default"){const s=e.hasOwnProperty(r);const o={obj:e,key:r,descriptor:Object.getOwnPropertyDescriptor(e,r),hasOwnProperty:s};if(!this.mocks.has(i)){this.mocks.set(i,[])}this.mocks.get(i).push(o);if(s){delete e[r]}let a=this.cache.get(i);if(!a){a=new Map;this.cache.set(i,a)}let c=a.get(e);if(!c){c=new Set;a.set(e,c)}c.add(r);const u=this.overridePropertyDescriptor(n);Object.defineProperty(e,r,u)}mockContext(e,r,n,i="default"){if(!this.contextMocks.has(i)){this.contextMocks.set(i,[])}this.contextMocks.get(i).push({app:e,key:r,value:n})}restore(e="default"){this.restoreGroup(e)}restoreAll(){const e=new Set([...this.mocks.keys(),...this.contextMocks.keys(),...this.cache.keys()]);for(const r of e){this.restoreGroup(r)}this.simulatorList=[]}restoreGroup(e){const r=this.mocks.get(e)||[];for(let e=r.length-1;e>=0;e--){const n=r[e];if(!n.hasOwnProperty){delete n.obj[n.key]}else{Object.defineProperty(n.obj,n.key,n.descriptor)}}this.mocks.delete(e);this.contextMocks.delete(e);this.cache.delete(e);this.simulatorList=this.simulatorList.filter((r=>r["group"]!==e))}isMocked(e,r,n="default"){if((0,u.isClass)(e)){e=e.prototype}const i=this.cache.get(n);const s=i?i.get(e):undefined;return s?s.has(r):false}applyContextMocks(e,r){for(const[,n]of this.contextMocks){for(const i of n){if(i.app===e){const e=this.overridePropertyDescriptor(i.value);if(typeof i.key==="string"){Object.defineProperty(r,i.key,e)}else{i.key(r)}}}}}getContextMocksSize(){return Array.from(this.contextMocks.values()).reduce(((e,r)=>e+r.length),0)}overridePropertyDescriptor(e){const r={configurable:true,enumerable:true};if(e&&(e.get||e.set)){r.get=e.get;r.set=e.set}else{r.value=e;r.writable=true}return r}async initSimulation(e="default"){const r=(0,c.listModule)(c.MOCK_KEY);for(const n of r){const r=await this.applicationContext.getAsync(n);if(await r.enableCondition()){r["group"]=e;this.simulatorList.push(r)}}}async runSimulatorSetup(){var e;for(const r of this.simulatorList){await((e=r.setup)===null||e===void 0?void 0:e.call(r))}}async runSimulatorTearDown(){var e;for(let r=this.simulatorList.length-1;r>=0;r--){const n=this.simulatorList[r];await((e=n.tearDown)===null||e===void 0?void 0:e.call(n))}}async runSimulatorAppSetup(e){var r;for(const n of this.simulatorList){await((r=n.appSetup)===null||r===void 0?void 0:r.call(n,e))}}async runSimulatorAppTearDown(e){var r;for(let n=this.simulatorList.length-1;n>=0;n--){const i=this.simulatorList[n];await((r=i.appTearDown)===null||r===void 0?void 0:r.call(i,e))}}async runSimulatorContextSetup(e,r){var n;for(const i of this.simulatorList){await((n=i.contextSetup)===null||n===void 0?void 0:n.call(i,e,r))}}async runSimulatorContextTearDown(e,r){var n;for(let i=this.simulatorList.length-1;i>=0;i--){const s=this.simulatorList[i];await((n=s===null||s===void 0?void 0:s.contextTearDown)===null||n===void 0?void 0:n.call(s,e,r))}}};p.prepareMocks=[];i([(0,c.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],p.prototype,"init",null);i([(0,c.Destroy)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],p.prototype,"restoreAll",null);p=o=i([(0,c.Provide)(),(0,c.Scope)(a.ScopeEnum.Singleton),s("design:paramtypes",[Object])],p);r.MidwayMockService=p},720:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayPipelineService=r.PipelineContext=void 0;const i=n(8351);class PipelineContext{constructor(e){this.info={current:null,currentName:null};this.data=new Map;this.args=e}get(e){return this.data.get(e)}set(e,r){this.data.set(e,r)}keys(){const e=[];const r=this.data.keys();for(const n of r){e.push(n)}return e}}r.PipelineContext=PipelineContext;class MidwayPipelineService{constructor(e,r){this.applicationContext=e;this.valves=r}async parallel(e){const r=this.prepareParallelValves(e);const n=await Promise.all(r);return this.packResult(n,false)}async concat(e){const r=this.prepareParallelValves(e);const n=await Promise.all(r);return this.packResult(n,true)}async series(e){const r=this.mergeValves(e.valves);const n=new PipelineContext(e.args);const i={success:true,result:null};const s={};const o={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let a=1;for(const e of r){o.prev=o.current;o.prevName=getName(o.prev);o.current=e;o.currentName=getName(o.current);if(a<r.length){o.next=r[a];o.nextName=getName(o.next)}else{o.next=undefined;o.nextName=undefined}a+=1;n.info=o;try{const r=await this.applicationContext.getAsync(e);const i=await r.invoke(n);let a=e;if(r.alias){a=r.alias}s[a]=i;o.prevValue=i}catch(r){i.success=false;i.error={valveName:typeof e==="string"?e:e.name,message:r.message,error:r};return i}}i.result=s;return i}async concatSeries(e){const r=this.mergeValves(e.valves);const n=new PipelineContext(e.args);const i={success:true,result:null};const s=[];const o={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let a=1;for(const e of r){o.prev=o.current;o.prevName=getName(o.prev);o.current=e;o.currentName=getName(o.current);if(a<r.length){o.next=r[a];o.nextName=getName(o.next)}else{o.next=undefined;o.nextName=undefined}a+=1;n.info=o;try{const r=await this.applicationContext.getAsync(e);const i=await r.invoke(n);s.push(i);o.prevValue=i}catch(r){i.success=false;i.error={valveName:typeof e==="string"?e:e.name,message:r.message,error:r};return i}}i.result=s;return i}async waterfall(e){const r=await this.concatSeries(e);if(r.success){const e=r.result;r.result=e[e.length-1]}return r}mergeValves(e){let r=[];if(this.valves&&this.valves.length>0){r=this.valves}let n=[];if(e){for(const i of e){if(r.includes(i)){n.push(i)}}}else{n=r}return n}prepareParallelValves(e){const r=this.mergeValves(e.valves);const n=new PipelineContext(e.args);return r.map((async e=>{const r={valveName:e,dataKey:e,data:null};try{const i=await this.applicationContext.getAsync(e);if(i.alias){r.dataKey=i.alias}r.data=await i.invoke(n)}catch(e){r.error=e}return r}))}packResult(e,r=false){const n={success:true,result:null};let i;if(r){i=[]}else{i={}}for(const s of e){if(s.error){n.success=false;n.error={valveName:typeof s.valveName==="string"?s.valveName:s.valveName.name,message:s.error.message,error:s.error};return n}else{if(r){i.push(s.data)}else{i[s.dataKey]=s.data}}}n.result=i;return n}}r.MidwayPipelineService=MidwayPipelineService;function getName(e){if(e){if(typeof e==="string"){return e}else{return(0,i.getProviderName)(e)}}return null}},42986:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.WebRouterCollector=r.MidwayServerlessFunctionService=void 0;const o=n(8351);const a=n(64259);const c=n(12922);const u=n(11207);const p=n(7269);const g=n(87270);let v=class MidwayServerlessFunctionService extends a.MidwayWebRouterService{constructor(e={}){super(Object.assign({},e,{includeFunctionRouter:true}));this.options=e}async analyze(){this.analyzeController();this.analyzeFunction();this.sortPrefixAndRouter();for(const e of this.routes.values()){for(const r of e){if(r.requestMethod==="all"){r.functionTriggerMetadata=r.functionTriggerMetadata||{};r.functionTriggerMetadata.method=["get","post","put","delete","head","patch","options"]}}}}analyzeFunction(){const e=(0,o.listModule)(o.FUNC_KEY);for(const r of e){this.collectFunctionRoute(r)}}collectFunctionRoute(e){var r,n,i,s,a,c,u,p,g,v,b,_,E,x,T,w,C;const A=(0,o.getClassMetadata)(o.FUNC_KEY,e);const k=(0,o.getProviderName)(e);const P=(0,o.getProviderUUId)(e);const I="/";if(!this.routes.has(I)){this.routes.set(I,[]);this.routesPriority.push({prefix:I,priority:-999,middleware:[],routerOptions:{},controllerId:k,routerModule:e})}for(const R of A){if((r=R["metadata"])===null||r===void 0?void 0:r["path"]){const r=(0,o.getPropertyDataFromClass)(o.WEB_ROUTER_PARAM_KEY,e,R["methodName"])||[];const b=(0,o.getPropertyMetadata)(o.WEB_RESPONSE_KEY,e,R["methodName"])||[];const _={id:P,prefix:I,routerName:"",url:R["metadata"]["path"],requestMethod:(i=(n=R["metadata"])===null||n===void 0?void 0:n["method"])!==null&&i!==void 0?i:"get",method:R["methodName"],description:"",summary:"",handlerName:`${k}.${R["methodName"]}`,funcHandlerName:`${k}.${R["methodName"]}`,controllerId:k,middleware:((s=R["metadata"])===null||s===void 0?void 0:s["middleware"])||[],controllerMiddleware:[],requestMetadata:r,responseMetadata:b};const E=(0,o.getPropertyMetadata)(o.SERVERLESS_FUNC_KEY,e,R["methodName"])||{};const x=(u=(a=E["functionName"])!==null&&a!==void 0?a:(c=R===null||R===void 0?void 0:R["metadata"])===null||c===void 0?void 0:c["functionName"])!==null&&u!==void 0?u:createFunctionName(e,R["methodName"]);const T=(v=(p=E["handlerName"])!==null&&p!==void 0?p:(g=R===null||R===void 0?void 0:R["metadata"])===null||g===void 0?void 0:g["handlerName"])!==null&&v!==void 0?v:_.funcHandlerName;_.functionName=x;_.funcHandlerName=T;_.functionTriggerName=R["type"];_.functionTriggerMetadata=R["metadata"];_.functionMetadata={functionName:x,...E};this.checkDuplicateAndPush(I,_)}else{const r=(0,o.getPropertyMetadata)(o.SERVERLESS_FUNC_KEY,e,R["methodName"])||{};const n=(E=(b=r["functionName"])!==null&&b!==void 0?b:(_=R===null||R===void 0?void 0:R["metadata"])===null||_===void 0?void 0:_["functionName"])!==null&&E!==void 0?E:createFunctionName(e,R["methodName"]);const i=(w=(x=r["handlerName"])!==null&&x!==void 0?x:(T=R===null||R===void 0?void 0:R["metadata"])===null||T===void 0?void 0:T["handlerName"])!==null&&w!==void 0?w:`${k}.${R["methodName"]}`;this.checkDuplicateAndPush(I,{id:P,prefix:I,routerName:"",url:"",requestMethod:"",method:R["methodName"],description:"",summary:"",handlerName:`${k}.${R["methodName"]}`,funcHandlerName:i,controllerId:k,middleware:((C=R["metadata"])===null||C===void 0?void 0:C["middleware"])||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:n,functionTriggerName:R["type"],functionTriggerMetadata:R["metadata"],functionMetadata:{functionName:n,...r}})}}}async getFunctionList(){return this.getFlattenRouterTable({compileUrlPattern:true})}addServerlessFunction(e,r,n={}){var i,s;const o="";if(!this.routes.has(o)){this.routes.set(o,[]);this.routesPriority.push({prefix:o,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}const a=(i=r.functionName)!==null&&i!==void 0?i:n.functionName;this.checkDuplicateAndPush(o,{id:null,method:e,url:r.metadata["path"]||"",requestMethod:r.metadata["method"]||"",description:"",summary:"",handlerName:"",funcHandlerName:r.handlerName||n.handlerName,controllerId:"",middleware:((s=r.metadata)===null||s===void 0?void 0:s.middleware)||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:a,functionTriggerName:r.metadata.name,functionTriggerMetadata:r.metadata,functionMetadata:{functionName:a,...n}})}};v=i([(0,o.Provide)(),(0,o.Scope)(g.ScopeEnum.Singleton),s("design:paramtypes",[Object])],v);r.MidwayServerlessFunctionService=v;function createFunctionName(e,r){return(0,o.getProviderName)(e).replace(/[:#]/g,"-")+"-"+r}class WebRouterCollector{constructor(e="",r={}){this.baseDir=e;this.options=r}async init(){if(!this.proxy){if(this.baseDir){const e=new c.MidwayContainer;(0,o.bindContainer)(e);e.setFileDetector(new u.CommonJSFileDetector({loadDir:this.baseDir}));await e.ready()}if(this.options.includeFunctionRouter){if((0,p.getCurrentMainFramework)()){this.proxy=await(0,p.getCurrentMainFramework)().getApplicationContext().getAsync(v,[this.options])}else{this.proxy=new v(this.options)}}else{if((0,p.getCurrentMainFramework)()){this.proxy=await(0,p.getCurrentMainFramework)().getApplicationContext().getAsync(a.MidwayWebRouterService,[this.options])}else{this.proxy=new a.MidwayWebRouterService(this.options)}}}}async getRoutePriorityList(){await this.init();return this.proxy.getRoutePriorityList()}async getRouterTable(){await this.init();return this.proxy.getRouterTable()}async getFlattenRouterTable(){await this.init();return this.proxy.getFlattenRouterTable()}}r.WebRouterCollector=WebRouterCollector},64259:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayWebRouterService=void 0;const o=n(8351);const a=n(86110);const c=n(86248);const u=n(39023);const p=n(66027);const g=n(73171);const v=n(87270);const b=u.debuglog("midway:debug");let _=class MidwayWebRouterService{constructor(e={}){this.options=e;this.isReady=false;this.routes=new Map;this.routesPriority=[]}async analyze(){this.analyzeController();this.sortPrefixAndRouter()}analyzeController(){const e=(0,o.listModule)(o.CONTROLLER_KEY);for(const r of e){const e=(0,o.getClassMetadata)(o.CONTROLLER_KEY,r);this.addController(r,e,this.options.includeFunctionRouter)}}sortPrefixAndRouter(){this.routesPriority=this.routesPriority.filter((e=>{const r=this.routes.get(e.prefix);if(r.length>0){return true}else{this.routes.delete(e.prefix);return false}}));for(const e of this.routes.keys()){const r=this.routes.get(e);this.routes.set(e,this.sortRouter(r))}this.routesPriority=this.routesPriority.sort(((e,r)=>r.prefix.length-e.prefix.length))}addController(e,r,n={},i=false){var s;if(n&&typeof n==="boolean"){i=n;n=undefined}if(!n){n={}}const u=(0,o.getProviderName)(e);b(`[core]: Found Controller ${u}.`);const p=(0,o.getProviderUUId)(e);r.routerOptions=r.routerOptions||{};let g;const _=r.routerOptions.middleware;const E=!!((s=r.routerOptions)===null||s===void 0?void 0:s.ignoreGlobalPrefix);let x=(0,a.joinURLPath)(this.options.globalPrefix,r.prefix||"/");const T=r.prefix||"/";if(E){x=T}if(/\*/.test(x)){throw new c.MidwayCommonError(`Router prefix ${x} can't set string with *`)}if(!this.routes.has(x)){this.routes.set(x,[]);this.routesPriority.push({prefix:x,priority:x==="/"&&g===undefined?-999:0,middleware:_,routerOptions:r.routerOptions,controllerId:u,routerModule:e})}else{if(_&&_.length>0){const e=this.routesPriority.filter((e=>e.prefix===x))[0];throw new c.MidwayDuplicateControllerOptionsError(x,u,e.controllerId)}}if(!this.routes.has(T)){this.routes.set(T,[]);this.routesPriority.push({prefix:T,priority:T==="/"&&g===undefined?-999:0,middleware:_,routerOptions:r.routerOptions,controllerId:u,routerModule:e})}const w=(0,o.getClassMetadata)(o.WEB_ROUTER_KEY,e);if(w&&typeof w[Symbol.iterator]==="function"){for(const r of w){const s=(0,o.getPropertyDataFromClass)(o.WEB_ROUTER_PARAM_KEY,e,r.method)||[];const c=(0,o.getPropertyMetadata)(o.WEB_RESPONSE_KEY,e,r.method)||[];const g={id:p,prefix:r.ignoreGlobalPrefix?T:x,routerName:r.routerName||"",url:r.path,requestMethod:r.requestMethod,method:r.method,description:r.description||"",summary:r.summary||"",handlerName:`${u}.${r.method}`,funcHandlerName:`${u}.${r.method}`,controllerId:u,controllerClz:e,middleware:r.middleware||[],controllerMiddleware:_||[],requestMetadata:s,responseMetadata:c};if(i){g.functionName=u+"-"+r.method;g.functionTriggerName=v.ServerlessTriggerType.HTTP;g.functionTriggerMetadata={path:(0,a.joinURLPath)(x,r.path.toString()),method:r.requestMethod};g.functionMetadata={functionName:g.functionName}}if(n.resourceFilter&&!n.resourceFilter(g)){continue}this.checkDuplicateAndPush(g.prefix,g)}}}addRouter(e,r){const n=r.prefix||"";r.requestMethod=(r.requestMethod||"GET").toUpperCase();if(!this.routes.has(n)){this.routes.set(n,[]);this.routesPriority.push({prefix:n,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}this.checkDuplicateAndPush(n,Object.assign(r,{method:e}));this.sortPrefixAndRouter()}sortRouter(e){return e.map((e=>{const r=e.url.toString();const n=g.Types.isRegExp(e.url)?r.split("\\/"):r.split("/");let i=0;for(const e of n){if(e===""||e.includes(":")||e.includes("*")){i+=0}else{i+=1}}let s=2;const o=r.includes(":")?r.replace(/:.+$/,""):"";if(o){s=1}if(r.includes("*")){s=0}return{...e,_pureRouter:r.replace(/\**$/,"").replace(/:\w+/,"123"),_level:r.split("/").length-1,_paramString:o,_category:s,_weight:i}})).sort(((e,r)=>{if(e._category!==r._category){return r._category-e._category}if(e._weight!==r._weight){return r._weight-e._weight}if(e._level===r._level){if(r._pureRouter===e._pureRouter){return e.url.toString().length-r.url.toString().length}return r._pureRouter.length-e._pureRouter.length}return r._level-e._level}))}async getRoutePriorityList(){if(!this.isReady){await this.analyze();this.isReady=true}return this.routesPriority}async getRouterTable(){if(!this.isReady){await this.analyze();this.isReady=true}return this.routes}async getFlattenRouterTable(e={}){if(!this.isReady){await this.analyze();this.isReady=true}let r=[];for(const e of this.routesPriority){r=r.concat(this.routes.get(e.prefix))}if(e.compileUrlPattern){for(const e of r){if(e.fullUrlFlattenString){e.fullUrlCompiledRegexp=p.PathToRegexpUtil.toRegexp(e.fullUrlFlattenString)}}}return r}async getMatchedRouterInfo(e,r){const n=await this.getFlattenRouterTable({compileUrlPattern:true});let i;for(const s of n){if(s.fullUrlCompiledRegexp){const n=s["requestMethod"].toUpperCase();if(("ALL"===n||r.toUpperCase()===n)&&s.fullUrlCompiledRegexp.test(e)){i=s;break}}}return i}checkDuplicateAndPush(e,r){const n=this.routes.get(e);const i=n.filter((e=>r.url&&r.requestMethod&&e.url===r.url&&e.requestMethod===r.requestMethod));if(i&&i.length){throw new c.MidwayDuplicateRouteError(`${r.requestMethod} ${r.url}`,`${i[0].handlerName}`,`${r.handlerName}`)}if(!r.fullUrlFlattenString&&r.url&&typeof r.url==="string"){r.fullUrl=(0,a.joinURLPath)(e,r.url);if(/\*$/.test(r.fullUrl)){r.fullUrlFlattenString=r.fullUrl.replace("*","(.*)")}else{r.fullUrlFlattenString=r.fullUrl}}n.push(r)}};_=i([(0,o.Provide)(),(0,o.Scope)(v.ScopeEnum.Singleton),s("design:paramtypes",[Object])],_);r.MidwayWebRouterService=_},33216:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.prepareGlobalApplicationContext=r.prepareGlobalApplicationContextAsync=r.destroyGlobalApplicationContext=r.initializeGlobalApplicationContext=void 0;const i=n(45573);const s=n(49211);const o=n(8351);const a=n(39023);const c=n(42986);const u=n(16928);const p=n(34292);const g=n(4334);const v=a.debuglog("midway:debug");let b=1;function printStepDebugInfo(e){v(`\n\nStep ${b++}: ${e}\n`)}async function initializeGlobalApplicationContext(e){g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);const r=await prepareGlobalApplicationContextAsync(e);printStepDebugInfo("Init logger");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);const n=await r.getAsync(i.MidwayLoggerService,[r,e]);if(n.getLogger("appLogger")){r.registerObject("logger",n.getLogger("appLogger"))}g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);printStepDebugInfo("Init MidwayMockService");await r.getAsync(i.MidwayMockService,[r]);printStepDebugInfo("Init framework");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);await r.getAsync(i.MidwayFrameworkService,[r,e]);g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);printStepDebugInfo("Init lifecycle");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);await r.getAsync(i.MidwayLifeCycleService,[r]);g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);printStepDebugInfo("Init preload modules");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);const s=(0,o.listPreloadModule)();for(const e of s){await r.getAsync(e)}g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);printStepDebugInfo("End of initialize and start");g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);return r}r.initializeGlobalApplicationContext=initializeGlobalApplicationContext;async function destroyGlobalApplicationContext(e){const r=await e.getAsync(i.MidwayLoggerService);const n=r.getCurrentLoggerFactory();const s=await e.getAsync(i.MidwayLifeCycleService);await s.stop();await e.stop();(0,o.clearBindContainer)();n.close();g.MidwayPerformanceManager.cleanAll();global["MIDWAY_APPLICATION_CONTEXT"]=undefined;global["MIDWAY_MAIN_FRAMEWORK"]=undefined}r.destroyGlobalApplicationContext=destroyGlobalApplicationContext;async function prepareGlobalApplicationContextAsync(e){var r,n,b,_,E;printStepDebugInfo("Ready to create applicationContext");v('[core]: start "initializeGlobalApplicationContext"');v(`[core]: bootstrap options = ${a.inspect(e)}`);const x=(r=e.appDir)!==null&&r!==void 0?r:"";const T=(n=e.baseDir)!==null&&n!==void 0?n:"";g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const w=(b=e.applicationContext)!==null&&b!==void 0?b:new i.MidwayContainer;v("[core]: delegate module map from decoratorManager");(0,o.bindContainer)(w);global["MIDWAY_APPLICATION_CONTEXT"]=w;w.registerObject("baseDir",T);w.registerObject("appDir",x);g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);v("[core]: set default file detector");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Ready module detector");if(!e.moduleLoadType){e.moduleLoadType="commonjs"}if(e.moduleDetector!==false){v("[core]: set module load type = %s",e.moduleLoadType);if(!e.imports){e.imports=[await(0,i.loadModule)((0,u.join)(T,`configuration${(0,i.isTypeScriptEnvironment)()?".ts":".js"}`),{loadMode:e.moduleLoadType,safeLoad:true})]}if(e.moduleDetector===undefined){if(e.moduleLoadType==="esm"){w.setFileDetector(new i.ESModuleFileDetector({loadDir:T,ignore:(_=e.ignore)!==null&&_!==void 0?_:[]}));e.moduleLoadType="esm"}else{w.setFileDetector(new i.CommonJSFileDetector({loadDir:T,ignore:(E=e.ignore)!==null&&E!==void 0?E:[]}))}}}g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");w.bindClass(i.MidwayEnvironmentService);w.bindClass(i.MidwayInformationService);w.bindClass(i.MidwayAspectService);w.bindClass(i.MidwayDecoratorService);w.bindClass(i.MidwayConfigService);w.bindClass(i.MidwayLoggerService);w.bindClass(i.MidwayApplicationManager);w.bindClass(i.MidwayFrameworkService);w.bindClass(i.MidwayMiddlewareService);w.bindClass(i.MidwayLifeCycleService);w.bindClass(i.MidwayMockService);w.bindClass(i.MidwayWebRouterService);w.bindClass(c.MidwayServerlessFunctionService);w.bindClass(p.MidwayHealthService);w.bindClass(i.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(e.preloadModules&&e.preloadModules.length){for(const r of e.preloadModules){w.bindClass(r)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const C=w.get(i.MidwayEnvironmentService);C.setModuleLoadType(e.moduleLoadType);const A=w.get(i.MidwayConfigService);A.add([{default:s.default}]);w.get(i.MidwayAspectService,[w]);w.get(i.MidwayDecoratorService,[w]);printStepDebugInfo("Load imports(component) and user code configuration module");w.load([].concat(e.imports).concat(e.configurationModule));printStepDebugInfo("Run applicationContext ready method");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);await w.ready();g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(e.globalConfig){if(Array.isArray(e.globalConfig)){A.add(e.globalConfig)}else{A.addObject(e.globalConfig)}}printStepDebugInfo("Load config file");A.load();v("[core]: Current config = %j",A.getConfiguration());g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);w.get(i.MidwayMiddlewareService,[w]);return w}r.prepareGlobalApplicationContextAsync=prepareGlobalApplicationContextAsync;function prepareGlobalApplicationContext(e){var r,n,b,_;printStepDebugInfo("Ready to create applicationContext");v('[core]: start "initializeGlobalApplicationContext"');v(`[core]: bootstrap options = ${a.inspect(e)}`);const E=(r=e.appDir)!==null&&r!==void 0?r:"";const x=(n=e.baseDir)!==null&&n!==void 0?n:"";g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const T=(b=e.applicationContext)!==null&&b!==void 0?b:new i.MidwayContainer;v("[core]: delegate module map from decoratorManager");(0,o.bindContainer)(T);global["MIDWAY_APPLICATION_CONTEXT"]=T;T.registerObject("baseDir",x);T.registerObject("appDir",E);g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);printStepDebugInfo("Ready module detector");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);if(!e.moduleLoadType){e.moduleLoadType="commonjs"}if(e.moduleDetector!==false){if(e.moduleDetector===undefined){T.setFileDetector(new i.CommonJSFileDetector({ignore:(_=e.ignore)!==null&&_!==void 0?_:[]}))}else if(e.moduleDetector){T.setFileDetector(e.moduleDetector)}}g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");T.bindClass(i.MidwayEnvironmentService);T.bindClass(i.MidwayInformationService);T.bindClass(i.MidwayAspectService);T.bindClass(i.MidwayDecoratorService);T.bindClass(i.MidwayConfigService);T.bindClass(i.MidwayLoggerService);T.bindClass(i.MidwayApplicationManager);T.bindClass(i.MidwayFrameworkService);T.bindClass(i.MidwayMiddlewareService);T.bindClass(i.MidwayLifeCycleService);T.bindClass(i.MidwayMockService);T.bindClass(i.MidwayWebRouterService);T.bindClass(c.MidwayServerlessFunctionService);T.bindClass(p.MidwayHealthService);T.bindClass(i.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(e.preloadModules&&e.preloadModules.length){for(const r of e.preloadModules){T.bindClass(r)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const w=T.get(i.MidwayEnvironmentService);w.setModuleLoadType(e.moduleLoadType);const C=T.get(i.MidwayConfigService);C.add([{default:s.default}]);T.get(i.MidwayAspectService,[T]);T.get(i.MidwayDecoratorService,[T]);printStepDebugInfo("Load imports(component) and user code configuration module");if(!e.imports){e.imports=[(0,i.safeRequire)((0,u.join)(e.baseDir,"configuration"))]}T.load([].concat(e.imports).concat(e.configurationModule));printStepDebugInfo("Run applicationContext ready method");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);T.ready();g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(e.globalConfig){if(Array.isArray(e.globalConfig)){C.add(e.globalConfig)}else{C.addObject(e.globalConfig)}}printStepDebugInfo("Load config file");C.load();v("[core]: Current config = %j",C.getConfiguration());g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);T.get(i.MidwayMiddlewareService,[T]);return T}r.prepareGlobalApplicationContext=prepareGlobalApplicationContext},88504:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.pascalCase=r.camelCase=void 0;const n=/[\p{Lu}]/u;const i=/[\p{Ll}]/u;const s=/([\p{Alpha}\p{N}_]|$)/u;const o=/[_.\- ]+/;const a=new RegExp("^"+o.source);const c=new RegExp(o.source+s.source,"gu");const u=new RegExp("\\d+"+s.source,"gu");const preserveCamelCase=(e,r,s)=>{let o=false;let a=false;let c=false;for(let u=0;u<e.length;u++){const p=e[u];if(o&&n.test(p)){e=e.slice(0,u)+"-"+e.slice(u);o=false;c=a;a=true;u++}else if(a&&c&&i.test(p)){e=e.slice(0,u-1)+"-"+e.slice(u-1);c=a;a=false;o=true}else{o=r(p)===p&&s(p)!==p;c=a;a=s(p)===p&&r(p)!==p}}return e};const postProcess=(e,r)=>{c.lastIndex=0;u.lastIndex=0;return e.replace(c,((e,n)=>r(n))).replace(u,(e=>r(e)))};function camelCaseOrigin(e,r){r={pascalCase:false,...r};e=e.trim();if(e.length===0){return""}const toLowerCase=e=>e.toLowerCase();const toUpperCase=e=>e.toUpperCase();if(e.length===1){if(o.test(e)){return""}return r.pascalCase?toUpperCase(e):toLowerCase(e)}const n=e!==toLowerCase(e);if(n){e=preserveCamelCase(e,toLowerCase,toUpperCase)}e=e.replace(a,"");e=toLowerCase(e);if(r.pascalCase){e=toUpperCase(e.charAt(0))+e.slice(1)}return postProcess(e,toUpperCase)}function camelCase(e){return camelCaseOrigin(e,{pascalCase:false})}r.camelCase=camelCase;function pascalCase(e){return camelCaseOrigin(e,{pascalCase:true})}r.pascalCase=pascalCase},7269:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.getCurrentAsyncContextManager=r.getCurrentMainApp=r.getCurrentMainFramework=r.getCurrentApplicationContext=void 0;const i=n(77404);const getCurrentApplicationContext=()=>global["MIDWAY_APPLICATION_CONTEXT"];r.getCurrentApplicationContext=getCurrentApplicationContext;const getCurrentMainFramework=()=>global["MIDWAY_MAIN_FRAMEWORK"];r.getCurrentMainFramework=getCurrentMainFramework;const getCurrentMainApp=()=>{const e=(0,r.getCurrentMainFramework)();if(e){return e.getApplication()}return undefined};r.getCurrentMainApp=getCurrentMainApp;const getCurrentAsyncContextManager=()=>(0,r.getCurrentApplicationContext)().get(i.ASYNC_CONTEXT_MANAGER_KEY);r.getCurrentAsyncContextManager=getCurrentAsyncContextManager},90428:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.extend=void 0;const i=n(73171);function extend(...e){let r,n,s,o,a;let c=e[0];let u=1;const p=e.length;let g=false;if(typeof c==="boolean"){g=c;c=e[1]||{};u=2}else if(typeof c!=="object"&&typeof c!=="function"||c==null){c={}}for(;u<p;++u){r=e[u];if(r==null)continue;for(n in r){if(n==="__proto__")continue;s=c[n];o=r[n];if(c===o)continue;if(g&&o&&i.Types.isPlainObject(o)){a=s&&i.Types.isPlainObject(s)?s:{};c[n]=extend(g,a,o)}else if(typeof o!=="undefined"){c[n]=o}}}return c}r.extend=extend},21206:(e,r)=>{"use strict";
|
|
1
|
+
(()=>{var __webpack_modules__={62542:e=>{function webpackEmptyAsyncContext(e){return Promise.resolve().then((()=>{var r=new Error("Cannot find module '"+e+"'");r.code="MODULE_NOT_FOUND";throw r}))}webpackEmptyAsyncContext.keys=()=>[];webpackEmptyAsyncContext.resolve=webpackEmptyAsyncContext;webpackEmptyAsyncContext.id=62542;e.exports=webpackEmptyAsyncContext},35378:(e,r,n)=>{const{Bootstrap:i}=n(41836);i.configure({imports:n(60137),moduleDetector:false}).run()},62002:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const i=n(51466);const s=n(74761);const o=n(96878);const a=n(44348);const c=n(40934);r["default"]={v1Comp:i,v1Email:s,v1Oss:o,v1Token:a,v1User:c}},51466:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.compcontrollerVersions=r.compcontrollerUpload=r.compcontrollerUpdateobjectid=r.compcontrollerUpdate=r.compcontrollerSoftdelete=r.compcontrollerMycomps=r.compcontrollerInfobyname=r.compcontrollerInfobyid=r.compcontrollerDownload=r.compcontrollerDelete=r.compcontrollerComps=r.compcontrollerCollectedcomps=r.compcontrollerCollect=r.compcontrollerCheckversioncorrect=r.compcontrollerCheckversion=r.compcontrollerCheckcompexistbyname=r.compcontrollerCheckcompexistbyid=r.compcontrollerCheckcompexistbyhash=void 0;const i=n(10954);async function compcontrollerCheckcompexistbyhash(e,r){return(0,i.default)("/api/v1/comp/checkCompExistByHash",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCheckcompexistbyhash=compcontrollerCheckcompexistbyhash;async function compcontrollerCheckcompexistbyid(e,r){return(0,i.default)("/api/v1/comp/checkCompExistById",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCheckcompexistbyid=compcontrollerCheckcompexistbyid;async function compcontrollerCheckcompexistbyname(e,r){return(0,i.default)("/api/v1/comp/checkCompExistByName",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCheckcompexistbyname=compcontrollerCheckcompexistbyname;async function compcontrollerCheckversion(e,r){return(0,i.default)("/api/v1/comp/checkVersion",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCheckversion=compcontrollerCheckversion;async function compcontrollerCheckversioncorrect(e,r){return(0,i.default)("/api/v1/comp/checkVersionCorrect",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCheckversioncorrect=compcontrollerCheckversioncorrect;async function compcontrollerCollect(e,r){return(0,i.default)("/api/v1/comp/collect",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCollect=compcontrollerCollect;async function compcontrollerCollectedcomps(e,r){return(0,i.default)("/api/v1/comp/collectedComps",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerCollectedcomps=compcontrollerCollectedcomps;async function compcontrollerComps(e,r){return(0,i.default)("/api/v1/comp/comps",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerComps=compcontrollerComps;async function compcontrollerDelete(e,r){return(0,i.default)("/api/v1/comp/delete",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerDelete=compcontrollerDelete;async function compcontrollerDownload(e,r){return(0,i.default)("/api/v1/comp/download",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerDownload=compcontrollerDownload;async function compcontrollerInfobyid(e,r){return(0,i.default)("/api/v1/comp/infoById",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerInfobyid=compcontrollerInfobyid;async function compcontrollerInfobyname(e,r){return(0,i.default)("/api/v1/comp/infoByName",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerInfobyname=compcontrollerInfobyname;async function compcontrollerMycomps(e,r){return(0,i.default)("/api/v1/comp/myComps",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerMycomps=compcontrollerMycomps;async function compcontrollerSoftdelete(e,r){return(0,i.default)("/api/v1/comp/softDelete",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerSoftdelete=compcontrollerSoftdelete;async function compcontrollerUpdate(e,r){return(0,i.default)("/api/v1/comp/update",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerUpdate=compcontrollerUpdate;async function compcontrollerUpdateobjectid(e,r){return(0,i.default)("/api/v1/comp/updateObjectId",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerUpdateobjectid=compcontrollerUpdateobjectid;async function compcontrollerUpload(e,r){return(0,i.default)("/api/v1/comp/upload",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerUpload=compcontrollerUpload;async function compcontrollerVersions(e,r){return(0,i.default)("/api/v1/comp/versions",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.compcontrollerVersions=compcontrollerVersions},74761:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.emailcontrollerSendcode=void 0;const i=n(10954);async function emailcontrollerSendcode(e,r){return(0,i.default)("/api/v1/email/sendCode",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.emailcontrollerSendcode=emailcontrollerSendcode},96878:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.osscontrollerPutpolicy=r.osscontrollerGetsts=r.osscontrollerCompossdir=void 0;const i=n(10954);async function osscontrollerCompossdir(e){return(0,i.default)("/api/v1/oss/compOssDir",{method:"POST",...e||{}})}r.osscontrollerCompossdir=osscontrollerCompossdir;async function osscontrollerGetsts(e){return(0,i.default)("/api/v1/oss/getSts",{method:"POST",...e||{}})}r.osscontrollerGetsts=osscontrollerGetsts;async function osscontrollerPutpolicy(e,r){return(0,i.default)("/api/v1/oss/putPolicy",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.osscontrollerPutpolicy=osscontrollerPutpolicy},44348:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.tokencontrollerRefresh=void 0;const i=n(10954);async function tokencontrollerRefresh(e){return(0,i.default)("/api/v1/token/refresh",{method:"POST",...e||{}})}r.tokencontrollerRefresh=tokencontrollerRefresh},40934:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.usercontrollerWhoami=r.usercontrollerUserinfo=r.usercontrollerUpdateemail=r.usercontrollerSetallowemaillogin=r.usercontrollerLogin=r.usercontrollerCheckpassword=r.usercontrollerCheckemail=r.usercontrollerChangepassword=r.usercontrollerChangenickname=r.usercontrollerChangeavatar=void 0;const i=n(10954);async function usercontrollerChangeavatar(e,r){return(0,i.default)("/api/v1/user/changeAvatar",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerChangeavatar=usercontrollerChangeavatar;async function usercontrollerChangenickname(e,r){return(0,i.default)("/api/v1/user/changeNickname",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerChangenickname=usercontrollerChangenickname;async function usercontrollerChangepassword(e,r){return(0,i.default)("/api/v1/user/changePassword",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerChangepassword=usercontrollerChangepassword;async function usercontrollerCheckemail(e,r){return(0,i.default)("/api/v1/user/checkEmail",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerCheckemail=usercontrollerCheckemail;async function usercontrollerCheckpassword(e){return(0,i.default)("/api/v1/user/checkPassword",{method:"POST",...e||{}})}r.usercontrollerCheckpassword=usercontrollerCheckpassword;async function usercontrollerLogin(e,r){return(0,i.default)("/api/v1/user/login",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerLogin=usercontrollerLogin;async function usercontrollerSetallowemaillogin(e,r){return(0,i.default)("/api/v1/user/setAllowEmailLogin",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerSetallowemaillogin=usercontrollerSetallowemaillogin;async function usercontrollerUpdateemail(e,r){return(0,i.default)("/api/v1/user/updateEmail",{method:"POST",headers:{"Content-Type":"application/json"},data:e,...r||{}})}r.usercontrollerUpdateemail=usercontrollerUpdateemail;async function usercontrollerUserinfo(e){return(0,i.default)("/api/v1/user/userInfo",{method:"POST",...e||{}})}r.usercontrollerUserinfo=usercontrollerUserinfo;async function usercontrollerWhoami(e){return(0,i.default)("/api/v1/user/whoAmI",{method:"POST",...e||{}})}r.usercontrollerWhoami=usercontrollerWhoami},10839:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.resUtil=r.getResType=r.SuccessWrapper=r.getListItemRes=r.ListRes=r.ApiRes=void 0;const o=n(66466);class ApiRes{}i([(0,o.ApiProperty)({description:"状态码",example:0,required:true}),s("design:type",Number)],ApiRes.prototype,"code",void 0);i([(0,o.ApiProperty)({description:"响应消息",example:"OK",required:true}),s("design:type",String)],ApiRes.prototype,"message",void 0);i([(0,o.ApiProperty)({description:"业务数据",required:true}),s("design:type",Object)],ApiRes.prototype,"data",void 0);r.ApiRes=ApiRes;class ListRes{}i([(0,o.ApiProperty)({description:"列表数据"}),s("design:type",Array)],ListRes.prototype,"rows",void 0);i([(0,o.ApiProperty)({description:"总记录数",example:100}),s("design:type",Number)],ListRes.prototype,"total",void 0);i([(0,o.ApiProperty)({description:"当前页码",example:1}),s("design:type",Number)],ListRes.prototype,"page",void 0);i([(0,o.ApiProperty)({description:"每页记录数",example:10}),s("design:type",Number)],ListRes.prototype,"pageSize",void 0);r.ListRes=ListRes;const a=new Map;function getListItemRes(e){const r=`${e.name}ListRes`;if(a.has(r)){return a.get(r)}class SpecificListRes extends ListRes{}i([(0,o.ApiProperty)({type:[e],description:"列表数据"}),s("design:type",Array)],SpecificListRes.prototype,"rows",void 0);Object.defineProperty(SpecificListRes,"name",{value:r,writable:false});a.set(r,SpecificListRes);return SpecificListRes}r.getListItemRes=getListItemRes;function SuccessWrapper(e){class Successed{}i([(0,o.ApiProperty)({description:"状态码"}),s("design:type",Number)],Successed.prototype,"code",void 0);i([(0,o.ApiProperty)({description:"消息"}),s("design:type",String)],Successed.prototype,"message",void 0);i([(0,o.ApiProperty)({type:e}),s("design:type",Object)],Successed.prototype,"data",void 0);return Successed}r.SuccessWrapper=SuccessWrapper;function getResType(e){const r=`${e.name}Res`;if(a.has(r)){return a.get(r)}class SpecificResponse extends ApiRes{}i([(0,o.ApiProperty)({type:e,required:true}),s("design:type",Object)],SpecificResponse.prototype,"data",void 0);Object.defineProperty(SpecificResponse,"name",{value:r,writable:false});a.set(r,SpecificResponse);return SpecificResponse}r.getResType=getResType;r.resUtil={success:(e=null,r="OK",n=0)=>({code:n,message:r,data:e}),error:(e="Error",r=1,n=null)=>({code:r,message:e,data:n})}},5808:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]={FILE_MANAGER_DIRNAME:{adapter:"local",storages:["local"],dirname:"local://"},COMP_DEFAULT_FIELD:[{name:"__id__",label:"组件ID",required:true,default:""},{name:"name",label:"组件名称",required:true,default:""},{name:"version",label:"版本号",required:true,default:"1.0.0"}],PREBUILD_MODULE_DIR:"/node_modules/.prebuild_module",MODULE_LOAD_PREFIX:"/_module_load_prefix_",COMP_PREVIEW_PREFIX:"/_comp_preview_prefix_",COMP_TEMP_DIR:"/.comp_hub_temp",COMP_SUBMIT_FILE_CHECKING:{totalSize:1024*1024*10,totalNum:30},CACHE_KEY:{STS_TOKEN:"oss:sts:token",STS_EXPIRE_TIME:"oss:sts:expire"},OSS_CUSTOM_DOMAIN:"https://oss.comphub.cn",REMOTE_SERVICE_URL:"https://api.comphub.cn:5696"}},82919:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const i=n(5808);const s=n(80994);const{logLevel:o=""}=s(process.argv.slice(2));r["default"]={keys:"1755564797722_8890",koa:{globalPrefix:"/api"},midwayLogger:{default:{transports:{console:{level:"all"}}},clients:{appLogger:{level:o||"info"},coreLogger:{level:o||"info"}}},cacheManager:{clients:{default:{store:"memory"}}},...i.default}},50849:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]={}},3574:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]={koa:{port:null}}},85903:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MainConfiguration=void 0;const o=n(45573);const a=n(78305);const c=n(30794);const u=n(7252);const p=n(16313);const g=n(66792);const v=n(39718);const b=n(82919);const _=n(50849);const E=n(16928);const x=n(79896);const T=n(5783);const w=n(66466);const C=n(58139);const A=n(5808);const k=n(79896);const P=n(10954);const I=n(16378);const R=n(65543);const N=n(80994);const L=N(process.argv.slice(2));async function configBuild(e,r,n){const i=e.getEnv();let s=process.cwd();r.info("cwd:",s);r.info("env:",i);if(i==="local"&&L?.dir){s=E.resolve(s,"../",L?.dir)}const o=E.join(s,"comphub.json");let a={};try{const e=(0,x.readFileSync)(o,"utf8");a=JSON.parse(e)}catch(e){r.warn("未配置comphub.json文件")}r.info("comphub.json:",JSON.stringify(a));if(a.debuggerCwd){s=a.debuggerCwd}const c=E.join(n,i==="local"?"../website":"website","dist");const u=E.join(s,a.srcPath||"");const p=E.join(s,A.default.PREBUILD_MODULE_DIR);await k.promises.mkdir(p,{recursive:true});const g=a.port||3e3;const v=a.remoteServer||A.default.REMOTE_SERVICE_URL;const b={websitePath:c,prebuildModulePath:p,cwd:s,port:g,srcPath:u,remoteServer:v,logLevel:a.logLevel||"warn",debuggerCwd:a.debuggerCwd||""};e.setAttr("comphubConfig",b);r.debug("comphubConfig:",b);P.default.defaults.baseURL=b.remoteServer;return{koa:{port:g},staticFile:{dirs:{default:{prefix:"/dist",dir:c},[A.default.MODULE_LOAD_PREFIX]:{prefix:A.default.MODULE_LOAD_PREFIX,dir:p,maxAge:0},[A.default.COMP_PREVIEW_PREFIX]:{prefix:A.default.COMP_PREVIEW_PREFIX,dir:b.srcPath,maxAge:0}}},httpProxy:{strategy:{__remote__:{match:/\/__remote__\/(.*)$/,target:`${b.remoteServer}/$1`}}}}}let B=class MainConfiguration{async onConfigLoad(){return configBuild(this.app,this.logger,__dirname)}async onReady(){this.app.useMiddleware([v.ReportMiddleware]);this.app.useFilter([g.BadRequestErrorFilter,p.DefaultErrorFilter])}async onServerReady(e){const r=await e.getAsync(a.Framework);const n=r.getServer();const i=n.address();const s=this.app.getEnv();if(i){if(typeof i!=="string"&&"port"in i){this.logger.info("[34mcomp-hub访问地址:",`[34mhttp://127.0.0.1:${i.port}[0m`);if(s==="local"){this.logger.info("[34mswagger-ui:",`[34mhttp://127.0.0.1:${i.port}/swagger-ui/index.html[0m`)}}else if(typeof i==="string"){this.logger.info("服务器启动成功",`地址: ${i}`)}}}};i([(0,o.Logger)("coreLogger"),s("design:type",Object)],B.prototype,"logger",void 0);i([(0,o.App)("koa"),s("design:type",Object)],B.prototype,"app",void 0);B=i([(0,o.Configuration)({imports:[a,c,T,C,I,R,{component:u,enabledEnvironment:["local"]},{component:w,enabledEnvironment:["local"]}],importConfigs:[{default:b,local:_}]})],B);r.MainConfiguration=B},66404:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.SpaController=void 0;const o=n(45573);const a=n(79896);const c=n(16928);const u=n(66466);const p=n(15766);let g=class SpaController{async index(){this.ctx.redirect("/dist/")}async spa(){const e=this.configService.comphubConfig();const{websitePath:r}=e;const n=(0,c.resolve)(r,"index.html");return(0,a.readFileSync)(n,"utf-8")}};i([(0,o.Inject)(),s("design:type",Object)],g.prototype,"ctx",void 0);i([(0,o.App)(),s("design:type",Object)],g.prototype,"app",void 0);i([(0,o.Inject)(),s("design:type",p.ConfigService)],g.prototype,"configService",void 0);i([(0,o.Get)("/"),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],g.prototype,"index",null);i([(0,o.Get)("/dist/*"),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],g.prototype,"spa",null);g=i([(0,u.ApiExcludeController)(),(0,o.Controller)("/",{ignoreGlobalPrefix:true})],g);r.SpaController=g},91557:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};var o=this&&this.__param||function(e,r){return function(n,i){r(n,i,e)}};Object.defineProperty(r,"__esModule",{value:true});r.CompController=void 0;const a=n(45573);const c=n(56491);const u=n(15766);const p=n(66466);const g=n(4019);const v=n(33845);const b=n(10839);const _=n(93305);let E=class CompController{async dir(e){const r=await this.compService.getCompDir(e.compPath);return b.resUtil.success(r)}async file(e){const{filePath:r}=e;const n=await this.compService.getCompFile(r);return b.resUtil.success({content:n})}async check(e){const r=await this.compService.checkCompConfig(e.compPath);return b.resUtil.success(r)}async updateVersion(e){const{compPath:r,version:n}=e;await this.compService.updateCompVersion(r,n);return b.resUtil.success()}async generateCompJson(e){const{compPath:r}=e;await this.compService.generateCompJson(r);return b.resUtil.success()}async dep(e){const{compPath:r}=e;const n=await this.compService.getCompDep(r);return b.resUtil.success(n)}async preBuildAll(e){const{deps:r}=e;const n=await this.compService.preBuildAll(r);return b.resUtil.success(n)}async comphubConfig(){const e=this.configService.comphubConfig();return b.resUtil.success(e)}async otherConfig(){const e=this.configService.otherConfig();return b.resUtil.success(e)}async checkCompRepeat(e){const{compPath:r}=e;const n=await this.compService.checkCompRepeat(r);return b.resUtil.success(n)}async submit(e){await this.compService.submitComp(e);return b.resUtil.success()}async update(e){await this.compService.updateComp(e);return b.resUtil.success()}async download(e){const r=await this.compService.downloadComp(e);if(r?.isRepeat){return b.resUtil.success({isRepeat:true})}return b.resUtil.success({isRepeat:false})}async compById(e){const{compId:r}=e;const n=await this.compService.getCompById(r);return b.resUtil.success(n)}async compFilesOssSignedUrl(e){const r=await this.compService.getCompFilesOssSignedUrl(e);return b.resUtil.success(r)}async packageJson(){const e=await this.compService.getPackageJsonContent();return b.resUtil.success(e)}};i([(0,a.App)(),s("design:type",Object)],E.prototype,"app",void 0);i([(0,a.Inject)(),s("design:type",c.CompService)],E.prototype,"compService",void 0);i([(0,a.Inject)(),s("design:type",u.ConfigService)],E.prototype,"configService",void 0);i([(0,p.ApiOperation)({summary:"获取组件目录"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.CompFileVo)}),(0,a.Post)("/dir"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.CompDirDto]),s("design:returntype",Promise)],E.prototype,"dir",null);i([(0,p.ApiOperation)({summary:"获取组件目录内指定文件的内容"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.CompFileContentVo)}),(0,a.Post)("/file"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.CompFileDto]),s("design:returntype",Promise)],E.prototype,"file",null);i([(0,p.ApiOperation)({summary:"检查组件配置是否符合规范"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.CompCheckVo)}),(0,a.Post)("/check"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.CompCheckDto]),s("design:returntype",Promise)],E.prototype,"check",null);i([(0,p.ApiOperation)({summary:"更新组件版本号"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:b.ApiRes}),(0,a.Post)("/updateVersion"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.UpdateVersionDto]),s("design:returntype",Promise)],E.prototype,"updateVersion",null);i([(0,p.ApiOperation)({summary:"生成组件指纹文件"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:b.ApiRes}),(0,a.Post)("/generateCompJson"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.GenerateCompJsonDto]),s("design:returntype",Promise)],E.prototype,"generateCompJson",null);i([(0,p.ApiOperation)({summary:"获取组件依赖关系"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.ImportScanResultVo)}),(0,a.Post)("/dep"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.DepDto]),s("design:returntype",Promise)],E.prototype,"dep",null);i([(0,p.ApiOperation)({summary:"模块预构建整页"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.PreBuildVo)}),(0,a.Post)("/preBuildAll"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.PreBuildAllDto]),s("design:returntype",Promise)],E.prototype,"preBuildAll",null);i([(0,p.ApiOperation)({summary:"获取comphubConfig配置"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.ComphubConfigVo)}),(0,a.Post)("/comphubConfig"),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],E.prototype,"comphubConfig",null);i([(0,p.ApiOperation)({summary:"获取其他配置"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.OtherConfigVo)}),(0,a.Post)("/otherConfig"),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],E.prototype,"otherConfig",null);i([(0,p.ApiOperation)({summary:"检查组件是否重复"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.CompSimilarListVO)}),(0,a.Post)("/checkCompRepeat",{middleware:[_.TokenMiddleware]}),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.CheckCompRepeatDto]),s("design:returntype",Promise)],E.prototype,"checkCompRepeat",null);i([(0,p.ApiOperation)({summary:"提交组件"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:b.ApiRes}),(0,a.Post)("/submit",{middleware:[_.TokenMiddleware]}),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.SubmitCompDto]),s("design:returntype",Promise)],E.prototype,"submit",null);i([(0,p.ApiOperation)({summary:"更新组件"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:b.ApiRes}),(0,a.Post)("/update",{middleware:[_.TokenMiddleware]}),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.UpdateCompDto]),s("design:returntype",Promise)],E.prototype,"update",null);i([(0,p.ApiOperation)({summary:"下载组件"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.DownloadCompVo)}),(0,a.Post)("/download",{middleware:[_.TokenMiddleware]}),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.DownloadCompDto]),s("design:returntype",Promise)],E.prototype,"download",null);i([(0,p.ApiOperation)({summary:"通过id在本地查询组件"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.CompByIdVo)}),(0,a.Post)("/compById"),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.CompByIdDto]),s("design:returntype",Promise)],E.prototype,"compById",null);i([(0,p.ApiOperation)({summary:"获取组件文件夹下所有文件的oss签名访问地址"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:(0,b.getResType)(v.CompFilesOssSignedUrlVo)}),(0,a.Post)("/compFilesOssSignedUrl",{middleware:[_.TokenMiddleware]}),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[g.CompFilesOssSignedUrlDto]),s("design:returntype",Promise)],E.prototype,"compFilesOssSignedUrl",null);i([(0,p.ApiOperation)({summary:"获取package.json"}),(0,p.ApiResponse)({status:200,description:"返回结果",type:b.ApiRes}),(0,a.Post)("/packageJson"),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],E.prototype,"packageJson",null);E=i([(0,p.ApiTags)(["v1-comp"]),(0,a.Controller)("/v1/comp")],E);r.CompController=E},81179:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};var o=this&&this.__param||function(e,r){return function(n,i){r(n,i,e)}};Object.defineProperty(r,"__esModule",{value:true});r.OssController=void 0;const a=n(45573);const c=n(66466);const u=n(10839);const p=n(17583);const g=n(2809);const v=n(66959);const b=n(93305);let _=class OssController{async fileSignUrl(e){const{objectId:r}=e;const n=await this.ossService.getDownloadSts();const i=await this.ossService.getFilePreviewUrl(n,r);return u.resUtil.success({signUrl:i})}};i([(0,a.App)(),s("design:type",Object)],_.prototype,"app",void 0);i([(0,a.Inject)(),s("design:type",v.OssService)],_.prototype,"ossService",void 0);i([(0,c.ApiOperation)({summary:"获取图片访问地址",description:"获取图片访问地址"}),(0,c.ApiResponse)({status:200,description:"返回结果",type:(0,u.getResType)(g.SignedUrlVO)}),(0,a.Post)("/fileSignUrl",{middleware:[b.TokenMiddleware]}),o(0,(0,a.Body)()),s("design:type",Function),s("design:paramtypes",[p.SignedUrlDto]),s("design:returntype",Promise)],_.prototype,"fileSignUrl",null);_=i([(0,c.ApiTags)(["v1-oss"]),(0,a.Controller)("/v1/oss")],_);r.OssController=_},69322:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};var o=this&&this.__param||function(e,r){return function(n,i){r(n,i,e)}};Object.defineProperty(r,"__esModule",{value:true});r.VuefinderController=void 0;const a=n(45573);const c=n(87360);const u=n(66466);const p=n(33988);let g=class VuefinderController{async index(e){const r=await this.vuefinderService.getVuefinder(e.path,e.q);return r}};i([(0,a.App)(),s("design:type",Object)],g.prototype,"app",void 0);i([(0,a.Inject)(),s("design:type",c.VuefinderService)],g.prototype,"vuefinderService",void 0);i([(0,u.ApiOperation)({summary:"查询文件"}),(0,a.Get)("/index"),o(0,(0,a.Query)()),s("design:type",Function),s("design:paramtypes",[p.VueFinderIndexDto]),s("design:returntype",Promise)],g.prototype,"index",null);g=i([(0,u.ApiTags)(["v1-vuefinder"]),(0,a.Controller)("/v1/vuefinder")],g);r.VuefinderController=g},4019:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.CompFilesOssSignedUrlDto=r.DownloadCompDto=r.UpdateCompDto=r.SubmitCompDto=r.PreBuildAllDto=r.CompFileDto=r.UpdateVersionDto=r.CheckCompRepeatDto=r.CompByIdDto=r.DepDto=r.GenerateCompJsonDto=r.CompCheckDto=r.CompDirDto=void 0;const o=n(66466);class CompPathDto{}i([(0,o.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),s("design:type",String)],CompPathDto.prototype,"compPath",void 0);class CompIdDto{}i([(0,o.ApiProperty)({required:true,description:"组件id",example:"123"}),s("design:type",String)],CompIdDto.prototype,"compId",void 0);class CompDirDto extends CompPathDto{}r.CompDirDto=CompDirDto;class CompCheckDto extends CompPathDto{}r.CompCheckDto=CompCheckDto;class GenerateCompJsonDto extends CompPathDto{}r.GenerateCompJsonDto=GenerateCompJsonDto;class DepDto extends CompPathDto{}r.DepDto=DepDto;class CompByIdDto extends CompIdDto{}r.CompByIdDto=CompByIdDto;class CheckCompRepeatDto extends CompPathDto{}r.CheckCompRepeatDto=CheckCompRepeatDto;class UpdateVersionDto extends CompPathDto{}i([(0,o.ApiProperty)({required:true,description:"组件版本号",example:"1.0.0"}),s("design:type",String)],UpdateVersionDto.prototype,"version",void 0);r.UpdateVersionDto=UpdateVersionDto;class CompFileDto{}i([(0,o.ApiProperty)({required:true,description:"组件文件路径",example:"/src/components/MyComp/index.vue"}),s("design:type",String)],CompFileDto.prototype,"filePath",void 0);r.CompFileDto=CompFileDto;class PreBuildAllDto{}i([(0,o.ApiProperty)({required:true,description:"组件依赖",example:["axios","md5"]}),s("design:type",Array)],PreBuildAllDto.prototype,"deps",void 0);r.PreBuildAllDto=PreBuildAllDto;class ImportDetailDto{}i([(0,o.ApiProperty)({description:"是否默认导入",example:false}),s("design:type",Boolean)],ImportDetailDto.prototype,"default",void 0);i([(0,o.ApiProperty)({description:"命名导入列表",type:[String],example:["ElButton"]}),s("design:type",Array)],ImportDetailDto.prototype,"named",void 0);i([(0,o.ApiProperty)({description:"是否命名空间导入",example:false}),s("design:type",Boolean)],ImportDetailDto.prototype,"namespace",void 0);i([(0,o.ApiProperty)({description:"库版本(仅第三方库存在)",required:false,example:"^2.10.5"}),s("design:type",String)],ImportDetailDto.prototype,"version",void 0);class PreviewItemDto{}i([(0,o.ApiProperty)({required:true,description:"组件入口",example:["/src/components/MyComp/index.vue"]}),s("design:type",Array)],PreviewItemDto.prototype,"path",void 0);i([(0,o.ApiProperty)({required:true,description:"入口描述",example:"这是一个组件"}),s("design:type",String)],PreviewItemDto.prototype,"desc",void 0);let a=class SubmitCompDto{};i([(0,o.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),s("design:type",String)],a.prototype,"compPath",void 0);i([(0,o.ApiProperty)({type:"object",required:true,description:"组件依赖",additionalProperties:{type:()=>ImportDetailDto}}),s("design:type",Object)],a.prototype,"dep",void 0);i([(0,o.ApiProperty)({type:"array",required:true,description:"组件预览数据",items:{$ref:(0,o.getSchemaPath)(PreviewItemDto)}}),s("design:type",Array)],a.prototype,"previewConfigs",void 0);i([(0,o.ApiProperty)({required:true,description:"组件描述",example:"这是一个组件"}),s("design:type",String)],a.prototype,"desc",void 0);i([(0,o.ApiProperty)({required:false,description:"组件背景颜色",example:"#f0f0f0"}),s("design:type",String)],a.prototype,"bgColor",void 0);i([(0,o.ApiProperty)({required:false,description:"是否允许重复",example:true}),s("design:type",Boolean)],a.prototype,"allowRepeat",void 0);a=i([(0,o.ApiExtraModel)(PreviewItemDto)],a);r.SubmitCompDto=a;class UpdateCompDto extends a{}i([(0,o.ApiProperty)({required:true,description:"组件id",example:"123"}),s("design:type",String)],UpdateCompDto.prototype,"compId",void 0);r.UpdateCompDto=UpdateCompDto;class DownloadCompDto extends CompIdDto{}i([(0,o.ApiProperty)({required:true,description:"组件下载路径",example:"/src/components/MyComp"}),s("design:type",String)],DownloadCompDto.prototype,"savePath",void 0);i([(0,o.ApiProperty)({required:false,description:"是否覆盖",example:true}),s("design:type",Boolean)],DownloadCompDto.prototype,"isCover",void 0);i([(0,o.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),s("design:type",String)],DownloadCompDto.prototype,"compName",void 0);i([(0,o.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),s("design:type",String)],DownloadCompDto.prototype,"version",void 0);r.DownloadCompDto=DownloadCompDto;class CompFilesOssSignedUrlDto{}i([(0,o.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),s("design:type",String)],CompFilesOssSignedUrlDto.prototype,"compName",void 0);i([(0,o.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),s("design:type",String)],CompFilesOssSignedUrlDto.prototype,"version",void 0);i([(0,o.ApiProperty)({required:true,description:"对象存储id",example:"123"}),s("design:type",String)],CompFilesOssSignedUrlDto.prototype,"objectId",void 0);i([(0,o.ApiProperty)({required:true,description:"组件文件路径",example:"MyComp/index.vue"}),s("design:type",Array)],CompFilesOssSignedUrlDto.prototype,"files",void 0);r.CompFilesOssSignedUrlDto=CompFilesOssSignedUrlDto},17583:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.SignedUrlDto=void 0;const o=n(66466);const a=n(30794);class SignedUrlDto{}i([(0,a.Rule)(a.RuleType.string().required().error(new Error("对象id不能为空"))),(0,o.ApiProperty)({example:"xcxcxdas",description:"对象id",required:true}),s("design:type",String)],SignedUrlDto.prototype,"objectId",void 0);r.SignedUrlDto=SignedUrlDto},33988:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.VueFinderIndexDto=void 0;const o=n(66466);class VueFinderIndexDto{}i([(0,o.ApiProperty)({required:true,description:"文件路径"}),s("design:type",String)],VueFinderIndexDto.prototype,"path",void 0);i([(0,o.ApiProperty)({required:true,description:"查询关键词"}),s("design:type",String)],VueFinderIndexDto.prototype,"q",void 0);r.VueFinderIndexDto=VueFinderIndexDto},66792:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.BadRequestErrorFilter=void 0;const s=n(45573);const o=n(10839);let a=class BadRequestErrorFilter{async catch(e,r){r.logger.error("BadRequestError==>",e);return o.resUtil.error(e.message,e.status)}};a=i([(0,s.Catch)(s.httpError.BadRequestError)],a);r.BadRequestErrorFilter=a},16313:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.DefaultErrorFilter=void 0;const s=n(45573);let o=class DefaultErrorFilter{async catch(e,r){try{r.logger.error("remote server request error:",e);const n=JSON.parse(e.message);return{...n}}catch(n){r.logger.error(e)}return{code:e.status??500,message:e.message}}};o=i([(0,s.Catch)()],o);r.DefaultErrorFilter=o},53441:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.NotFoundFilter=void 0;const s=n(45573);let o=class NotFoundFilter{async catch(e,r){r.redirect("/404.html")}};o=i([(0,s.Catch)(s.httpError.NotFoundError)],o);r.NotFoundFilter=o},60137:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.Configuration=void 0;var o=n(85903);Object.defineProperty(r,"Configuration",{enumerable:true,get:function(){return o.MainConfiguration}});s(n(51466),r);s(n(74761),r);s(n(96878),r);s(n(44348),r);s(n(40934),r);s(n(62002),r);s(n(10839),r);s(n(5808),r);s(n(82919),r);s(n(50849),r);s(n(3574),r);s(n(66404),r);s(n(91557),r);s(n(81179),r);s(n(69322),r);s(n(4019),r);s(n(17583),r);s(n(33988),r);s(n(66792),r);s(n(16313),r);s(n(53441),r);s(n(87135),r);s(n(61667),r);s(n(39718),r);s(n(93305),r);s(n(56491),r);s(n(15766),r);s(n(64648),r);s(n(66959),r);s(n(8492),r);s(n(87360),r);s(n(35505),r);s(n(99579),r);s(n(25147),r);s(n(15199),r);s(n(10954),r);s(n(39565),r);s(n(30765),r);s(n(33845),r);s(n(2809),r)},87135:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},61667:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},39718:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.ReportMiddleware=void 0;const s=n(45573);let o=class ReportMiddleware{resolve(){return async(e,r)=>{const n=Date.now();const i=await r();e.logger.debug(`rt = ${Date.now()-n}ms`);return i}}static getName(){return"report"}};o=i([(0,s.Middleware)()],o);r.ReportMiddleware=o},93305:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.TokenMiddleware=void 0;const s=n(45573);const o=n(10954);let a=class TokenMiddleware{resolve(){return async(e,r)=>{(0,o.setHeader)(e.header);await r()}}static getName(){return"token"}};a=i([(0,s.Middleware)()],a);r.TokenMiddleware=a},56491:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.CompService=void 0;const o=n(45573);const a=n(16928);const c=n(79896);const u=n(15766);const p=n(25147);const g=n(99579);const v=n(15199);const b=n(5808);const _=n(51466);const E=n(96878);const x=n(66959);const T=n(64648);const w=n(70857);const C=n(72136);let A=class CompService{async getCompDir(e){const{srcPath:r}=this.configService.comphubConfig();const n=b.default.FILE_MANAGER_DIRNAME;const i=a.join(e.replace(n.dirname,`${r}${a.sep}`));const s=await(0,p.readFileTree)(i);return s}async getCompFile(e){const r=await c.promises.readFile(e,"utf-8");return r}getCompFullPath(e){const{srcPath:r}=this.configService.comphubConfig();const n=b.default.FILE_MANAGER_DIRNAME;e=e.replace(n.dirname,"");const i=a.join(r,e);return i}checkCompEntryIndex(e){const r=this.getCompFullPath(e);const n=a.join(r,"index.vue");if(!c.existsSync(n)){return false}return true}checkCompJson(e){const r=this.getCompFullPath(e);const n=a.join(r,"comp.json");if(!c.existsSync(n)){return false}return true}checkCompJsonFormat(e){const r=b.default.COMP_DEFAULT_FIELD;const n=Object.keys(e);const i=r.every((e=>{if(e.required){return n.includes(e.name)}else{return true}}));if(!i){return false}const s=(0,p.validateVersion)(e.version);return s}async checkCompConfig(e){const r=a.basename(e);const n=this.checkCompEntryIndex(e);const i=this.checkCompJson(e);const s={entryIndex:n?a.join(r,"index.vue"):"",compHash:i?a.join(r,"comp.json"):"",compJsonIsOk:""};const o=this.getCompFullPath(e);const c=a.join(o,"comp.json");await this.getCompFile(c).then((e=>{const r=JSON.parse(e);const n=this.checkCompJsonFormat(r);s.compJsonIsOk=n?e:""})).catch((e=>{this.ctx.logger.error("读取comp.json文件失败",e);s.compJsonIsOk=""}));return s}async updateCompVersion(e,r){const n=(0,p.validateVersion)(r);if(!n){throw new o.httpError.BadRequestError("版本号格式错误")}const i=this.getCompFullPath(e);const s=a.join(i,"comp.json");const u=await this.getCompFile(s);const g=JSON.parse(u);g.version=r;const v=JSON.stringify(g,null,2);await c.promises.writeFile(s,v)}async updateCompJson(e,r){const n=this.getCompFullPath(e);const i=a.join(n,"comp.json");const s=await this.getCompFile(i);const o=r(JSON.parse(s));await c.promises.writeFile(i,JSON.stringify(o,null,4))}async readCompVersion(e){const r=this.getCompFullPath(e);const n=a.join(r,"comp.json");const i=await this.getCompFile(n);const s=JSON.parse(i);return s.version}async getCompSize(e){const r=this.getCompFullPath(e);const n=await(0,p.dirSize)(r);return n}initCompJson(){const e=b.default.COMP_DEFAULT_FIELD;return e.reduce(((e,r)=>{const n={};if(r.required){n[r.name]=r.default}return{...e,...n}}),{})}async generateCompJson(e){const r=this.getCompFullPath(e);const n=this.checkCompJson(e);if(n){throw new o.httpError.BadRequestError("组件已存在comp.json文件")}const i=a.basename(r);const s=this.initCompJson();s.name=i;await c.promises.writeFile(a.join(r,"comp.json"),JSON.stringify(s,null,4))}async getCompDep(e){const{cwd:r}=this.configService.comphubConfig();const n=this.getCompFullPath(e);const i=await(0,v.getModuleEntry)(n,r);return i}async preBuildAll(e){const{cwd:r}=this.configService.comphubConfig();const n=this.app.getConfig("PREBUILD_MODULE_DIR");const i=a.join(r,n);const s=await(0,v.prebundleAll)(i,e,r);return s}async uploadFolderToOss({compFullPath:e,version:r,ossData:n}){const i=a.basename(e);const s=await(0,p.readDirRecursively)(e);const o=s.map((r=>{const n=c.statSync(r).size;const i=r.replace(e,"");return{filePath:i,fileFullPath:r,size:n}}));o.sort(((e,r)=>r.size-e.size));let u="";let g="";const v=[];for(let e=0;e<o.length;e++){const{filePath:s,fileFullPath:p}=o[e];const b={...n,key:a.join(n.key,i,r,s).replaceAll(a.sep,"/")};const _=c.createReadStream(p);try{await this.ossService.uploadFileToOss(b,_);v.push(b.key)}catch(e){g=s;u=e.message;break}}if(u){if(v.length){console.log("已经上传完成的文件:",v)}if(u.includes("Your proposed upload exceeds the maximum allowed size")){throw new Error(`组件上传失败,文件${g}大小超过限制`)}throw new Error(u)}}async getCompHashMap(e){const r=await this.hashService.getDirHashList(e);r.forEach((r=>{r.path=r.path.replace(e,"").replaceAll(a.sep,"/")}));const n=r.filter((e=>e.path!=="/comp.json"));const i=n.map((e=>`${e.path}=${e.hash}`)).join(";");return{fileHashList:n,compHash:(0,g.getStringHash)(i)}}async checkCompByFuzzyHash(e){const r=this.getCompFullPath(e);const n=await this.getCompHashMap(r);return n}async checkCompRepeat(e){const r=this.getCompFullPath(e);const n=await this.getCompHashMap(r);const i=await(0,_.compcontrollerCheckcompexistbyhash)({...n}).catch((e=>{throw new Error(e)}));return i.data}async submitComp(e){const{compPath:r,dep:n,previewConfigs:i,desc:s,bgColor:u,allowRepeat:g}=e;const v=this.getCompFullPath(r);const x=await this.getCompHashMap(v);const T=this.checkCompEntryIndex(r);if(!T){throw new o.httpError.BadRequestError("组件入口文件不存在")}const w=a.basename(v);const C=await(0,p.readDirRecursively)(v);const A=await this.getCompSize(r);const{totalSize:k,totalNum:P}=b.default.COMP_SUBMIT_FILE_CHECKING;if(C.length>P){throw new o.httpError.BadRequestError(`组件提交文件数量超过限制${P}个`)}if(A>k){throw new o.httpError.BadRequestError(`组件提交文件大小超过限制${Math.floor(k/1024/1024)}MB`)}const I=await this.readCompVersion(r);const R=C.map((e=>({name:a.basename(e),size:c.statSync(e).size,path:e.replace(v,"").replaceAll(a.sep,"/")})));const N=await(0,_.compcontrollerUpload)({name:w,dep:n,previewConfigs:i,desc:s,version:I,size:await this.getCompSize(r),files:R,bgColor:u,hashMap:x,allowRepeat:g}).catch((e=>{throw new Error(e)}));const L=N.data._id;await this.updateCompJson(r,(e=>({...e,name:w,__id__:L})));const B=await(0,E.osscontrollerCompossdir)().catch((e=>{throw new Error(e)}));const{componentDir:j}=B.data;const U=await(0,E.osscontrollerPutpolicy)({type:j}).catch((async e=>{await(0,_.compcontrollerDelete)({compId:L}).catch((()=>{throw new Error(e)}));throw new Error(e)}));await this.uploadFolderToOss({compFullPath:v,version:I,ossData:U.data}).catch((async e=>{await(0,_.compcontrollerDelete)({compId:L}).catch((e=>{throw new Error(e)}));throw new o.httpError.BadRequestError(e)}));const{key:q}=U.data;await(0,_.compcontrollerUpdateobjectid)({compId:L,objectId:`${j}${q}`}).catch((async e=>{await(0,_.compcontrollerDelete)({compId:L}).catch((e=>{throw new Error(e)}));throw new Error(e)}))}async updateComp(e){const{compId:r,compPath:n,dep:i,previewConfigs:s,desc:u,bgColor:g}=e;const v=this.getCompFullPath(n);const b=await this.getCompHashMap(v);const x=this.checkCompEntryIndex(n);if(!x){throw new o.httpError.BadRequestError("组件入口文件不存在")}const T=await(0,_.compcontrollerInfobyid)({compId:r}).catch((e=>{throw new Error(e)}));const{objectId:w,version:C}=T.data;const A=a.basename(v);const k=await this.readCompVersion(n);const P=await(0,p.readDirRecursively)(v);const I=P.map((e=>({name:a.basename(e),size:c.statSync(e).size,path:e.replace(v,"").replaceAll(a.sep,"/")})));const R=await(0,_.compcontrollerUpdate)({compId:r,name:A,dep:i,previewConfigs:s,desc:u,version:k,size:await this.getCompSize(n),files:I,bgColor:g,hashMap:b}).catch((e=>{throw new Error(e)}));const{isFileChange:N}=R.data;if(!N&&C===k){return}const L=await(0,E.osscontrollerCompossdir)().catch((e=>{throw new Error(e)}));const{componentDir:B}=L.data;const j=await(0,E.osscontrollerPutpolicy)({type:B}).catch((e=>{throw new Error(e)}));const U={...j.data,key:w.replace(j.data.dir,"")};await this.uploadFolderToOss({compFullPath:v,version:k,ossData:U}).catch((async e=>{throw new o.httpError.BadRequestError(e)}));await this.updateCompJson(n,(e=>({...e,name:A,__id__:r})))}async downloadComp(e){const{compId:r,savePath:n,isCover:i,compName:s,version:o}=e;const{srcPath:u}=this.configService.comphubConfig();const g=n.replace(b.default.FILE_MANAGER_DIRNAME.dirname,"").replace(/[/\\]/g,a.sep);const v=a.join(u,g,s);if(!i&&c.existsSync(v)){return{isRepeat:true}}const E=w.tmpdir();this.ctx.logger.debug("临时文件夹",E);const x=a.join(E,b.default.COMP_TEMP_DIR);const T=await(0,_.compcontrollerInfobyid)({compId:r,version:o}).catch((e=>{throw new Error(e)}));const{files:A,objectId:k}=T.data;const P=a.join(x,k,s,o);const{files:I}=await(0,p.readDirRecursively)(P).then((e=>({files:e}))).catch((()=>({files:[]})));if(A.length===I.length){await C.copy(P,v);this.ctx.logger.debug("组件缓存文件和服务器文件一致,直接复制缓存文件");return}const R=await(0,_.compcontrollerDownload)({compId:r,version:o}).catch((e=>{throw new Error(e)}));const{files:N,version:L,compName:B}=R.data;const j=N.map((e=>{const r=a.join(k,B,L,e.path);return{path:r.replace(/[/\\]/g,"/")}}));const U=await this.ossService.getDownloadSts();await this.ossService.downloadFileToPath(U,j,x);const q=a.join(x,k,B,L);await C.copy(q,v)}async findCompJsonPath(e){const r=await(0,p.readDirRecursively)(e);this.ctx.logger.debug("项目文件数量:",r.length);const n=r.filter((e=>e.endsWith("comp.json")));return n}async getCompById(e){const{srcPath:r}=this.configService.comphubConfig();this.ctx.logger.debug("srcPath",r);const n=await this.findCompJsonPath(r);this.ctx.logger.debug("组件文件数量:",n.length);const i=n.map((async e=>{const r=await c.promises.readFile(e,"utf8");const n=JSON.parse(r);return{...n,path:a.dirname(e)}}));const s=await Promise.all(i);const o=s.find((r=>r.__id__===e));if(!o){return null}this.ctx.logger.debug("compFile:",o);const u=b.default.FILE_MANAGER_DIRNAME.dirname;const escapeRegExp=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");const p={path:u+o.path.replace(r,"").replace(new RegExp(escapeRegExp(a.sep),"g"),"/").slice(1),dirname:u,basename:a.basename(o.path)};return p}async getCompFilesOssSignedUrl(e){const{compName:r,version:n,objectId:i,files:s}=e;const o=await this.ossService.getDownloadSts();const c=s.map((async e=>{const s=a.join(i,r,n,e);const c=await this.ossService.getFilePreviewUrl(o,s.replace(/[/\\]/g,"/"));return{path:e,signedUrl:c}}));const u=await Promise.all(c);return{signedUrls:u}}async getPackageJsonContent(){const e=this.configService.comphubConfig();return(0,v.getPackageJson)(e.cwd)}};i([(0,o.App)(),s("design:type",Object)],A.prototype,"app",void 0);i([(0,o.Inject)(),s("design:type",u.ConfigService)],A.prototype,"configService",void 0);i([(0,o.Inject)(),s("design:type",x.OssService)],A.prototype,"ossService",void 0);i([(0,o.Inject)(),s("design:type",T.HashService)],A.prototype,"hashService",void 0);i([(0,o.Inject)(),s("design:type",Object)],A.prototype,"ctx",void 0);A=i([(0,o.Provide)()],A);r.CompService=A},15766:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.ConfigService=void 0;const o=n(45573);const a=n(16928);let c=class ConfigService{comphubConfig(){const e=this.app.getAttr("comphubConfig");return e}otherConfig(){return{pathSeparator:a.sep}}};i([(0,o.App)(),s("design:type",Object)],c.prototype,"app",void 0);c=i([(0,o.Provide)()],c);r.ConfigService=c},64648:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.HashService=void 0;const o=n(45573);const a=n(25147);const c=n(99579);const u=n(39565);let p=class HashService{async getDirHashList(e){const r=await(0,a.readDirRecursively)(e);const n=await Promise.all(r.map((async e=>{const{hash:r,fileContent:n}=await(0,c.getFileHash)(e);const i={path:e,hash:r};if(e.endsWith(".vue")){const e=await(0,u.vueSyntaxString)(n);i.fuzzyHash=await(0,c.getStringFuzzyHash)(e);i.blockSize=parseInt(i.fuzzyHash.split(":")[0],10);i.prefix=i.fuzzyHash.split(":")[1].slice(0,16)}return i})));const i=[...n].sort(((e,r)=>e.path.localeCompare(r.path)));return i}};i([(0,o.App)(),s("design:type",Object)],p.prototype,"app",void 0);p=i([(0,o.Provide)()],p);r.HashService=p},66959:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.OssService=void 0;const o=n(45573);const a=n(96454);const c=n(87269);const u=n(25147);const p=n(14391);const g=n(16928);const v=n(79896);const b=n(16378);const _=n(5808);const E=n(96878);const x=n(22296);const T=n(3706);let w=class OssService{async getDownloadSts(){const e=await this.cache.get(_.default.CACHE_KEY.STS_TOKEN);if(e){return e}const r=await(0,E.osscontrollerGetsts)().catch((e=>{throw new Error(e)}));const n=new Date(r.data.Expiration).getTime()-1*60*1e3;await this.cache.set(_.default.CACHE_KEY.STS_EXPIRE_TIME,n);const i=n-Date.now();this.ctx.logger.debug("STS过期时间",T(n).format("YYYY-MM-DD HH:mm:ss"));this.cache.set(_.default.CACHE_KEY.STS_TOKEN,r.data,i);return r.data}createOssClient(e){const r={endpoint:_.default.OSS_CUSTOM_DOMAIN,authorizationV4:true,cname:true,...e};return new p(r)}createOssFormData(e,r){const n=new a;const i=e.dir+e.key;n.append("success_action_status","200");n.append("policy",e.policy);n.append("x-oss-signature",e.signature);n.append("x-oss-signature-version",e.x_oss_signature_version);n.append("x-oss-credential",e.x_oss_credential);n.append("x-oss-date",e.x_oss_date);n.append("key",i);n.append("x-oss-security-token",e.security_token);n.append("x-oss-forbid-overwrite","true");n.append("Cache-Control","public, max-age=31536000");n.append("file",r);return{host:e.host,filePath:i,formData:n}}async uploadFileToOss(e,r){const{host:n,formData:i}=this.createOssFormData(e,r);const s=await c.default.post(n,i,{headers:{...i.getHeaders()}}).catch((async e=>{const r=e.response.data;const n=await(0,u.parseXml)(r).catch((()=>{throw new Error("解析xml失败")}));if(n?.Error){throw new Error(n.Error.Message)}throw new Error("组件上传失败")}));if(s.status!==200){throw new Error(s.data)}}async downloadFileToPath(e,r,n){const i=this.createOssClient({region:e.region,accessKeyId:e.AccessKeyId,accessKeySecret:e.AccessKeySecret,stsToken:e.SecurityToken,bucket:e.bucket,refreshSTSToken:async()=>{const e=await this.getDownloadSts();return{accessKeyId:e.AccessKeyId,accessKeySecret:e.AccessKeySecret,stsToken:e.SecurityToken}}});const s=r.map((async e=>{const{path:r}=e;const s=g.join(n,r);const o=g.dirname(s);if(!v.existsSync(o)){v.mkdirSync(o,{recursive:true})}return await i.get(r,s)}));return await Promise.all(s)}async getFilePreviewUrl(e,r){const n=x(r);const i=await this.cache.get(_.default.CACHE_KEY.STS_EXPIRE_TIME);const s=await this.cache.get(n);const o=Math.floor((Number(i)-Date.now())/1e3);if(s&&o>0){return s}const a=this.createOssClient({region:e.region,accessKeyId:e.AccessKeyId,accessKeySecret:e.AccessKeySecret,stsToken:e.SecurityToken,bucket:e.bucket,refreshSTSToken:async()=>{const e=await this.getDownloadSts();return{accessKeyId:e.AccessKeyId,accessKeySecret:e.AccessKeySecret,stsToken:e.SecurityToken}}});this.ctx.logger.debug("文件地址过期时间:",o,"秒",Math.floor(o/60),"分钟");const c=a.signatureUrl(r,{expires:o});await this.cache.set(n,c,o*1e3);this.ctx.logger.debug("缓存预览URL",r);return c}};i([(0,o.Inject)(),s("design:type",Object)],w.prototype,"ctx",void 0);i([(0,o.InjectClient)(b.CachingFactory,"default"),s("design:type",Object)],w.prototype,"cache",void 0);w=i([(0,o.Provide)()],w);r.OssService=w},8492:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.TerminalService=void 0;const o=n(45573);const a=n(35317);const c=n(15766);const u=n(9367);const p=n(20629);const g=n(73024);const v=n(51455);const b=n(25147);const _=n(67855);let E=class TerminalService{constructor(){this.subprocess=null;this.cwd="";this.tabIndex=0}getPrompt(){return`${this.cwd}`}smartDecode(e){if(!e||e.length===0)return"";const r=p.detect(e)||"gbk";return u.decode(e,r)}async shutdown(e=5e3){const r=this.subprocess;if(!r||r.killed){this.ctx.emit("output",{cwd:this.getPrompt()});return}return new Promise((n=>{let i=false;const done=()=>{if(!i){i=true;n(0)}};r.once("exit",done);_(r.pid,"SIGTERM",(e=>{if(e){this.ctx.emit("output",{err:e.message})}}));const s=setTimeout((()=>{_(r.pid,"SIGKILL",(e=>{if(e){this.ctx.emit("output",{err:e.message})}done()}))}),e);r.once("exit",(()=>clearTimeout(s)))}))}async folderExists(e){try{await(0,v.access)(e,g.constants.F_OK|g.constants.R_OK);return true}catch{return false}}async execCmd({cwd:e,oldCwd:r,command:n}){if(!await this.folderExists(e)){this.ctx.emit("output",{err:`${e} 路径不存在`});this.ctx.emit("output",{cwd:r});return}this.cwd=e;if(!n.trim()){this.ctx.emit("output",{cwd:this.getPrompt()});return}if(n==="^C"){await this.shutdown();return}this.subprocess=(0,a.spawn)(n,{shell:true,cwd:e,stdio:["pipe","pipe","pipe"]});this.subprocess.stdout.on("data",(e=>{this.ctx.emit("output",{stdout:this.smartDecode(e)})}));this.subprocess.stderr.on("data",(e=>{this.ctx.emit("output",{stderr:this.smartDecode(e)})}));this.subprocess.on("close",((e,r)=>{this.subprocess=null;this.ctx.emit("output",{cwd:this.getPrompt(),command:n})}));this.subprocess.on("error",(e=>{this.ctx.emit("output",{err:e.message})}))}async cmdTab({cwd:e,lastWord:r}){let n=await(0,b.readDirFiles)(e);if(r){n=n.filter((e=>e.name.startsWith(r)))}if(n.length===0){return}this.tabIndex=(this.tabIndex+1)%n.length;const i=n[this.tabIndex];this.ctx.emit("output",{tab:i.name})}};i([(0,o.Inject)(),s("design:type",c.ConfigService)],E.prototype,"configService",void 0);i([(0,o.Inject)(),s("design:type",Object)],E.prototype,"ctx",void 0);E=i([(0,o.Provide)()],E);r.TerminalService=E},87360:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.VuefinderService=void 0;const o=n(45573);const a=n(16928);const c=n(79896);const u=n(5808);const p=n(15766);let g=class VuefinderService{async getVuefinder(e,r){const n=u.default.FILE_MANAGER_DIRNAME;const{srcPath:i}=this.configService.comphubConfig();const s=e||n.dirname;if(e){e=e.replace(n.dirname,`${i}${a.sep}`)}const o=e||i;const p=await c.promises.readdir(o);const g=p.map((async e=>{const r=a.join(o,e);const i=await c.promises.stat(r);const u=s===n.dirname?`${s}${e}`:`${s}/${e}`;return{type:i.isDirectory()?"dir":"file",path:u,visibility:"public",last_modified:Math.floor(i.mtimeMs/1e3),extra_metadata:[],basename:e,file_size:i.size,extension:a.extname(e).slice(1),storage:n.storages[0],dirname:n.dirname}}));const v=await Promise.all(g);v.sort(((e,r)=>{if(e.type!==r.type){return e.type==="dir"?-1:1}return e.basename.localeCompare(r.basename)}));if(r==="index"){return{adapter:n.adapter,storages:n.storages,dirname:s,files:[...v]}}else if(r==="subfolders"){const e=v.filter((e=>e.type==="dir")).map((e=>({adapter:n.adapter,path:e.path,basename:e.basename})));return e}}};i([(0,o.App)(),s("design:type",Object)],g.prototype,"app",void 0);i([(0,o.Inject)(),s("design:type",p.ConfigService)],g.prototype,"configService",void 0);g=i([(0,o.Provide)()],g);r.VuefinderService=g},35505:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.TerminalSocketController=void 0;const o=n(45573);const a=n(8492);let c=class TerminalSocketController{async onConnection(){this.ctx.logger.debug(`新客户端连接:${this.ctx.id}`)}async onDisConnection(){this.ctx.logger.debug(`客户端断开连接:${this.ctx.id}`);await this.terminalService.shutdown()}async onCommand(e){this.terminalService.execCmd(e)}async onTab(e){this.terminalService.cmdTab(e)}};i([(0,o.Inject)(),s("design:type",Object)],c.prototype,"ctx",void 0);i([(0,o.Inject)(),s("design:type",a.TerminalService)],c.prototype,"terminalService",void 0);i([(0,o.OnWSConnection)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],c.prototype,"onConnection",null);i([(0,o.OnWSDisConnection)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],c.prototype,"onDisConnection",null);i([(0,o.OnWSMessage)("command"),s("design:type",Function),s("design:paramtypes",[Object]),s("design:returntype",Promise)],c.prototype,"onCommand",null);i([(0,o.OnWSMessage)("tab"),s("design:type",Function),s("design:paramtypes",[Object]),s("design:returntype",Promise)],c.prototype,"onTab",null);c=i([(0,o.WSController)("/terminal")],c);r.TerminalSocketController=c},99579:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.getStringFuzzyHash=r.getStringHash=r.getFileHash=void 0;const i=n(79896);const s=n(76982);const o=n(93177);async function getFileHash(e,r="sha256"){try{const n=await i.promises.readFile(e,"utf8");return{hash:(0,s.createHash)(r).update(n).digest("hex"),fileContent:n}}catch(r){console.error(`计算文件哈希失败: ${e}`,r.message);return null}}r.getFileHash=getFileHash;function getStringHash(e,r="sha256"){return(0,s.createHash)(r).update(e).digest("hex")}r.getStringHash=getStringHash;function getStringFuzzyHash(e){return o.digest(e)}r.getStringFuzzyHash=getStringFuzzyHash},25147:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.readPackageJson=r.getVueVersion=r.readDirFiles=r.parseXml=r.calculateHash=r.validateVersion=r.dirSize=r.readFileTree=r.readDirRecursively=void 0;const i=n(79896);const s=n(16928);const o=n(76982);const a=n(758).parseString;async function readDirRecursively(e,r){const defaultFilter=(e,r)=>!(r.isDirectory()&&r.name==="node_modules");const n=r??defaultFilter;async function walk(e,r){const o=await i.promises.readdir(e,{withFileTypes:true});await Promise.all(o.map((async i=>{const o=s.resolve(e,i.name);const a=await n(o,i);if(!a)return;if(i.isDirectory()){await walk(o,r)}else if(i.isFile()){r.push(o)}})))}const o=[];await walk(e,o);return o}r.readDirRecursively=readDirRecursively;async function readFileTree(e){const r=await i.promises.stat(e);if(!r.isDirectory()){throw new Error(`${e} is not a directory`)}async function buildFileTree(e){const r=s.basename(e);const n=await i.promises.stat(e);if(!n.isDirectory()){return{name:r,path:e,type:"file"}}const o={name:r,path:e,type:"directory",children:[]};const a=await i.promises.readdir(e,{withFileTypes:true});for(const r of a){const n=s.join(e,r.name);const i=await buildFileTree(n);o.children.push(i)}return o}return buildFileTree(e)}r.readFileTree=readFileTree;async function dirSize(e){let r=0;const n=await i.promises.readdir(e,{withFileTypes:true});await Promise.all(n.map((async n=>{const o=s.join(e,n.name);if(n.isDirectory()){r+=await dirSize(o)}else{r+=(await i.promises.stat(o)).size}})));return r}r.dirSize=dirSize;function validateVersion(e){const r=/^\d+\.\d+\.\d+$/;return r.test(e)}r.validateVersion=validateVersion;function calculateHash(e){return(0,o.createHash)("sha256").update(e).digest("hex").slice(0,8)}r.calculateHash=calculateHash;function parseXml(e){return new Promise(((r,n)=>{a(e,((e,i)=>{if(e){n(e);return}r(i)}))}))}r.parseXml=parseXml;async function readDirFiles(e){const r=await i.promises.readdir(e,{withFileTypes:true});return r.map((e=>({...e,type:e.isDirectory()?"directory":"file"})))}r.readDirFiles=readDirFiles;function getVueVersion(e){if(e.startsWith("2")||e.startsWith("~2")||e.startsWith("^2")){return 2}if(e.startsWith("3")||e.startsWith("~3")||e.startsWith("^3")){return 3}throw new Error("vue版本错误")}r.getVueVersion=getVueVersion;async function readPackageJson(e){const r=await i.promises.readFile(e,"utf8");const n=JSON.parse(r);return n}r.readPackageJson=readPackageJson},15199:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.prebundleAll=r.getModuleEntry=r.getPackageJson=void 0;const i=n(30765);const s=n(16928);const o=n(79896);const a=n(64713);const c=n(25147);const u=n(45573);function findModuleVersion(e,r){if(e.dependencies&&e.dependencies[r]){return e.dependencies[r]}if(e.devDependencies&&e.devDependencies[r]){return e.devDependencies[r]}return null}async function getPackageJson(e){const r=s.join(e,"package.json");return(0,c.readPackageJson)(r)}r.getPackageJson=getPackageJson;async function getModuleEntry(e,r){const n=await getPackageJson(r);const s=findModuleVersion(n,"vue");const o=await(0,i.detectImports)(e,["@"],s);const a=o.thirdParty;if(!a["vue"]){a["vue"]={default:false}}for(const e in a){a[e].version=findModuleVersion(n,e)}return o}r.getModuleEntry=getModuleEntry;async function prebundleAll(e,r,n){const i=await getPackageJson(n);const p=r.reduce(((e,r)=>{const n=findModuleVersion(i,r);if(!n){return e}if(r==="vue"){const i=(0,c.getVueVersion)(n);if(i===3){e[r]="vue/dist/vue.esm-bundler.js"}else{e[r]=r}}else{e[r]=r}return e}),{});await o.promises.mkdir(e,{recursive:true});const g={entryPoints:p,bundle:true,format:"esm",splitting:true,outdir:e,entryNames:"[name]-[hash]",chunkNames:"chunk-[hash]",outExtension:{".js":".js"},metafile:true,write:true,target:"esnext",sourcemap:false};if(process.env.NODE_ENV==="local"){const e=(0,u.getCurrentApplicationContext)();const r=await e.getAsync("configService");const{cwd:n}=r.comphubConfig();g.absWorkingDir=n;g.nodePaths=[s.join(n,"node_modules")]}try{const e=await(0,a.build)(g);const r={};for(const[n,i]of Object.entries(e.metafile.outputs)){if(i.entryPoint){const e=Object.keys(p);const i=e.find((e=>n.includes(e)));r[i]=s.basename(n)}}return{entryNameToFile:r}}catch(e){return{error:String(e)}}}r.prebundleAll=prebundleAll},10954:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.setHeader=void 0;const i=n(87269);let s=null;const setHeader=e=>{s=e};r.setHeader=setHeader;const o=i.default.create({timeout:1e4});o.interceptors.request.use((e=>{e.headers["authorization"]=s.authorization;e.headers["x-csrf-token"]=s["x-csrf-token"];e.headers["cookie"]=s.cookie;return e}),(e=>Promise.reject(e)));o.interceptors.response.use((async e=>{if(e.data.code!==0){return Promise.reject(JSON.stringify(e.data))}return e.data}),(e=>Promise.reject(e)));r["default"]=o},39565:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.vueSyntaxString=void 0;const i=n(81192);const s=n(91489);const o=n(5429);const a=n(50148);const c=n(12123);const u=n(4145);function getAst(e){const r=(0,o.parse)(e,{sourceType:"module",errorRecovery:true,plugins:["typescript","jsx"]});(0,a.default)(r,{VariableDeclaration(e){if(e.node.declarations.length<=1)return;const{kind:r,declarations:n}=e.node;e.replaceWithMultiple(n.map((e=>({type:"VariableDeclaration",kind:r,declarations:[e]}))))}});return r}function getBindingNames(e){const r=[];const walk=e=>{if(!e)return;if(e.type==="Identifier")r.push(e.name);if(e.type==="ArrayPattern")e.elements.forEach(walk);if(e.type==="ObjectPattern")e.properties.forEach((e=>walk(e.key||e.value)));if(e.type==="RestElement")walk(e.argument);if(e.type==="AssignmentPattern")walk(e.left)};walk(e);return r}function removeUnusedVariables(e){const r=new Set;(0,a.default)(e,{ReferencedIdentifier(e){r.add(e.node.name)}});(0,a.default)(e,{VariableDeclarator(e){const n=getBindingNames(e.node.id);if(n.length&&!n.some((e=>r.has(e)))){e.remove()}},FunctionDeclaration(e){if(e.node.id&&!r.has(e.node.id.name)){e.remove()}}})}function renameVariables(e){let r=0;const n=new Map;(0,a.default)(e,{Identifier(e){const{node:i,parent:s}=e;if(s.type==="VariableDeclarator"&&s.id===i||s.type==="FunctionDeclaration"&&s.id===i){if(!n.has(i.name))n.set(i.name,`v${r++}`);i.name=n.get(i.name)}if(n.has(i.name))i.name=n.get(i.name)},NumericLiteral(e){e.node.value=0},StringLiteral(e){e.node.value="S"},ObjectExpression(e){e.node.properties.forEach((e=>{if(e.type==="ObjectProperty"&&!e.computed&&(e.key.type==="StringLiteral"||e.key.type==="NumericLiteral")){e.key.type="StringLiteral";e.key.value="S"}}))}})}async function processVueTemplate(e){const r=await(0,u.minify)(e,{removeComments:true,collapseWhitespace:true,removeEmptyElements:false,caseSensitive:true,trimCustomFragments:true});const{code:n}=(0,i.compileTemplate)({source:r,filename:"component.vue",id:"template"});return n.replace(/\s+/g," ").trim()}async function vueSyntaxString(e){let r="";const{descriptor:n}=(0,i.parse)(e);const o=n.script||n.scriptSetup;if(!o)return r;const a=await(0,s.minify)(o.content);if(!a.code)return r;const u=getAst(a.code);removeUnusedVariables(u);renameVariables(u);const{code:p}=(0,c.default)(u,{comments:false});r+=p.replace(/\s+/g," ").trim();if(n.template){const e=await processVueTemplate(n.template.content);r+=e}return r}r.vueSyntaxString=vueSyntaxString},30765:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.detectImports=void 0;const i=n(16928);const s=n(79896);const o=n(5429);const a=n(81192);const c=n(50148);const u=n(98995);const p=n(25147);const isBuiltin=e=>u.builtinModules.includes(e)||u.builtinModules.includes(`node:${e}`);const getUIlibsNameByTag=(e,r)=>{const n=[];for(const i of e){if(i.startsWith("el-")){const e=(0,p.getVueVersion)(r);if(e===2){n.push("element-ui")}else if(e===3){n.push("element-plus")}}}return n};const walk=(e,r=new Set)=>{if(!e)return r;if(e.type===1){const n=e.tag;if(/^[a-z]/.test(n)&&n.includes("-")){r.add(n)}if(e.children&&e.children.length){e.children.forEach((e=>walk(e,r)))}}if(e.children&&e.children.length){e.children.forEach((e=>walk(e,r)))}return r};const collectTargetFiles=async(e,r=[".js",".ts",".vue"])=>{const n=[];const walk=async e=>{const o=await s.promises.readdir(e,{withFileTypes:true});for(const s of o){const o=i.join(e,s.name);if(s.isDirectory())await walk(o);else if(r.some((e=>s.name.endsWith(e))))n.push(o)}};await walk(e);return n};const readCode=async e=>{try{const r=await s.promises.readFile(e,"utf8");if(e.endsWith(".vue")){const{descriptor:e}=(0,a.parse)(r);const n=e.scriptSetup?.content??e.script?.content??null;const i=e?.template??null;return{script:n,template:i}}return{script:r}}catch{return null}};const extractDetailsFromSpecifiers=(e,r)=>{const n={default:false,named:[],namespace:false,files:[r]};e.forEach((e=>{switch(e.type){case"ImportDefaultSpecifier":n.default=true;break;case"ImportNamespaceSpecifier":n.namespace=true;break;case"ImportSpecifier":{const r=e.imported.type==="Identifier"?e.imported.name:e.imported.value;if(!n.named.includes(r))n.named.push(r);break}}}));return n};const getImportType=(e,r)=>{if(e.startsWith("./")||e.startsWith("../"))return"relative-path";const n=e.split("/")[0];const i=r.some((r=>e.startsWith(`${r}/`)));if(!isBuiltin(n)&&!i&&!e.startsWith("/"))return"third-party";return"unknown"};const mergeImportDetails=(e,r)=>({default:e.default||r.default,named:[...new Set([...e.named,...r.named])],namespace:e.namespace||r.namespace,files:[...new Set([...e.files,...r.files])]});const parseImportsInFile=async e=>{const{script:r,template:n}=await readCode(e);if(!r)return{uiLibs:[],imports:[],template:n};const i=o.parse(r,{sourceType:"module",plugins:["jsx","typescript","importMeta","topLevelAwait"]});const s=[];(0,c.default)(i,{ImportDeclaration(r){s.push({source:r.node.source.value,...extractDetailsFromSpecifiers(r.node.specifiers,e)})}});return{template:n,imports:s}};const mergeThirdParty=(e,r)=>{for(const n of r){if(!e.has(n)){if(n==="element-ui"){e.set(n,{default:true})}else if(n==="element-plus"){e.set(n,{default:false})}}}};async function detectImports(e,r=["@"],n){const s=i.resolve(e);const o=await collectTargetFiles(s);let a=[];const c=new Map;const u=new Map;for(const e of o){const{template:i,imports:s}=await parseImportsInFile(e);if(i){const e=walk(i?.ast);const r=getUIlibsNameByTag([...e],n);a=[...new Set([...a,...r])]}for(const{source:e,...n}of s){const i=getImportType(e,r);const s={...n};const o=i==="third-party"?c:u;const a=i==="third-party"?e.split("/")[0]:e;const p=o.get(a);o.set(a,p?mergeImportDetails(p,s):s)}}mergeThirdParty(c,a);return{thirdParty:Object.fromEntries(c),unknown:Object.fromEntries(u)}}r.detectImports=detectImports},33845:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.CompSimilarListVO=r.CompFilesOssSignedUrlVo=r.DownloadCompVo=r.CompByIdVo=r.OtherConfigVo=r.ComphubConfigVo=r.PreBuildVo=r.ImportScanResultVo=r.CompCheckVo=r.CompFileContentVo=r.CompFileVo=r.FileType=r.CompSimilarListItemVO=void 0;const o=n(66466);class CompSimilarListItemVO{}i([(0,o.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件ID",required:true}),s("design:type",String)],CompSimilarListItemVO.prototype,"id",void 0);i([(0,o.ApiProperty)({example:"组件名称",description:"组件名称",required:true}),s("design:type",String)],CompSimilarListItemVO.prototype,"name",void 0);r.CompSimilarListItemVO=CompSimilarListItemVO;var a;(function(e){e["FILE"]="file";e["DIRECTORY"]="directory"})(a=r.FileType||(r.FileType={}));class CompFileVo{}i([(0,o.ApiProperty)({description:"组件文件名称",example:"index.vue",required:true}),s("design:type",String)],CompFileVo.prototype,"name",void 0);i([(0,o.ApiProperty)({description:"组件文件路径",example:"/src/components/MyComp/index.vue",required:true}),s("design:type",String)],CompFileVo.prototype,"path",void 0);i([(0,o.ApiProperty)({description:"组件文件类型",example:"file",required:true,enum:a}),s("design:type",String)],CompFileVo.prototype,"type",void 0);i([(0,o.ApiProperty)({description:"子节点",type:"array",items:{$ref:()=>(0,o.getSchemaPath)(CompFileVo)}}),s("design:type",Array)],CompFileVo.prototype,"children",void 0);r.CompFileVo=CompFileVo;class CompFileContentVo{}i([(0,o.ApiProperty)({description:"组件文件内容",example:'import { defineComponent } from "vue";\n\nexport default defineComponent({...})',required:true}),s("design:type",String)],CompFileContentVo.prototype,"content",void 0);r.CompFileContentVo=CompFileContentVo;class CompCheckVo{}i([(0,o.ApiProperty)({description:"组件入口文件",required:true}),s("design:type",String)],CompCheckVo.prototype,"entryIndex",void 0);i([(0,o.ApiProperty)({description:"组件配置文件",required:true}),s("design:type",String)],CompCheckVo.prototype,"compHash",void 0);i([(0,o.ApiProperty)({description:"组件配置文件检查结果",required:true}),s("design:type",String)],CompCheckVo.prototype,"compJsonIsOk",void 0);r.CompCheckVo=CompCheckVo;class ImportDetailVo{}i([(0,o.ApiProperty)({description:"是否默认导入",example:false,required:true}),s("design:type",Boolean)],ImportDetailVo.prototype,"default",void 0);i([(0,o.ApiProperty)({description:"命名导入列表",type:[String],example:["ElButton"],required:false}),s("design:type",Array)],ImportDetailVo.prototype,"named",void 0);i([(0,o.ApiProperty)({description:"是否命名空间导入",example:false,required:false}),s("design:type",Boolean)],ImportDetailVo.prototype,"namespace",void 0);i([(0,o.ApiProperty)({description:"涉及文件列表",type:[String],required:false}),s("design:type",Array)],ImportDetailVo.prototype,"files",void 0);i([(0,o.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),s("design:type",String)],ImportDetailVo.prototype,"version",void 0);class ImportScanResultVo{}i([(0,o.ApiProperty)({type:"object",required:true,additionalProperties:{type:()=>ImportDetailVo}}),s("design:type",Object)],ImportScanResultVo.prototype,"thirdParty",void 0);i([(0,o.ApiProperty)({type:"object",additionalProperties:{type:()=>ImportDetailVo}}),s("design:type",Object)],ImportScanResultVo.prototype,"unknown",void 0);r.ImportScanResultVo=ImportScanResultVo;class PreBuildVo{}i([(0,o.ApiProperty)({description:"预构建模块对应文件",required:false,example:{vue:"vue-hash.js"}}),s("design:type",Object)],PreBuildVo.prototype,"entryNameToFile",void 0);i([(0,o.ApiProperty)({description:"错误信息",required:false,example:"报错信息"}),s("design:type",String)],PreBuildVo.prototype,"error",void 0);r.PreBuildVo=PreBuildVo;class ComphubConfigVo{}i([(0,o.ApiProperty)({description:"组件库网站目录",required:true,example:"/src/components"}),s("design:type",String)],ComphubConfigVo.prototype,"websitePath",void 0);i([(0,o.ApiProperty)({description:"当前工作目录",required:true,example:"/src/components"}),s("design:type",String)],ComphubConfigVo.prototype,"cwd",void 0);i([(0,o.ApiProperty)({description:"当前服务器启动端口",required:true,example:3e3}),s("design:type",Number)],ComphubConfigVo.prototype,"port",void 0);i([(0,o.ApiProperty)({description:"组件库源目录",required:true,example:"/src/components"}),s("design:type",String)],ComphubConfigVo.prototype,"srcPath",void 0);r.ComphubConfigVo=ComphubConfigVo;class OtherConfigVo{}i([(0,o.ApiProperty)({description:"系统路径分隔符",required:true,example:"\\"}),s("design:type",String)],OtherConfigVo.prototype,"pathSeparator",void 0);r.OtherConfigVo=OtherConfigVo;class CompByIdVo{}i([(0,o.ApiProperty)({description:"组件文件路径",example:"local:///MyComp/index.vue",required:true}),s("design:type",String)],CompByIdVo.prototype,"path",void 0);i([(0,o.ApiProperty)({description:"文件选择器目录别名",example:"local://",required:true}),s("design:type",String)],CompByIdVo.prototype,"dirname",void 0);r.CompByIdVo=CompByIdVo;class DownloadCompVo{}i([(0,o.ApiProperty)({description:"组件是否重复",example:true,required:true}),s("design:type",Boolean)],DownloadCompVo.prototype,"isRepeat",void 0);r.DownloadCompVo=DownloadCompVo;class signedUrlItem{}i([(0,o.ApiProperty)({description:"文件路径",example:"/src/components/MyComp/index.vue",required:true}),s("design:type",String)],signedUrlItem.prototype,"path",void 0);i([(0,o.ApiProperty)({description:"文件oss签名访问地址",example:"https://comp-hub.oss-cn-beijing.aliyuncs.com/src/components/MyComp/index.vue?x-oss-security-token=...",required:true}),s("design:type",String)],signedUrlItem.prototype,"signedUrl",void 0);let c=class CompFilesOssSignedUrlVo{};i([(0,o.ApiProperty)({description:"文件oss签名访问地址列表",type:"array",items:{$ref:(0,o.getSchemaPath)(signedUrlItem)},required:true}),s("design:type",Array)],c.prototype,"signedUrls",void 0);c=i([(0,o.ApiExtraModel)(signedUrlItem)],c);r.CompFilesOssSignedUrlVo=c;let u=class CompSimilarListVO{};i([(0,o.ApiProperty)({type:"array",items:{$ref:(0,o.getSchemaPath)(CompSimilarListItemVO)},description:"相似组件列表",required:true}),s("design:type",Array)],u.prototype,"similarList",void 0);u=i([(0,o.ApiExtraModel)(CompSimilarListItemVO)],u);r.CompSimilarListVO=u},2809:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.SignedUrlVO=void 0;const o=n(66466);class SignedUrlVO{}i([(0,o.ApiProperty)({example:"xxxx",description:"带签名的访问地址",required:true}),s("design:type",String)],SignedUrlVO.prototype,"signUrl",void 0);r.SignedUrlVO=SignedUrlVO},55664:(e,r)=>{"use strict";const n={suspectRx:/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*\:/};r.parse=function(e,...i){const s=typeof i[0]==="object"&&i[0];const o=i.length>1||!s?i[0]:undefined;const a=i.length>1&&i[1]||s||{};const c=JSON.parse(e,o);if(a.protoAction==="ignore"){return c}if(!c||typeof c!=="object"){return c}if(!e.match(n.suspectRx)){return c}r.scan(c,a);return c};r.scan=function(e,r={}){let n=[e];while(n.length){const e=n;n=[];for(const i of e){if(Object.prototype.hasOwnProperty.call(i,"__proto__")){if(r.protoAction!=="remove"){throw new SyntaxError("Object contains forbidden prototype property")}delete i.__proto__}for(const e in i){const r=i[e];if(r&&typeof r==="object"){n.push(i[e])}}}}};r.safeParse=function(e,n){try{return r.parse(e,n)}catch(e){return null}}},4051:(e,r,n)=>{"use strict";const i=n(15676);const s=n(7185);const o=n(41584);const a=n(73299);const c={};e.exports=function(e,r,n={}){i(e&&typeof e==="object","Invalid defaults value: must be an object");i(!r||r===true||typeof r==="object","Invalid source value: must be true, falsy or an object");i(typeof n==="object","Invalid options: must be an object");if(!r){return null}if(n.shallow){return c.applyToDefaultsWithShallow(e,r,n)}const a=s(e);if(r===true){return a}const u=n.nullOverride!==undefined?n.nullOverride:false;return o(a,r,{nullOverride:u,mergeArrays:false})};c.applyToDefaultsWithShallow=function(e,r,n){const u=n.shallow;i(Array.isArray(u),"Invalid keys");const p=new Map;const g=r===true?null:new Set;for(let n of u){n=Array.isArray(n)?n:n.split(".");const i=a(e,n);if(i&&typeof i==="object"){p.set(i,g&&a(r,n)||i)}else if(g){g.add(n)}}const v=s(e,{},p);if(!g){return v}for(const e of g){c.reachCopy(v,r,e)}const b=n.nullOverride!==undefined?n.nullOverride:false;return o(v,r,{nullOverride:b,mergeArrays:false})};c.reachCopy=function(e,r,n){for(const e of n){if(!(e in r)){return}const n=r[e];if(typeof n!=="object"||n===null){return}r=n}const i=r;let s=e;for(let e=0;e<n.length-1;++e){const r=n[e];if(typeof s[r]!=="object"){s[r]={}}s=s[r]}s[n[n.length-1]]=i}},15676:(e,r,n)=>{"use strict";const i=n(214);const s={};e.exports=function(e,...r){if(e){return}if(r.length===1&&r[0]instanceof Error){throw r[0]}throw new i(r)}},7185:(e,r,n)=>{"use strict";const i=n(73299);const s=n(60265);const o=n(53829);const a={needsProtoHack:new Set([s.set,s.map,s.weakSet,s.weakMap])};e.exports=a.clone=function(e,r={},n=null){if(typeof e!=="object"||e===null){return e}let i=a.clone;let c=n;if(r.shallow){if(r.shallow!==true){return a.cloneWithShallow(e,r)}i=e=>e}else if(c){const r=c.get(e);if(r){return r}}else{c=new Map}const u=s.getInternalProto(e);if(u===s.buffer){return Buffer&&Buffer.from(e)}if(u===s.date){return new Date(e.getTime())}if(u===s.regex){return new RegExp(e)}const p=a.base(e,u,r);if(p===e){return e}if(c){c.set(e,p)}if(u===s.set){for(const n of e){p.add(i(n,r,c))}}else if(u===s.map){for(const[n,s]of e){p.set(n,i(s,r,c))}}const g=o.keys(e,r);for(const n of g){if(n==="__proto__"){continue}if(u===s.array&&n==="length"){p.length=e.length;continue}const o=Object.getOwnPropertyDescriptor(e,n);if(o){if(o.get||o.set){Object.defineProperty(p,n,o)}else if(o.enumerable){p[n]=i(e[n],r,c)}else{Object.defineProperty(p,n,{enumerable:false,writable:true,configurable:true,value:i(e[n],r,c)})}}else{Object.defineProperty(p,n,{enumerable:true,writable:true,configurable:true,value:i(e[n],r,c)})}}return p};a.cloneWithShallow=function(e,r){const n=r.shallow;r=Object.assign({},r);r.shallow=false;const s=new Map;for(const r of n){const n=i(e,r);if(typeof n==="object"||typeof n==="function"){s.set(n,n)}}return a.clone(e,r,s)};a.base=function(e,r,n){if(n.prototype===false){if(a.needsProtoHack.has(r)){return new r.constructor}return r===s.array?[]:{}}const i=Object.getPrototypeOf(e);if(i&&i.isImmutable){return e}if(r===s.array){const e=[];if(i!==r){Object.setPrototypeOf(e,i)}return e}if(a.needsProtoHack.has(r)){const e=new i.constructor;if(i!==r){Object.setPrototypeOf(e,i)}return e}return Object.create(i)}},41058:(e,r,n)=>{"use strict";const i=n(60265);const s={mismatched:null};e.exports=function(e,r,n){n=Object.assign({prototype:true},n);return!!s.isDeepEqual(e,r,n,[])};s.isDeepEqual=function(e,r,n,o){if(e===r){return e!==0||1/e===1/r}const a=typeof e;if(a!==typeof r){return false}if(e===null||r===null){return false}if(a==="function"){if(!n.deepFunction||e.toString()!==r.toString()){return false}}else if(a!=="object"){return e!==e&&r!==r}const c=s.getSharedType(e,r,!!n.prototype);switch(c){case i.buffer:return Buffer&&Buffer.prototype.equals.call(e,r);case i.promise:return e===r;case i.regex:return e.toString()===r.toString();case s.mismatched:return false}for(let n=o.length-1;n>=0;--n){if(o[n].isSame(e,r)){return true}}o.push(new s.SeenEntry(e,r));try{return!!s.isDeepEqualObj(c,e,r,n,o)}finally{o.pop()}};s.getSharedType=function(e,r,n){if(n){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(r)){return s.mismatched}return i.getInternalProto(e)}const o=i.getInternalProto(e);if(o!==i.getInternalProto(r)){return s.mismatched}return o};s.valueOf=function(e){const r=e.valueOf;if(r===undefined){return e}try{return r.call(e)}catch(e){return e}};s.hasOwnEnumerableProperty=function(e,r){return Object.prototype.propertyIsEnumerable.call(e,r)};s.isSetSimpleEqual=function(e,r){for(const n of Set.prototype.values.call(e)){if(!Set.prototype.has.call(r,n)){return false}}return true};s.isDeepEqualObj=function(e,r,n,o,a){const{isDeepEqual:c,valueOf:u,hasOwnEnumerableProperty:p}=s;const{keys:g,getOwnPropertySymbols:v}=Object;if(e===i.array){if(o.part){for(const e of r){for(const r of n){if(c(e,r,o,a)){return true}}}}else{if(r.length!==n.length){return false}for(let e=0;e<r.length;++e){if(!c(r[e],n[e],o,a)){return false}}return true}}else if(e===i.set){if(r.size!==n.size){return false}if(!s.isSetSimpleEqual(r,n)){const e=new Set(Set.prototype.values.call(n));for(const n of Set.prototype.values.call(r)){if(e.delete(n)){continue}let r=false;for(const i of e){if(c(n,i,o,a)){e.delete(i);r=true;break}}if(!r){return false}}}}else if(e===i.map){if(r.size!==n.size){return false}for(const[e,i]of Map.prototype.entries.call(r)){if(i===undefined&&!Map.prototype.has.call(n,e)){return false}if(!c(i,Map.prototype.get.call(n,e),o,a)){return false}}}else if(e===i.error){if(r.name!==n.name||r.message!==n.message){return false}}const b=u(r);const _=u(n);if((r!==b||n!==_)&&!c(b,_,o,a)){return false}const E=g(r);if(!o.part&&E.length!==g(n).length&&!o.skip){return false}let x=0;for(const e of E){if(o.skip&&o.skip.includes(e)){if(n[e]===undefined){++x}continue}if(!p(n,e)){return false}if(!c(r[e],n[e],o,a)){return false}}if(!o.part&&E.length-x!==g(n).length){return false}if(o.symbols!==false){const e=v(r);const i=new Set(v(n));for(const s of e){if(!o.skip||!o.skip.includes(s)){if(p(r,s)){if(!p(n,s)){return false}if(!c(r[s],n[s],o,a)){return false}}else if(p(n,s)){return false}}i.delete(s)}for(const e of i){if(p(n,e)){return false}}}return true};s.SeenEntry=class{constructor(e,r){this.obj=e;this.ref=r}isSame(e,r){return this.obj===e&&this.ref===r}}},214:(e,r,n)=>{"use strict";const i=n(35265);const s={};e.exports=class extends Error{constructor(e){const n=e.filter((e=>e!=="")).map((e=>typeof e==="string"?e:e instanceof Error?e.message:i(e)));super(n.join(" ")||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,r.assert)}}}},98972:e=>{"use strict";const r={};e.exports=function(e){if(!e){return""}let n="";for(let i=0;i<e.length;++i){const s=e.charCodeAt(i);if(r.isSafe(s)){n+=e[i]}else{n+=r.escapeHtmlChar(s)}}return n};r.escapeHtmlChar=function(e){const n=r.namedHtml.get(e);if(n){return n}if(e>=256){return"&#"+e+";"}const i=e.toString(16).padStart(2,"0");return`&#x${i};`};r.isSafe=function(e){return r.safeCharCodes.has(e)};r.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]);r.safeCharCodes=function(){const e=new Set;for(let r=32;r<123;++r){if(r>=97||r>=65&&r<=90||r>=48&&r<=57||r===32||r===46||r===44||r===45||r===58||r===95){e.add(r)}}return e}()},33574:e=>{"use strict";const r={};e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},8836:e=>{"use strict";const r={};e.exports=function(){}},41584:(e,r,n)=>{"use strict";const i=n(15676);const s=n(7185);const o=n(53829);const a={};e.exports=a.merge=function(e,r,n){i(e&&typeof e==="object","Invalid target value: must be an object");i(r===null||r===undefined||typeof r==="object","Invalid source value: must be null, undefined, or an object");if(!r){return e}n=Object.assign({nullOverride:true,mergeArrays:true},n);if(Array.isArray(r)){i(Array.isArray(e),"Cannot merge array onto an object");if(!n.mergeArrays){e.length=0}for(let i=0;i<r.length;++i){e.push(s(r[i],{symbols:n.symbols}))}return e}const c=o.keys(r,n);for(let i=0;i<c.length;++i){const o=c[i];if(o==="__proto__"||!Object.prototype.propertyIsEnumerable.call(r,o)){continue}const u=r[o];if(u&&typeof u==="object"){if(e[o]===u){continue}if(!e[o]||typeof e[o]!=="object"||Array.isArray(e[o])!==Array.isArray(u)||u instanceof Date||Buffer&&Buffer.isBuffer(u)||u instanceof RegExp){e[o]=s(u,{symbols:n.symbols})}else{a.merge(e[o],u,n)}}else{if(u!==null&&u!==undefined){e[o]=u}else if(n.nullOverride){e[o]=u}}}return e}},73299:(e,r,n)=>{"use strict";const i=n(15676);const s={};e.exports=function(e,r,n){if(r===false||r===null||r===undefined){return e}n=n||{};if(typeof n==="string"){n={separator:n}}const o=Array.isArray(r);i(!o||!n.separator,"Separator option is not valid for array-based chain");const a=o?r:r.split(n.separator||".");let c=e;for(let e=0;e<a.length;++e){let o=a[e];const u=n.iterables&&s.iterables(c);if(Array.isArray(c)||u==="set"){const e=Number(o);if(Number.isInteger(e)){o=e<0?c.length+e:e}}if(!c||typeof c==="function"&&n.functions===false||!u&&c[o]===undefined){i(!n.strict||e+1===a.length,"Missing segment",o,"in reach path ",r);i(typeof c==="object"||n.functions===true||typeof c!=="function","Invalid segment",o,"in reach path ",r);c=n.default;break}if(!u){c=c[o]}else if(u==="set"){c=[...c][o]}else{c=c.get(o)}}return c};s.iterables=function(e){if(e instanceof Set){return"set"}if(e instanceof Map){return"map"}}},35265:e=>{"use strict";const r={};e.exports=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}}},60265:(e,r)=>{"use strict";const n={};r=e.exports={array:Array.prototype,buffer:Buffer&&Buffer.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype};n.typeMap=new Map([["[object Error]",r.error],["[object Map]",r.map],["[object Promise]",r.promise],["[object Set]",r.set],["[object WeakMap]",r.weakMap],["[object WeakSet]",r.weakSet]]);r.getInternalProto=function(e){if(Array.isArray(e)){return r.array}if(Buffer&&e instanceof Buffer){return r.buffer}if(e instanceof Date){return r.date}if(e instanceof RegExp){return r.regex}if(e instanceof Error){return r.error}const i=Object.prototype.toString.call(e);return n.typeMap.get(i)||r.generic}},53829:(e,r)=>{"use strict";const n={};r.keys=function(e,r={}){return r.symbols!==false?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},97541:(e,r,n)=>{"use strict";const i=n(15676);const s={};r.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(e,r){r=r||{};const n=[].concat(r.before||[]);const s=[].concat(r.after||[]);const o=r.group||"?";const a=r.sort||0;i(!n.includes(o),`Item cannot come before itself: ${o}`);i(!n.includes("?"),"Item cannot come before unassociated items");i(!s.includes(o),`Item cannot come after itself: ${o}`);i(!s.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(e)){e=[e]}for(const r of e){const e={seq:this._items.length,sort:a,before:n,after:s,group:o,node:r};this._items.push(e)}if(!r.manual){const e=this._sort();i(e,"item",o!=="?"?`added into group ${o}`:"","created a dependencies error")}return this.nodes}merge(e){if(!Array.isArray(e)){e=[e]}for(const r of e){if(r){for(const e of r._items){this._items.push(Object.assign({},e))}}}this._items.sort(s.mergeSort);for(let e=0;e<this._items.length;++e){this._items[e].seq=e}const r=this._sort();i(r,"merge created a dependencies error");return this.nodes}sort(){const e=this._sort();i(e,"sort created a dependencies error");return this.nodes}_sort(){const e={};const r=Object.create(null);const n=Object.create(null);for(const i of this._items){const s=i.seq;const o=i.group;n[o]=n[o]||[];n[o].push(s);e[s]=i.before;for(const e of i.after){r[e]=r[e]||[];r[e].push(s)}}for(const r in e){const i=[];for(const s in e[r]){const o=e[r][s];n[o]=n[o]||[];i.push(...n[o])}e[r]=i}for(const i in r){if(n[i]){for(const s of n[i]){e[s].push(...r[i])}}}const i={};for(const r in e){const n=e[r];for(const e of n){i[e]=i[e]||[];i[e].push(r)}}const s={};const o=[];for(let e=0;e<this._items.length;++e){let r=e;if(i[e]){r=null;for(let e=0;e<this._items.length;++e){if(s[e]===true){continue}if(!i[e]){i[e]=[]}const n=i[e].length;let o=0;for(let r=0;r<n;++r){if(s[i[e][r]]){++o}}if(o===n){r=e;break}}}if(r!==null){s[r]=true;o.push(r)}}if(o.length!==this._items.length){return false}const a={};for(const e of this._items){a[e.seq]=e}this._items=[];this.nodes=[];for(const e of o){const r=a[e];this.nodes.push(r.node);this._items.push(r)}return true}};s.mergeSort=(e,r)=>e.sort===r.sort?0:e.sort<r.sort?-1:1},36153:function(e,r,n){e=n.nmd(e);(function(r,i){if(true){i(e,n(69551),n(99535));e.exports=def(e)}else{}function def(e){return"default"in e.exports?e.exports.default:e.exports}})(this,(function(e,r,n){"use strict";var i=Object.create;var s=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.getPrototypeOf;var u=Object.prototype.hasOwnProperty;var __commonJS=(e,r)=>function __require(){return r||(0,e[a(e)[0]])((r={exports:{}}).exports,r),r.exports};var __export=(e,r)=>{for(var n in r)s(e,n,{get:r[n],enumerable:true})};var __copyProps=(e,r,n,i)=>{if(r&&typeof r==="object"||typeof r==="function"){for(let c of a(r))if(!u.call(e,c)&&c!==n)s(e,c,{get:()=>r[c],enumerable:!(i=o(r,c))||i.enumerable})}return e};var __toESM=(e,r,n)=>(n=e!=null?i(c(e)):{},__copyProps(r||!e||!e.__esModule?s(n,"default",{value:e,enumerable:true}):n,e));var __toCommonJS=e=>__copyProps(s({},"__esModule",{value:true}),e);var p=__commonJS({"umd:@jridgewell/sourcemap-codec"(e,n){n.exports=r}});var g=__commonJS({"umd:@jridgewell/trace-mapping"(e,r){r.exports=n}});var v={};__export(v,{GenMapping:()=>P,addMapping:()=>addMapping,addSegment:()=>addSegment,allMappings:()=>allMappings,fromMap:()=>fromMap,maybeAddMapping:()=>maybeAddMapping,maybeAddSegment:()=>maybeAddSegment,setIgnore:()=>setIgnore,setSourceContent:()=>setSourceContent,toDecodedMap:()=>toDecodedMap,toEncodedMap:()=>toEncodedMap});e.exports=__toCommonJS(v);var b=class{constructor(){this._indexes={__proto__:null};this.array=[]}};function cast(e){return e}function get(e,r){return cast(e)._indexes[r]}function put(e,r){const n=get(e,r);if(n!==void 0)return n;const{array:i,_indexes:s}=cast(e);const o=i.push(r);return s[r]=o-1}function remove(e,r){const n=get(e,r);if(n===void 0)return;const{array:i,_indexes:s}=cast(e);for(let e=n+1;e<i.length;e++){const r=i[e];i[e-1]=r;s[r]--}s[r]=void 0;i.pop()}var _=__toESM(p());var E=__toESM(g());var x=0;var T=1;var w=2;var C=3;var A=4;var k=-1;var P=class{constructor({file:e,sourceRoot:r}={}){this._names=new b;this._sources=new b;this._sourcesContent=[];this._mappings=[];this.file=e;this.sourceRoot=r;this._ignoreList=new b}};function cast2(e){return e}function addSegment(e,r,n,i,s,o,a,c){return addSegmentInternal(false,e,r,n,i,s,o,a,c)}function addMapping(e,r){return addMappingInternal(false,e,r)}var maybeAddSegment=(e,r,n,i,s,o,a,c)=>addSegmentInternal(true,e,r,n,i,s,o,a,c);var maybeAddMapping=(e,r)=>addMappingInternal(true,e,r);function setSourceContent(e,r,n){const{_sources:i,_sourcesContent:s}=cast2(e);const o=put(i,r);s[o]=n}function setIgnore(e,r,n=true){const{_sources:i,_sourcesContent:s,_ignoreList:o}=cast2(e);const a=put(i,r);if(a===s.length)s[a]=null;if(n)put(o,a);else remove(o,a)}function toDecodedMap(e){const{_mappings:r,_sources:n,_sourcesContent:i,_names:s,_ignoreList:o}=cast2(e);removeEmptyFinalLines(r);return{version:3,file:e.file||void 0,names:s.array,sourceRoot:e.sourceRoot||void 0,sources:n.array,sourcesContent:i,mappings:r,ignoreList:o.array}}function toEncodedMap(e){const r=toDecodedMap(e);return Object.assign({},r,{mappings:(0,_.encode)(r.mappings)})}function fromMap(e){const r=new E.TraceMap(e);const n=new P({file:r.file,sourceRoot:r.sourceRoot});putAll(cast2(n)._names,r.names);putAll(cast2(n)._sources,r.sources);cast2(n)._sourcesContent=r.sourcesContent||r.sources.map((()=>null));cast2(n)._mappings=(0,E.decodedMappings)(r);if(r.ignoreList)putAll(cast2(n)._ignoreList,r.ignoreList);return n}function allMappings(e){const r=[];const{_mappings:n,_sources:i,_names:s}=cast2(e);for(let e=0;e<n.length;e++){const o=n[e];for(let n=0;n<o.length;n++){const a=o[n];const c={line:e+1,column:a[x]};let u=void 0;let p=void 0;let g=void 0;if(a.length!==1){u=i.array[a[T]];p={line:a[w]+1,column:a[C]};if(a.length===5)g=s.array[a[A]]}r.push({generated:c,source:u,original:p,name:g})}}return r}function addSegmentInternal(e,r,n,i,s,o,a,c,u){const{_mappings:p,_sources:g,_sourcesContent:v,_names:b}=cast2(r);const _=getIndex(p,n);const E=getColumnIndex(_,i);if(!s){if(e&&skipSourceless(_,E))return;return insert(_,E,[i])}assert(o);assert(a);const x=put(g,s);const T=c?put(b,c):k;if(x===v.length)v[x]=u!=null?u:null;if(e&&skipSource(_,E,x,o,a,T)){return}return insert(_,E,c?[i,x,o,a,T]:[i,x,o,a])}function assert(e){}function getIndex(e,r){for(let n=e.length;n<=r;n++){e[n]=[]}return e[r]}function getColumnIndex(e,r){let n=e.length;for(let i=n-1;i>=0;n=i--){const n=e[i];if(r>=n[x])break}return n}function insert(e,r,n){for(let n=e.length;n>r;n--){e[n]=e[n-1]}e[r]=n}function removeEmptyFinalLines(e){const{length:r}=e;let n=r;for(let r=n-1;r>=0;n=r,r--){if(e[r].length>0)break}if(n<r)e.length=n}function putAll(e,r){for(let n=0;n<r.length;n++)put(e,r[n])}function skipSourceless(e,r){if(r===0)return true;const n=e[r-1];return n.length===1}function skipSource(e,r,n,i,s,o){if(r===0)return false;const a=e[r-1];if(a.length===1)return false;return n===a[T]&&i===a[w]&&s===a[C]&&o===(a.length===5?a[A]:k)}function addMappingInternal(e,r,n){const{generated:i,source:s,original:o,name:a,content:c}=n;if(!s){return addSegmentInternal(e,r,i.line-1,i.column,null,null,null,null,null)}assert(o);return addSegmentInternal(e,r,i.line-1,i.column,s,o.line-1,o.column,a,c)}}))},59445:function(e){(function(r,n){true?e.exports=n():0})(this,(function(){"use strict";const e=/^[\w+.-]+:\/\//;const r=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;const n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function isAbsoluteUrl(r){return e.test(r)}function isSchemeRelativeUrl(e){return e.startsWith("//")}function isAbsolutePath(e){return e.startsWith("/")}function isFileUrl(e){return e.startsWith("file:")}function isRelative(e){return/^[.?#]/.test(e)}function parseAbsoluteUrl(e){const n=r.exec(e);return makeUrl(n[1],n[2]||"",n[3],n[4]||"",n[5]||"/",n[6]||"",n[7]||"")}function parseFileUrl(e){const r=n.exec(e);const i=r[2];return makeUrl("file:","",r[1]||"","",isAbsolutePath(i)?i:"/"+i,r[3]||"",r[4]||"")}function makeUrl(e,r,n,i,s,o,a){return{scheme:e,user:r,host:n,port:i,path:s,query:o,hash:a,type:7}}function parseUrl(e){if(isSchemeRelativeUrl(e)){const r=parseAbsoluteUrl("http:"+e);r.scheme="";r.type=6;return r}if(isAbsolutePath(e)){const r=parseAbsoluteUrl("http://foo.com"+e);r.scheme="";r.host="";r.type=5;return r}if(isFileUrl(e))return parseFileUrl(e);if(isAbsoluteUrl(e))return parseAbsoluteUrl(e);const r=parseAbsoluteUrl("http://foo.com/"+e);r.scheme="";r.host="";r.type=e?e.startsWith("?")?3:e.startsWith("#")?2:4:1;return r}function stripPathFilename(e){if(e.endsWith("/.."))return e;const r=e.lastIndexOf("/");return e.slice(0,r+1)}function mergePaths(e,r){normalizePath(r,r.type);if(e.path==="/"){e.path=r.path}else{e.path=stripPathFilename(r.path)+e.path}}function normalizePath(e,r){const n=r<=4;const i=e.path.split("/");let s=1;let o=0;let a=false;for(let e=1;e<i.length;e++){const r=i[e];if(!r){a=true;continue}a=false;if(r===".")continue;if(r===".."){if(o){a=true;o--;s--}else if(n){i[s++]=r}continue}i[s++]=r;o++}let c="";for(let e=1;e<s;e++){c+="/"+i[e]}if(!c||a&&!c.endsWith("/..")){c+="/"}e.path=c}function resolve(e,r){if(!e&&!r)return"";const n=parseUrl(e);let i=n.type;if(r&&i!==7){const e=parseUrl(r);const s=e.type;switch(i){case 1:n.hash=e.hash;case 2:n.query=e.query;case 3:case 4:mergePaths(n,e);case 5:n.user=e.user;n.host=e.host;n.port=e.port;case 6:n.scheme=e.scheme}if(s>i)i=s}normalizePath(n,i);const s=n.query+n.hash;switch(i){case 2:case 3:return s;case 4:{const i=n.path.slice(1);if(!i)return s||".";if(isRelative(r||e)&&!isRelative(i)){return"./"+i+s}return i+s}case 5:return n.path+s;default:return n.scheme+"//"+n.user+n.host+n.port+n.path+s}}return resolve}))},91391:function(e,r,n){e=n.nmd(e);(function(r,i){if(true){i(e,n(36153),n(99535));e.exports=def(e)}else{}function def(e){return"default"in e.exports?e.exports.default:e.exports}})(this,(function(e,r,n){"use strict";var i=Object.create;var s=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.getPrototypeOf;var u=Object.prototype.hasOwnProperty;var __commonJS=(e,r)=>function __require(){return r||(0,e[a(e)[0]])((r={exports:{}}).exports,r),r.exports};var __export=(e,r)=>{for(var n in r)s(e,n,{get:r[n],enumerable:true})};var __copyProps=(e,r,n,i)=>{if(r&&typeof r==="object"||typeof r==="function"){for(let c of a(r))if(!u.call(e,c)&&c!==n)s(e,c,{get:()=>r[c],enumerable:!(i=o(r,c))||i.enumerable})}return e};var __toESM=(e,r,n)=>(n=e!=null?i(c(e)):{},__copyProps(r||!e||!e.__esModule?s(n,"default",{value:e,enumerable:true}):n,e));var __toCommonJS=e=>__copyProps(s({},"__esModule",{value:true}),e);var p=__commonJS({"umd:@jridgewell/trace-mapping"(e,r){r.exports=n}});var g=__commonJS({"umd:@jridgewell/gen-mapping"(e,n){n.exports=r}});var v={};__export(v,{SourceMapConsumer:()=>E,SourceMapGenerator:()=>x});e.exports=__toCommonJS(v);var b=__toESM(p());var _=__toESM(g());var E=class _SourceMapConsumer{constructor(e,r){const n=this._map=new b.AnyMap(e,r);this.file=n.file;this.names=n.names;this.sourceRoot=n.sourceRoot;this.sources=n.resolvedSources;this.sourcesContent=n.sourcesContent;this.version=n.version}static fromSourceMap(e,r){if(e.toDecodedMap){return new _SourceMapConsumer(e.toDecodedMap(),r)}return new _SourceMapConsumer(e.toJSON(),r)}get mappings(){return(0,b.encodedMappings)(this._map)}originalPositionFor(e){return(0,b.originalPositionFor)(this._map,e)}generatedPositionFor(e){return(0,b.generatedPositionFor)(this._map,e)}allGeneratedPositionsFor(e){return(0,b.allGeneratedPositionsFor)(this._map,e)}hasContentsOfAllSources(){if(!this.sourcesContent||this.sourcesContent.length!==this.sources.length){return false}for(const e of this.sourcesContent){if(e==null){return false}}return true}sourceContentFor(e,r){const n=(0,b.sourceContentFor)(this._map,e);if(n!=null){return n}if(r){return null}throw new Error(`"${e}" is not in the SourceMap.`)}eachMapping(e,r){(0,b.eachMapping)(this._map,r?e.bind(r):e)}destroy(){}};var x=class _SourceMapGenerator{constructor(e){this._map=e instanceof _.GenMapping?e:new _.GenMapping(e)}static fromSourceMap(e){return new _SourceMapGenerator((0,_.fromMap)(e))}addMapping(e){(0,_.maybeAddMapping)(this._map,e)}setSourceContent(e,r){(0,_.setSourceContent)(this._map,e,r)}toJSON(){return(0,_.toEncodedMap)(this._map)}toString(){return JSON.stringify(this.toJSON())}toDecodedMap(){return(0,_.toDecodedMap)(this._map)}}}))},69551:function(e,r,n){e=n.nmd(e);(function(r,n){if(true){n(e);e.exports=def(e)}else{}function def(e){return"default"in e.exports?e.exports.default:e.exports}})(this,(function(e){"use strict";var r=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var __export=(e,n)=>{for(var i in n)r(e,i,{get:n[i],enumerable:true})};var __copyProps=(e,o,a,c)=>{if(o&&typeof o==="object"||typeof o==="function"){for(let u of i(o))if(!s.call(e,u)&&u!==a)r(e,u,{get:()=>o[u],enumerable:!(c=n(o,u))||c.enumerable})}return e};var __toCommonJS=e=>__copyProps(r({},"__esModule",{value:true}),e);var o={};__export(o,{decode:()=>decode,decodeGeneratedRanges:()=>decodeGeneratedRanges,decodeOriginalScopes:()=>decodeOriginalScopes,encode:()=>encode,encodeGeneratedRanges:()=>encodeGeneratedRanges,encodeOriginalScopes:()=>encodeOriginalScopes});e.exports=__toCommonJS(o);var a=",".charCodeAt(0);var c=";".charCodeAt(0);var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var p=new Uint8Array(64);var g=new Uint8Array(128);for(let e=0;e<u.length;e++){const r=u.charCodeAt(e);p[e]=r;g[r]=e}function decodeInteger(e,r){let n=0;let i=0;let s=0;do{const r=e.next();s=g[r];n|=(s&31)<<i;i+=5}while(s&32);const o=n&1;n>>>=1;if(o){n=-2147483648|-n}return r+n}function encodeInteger(e,r,n){let i=r-n;i=i<0?-i<<1|1:i<<1;do{let r=i&31;i>>>=5;if(i>0)r|=32;e.write(p[r])}while(i>0);return r}function hasMoreVlq(e,r){if(e.pos>=r)return false;return e.peek()!==a}var v=1024*16;var b=typeof TextDecoder!=="undefined"?new TextDecoder:typeof Buffer!=="undefined"?{decode(e){const r=Buffer.from(e.buffer,e.byteOffset,e.byteLength);return r.toString()}}:{decode(e){let r="";for(let n=0;n<e.length;n++){r+=String.fromCharCode(e[n])}return r}};var _=class{constructor(){this.pos=0;this.out="";this.buffer=new Uint8Array(v)}write(e){const{buffer:r}=this;r[this.pos++]=e;if(this.pos===v){this.out+=b.decode(r);this.pos=0}}flush(){const{buffer:e,out:r,pos:n}=this;return n>0?r+b.decode(e.subarray(0,n)):r}};var E=class{constructor(e){this.pos=0;this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){const{buffer:r,pos:n}=this;const i=r.indexOf(e,n);return i===-1?r.length:i}};var x=[];function decodeOriginalScopes(e){const{length:r}=e;const n=new E(e);const i=[];const s=[];let o=0;for(;n.pos<r;n.pos++){o=decodeInteger(n,o);const e=decodeInteger(n,0);if(!hasMoreVlq(n,r)){const r=s.pop();r[2]=o;r[3]=e;continue}const a=decodeInteger(n,0);const c=decodeInteger(n,0);const u=c&1;const p=u?[o,e,0,0,a,decodeInteger(n,0)]:[o,e,0,0,a];let g=x;if(hasMoreVlq(n,r)){g=[];do{const e=decodeInteger(n,0);g.push(e)}while(hasMoreVlq(n,r))}p.vars=g;i.push(p);s.push(p)}return i}function encodeOriginalScopes(e){const r=new _;for(let n=0;n<e.length;){n=_encodeOriginalScopes(e,n,r,[0])}return r.flush()}function _encodeOriginalScopes(e,r,n,i){const s=e[r];const{0:o,1:c,2:u,3:p,4:g,vars:v}=s;if(r>0)n.write(a);i[0]=encodeInteger(n,o,i[0]);encodeInteger(n,c,0);encodeInteger(n,g,0);const b=s.length===6?1:0;encodeInteger(n,b,0);if(s.length===6)encodeInteger(n,s[5],0);for(const e of v){encodeInteger(n,e,0)}for(r++;r<e.length;){const s=e[r];const{0:o,1:a}=s;if(o>u||o===u&&a>=p){break}r=_encodeOriginalScopes(e,r,n,i)}n.write(a);i[0]=encodeInteger(n,u,i[0]);encodeInteger(n,p,0);return r}function decodeGeneratedRanges(e){const{length:r}=e;const n=new E(e);const i=[];const s=[];let o=0;let a=0;let c=0;let u=0;let p=0;let g=0;let v=0;let b=0;do{const e=n.indexOf(";");let r=0;for(;n.pos<e;n.pos++){r=decodeInteger(n,r);if(!hasMoreVlq(n,e)){const e=s.pop();e[2]=o;e[3]=r;continue}const _=decodeInteger(n,0);const E=_&1;const T=_&2;const w=_&4;let C=null;let A=x;let k;if(E){const e=decodeInteger(n,a);c=decodeInteger(n,a===e?c:0);a=e;k=[o,r,0,0,e,c]}else{k=[o,r,0,0]}k.isScope=!!w;if(T){const e=u;const r=p;u=decodeInteger(n,u);const i=e===u;p=decodeInteger(n,i?p:0);g=decodeInteger(n,i&&r===p?g:0);C=[u,p,g]}k.callsite=C;if(hasMoreVlq(n,e)){A=[];do{v=o;b=r;const e=decodeInteger(n,0);let i;if(e<-1){i=[[decodeInteger(n,0)]];for(let r=-1;r>e;r--){const e=v;v=decodeInteger(n,v);b=decodeInteger(n,v===e?b:0);const r=decodeInteger(n,0);i.push([r,v,b])}}else{i=[[e]]}A.push(i)}while(hasMoreVlq(n,e))}k.bindings=A;i.push(k);s.push(k)}o++;n.pos=e+1}while(n.pos<r);return i}function encodeGeneratedRanges(e){if(e.length===0)return"";const r=new _;for(let n=0;n<e.length;){n=_encodeGeneratedRanges(e,n,r,[0,0,0,0,0,0,0])}return r.flush()}function _encodeGeneratedRanges(e,r,n,i){const s=e[r];const{0:o,1:c,2:u,3:p,isScope:g,callsite:v,bindings:b}=s;if(i[0]<o){catchupLine(n,i[0],o);i[0]=o;i[1]=0}else if(r>0){n.write(a)}i[1]=encodeInteger(n,s[1],i[1]);const _=(s.length===6?1:0)|(v?2:0)|(g?4:0);encodeInteger(n,_,0);if(s.length===6){const{4:e,5:r}=s;if(e!==i[2]){i[3]=0}i[2]=encodeInteger(n,e,i[2]);i[3]=encodeInteger(n,r,i[3])}if(v){const{0:e,1:r,2:o}=s.callsite;if(e!==i[4]){i[5]=0;i[6]=0}else if(r!==i[5]){i[6]=0}i[4]=encodeInteger(n,e,i[4]);i[5]=encodeInteger(n,r,i[5]);i[6]=encodeInteger(n,o,i[6])}if(b){for(const e of b){if(e.length>1)encodeInteger(n,-e.length,0);const r=e[0][0];encodeInteger(n,r,0);let i=o;let s=c;for(let r=1;r<e.length;r++){const o=e[r];i=encodeInteger(n,o[1],i);s=encodeInteger(n,o[2],s);encodeInteger(n,o[0],0)}}}for(r++;r<e.length;){const s=e[r];const{0:o,1:a}=s;if(o>u||o===u&&a>=p){break}r=_encodeGeneratedRanges(e,r,n,i)}if(i[0]<u){catchupLine(n,i[0],u);i[0]=u;i[1]=0}else{n.write(a)}i[1]=encodeInteger(n,p,i[1]);return r}function catchupLine(e,r,n){do{e.write(c)}while(++r<n)}function decode(e){const{length:r}=e;const n=new E(e);const i=[];let s=0;let o=0;let a=0;let c=0;let u=0;do{const e=n.indexOf(";");const r=[];let p=true;let g=0;s=0;while(n.pos<e){let i;s=decodeInteger(n,s);if(s<g)p=false;g=s;if(hasMoreVlq(n,e)){o=decodeInteger(n,o);a=decodeInteger(n,a);c=decodeInteger(n,c);if(hasMoreVlq(n,e)){u=decodeInteger(n,u);i=[s,o,a,c,u]}else{i=[s,o,a,c]}}else{i=[s]}r.push(i);n.pos++}if(!p)sort(r);i.push(r);n.pos=e+1}while(n.pos<=r);return i}function sort(e){e.sort(sortComparator)}function sortComparator(e,r){return e[0]-r[0]}function encode(e){const r=new _;let n=0;let i=0;let s=0;let o=0;for(let u=0;u<e.length;u++){const p=e[u];if(u>0)r.write(c);if(p.length===0)continue;let g=0;for(let e=0;e<p.length;e++){const c=p[e];if(e>0)r.write(a);g=encodeInteger(r,c[0],g);if(c.length===1)continue;n=encodeInteger(r,c[1],n);i=encodeInteger(r,c[2],i);s=encodeInteger(r,c[3],s);if(c.length===4)continue;o=encodeInteger(r,c[4],o)}}return r.flush()}}))},99535:function(e,r,n){e=n.nmd(e);(function(r,i){if(true){i(e,n(59445),n(69551));e.exports=def(e)}else{}function def(e){return"default"in e.exports?e.exports.default:e.exports}})(this,(function(e,r,n){"use strict";var i=Object.create;var s=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.getPrototypeOf;var u=Object.prototype.hasOwnProperty;var __commonJS=(e,r)=>function __require(){return r||(0,e[a(e)[0]])((r={exports:{}}).exports,r),r.exports};var __export=(e,r)=>{for(var n in r)s(e,n,{get:r[n],enumerable:true})};var __copyProps=(e,r,n,i)=>{if(r&&typeof r==="object"||typeof r==="function"){for(let c of a(r))if(!u.call(e,c)&&c!==n)s(e,c,{get:()=>r[c],enumerable:!(i=o(r,c))||i.enumerable})}return e};var __toESM=(e,r,n)=>(n=e!=null?i(c(e)):{},__copyProps(r||!e||!e.__esModule?s(n,"default",{value:e,enumerable:true}):n,e));var __toCommonJS=e=>__copyProps(s({},"__esModule",{value:true}),e);var p=__commonJS({"umd:@jridgewell/sourcemap-codec"(e,r){r.exports=n}});var g=__commonJS({"umd:@jridgewell/resolve-uri"(e,n){n.exports=r}});var v={};__export(v,{AnyMap:()=>FlattenMap,FlattenMap:()=>FlattenMap,GREATEST_LOWER_BOUND:()=>L,LEAST_UPPER_BOUND:()=>N,TraceMap:()=>B,allGeneratedPositionsFor:()=>allGeneratedPositionsFor,decodedMap:()=>decodedMap,decodedMappings:()=>decodedMappings,eachMapping:()=>eachMapping,encodedMap:()=>encodedMap,encodedMappings:()=>encodedMappings,generatedPositionFor:()=>generatedPositionFor,isIgnored:()=>isIgnored,originalPositionFor:()=>originalPositionFor,presortedDecodedMap:()=>presortedDecodedMap,sourceContentFor:()=>sourceContentFor,traceSegment:()=>traceSegment});e.exports=__toCommonJS(v);var b=__toESM(p());var _=__toESM(g());function stripFilename(e){if(!e)return"";const r=e.lastIndexOf("/");return e.slice(0,r+1)}function resolver(e,r){const n=stripFilename(e);const i=r?r+"/":"";return e=>(0,_.default)(i+(e||""),n)}var E=0;var x=1;var T=2;var w=3;var C=4;var A=1;var k=2;function maybeSort(e,r){const n=nextUnsortedSegmentLine(e,0);if(n===e.length)return e;if(!r)e=e.slice();for(let i=n;i<e.length;i=nextUnsortedSegmentLine(e,i+1)){e[i]=sortSegments(e[i],r)}return e}function nextUnsortedSegmentLine(e,r){for(let n=r;n<e.length;n++){if(!isSorted(e[n]))return n}return e.length}function isSorted(e){for(let r=1;r<e.length;r++){if(e[r][E]<e[r-1][E]){return false}}return true}function sortSegments(e,r){if(!r)e=e.slice();return e.sort(sortComparator)}function sortComparator(e,r){return e[E]-r[E]}var P=false;function binarySearch(e,r,n,i){while(n<=i){const s=n+(i-n>>1);const o=e[s][E]-r;if(o===0){P=true;return s}if(o<0){n=s+1}else{i=s-1}}P=false;return n-1}function upperBound(e,r,n){for(let i=n+1;i<e.length;n=i++){if(e[i][E]!==r)break}return n}function lowerBound(e,r,n){for(let i=n-1;i>=0;n=i--){if(e[i][E]!==r)break}return n}function memoizedState(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function memoizedBinarySearch(e,r,n,i){const{lastKey:s,lastNeedle:o,lastIndex:a}=n;let c=0;let u=e.length-1;if(i===s){if(r===o){P=a!==-1&&e[a][E]===r;return a}if(r>=o){c=a===-1?0:a}else{u=a}}n.lastKey=i;n.lastNeedle=r;return n.lastIndex=binarySearch(e,r,c,u)}function buildBySources(e,r){const n=r.map(buildNullArray);for(let i=0;i<e.length;i++){const s=e[i];for(let e=0;e<s.length;e++){const o=s[e];if(o.length===1)continue;const a=o[x];const c=o[T];const u=o[w];const p=n[a];const g=p[c]||(p[c]=[]);const v=r[a];let b=upperBound(g,u,memoizedBinarySearch(g,u,v,c));v.lastIndex=++b;insert(g,b,[u,i,o[E]])}}return n}function insert(e,r,n){for(let n=e.length;n>r;n--){e[n]=e[n-1]}e[r]=n}function buildNullArray(){return{__proto__:null}}function parse(e){return typeof e==="string"?JSON.parse(e):e}var FlattenMap=function(e,r){const n=parse(e);if(!("sections"in n)){return new B(n,r)}const i=[];const s=[];const o=[];const a=[];const c=[];recurse(n,r,i,s,o,a,c,0,0,Infinity,Infinity);const u={version:3,file:n.file,names:a,sources:s,sourcesContent:o,mappings:i,ignoreList:c};return presortedDecodedMap(u)};function recurse(e,r,n,i,s,o,a,c,u,p,g){const{sections:v}=e;for(let e=0;e<v.length;e++){const{map:b,offset:_}=v[e];let E=p;let x=g;if(e+1<v.length){const r=v[e+1].offset;E=Math.min(p,c+r.line);if(E===p){x=Math.min(g,u+r.column)}else if(E<p){x=u+r.column}}addSection(b,r,n,i,s,o,a,c+_.line,u+_.column,E,x)}}function addSection(e,r,n,i,s,o,a,c,u,p,g){const v=parse(e);if("sections"in v)return recurse(...arguments);const b=new B(v,r);const _=i.length;const A=o.length;const k=decodedMappings(b);const{resolvedSources:P,sourcesContent:I,ignoreList:R}=b;append(i,P);append(o,b.names);if(I)append(s,I);else for(let e=0;e<P.length;e++)s.push(null);if(R)for(let e=0;e<R.length;e++)a.push(R[e]+_);for(let e=0;e<k.length;e++){const r=c+e;if(r>p)return;const i=getLine(n,r);const s=e===0?u:0;const o=k[e];for(let e=0;e<o.length;e++){const n=o[e];const a=s+n[E];if(r===p&&a>=g)return;if(n.length===1){i.push([a]);continue}const c=_+n[x];const u=n[T];const v=n[w];i.push(n.length===4?[a,c,u,v]:[a,c,u,v,A+n[C]])}}}function append(e,r){for(let n=0;n<r.length;n++)e.push(r[n])}function getLine(e,r){for(let n=e.length;n<=r;n++)e[n]=[];return e[r]}var I="`line` must be greater than 0 (lines start at line 1)";var R="`column` must be greater than or equal to 0 (columns start at column 0)";var N=-1;var L=1;var B=class{constructor(e,r){const n=typeof e==="string";if(!n&&e._decodedMemo)return e;const i=parse(e);const{version:s,file:o,names:a,sourceRoot:c,sources:u,sourcesContent:p}=i;this.version=s;this.file=o;this.names=a||[];this.sourceRoot=c;this.sources=u;this.sourcesContent=p;this.ignoreList=i.ignoreList||i.x_google_ignoreList||void 0;const g=resolver(r,c);this.resolvedSources=u.map(g);const{mappings:v}=i;if(typeof v==="string"){this._encoded=v;this._decoded=void 0}else if(Array.isArray(v)){this._encoded=void 0;this._decoded=maybeSort(v,n)}else if(i.sections){throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`)}else{throw new Error(`invalid source map: ${JSON.stringify(i)}`)}this._decodedMemo=memoizedState();this._bySources=void 0;this._bySourceMemos=void 0}};function cast(e){return e}function encodedMappings(e){var r,n;return(n=(r=cast(e))._encoded)!=null?n:r._encoded=(0,b.encode)(cast(e)._decoded)}function decodedMappings(e){var r;return(r=cast(e))._decoded||(r._decoded=(0,b.decode)(cast(e)._encoded))}function traceSegment(e,r,n){const i=decodedMappings(e);if(r>=i.length)return null;const s=i[r];const o=traceSegmentInternal(s,cast(e)._decodedMemo,r,n,L);return o===-1?null:s[o]}function originalPositionFor(e,r){let{line:n,column:i,bias:s}=r;n--;if(n<0)throw new Error(I);if(i<0)throw new Error(R);const o=decodedMappings(e);if(n>=o.length)return OMapping(null,null,null,null);const a=o[n];const c=traceSegmentInternal(a,cast(e)._decodedMemo,n,i,s||L);if(c===-1)return OMapping(null,null,null,null);const u=a[c];if(u.length===1)return OMapping(null,null,null,null);const{names:p,resolvedSources:g}=e;return OMapping(g[u[x]],u[T]+1,u[w],u.length===5?p[u[C]]:null)}function generatedPositionFor(e,r){const{source:n,line:i,column:s,bias:o}=r;return generatedPosition(e,n,i,s,o||L,false)}function allGeneratedPositionsFor(e,r){const{source:n,line:i,column:s,bias:o}=r;return generatedPosition(e,n,i,s,o||N,true)}function eachMapping(e,r){const n=decodedMappings(e);const{names:i,resolvedSources:s}=e;for(let e=0;e<n.length;e++){const o=n[e];for(let n=0;n<o.length;n++){const a=o[n];const c=e+1;const u=a[0];let p=null;let g=null;let v=null;let b=null;if(a.length!==1){p=s[a[1]];g=a[2]+1;v=a[3]}if(a.length===5)b=i[a[4]];r({generatedLine:c,generatedColumn:u,source:p,originalLine:g,originalColumn:v,name:b})}}}function sourceIndex(e,r){const{sources:n,resolvedSources:i}=e;let s=n.indexOf(r);if(s===-1)s=i.indexOf(r);return s}function sourceContentFor(e,r){const{sourcesContent:n}=e;if(n==null)return null;const i=sourceIndex(e,r);return i===-1?null:n[i]}function isIgnored(e,r){const{ignoreList:n}=e;if(n==null)return false;const i=sourceIndex(e,r);return i===-1?false:n.includes(i)}function presortedDecodedMap(e,r){const n=new B(clone(e,[]),r);cast(n)._decoded=e.mappings;return n}function decodedMap(e){return clone(e,decodedMappings(e))}function encodedMap(e){return clone(e,encodedMappings(e))}function clone(e,r){return{version:e.version,file:e.file,names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,mappings:r,ignoreList:e.ignoreList||e.x_google_ignoreList}}function OMapping(e,r,n,i){return{source:e,line:r,column:n,name:i}}function GMapping(e,r){return{line:e,column:r}}function traceSegmentInternal(e,r,n,i,s){let o=memoizedBinarySearch(e,i,r,n);if(P){o=(s===N?upperBound:lowerBound)(e,i,o)}else if(s===N)o++;if(o===-1||o===e.length)return-1;return o}function sliceGeneratedPositions(e,r,n,i,s){let o=traceSegmentInternal(e,r,n,i,L);if(!P&&s===N)o++;if(o===-1||o===e.length)return[];const a=P?i:e[o][E];if(!P)o=lowerBound(e,a,o);const c=upperBound(e,a,o);const u=[];for(;o<=c;o++){const r=e[o];u.push(GMapping(r[A]+1,r[k]))}return u}function generatedPosition(e,r,n,i,s,o){var a;n--;if(n<0)throw new Error(I);if(i<0)throw new Error(R);const{sources:c,resolvedSources:u}=e;let p=c.indexOf(r);if(p===-1)p=u.indexOf(r);if(p===-1)return o?[]:GMapping(null,null);const g=(a=cast(e))._bySources||(a._bySources=buildBySources(decodedMappings(e),cast(e)._bySourceMemos=c.map(memoizedState)));const v=g[p][n];if(v==null)return o?[]:GMapping(null,null);const b=cast(e)._bySourceMemos[p];if(o)return sliceGeneratedPositions(v,b,n,i,s);const _=traceSegmentInternal(v,b,n,i,s);if(_===-1)return GMapping(null,null);const E=v[_];return GMapping(E[A]+1,E[k])}}))},99582:(e,r,n)=>{const{parse:i,format:s}=n(87016);const{pathToRegexp:o,compile:a,parse:c}=n(84868);e.exports=Layer;function Layer(e,r,n,i={}){this.opts=i;this.name=this.opts.name||null;this.methods=[];this.paramNames=[];this.stack=Array.isArray(n)?n:[n];for(const e of r){const r=this.methods.push(e.toUpperCase());if(this.methods[r-1]==="GET")this.methods.unshift("HEAD")}for(let n=0;n<this.stack.length;n++){const i=this.stack[n];const s=typeof i;if(s!=="function")throw new Error(`${r.toString()} \`${this.opts.name||e}\`: \`middleware\` must be a function, not \`${s}\``)}this.path=e;this.regexp=o(e,this.paramNames,this.opts)}Layer.prototype.match=function(e){return this.regexp.test(e)};Layer.prototype.params=function(e,r,n={}){for(let e=r.length,i=0;i<e;i++){if(this.paramNames[i]){const e=r[i];if(e&&e.length>0)n[this.paramNames[i].name]=e?safeDecodeURIComponent(e):e}}return n};Layer.prototype.captures=function(e){return this.opts.ignoreCaptures?[]:e.match(this.regexp).slice(1)};Layer.prototype.url=function(e,r){let n=e;const o=this.path.replace(/\(\.\*\)/g,"");if(typeof e!=="object"){n=Array.prototype.slice.call(arguments);if(typeof n[n.length-1]==="object"){r=n[n.length-1];n=n.slice(0,-1)}}const u=a(o,{encode:encodeURIComponent,...r});let p;const g=c(o);let v={};if(Array.isArray(n)){for(let e=g.length,r=0,i=0;r<e;r++){if(g[r].name)v[g[r].name]=n[i++]}}else if(g.some((e=>e.name))){v=e}else if(!r){r=e}p=u(v);if(r&&r.query){p=i(p);if(typeof r.query==="string"){p.search=r.query}else{p.search=undefined;p.query=r.query}return s(p)}return p};Layer.prototype.param=function(e,r){const{stack:n}=this;const i=this.paramNames;const middleware=function(n,i){return r.call(this,n.params[e],n,i)};middleware.param=e;const s=i.map((function(e){return e.name}));const o=s.indexOf(e);if(o>-1){n.some((function(e,r){if(!e.param||s.indexOf(e.param)>o){n.splice(r,0,middleware);return true}}))}return this};Layer.prototype.setPrefix=function(e){if(this.path){this.path=this.path!=="/"||this.opts.strict===true?`${e}${this.path}`:e;this.paramNames=[];this.regexp=o(this.path,this.paramNames,this.opts)}return this};function safeDecodeURIComponent(e){try{return decodeURIComponent(e)}catch{return e}}},10126:(e,r,n)=>{const i=n(48972);const s=n(78024);const o=n(50806);const{pathToRegexp:a}=n(84868);const c=n(99582);const u=n(2830)("koa-router");e.exports=Router;function Router(e={}){if(!(this instanceof Router))return new Router(e);this.opts=e;this.methods=this.opts.methods||["HEAD","OPTIONS","GET","PUT","PATCH","POST","DELETE"];this.exclusive=Boolean(this.opts.exclusive);this.params={};this.stack=[];this.host=this.opts.host}for(const p of o){function setMethodVerb(e){Router.prototype[e]=function(r,n,i){if(typeof n==="string"||n instanceof RegExp){i=Array.prototype.slice.call(arguments,2)}else{i=Array.prototype.slice.call(arguments,1);n=r;r=null}if(typeof n!=="string"&&!(n instanceof RegExp)&&(!Array.isArray(n)||n.length===0))throw new Error(`You have to provide a path when adding a ${e} handler`);this.register(n,[e],i,{name:r});return this}}setMethodVerb(p)}Router.prototype.del=Router.prototype["delete"];Router.prototype.use=function(){const e=this;const r=Array.prototype.slice.call(arguments);let n;if(Array.isArray(r[0])&&typeof r[0][0]==="string"){const s=r[0];for(const o of s){e.use.apply(e,[o].concat(r.slice(1)))}return this}const i=typeof r[0]==="string";if(i)n=r.shift();for(const u of r){if(u.router){const p=Object.assign(Object.create(Router.prototype),u.router,{stack:[...u.router.stack]});for(let g=0;g<p.stack.length;g++){const v=p.stack[g];const b=Object.assign(Object.create(c.prototype),v);if(n)b.setPrefix(n);if(e.opts.prefix)b.setPrefix(e.opts.prefix);e.stack.push(b);p.stack[g]=b}if(e.params){function setRouterParams(r){const n=r;for(const r of n){p.param(r,e.params[r])}}setRouterParams(Object.keys(e.params))}}else{const _=[];a(e.opts.prefix||"",_);const E=e.opts.prefix&&_.length;e.register(n||"([^/]*)",[],u,{end:false,ignoreCaptures:!i&&!E})}}return this};Router.prototype.prefix=function(e){e=e.replace(/\/$/,"");this.opts.prefix=e;for(let r=0;r<this.stack.length;r++){const n=this.stack[r];n.setPrefix(e)}return this};Router.prototype.routes=Router.prototype.middleware=function(){const e=this;const r=function dispatch(r,n){u("%s %s",r.method,r.path);const s=e.matchHost(r.host);if(!s){return n()}const o=e.opts.routerPath||r.newRouterPath||r.path||r.routerPath;const a=e.match(o,r.method);let c;if(r.matched){r.matched.push.apply(r.matched,a.path)}else{r.matched=a.path}r.router=e;if(!a.route)return n();const p=a.pathAndMethod;const g=p[p.length-1];r._matchedRoute=g.path;if(g.name){r._matchedRouteName=g.name}c=(e.exclusive?[g]:p).reduce((function(e,r){e.push((function(e,n){e.captures=r.captures(o,e.captures);e.params=e.request.params=r.params(o,e.captures,e.params);e.routerPath=r.path;e.routerName=r.name;e._matchedRoute=r.path;if(r.name){e._matchedRouteName=r.name}return n()}));return e.concat(r.stack)}),[]);return i(c)(r,n)};r.router=this;return r};Router.prototype.allowedMethods=function(e={}){const r=this.methods;return function allowedMethods(n,i){return i().then((function(){const i={};if(!n.status||n.status===404){for(let e=0;e<n.matched.length;e++){const r=n.matched[e];for(let e=0;e<r.methods.length;e++){const n=r.methods[e];i[n]=n}}const o=Object.keys(i);if(!~r.indexOf(n.method)){if(e.throw){const r=typeof e.notImplemented==="function"?e.notImplemented():new s.NotImplemented;throw r}else{n.status=501;n.set("Allow",o.join(", "))}}else if(o.length>0){if(n.method==="OPTIONS"){n.status=200;n.body="";n.set("Allow",o.join(", "))}else if(!i[n.method]){if(e.throw){const r=typeof e.methodNotAllowed==="function"?e.methodNotAllowed():new s.MethodNotAllowed;throw r}else{n.status=405;n.set("Allow",o.join(", "))}}}}}))}};Router.prototype.all=function(e,r,n){if(typeof r==="string"){n=Array.prototype.slice.call(arguments,2)}else{n=Array.prototype.slice.call(arguments,1);r=e;e=null}if(typeof r!=="string"&&!(r instanceof RegExp)&&(!Array.isArray(r)||r.length===0))throw new Error("You have to provide a path when adding an all handler");this.register(r,o,n,{name:e});return this};Router.prototype.redirect=function(e,r,n){if(typeof e==="symbol"||e[0]!=="/"){e=this.url(e);if(e instanceof Error)throw e}if(typeof r==="symbol"||r[0]!=="/"&&!r.includes("://")){r=this.url(r);if(r instanceof Error)throw r}return this.all(e,(e=>{e.redirect(r);e.status=n||301}))};Router.prototype.register=function(e,r,n,i={}){const s=this;const{stack:o}=this;if(Array.isArray(e)){for(const o of e){s.register.call(s,o,r,n,i)}return this}const a=new c(e,r,n,{end:i.end===false?i.end:true,name:i.name,sensitive:i.sensitive||this.opts.sensitive||false,strict:i.strict||this.opts.strict||false,prefix:i.prefix||this.opts.prefix||"",ignoreCaptures:i.ignoreCaptures});if(this.opts.prefix){a.setPrefix(this.opts.prefix)}for(let e=0;e<Object.keys(this.params).length;e++){const r=Object.keys(this.params)[e];a.param(r,this.params[r])}o.push(a);u("defined route %s %s",a.methods,a.path);return a};Router.prototype.route=function(e){const r=this.stack;for(let n=r.length,i=0;i<n;i++){if(r[i].name&&r[i].name===e)return r[i]}return false};Router.prototype.url=function(e,r){const n=this.route(e);if(n){const e=Array.prototype.slice.call(arguments,1);return n.url.apply(n,e)}return new Error(`No route found for name: ${String(e)}`)};Router.prototype.match=function(e,r){const n=this.stack;let i;const s={path:[],pathAndMethod:[],route:false};for(let o=n.length,a=0;a<o;a++){i=n[a];u("test %s %s",i.path,i.regexp);if(i.match(e)){s.path.push(i);if(i.methods.length===0||~i.methods.indexOf(r)){s.pathAndMethod.push(i);if(i.methods.length>0)s.route=true}}}return s};Router.prototype.matchHost=function(e){const{host:r}=this;if(!r){return true}if(!e){return false}if(typeof r==="string"){return e===r}if(typeof r==="object"&&r instanceof RegExp){return r.test(e)}};Router.prototype.param=function(e,r){this.params[e]=r;for(let n=0;n<this.stack.length;n++){const i=this.stack[n];i.param(e,r)}return this};Router.url=function(e){const r=Array.prototype.slice.call(arguments,1);return c.prototype.url.apply({path:e},r)}},50335:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.AsyncHooksContextManager=void 0;const i=n(45573);const s=n(90290);class AsyncHooksContextManager{constructor(){this._contexts=new Map;this._stack=[];this._asyncHook=s.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){var e;return(e=this._stack[this._stack.length-1])!==null&&e!==void 0?e:i.ASYNC_ROOT_CONTEXT}with(e,r,n,...i){this._enterContext(e);try{return r.call(n,...i)}finally{this._exitContext()}}enable(){this._asyncHook.enable();return this}disable(){this._asyncHook.disable();this._contexts.clear();this._stack=[];return this}_init(e,r){if(r==="TIMERWRAP")return;const n=this._stack[this._stack.length-1];if(n!==undefined){this._contexts.set(e,n)}}_destroy(e){this._contexts.delete(e)}_before(e){const r=this._contexts.get(e);if(r!==undefined){this._enterContext(r)}}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}bind(e,r){if(typeof r==="function"){const n=this;const contextWrapper=function(...i){return n.with(e,(()=>r.apply(this,i)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:r.length});return contextWrapper}return r}}r.AsyncHooksContextManager=AsyncHooksContextManager},82535:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.AsyncLocalStorageContextManager=void 0;const i=n(45573);const s=n(90290);class AsyncLocalStorageContextManager{constructor(){this._asyncLocalStorage=new s.AsyncLocalStorage}active(){var e;return(e=this._asyncLocalStorage.getStore())!==null&&e!==void 0?e:i.ASYNC_ROOT_CONTEXT}with(e,r,n,...i){const s=n==null?r:r.bind(n);return this._asyncLocalStorage.run(e,s,...i)}enable(){return this}disable(){this._asyncLocalStorage.disable();return this}bind(e,r){if(typeof r==="function"){const n=this;const contextWrapper=function(...i){return n.with(e,(()=>r.apply(this,i)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:r.length});return contextWrapper}return r}}r.AsyncLocalStorageContextManager=AsyncLocalStorageContextManager},78593:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.createContextManager=r.isSemverGreaterThanOrEqualTo=void 0;s(n(50335),r);s(n(82535),r);var o=n(32041);Object.defineProperty(r,"isSemverGreaterThanOrEqualTo",{enumerable:true,get:function(){return o.isSemverGreaterThanOrEqualTo}});Object.defineProperty(r,"createContextManager",{enumerable:true,get:function(){return o.createContextManager}})},32041:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.createContextManager=r.isSemverGreaterThanOrEqualTo=void 0;const i=n(82535);const s=n(50335);const o=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z-]+(?:\.[\da-z-]+)*))?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)?)?$/i;function isSemverGreaterThanOrEqualTo(e,r){const n=o.exec(e);const i=o.exec(r);if(n&&i){if(n[1]===i[1]&&n[2]===i[2]&&n[3]===i[3]&&n[4]===i[4]){return true}return gteString(n[1],i[1])||n[1]===i[1]&>eString(n[2],i[2])||n[1]===i[1]&&n[2]===i[2]&>eString(n[3],i[3])||n[1]===i[1]&&n[2]===i[2]&&n[3]===i[3]&>eString(n[4],i[4])}return false}r.isSemverGreaterThanOrEqualTo=isSemverGreaterThanOrEqualTo;function gteString(e,r){const n=parseInt(e,10);const i=parseInt(r,10);return n>i}function createContextManager(){const e=isSemverGreaterThanOrEqualTo(process.version,"14.8.0")?i.AsyncLocalStorageContextManager:s.AsyncHooksContextManager;return new e}r.createContextManager=createContextManager},87102:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Bootstrap=r.BootstrapStarter=void 0;const i=n(45573);const s=n(16928);const o=n(84416);const a=n(78593);const c=n(56095);const u=n(59625);class BootstrapStarter{constructor(){this.globalOptions={}}configure(e={}){this.globalOptions=e;return this}async init(){this.appDir=this.globalOptions.appDir=this.globalOptions.appDir||process.cwd();this.baseDir=this.globalOptions.baseDir=this.getBaseDir();if(process.env["MIDWAY_FORK_MODE"]){if(process.env["MIDWAY_FORK_MODE"]==="cluster"){this.eventBus=new c.ChildProcessEventBus({isWorker:true})}else if(process.env["MIDWAY_FORK_MODE"]==="thread"){this.eventBus=new c.ThreadEventBus({isWorker:true})}}if(!this.globalOptions.moduleLoadType){const e=await(0,i.loadModule)((0,s.join)(this.appDir,"package.json"),{safeLoad:true,enableCache:false});this.globalOptions.moduleLoadType=(e===null||e===void 0?void 0:e.type)==="module"?"esm":"commonjs"}this.applicationContext=await(0,i.initializeGlobalApplicationContext)({asyncContextManager:(0,a.createContextManager)(),loggerFactory:o.loggers,...this.globalOptions});return this.applicationContext}async run(){this.applicationContext=await this.init();if(this.eventBus){await this.eventBus.start();if(process.env["MIDWAY_STICKY_MODE"]==="true"){const e=this.applicationContext.get(i.MidwayApplicationManager);const r=e.getApplication("socketIO");(0,u.setupWorker)(r)}}const e=this.applicationContext.get(i.MidwayFrameworkService);if(!e.getMainApp()){throw new i.MidwayMainFrameworkMissingError}}async stop(){if(this.applicationContext){await(0,i.destroyGlobalApplicationContext)(this.applicationContext)}if(this.eventBus){await this.eventBus.stop()}}getApplicationContext(){return this.applicationContext}getBaseDir(){if(this.globalOptions.baseDir){return this.globalOptions.baseDir}if((0,i.isTypeScriptEnvironment)()){return(0,s.join)(this.appDir,"src")}else{return(0,s.join)(this.appDir,"dist")}}}r.BootstrapStarter=BootstrapStarter;class Bootstrap{static configure(e={}){this.configured=true;if(!this.logger&&!e.logger){this.logger=this.bootstrapLoggerFactory.createLogger("bootstrap",{enableError:false,enableFile:false,enableConsole:true});if(e.logger===false){if(this.logger["disableConsole"]){this.logger["disableConsole"]()}else{this.logger["level"]="none"}}e.logger=this.logger}else{this.logger=this.logger||e.logger}if(e.appDir&&e.appDir!==process.cwd()){process.chdir(e.appDir)}this.getStarter().configure(e);return this}static getStarter(){if(!this.starter){this.starter=new BootstrapStarter}return this.starter}static async run(){if(!this.configured){this.configure()}process.once("SIGINT",this.onSignal.bind(this,"SIGINT"));process.once("SIGQUIT",this.onSignal.bind(this,"SIGQUIT"));process.once("SIGTERM",this.onSignal.bind(this,"SIGTERM"));process.once("exit",this.onExit.bind(this));this.uncaughtExceptionHandler=this.uncaughtExceptionHandler.bind(this);process.on("uncaughtException",this.uncaughtExceptionHandler);this.unhandledRejectionHandler=this.unhandledRejectionHandler.bind(this);process.on("unhandledRejection",this.unhandledRejectionHandler);return this.getStarter().run().then((()=>{this.logger.info("[midway:bootstrap] current app started");global["MIDWAY_BOOTSTRAP_APP_READY"]=true;return this.getApplicationContext()})).catch((e=>{this.logger.error(e);process.exit(1)}))}static async stop(){await this.getStarter().stop();process.removeListener("uncaughtException",this.uncaughtExceptionHandler);process.removeListener("unhandledRejection",this.unhandledRejectionHandler);this.reset();global["MIDWAY_BOOTSTRAP_APP_READY"]=false}static reset(){this.configured=false;this.starter=null;this.bootstrapLoggerFactory.close()}static async onSignal(e){this.logger.info("[midway:bootstrap] receive signal %s, closing",e);try{await this.stop();this.logger.info("[midway:bootstrap] close done, exiting with code:0");process.exit(0)}catch(e){this.logger.error("[midway:bootstrap] close with error: ",e);process.exit(1)}}static onExit(e){this.logger.info("[midway:bootstrap] exit with code:%s",e)}static uncaughtExceptionHandler(e){if(!(e instanceof Error)){e=new Error(String(e))}if(e.name==="Error"){e.name="unhandledExceptionError"}this.logger.error(e)}static unhandledRejectionHandler(e){if(!(e instanceof Error)){const r=new Error(String(e));if(e){if(e.name)r.name=e.name;if(e.message)r.message=e.message;if(e.stack)r.stack=e.stack}e=r}if(e.name==="Error"){e.name="unhandledRejectionError"}this.logger.error(e)}static getApplicationContext(){return this.getStarter().getApplicationContext()}}r.Bootstrap=Bootstrap;Bootstrap.configured=false;Bootstrap.bootstrapLoggerFactory=new o.MidwayLoggerContainer},41836:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.setupStickyMaster=r.AbstractForkManager=r.ClusterManager=r.BootstrapStarter=r.Bootstrap=void 0;s(n(20651),r);var o=n(87102);Object.defineProperty(r,"Bootstrap",{enumerable:true,get:function(){return o.Bootstrap}});Object.defineProperty(r,"BootstrapStarter",{enumerable:true,get:function(){return o.BootstrapStarter}});var a=n(10985);Object.defineProperty(r,"ClusterManager",{enumerable:true,get:function(){return a.ClusterManager}});var c=n(60727);Object.defineProperty(r,"AbstractForkManager",{enumerable:true,get:function(){return c.AbstractForkManager}});var u=n(59625);Object.defineProperty(r,"setupStickyMaster",{enumerable:true,get:function(){return u.setupStickyMaster}})},20651:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},60727:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.AbstractForkManager=void 0;const i=n(70857);const s=n(39023);const o=n(71470);const a=n(24434);const c=n(39023);const u=(0,c.debuglog)("midway:bootstrap");class AbstractForkManager{constructor(e){this.options=e;this.reforks=[];this.disconnectCount=0;this.unexpectedCount=0;this.disconnects={};this.hub=new a.EventEmitter;this.workers=new Map;this.isClosing=false;e.count=e.count||i.cpus().length-1;e.refork=e.refork!==false;e.limit=e.limit||60;e.duration=e.duration||6e4;e.logger=e.logger||console;e.workerInitTimeout=e.workerInitTimeout||3e4;this.eventBus=this.createEventBus({initTimeout:e.workerInitTimeout})}async start(){u("Start manager with options: %j",this.options);this.bindWorkerDisconnect((e=>{u(" - worker(%s): trigger event = disconnect",this.getWorkerId(e));const r=this.options.logger[e["disableRefork"]?"info":"error"];this.disconnectCount++;const n=this.isWorkerDead(e);if(n){u(" - worker(%s): worker is dead",this.getWorkerId(e));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork, because worker:%s exit event emit before disconnect",(0,o.logDate)(),process.pid,this.getWorkerId(e));return}if(e["disableRefork"]){u(" - worker(%s): worker is disableRefork(maybe terminated by master)",this.getWorkerId(e));r("[%s] [bootstrap:master:%s] don't fork, because worker:%s will be kill soon",(0,o.logDate)(),process.pid,this.getWorkerId(e));return}this.disconnects[this.getWorkerId(e)]=(0,o.logDate)();this.tryToRefork(e)}));this.bindWorkerExit(((e,r,n)=>{u(" - worker(%s): trigger event = exit",this.getWorkerId(e));this.workers.delete(this.getWorkerId(e));if(e["disableRefork"]){return}const i=!!this.disconnects[this.getWorkerId(e)];u(" - worker(%s): isExpected=%s",this.getWorkerId(e),i);if(i){delete this.disconnects[this.getWorkerId(e)];return}u(" - worker(%s): isWorkerDead=%s",this.getWorkerId(e),this.isWorkerDead(e));if(this.isWorkerDead(e)){return}u(" - worker(%s): unexpectedCount will add");this.unexpectedCount++;this.tryToRefork(e);this.onUnexpected(e,r,n)}));this.bindClose();this.hub.on("reachReforkLimit",this.onReachReforkLimit.bind(this));setImmediate((()=>{if(process.listeners("uncaughtException").length===0){process.on("uncaughtException",this.onerror.bind(this))}}));for(let e=0;e<this.options.count;e++){const e=this.createWorker();u(" - worker(%s) created",this.getWorkerId(e));this.eventBus.addWorker(e);this.workers.set(this.getWorkerId(e),e)}await this.eventBus.start()}tryToRefork(e){if(this.allowRefork()){u(" - worker(%s): allow refork and will fork new",this.getWorkerId(e));const r=this.createWorker(e);this.workers.set(this.getWorkerId(r),r);this.options.logger.info("[%s] [bootstrap:master:%s] new worker:%s fork (state: %s)",(0,o.logDate)(),process.pid,this.getWorkerId(r),r["state"]);this.eventBus.addWorker(r)}else{u(" - worker(%s): forbidden refork and will stop",this.getWorkerId(e));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork new work (refork: %s)",(0,o.logDate)(),process.pid,this.options.refork)}}allowRefork(){if(!this.options.refork||this.isClosing){return false}const e=this.reforks.push(Date.now());if(e>this.options.limit){this.reforks.shift()}const r=this.reforks[this.reforks.length-1]-this.reforks[0];const n=this.reforks.length<this.options.limit||r>this.options.duration;if(!n){this.hub.emit("reachReforkLimit")}return n}onerror(e){if(!e){return}this.options.logger.error("[%s] [bootstrap:master:%s] master uncaughtException: %s",(0,o.logDate)(),process.pid,e.stack);this.options.logger.error(e);this.options.logger.error("(total %d disconnect, %d unexpected exit)",this.disconnectCount,this.unexpectedCount)}onUnexpected(e,r,n){const i=e.hasOwnProperty("exitedAfterDisconnect")?"exitedAfterDisconnect":"suicide";const a=new Error(s.format("worker:%s died unexpected (code: %s, signal: %s, %s: %s, state: %s)",this.getWorkerId(e),r,n,i,e[i],e["state"]));a.name="WorkerDiedUnexpectedError";this.options.logger.error("[%s] [bootstrap:master:%s] (total %d disconnect, %d unexpected exit) %s",(0,o.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount,a.stack)}onReachReforkLimit(){this.options.logger.error("[%s] [bootstrap:master:%s] worker died too fast (total %d disconnect, %d unexpected exit)",(0,o.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount)}async killWorker(e,r){await this.closeWorker(e);await Promise.race([(0,a.once)(e,"exit"),(0,o.sleep)(r)]);if(e.killed)return;(e.process||e).kill("SIGKILL")}async stop(e=2e3){u("run close");this.isClosing=true;await this.eventBus.stop();for(const r of this.workers.values()){r["disableRefork"]=true;await this.killWorker(r,e)}if(this.exitListener){await this.exitListener()}}hasWorker(e){return this.workers.has(e)}getWorker(e){return this.workers.get(e)}getWorkerIds(){return Array.from(this.workers.keys())}onStop(e){this.exitListener=e}bindClose(){process.once("SIGINT",this.onSignal.bind(this,"SIGINT"));process.once("SIGQUIT",this.onSignal.bind(this,"SIGQUIT"));process.once("SIGTERM",this.onSignal.bind(this,"SIGTERM"));process.once("exit",this.onMasterExit.bind(this))}async onSignal(e){if(!this.isClosing){this.options.logger.info("[bootstrap:master] receive signal %s, closing",e);try{await this.stop();this.options.logger.info("[bootstrap:master] close done, exiting with code:0");process.exit(0)}catch(e){this.options.logger.error("[midway:master] close with error: ",e);process.exit(1)}}}onMasterExit(e){this.options.logger.info("[bootstrap:master] exit with code:%s",e)}}r.AbstractForkManager=AbstractForkManager},10985:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ClusterManager=void 0;const i=n(56095);const s=n(60727);const o=n(29907);const a=n(39023);const c=n(45573);const u=(0,a.debuglog)("midway:bootstrap");class ClusterManager extends s.AbstractForkManager{constructor(e={}){super(e);this.options=e;e.args=e.args||[];e.execArgv=e.execArgv||[];if((0,c.isTypeScriptEnvironment)()){e.execArgv.push(...["--require","ts-node/register"])}}createWorker(){if(o["setupPrimary"]){o["setupPrimary"](this.options)}else if(o["setupMaster"]){o["setupMaster"](this.options)}return o.fork({MIDWAY_FORK_MODE:"cluster",MIDWAY_STICKY_MODE:this.options.sticky?"true":"false",...this.options.env})}bindWorkerDisconnect(e){u("Bind cluster.disconnect event");o.on("disconnect",e)}bindWorkerExit(e){u("Bind cluster.exit event");o.on("exit",e)}getWorkerId(e){return String(e.process.pid)}isWorkerDead(e){return e.isDead()}closeWorker(e){e.kill("SIGTERM")}createEventBus(e){return new i.ChildProcessEventBus(e)}isPrimary(){return!o.isWorker}}r.ClusterManager=ClusterManager},59625:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.setupWorker=r.setupStickyMaster=void 0;const i=n(29907);const s=n(76982);const randomId=()=>(0,s.randomBytes)(8).toString("hex");function setupStickyMaster(e,r={}){const n={loadBalancingMethod:"least-connection",...r};const s=new Map;const o=/sid=([\w-]{20})/;let a=0;const computeWorkerId=e=>{const r=o.exec(e);if(r){const e=r[1];const n=s.get(e);if(n&&i.workers[n]){return n}}switch(n.loadBalancingMethod){case"random":{const e=Object.keys(i.workers);return e[Math.floor(Math.random()*e.length)]}case"round-robin":{const e=Object.keys(i.workers);a++;if(a>=e.length){a=0}return e[a]}case"least-connection":let e;for(const r in i.workers){const n=i.workers[r];if(e===undefined){e=n}else{const r=n["clientsCount"]||0;const i=e["clientsCount"]||0;if(r<i){e=n}}}return e.id}};e.on("connection",(e=>{let r,n;const sendCallback=r=>{if(r){e.destroy()}};e.on("data",(s=>{let o="utf-8";let a=s.toString(o);if(r&&n){i.workers[r].send({type:"sticky:http-chunk",data:a,encoding:o,connectionId:n},sendCallback);return}r=computeWorkerId(a);const c=!(a.startsWith("GET")||a.substring(0,a.indexOf("\r\n\r\n")).includes("pgrade: websocket"));if(a.startsWith("POST")&&a.includes("multipart/form-data")){o="base64";a=s.toString("base64")}e.pause();if(c){n=randomId()}i.workers[r].send({type:"sticky:connection",data:a,encoding:o,connectionId:n},e,{keepOpen:c},sendCallback)}))}));e.on("request",(e=>{e.on("data",(()=>{}))}));i.on("message",((e,{type:r,data:i})=>{switch(r){case"sticky:connection":s.set(i,e.id);if(n.loadBalancingMethod==="least-connection"){e["clientsCount"]=(e["clientsCount"]||0)+1}break;case"sticky:disconnection":s.delete(i);if(n.loadBalancingMethod==="least-connection"){e["clientsCount"]--}break}}))}r.setupStickyMaster=setupStickyMaster;function setupWorker(e){const r=new Map;process.on("message",(({type:n,data:i,encoding:s,connectionId:o},a)=>{switch(n){case"sticky:connection":if(!a){return}e.httpServer.emit("connection",a);a.emit("data",Buffer.from(i,s));a.resume();if(o){r.set(o,a);a.on("close",(()=>{r.delete(o)}))}break;case"sticky:http-chunk":{const e=r.get(o);if(e){e.emit("data",Buffer.from(i,s))}}}}));const ignoreError=()=>{};e.engine.on("connection",(e=>{process.send({type:"sticky:connection",data:e.id},ignoreError);e.once("close",(()=>{process.send({type:"sticky:disconnection",data:e.id},ignoreError)}))}))}r.setupWorker=setupWorker},71470:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.sleep=r.logDate=void 0;function logDate(){const e=new Date;let r=e.getDate();if(r<10){r="0"+r}let n=e.getMonth()+1;if(n<10){n="0"+n}let i=e.getHours();if(i<10){i="0"+i}let s=e.getMinutes();if(s<10){s="0"+s}let o=e.getSeconds();if(o<10){o="0"+o}let a=e.getMilliseconds();if(a<10){a="00"+a}else if(a<100){a="0"+a}return e.getFullYear()+"-"+n+"-"+r+" "+i+":"+s+":"+o+"."+a}r.logDate=logDate;async function sleep(e){return new Promise((r=>{setTimeout(r,e)}))}r.sleep=sleep},54033:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.multiCaching=r.createCache=r.caching=void 0;const i=n(32884);const s=n(62387);async function caching(e,r){if(e==="memory"){const e=(0,s.memoryStore)(r);return createCache(e,r)}if(typeof e==="function"){const n=await e(r);return createCache(n,r)}return createCache(e,r)}r.caching=caching;function createCache(e,r){return{wrap:async(n,s,o)=>(0,i.coalesceAsync)(n,(async()=>{const a=await e.get(n);if(a===undefined){const r=await s();const i=typeof o==="function"?o(r):o;await e.set(n,r,i);return r}else if(r===null||r===void 0?void 0:r.refreshThreshold){const c=typeof o==="function"?o(a):o;const u=await e.ttl(n);if(u!==-1&&u<r.refreshThreshold){(0,i.coalesceAsync)(`+++${n}`,s).then((r=>e.set(n,r,c)))}}return a})),store:e,del:r=>e.del(r),get:r=>e.get(r),set:(r,n,i)=>e.set(r,n,i),reset:()=>e.reset(),methodWrap:async(n,s,o,a)=>(0,i.coalesceAsync)(n,(async()=>{const c=await e.get(n);if(c===undefined){const r=await s(...o);const i=typeof a==="function"?a(r):a;await e.set(n,r,i);return r}else if(r===null||r===void 0?void 0:r.refreshThreshold){const u=typeof a==="function"?a(c):a;const p=await e.ttl(n);if(p!==-1&&p<r.refreshThreshold){(0,i.coalesceAsync)(`+++${n}`,(()=>s(...o))).then((r=>e.set(n,r,u)))}}return c}))}}r.createCache=createCache;function multiCaching(e){const get=async r=>{for(const n of e){try{const e=await n.get(r);if(e!==undefined)return e}catch(e){}}};const set=async(r,n,i)=>{await Promise.all(e.map((e=>e.set(r,n,i))))};return{get:get,set:set,del:async r=>{await Promise.all(e.map((e=>e.del(r))))},async wrap(r,n,i){let s;let o=0;for(;o<e.length;o++){try{s=await e[o].get(r);if(s!==undefined)break}catch(e){}}if(s===undefined){const e=await n();const s=typeof i==="function"?i(e):i;await set(r,e,s);return e}else{const a=typeof i==="function"?i(s):i;Promise.all(e.slice(0,o).map((e=>e.set(r,s,a)))).then();e[o].wrap(r,n,i).then()}return s},reset:async()=>{await Promise.all(e.map((e=>e.reset())))},mget:async(...r)=>{const n=new Array(r.length).fill(undefined);for(const i of e){if(n.every((e=>e!==undefined)))break;try{const e=await i.store.mget(...r);e.forEach(((e,r)=>{if(n[r]===undefined&&e!==undefined)n[r]=e}))}catch(e){}}return n},mset:async(r,n)=>{await Promise.all(e.map((e=>e.store.mset(r,n))))},mdel:async(...r)=>{await Promise.all(e.map((e=>e.store.mdel(...r))))},methodWrap:async(r,n,i,s)=>{let o;let a=0;for(;a<e.length;a++){try{o=await e[a].get(r);if(o!==undefined)break}catch(e){}}if(o===undefined){const e=await n(...i);const o=typeof s==="function"?s(e):s;await set(r,e,o);return e}else{const c=typeof s==="function"?s(o):s;Promise.all(e.slice(0,a).map((e=>e.set(r,o,c)))).then();e[a].methodWrap(r,n,i,s).then()}return o}}}r.multiCaching=multiCaching},1554:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});s(n(54033),r);s(n(62387),r);s(n(65327),r)},32884:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.coalesceAsync=void 0;const n=new Map;async function coalesceAsync(e,r){if(!hasKey(e)){addKey(e);try{const n=await Promise.resolve(r());coalesce({key:e,result:n});return n}catch(r){coalesce({key:e,error:r});throw r}}return enqueue(e)}r.coalesceAsync=coalesceAsync;function hasKey(e){return n.has(e)}function addKey(e){n.set(e,[])}function removeKey(e){n.delete(e)}function addCallbackToKey(e,r){const i=getCallbacksByKey(e);i.push(r);n.set(e,i)}function getCallbacksByKey(e){var r;return(r=n.get(e))!==null&&r!==void 0?r:[]}function enqueue(e){return new Promise(((r,n)=>{const i={resolve:r,reject:n};addCallbackToKey(e,i)}))}function dequeue(e){const r=getCallbacksByKey(e);removeKey(e);return r}function coalesce(e){const{key:r,error:n,result:i}=e;dequeue(r).forEach((e=>{if(n){e.reject(n)}else{e.resolve(i)}}))}},62387:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.memoryStore=void 0;const i=n(37584);const s=n(15364);function clone(e){if(typeof e==="object"&&e!==null){return s(e)}return e}function memoryStore(e){var r;const n=(e===null||e===void 0?void 0:e.shouldCloneBeforeSet)!==false;const s=(r=e===null||e===void 0?void 0:e.isCacheable)!==null&&r!==void 0?r:e=>e!==undefined;const o={ttlAutopurge:true,...e,max:(e===null||e===void 0?void 0:e.max)||500,ttl:(e===null||e===void 0?void 0:e.ttl)!==undefined?e.ttl:0};const a=new i(o);return{async del(e){a.delete(e)},get:async e=>a.get(e),keys:async()=>[...a.keys()],mget:async(...e)=>e.map((e=>a.get(e))),async mset(e,r){const i={ttl:r!==undefined?r:o.ttl};for(const[r,o]of e){if(!s(o))throw new Error(`no cacheable value ${JSON.stringify(o)}`);if(n)a.set(r,clone(o),i);else a.set(r,o,i)}},async mdel(...e){for(const r of e)a.delete(r)},async reset(){a.clear()},ttl:async e=>a.getRemainingTTL(e),async set(e,r,i){if(!s(r))throw new Error(`no cacheable value ${JSON.stringify(r)}`);if(n)r=clone(r);const c=i!==undefined?i:o.ttl;a.set(e,r,{ttl:c})},get calculatedSize(){return a.calculatedSize},get size(){return a.size},dump:()=>a.dump(),load:(...e)=>a.load(...e)}}r.memoryStore=memoryStore},65327:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},12096:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.CacheConfiguration=r.getClassMethodDefaultCacheKey=void 0;const o=n(45573);const a=n(78335);const c=n(9956);function getClassMethodDefaultCacheKey(e,r){return e.name+"-"+(0,o.getProviderUUId)(e)+"-"+r}r.getClassMethodDefaultCacheKey=getClassMethodDefaultCacheKey;let u=class CacheConfiguration{async onReady(e){this.cacheService=await e.getAsync(c.CachingFactory);this.decoratorService.registerMethodHandler(a.CACHE_DECORATOR_KEY,(({target:e,propertyName:r,metadata:n})=>{if(!n.cacheKey){n.cacheKey=getClassMethodDefaultCacheKey(e,r)}return{around:async e=>{let r=n.cacheKey;const i=this.cacheService.get(n.cacheInstanceName);if(typeof r==="function"){r=await r({methodArgs:e.args,ctx:e.target[o.REQUEST_OBJ_CTX_KEY],target:e.target})}if(typeof r==="string"){return i.methodWrap(r,e.proceed,e.args,n.ttl)}else{return e.proceed(...e.args)}}}}))}};i([(0,o.Inject)(),s("design:type",o.MidwayDecoratorService)],u.prototype,"decoratorService",void 0);u=i([(0,o.Configuration)({namespace:"cacheManager",importConfigs:[{default:{cacheManager:{}}}]})],u);r.CacheConfiguration=u},78335:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Caching=r.CACHE_DECORATOR_KEY=void 0;const i=n(45573);r.CACHE_DECORATOR_KEY="cache-manager:caching";function Caching(e,n,s){if(typeof n==="number"){s=n;n=undefined}return(0,i.createCustomMethodDecorator)(r.CACHE_DECORATOR_KEY,{cacheInstanceName:e,cacheKey:n,ttl:s})}r.Caching=Caching},9956:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.CachingFactory=void 0;const o=n(45573);const a=n(1554);let c=class CachingFactory extends o.ServiceFactory{async init(){await this.initClients(this.cacheManagerConfig)}async createClient(e,r){if(Array.isArray(e.store)){const n=[];for(const i of e.store){if(typeof i==="string"){if(!this.has(i)){throw new o.MidwayCommonError(`cache instance "${i}" not found in "${r}", please check your configuration.`)}n.push(this.get(i))}else if(typeof i==="function"){n.push(await i())}else if(i["wrap"]){n.push(i["wrap"])}else if(typeof i==="object"){if(typeof i.store==="function"){i.store=await i.store(i["options"]||{},this.applicationContext)}if(!i.store){throw new o.MidwayCommonError(`cache instance "${r}" store is undefined, please check your configuration.`)}n.push(await(0,a.caching)(i.store,i["options"]))}else{throw new o.MidwayCommonError("invalid cache config")}}return await(0,a.multiCaching)(n)}else{if(typeof e.store==="function"){e.store=await e.store(e["options"]||{},this.applicationContext)}if(!e.store){throw new o.MidwayCommonError(`cache instance "${r}" store is undefined, please check your configuration.`)}return await(0,a.caching)(e.store,e["options"])}}getName(){return"cache-manager"}getCaching(e){return this.get(e)}getMultiCaching(e){return this.get(e)}};i([(0,o.Config)("cacheManager"),s("design:type",Object)],c.prototype,"cacheManagerConfig",void 0);i([(0,o.ApplicationContext)(),s("design:type",Object)],c.prototype,"applicationContext",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],c.prototype,"init",null);c=i([(0,o.Provide)(),(0,o.Scope)(o.ScopeEnum.Singleton)],c);r.CachingFactory=c},16378:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.CacheManager=r.getClassMethodDefaultCacheKey=r.Configuration=void 0;var o=n(12096);Object.defineProperty(r,"Configuration",{enumerable:true,get:function(){return o.CacheConfiguration}});Object.defineProperty(r,"getClassMethodDefaultCacheKey",{enumerable:true,get:function(){return o.getClassMethodDefaultCacheKey}});s(n(31597),r);s(n(9956),r);s(n(78335),r);r.CacheManager=n(1554);s(n(58811),r)},31597:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},58811:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.createRedisStore=void 0;const i=n(45573);const getVal=e=>JSON.stringify(e)||'"undefined"';function createRedisStore(e){return async(r,n)=>{const{RedisServiceFactory:s}=(0,i.safeRequire)("@midwayjs/redis");const o=await n.getAsync(s);const a=o.get(e);return createStore(a,r)}}r.createRedisStore=createRedisStore;function createStore(e,r){const n=(r===null||r===void 0?void 0:r.isCacheable)||(e=>e!==undefined&&e!==null);const keys=r=>e.keys(r);return{async get(r){const n=await e.get(r);if(n===undefined||n===null)return undefined;else{try{return JSON.parse(n)}catch(e){return n}}},async set(s,o,a){if(!n(o))throw new i.MidwayCommonError(`"${o}" is not a cacheable value`);const c=a===undefined?r===null||r===void 0?void 0:r.ttl:a;if(c!==undefined&&c!==0)await e.set(s,getVal(o),"PX",c);else await e.set(s,getVal(o))},async mset(s,o){const a=o===undefined?r===null||r===void 0?void 0:r.ttl:o;if(a!==undefined&&a!==0){const r=e.multi();for(const[e,o]of s){if(!n(o))throw new i.MidwayCommonError(`"${getVal(o)}" is not a cacheable value`);r.set(e,getVal(o),"PX",a)}await r.exec()}else await e.mset(s.flatMap((([e,r])=>{if(!n(r))throw new Error(`"${getVal(r)}" is not a cacheable value`);return[e,getVal(r)]})))},mget:(...r)=>e.mget(r).then((e=>e.map((e=>{if(e===null||e===undefined){return undefined}else{try{return JSON.parse(e)}catch(r){return e}}})))),async mdel(...r){await e.del(r)},async del(r){await e.del(r)},ttl:async r=>e.pttl(r),keys:(e="*")=>keys(e),reset:()=>{throw new i.MidwayCommonError("flushdb() is too dangerous, if necessary, please use redisServiceFactory.get(client) to get the instance and call it manually.")},isCacheable:n}}},9589:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Cookie=void 0;const i=n(42613);const s=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;const o=/^(?:none|lax|strict)$/i;class Cookie{constructor(e,r,n){i(s.test(e),"argument name is invalid");i(!r||s.test(r),"argument value is invalid");this.name=e;this.value=r||"";this.attrs=mergeDefaultAttrs(n);i(!this.attrs.path||s.test(this.attrs.path),"argument option path is invalid");i(!this.attrs.domain||s.test(this.attrs.domain),"argument option domain is invalid");i(!this.attrs.sameSite||this.attrs.sameSite===true||o.test(this.attrs.sameSite),"argument option sameSite is invalid");if(!r){this.attrs.expires=new Date(0);this.attrs.maxAge=null}}toString(){return this.name+"="+this.value}toHeader(){let e=this.toString();const r=this.attrs;if(r.path)e+="; path="+r.path;const n=typeof r.maxAge==="string"?parseInt(r.maxAge,10):r.maxAge;if(n){e+="; max-age="+Math.round(n/1e3);r.expires=new Date(Date.now()+n)}if(r.expires)e+="; expires="+r.expires.toUTCString();if(r.domain)e+="; domain="+r.domain;if(r.sameSite)e+="; samesite="+(r.sameSite===true?"strict":r.sameSite.toLowerCase());if(r.secure)e+="; secure";if(r.httpOnly)e+="; httponly";if(r.priority)e+="; priority="+r.priority;if(r.partitioned)e+="; partitioned";return e}}r.Cookie=Cookie;const a=["path","expires","domain","httpOnly","secure","partitioned","maxAge","overwrite","sameSite","priority"];function mergeDefaultAttrs(e){const r={path:"/",httpOnly:true,secure:false,overwrite:false,sameSite:false,partitioned:false};if(!e)return r;for(let n=0;n<a.length;n++){const i=a[n];if(i in e)r[i]=e[i]}return r}},84320:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.urlSafeDecode=r.urlSafeEncode=r.Cookies=void 0;const i=n(42613);const s=n(9589);const o=n(83856);const a=n(38552);const c=Symbol("midwayCookies:keysArray");const u=Symbol("midwayCookies:keys");const p=new Map;class Cookies{constructor(e,r,n,i){var s;this[c]=r?[].concat(r):r;this._defaultCookieOptions=n;this._defaultGetCookieOptions=i;this.ctx=e;this.secure=(s=n===null||n===void 0?void 0:n.secure)!==null&&s!==void 0?s:this.ctx.secure;this.app=e.app}get keys(){if(!this[u]){const e=this[c];i(Array.isArray(e),".keys required for encrypt/sign cookies");const r=p.get(e);if(r){this[u]=r}else{this[u]=new o.Keygrip(this[c]);p.set(e,this[u])}}return this[u]}get(e,r){r=Object.assign({},this._defaultGetCookieOptions||{},r);const n=computeSigned(r);const i=this.ctx.get("cookie");if(!i)return;const s=i.match(getPattern(e));if(!s)return;let o=s[1];if(!r.encrypt&&!n)return o;if(n){const r=e+".sig";const n=this.get(r,{signed:false});if(!n)return;const i=e+"="+o;const s=this.keys.verify(i,n);if(s<0){this.set(r,null,{path:"/",signed:false});return}if(s>0){this.set(r,this.keys.sign(i),{signed:false})}return o}o=urlSafeDecode(o);const a=this.keys.decrypt(o);if(a===null||a===void 0?void 0:a.value){return a.value.toString()}return undefined}set(e,r,n){if(!n&&typeof r!=="string"){n=r;r=""}n=Object.assign({},this._defaultCookieOptions,n);const i=computeSigned(n);r=r||"";if(!this.secure&&n.secure){throw new Error("Cannot send secure cookie over unencrypted connection")}let o=this.ctx.response.get("set-cookie")||[];if(!Array.isArray(o))o=[o];if(n.encrypt){r=r&&urlSafeEncode(this.keys.encrypt(r))}if(r.length>4093){this.app.emit("cookieLimitExceed",{name:e,value:r,ctx:this.ctx})}const a=this.ctx.get("user-agent");if(n.sameSite&&typeof n.sameSite==="string"&&n.sameSite.toLowerCase()==="none"){if(!this.secure||a&&!this.isSameSiteNoneCompatible(a)){n.sameSite=false}}if(n.partitioned){if(!this.secure||!a||a&&!this.isPartitionedCompatible(a)){n.partitioned=false}}if(n.partitioned&&n.removeUnpartitioned){const r=n.overwrite;if(r){n.overwrite=false;o=ignoreCookiesByName(o,e)}const a=Object.assign({},n,{partitioned:false});const c=new s.Cookie(e,"",a);if(n.secure===undefined)c.attrs.secure=this.secure;o=pushCookie(o,c);if(i){c.name+=".sig";o=ignoreCookiesByName(o,c.name);o=pushCookie(o,c)}}if(n.priority){if(!a||a&&!this.isPriorityCompatible(a)){n.priority=undefined}}const c=new s.Cookie(e,r,n);if(n.secure===undefined)c.attrs.secure=this.secure;o=pushCookie(o,c);if(i){c.value=r&&this.keys.sign(c.toString());c.name+=".sig";o=pushCookie(o,c)}this.ctx.set("set-cookie",o);return this}isSameSiteNoneCompatible(e){const r=this.parseChromiumAndMajorVersion(e);if(r.chromium&&r.majorVersion){return r.majorVersion>=80}return(0,a.isSameSiteNoneCompatible)(e)}isPartitionedCompatible(e){const r=this.parseChromiumAndMajorVersion(e);if(r.chromium&&r.majorVersion){return r.majorVersion>=114}return false}parseChromiumAndMajorVersion(e){if(!this.uaParseResult){const r=/Chrom[^ /]+\/(\d+)[.\d]* /.exec(e);if(!r)return{chromium:false,majorVersion:undefined};this.uaParseResult={chromium:true,majorVersion:parseInt(r[1])}}return this.uaParseResult}isPriorityCompatible(e){const r=this.parseChromiumAndMajorVersion(e);if(r.chromium&&r.majorVersion){return r.majorVersion>=81}return false}}r.Cookies=Cookies;const g=new Map;function getPattern(e){const r=g.get(e);if(r)return r;const n=new RegExp("(?:^|;) *"+e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)");g.set(e,n);return n}function computeSigned(e){if(e.encrypt)return false;return e.signed!==false}function pushCookie(e,r){if(r.attrs.overwrite){e=ignoreCookiesByName(e,r.name)}e.push(r.toHeader());return e}function ignoreCookiesByName(e,r){const n=`${r}=`;return e.filter((e=>!e.startsWith(n)))}function urlSafeEncode(e){return e.replace(/\+/g,"-").replace(/\//g,"_")}r.urlSafeEncode=urlSafeEncode;function urlSafeDecode(e){return e.replace(/-/g,"+").replace(/_/g,"/")}r.urlSafeDecode=urlSafeDecode},78439:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});s(n(81580),r);s(n(84320),r)},81580:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},83856:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Keygrip=void 0;const i=n(42613);const s=n(39023);const o=n(76982);const a=n(30451);const c=(0,s.debuglog)("midway:cookies");const u={"/":"_","+":"-","=":""};class Keygrip{constructor(e){i(Array.isArray(e)&&e.length,"keys must be provided and should be an array");this.keys=e;this.hash="sha256"}encrypt(e,r){r=r||this.keys[0];try{e=String(e);const n=getAlgorithm();const i=(0,o.randomBytes)(64);const s=(0,o.randomBytes)(16);const a=Math.floor(Math.random()*(99999-1e4+1))+1e4;const c=deriveKeyFromPassword(r,i,Math.floor(a*.47+1337));const u=(0,o.createCipheriv)(n,c,s);const p=Buffer.concat([u.update(e,"utf8"),u.final()]);const g=u.getAuthTag();const v=Buffer.concat([i,s,g,Buffer.from(a.toString()),p]).toString("hex");return getEncryptedPrefix()+v}catch(e){c("crypt error",e.stack);return undefined}}decrypt(e,r){if(!r){const r=this.keys;for(let n=0;n<r.length;n++){const i=this.decrypt(e,r[n]);if(i!==false)return{value:i,index:n}}return false}try{const n=getAlgorithm();const i=e.split(getEncryptedPrefix());if(i.length!==2){return void 0}else{e=i[1]}const s=Buffer.from(e,"hex");const a=s.slice(0,64);const c=s.slice(64,80);const u=s.slice(80,96);const p=parseInt(s.slice(96,101).toString("utf-8"),10);const g=s.slice(101);const v=deriveKeyFromPassword(r,a,Math.floor(p*.47+1337));const b=(0,o.createDecipheriv)(n,v,c);b.setAuthTag(u);return b.update(g,"binary","utf-8")+b.final("utf-8")}catch(e){c("crypt error",e.stack);return false}}sign(e,r){r=r||this.keys[0];return(0,o.createHmac)(this.hash,r).update(e).digest("base64").replace(/\/|\+|=/g,(e=>u[e]))}verify(e,r){const n=this.keys;for(let i=0;i<n.length;i++){if(a(Buffer.from(r),Buffer.from(this.sign(e,n[i])))){c("data %s match key %s",e,n[i]);return i}}return-1}}r.Keygrip=Keygrip;function getAlgorithm(){return"aes-256-gcm"}function getEncryptedPrefix(){return"enc::"}function deriveKeyFromPassword(e,r,n){return(0,o.pbkdf2Sync)(e,r,n,32,"sha512")}},31630:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.BaseFramework=void 0;const o=n(87270);const a=n(77404);const c=n(8351);const u=n(34005);const p=n(14057);const g=n(73440);const v=n(41560);const b=n(70426);const _=n(91044);const E=n(66134);const x=n(43762);const T=n(67072);const w=n(39023);const C=n(46905);const A=n(81347);const k=w.debuglog("midway:debug");class BaseFramework{constructor(e){this.applicationContext=e;this.defaultContext={};this.middlewareManager=this.createMiddlewareManager();this.filterManager=this.createFilterManager();this.guardManager=this.createGuardManager();this.composeMiddleware=null}async init(){var e,r;this.configurationOptions=(e=this.configure())!==null&&e!==void 0?e:{};this.contextLoggerApplyLogger=(r=this.configurationOptions.contextLoggerApplyLogger)!==null&&r!==void 0?r:"appLogger";this.contextLoggerFormat=this.configurationOptions.contextLoggerFormat;this.logger=this.loggerService.getLogger("coreLogger");this.appLogger=this.loggerService.getLogger("appLogger");return this}isEnable(){return true}async initialize(e){this.bootstrapOptions=e;await this.beforeContainerInitialize(e);await this.containerInitialize(e);await this.afterContainerInitialize(e);await this.containerDirectoryLoad(e);await this.afterContainerDirectoryLoad(e);await this.applicationInitialize(e);await this.containerReady(e);await this.afterContainerReady(e);await this.mockService.runSimulatorAppSetup(this.app)}async containerInitialize(e){}async containerDirectoryLoad(e){}async containerReady(e){if(!this.app.getApplicationContext){this.defineApplicationProperties()}}getApplicationContext(){return this.applicationContext}getConfiguration(e){return this.configService.getConfiguration(e)}getCurrentEnvironment(){return this.environmentService.getCurrentEnvironment()}getApplication(){return this.app}createContextLogger(e,r){if(r&&r!=="appLogger"){const n=this.getLogger(r);let i=e.getAttr(a.REQUEST_CTX_LOGGER_CACHE_KEY);if(!i){i=new Map;e.setAttr(a.REQUEST_CTX_LOGGER_CACHE_KEY,i)}if(i.has(r)){return i.get(r)}const s=this.loggerService.createContextLogger(e,n);i.set(r,s);return s}else{const n=this.getLogger(r!==null&&r!==void 0?r:this.contextLoggerApplyLogger);if(e["_logger"]){return e["_logger"]}e["_logger"]=this.loggerService.createContextLogger(e,n,{contextFormat:this.contextLoggerFormat});return e["_logger"]}}async stop(){await this.mockService.runSimulatorAppTearDown(this.app);await this.beforeStop()}getAppDir(){return this.informationService.getAppDir()}getBaseDir(){return this.informationService.getBaseDir()}defineApplicationProperties(e={},r=[]){const n={getBaseDir:()=>this.getBaseDir(),getAppDir:()=>this.getAppDir(),getEnv:()=>this.getCurrentEnvironment(),getApplicationContext:()=>this.getApplicationContext(),getConfig:e=>this.getConfiguration(e),getFrameworkType:()=>{if(this["getFrameworkType"]){return this["getFrameworkType"]()}},getProcessType:()=>o.MidwayProcessTypeEnum.APPLICATION,getCoreLogger:()=>this.getCoreLogger(),getLogger:e=>this.getLogger(e),createLogger:(e,r={})=>this.createLogger(e,r),getFramework:()=>this,getProjectName:()=>this.getProjectName(),createAnonymousContext:e=>{const r=e||Object.create(this.defaultContext);if(!r.startTime){r.startTime=Date.now()}if(!r.logger){r.logger=this.createContextLogger(r)}if(!r.requestContext){r.requestContext=new u.MidwayRequestContainer(r,this.getApplicationContext());r.requestContext.ready()}if(!r.getLogger){r.getLogger=e=>this.createContextLogger(r,e)}r.setAttr=(e,n)=>{r.requestContext.setAttr(e,n)};r.getAttr=e=>r.requestContext.getAttr(e);r.getApp=()=>this.getApplication();return r},addConfigObject:e=>{this.configService.addObject(e)},setAttr:(e,r)=>{this.getApplicationContext().setAttr(e,r)},getAttr:e=>this.getApplicationContext().getAttr(e),useMiddleware:e=>this.useMiddleware(e),getMiddleware:()=>this.getMiddleware(),useFilter:e=>this.useFilter(e),useGuard:e=>this.useGuard(e),getNamespace:()=>this.getNamespace()};for(const e of r){delete n[e]}Object.assign(this.app,n,e)}async beforeStop(){}async beforeContainerInitialize(e){}async afterContainerInitialize(e){}async afterContainerDirectoryLoad(e){}async afterContainerReady(e){}async applyMiddleware(e){var r;if(!this.composeMiddleware){if(!this.applicationContext.hasObject(a.ASYNC_CONTEXT_MANAGER_KEY)){const e=this.configService.getConfiguration("asyncContextManager.enable")||false;const n=e?((r=this.bootstrapOptions)===null||r===void 0?void 0:r.asyncContextManager)||new C.NoopContextManager:new C.NoopContextManager;if(e){n.enable()}this.applicationContext.registerObject(a.ASYNC_CONTEXT_MANAGER_KEY,n)}this.middlewareManager.insertFirst((async(e,r)=>{const n=C.ASYNC_ROOT_CONTEXT.setValue(a.ASYNC_CONTEXT_KEY,e);const i=this.applicationContext.get(a.ASYNC_CONTEXT_MANAGER_KEY);return await i.with(n,(async()=>{await this.mockService.runSimulatorContextSetup(e,this.app);this.mockService.applyContextMocks(this.app,e);let n=undefined;try{const i=await r();n=await this.filterManager.runResultFilter(i,e)}catch(r){n=await this.filterManager.runErrorFilter(r,e)}finally{await this.mockService.runSimulatorContextTearDown(e,this.app)}if(n.error){throw n.error}return n.result}))}));k(`[core]: Compose middleware = [${this.middlewareManager.getNames()}]`);this.composeMiddleware=await this.middlewareService.compose(this.middlewareManager,this.app);await this.filterManager.init(this.applicationContext)}if(e){e=Array.isArray(e)?e:[e];return await this.middlewareService.compose([this.composeMiddleware,...e],this.app)}return this.composeMiddleware}getLogger(e){var r;return(r=this.loggerService.getLogger(e))!==null&&r!==void 0?r:this.appLogger}getCoreLogger(){return this.logger}createLogger(e,r={}){return this.loggerService.createLogger(e,r)}getProjectName(){return this.informationService.getProjectName()}getFrameworkName(){return this.constructor.name}useMiddleware(e){this.middlewareManager.insertLast(e)}getMiddleware(){return this.middlewareManager}useFilter(e){return this.filterManager.useFilter(e)}useGuard(e){return this.guardManager.addGlobalGuard(e)}async runGuard(e,r,n){return this.guardManager.runGuard(e,r,n)}createMiddlewareManager(){return new _.ContextMiddlewareManager}createFilterManager(){return new x.FilterManager}createGuardManager(){return new A.GuardManager}setNamespace(e){this.namespace=e}getNamespace(){return this.namespace}}i([(0,c.Inject)(),s("design:type",b.MidwayLoggerService)],BaseFramework.prototype,"loggerService",void 0);i([(0,c.Inject)(),s("design:type",p.MidwayEnvironmentService)],BaseFramework.prototype,"environmentService",void 0);i([(0,c.Inject)(),s("design:type",g.MidwayConfigService)],BaseFramework.prototype,"configService",void 0);i([(0,c.Inject)(),s("design:type",v.MidwayInformationService)],BaseFramework.prototype,"informationService",void 0);i([(0,c.Inject)(),s("design:type",E.MidwayMiddlewareService)],BaseFramework.prototype,"middlewareService",void 0);i([(0,c.Inject)(),s("design:type",T.MidwayMockService)],BaseFramework.prototype,"mockService",void 0);i([(0,c.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],BaseFramework.prototype,"init",null);r.BaseFramework=BaseFramework},51926:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.MidwayApplicationManager=void 0;const s=n(87270);const o=n(8351);let a=class MidwayApplicationManager{constructor(){this.globalFrameworkMap=new Map;this.globalFrameworkTypeMap=new WeakMap}addFramework(e,r){this.globalFrameworkMap.set(e,r);if(r["getFrameworkType"]){this.globalFrameworkTypeMap.set(r["getFrameworkType"](),r)}}getFramework(e){if(typeof e==="string"){if(this.globalFrameworkMap.has(e)){return this.globalFrameworkMap.get(e)}}else{if(this.globalFrameworkTypeMap.has(e)){return this.globalFrameworkTypeMap.get(e)}}}getApplication(e){if(typeof e==="string"){if(this.globalFrameworkMap.has(e)){return this.globalFrameworkMap.get(e).getApplication()}}else{if(this.globalFrameworkTypeMap.has(e)){return this.globalFrameworkTypeMap.get(e).getApplication()}}}getApplications(e){if(!e){return Array.from(this.globalFrameworkMap.values()).map((e=>e.getApplication())).filter((e=>!!e))}else{return e.map((e=>this.getApplication(e))).filter((e=>!!e))}}};a=i([(0,o.Provide)(),(0,o.Scope)(s.ScopeEnum.Singleton)],a);r.MidwayApplicationManager=a},46905:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.NoopContextManager=r.ASYNC_ROOT_CONTEXT=void 0;class AsyncBaseContext{constructor(e){const r=this;r._currentContext=e?new Map(e):new Map;r.getValue=e=>r._currentContext.get(e);r.setValue=(e,n)=>{const i=new AsyncBaseContext(r._currentContext);i._currentContext.set(e,n);return i};r.deleteValue=e=>{const n=new AsyncBaseContext(r._currentContext);n._currentContext.delete(e);return n}}}r.ASYNC_ROOT_CONTEXT=new AsyncBaseContext;class NoopContextManager{active(){return r.ASYNC_ROOT_CONTEXT}with(e,r,n,...i){return r.call(n,...i)}bind(e,r){return r}enable(){return this}disable(){return this}}r.NoopContextManager=NoopContextManager},7647:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.DataListener=void 0;const o=n(8351);class DataListener{async init(){this.innerData=await this.initData();await this.onData(this.setData.bind(this))}setData(e){this.innerData=e}getData(){return this.innerData}async stop(){await this.destroyListener()}async destroyListener(){}}i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],DataListener.prototype,"init",null);i([(0,o.Destroy)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],DataListener.prototype,"stop",null);r.DataListener=DataListener},50771:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.globModels=r.formatGlobString=r.DataSourceManager=void 0;const o=n(90428);const a=n(86248);const c=n(30266);const u=n(16928);const p=n(73171);const g=n(77404);const v=n(39023);const b=n(86110);const _=n(8351);const E=n(14057);const x=n(60340);const T=(0,v.debuglog)("midway:debug");class DataSourceManager{constructor(){this.dataSource=new Map;this.options={};this.modelMapping=new WeakMap;this.dataSourcePriority={}}async initDataSource(e,r){var n;this.options=e;if(!this.options.dataSource){throw new a.MidwayParameterError("[DataSourceManager] must set options.dataSource.")}if(typeof r==="string"){r={baseDir:r,entitiesConfigKey:"entities"}}for(const i in e.dataSource){const s=e.dataSource[i];const o=s[r.entitiesConfigKey];if(o){const e=new Set;for(const s of o){if(typeof s==="string"){const o=await globModels(s,r.baseDir,(n=this.environmentService)===null||n===void 0?void 0:n.getModuleLoadType());for(const r of o){e.add(r);this.modelMapping.set(r,i)}}else{e.add(s);this.modelMapping.set(s,i)}}s[r.entitiesConfigKey]=Array.from(e);T(`[core]: DataManager load ${s[r.entitiesConfigKey].length} models from ${i}.`)}const a={cacheInstance:e.cacheInstance,validateConnection:e.validateConnection};await this.createInstance(s,i,a)}}getDataSource(e){return this.dataSource.get(e)}hasDataSource(e){return this.dataSource.has(e)}getDataSourceNames(){return Array.from(this.dataSource.keys())}getAllDataSources(){return this.dataSource}async isConnected(e){const r=this.getDataSource(e);return r?this.checkConnected(r):false}async createInstance(e,r,n){const i=n&&typeof n.cacheInstance==="boolean"?n.cacheInstance:true;const s=n&&n.validateConnection||false;const c=(0,o.extend)(true,{},this.options["default"],e);const u=await this.createDataSource(c,r);if(i&&r&&u){this.dataSource.set(r,u)}if(s){if(!u){throw new a.MidwayCommonError(`[DataSourceManager] ${r} initialization failed.`)}const e=await this.checkConnected(u);if(!e){throw new a.MidwayCommonError(`[DataSourceManager] ${r} is not connected.`)}}return u}getDataSourceNameByModel(e){return this.modelMapping.get(e)}async stop(){const e=Array.from(this.dataSource.values());await Promise.all(e.map((e=>this.destroyDataSource(e))));this.dataSource.clear()}getDefaultDataSourceName(){if(this.innerDefaultDataSourceName===undefined){if(this.options["defaultDataSourceName"]){this.innerDefaultDataSourceName=this.options["defaultDataSourceName"]}else if(this.dataSource.size===1){this.innerDefaultDataSourceName=Array.from(this.dataSource.keys())[0]}else{this.innerDefaultDataSourceName=""}}return this.innerDefaultDataSourceName}getDataSourcePriority(e){return this.priorityManager.getPriority(this.dataSourcePriority[e])}isHighPriority(e){return this.priorityManager.isHighPriority(this.dataSourcePriority[e])}isMediumPriority(e){return this.priorityManager.isMediumPriority(this.dataSourcePriority[e])}isLowPriority(e){return this.priorityManager.isLowPriority(this.dataSourcePriority[e])}}i([(0,_.Inject)(),s("design:type",String)],DataSourceManager.prototype,"appDir",void 0);i([(0,_.Inject)(),s("design:type",E.MidwayEnvironmentService)],DataSourceManager.prototype,"environmentService",void 0);i([(0,_.Inject)(),s("design:type",x.MidwayPriorityManager)],DataSourceManager.prototype,"priorityManager",void 0);r.DataSourceManager=DataSourceManager;function formatGlobString(e){let r;if(!/^\*/.test(e)){e="/"+e}const n=(0,u.parse)(e);if(n.base&&(/\*/.test(n.base)||n.ext)){r=[e]}else{r=[...g.DEFAULT_PATTERN.map((r=>(0,u.join)(e,r)))]}return r}r.formatGlobString=formatGlobString;async function globModels(e,r,n){const i=formatGlobString(e);const s=[];const o=(0,c.run)(i,{cwd:r,ignore:g.IGNORE_PATTERN});for(const e of o){const r=await(0,b.loadModule)(e,{loadMode:n});if(p.Types.isClass(r)){s.push(r)}else{for(const e in r){const n=r[e];if(p.Types.isClass(n)){s.push(n)}}}}return s}r.globModels=globModels},11207:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.CustomModuleDetector=r.ESModuleFileDetector=r.CommonJSFileDetector=r.AbstractFileDetector=void 0;const i=n(73171);const s=n(30266);const o=n(86248);const a=n(77404);const c=n(8351);const u=n(86110);class AbstractFileDetector{constructor(e){this.options=e;this.extraDetectorOptions={}}setExtraDetectorOptions(e){this.extraDetectorOptions=e}}r.AbstractFileDetector=AbstractFileDetector;const p=["**/**.tsx"].concat(a.DEFAULT_PATTERN);const g=["**/logs/**","**/run/**","**/public/**","**/app/view/**","**/app/views/**","**/app/extend/**","**/node_modules/**","**/**.test.ts","**/**.test.js","**/__test__/**"].concat(a.IGNORE_PATTERN);class CommonJSFileDetector extends AbstractFileDetector{constructor(){super(...arguments);this.duplicateModuleCheckSet=new Map}run(e){if(this.getType()==="commonjs"){return this.loadSync(e)}else{return this.loadAsync(e)}}loadSync(e){var r;this.options=this.options||{};const n=[].concat((r=this.options.loadDir)!==null&&r!==void 0?r:e.get("baseDir"));for(const r of n){const n=(0,s.run)(p.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:r,ignore:g.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(e,r)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&i.Types.isClass(e)){const n=(0,c.getProviderName)(e);if(n){if(this.duplicateModuleCheckSet.has(n)){throw new o.MidwayDuplicateClassNameError(n,r.srcPath,this.duplicateModuleCheckSet.get(n))}else{this.duplicateModuleCheckSet.set(n,r.srcPath)}}}};for(const r of n){const n=require(r);e.bindClass(n,{namespace:this.options.namespace,srcPath:r,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}async loadAsync(e){var r;this.options=this.options||{};const n=[].concat((r=this.options.loadDir)!==null&&r!==void 0?r:e.get("baseDir"));for(const r of n){const n=(0,s.run)(p.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:r,ignore:g.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(e,r)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&i.Types.isClass(e)){const n=(0,c.getProviderName)(e);if(n){if(this.duplicateModuleCheckSet.has(n)){throw new o.MidwayDuplicateClassNameError(n,r.srcPath,this.duplicateModuleCheckSet.get(n))}else{this.duplicateModuleCheckSet.set(n,r.srcPath)}}}};for(const r of n){const n=await(0,u.loadModule)(r,{loadMode:"esm"});e.bindClass(n,{namespace:this.options.namespace,srcPath:r,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}getType(){return"commonjs"}}r.CommonJSFileDetector=CommonJSFileDetector;class ESModuleFileDetector extends CommonJSFileDetector{getType(){return"module"}}r.ESModuleFileDetector=ESModuleFileDetector;class CustomModuleDetector extends AbstractFileDetector{async run(e){for(const r of this.options.modules){e.bindClass(r,{namespace:this.options.namespace,createFrom:"module"})}}}r.CustomModuleDetector=CustomModuleDetector},43762:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.FilterManager=void 0;const i=n(8351);const s=n(86110);class FilterManager{constructor(){this.errFilterList=[];this.successFilterList=[];this.exceptionMap=new WeakMap;this.defaultErrFilter=undefined;this.matchFnList=[];this.protoMatchList=[]}useFilter(e){if(!Array.isArray(e)){e=[e]}for(const r of e){if((0,i.getClassMetadata)(i.CATCH_KEY,r)){this.errFilterList.push(r)}if((0,i.getClassMetadata)(i.MATCH_KEY,r)){this.successFilterList.push(r)}}}async init(e){for(const r of this.errFilterList){const n=await e.getAsync(r);const s=(0,i.getClassMetadata)(i.CATCH_KEY,r);if(s&&s.catchTargets){s.catchOptions=s.catchOptions||{};for(const e of s.catchTargets){this.exceptionMap.set(e,{filter:n,catchOptions:s.catchOptions});if(s.catchOptions["matchPrototype"]){this.protoMatchList.push((r=>{if(r instanceof e){return e}else{return false}}))}}}else{this.defaultErrFilter=n}}for(const r of this.successFilterList){const n=await e.getAsync(r);const o=(0,i.getClassMetadata)(i.MATCH_KEY,r);if(o&&o.matchPattern){this.matchFnList.push({matchFn:(0,s.toPathMatch)(o.matchPattern),target:n})}}}async runErrorFilter(e,r,n,i){let s,o;let a=false;if(this.exceptionMap.has(e.constructor)){a=true;const o=this.exceptionMap.get(e.constructor);s=await o.filter.catch(e,r,n,i)}if(!a&&this.protoMatchList.length){let o;for(const r of this.protoMatchList){o=r(e);if(o){break}}if(o){a=true;const c=this.exceptionMap.get(o);s=await c.filter.catch(e,r,n,i)}}if(!a&&this.defaultErrFilter){a=true;s=await this.defaultErrFilter.catch(e,r,n,i)}if(!a){o=e}return{result:s,error:o}}async runResultFilter(e,r,n,i){let s=e;for(const e of this.matchFnList){if(e.matchFn(r,n)){s=await e.target.match(s,r,n,i)}}return{result:s,error:undefined}}}r.FilterManager=FilterManager},81347:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.GuardManager=void 0;const i=n(8351);class GuardManager extends Array{addGlobalGuard(e){if(!Array.isArray(e)){this.push(e)}else{this.push(...e)}}async runGuard(e,r,n){for(const i of this){const s=await e.requestContext.getAsync(i);const o=await s.canActivate(e,r,n);if(!o){return false}}const s=(0,i.getClassMetadata)(i.GUARD_KEY,r);if(s){for(const i of s){const s=await e.requestContext.getAsync(i);const o=await s.canActivate(e,r,n);if(!o){return false}}}const o=(0,i.getPropertyMetadata)(i.GUARD_KEY,r,n);if(o){for(const i of o){const s=await e.requestContext.getAsync(i);const o=await s.canActivate(e,r,n);if(!o){return false}}}return true}}r.GuardManager=GuardManager},94853:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DefaultConsoleLoggerFactory=r.LoggerFactory=void 0;class LoggerFactory{}r.LoggerFactory=LoggerFactory;class DefaultConsoleLoggerFactory{constructor(){this.instance=new Map}createLogger(e,r){this.instance.set(e,console);return console}getLogger(e){return this.instance.get(e)}close(e){}removeLogger(e){}getDefaultMidwayLoggerConfig(){return{midwayLogger:{default:{},clients:{coreLogger:{},appLogger:{}}}}}createContextLogger(e,r,n){return r}getClients(){return this.instance}getClientKeys(){return Array.from(this.instance.keys())}}r.DefaultConsoleLoggerFactory=DefaultConsoleLoggerFactory},91044:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.createMiddleware=r.ContextMiddlewareManager=void 0;class ContextMiddlewareManager extends Array{insertFirst(e){if(Array.isArray(e)){this.unshift(...e)}else{this.unshift(e)}}insertLast(e){if(Array.isArray(e)){this.push(...e)}else{this.push(e)}}insertBefore(e,r){if(typeof r!=="number"){r=this.findItemIndex(r)}if(Array.isArray(e)){this.splice(r,0,...e)}else{this.splice(r,0,e)}}insertAfter(e,r){if(typeof r!=="number"){r=this.findItemIndex(r)}if(Array.isArray(e)){this.splice(r+1,0,...e)}else{this.splice(r+1,0,e)}}findAndInsertAfter(e,r){e=this.findItem(e);r=this.findItem(r);if(!e||!r||e===r){return}if(r){const n=this.remove(e);if(n){this.insertAfter(n,r)}}}findAndInsertBefore(e,r){e=this.findItem(e);r=this.findItem(r);if(!e||!r||e===r){return}if(r){const n=this.remove(e);if(n){this.insertBefore(n,r)}}}findAndInsertFirst(e){const r=this.remove(e);if(r){this.insertFirst(r)}}findAndInsertLast(e){const r=this.remove(e);if(r){this.insertLast(r)}}findItemIndex(e){if(typeof e==="number"){return e}else if(typeof e==="string"){return this.findIndex((r=>this.getMiddlewareName(r)===e))}else{return this.findIndex((r=>r===e))}}findItem(e){if(typeof e==="number"){if(e>=0&&e<=this.length-1){return this[e]}}else if(typeof e==="string"){return this.find((r=>this.getMiddlewareName(r)===e))}else{return e}}getMiddlewareName(e){var r,n,i;if(e["middleware"]){return(r=e.name)!==null&&r!==void 0?r:this.getMiddlewareName(e["middleware"])}return(i=(n=e.getName&&e.getName())!==null&&n!==void 0?n:e._name)!==null&&i!==void 0?i:e.name}remove(e){if(typeof e==="number"&&e!==-1){return this.splice(e,1)[0]}else{const r=this.findItemIndex(e);if(r!==-1){return this.splice(r,1)[0]}}}push(...e){e.forEach((e=>{if(typeof e!=="string"&&!this.getMiddlewareName(e)){e._name="anonymous"}}));return super.push(...e)}unshift(...e){e.forEach((e=>{if(typeof e!=="string"&&!this.getMiddlewareName(e)){e._name="anonymous"}}));return super.unshift(...e)}getNames(){return this.map((e=>this.getMiddlewareName(e)))}}r.ContextMiddlewareManager=ContextMiddlewareManager;function createMiddleware(e,r,n){return{middleware:e,options:r,name:n}}r.createMiddleware=createMiddleware},4334:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayInitializerPerformanceManager=r.MidwayPerformanceManager=void 0;const i=n(82987);class MidwayPerformanceManager{constructor(e){this.group=e;this.observer=null;this.marks=new Set;this.measures=new Set}static getInstance(e){if(!this.instances.has(e)){this.instances.set(e,new MidwayPerformanceManager(e))}return this.instances.get(e)}formatKey(e,r){return`${this.group}:${e}-${r}`}markStart(e){const r=this.formatKey(e,"start");i.performance.mark(r);this.marks.add(r)}markEnd(e){const r=this.formatKey(e,"start");const n=this.formatKey(e,"end");const s=`${this.group}:${e}`;i.performance.mark(n);this.marks.add(n);i.performance.measure(s,r,n);this.measures.add(s)}observeMeasure(e){if(this.observer){return}this.observer=new i.PerformanceObserver((r=>{const n=r.getEntries().filter((e=>e.name.startsWith(`${this.group}:`)));if(n.length>0){e({getEntries:()=>n})}}));this.observer.observe({entryTypes:["measure"]});return this.observer}disconnect(){if(this.observer){this.observer.disconnect();this.observer=null}}clean(){this.marks.forEach((e=>{try{i.performance.clearMarks(e)}catch(r){console.warn(`Failed to clear mark ${e}: ${r}`)}}));this.marks.clear();this.measures.forEach((e=>{try{i.performance.clearMeasures(e)}catch(r){console.warn(`Failed to clear measure ${e}: ${r}`)}}));this.measures.clear();this.disconnect()}static cleanAll(){this.instances.forEach((e=>e.clean()));this.instances.clear()}static getInitialPerformanceEntries(){const e=[];i.performance===null||i.performance===void 0?void 0:i.performance.getEntries().forEach((r=>{if(r.name.startsWith(this.DEFAULT_GROUP.INITIALIZE)){e.push(r.toJSON())}}));return e}}r.MidwayPerformanceManager=MidwayPerformanceManager;MidwayPerformanceManager.instances=new Map;MidwayPerformanceManager.DEFAULT_GROUP={INITIALIZE:"MidwayInitialize"};class MidwayInitializerPerformanceManager{static markStart(e){const r=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);r.markStart(e)}static markEnd(e){const r=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);r.markEnd(e)}static frameworkInitializeStart(e){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${e}`)}static frameworkInitializeEnd(e){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${e}`)}static frameworkRunStart(e){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${e}`)}static frameworkRunEnd(e){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${e}`)}static lifecycleStart(e,r){this.markStart(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${e}:${r}`)}static lifecycleEnd(e,r){this.markEnd(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${e}:${r}`)}}r.MidwayInitializerPerformanceManager=MidwayInitializerPerformanceManager;MidwayInitializerPerformanceManager.MEASURE_KEYS={INITIALIZE:"Initialize",METADATA_PREPARE:"MetadataPrepare",DETECTOR_PREPARE:"DetectorPrepare",DEFINITION_PREPARE:"DefinitionPrepare",CONFIG_LOAD:"ConfigLoad",LOGGER_PREPARE:"LoggerPrepare",FRAMEWORK_PREPARE:"FrameworkPrepare",FRAMEWORK_INITIALIZE:"FrameworkInitialize",FRAMEWORK_RUN:"FrameworkRun",LIFECYCLE_PREPARE:"LifecyclePrepare",PRELOAD_MODULE_PREPARE:"PreloadModulePrepare"}},60340:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.MidwayPriorityManager=r.DEFAULT_PRIORITY=void 0;const s=n(8351);const o=n(87270);r.DEFAULT_PRIORITY={L1:"High",L2:"Medium",L3:"Low"};let a=class MidwayPriorityManager{constructor(){this.priorityList=r.DEFAULT_PRIORITY;this.defaultPriority=r.DEFAULT_PRIORITY.L2}getCurrentPriorityList(){return this.priorityList}getDefaultPriority(){return this.defaultPriority}isHighPriority(e=r.DEFAULT_PRIORITY.L2){return e===r.DEFAULT_PRIORITY.L1}isMediumPriority(e=r.DEFAULT_PRIORITY.L2){return e===r.DEFAULT_PRIORITY.L2}isLowPriority(e=r.DEFAULT_PRIORITY.L2){return e===r.DEFAULT_PRIORITY.L3}getPriority(e){return e||this.getDefaultPriority()}};a=i([(0,s.Provide)(),(0,s.Scope)(o.ScopeEnum.Singleton)],a);r.MidwayPriorityManager=a},37940:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.ServiceFactory=void 0;const o=n(90428);const a=n(60340);const c=n(8351);class ServiceFactory{constructor(){this.clients=new Map;this.options={}}async initClients(e={}){this.options=e;if(e.client){e.clients=e.clients||{};e.clients["default"]=e.clients["default"]||{};(0,o.extend)(true,e.clients["default"],e.client)}if(e.clients){for(const r of Object.keys(e.clients)){await this.createInstance(e.clients[r],r)}}this.clientPriority=e.priority||{}}get(e="default"){return this.clients.get(e)}has(e){return this.clients.has(e)}async createInstance(e,r){e=(0,o.extend)(true,{},this.options["default"],e);const n=await this.createClient(e,r);if(n){if(r){this.clients.set(r,n)}return n}}async destroyClient(e,r){}async stop(){for(const[e,r]of this.clients.entries()){await this.destroyClient(r,e)}}getDefaultClientName(){return this.options["defaultClientName"]}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}getClientPriority(e){return this.priorityManager.getPriority(this.clientPriority[e])}isHighPriority(e){return this.priorityManager.isHighPriority(this.clientPriority[e])}isMediumPriority(e){return this.priorityManager.isMediumPriority(this.clientPriority[e])}isLowPriority(e){return this.priorityManager.isLowPriority(this.clientPriority[e])}}i([(0,c.Inject)(),s("design:type",a.MidwayPriorityManager)],ServiceFactory.prototype,"priorityManager",void 0);r.ServiceFactory=ServiceFactory},53924:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TypedResourceManager=void 0;class TypedResourceManager{constructor(e){this.typedResourceInitializerOptions=e;this.resourceMap=new Map;this.resourceBindingMap=new Map}async createResource(e,r){const n=await this.typedResourceInitializerOptions.resourceInitialize(r,e);this.resourceMap.set(e,n);return n}async init(){for(const e of Object.keys(this.typedResourceInitializerOptions.initializeValue)){const r=this.typedResourceInitializerOptions.initializeValue[e];const n=this.typedResourceInitializerOptions.initializeClzProvider[e];const i=await this.createResource(e,r);const s=await this.typedResourceInitializerOptions.resourceBinding(n,r,i,e);if(s){this.resourceBindingMap.set(e,s)}}}async startParallel(){const e=[];for(const[r,n]of this.resourceMap.entries()){e.push(this.typedResourceInitializerOptions.resourceStart(n,this.typedResourceInitializerOptions.initializeValue[r],this.resourceBindingMap.get(r)))}await Promise.all(e)}async start(){for(const[e,r]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceStart(r,this.typedResourceInitializerOptions.initializeValue[e],this.resourceBindingMap.get(e))}}async destroyParallel(){const e=[];for(const[r,n]of this.resourceMap.entries()){e.push(this.typedResourceInitializerOptions.resourceDestroy(n,this.typedResourceInitializerOptions.initializeValue[r]))}await Promise.all(e)}async destroy(){for(const[e,r]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceDestroy(r,this.typedResourceInitializerOptions.initializeValue[e])}this.resourceMap.clear();this.resourceBindingMap.clear()}getResource(e){return this.resourceMap.get(e)}}r.TypedResourceManager=TypedResourceManager},12888:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.WebControllerGenerator=void 0;const i=n(8351);const s=n(39023);const o=n(87270);const a=n(86248);const c=n(66134);const u=s.debuglog("midway:debug");class WebControllerGenerator{constructor(e,r){this.app=e;this.midwayWebRouterService=r}generateKoaController(e){return async(r,n)=>{if(e.controllerClz&&typeof e.method==="string"){const n=await this.app.getFramework().runGuard(r,e.controllerClz,e.method);if(!n){throw new a.httpError.ForbiddenError}}const s=[r,n];let o;if(typeof e.method!=="string"){o=await e.method(r,n)}else{const n=await r.requestContext.getAsync(e.id);o=await n[e.method].apply(n,s)}if(o!==undefined){if(o===null){r.response._body=null;r.response._midwayControllerNullBody=true}else{r.body=o}}if(Array.isArray(e.responseMetadata)&&e.responseMetadata.length){for(const n of e.responseMetadata){switch(n.type){case i.WEB_RESPONSE_HTTP_CODE:r.status=n.code;break;case i.WEB_RESPONSE_HEADER:for(const e in(n===null||n===void 0?void 0:n.setHeaders)||{}){r.set(e,n.setHeaders[e])}break;case i.WEB_RESPONSE_CONTENT_TYPE:r.type=n.contentType;break;case i.WEB_RESPONSE_REDIRECT:r.status=n.code;r.redirect(n.url);return}}}}}async loadMidwayController(e){var r,n;const i=await this.midwayWebRouterService.getRouterTable();const s=await this.midwayWebRouterService.getRoutePriorityList();const a=this.app.getApplicationContext();const p=this.app.getCoreLogger();const g=a.get(c.MidwayMiddlewareService);for(const c of s){a.bindClass(c.routerModule);p.debug(`Load Controller "${c.controllerId}", prefix=${c.prefix}`);u(`[core]: Load Controller "${c.controllerId}", prefix=${c.prefix}`);const s=this.createRouter({prefix:c.prefix,...c.routerOptions});c.middleware=(r=c.middleware)!==null&&r!==void 0?r:[];if(c.middleware.length){const e=await g.compose(c.middleware,this.app);s.use(e)}const v=i.get(c.prefix);for(const e of v){const r=[];e.middleware=(n=e.middleware)!==null&&n!==void 0?n:[];if(e.middleware.length){const n=await g.compose(e.middleware,this.app);r.push(n)}if(this.app.getFrameworkType()===o.MidwayFrameworkType.WEB_KOA){if(typeof e.url==="string"&&/\*$/.test(e.url)){e.url=e.url.replace("*","(.*)")}}const i=[e.routerName,e.url,...r,this.generateController(e)];p.debug(`Load Router "${e.requestMethod.toUpperCase()} ${e.url}"`);u(`[core]: Load Router "${e.requestMethod.toUpperCase()} ${e.url}"`);s[e.requestMethod.toLowerCase()].apply(s,i)}e&&e(s)}}}r.WebControllerGenerator=WebControllerGenerator},49211:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const i=n(86110);r["default"]=e=>{const r=(0,i.isDevelopmentEnvironment)((0,i.getCurrentEnvironment)());return{core:{healthCheckTimeout:1e3},asyncContextManager:{enable:false},midwayLogger:{default:{level:"info"},clients:{coreLogger:{level:r?"info":"warn"},appLogger:{aliasName:"logger"}}},debug:{recordConfigMergeOrder:r}}}},77404:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.SINGLETON_CONTAINER_CTX=r.IGNORE_PATTERN=r.DEFAULT_PATTERN=r.ASYNC_CONTEXT_MANAGER_KEY=r.ASYNC_CONTEXT_KEY=r.REQUEST_CTX_LOGGER_CACHE_KEY=r.HTTP_SERVER_KEY=r.CONTAINER_OBJ_SCOPE=r.REQUEST_OBJ_CTX_KEY=r.REQUEST_CTX_KEY=r.MIDWAY_LOGGER_WRITEABLE_DIR=r.FUNCTION_INJECT_KEY=r.KEYS=void 0;r.KEYS={OBJECTS_ELEMENT:"objects",OBJECT_ELEMENT:"object",IMPORT_ELEMENT:"import",PROPERTY_ELEMENT:"property",LIST_ELEMENT:"list",MAP_ELEMENT:"map",ENTRY_ELEMENT:"entry",VALUE_ELEMENT:"value",PROPS_ELEMENT:"props",PROP_ELEMENT:"prop",SET_ELEMENT:"set",CONSTRUCTOR_ARG_ELEMENT:"constructor-arg",REF_ELEMENT:"ref",JSON_ELEMENT:"json",CONFIGURATION_ELEMENT:"configuration",ID_ATTRIBUTE:"id",PATH_ATTRIBUTE:"path",DIRECT_ATTRIBUTE:"direct",AUTOWIRE_ATTRIBUTE:"autowire",ASYNC_ATTRIBUTE:"async",NAME_ATTRIBUTE:"name",REF_ATTRIBUTE:"ref",KEY_ATTRIBUTE:"key",VALUE_ATTRIBUTE:"value",TYPE_ATTRIBUTE:"type",EXTERNAL_ATTRIBUTE:"external",OBJECT_ATTRIBUTE:"object",RESOURCE_ATTRIBUTE:"resource",SCOPE_ATTRIBUTE:"scope",ASPECT_ELEMENT:"aspect",AROUND_ELEMENT:"around",EXPRESSION_ATTRIBUTE:"expression",EXECUTE_ATTRIBUTE:"execute"};r.FUNCTION_INJECT_KEY="midway:function_inject_key";r.MIDWAY_LOGGER_WRITEABLE_DIR="MIDWAY_LOGGER_WRITEABLE_DIR";r.REQUEST_CTX_KEY="ctx";r.REQUEST_OBJ_CTX_KEY="_req_ctx";r.CONTAINER_OBJ_SCOPE="_obj_scope";r.HTTP_SERVER_KEY="_midway_http_server";r.REQUEST_CTX_LOGGER_CACHE_KEY="_midway_ctx_logger_cache";r.ASYNC_CONTEXT_KEY=Symbol("ASYNC_CONTEXT_KEY");r.ASYNC_CONTEXT_MANAGER_KEY="MIDWAY_ASYNC_CONTEXT_MANAGER_KEY";r.DEFAULT_PATTERN=["**/**.ts","**/**.js","**/**.mts","**/**.mjs","**/**.cts","**/**.cjs"];r.IGNORE_PATTERN=["**/**.d.ts","**/**.d.mts","**/**.d.cts"];r.SINGLETON_CONTAINER_CTX={_MAIN_CTX_:true}},12922:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayContainer=void 0;const i=n(8351);const s=n(65061);const o=n(39023);const a=n(7755);const c=n(87270);const u=n(77404);const p=n(78028);const g=n(86271);const v=n(6282);const b=n(14057);const _=n(73440);const E=n(24434);const x=n(86248);const T=n(73171);const w=n(86110);const C=o.debuglog("midway:debug");const A=o.debuglog("midway:bind");const k=9;class ContainerConfiguration{constructor(e){this.container=e;this.loadedMap=new WeakMap;this.namespaceList=[];this.configurationOptionsList=[]}load(e){let r=i.MAIN_MODULE_KEY;const n=this.getConfigurationExport(e);if(!n.length)return;for(let e=0;e<n.length;e++){const o=n[e];if(this.loadedMap.get(o)){continue}let a;if(o instanceof s.FunctionalConfiguration){a=o.getConfigurationOptions()}else{a=(0,i.getClassMetadata)(i.CONFIGURATION_KEY,o)}this.loadedMap.set(o,true);if(a){if(a.namespace!==undefined){r=a.namespace;this.namespaceList.push(r)}this.configurationOptionsList.push(a);C(`[core]: load configuration in namespace="${r}"`);this.addImports(a.imports);this.addImportObjects(a.importObjects);this.addImportConfigs(a.importConfigs);this.addImportConfigFilter(a.importConfigFilter);this.bindConfigurationClass(o,r)}}this.container.bindClass(e,{namespace:r})}addImportConfigs(e){if(e){if(Array.isArray(e)){this.container.get(_.MidwayConfigService).add(e)}else{this.container.get(_.MidwayConfigService).addObject(e)}}}addImportConfigFilter(e){if(e){this.container.get(_.MidwayConfigService).addFilter(e)}}addImports(e=[]){var r;for(let n of e){if(!n)continue;if(typeof n==="string"){n=require(n)}if("Configuration"in n){this.load(n)}else if("component"in n){if(n===null||n===void 0?void 0:n.enabledEnvironment){if((r=n===null||n===void 0?void 0:n.enabledEnvironment)===null||r===void 0?void 0:r.includes(this.container.get(b.MidwayEnvironmentService).getCurrentEnvironment())){this.load(n.component)}}else{this.load(n.component)}}else{this.load(n)}}}addImportObjects(e){if(e){const r=Object.keys(e);for(const n of r){if(typeof e[n]!==undefined){this.container.registerObject(n,e[n])}}}}bindConfigurationClass(e,r){if(e instanceof s.FunctionalConfiguration){}else{(0,i.saveProviderId)(undefined,e);const n=(0,i.getProviderUUId)(e);this.container.bind(n,e,{namespace:r,scope:c.ScopeEnum.Singleton})}const n=(0,i.listModule)(i.CONFIGURATION_KEY);const o=n.find((r=>r.target===e));if(!o){(0,i.saveModule)(i.CONFIGURATION_KEY,{target:e,namespace:r})}}getConfigurationExport(e){const r=[];if(T.Types.isClass(e)||T.Types.isFunction(e)||e instanceof s.FunctionalConfiguration){r.push(e)}else{for(const n in e){const i=e[n];if(T.Types.isClass(i)||T.Types.isFunction(i)||i instanceof s.FunctionalConfiguration){r.push(i)}}}return r}getNamespaceList(){return this.namespaceList}getConfigurationOptionsList(){return this.configurationOptionsList}}class MidwayContainer{constructor(e){this._resolverFactory=null;this._registry=null;this._identifierMapping=null;this.moduleMap=null;this.parent=null;this.ctx=u.SINGLETON_CONTAINER_CTX;this.attrMap=new Map;this._namespaceSet=null;this.parent=e;this.init()}init(){this.registerObject(u.REQUEST_CTX_KEY,this.ctx)}get objectCreateEventTarget(){if(!this._objectCreateEventTarget){this._objectCreateEventTarget=new E}return this._objectCreateEventTarget}get registry(){if(!this._registry){this._registry=new a.ObjectDefinitionRegistry}return this._registry}set registry(e){this._registry=e}get managedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new v.ManagedResolverFactory(this)}return this._resolverFactory}get identifierMapping(){if(!this._identifierMapping){this._identifierMapping=this.registry.getIdentifierRelation()}return this._identifierMapping}get namespaceSet(){if(!this._namespaceSet){this._namespaceSet=new Set}return this._namespaceSet}load(e){var r,n,i;if(!Array.isArray(e)){e=[e]}const s=new ContainerConfiguration(this);for(const r of e){if(r){s.load(r)}}for(const e of s.getNamespaceList()){this.namespaceSet.add(e);C(`[core]: load configuration in namespace="${e}" complete`)}const o=(r=s.getConfigurationOptionsList())!==null&&r!==void 0?r:[];const a=(n=o.find((e=>!e.namespace)))!==null&&n!==void 0?n:{};this.fileDetector=(i=a.detector)!==null&&i!==void 0?i:this.fileDetector;if(this.fileDetector){this.fileDetector.setExtraDetectorOptions({conflictCheck:a.conflictCheck,...a.detectorOptions})}}loadDefinitions(){if(this.fileDetector){return this.fileDetector.run(this)}}bindClass(e,r){if(T.Types.isClass(e)||T.Types.isFunction(e)){this.bindModule(e,r)}else{for(const n in e){const i=e[n];if(T.Types.isClass(i)||T.Types.isFunction(i)){this.bindModule(i,r)}}}}bind(e,r,n){var s;if(T.Types.isClass(e)||T.Types.isFunction(e)){return this.bindModule(e,r)}if(this.registry.hasDefinition(e)){return}if(n===null||n===void 0?void 0:n.bindHook){n.bindHook(r,n)}let o;if(T.Types.isClass(r)){o=new p.ObjectDefinition;o.name=(0,i.getProviderName)(r)}else{o=new g.FunctionDefinition;if(!T.Types.isAsyncFunction(r)){o.asynchronous=false}o.name=o.id}o.path=r;o.id=e;o.srcPath=(n===null||n===void 0?void 0:n.srcPath)||null;o.namespace=(n===null||n===void 0?void 0:n.namespace)||"";o.scope=(n===null||n===void 0?void 0:n.scope)||c.ScopeEnum.Request;o.createFrom=n===null||n===void 0?void 0:n.createFrom;if(o.srcPath){C(`[core]: bind id "${o.name} (${o.srcPath}) ${e}"`)}else{C(`[core]: bind id "${o.name}" ${e}`)}const a=(0,i.getPropertyInject)(r);for(const e in a){const r=a[e];A(`${" ".repeat(k)}inject properties => [${JSON.stringify(r)}]`);const n=new v.ManagedReference;n.args=r.args;n.name=r.value;n.injectMode=r["injectMode"];o.properties.set(r["targetKey"],n)}const u=(0,i.getClassExtendedMetadata)(i.INJECT_CUSTOM_PROPERTY,r);for(const e in u){const r=u[e];o.handlerProps.push(r)}const b=(s=(0,i.getObjectDefinition)(r))!==null&&s!==void 0?s:{};if(b.initMethod){A(`${" ".repeat(k)}register initMethod = ${b.initMethod}`);o.initMethod=b.initMethod}if(b.destroyMethod){A(`${" ".repeat(k)}register destroyMethod = ${b.destroyMethod}`);o.destroyMethod=b.destroyMethod}if(b.scope){A(`${" ".repeat(k)}register scope = ${b.scope}`);o.scope=b.scope}if(b.allowDowngrade){A(`${" ".repeat(k)}register allowDowngrade = ${b.allowDowngrade}`);o.allowDowngrade=b.allowDowngrade}this.objectCreateEventTarget.emit(c.ObjectLifeCycleEvent.BEFORE_BIND,r,{context:this,definition:o,replaceCallback:e=>{o=e}});if(o){this.registry.registerDefinition(o.id,o)}}bindModule(e,r){if(T.Types.isClass(e)){const n=(0,i.getProviderUUId)(e);if(n){this.identifierMapping.saveClassRelation(e,r===null||r===void 0?void 0:r.namespace);this.bind(n,e,r)}else{}}else{const n=e[u.FUNCTION_INJECT_KEY];if(n&&n.id){if(!n.scope){n.scope=c.ScopeEnum.Request}const i=w.Utils.generateRandomId();this.identifierMapping.saveFunctionRelation(n.id,i);this.bind(i,e,{scope:n.scope,namespace:r.namespace,srcPath:r.srcPath,createFrom:r.createFrom})}}}setFileDetector(e){this.fileDetector=e}createChild(){return new MidwayContainer(this)}setAttr(e,r){this.attrMap.set(e,r)}getAttr(e){return this.attrMap.get(e)}getIdentifier(e){return(0,i.getProviderUUId)(e)}getManagedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new v.ManagedResolverFactory(this)}return this._resolverFactory}async stop(){await this.getManagedResolverFactory().destroyCache();this.registry.clearAll()}ready(){return this.loadDefinitions()}get(e,r,n){var i;r=r!==null&&r!==void 0?r:[];n=n!==null&&n!==void 0?n:{originName:e};if(typeof e!=="string"){n.originName=e.name;e=this.getIdentifier(e)}if(this.registry.hasObject(e)){return this.registry.getObject(e)}const s=this.registry.getDefinition(e);if(!s&&this.parent){return this.parent.get(e,r)}if(!s){throw new x.MidwayDefinitionNotFoundError((i=n===null||n===void 0?void 0:n.originName)!==null&&i!==void 0?i:e)}return this.getManagedResolverFactory().create({definition:s,args:r})}async getAsync(e,r,n){var i;r=r!==null&&r!==void 0?r:[];n=n!==null&&n!==void 0?n:{originName:e};if(typeof e!=="string"){n.originName=e.name;e=this.getIdentifier(e)}if(this.registry.hasObject(e)){return this.registry.getObject(e)}const s=this.registry.getDefinition(e);if(!s&&this.parent){return this.parent.getAsync(e,r)}if(!s){throw new x.MidwayDefinitionNotFoundError((i=n===null||n===void 0?void 0:n.originName)!==null&&i!==void 0?i:e)}return this.getManagedResolverFactory().createAsync({definition:s,args:r})}registerObject(e,r){this.registry.registerObject(e,r)}onBeforeBind(e){this.objectCreateEventTarget.on(c.ObjectLifeCycleEvent.BEFORE_BIND,e)}onBeforeObjectCreated(e){this.objectCreateEventTarget.on(c.ObjectLifeCycleEvent.BEFORE_CREATED,e)}onObjectCreated(e){this.objectCreateEventTarget.on(c.ObjectLifeCycleEvent.AFTER_CREATED,e)}onObjectInit(e){this.objectCreateEventTarget.on(c.ObjectLifeCycleEvent.AFTER_INIT,e)}onBeforeObjectDestroy(e){this.objectCreateEventTarget.on(c.ObjectLifeCycleEvent.BEFORE_DESTROY,e)}saveModule(e,r){if(!this.moduleMap.has(e)){this.moduleMap.set(e,new Set)}this.moduleMap.get(e).add(r)}listModule(e){return Array.from(this.moduleMap.get(e)||{})}transformModule(e){this.moduleMap=new Map(e)}hasNamespace(e){return this.namespaceSet.has(e)}getNamespaceList(){return Array.from(this.namespaceSet)}hasDefinition(e){return this.registry.hasDefinition(e)}hasObject(e){return this.registry.hasObject(e)}getInstanceScope(e){if(e[u.CONTAINER_OBJ_SCOPE]){return e[u.CONTAINER_OBJ_SCOPE]}return undefined}}r.MidwayContainer=MidwayContainer},7755:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ObjectDefinitionRegistry=void 0;const i=n(8351);const s="_id_default_";class LegacyIdentifierRelation extends Map{saveClassRelation(e,r){const n=(0,i.getProviderUUId)(e);this.set(n,n);if(n){const s=(0,i.getProviderId)(e);if(s){this.set(s,n)}this.set((0,i.getProviderName)(e),n);if(r){this.set(r+":"+(0,i.getProviderName)(e),n)}}}saveFunctionRelation(e,r){this.set(r,r);this.set(e,r)}hasRelation(e){return this.has(e)}getRelation(e){return this.get(e)}}class ObjectDefinitionRegistry extends Map{constructor(){super(...arguments);this.singletonIds=[];this._identifierRelation=new LegacyIdentifierRelation}get identifierRelation(){if(!this._identifierRelation){this._identifierRelation=new LegacyIdentifierRelation}return this._identifierRelation}set identifierRelation(e){this._identifierRelation=e}get identifiers(){const e=[];for(const r of this.keys()){if(r.indexOf(s)===-1){e.push(r)}}return e}get count(){return this.size}getSingletonDefinitionIds(){return this.singletonIds}getDefinitionByName(e){const r=[];for(const n of this.values()){const i=n;if(i.name===e){r.push(i)}}return r}registerDefinition(e,r){if(r.isSingletonScope()){this.singletonIds.push(e)}this.set(e,r)}getDefinition(e){var r;e=(r=this.identifierRelation.getRelation(e))!==null&&r!==void 0?r:e;return this.get(e)}removeDefinition(e){this.delete(e)}hasDefinition(e){var r;e=(r=this.identifierRelation.getRelation(e))!==null&&r!==void 0?r:e;return this.has(e)}clearAll(){this.singletonIds=[];this.clear()}hasObject(e){var r;e=(r=this.identifierRelation.getRelation(e))!==null&&r!==void 0?r:e;return this.has(s+e)}registerObject(e,r){this.set(s+e,r)}getObject(e){var r;e=(r=this.identifierRelation.getRelation(e))!==null&&r!==void 0?r:e;return this.get(s+e)}getIdentifierRelation(){return this.identifierRelation}setIdentifierRelation(e){this.identifierRelation=e}}r.ObjectDefinitionRegistry=ObjectDefinitionRegistry},6282:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ManagedResolverFactory=r.ManagedReference=void 0;const i=n(77404);const s=n(87270);const o=n(39023);const a=n(86248);const c=o.debuglog("midway:managedresolver");const u=o.debuglog("midway:debug");class ManagedReference{constructor(){this.type=i.KEYS.REF_ELEMENT}}r.ManagedReference=ManagedReference;class RefResolver{constructor(e){this.factory=e}get type(){return i.KEYS.REF_ELEMENT}resolve(e,r){var n;const i=e;if(i.injectMode===s.InjectModeEnum.Class&&!((n=this.factory.context.parent)!==null&&n!==void 0?n:this.factory.context).hasDefinition(i.name)){if(r==="loggerService"){throw new a.MidwayInconsistentVersionError}else{throw new a.MidwayMissingImportComponentError(r)}}return this.factory.context.get(i.name,i.args,{originName:r})}async resolveAsync(e,r){var n;const i=e;if(i.injectMode===s.InjectModeEnum.Class&&!((n=this.factory.context.parent)!==null&&n!==void 0?n:this.factory.context).hasDefinition(i.name)){if(r==="loggerService"){throw new a.MidwayInconsistentVersionError}else{throw new a.MidwayMissingImportComponentError(r)}}return this.factory.context.getAsync(i.name,i.args,{originName:r})}}class ManagedResolverFactory{constructor(e){this.resolvers={};this.creating=new Map;this.singletonCache=new Map;this.context=e;this.resolvers={ref:new RefResolver(this)}}registerResolver(e){this.resolvers[e.type]=e}resolveManaged(e,r){const n=this.resolvers[e.type];if(!n||n.type!==e.type){throw new a.MidwayResolverMissingError(e.type)}return n.resolve(e,r)}async resolveManagedAsync(e,r){const n=this.resolvers[e.type];if(!n||n.type!==e.type){throw new a.MidwayResolverMissingError(e.type)}return n.resolveAsync(e,r)}create(e){const{definition:r,args:n}=e;if(r.isSingletonScope()&&this.singletonCache.has(r.id)){return this.singletonCache.get(r.id)}let o=this.createProxyReference(r);if(o){return o}this.compareAndSetCreateStatus(r);if(r.hasDependsOn()){for(const e of r.dependsOn){this.context.get(e,n)}}u(`[core]: Create id = "${r.name}" ${r.id}.`);const c=r.creator.load();let p=[];if(n&&Array.isArray(n)&&n.length>0){p=n}this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.BEFORE_CREATED,c,{constructorArgs:p,definition:r,context:this.context});o=r.creator.doConstruct(c,p,this.context);if(r.isRequestScope()&&r.constructor.name==="ObjectDefinition"){Object.defineProperty(o,i.REQUEST_OBJ_CTX_KEY,{value:this.context.get(i.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(r.properties){const e=r.properties.propertyKeys();for(const n of e){this.checkSingletonInvokeRequest(r,n);try{o[n]=this.resolveManaged(r.properties.get(n),n)}catch(e){if(a.MidwayDefinitionNotFoundError.isClosePrototypeOf(e)){const n=r.path.name;e.updateErrorMsg(n)}this.removeCreateStatus(r,true);throw e}}}this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.AFTER_CREATED,o,{context:this.context,definition:r,replaceCallback:e=>{o=e}});r.creator.doInit(o);this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.AFTER_INIT,o,{context:this.context,definition:r});if(r.id){if(r.isSingletonScope()){this.singletonCache.set(r.id,o);this.setInstanceScope(o,s.ScopeEnum.Singleton)}else if(r.isRequestScope()){this.context.registerObject(r.id,o);this.setInstanceScope(o,s.ScopeEnum.Request)}else{this.setInstanceScope(o,s.ScopeEnum.Prototype)}}this.removeCreateStatus(r,true);return o}async createAsync(e){const{definition:r,args:n}=e;if(r.isSingletonScope()&&this.singletonCache.has(r.id)){c(`id = ${r.id}(${r.name}) get from singleton cache.`);return this.singletonCache.get(r.id)}let o=this.createProxyReference(r);if(o){c(`id = ${r.id}(${r.name}) from proxy reference.`);return o}this.compareAndSetCreateStatus(r);if(r.hasDependsOn()){for(const e of r.dependsOn){c("id = %s init depend %s.",r.id,e);await this.context.getAsync(e,n)}}u(`[core]: Create id = "${r.name}" ${r.id}.`);const p=r.creator.load();let g=[];if(n&&Array.isArray(n)&&n.length>0){g=n}this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.BEFORE_CREATED,p,{constructorArgs:g,context:this.context});o=await r.creator.doConstructAsync(p,g,this.context);if(!o){this.removeCreateStatus(r,false);throw new a.MidwayCommonError(`${r.id} construct return undefined`)}if(r.isRequestScope()&&r.constructor.name==="ObjectDefinition"){c("id = %s inject ctx",r.id);Object.defineProperty(o,i.REQUEST_OBJ_CTX_KEY,{value:this.context.get(i.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(r.properties){const e=r.properties.propertyKeys();for(const n of e){this.checkSingletonInvokeRequest(r,n);try{o[n]=await this.resolveManagedAsync(r.properties.get(n),n)}catch(e){if(a.MidwayDefinitionNotFoundError.isClosePrototypeOf(e)){const n=r.path.name;e.updateErrorMsg(n)}this.removeCreateStatus(r,false);throw e}}}this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.AFTER_CREATED,o,{context:this.context,definition:r,replaceCallback:e=>{o=e}});await r.creator.doInitAsync(o);this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.AFTER_INIT,o,{context:this.context,definition:r});if(r.id){if(r.isSingletonScope()){c(`id = ${r.id}(${r.name}) set to singleton cache`);this.singletonCache.set(r.id,o);this.setInstanceScope(o,s.ScopeEnum.Singleton)}else if(r.isRequestScope()){c(`id = ${r.id}(${r.name}) set to register object`);this.context.registerObject(r.id,o);this.setInstanceScope(o,s.ScopeEnum.Request)}else{this.setInstanceScope(o,s.ScopeEnum.Prototype)}}this.removeCreateStatus(r,true);return o}async destroyCache(){for(const e of this.singletonCache.keys()){const r=this.context.registry.getDefinition(e);if(r.creator){const n=this.singletonCache.get(e);this.getObjectEventTarget().emit(s.ObjectLifeCycleEvent.BEFORE_DESTROY,n,{context:this.context,definition:r});await r.creator.doDestroyAsync(n)}}this.singletonCache.clear();this.creating.clear()}removeCreateStatus(e,r){if(this.creating.has(e.id)){this.creating.set(e.id,false)}return true}isCreating(e){return this.creating.has(e.id)&&this.creating.get(e.id)}compareAndSetCreateStatus(e){if(!this.creating.has(e.id)||!this.creating.get(e.id)){this.creating.set(e.id,true)}}createProxyReference(e){if(this.isCreating(e)){c("create proxy for %s.",e.id);if(!this.depthFirstSearch(e.id,e)){c("id = %s after dfs return null",e.id);return null}return new Proxy({__is_proxy__:true,__target_id__:e.id},{get:(r,n)=>{let i;if(e.isRequestScope()){i=this.context.registry.getObject(e.id)}else if(e.isSingletonScope()){i=this.singletonCache.get(e.id)}else{i=this.context.get(e.id)}if(i){if(typeof i[n]==="function"){return i[n].bind(i)}return i[n]}return undefined}})}return null}depthFirstSearch(e,r,n){var i;if(r){c("dfs for %s == %s start.",e,r.id);if(r.properties){const s=r.properties.propertyKeys();if(s.indexOf(e)>-1){c("dfs exist in properties %s == %s.",e,r.id);return true}for(const o of s){if(!Array.isArray(n)){n=[e]}let s=o;const a=r.properties.get(o);if(a&&a.name){s=(i=this.context.identifierMapping.getRelation(a.name))!==null&&i!==void 0?i:a.name}if(s===e){c("dfs exist in properties key %s == %s.",e,r.id);return true}if(n.indexOf(s)>-1){c("dfs depth circular %s == %s, %s, %j.",e,r.id,s,n);continue}else{n.push(s);c("dfs depth push %s == %s, %j.",e,s,n)}let u=this.context.registry.getDefinition(s);if(!u&&this.context.parent){u=this.context.parent.registry.getDefinition(s)}if(this.depthFirstSearch(e,u,n)){c("dfs exist in sub tree %s == %s subId = %s.",e,r.id,u.id);return true}}}c("dfs for %s == %s end.",e,r.id)}return false}getObjectEventTarget(){if(this.context.parent){return this.context.parent.objectCreateEventTarget}return this.context.objectCreateEventTarget}checkSingletonInvokeRequest(e,r){if(e.isSingletonScope()){const n=e.properties.get(r);if(this.context.hasDefinition(n===null||n===void 0?void 0:n.name)){const r=this.context.registry.getDefinition(n.name);if(r.isRequestScope()&&!r.allowDowngrade){throw new a.MidwaySingletonInjectRequestError(e.path.name,r.path.name)}}}return true}setInstanceScope(e,r){if(typeof e==="object"){if(r===s.ScopeEnum.Request&&e[i.REQUEST_OBJ_CTX_KEY]===i.SINGLETON_CONTAINER_CTX){r=s.ScopeEnum.Singleton}Object.defineProperty(e,i.CONTAINER_OBJ_SCOPE,{value:r,writable:false,enumerable:false,configurable:false})}}}r.ManagedResolverFactory=ManagedResolverFactory},20233:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.providerWrapper=void 0;const i=n(77404);function providerWrapper(e){for(const r of e){Object.defineProperty(r.provider,i.FUNCTION_INJECT_KEY,{value:r,writable:false})}}r.providerWrapper=providerWrapper},34005:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayRequestContainer=void 0;const i=n(12922);const s=n(8351);const o=n(77404);class MidwayRequestContainer extends i.MidwayContainer{constructor(e,r){super(r);this.applicationContext=r;this.registry.setIdentifierRelation(this.applicationContext.registry.getIdentifierRelation());this.ctx=e;this.registerObject(o.REQUEST_CTX_KEY,e);this.registerObject("res",{});if(e.logger){this.registerObject("logger",e.logger)}}init(){}get(e,r){if(typeof e!=="string"){e=this.getIdentifier(e)}if(this.registry.hasObject(e)){return this.registry.getObject(e)}const n=this.applicationContext.registry.getDefinition(e);if(n){if(n.isRequestScope()||n.id===s.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().create({definition:n,args:r})}}if(this.parent){return this.parent.get(e,r)}}async getAsync(e,r){if(typeof e!=="string"){e=this.getIdentifier(e)}if(this.registry.hasObject(e)){return this.registry.getObject(e)}const n=this.applicationContext.registry.getDefinition(e);if(n){if(n.isRequestScope()||n.id===s.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().createAsync({definition:n,args:r})}}if(this.parent){return this.parent.getAsync(e,r)}}async ready(){}getContext(){return this.ctx}}r.MidwayRequestContainer=MidwayRequestContainer},86409:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Aspect=void 0;const i=n(8351);const s=n(92139);const o=n(87270);function Aspect(e,r,n){return function(a){(0,i.saveModule)(i.ASPECT_KEY,a);const c=[].concat(e);for(const e of c){(0,i.attachClassMetadata)(i.ASPECT_KEY,{aspectTarget:e,match:r,priority:n},a)}(0,s.Scope)(o.ScopeEnum.Singleton)(a);(0,i.Provide)()(a)}}r.Aspect=Aspect},4166:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Autoload=void 0;const i=n(7679);const s=n(6960);function Autoload(){return function(e){(0,i.savePreloadModule)(e);(0,s.Provide)()(e)}}r.Autoload=Autoload},65963:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Configuration=void 0;const i=n(8351);function Configuration(e={}){return r=>{(0,i.saveClassMetadata)(i.CONFIGURATION_KEY,e,r)}}r.Configuration=Configuration},89183:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Match=r.Catch=void 0;const i=n(7679);const s=n(96695);const o=n(92139);const a=n(6960);const c=n(87270);function Catch(e,r={}){return function(n){const u=e?[].concat(e):undefined;(0,i.saveClassMetadata)(s.CATCH_KEY,{catchTargets:u,catchOptions:r},n);(0,o.Scope)(c.ScopeEnum.Singleton)(n);(0,a.Provide)()(n)}}r.Catch=Catch;function Match(e=true){return function(r){(0,i.saveClassMetadata)(s.MATCH_KEY,{matchPattern:e},r);(0,o.Scope)(c.ScopeEnum.Singleton)(r);(0,a.Provide)()(r)}}r.Match=Match},12629:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApplicationContext=r.Logger=r.App=r.Config=r.Plugin=r.Framework=void 0;const i=n(8351);const s=n(87270);function Framework(){return e=>{(0,i.saveModule)(i.FRAMEWORK_KEY,e);(0,i.Scope)(s.ScopeEnum.Singleton)(e);(0,i.Provide)()(e)}}r.Framework=Framework;function Plugin(e){return(0,i.createCustomPropertyDecorator)(i.PLUGIN_KEY,{identifier:e})}r.Plugin=Plugin;function Config(e){return(0,i.createCustomPropertyDecorator)(i.CONFIG_KEY,{identifier:e})}r.Config=Config;function App(e){return(0,i.createCustomPropertyDecorator)(i.APPLICATION_KEY,{type:e})}r.App=App;function Logger(e){return(0,i.createCustomPropertyDecorator)(i.LOGGER_KEY,{identifier:e})}r.Logger=Logger;function ApplicationContext(){return(0,i.createCustomPropertyDecorator)(i.APPLICATION_CONTEXT_KEY,{})}r.ApplicationContext=ApplicationContext},26748:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Guard=r.UseGuard=void 0;const i=n(7679);const s=n(87270);const o=n(96695);const a=n(6960);const c=n(92139);function UseGuard(e){return(r,n,s)=>{if(!Array.isArray(e)){e=[e]}if(n){(0,i.savePropertyMetadata)(o.GUARD_KEY,e,r,n)}else{(0,i.saveClassMetadata)(o.GUARD_KEY,e,r)}}}r.UseGuard=UseGuard;function Guard(){return e=>{(0,a.Provide)()(e);(0,c.Scope)(s.ScopeEnum.Singleton)(e)}}r.Guard=Guard},87216:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.InjectClient=r.Inject=void 0;const i=n(7679);const s=n(96695);function Inject(e){return function(r,n){(0,i.savePropertyInject)({target:r,targetKey:n,identifier:e})}}r.Inject=Inject;function InjectClient(e,r){return(0,i.createCustomPropertyDecorator)(s.FACTORY_SERVICE_CLIENT_KEY,{serviceFactoryClz:e,clientName:r})}r.InjectClient=InjectClient},42801:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Middleware=void 0;const i=n(8351);const s=n(87270);function Middleware(){return e=>{(0,i.Scope)(s.ScopeEnum.Singleton)(e);(0,i.Provide)()(e)}}r.Middleware=Middleware},78735:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Mock=void 0;const i=n(8351);const s=n(87270);function Mock(){return e=>{(0,i.saveModule)(i.MOCK_KEY,e);(0,i.Scope)(s.ScopeEnum.Singleton)(e);(0,i.Provide)()(e)}}r.Mock=Mock},92139:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Singleton=r.Scope=r.Destroy=r.Init=void 0;const i=n(7679);const s=n(6960);const o=n(87270);function Init(){return function(e,r){(0,i.saveObjectDefinition)(e,{initMethod:r})}}r.Init=Init;function Destroy(){return function(e,r){(0,i.saveObjectDefinition)(e,{destroyMethod:r})}}r.Destroy=Destroy;function Scope(e,r){return function(n){(0,i.saveObjectDefinition)(n,{scope:e,...r})}}r.Scope=Scope;function Singleton(){return function(e){Scope(o.ScopeEnum.Singleton)(e);(0,s.Provide)()(e)}}r.Singleton=Singleton},2765:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Pipe=void 0;const i=n(8351);const s=n(87270);function Pipe(){return e=>{(0,i.Scope)(s.ScopeEnum.Singleton)(e);(0,i.Provide)()(e)}}r.Pipe=Pipe},14767:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Pipeline=void 0;const i=n(7679);const s=n(96695);function Pipeline(e){return(0,i.createCustomPropertyDecorator)(s.PIPELINE_IDENTIFIER,{valves:e})}r.Pipeline=Pipeline},6960:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Provide=void 0;const i=n(7679);function Provide(e){return function(r){return(0,i.saveProviderId)(e,r)}}r.Provide=Provide},96695:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TAGGED_CLS=r.INJECT_CUSTOM_PARAM=r.INJECT_CUSTOM_METHOD=r.INJECT_CUSTOM_PROPERTY=r.INJECT_TAG=r.NAMED_TAG=r.CLASS_KEY_CONSTRUCTOR=r.APPLICATION_CONTEXT_KEY=r.APPLICATION_KEY=r.LOGGER_KEY=r.PLUGIN_KEY=r.CONFIG_KEY=r.MS_HSF_METHOD_KEY=r.MS_DUBBO_METHOD_KEY=r.MS_GRPC_METHOD_KEY=r.MS_PROVIDER_KEY=r.MS_PRODUCER_KEY=r.MS_CONSUMER_KEY=r.RPC_DUBBO_KEY=r.RPC_GRPC_KEY=r.HSF_KEY=r.WS_EVENT_KEY=r.WS_CONTROLLER_KEY=r.MODULE_TASK_QUEUE_OPTIONS=r.MODULE_TASK_QUEUE_KEY=r.MODULE_TASK_TASK_LOCAL_OPTIONS=r.MODULE_TASK_TASK_LOCAL_KEY=r.MODULE_TASK_METADATA=r.MODULE_TASK_KEY=r.WEB_RESPONSE_RENDER=r.WEB_RESPONSE_CONTENT_TYPE=r.WEB_RESPONSE_HEADER=r.WEB_RESPONSE_REDIRECT=r.WEB_RESPONSE_HTTP_CODE=r.WEB_RESPONSE_KEY=r.WEB_ROUTER_PARAM_KEY=r.WEB_ROUTER_KEY=r.CONTROLLER_KEY=r.SERVERLESS_FUNC_KEY=r.FUNC_KEY=r.FACTORY_SERVICE_CLIENT_KEY=r.MOCK_KEY=r.GUARD_KEY=r.MATCH_KEY=r.CATCH_KEY=r.ASPECT_KEY=r.FRAMEWORK_KEY=r.CONFIGURATION_KEY=r.SCHEDULE_KEY=r.ALL=void 0;r.PRIVATE_META_DATA_KEY=r.MAIN_MODULE_KEY=r.LIFECYCLE_IDENTIFIER_PREFIX=r.PIPELINE_IDENTIFIER=r.OBJ_DEF_CLS=r.TAGGED_FUN=void 0;r.ALL="common:all_value_key";r.SCHEDULE_KEY="common:schedule";r.CONFIGURATION_KEY="common:configuration";r.FRAMEWORK_KEY="common:framework";r.ASPECT_KEY="common:aspect";r.CATCH_KEY="common:catch";r.MATCH_KEY="common:match";r.GUARD_KEY="common:guard";r.MOCK_KEY="common:mock";r.FACTORY_SERVICE_CLIENT_KEY="common:service_factory:client";r.FUNC_KEY="faas:func";r.SERVERLESS_FUNC_KEY="faas:serverless:function";r.CONTROLLER_KEY="web:controller";r.WEB_ROUTER_KEY="web:router";r.WEB_ROUTER_PARAM_KEY="web:router_param";r.WEB_RESPONSE_KEY="web:response";r.WEB_RESPONSE_HTTP_CODE="web:response_http_code";r.WEB_RESPONSE_REDIRECT="web:response_redirect";r.WEB_RESPONSE_HEADER="web:response_header";r.WEB_RESPONSE_CONTENT_TYPE="web:response_content_type";r.WEB_RESPONSE_RENDER="web:response_render";r.MODULE_TASK_KEY="task:task";r.MODULE_TASK_METADATA="task:task:options";r.MODULE_TASK_TASK_LOCAL_KEY="task:task:task_local";r.MODULE_TASK_TASK_LOCAL_OPTIONS="task:task:task_local:options";r.MODULE_TASK_QUEUE_KEY="task:task:queue";r.MODULE_TASK_QUEUE_OPTIONS="task:task:queue:options";r.WS_CONTROLLER_KEY="ws:controller";r.WS_EVENT_KEY="ws:event";r.HSF_KEY="rpc:hsf";r.RPC_GRPC_KEY="rpc:grpc";r.RPC_DUBBO_KEY="rpc:dubbo";r.MS_CONSUMER_KEY="ms:consumer";r.MS_PRODUCER_KEY="ms:producer";r.MS_PROVIDER_KEY="ms:provider";r.MS_GRPC_METHOD_KEY="ms:grpc:method";r.MS_DUBBO_METHOD_KEY="ms:dubbo:method";r.MS_HSF_METHOD_KEY="ms:hsf:method";r.CONFIG_KEY="config";r.PLUGIN_KEY="plugin";r.LOGGER_KEY="logger";r.APPLICATION_KEY="__midway_framework_app__";r.APPLICATION_CONTEXT_KEY="__midway_application_context__";r.CLASS_KEY_CONSTRUCTOR="midway:class_key_constructor";r.NAMED_TAG="named";r.INJECT_TAG="inject";r.INJECT_CUSTOM_PROPERTY="inject_custom_property";r.INJECT_CUSTOM_METHOD="inject_custom_method";r.INJECT_CUSTOM_PARAM="inject_custom_param";r.TAGGED_CLS="injection:tagged_class";r.TAGGED_FUN="injection:tagged_function";r.OBJ_DEF_CLS="injection:object_definition_class";r.PIPELINE_IDENTIFIER="__pipeline_identifier__";r.LIFECYCLE_IDENTIFIER_PREFIX="__lifecycle__";r.MAIN_MODULE_KEY="__main__";r.PRIVATE_META_DATA_KEY="__midway_private_meta_data__"},7679:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.createCustomParamDecorator=r.createCustomMethodDecorator=r.createCustomPropertyDecorator=r.getMethodReturnTypes=r.getPropertyType=r.getMethodParamTypes=r.BaseType=r.isProvide=r.getProviderUUId=r.getProviderName=r.getProviderId=r.saveProviderId=r.getObjectDefinition=r.saveObjectDefinition=r.getPropertyInject=r.savePropertyInject=r.transformTypeFromTSDesign=r.clearAllModule=r.resetModule=r.listModule=r.clearBindContainer=r.bindContainer=r.saveModule=r.listPreloadModule=r.savePreloadModule=r.getPropertyMetadata=r.attachPropertyMetadata=r.savePropertyMetadata=r.listPropertyDataFromClass=r.getPropertyDataFromClass=r.attachPropertyDataToClass=r.savePropertyDataToClass=r.getClassMetadata=r.getClassExtendedMetadata=r.attachClassMetadata=r.saveClassMetadata=r.DecoratorManager=r.INJECT_CLASS_KEY_PREFIX=r.PRELOAD_MODULE_KEY=void 0;n(80477);const i=n(87270);const s=n(96695);const o=n(73171);const a=n(88504);const c=n(86110);const u=n(29837);const p=n(39023).debuglog("midway:core");r.PRELOAD_MODULE_KEY="INJECTION_PRELOAD_MODULE_KEY";r.INJECT_CLASS_KEY_PREFIX="INJECTION_CLASS_META_DATA";class DecoratorManager extends Map{constructor(){super(...arguments);this.injectClassKeyPrefix=r.INJECT_CLASS_KEY_PREFIX;this.injectClassMethodKeyPrefix="INJECTION_CLASS_METHOD_META_DATA";this.injectMethodKeyPrefix="INJECTION_METHOD_META_DATA"}saveModule(e,r){if(this.container){return this.container.saveModule(e,r)}if(!this.has(e)){this.set(e,new Set)}this.get(e).add(r)}listModule(e){if(this.container){return this.container.listModule(e)}return Array.from(this.get(e)||{})}resetModule(e){this.set(e,new Set)}bindContainer(e){this.container=e;this.container.transformModule(this)}static getDecoratorClassKey(e){return e.toString()+"_CLS"}static removeDecoratorClassKeySuffix(e){return e.toString().replace("_CLS","")}static getDecoratorMethodKey(e){return e.toString()+"_METHOD"}static getDecoratorClsExtendedKey(e){return e.toString()+"_EXT"}static getDecoratorClsMethodPrefix(e){return e.toString()+"_CLS_METHOD"}static getDecoratorClsMethodKey(e,r){return DecoratorManager.getDecoratorClsMethodPrefix(e)+":"+r.toString()}static getDecoratorMethod(e,r){return DecoratorManager.getDecoratorMethodKey(e)+"_"+r.toString()}static saveMetadata(e,r,n,i){if(typeof r==="object"&&r.constructor){r=r.constructor}let s;if(Reflect.hasOwnMetadata(e,r)){s=Reflect.getMetadata(e,r)}else{s=new Map}s.set(n,i);Reflect.defineMetadata(e,s,r)}static attachMetadata(e,r,n,i,s,o="one"){if(typeof r==="object"&&r.constructor){r=r.constructor}let a;if(Reflect.hasOwnMetadata(e,r)){a=Reflect.getMetadata(e,r)}else{a=new Map}if(!a.has(n)){if(s){a.set(n,{})}else{a.set(n,[])}}if(s){if(o==="one"){a.get(n)[s]=i}else{if(a.get(n)[s]){a.get(n)[s].push(i)}else{a.get(n)[s]=[i]}}}else{a.get(n).push(i)}Reflect.defineMetadata(e,a,r)}static getMetadata(e,r,n){if(typeof r==="object"&&r.constructor){r=r.constructor}let i;if(!Reflect.hasOwnMetadata(e,r)){i=new Map;Reflect.defineMetadata(e,i,r)}else{i=Reflect.getMetadata(e,r)}if(!n){return i}return i.get(n)}saveMetadata(e,r,n,i){if(i){const s=DecoratorManager.getDecoratorMethod(e,i);DecoratorManager.saveMetadata(this.injectMethodKeyPrefix,n,s,r)}else{const i=DecoratorManager.getDecoratorClassKey(e);DecoratorManager.saveMetadata(this.injectClassKeyPrefix,n,i,r)}}attachMetadata(e,r,n,i,s,o){if(i){const a=DecoratorManager.getDecoratorMethod(e,i);DecoratorManager.attachMetadata(this.injectMethodKeyPrefix,n,a,r,s,o)}else{const i=DecoratorManager.getDecoratorClassKey(e);DecoratorManager.attachMetadata(this.injectClassKeyPrefix,n,i,r,s,o)}}getMetadata(e,r,n){if(n){const i=DecoratorManager.getDecoratorMethod(e,n);return DecoratorManager.getMetadata(this.injectMethodKeyPrefix,r,i)}else{const n=`${DecoratorManager.getDecoratorClassKey(e)}`;return DecoratorManager.getMetadata(this.injectClassKeyPrefix,r,n)}}savePropertyDataToClass(e,r,n,i){const s=DecoratorManager.getDecoratorClsMethodKey(e,i);DecoratorManager.saveMetadata(this.injectClassMethodKeyPrefix,n,s,r)}attachPropertyDataToClass(e,r,n,i,s){const o=DecoratorManager.getDecoratorClsMethodKey(e,i);DecoratorManager.attachMetadata(this.injectClassMethodKeyPrefix,n,o,r,s)}getPropertyDataFromClass(e,r,n){const i=DecoratorManager.getDecoratorClsMethodKey(e,n);return DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,r,i)}listPropertyDataFromClass(e,r){const n=DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,r);const i=[];for(const[r,s]of n){if(r.indexOf(DecoratorManager.getDecoratorClsMethodPrefix(e))!==-1){i.push(s)}}return i}}r.DecoratorManager=DecoratorManager;let g=new DecoratorManager;if(typeof global==="object"){if(global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]){console.warn('DecoratorManager not singleton and please check @midwayjs/core version by "npm ls @midwayjs/core"');const e=(0,u.getModuleRequirePathList)("@midwayjs/core");if(e.length){console.info("The module may be located in:");e.forEach(((e,r)=>{console.info(`${r+1}. ${e}`)}))}g=global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]}else{global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]=g}}function saveClassMetadata(e,r,n,i){if(i&&typeof r==="object"){const i=g.getMetadata(e,n);if(!i){return g.saveMetadata(e,r,n)}if(Array.isArray(i)){return g.saveMetadata(e,i.concat(r),n)}else{return g.saveMetadata(e,Object.assign(i,r),n)}}else{return g.saveMetadata(e,r,n)}}r.saveClassMetadata=saveClassMetadata;function attachClassMetadata(e,r,n,i,s){return g.attachMetadata(e,r,n,undefined,i,s)}r.attachClassMetadata=attachClassMetadata;function getClassExtendedMetadata(e,r,n,i){if(i===undefined){i=true}const s=DecoratorManager.getDecoratorClsExtendedKey(e);let o=g.getMetadata(s,r,n);if(i&&o!==undefined){return o}const a=Reflect.getPrototypeOf(r);if(a&&a.constructor!==Object){o=(0,c.merge)(getClassExtendedMetadata(e,a,n,i),g.getMetadata(e,r,n))}g.saveMetadata(s,o||null,r,n);return o}r.getClassExtendedMetadata=getClassExtendedMetadata;function getClassMetadata(e,r){return g.getMetadata(e,r)}r.getClassMetadata=getClassMetadata;function savePropertyDataToClass(e,r,n,i){return g.savePropertyDataToClass(e,r,n,i)}r.savePropertyDataToClass=savePropertyDataToClass;function attachPropertyDataToClass(e,r,n,i,s){return g.attachPropertyDataToClass(e,r,n,i,s)}r.attachPropertyDataToClass=attachPropertyDataToClass;function getPropertyDataFromClass(e,r,n){return g.getPropertyDataFromClass(e,r,n)}r.getPropertyDataFromClass=getPropertyDataFromClass;function listPropertyDataFromClass(e,r){return g.listPropertyDataFromClass(e,r)}r.listPropertyDataFromClass=listPropertyDataFromClass;function savePropertyMetadata(e,r,n,i){return g.saveMetadata(e,r,n,i)}r.savePropertyMetadata=savePropertyMetadata;function attachPropertyMetadata(e,r,n,i){return g.attachMetadata(e,r,n,i)}r.attachPropertyMetadata=attachPropertyMetadata;function getPropertyMetadata(e,r,n){return g.getMetadata(e,r,n)}r.getPropertyMetadata=getPropertyMetadata;function savePreloadModule(e){return saveModule(r.PRELOAD_MODULE_KEY,e)}r.savePreloadModule=savePreloadModule;function listPreloadModule(){return listModule(r.PRELOAD_MODULE_KEY)}r.listPreloadModule=listPreloadModule;function saveModule(e,r){if((0,o.isClass)(r)){saveProviderId(undefined,r)}return g.saveModule(e,r)}r.saveModule=saveModule;function bindContainer(e){return g.bindContainer(e)}r.bindContainer=bindContainer;function clearBindContainer(){return g.container=null}r.clearBindContainer=clearBindContainer;function listModule(e,r){const n=g.listModule(e);if(r){return n.filter(r)}else{return n}}r.listModule=listModule;function resetModule(e){return g.resetModule(e)}r.resetModule=resetModule;function clearAllModule(){p("--- clear all module here ---");return g.clear()}r.clearAllModule=clearAllModule;function transformTypeFromTSDesign(e){if((0,o.isNullOrUndefined)(e)){return{name:"undefined",isBaseType:true,originDesign:e}}switch(e.name){case"String":return{name:"string",isBaseType:true,originDesign:e};case"Number":return{name:"number",isBaseType:true,originDesign:e};case"Boolean":return{name:"boolean",isBaseType:true,originDesign:e};case"Symbol":return{name:"symbol",isBaseType:true,originDesign:e};case"Object":return{name:"object",isBaseType:true,originDesign:e};case"Function":return{name:"function",isBaseType:true,originDesign:e};default:return{name:e.name,isBaseType:false,originDesign:e}}}r.transformTypeFromTSDesign=transformTypeFromTSDesign;function savePropertyInject(e){let r=e.identifier;let n=i.InjectModeEnum.Identifier;if(!r){const s=getPropertyType(e.target,e.targetKey);if(!s.isBaseType&&(0,o.isClass)(s.originDesign)&&isProvide(s.originDesign)){r=getProviderUUId(s.originDesign);n=i.InjectModeEnum.Class}if(!r){r=e.targetKey;n=i.InjectModeEnum.PropertyName}}attachClassMetadata(s.INJECT_TAG,{targetKey:e.targetKey,value:r,args:e.args,injectMode:n},e.target,e.targetKey)}r.savePropertyInject=savePropertyInject;function getPropertyInject(e,r){return getClassExtendedMetadata(s.INJECT_TAG,e,undefined,r)}r.getPropertyInject=getPropertyInject;function saveObjectDefinition(e,r={}){saveClassMetadata(s.OBJ_DEF_CLS,r,e,true);return e}r.saveObjectDefinition=saveObjectDefinition;function getObjectDefinition(e){return getClassExtendedMetadata(s.OBJ_DEF_CLS,e)}r.getObjectDefinition=getObjectDefinition;function saveProviderId(e,r){if(isProvide(r)){if(e){const n=getClassMetadata(s.TAGGED_CLS,r);if(n.id!==e){n.id=e;saveClassMetadata(s.TAGGED_CLS,n,r);p(`update provide: ${r.name} -> ${n.uuid}`)}}}else{const n=(0,c.generateRandomId)();saveClassMetadata(s.TAGGED_CLS,{id:e,originName:r.name,uuid:n,name:(0,a.camelCase)(r.name)},r);p(`save provide: ${r.name} -> ${n}`)}return r}r.saveProviderId=saveProviderId;function getProviderId(e){const r=getClassMetadata(s.TAGGED_CLS,e);if(r&&r.id){return r.id}}r.getProviderId=getProviderId;function getProviderName(e){const r=getClassMetadata(s.TAGGED_CLS,e);if(r&&r.name){return r.name}}r.getProviderName=getProviderName;function getProviderUUId(e){const r=getClassMetadata(s.TAGGED_CLS,e);if(r&&r.uuid){return r.uuid}}r.getProviderUUId=getProviderUUId;function isProvide(e){return!!getClassMetadata(s.TAGGED_CLS,e)}r.isProvide=isProvide;var v;(function(e){e["Boolean"]="boolean";e["Number"]="number";e["String"]="string"})(v=r.BaseType||(r.BaseType={}));function getMethodParamTypes(e,r){if((0,o.isClass)(e)){e=e.prototype}return Reflect.getMetadata("design:paramtypes",e,r)}r.getMethodParamTypes=getMethodParamTypes;function getPropertyType(e,r){return transformTypeFromTSDesign(Reflect.getMetadata("design:type",e,r))}r.getPropertyType=getPropertyType;function getMethodReturnTypes(e,r){if((0,o.isClass)(e)){e=e.prototype}return Reflect.getMetadata("design:returntype",e,r)}r.getMethodReturnTypes=getMethodReturnTypes;function createCustomPropertyDecorator(e,r,n=true){return function(i,o){attachClassMetadata(s.INJECT_CUSTOM_PROPERTY,{propertyName:o,key:e,metadata:r,impl:n},i,o)}}r.createCustomPropertyDecorator=createCustomPropertyDecorator;function createCustomMethodDecorator(e,r,n={impl:true}){if(typeof n==="boolean"){n={impl:n}}if(n.impl===undefined){n.impl=true}return function(i,o,a){attachClassMetadata(s.INJECT_CUSTOM_METHOD,{propertyName:o,key:e,metadata:r,options:n},i)}}r.createCustomMethodDecorator=createCustomMethodDecorator;function createCustomParamDecorator(e,r,n={impl:true}){if(typeof n==="boolean"){n={impl:n}}if(n.impl===undefined){n.impl=true}return function(i,o,a){attachClassMetadata(s.INJECT_CUSTOM_PARAM,{key:e,parameterIndex:a,propertyName:o,metadata:r,options:n},i,o,"multi")}}r.createCustomParamDecorator=createCustomParamDecorator},60719:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ServerlessTrigger=r.ServerlessFunction=void 0;const i=n(8351);const s=n(87270);function ServerlessFunction(e){return(r,n,s)=>{(0,i.savePropertyMetadata)(i.SERVERLESS_FUNC_KEY,e,r,n)}}r.ServerlessFunction=ServerlessFunction;function ServerlessTrigger(e,r={}){return(n,o,a)=>{var c;if(e===s.ServerlessTriggerType.HTTP||e===s.ServerlessTriggerType.API_GATEWAY){r["method"]=(c=r["method"])!==null&&c!==void 0?c:"get"}(0,i.saveModule)(i.FUNC_KEY,n.constructor);r=r||{};(0,i.attachClassMetadata)(i.FUNC_KEY,{type:e,methodName:o,metadata:r},n)}}r.ServerlessTrigger=ServerlessTrigger},8351:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});s(n(6960),r);s(n(87216),r);s(n(14767),r);s(n(86409),r);s(n(4166),r);s(n(65963),r);s(n(92139),r);s(n(12629),r);s(n(89183),r);s(n(42801),r);s(n(26748),r);s(n(2765),r);s(n(78735),r);s(n(60719),r);s(n(24016),r);s(n(23565),r);s(n(73697),r);s(n(96915),r);s(n(96695),r);s(n(7679),r);s(n(18783),r);s(n(16682),r);s(n(89941),r);s(n(61681),r);s(n(55550),r);s(n(96558),r);s(n(68036),r);s(n(70657),r);s(n(79916),r);s(n(98485),r);s(n(10425),r)},18783:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Consumer=void 0;const i=n(8351);const s=n(87270);function Consumer(e,r={}){return n=>{(0,i.saveModule)(i.MS_CONSUMER_KEY,n);(0,i.saveClassMetadata)(i.MS_CONSUMER_KEY,{type:e,metadata:r},n);(0,i.Scope)(s.ScopeEnum.Request)(n);(0,i.Provide)()(n)}}r.Consumer=Consumer},61681:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.KafkaListener=void 0;const i=n(8351);function KafkaListener(e,r={}){return(n,s)=>{r.topic=e;r.propertyKey=s;(0,i.attachPropertyDataToClass)(i.MS_CONSUMER_KEY,r,n,s)}}r.KafkaListener=KafkaListener},16682:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DubboMethod=r.GrpcMethod=r.GrpcStreamTypeEnum=r.Provider=void 0;const i=n(8351);const s=n(87270);function Provider(e,r={}){return n=>{(0,i.saveModule)(i.MS_PROVIDER_KEY,n);(0,i.saveClassMetadata)(i.MS_PROVIDER_KEY,{type:e,metadata:r},n);(0,i.Scope)(s.ScopeEnum.Request)(n);(0,i.Provide)()(n)}}r.Provider=Provider;var o;(function(e){e["BASE"]="base";e["DUPLEX"]="ServerDuplexStream";e["READABLE"]="ServerReadableStream";e["WRITEABLE"]="ServerWritableStream"})(o=r.GrpcStreamTypeEnum||(r.GrpcStreamTypeEnum={}));function GrpcMethod(e={}){return(r,n,s)=>{if(!e.type){e.type=o.BASE}(0,i.savePropertyMetadata)(i.MS_GRPC_METHOD_KEY,{methodName:e.methodName||n,type:e.type,onEnd:e.onEnd},r,n);return s}}r.GrpcMethod=GrpcMethod;function DubboMethod(e){return(r,n,s)=>{(0,i.attachClassMetadata)(i.MS_DUBBO_METHOD_KEY,{methodName:e||n},r);return s}}r.DubboMethod=DubboMethod},89941:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.RabbitMQListener=void 0;const i=n(8351);function RabbitMQListener(e,r={}){return(n,s)=>{r.queueName=e;r.propertyKey=s;(0,i.attachPropertyDataToClass)(i.MS_CONSUMER_KEY,r,n,s)}}r.RabbitMQListener=RabbitMQListener},55550:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.HSF=void 0;const i=n(8351);const s=n(87270);function HSF(e={}){return r=>{(0,i.saveModule)(i.HSF_KEY,r);(0,i.saveClassMetadata)(i.HSF_KEY,e,r);(0,i.Scope)(s.ScopeEnum.Request)(r);(0,i.Provide)()(r)}}r.HSF=HSF},96558:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Queue=void 0;const i=n(8351);const s=n(96695);function Queue(e){return function(r){(0,i.saveModule)(s.MODULE_TASK_QUEUE_KEY,r);(0,i.saveClassMetadata)(s.MODULE_TASK_QUEUE_OPTIONS,{options:e,name:r.name},r);(0,i.Provide)()(r)}}r.Queue=Queue},79916:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Schedule=void 0;const i=n(8351);const s=n(87270);function Schedule(e){return function(r){(0,i.saveModule)(i.SCHEDULE_KEY,r);(0,i.saveClassMetadata)(i.SCHEDULE_KEY,e,r);(0,i.Scope)(s.ScopeEnum.Request)(r);(0,i.Provide)()(r)}}r.Schedule=Schedule},68036:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Task=void 0;const i=n(8351);const s=n(96695);function Task(e){return function(r,n,o){(0,i.saveModule)(s.MODULE_TASK_KEY,r.constructor);(0,i.attachClassMetadata)(s.MODULE_TASK_METADATA,{options:e,propertyKey:n,value:o.value,name:r.constructor.name},r)}}r.Task=Task},70657:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TaskLocal=void 0;const i=n(8351);const s=n(96695);function TaskLocal(e){return function(r,n,o){(0,i.saveModule)(s.MODULE_TASK_TASK_LOCAL_KEY,r.constructor);(0,i.attachClassMetadata)(s.MODULE_TASK_TASK_LOCAL_OPTIONS,{options:e,propertyKey:n,value:o.value},r)}}r.TaskLocal=TaskLocal},24016:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Controller=void 0;const i=n(8351);const s=n(87270);function Controller(e="/",r={middleware:[],sensitive:true}){return n=>{(0,i.saveModule)(i.CONTROLLER_KEY,n);if(e)(0,i.saveClassMetadata)(i.CONTROLLER_KEY,{prefix:e,routerOptions:r},n);(0,i.Scope)(s.ScopeEnum.Request)(n);(0,i.Provide)()(n)}}r.Controller=Controller},23565:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Fields=r.Queries=r.RequestIP=r.RequestPath=r.Files=r.File=r.Headers=r.Param=r.Query=r.Body=r.Session=r.createRequestParamDecorator=r.RouteParamTypes=void 0;const i=n(8351);var s;(function(e){e["QUERY"]="query";e["BODY"]="body";e["PARAM"]="param";e["HEADERS"]="headers";e["SESSION"]="session";e["FILESTREAM"]="file_stream";e["FILESSTREAM"]="files_stream";e["NEXT"]="next";e["REQUEST_PATH"]="request_path";e["REQUEST_IP"]="request_ip";e["QUERIES"]="queries";e["FIELDS"]="fields";e["CUSTOM"]="custom"})(s=r.RouteParamTypes||(r.RouteParamTypes={}));const createParamMapping=function(e){return(r,n={})=>{let s=r;if(Array.isArray(r)&&n.pipes===undefined){n.pipes=r;s=undefined}return(0,i.createCustomParamDecorator)(i.WEB_ROUTER_PARAM_KEY,{type:e,propertyData:s},n)}};const createRequestParamDecorator=function(e,r){r=r||{};if(Array.isArray(r)){r={pipes:r}}return createParamMapping(s.CUSTOM)(e,r)};r.createRequestParamDecorator=createRequestParamDecorator;const Session=(e,r)=>createParamMapping(s.SESSION)(e,{pipes:r});r.Session=Session;const Body=(e,r)=>createParamMapping(s.BODY)(e,{pipes:r});r.Body=Body;const Query=(e,r)=>createParamMapping(s.QUERY)(e,{pipes:r});r.Query=Query;const Param=(e,r)=>createParamMapping(s.PARAM)(e,{pipes:r});r.Param=Param;const Headers=(e,r)=>createParamMapping(s.HEADERS)(e,{pipes:r});r.Headers=Headers;const File=(e,r)=>createParamMapping(s.FILESTREAM)(e,{pipes:r});r.File=File;const Files=(e,r)=>createParamMapping(s.FILESSTREAM)(e,{pipes:r});r.Files=Files;const RequestPath=e=>createParamMapping(s.REQUEST_PATH)(undefined,{pipes:e});r.RequestPath=RequestPath;const RequestIP=e=>createParamMapping(s.REQUEST_IP)(undefined,{pipes:e});r.RequestIP=RequestIP;const Queries=(e,r)=>createParamMapping(s.QUERIES)(e,{pipes:r});r.Queries=Queries;const Fields=(e,r)=>createParamMapping(s.FIELDS)(e,{pipes:r});r.Fields=Fields},73697:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.All=r.Head=r.Options=r.Patch=r.Put=r.Del=r.Get=r.Post=r.RequestMapping=r.RequestMethod=void 0;const i=n(8351);r.RequestMethod={GET:"get",POST:"post",PUT:"put",DELETE:"delete",PATCH:"patch",ALL:"all",OPTIONS:"options",HEAD:"head"};const s={path:"/",requestMethod:r.RequestMethod.GET,routerName:null,middleware:[]};const RequestMapping=(e=s)=>{const n=e.path||"/";const o=e.requestMethod||r.RequestMethod.GET;const a=e.routerName;const c=e.middleware;return(r,s,u)=>{var p;(0,i.attachClassMetadata)(i.WEB_ROUTER_KEY,{path:n,requestMethod:o,routerName:a,method:s,middleware:c,summary:(e===null||e===void 0?void 0:e.summary)||"",description:(e===null||e===void 0?void 0:e.description)||"",ignoreGlobalPrefix:(p=e===null||e===void 0?void 0:e.ignoreGlobalPrefix)!==null&&p!==void 0?p:false},r);return u}};r.RequestMapping=RequestMapping;const createMappingDecorator=e=>(n,i={middleware:[]})=>(0,r.RequestMapping)(Object.assign(i,{requestMethod:e,path:n}));r.Post=createMappingDecorator(r.RequestMethod.POST);r.Get=createMappingDecorator(r.RequestMethod.GET);r.Del=createMappingDecorator(r.RequestMethod.DELETE);r.Put=createMappingDecorator(r.RequestMethod.PUT);r.Patch=createMappingDecorator(r.RequestMethod.PATCH);r.Options=createMappingDecorator(r.RequestMethod.OPTIONS);r.Head=createMappingDecorator(r.RequestMethod.HEAD);r.All=createMappingDecorator(r.RequestMethod.ALL)},96915:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.createRender=r.ContentType=r.SetHeader=r.HttpCode=r.Redirect=void 0;const i=n(8351);function Redirect(e,r=302){return(n,s,o)=>{(0,i.attachPropertyMetadata)(i.WEB_RESPONSE_KEY,{type:i.WEB_RESPONSE_REDIRECT,url:e,code:r},n,s);return o}}r.Redirect=Redirect;function HttpCode(e){return(r,n,s)=>{(0,i.attachPropertyMetadata)(i.WEB_RESPONSE_KEY,{type:i.WEB_RESPONSE_HTTP_CODE,code:e},r,n);return s}}r.HttpCode=HttpCode;function SetHeader(e,r){return(n,s,o)=>{let a={};if(r){a[e]=r}else{a=e}(0,i.attachPropertyMetadata)(i.WEB_RESPONSE_KEY,{type:i.WEB_RESPONSE_HEADER,setHeaders:a},n,s);return o}}r.SetHeader=SetHeader;function ContentType(e){return(r,n,s)=>{(0,i.attachPropertyMetadata)(i.WEB_RESPONSE_KEY,{type:i.WEB_RESPONSE_CONTENT_TYPE,contentType:e},r,n);return s}}r.ContentType=ContentType;function createRender(e){return e=>(r,n,s)=>{(0,i.attachPropertyMetadata)(i.WEB_RESPONSE_KEY,{type:i.WEB_RESPONSE_RENDER,templateName:e},r,n);return s}}r.createRender=createRender},98485:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.WSController=void 0;const i=n(8351);const s=n(87270);function WSController(e="/",r={middleware:[],connectionMiddleware:[]}){return n=>{(0,i.saveModule)(i.WS_CONTROLLER_KEY,n);(0,i.saveClassMetadata)(i.WS_CONTROLLER_KEY,{namespace:e,routerOptions:r},n);(0,i.Scope)(s.ScopeEnum.Request)(n);(0,i.Provide)()(n)}}r.WSController=WSController},10425:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.OnConnection=r.OnDisConnection=r.Emit=r.OnMessage=r.WSBroadCast=r.WSEmit=r.OnWSMessage=r.OnWSDisConnection=r.OnWSConnection=r.WSEventTypeEnum=void 0;const i=n(8351);var s;(function(e){e["ON_CONNECTION"]="ws:onConnection";e["ON_DISCONNECTION"]="ws:onDisconnection";e["ON_MESSAGE"]="ws:onMessage";e["ON_SOCKET_ERROR"]="ws:onSocketError";e["EMIT"]="ws:Emit";e["BROADCAST"]="ws:broadcast"})(s=r.WSEventTypeEnum||(r.WSEventTypeEnum={}));function OnWSConnection(e={}){return(r,n,o)=>{(0,i.attachClassMetadata)(i.WS_EVENT_KEY,{eventType:s.ON_CONNECTION,propertyName:n,eventOptions:e,descriptor:o},r.constructor)}}r.OnWSConnection=OnWSConnection;function OnWSDisConnection(){return(e,r,n)=>{(0,i.attachClassMetadata)(i.WS_EVENT_KEY,{eventType:s.ON_DISCONNECTION,propertyName:r,descriptor:n},e.constructor)}}r.OnWSDisConnection=OnWSDisConnection;function OnWSMessage(e,r={}){return(n,o,a)=>{(0,i.attachClassMetadata)(i.WS_EVENT_KEY,{eventType:s.ON_MESSAGE,messageEventName:e,propertyName:o,eventOptions:r,descriptor:a},n.constructor)}}r.OnWSMessage=OnWSMessage;function WSEmit(e,r=[]){return(n,o,a)=>{(0,i.attachClassMetadata)(i.WS_EVENT_KEY,{eventType:s.EMIT,propertyName:o,messageEventName:e,roomName:[].concat(r),descriptor:a},n.constructor)}}r.WSEmit=WSEmit;function WSBroadCast(e="",r=[]){return(n,o,a)=>{(0,i.attachClassMetadata)(i.WS_EVENT_KEY,{eventType:s.BROADCAST,propertyName:o,messageEventName:e,roomName:[].concat(r),descriptor:a},n.constructor)}}r.WSBroadCast=WSBroadCast;r.OnMessage=OnWSMessage;r.Emit=WSEmit;r.OnDisConnection=OnWSDisConnection;r.OnConnection=OnWSConnection},86271:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.FunctionDefinition=void 0;const i=n(87270);const s=n(88797);class FunctionWrapperCreator extends s.ObjectCreator{doConstruct(e,r,n){if(!e){return null}return e(n,r)}async doConstructAsync(e,r,n){if(!e){return null}return e(n,r)}}class FunctionDefinition{constructor(){this.constructorArgs=[];this.namespace="";this.asynchronous=true;this.handlerProps=[];this.allowDowngrade=false;this.innerAutowire=false;this.innerScope=i.ScopeEnum.Singleton;this.creator=new FunctionWrapperCreator(this)}getAttr(e){}hasAttr(e){return false}hasConstructorArgs(){return false}hasDependsOn(){return false}isAsync(){return this.asynchronous}isDirect(){return false}isExternal(){return false}set scope(e){this.innerScope=e}isSingletonScope(){return this.innerScope===i.ScopeEnum.Singleton}isRequestScope(){return this.innerScope===i.ScopeEnum.Request}setAttr(e,r){}}r.FunctionDefinition=FunctionDefinition},88797:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ObjectCreator=void 0;const i=n(86248);const s=n(73171);class ObjectCreator{constructor(e){this.definition=e}load(){let e=null;if(typeof this.definition.path==="string"){if(!this.definition.path){return e}const r=this.definition.path;if(this.definition.export){e=require(r)[this.definition.export]}else{e=require(r)}}else{e=this.definition.path}return e}doConstruct(e,r){if(!e){return Object.create(null)}let n;if(this.definition.constructMethod){n=e[this.definition.constructMethod].apply(e,r)}else{n=Reflect.construct(e,r)}return n}async doConstructAsync(e,r){if(!e){return Object.create(null)}let n;if(this.definition.constructMethod){const i=e[this.definition.constructMethod];if(s.Types.isAsyncFunction(i)){n=await i.apply(e,r)}else{n=i.apply(e,r)}}else{n=Reflect.construct(e,r)}return n}doInit(e){const r=e;if(this.definition.initMethod&&r[this.definition.initMethod]){if(s.Types.isGeneratorFunction(r[this.definition.initMethod])||s.Types.isAsyncFunction(r[this.definition.initMethod])){throw new i.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}else{const e=r[this.definition.initMethod].call(r);if(s.Types.isPromise(e)){throw new i.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}}}}async doInitAsync(e){const r=e;if(this.definition.initMethod&&r[this.definition.initMethod]){const e=r[this.definition.initMethod];if(s.Types.isAsyncFunction(e)){await e.call(r)}else{if(e.length===1){await new Promise((n=>{e.call(r,n)}))}else{e.call(r)}}}}doDestroy(e){if(this.definition.destroyMethod&&e[this.definition.destroyMethod]){e[this.definition.destroyMethod].call(e)}}async doDestroyAsync(e){if(this.definition.destroyMethod&&e[this.definition.destroyMethod]){const r=e[this.definition.destroyMethod];if(s.Types.isAsyncFunction(r)){await r.call(e)}else{if(r.length===1){await new Promise((n=>{r.call(e,n)}))}else{r.call(e)}}}}}r.ObjectCreator=ObjectCreator},78028:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ObjectDefinition=void 0;const i=n(87270);const s=n(79855);const o=n(88797);class ObjectDefinition{constructor(){this._attrs=new Map;this._asynchronous=false;this.scope=i.ScopeEnum.Singleton;this.creator=null;this.id=null;this.name=null;this.initMethod=null;this.destroyMethod=null;this.constructMethod=null;this.constructorArgs=[];this.path=null;this.export=null;this.dependsOn=[];this.properties=new s.ObjectProperties;this.namespace="";this.handlerProps=[];this.allowDowngrade=false;this.creator=new o.ObjectCreator(this)}set asynchronous(e){this._asynchronous=e}isAsync(){return this._asynchronous}isSingletonScope(){return this.scope===i.ScopeEnum.Singleton}isRequestScope(){return this.scope===i.ScopeEnum.Request}hasDependsOn(){return this.dependsOn.length>0}hasConstructorArgs(){return this.constructorArgs.length>0}getAttr(e){return this._attrs.get(e)}hasAttr(e){return this._attrs.has(e)}setAttr(e,r){this._attrs.set(e,r)}}r.ObjectDefinition=ObjectDefinition},79855:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ObjectProperties=void 0;class ObjectProperties extends Map{propertyKeys(){return Array.from(this.keys())}getProperty(e,r){if(this.has(e)){return this.get(e)}return r}setProperty(e,r){return this.set(e,r)}}r.ObjectProperties=ObjectProperties},25895:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayHttpError=r.MidwayError=r.registerErrorCode=void 0;const i=n(58611);const s=new Set;function registerErrorCode(e,r){if(s.has(e)){throw new MidwayError(`Error group ${e} is duplicated, please check before adding.`)}else{s.add(e)}const n={};for(const i in r){n[i]=e.toUpperCase()+"_"+String(r[i]).toUpperCase()}return n}r.registerErrorCode=registerErrorCode;class MidwayError extends Error{constructor(e,r,n){super(e);if(!r||typeof r==="object"){n=r;r="MIDWAY_10000"}this.name=this.constructor.name;this.code=r;this.cause=n===null||n===void 0?void 0:n.cause}}r.MidwayError=MidwayError;class MidwayHttpError extends MidwayError{constructor(e,r,n,s){super(e?typeof e==="string"?e:e.message:i.STATUS_CODES[r],n!==null&&n!==void 0?n:String(r),s);if(e&&e["stack"]){this.stack=e["stack"]}this.status=r}}r.MidwayHttpError=MidwayHttpError},36904:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayEmptyValueError=r.MidwayInvalidConfigPropertyError=r.MidwayMainFrameworkMissingError=r.MidwayCodeInvokeTimeoutError=r.MidwayInvokeForbiddenError=r.MidwayRetryExceededMaxTimesError=r.MidwayDuplicateControllerOptionsError=r.MidwayDuplicateClassNameError=r.MidwayInconsistentVersionError=r.MidwayUtilHttpClientTimeoutError=r.MidwayMissingImportComponentError=r.MidwaySingletonInjectRequestError=r.MidwayUseWrongMethodError=r.MidwayDuplicateRouteError=r.MidwayResolverMissingError=r.MidwayInvalidConfigError=r.MidwayConfigMissingError=r.MidwayFeatureNotImplementedError=r.MidwayFeatureNoLongerSupportedError=r.MidwayDefinitionNotFoundError=r.MidwayParameterError=r.MidwayCommonError=r.FrameworkErrorEnum=void 0;const i=n(25895);r.FrameworkErrorEnum=(0,i.registerErrorCode)("midway",{UNKNOWN:1e4,COMMON:10001,PARAM_TYPE:10002,DEFINITION_NOT_FOUND:10003,FEATURE_NO_LONGER_SUPPORTED:10004,FEATURE_NOT_IMPLEMENTED:10004,MISSING_CONFIG:10006,MISSING_RESOLVER:10007,DUPLICATE_ROUTER:10008,USE_WRONG_METHOD:10009,SINGLETON_INJECT_REQUEST:10010,MISSING_IMPORTS:10011,UTIL_HTTP_TIMEOUT:10012,INCONSISTENT_VERSION:10013,INVALID_CONFIG:10014,DUPLICATE_CLASS_NAME:10015,DUPLICATE_CONTROLLER_PREFIX_OPTIONS:10016,RETRY_OVER_MAX_TIME:10017,INVOKE_METHOD_FORBIDDEN:10018,CODE_INVOKE_TIMEOUT:10019,MAIN_FRAMEWORK_MISSING:10020,INVALID_CONFIG_PROPERTY:10021,EMPTY_VALUE:10022});class MidwayCommonError extends i.MidwayError{constructor(e){super(e,r.FrameworkErrorEnum.COMMON)}}r.MidwayCommonError=MidwayCommonError;class MidwayParameterError extends i.MidwayError{constructor(e){super(e!==null&&e!==void 0?e:"Parameter type not match",r.FrameworkErrorEnum.PARAM_TYPE)}}r.MidwayParameterError=MidwayParameterError;class MidwayDefinitionNotFoundError extends i.MidwayError{static isClosePrototypeOf(e){return e?e[MidwayDefinitionNotFoundError.type]===MidwayDefinitionNotFoundError.type:false}constructor(e){super(`${e} is not valid in current context`,r.FrameworkErrorEnum.DEFINITION_NOT_FOUND);this[MidwayDefinitionNotFoundError.type]=MidwayDefinitionNotFoundError.type}updateErrorMsg(e){const r=this.message.split(" is not valid in current context")[0];this.message=`${r} in class ${e} is not valid in current context`}}r.MidwayDefinitionNotFoundError=MidwayDefinitionNotFoundError;MidwayDefinitionNotFoundError.type=Symbol.for("#NotFoundError");class MidwayFeatureNoLongerSupportedError extends i.MidwayError{constructor(e){super("This feature no longer supported \n"+e,r.FrameworkErrorEnum.FEATURE_NO_LONGER_SUPPORTED)}}r.MidwayFeatureNoLongerSupportedError=MidwayFeatureNoLongerSupportedError;class MidwayFeatureNotImplementedError extends i.MidwayError{constructor(e){super("This feature not implemented \n"+e,r.FrameworkErrorEnum.FEATURE_NOT_IMPLEMENTED)}}r.MidwayFeatureNotImplementedError=MidwayFeatureNotImplementedError;class MidwayConfigMissingError extends i.MidwayError{constructor(e){super(`Can't found config key "${e}" in your config, please set it first`,r.FrameworkErrorEnum.MISSING_CONFIG)}}r.MidwayConfigMissingError=MidwayConfigMissingError;class MidwayInvalidConfigError extends i.MidwayError{constructor(e){super("Invalid config file \n"+e,r.FrameworkErrorEnum.INVALID_CONFIG)}}r.MidwayInvalidConfigError=MidwayInvalidConfigError;class MidwayResolverMissingError extends i.MidwayError{constructor(e){super(`Resolver "${e}" is missing.`,r.FrameworkErrorEnum.MISSING_RESOLVER)}}r.MidwayResolverMissingError=MidwayResolverMissingError;class MidwayDuplicateRouteError extends i.MidwayError{constructor(e,n,i){super(`Duplicate router "${e}" at "${n}" and "${i}"`,r.FrameworkErrorEnum.DUPLICATE_ROUTER)}}r.MidwayDuplicateRouteError=MidwayDuplicateRouteError;class MidwayUseWrongMethodError extends i.MidwayError{constructor(e,n,i){const s=i?`${i} not valid by ${e}, Use ${n} instead!`:`You should not invoked by ${e}, Use ${n} instead!`;super(s,r.FrameworkErrorEnum.USE_WRONG_METHOD)}}r.MidwayUseWrongMethodError=MidwayUseWrongMethodError;class MidwaySingletonInjectRequestError extends i.MidwayError{constructor(e,n){const i=`${e} with singleton scope can't implicitly inject ${n} with request scope directly, please add "@Scope(ScopeEnum.Request, { allowDowngrade: true })" in ${n} or use "ctx.requestContext.getAsync(${n})".`;super(i,r.FrameworkErrorEnum.SINGLETON_INJECT_REQUEST)}}r.MidwaySingletonInjectRequestError=MidwaySingletonInjectRequestError;class MidwayMissingImportComponentError extends i.MidwayError{constructor(e){const n=`"${e}" can't inject and maybe forgot add "{imports: [***]}" in @Configuration.`;super(n,r.FrameworkErrorEnum.MISSING_IMPORTS)}}r.MidwayMissingImportComponentError=MidwayMissingImportComponentError;class MidwayUtilHttpClientTimeoutError extends i.MidwayError{constructor(e){super(e,r.FrameworkErrorEnum.UTIL_HTTP_TIMEOUT)}}r.MidwayUtilHttpClientTimeoutError=MidwayUtilHttpClientTimeoutError;class MidwayInconsistentVersionError extends i.MidwayError{constructor(){const e='We find a latest dependency package installed, please remove the lock file and use "npm update" to upgrade all dependencies first.';super(e,r.FrameworkErrorEnum.INCONSISTENT_VERSION)}}r.MidwayInconsistentVersionError=MidwayInconsistentVersionError;class MidwayDuplicateClassNameError extends i.MidwayError{constructor(e,n,i){super(`"${e}" duplicated between "${n}" and "${i}"`,r.FrameworkErrorEnum.DUPLICATE_CLASS_NAME)}}r.MidwayDuplicateClassNameError=MidwayDuplicateClassNameError;class MidwayDuplicateControllerOptionsError extends i.MidwayError{constructor(e,n,i){super(`"Prefix ${e}" with duplicated controller options between "${n}" and "${i}"`,r.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS)}}r.MidwayDuplicateControllerOptionsError=MidwayDuplicateControllerOptionsError;class MidwayRetryExceededMaxTimesError extends i.MidwayError{constructor(e,n,i){super(`Invoke "${e}" retries exceeded the maximum number of times(${n}), error: ${i.message}`,r.FrameworkErrorEnum.RETRY_OVER_MAX_TIME,{cause:i})}}r.MidwayRetryExceededMaxTimesError=MidwayRetryExceededMaxTimesError;class MidwayInvokeForbiddenError extends i.MidwayError{constructor(e,n){super(`Invoke "${n?n.name:"unknown"}.${e}" is forbidden.`,r.FrameworkErrorEnum.INVOKE_METHOD_FORBIDDEN)}}r.MidwayInvokeForbiddenError=MidwayInvokeForbiddenError;class MidwayCodeInvokeTimeoutError extends i.MidwayError{constructor(e,n){super(`Invoke "${e}" running timeout(${n}ms)`,r.FrameworkErrorEnum.CODE_INVOKE_TIMEOUT)}}r.MidwayCodeInvokeTimeoutError=MidwayCodeInvokeTimeoutError;class MidwayMainFrameworkMissingError extends i.MidwayError{constructor(){super("Main framework missing, please check your configuration.",r.FrameworkErrorEnum.MAIN_FRAMEWORK_MISSING)}}r.MidwayMainFrameworkMissingError=MidwayMainFrameworkMissingError;class MidwayInvalidConfigPropertyError extends i.MidwayError{constructor(e,n){super(`Invalid config property "${e}", ${n?`only ${n.join(",")} can be set`:"please check your configuration"}.`,r.FrameworkErrorEnum.INVALID_CONFIG_PROPERTY)}}r.MidwayInvalidConfigPropertyError=MidwayInvalidConfigPropertyError;class MidwayEmptyValueError extends i.MidwayError{constructor(e){super(e!==null&&e!==void 0?e:"There is an empty value got and it is not allowed.",r.FrameworkErrorEnum.EMPTY_VALUE)}}r.MidwayEmptyValueError=MidwayEmptyValueError},91438:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.httpError=r.GatewayTimeoutError=r.ServiceUnavailableError=r.BadGatewayError=r.NotImplementedError=r.InternalServerErrorError=r.TooManyRequestsError=r.UnprocessableEntityError=r.UnsupportedMediaTypeError=r.PayloadTooLargeError=r.GoneError=r.ConflictError=r.RequestTimeoutError=r.NotAcceptableError=r.ForbiddenError=r.NotFoundError=r.UnauthorizedError=r.BadRequestError=r.HttpStatus=void 0;const i=n(25895);var s;(function(e){e[e["CONTINUE"]=100]="CONTINUE";e[e["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";e[e["PROCESSING"]=102]="PROCESSING";e[e["EARLYHINTS"]=103]="EARLYHINTS";e[e["OK"]=200]="OK";e[e["CREATED"]=201]="CREATED";e[e["ACCEPTED"]=202]="ACCEPTED";e[e["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";e[e["NO_CONTENT"]=204]="NO_CONTENT";e[e["RESET_CONTENT"]=205]="RESET_CONTENT";e[e["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";e[e["AMBIGUOUS"]=300]="AMBIGUOUS";e[e["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";e[e["FOUND"]=302]="FOUND";e[e["SEE_OTHER"]=303]="SEE_OTHER";e[e["NOT_MODIFIED"]=304]="NOT_MODIFIED";e[e["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";e[e["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";e[e["BAD_REQUEST"]=400]="BAD_REQUEST";e[e["UNAUTHORIZED"]=401]="UNAUTHORIZED";e[e["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";e[e["FORBIDDEN"]=403]="FORBIDDEN";e[e["NOT_FOUND"]=404]="NOT_FOUND";e[e["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";e[e["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";e[e["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";e[e["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";e[e["CONFLICT"]=409]="CONFLICT";e[e["GONE"]=410]="GONE";e[e["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";e[e["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";e[e["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";e[e["URI_TOO_LONG"]=414]="URI_TOO_LONG";e[e["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";e[e["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";e[e["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";e[e["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";e[e["MISDIRECTED"]=421]="MISDIRECTED";e[e["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";e[e["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";e[e["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";e[e["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";e[e["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";e[e["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";e[e["BAD_GATEWAY"]=502]="BAD_GATEWAY";e[e["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";e[e["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";e[e["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(s=r.HttpStatus||(r.HttpStatus={}));class BadRequestError extends i.MidwayHttpError{constructor(e){super(e,s.BAD_REQUEST)}}r.BadRequestError=BadRequestError;class UnauthorizedError extends i.MidwayHttpError{constructor(e){super(e,s.UNAUTHORIZED)}}r.UnauthorizedError=UnauthorizedError;class NotFoundError extends i.MidwayHttpError{constructor(e){super(e,s.NOT_FOUND)}}r.NotFoundError=NotFoundError;class ForbiddenError extends i.MidwayHttpError{constructor(e){super(e,s.FORBIDDEN)}}r.ForbiddenError=ForbiddenError;class NotAcceptableError extends i.MidwayHttpError{constructor(e){super(e,s.NOT_ACCEPTABLE)}}r.NotAcceptableError=NotAcceptableError;class RequestTimeoutError extends i.MidwayHttpError{constructor(e){super(e,s.REQUEST_TIMEOUT)}}r.RequestTimeoutError=RequestTimeoutError;class ConflictError extends i.MidwayHttpError{constructor(e){super(e,s.CONFLICT)}}r.ConflictError=ConflictError;class GoneError extends i.MidwayHttpError{constructor(e){super(e,s.GONE)}}r.GoneError=GoneError;class PayloadTooLargeError extends i.MidwayHttpError{constructor(e){super(e,s.PAYLOAD_TOO_LARGE)}}r.PayloadTooLargeError=PayloadTooLargeError;class UnsupportedMediaTypeError extends i.MidwayHttpError{constructor(e){super(e,s.UNSUPPORTED_MEDIA_TYPE)}}r.UnsupportedMediaTypeError=UnsupportedMediaTypeError;class UnprocessableEntityError extends i.MidwayHttpError{constructor(e){super(e,s.UNPROCESSABLE_ENTITY)}}r.UnprocessableEntityError=UnprocessableEntityError;class TooManyRequestsError extends i.MidwayHttpError{constructor(e){super(e,s.TOO_MANY_REQUESTS)}}r.TooManyRequestsError=TooManyRequestsError;class InternalServerErrorError extends i.MidwayHttpError{constructor(e){super(e,s.INTERNAL_SERVER_ERROR)}}r.InternalServerErrorError=InternalServerErrorError;class NotImplementedError extends i.MidwayHttpError{constructor(e){super(e,s.NOT_IMPLEMENTED)}}r.NotImplementedError=NotImplementedError;class BadGatewayError extends i.MidwayHttpError{constructor(e){super(e,s.BAD_GATEWAY)}}r.BadGatewayError=BadGatewayError;class ServiceUnavailableError extends i.MidwayHttpError{constructor(e){super(e,s.SERVICE_UNAVAILABLE)}}r.ServiceUnavailableError=ServiceUnavailableError;class GatewayTimeoutError extends i.MidwayHttpError{constructor(e){super(e,s.GATEWAY_TIMEOUT)}}r.GatewayTimeoutError=GatewayTimeoutError;r.httpError={BadRequestError:BadRequestError,UnauthorizedError:UnauthorizedError,NotFoundError:NotFoundError,ForbiddenError:ForbiddenError,NotAcceptableError:NotAcceptableError,RequestTimeoutError:RequestTimeoutError,ConflictError:ConflictError,GoneError:GoneError,PayloadTooLargeError:PayloadTooLargeError,UnsupportedMediaTypeError:UnsupportedMediaTypeError,UnprocessableEntityError:UnprocessableEntityError,TooManyRequestsError:TooManyRequestsError,InternalServerErrorError:InternalServerErrorError,NotImplementedError:NotImplementedError,BadGatewayError:BadGatewayError,ServiceUnavailableError:ServiceUnavailableError,GatewayTimeoutError:GatewayTimeoutError}},86248:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.httpError=r.HttpStatus=void 0;s(n(25895),r);var o=n(91438);Object.defineProperty(r,"HttpStatus",{enumerable:true,get:function(){return o.HttpStatus}});Object.defineProperty(r,"httpError",{enumerable:true,get:function(){return o.httpError}});s(n(36904),r)},65061:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.createConfiguration=r.FunctionalConfiguration=void 0;class FunctionalConfiguration{constructor(e){this.options=e;this.readyHandler=()=>{};this.stopHandler=()=>{};this.configLoadHandler=()=>{};this.serverReadyHandler=()=>{}}onConfigLoad(e,r){if(typeof e==="function"){this.configLoadHandler=e}else{return this.configLoadHandler(e,r)}return this}onReady(e,r){if(typeof e==="function"){this.readyHandler=e}else{return this.readyHandler(e,r)}return this}onServerReady(e,r){if(typeof e==="function"){this.serverReadyHandler=e}else{return this.serverReadyHandler(e,r)}return this}onStop(e,r){if(typeof e==="function"){this.stopHandler=e}else{return this.stopHandler(e,r)}return this}getConfigurationOptions(){return this.options}}r.FunctionalConfiguration=FunctionalConfiguration;const createConfiguration=e=>new FunctionalConfiguration(e);r.createConfiguration=createConfiguration},45573:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayPerformanceManager=r.TypedResourceManager=r.HttpServerResponse=r.ServerResponse=r.FORMAT=r.FileUtils=r.PathFileUtil=r.Types=r.retryWith=r.retryWithAsync=r.extend=r.Utils=r.sleep=r.isTypeScriptEnvironment=r.wrapAsync=r.wrapMiddleware=r.pathMatching=r.transformRequestObjectByType=r.deprecatedOutput=r.delegateTargetAllPrototypeMethod=r.delegateTargetProperties=r.delegateTargetMethod=r.delegateTargetPrototypeMethod=r.loadModule=r.safeRequire=r.safelyGet=r.ASYNC_ROOT_CONTEXT=r.MidwayPriorityManager=r.DEFAULT_PRIORITY=r.DataSourceManager=r.WebRouterCollector=r.MidwayServerlessFunctionService=r.MidwayWebRouterService=r.MidwayHealthService=r.MidwayMockService=r.MidwayDecoratorService=r.MidwayMiddlewareService=r.MidwayLifeCycleService=r.MidwayAspectService=r.MidwayFrameworkService=r.MidwayLoggerService=r.MidwayInformationService=r.MidwayEnvironmentService=r.MidwayConfigService=r.FunctionalConfiguration=r.createConfiguration=r.BaseFramework=r.MidwayRequestContainer=void 0;s(n(87270),r);s(n(12922),r);var o=n(34005);Object.defineProperty(r,"MidwayRequestContainer",{enumerable:true,get:function(){return o.MidwayRequestContainer}});var a=n(31630);Object.defineProperty(r,"BaseFramework",{enumerable:true,get:function(){return a.BaseFramework}});s(n(20233),r);s(n(77404),r);var c=n(65061);Object.defineProperty(r,"createConfiguration",{enumerable:true,get:function(){return c.createConfiguration}});Object.defineProperty(r,"FunctionalConfiguration",{enumerable:true,get:function(){return c.FunctionalConfiguration}});var u=n(73440);Object.defineProperty(r,"MidwayConfigService",{enumerable:true,get:function(){return u.MidwayConfigService}});var p=n(14057);Object.defineProperty(r,"MidwayEnvironmentService",{enumerable:true,get:function(){return p.MidwayEnvironmentService}});var g=n(41560);Object.defineProperty(r,"MidwayInformationService",{enumerable:true,get:function(){return g.MidwayInformationService}});var v=n(70426);Object.defineProperty(r,"MidwayLoggerService",{enumerable:true,get:function(){return v.MidwayLoggerService}});var b=n(65338);Object.defineProperty(r,"MidwayFrameworkService",{enumerable:true,get:function(){return b.MidwayFrameworkService}});var _=n(59550);Object.defineProperty(r,"MidwayAspectService",{enumerable:true,get:function(){return _.MidwayAspectService}});var E=n(1026);Object.defineProperty(r,"MidwayLifeCycleService",{enumerable:true,get:function(){return E.MidwayLifeCycleService}});var x=n(66134);Object.defineProperty(r,"MidwayMiddlewareService",{enumerable:true,get:function(){return x.MidwayMiddlewareService}});var T=n(14625);Object.defineProperty(r,"MidwayDecoratorService",{enumerable:true,get:function(){return T.MidwayDecoratorService}});var w=n(67072);Object.defineProperty(r,"MidwayMockService",{enumerable:true,get:function(){return w.MidwayMockService}});var C=n(34292);Object.defineProperty(r,"MidwayHealthService",{enumerable:true,get:function(){return C.MidwayHealthService}});var A=n(64259);Object.defineProperty(r,"MidwayWebRouterService",{enumerable:true,get:function(){return A.MidwayWebRouterService}});var k=n(42986);Object.defineProperty(r,"MidwayServerlessFunctionService",{enumerable:true,get:function(){return k.MidwayServerlessFunctionService}});Object.defineProperty(r,"WebRouterCollector",{enumerable:true,get:function(){return k.WebRouterCollector}});var P=n(50771);Object.defineProperty(r,"DataSourceManager",{enumerable:true,get:function(){return P.DataSourceManager}});var I=n(60340);Object.defineProperty(r,"DEFAULT_PRIORITY",{enumerable:true,get:function(){return I.DEFAULT_PRIORITY}});Object.defineProperty(r,"MidwayPriorityManager",{enumerable:true,get:function(){return I.MidwayPriorityManager}});s(n(720),r);s(n(94853),r);s(n(37940),r);s(n(7647),r);s(n(11207),r);s(n(12888),r);s(n(91044),r);s(n(43762),r);s(n(51926),r);s(n(33216),r);s(n(86248),r);var R=n(46905);Object.defineProperty(r,"ASYNC_ROOT_CONTEXT",{enumerable:true,get:function(){return R.ASYNC_ROOT_CONTEXT}});s(n(8351),r);s(n(7679),r);s(n(96695),r);var N=n(86110);Object.defineProperty(r,"safelyGet",{enumerable:true,get:function(){return N.safelyGet}});Object.defineProperty(r,"safeRequire",{enumerable:true,get:function(){return N.safeRequire}});Object.defineProperty(r,"loadModule",{enumerable:true,get:function(){return N.loadModule}});Object.defineProperty(r,"delegateTargetPrototypeMethod",{enumerable:true,get:function(){return N.delegateTargetPrototypeMethod}});Object.defineProperty(r,"delegateTargetMethod",{enumerable:true,get:function(){return N.delegateTargetMethod}});Object.defineProperty(r,"delegateTargetProperties",{enumerable:true,get:function(){return N.delegateTargetProperties}});Object.defineProperty(r,"delegateTargetAllPrototypeMethod",{enumerable:true,get:function(){return N.delegateTargetAllPrototypeMethod}});Object.defineProperty(r,"deprecatedOutput",{enumerable:true,get:function(){return N.deprecatedOutput}});Object.defineProperty(r,"transformRequestObjectByType",{enumerable:true,get:function(){return N.transformRequestObjectByType}});Object.defineProperty(r,"pathMatching",{enumerable:true,get:function(){return N.pathMatching}});Object.defineProperty(r,"wrapMiddleware",{enumerable:true,get:function(){return N.wrapMiddleware}});Object.defineProperty(r,"wrapAsync",{enumerable:true,get:function(){return N.wrapAsync}});Object.defineProperty(r,"isTypeScriptEnvironment",{enumerable:true,get:function(){return N.isTypeScriptEnvironment}});Object.defineProperty(r,"sleep",{enumerable:true,get:function(){return N.sleep}});Object.defineProperty(r,"Utils",{enumerable:true,get:function(){return N.Utils}});var L=n(90428);Object.defineProperty(r,"extend",{enumerable:true,get:function(){return L.extend}});s(n(17816),r);s(n(7269),r);s(n(66027),r);s(n(9527),r);var B=n(73724);Object.defineProperty(r,"retryWithAsync",{enumerable:true,get:function(){return B.retryWithAsync}});Object.defineProperty(r,"retryWith",{enumerable:true,get:function(){return B.retryWith}});var j=n(73171);Object.defineProperty(r,"Types",{enumerable:true,get:function(){return j.Types}});var U=n(29837);Object.defineProperty(r,"PathFileUtil",{enumerable:true,get:function(){return U.PathFileUtil}});var q=n(93879);Object.defineProperty(r,"FileUtils",{enumerable:true,get:function(){return q.FileUtils}});var V=n(85439);Object.defineProperty(r,"FORMAT",{enumerable:true,get:function(){return V.FORMAT}});var z=n(14233);Object.defineProperty(r,"ServerResponse",{enumerable:true,get:function(){return z.ServerResponse}});Object.defineProperty(r,"HttpServerResponse",{enumerable:true,get:function(){return z.HttpServerResponse}});var K=n(53924);Object.defineProperty(r,"TypedResourceManager",{enumerable:true,get:function(){return K.TypedResourceManager}});var W=n(4334);Object.defineProperty(r,"MidwayPerformanceManager",{enumerable:true,get:function(){return W.MidwayPerformanceManager}})},87270:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayProcessTypeEnum=r.ObjectLifeCycleEvent=r.ServerlessTriggerType=r.MidwayFrameworkType=r.FrameworkType=r.MSListenerType=r.MSProviderType=r.InjectModeEnum=r.ScopeEnum=void 0;var n;(function(e){e["Singleton"]="Singleton";e["Request"]="Request";e["Prototype"]="Prototype"})(n=r.ScopeEnum||(r.ScopeEnum={}));var i;(function(e){e["Identifier"]="Identifier";e["Class"]="Class";e["PropertyName"]="PropertyName"})(i=r.InjectModeEnum||(r.InjectModeEnum={}));var s;(function(e){e["DUBBO"]="dubbo";e["GRPC"]="gRPC"})(s=r.MSProviderType||(r.MSProviderType={}));var o;(function(e){e["RABBITMQ"]="rabbitmq";e["MQTT"]="mqtt";e["KAFKA"]="kafka";e["REDIS"]="redis"})(o=r.MSListenerType||(r.MSListenerType={}));class FrameworkType{}r.FrameworkType=FrameworkType;class MidwayFrameworkType extends FrameworkType{constructor(e){super();this.name=e}}r.MidwayFrameworkType=MidwayFrameworkType;MidwayFrameworkType.WEB=new MidwayFrameworkType("@midwayjs/web");MidwayFrameworkType.WEB_KOA=new MidwayFrameworkType("@midwayjs/web-koa");MidwayFrameworkType.WEB_EXPRESS=new MidwayFrameworkType("@midwayjs/express");MidwayFrameworkType.FAAS=new MidwayFrameworkType("@midwayjs/faas");MidwayFrameworkType.MS_GRPC=new MidwayFrameworkType("@midwayjs/grpc");MidwayFrameworkType.MS_RABBITMQ=new MidwayFrameworkType("@midwayjs/rabbitmq");MidwayFrameworkType.MS_KAFKA=new MidwayFrameworkType("@midwayjs/kafka");MidwayFrameworkType.WS_IO=new MidwayFrameworkType("@midwayjs/socketio");MidwayFrameworkType.WS=new MidwayFrameworkType("@midwayjs/ws");MidwayFrameworkType.SERVERLESS_APP=new MidwayFrameworkType("@midwayjs/serverless-app");MidwayFrameworkType.CUSTOM=new MidwayFrameworkType("");MidwayFrameworkType.EMPTY=new MidwayFrameworkType("empty");MidwayFrameworkType.LIGHT=new MidwayFrameworkType("light");MidwayFrameworkType.TASK=new MidwayFrameworkType("@midwayjs/task");var a;(function(e){e["EVENT"]="event";e["HTTP"]="http";e["API_GATEWAY"]="apigw";e["OS"]="os";e["CDN"]="cdn";e["LOG"]="log";e["TIMER"]="timer";e["MQ"]="mq";e["KAFKA"]="kafka";e["HSF"]="hsf";e["MTOP"]="mtop";e["SSR"]="ssr"})(a=r.ServerlessTriggerType||(r.ServerlessTriggerType={}));var c;(function(e){e["BEFORE_BIND"]="beforeBind";e["BEFORE_CREATED"]="beforeObjectCreated";e["AFTER_CREATED"]="afterObjectCreated";e["AFTER_INIT"]="afterObjectInit";e["BEFORE_DESTROY"]="beforeObjectDestroy"})(c=r.ObjectLifeCycleEvent||(r.ObjectLifeCycleEvent={}));var u;(function(e){e["APPLICATION"]="APPLICATION";e["AGENT"]="AGENT"})(u=r.MidwayProcessTypeEnum||(r.MidwayProcessTypeEnum={}))},97996:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ServerResponse=void 0;class ServerResponse{constructor(e){this.isSuccess=true;this.ctx=e}json(e){return Object.getPrototypeOf(this).constructor.JSON_TPL(e,this.isSuccess,this.ctx)}text(e){return Object.getPrototypeOf(this).constructor.TEXT_TPL(e,this.isSuccess,this.ctx)}blob(e){return Object.getPrototypeOf(this).constructor.BLOB_TPL(e,this.isSuccess,this.ctx)}success(){this.isSuccess=true;return this}fail(){this.isSuccess=false;return this}}r.ServerResponse=ServerResponse;ServerResponse.TEXT_TPL=(e,r,n)=>e;ServerResponse.JSON_TPL=(e,r,n)=>{if(r){return{success:"true",data:e}}else{return{success:"false",message:e||"fail"}}};ServerResponse.BLOB_TPL=(e,r,n)=>e},78053:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.HttpServerResponse=void 0;const i=n(79896);const s=n(97996);const o=n(73156);const a=n(56109);const c=n(16928);class HttpServerResponse extends s.ServerResponse{constructor(e){super(e)}status(e){this.ctx.res.statusCode=e;return this}header(e,r){this.ctx.res.setHeader(e,r);return this}headers(e){if(this.ctx.res.setHeaders){this.ctx.res.setHeaders(new Map(Object.entries(e)))}else{for(const r in e){this.header(r,e[r])}}return this}json(e){this.header("Content-Type","application/json");return Object.getPrototypeOf(this).constructor.JSON_TPL(e,this.isSuccess,this.ctx)}text(e){this.header("Content-Type","text/plain");return Object.getPrototypeOf(this).constructor.TEXT_TPL(e,this.isSuccess,this.ctx)}file(e,r){this.header("Content-Type",r||"application/octet-stream");this.header("Content-Disposition",`attachment; filename=${(0,c.basename)(e)}`);return Object.getPrototypeOf(this).constructor.FILE_TPL(typeof e==="string"?(0,i.createReadStream)(e):e,this.isSuccess,this.ctx)}blob(e,r){this.header("Content-Type",r||"application/octet-stream");return Object.getPrototypeOf(this).constructor.BLOB_TPL(e,this.isSuccess,this.ctx)}html(e){this.header("Content-Type","text/html");return Object.getPrototypeOf(this).constructor.HTML_TPL(e,this.isSuccess,this.ctx)}redirect(e,r=302){this.status(r);if(this.ctx.redirect){return this.ctx.redirect(e)}else if(this.ctx.res.redirect){return this.ctx.res.redirect(e)}else{this.header("Location",e)}}sse(e={}){return new o.ServerSendEventStream(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.SSE_TPL,...e})}stream(e={}){return new a.HttpStreamResponse(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.STREAM_TPL,...e})}}r.HttpServerResponse=HttpServerResponse;HttpServerResponse.FILE_TPL=(e,r,n)=>e;HttpServerResponse.SSE_TPL=(e,r)=>e;HttpServerResponse.STREAM_TPL=(e,r)=>e;HttpServerResponse.HTML_TPL=(e,r,n)=>e},14233:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.HttpServerResponse=r.ServerResponse=void 0;var i=n(97996);Object.defineProperty(r,"ServerResponse",{enumerable:true,get:function(){return i.ServerResponse}});var s=n(78053);Object.defineProperty(r,"HttpServerResponse",{enumerable:true,get:function(){return s.HttpServerResponse}})},73156:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ServerSendEventStream=void 0;const i=n(2203);class ServerSendEventStream extends i.Transform{constructor(e,r={}){super({objectMode:true,...r});this.isActive=false;this.ctx=e;this.closeEvent=r.closeEvent||"close";this.options=r;this.ctx.req.on("close",this.handleClose.bind(this))}_transform(e,r,n){try{let r,i="data: ";const s=/^\s*:\s*/;const o=[];if(!this.isActive){this.isActive=true;const e={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(const r in e){this.ctx.res.setHeader(r,e[r])}this.ctx.req.socket.setTimeout(0);this.ctx.req.socket.setNoDelay(true);this.ctx.req.socket.setKeepAlive(true);o.push(": ok")}const a=e;if(a.event)o.push("event: "+a.event);if(a.retry)o.push("retry: "+a.retry);if(a.id)o.push("id: "+a.id);if(typeof a.data==="object"){r=JSON.stringify(a.data);o.push(i+r)}else if(typeof a.data==="undefined"){o.push(i)}else{a.data=String(a.data);if(a.data.search(s)!==-1){a.data=a.data.replace(s,"");i=": "}a.data=a.data.replace(/(\r\n|\r|\n)/g,"\n");r=a.data.split(/\n/);for(let e=0,n=r.length;e<n;++e){const s=r[e];if(e+1===n){o.push(i+s)}else{o.push(i+s)}}}this.push(o.join("\n")+"\n\n");n()}catch(e){this.ctx.logger.error(e);this.sendError(e);this.end();n(e)}}sendError(e){this.send({event:"error",data:e.message||"An error occurred"})}sendEnd(e){e.event=this.closeEvent;this.send(e)}send(e){super.write(this.options.tpl(e,this.ctx))}handleClose(){this.end()}}r.ServerSendEventStream=ServerSendEventStream},56109:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.HttpStreamResponse=void 0;const i=n(2203);class HttpStreamResponse extends i.Transform{constructor(e,r={}){super({objectMode:true,...r});this.isActive=false;this.ctx=e;this.options=r}_transform(e,r,n){try{if(!this.isActive){this.isActive=true;this.ctx.res.statusCode=200;this.ctx.res.setHeader("Transfer-Encoding","chunked");this.ctx.res.setHeader("Cache-Control","no-cache");this.ctx.req.socket.setTimeout(0)}if(typeof e==="string"){this.ctx.res.write(e)}else{this.ctx.res.write(JSON.stringify(e))}n()}catch(e){this.ctx.logger.error(e);this.end();this.ctx.res.end();n(e)}}send(e){if(!this.writable){return}this.write(this.options.tpl(e,this.ctx))}sendError(e){this.ctx.logger.error(e);this.end();this.ctx.res.end()}_flush(e){this.ctx.res.end();e()}}r.HttpStreamResponse=HttpStreamResponse},59550:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayAspectService=void 0;const o=n(14006);const a=n(87270);const c=n(8351);const u=n(73171);let p=class MidwayAspectService{constructor(e){this.applicationContext=e}async loadAspect(){const e=(0,c.listModule)(c.ASPECT_KEY);let r=[];for(const n of e){const e=(0,c.getClassMetadata)(c.ASPECT_KEY,n);r=r.concat(e.map((e=>{e.aspectModule=n;return e})))}r.sort(((e,r)=>(r.priority||0)-(e.priority||0)));for(const e of r){const r=await this.applicationContext.getAsync(e.aspectModule);await this.addAspect(r,e)}}async addAspect(e,r){const n=r.aspectTarget;const i=Object.getOwnPropertyNames(n.prototype);const s=r.match?o(r.match):()=>true;for(const r of i){if(r==="constructor"||!s(r)){continue}const i=Object.getOwnPropertyDescriptor(n.prototype,r);if(!i||i.writable===false){continue}this.interceptPrototypeMethod(n,r,e)}}interceptPrototypeMethod(e,r,n){const i=e.prototype[r];if(u.Types.isAsyncFunction(e.prototype[r])){e.prototype[r]=async function(...e){var s,o,a;let c,u;const newProceed=(...e)=>i.apply(this,e);const p={methodName:r,target:this,args:e,proceed:newProceed,proceedIsAsyncFunction:true};if(typeof n==="function"){n=n()}try{await((s=n.before)===null||s===void 0?void 0:s.call(n,p));if(n.around){u=await n.around(p)}else{u=await i.call(this,...p.args)}p.proceed=undefined;const e=await((o=n.afterReturn)===null||o===void 0?void 0:o.call(n,p,u));u=typeof e==="undefined"?u:e;return u}catch(e){p.proceed=undefined;c=e;if(n.afterThrow){await n.afterThrow(p,c)}else{throw e}}finally{await((a=n.after)===null||a===void 0?void 0:a.call(n,p,u,c))}}}else{e.prototype[r]=function(...e){var s,o,a;let c,u;const newProceed=(...e)=>i.apply(this,e);const p={methodName:r,target:this,args:e,proceed:newProceed,proceedIsAsyncFunction:false};if(typeof n==="function"){n=n()}try{(s=n.before)===null||s===void 0?void 0:s.call(n,p);if(n.around){u=n.around(p)}else{u=i.call(this,...p.args)}p.proceed=undefined;const e=(o=n.afterReturn)===null||o===void 0?void 0:o.call(n,p,u);u=typeof e==="undefined"?u:e;return u}catch(e){p.proceed=undefined;c=e;if(n.afterThrow){n.afterThrow(p,c)}else{throw e}}finally{(a=n.after)===null||a===void 0?void 0:a.call(n,p,u,c)}}}}};p=i([(0,c.Provide)(),(0,c.Scope)(a.ScopeEnum.Singleton),s("design:paramtypes",[Object])],p);r.MidwayAspectService=p},73440:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayConfigService=void 0;const o=n(16928);const a=n(87270);const c=n(86110);const u=n(79896);const p=n(39023);const g=n(14057);const v=n(41560);const b=n(90428);const _=n(86248);const E=n(8351);const x=n(73171);const T=p.debuglog("midway:debug");let w=class MidwayConfigService{constructor(){this.envDirMap=new Map;this.aliasMap={prod:"production",unittest:"test"};this.configMergeOrder=[];this.configuration={};this.isReady=false;this.externalObject=[];this.configFilterList=[]}init(){this.appInfo={pkg:this.informationService.getPkg(),name:this.informationService.getProjectName(),baseDir:this.informationService.getBaseDir(),appDir:this.informationService.getAppDir(),HOME:this.informationService.getHome(),root:this.informationService.getRoot(),env:this.environmentService.getCurrentEnvironment()}}add(e){for(const r of e){if(typeof r==="string"){if(/\.\w+$/.test(r)){const e=this.getConfigEnv(r);const n=this.getEnvSet(e);n.add(r);if(this.aliasMap[e]){this.getEnvSet(this.aliasMap[e]).add(r)}}else{const e=(0,u.statSync)(r);if(e.isDirectory()){const e=(0,u.readdirSync)(r);this.add(e.map((e=>(0,o.join)(r,e))))}}}else{for(const e in r){this.getEnvSet(e).add(r[e]);if(this.aliasMap[e]){this.getEnvSet(this.aliasMap[e]).add(r[e])}}}}}addObject(e,r=false){if(this.isReady){e=this.runWithFilter(e);if(!e){T("[config]: Filter config and got undefined will be drop it");return}this.configMergeOrder.push({env:"default",extraPath:"",value:e});if(r){this.configuration=(0,b.extend)(true,e,this.configuration)}else{(0,b.extend)(true,this.configuration,e)}}else{this.externalObject.push(e)}}getEnvSet(e){if(!this.envDirMap.has(e)){this.envDirMap.set(e,new Set)}return this.envDirMap.get(e)}getConfigEnv(e){const r=(0,o.basename)(e);const n=r.split(".");const i=n.pop();if(i!=="js"&&i!=="ts"){return i}return n.pop()}load(){if(this.isReady)return;const e=this.getEnvSet("default");const r=this.getEnvSet(this.environmentService.getCurrentEnvironment());const n={};const i=e.size;for(const[s,o]of[...e,...r].entries()){let e=this.loadConfig(o);if(x.Types.isFunction(e)){e=e.apply(null,[this.appInfo,n])}if(!e){continue}e=this.runWithFilter(e);if(!e){T("[config]: Filter config and got undefined will be drop it");continue}if(typeof o==="string"){T("[config]: Loaded config %s, %j",o,e)}else{T("[config]: Loaded config %j",e)}this.configMergeOrder.push({env:s<i?"default":this.environmentService.getCurrentEnvironment(),extraPath:o,value:e});(0,b.extend)(true,n,e)}if(this.externalObject.length){for(let e of this.externalObject){if(e){e=this.runWithFilter(e);if(!e){T("[config]: Filter config and got undefined will be drop it");continue}T("[config]: Loaded external object %j",e);(0,b.extend)(true,n,e);this.configMergeOrder.push({env:"default",extraPath:"",value:e})}}}this.configuration=n;this.isReady=true}getConfiguration(e){if(e){return(0,c.safelyGet)(e,this.configuration)}return this.configuration}getConfigMergeOrder(){return this.configMergeOrder}loadConfig(e){let r=typeof e==="string"?require(e):e;if(r&&r.__esModule){if(r&&r.default){if(Object.keys(r).length>1){throw new _.MidwayInvalidConfigError(`${e} should not have both a default export and named export`)}r=r.default}}return r}clearAllConfig(){this.configuration={}}clearConfigMergeOrder(){this.configMergeOrder.length=0}addFilter(e){this.configFilterList.push(e)}runWithFilter(e){for(const r of this.configFilterList){T(`[config]: Filter config by filter = "${r.name||"anonymous filter"}"`);e=r(e);T("[config]: Filter config result = %j",e)}return e}getAppInfo(){return this.appInfo}};i([(0,E.Inject)(),s("design:type",g.MidwayEnvironmentService)],w.prototype,"environmentService",void 0);i([(0,E.Inject)(),s("design:type",v.MidwayInformationService)],w.prototype,"informationService",void 0);i([(0,E.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],w.prototype,"init",null);w=i([(0,E.Provide)(),(0,E.Scope)(a.ScopeEnum.Singleton)],w);r.MidwayConfigService=w},14625:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayDecoratorService=void 0;const o=n(8351);const a=n(87270);const c=n(59550);const u=n(86248);const p=n(39023);const g=n(73171);const v=p.debuglog("midway:debug");let b=class MidwayDecoratorService{constructor(e){this.applicationContext=e;this.propertyHandlerMap=new Map;this.methodDecoratorMap=new Map;this.parameterDecoratorMap=new Map;this.parameterDecoratorPipes=new Map}init(){this.applicationContext.onBeforeBind((e=>{const r=(0,o.getClassMetadata)(o.INJECT_CUSTOM_METHOD,e);if(r){for(const n of r){const{propertyName:r,key:i,metadata:s,options:o}=n;if(!o||!o.impl){continue}this.aspectService.interceptPrototypeMethod(e,r,(()=>{const n=this.methodDecoratorMap.get(i);if(!n){throw new u.MidwayCommonError(`Method Decorator "${i}" handler not found, please register first.`)}return n({target:e,propertyName:r,metadata:s})}))}}const n=(0,o.getClassMetadata)(o.INJECT_CUSTOM_PARAM,e);if(n){for(const r of Object.keys(n)){this.aspectService.interceptPrototypeMethod(e,r,(()=>({before:async i=>{const s=[...i.args];for(const a of n[r]){const{propertyName:r,key:n,metadata:c,parameterIndex:p,options:b}=a;let _;if(b&&b.impl){_=this.parameterDecoratorMap.get(n);if(!_){throw new u.MidwayCommonError(`Parameter Decorator "${n}" handler not found, please register first.`)}}else{_=async({parameterIndex:e,originArgs:r})=>r[e]}const E=(0,o.getMethodParamTypes)(e,r);let x=false;try{s[p]=await _({metadata:c,propertyName:r,parameterIndex:p,target:e,originArgs:s,originParamType:E[p],instance:i.target})}catch(e){x=true;if((b===null||b===void 0?void 0:b.throwError)===true){throw e}else{v(`[core]: Parameter decorator throw error and use origin args, ${e.stack}`)}}if(x){continue}const T=[...this.parameterDecoratorPipes.get(n)||[],...(b===null||b===void 0?void 0:b.pipes)||[]];for(const e of T){let r;if("transform"in e){r=e["transform"].bind(e)}else if((0,g.isClass)(e)){const n=await this.applicationContext.getAsync(e);r=n.transform.bind(n)}else if(typeof e==="function"){r=e}else{throw new u.MidwayParameterError("Pipe must be a function or implement PipeTransform interface")}s[p]=await r(s[p],{metaType:(0,o.transformTypeFromTSDesign)(E[p]),metadata:c,target:i.target,methodName:i.methodName})}}i.args=s}})))}}}));this.applicationContext.onObjectCreated(((e,r)=>{if(this.propertyHandlerMap.size>0&&Array.isArray(r.definition.handlerProps)){for(const n of r.definition.handlerProps){this.defineGetterPropertyValue(n,e,this.getHandler(n.key))}}}));this.registerPropertyHandler(o.APPLICATION_CONTEXT_KEY,((e,r)=>this.applicationContext))}registerPropertyHandler(e,r){v(`[core]: Register property decorator key="${e}"`);this.propertyHandlerMap.set(e,r)}registerMethodHandler(e,r){v(`[core]: Register method decorator key="${e}"`);this.methodDecoratorMap.set(e,r)}registerParameterHandler(e,r){v(`[core]: Register parameter decorator key="${e}"`);this.parameterDecoratorMap.set(e,r)}registerParameterPipes(e,r){if(!this.parameterDecoratorPipes.has(e)){this.parameterDecoratorPipes.set(e,[])}this.parameterDecoratorPipes.set(e,this.parameterDecoratorPipes.get(e).concat(r))}defineGetterPropertyValue(e,r,n){if(e&&n){if(e.propertyName){Object.defineProperty(r,e.propertyName,{get:()=>{var i;return n(e.propertyName,(i=e.metadata)!==null&&i!==void 0?i:{},r)},configurable:true,enumerable:true})}}}getHandler(e){if(this.propertyHandlerMap.has(e)){return this.propertyHandlerMap.get(e)}}};i([(0,o.Inject)(),s("design:type",c.MidwayAspectService)],b.prototype,"aspectService",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],b.prototype,"init",null);b=i([(0,o.Provide)(),(0,o.Scope)(a.ScopeEnum.Singleton),s("design:paramtypes",[Object])],b);r.MidwayDecoratorService=b},14057:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.MidwayEnvironmentService=void 0;const s=n(87270);const o=n(86110);const a=n(8351);let c=class MidwayEnvironmentService{constructor(){this.moduleLoadType="commonjs"}getCurrentEnvironment(){if(!this.environment){this.environment=(0,o.getCurrentEnvironment)()}return this.environment}setCurrentEnvironment(e){this.environment=e}isDevelopmentEnvironment(){return(0,o.isDevelopmentEnvironment)(this.environment)}setModuleLoadType(e){this.moduleLoadType=e}getModuleLoadType(){return this.moduleLoadType}isPkgEnvironment(){return typeof process["pkg"]!=="undefined"}};c=i([(0,a.Provide)(),(0,a.Scope)(s.ScopeEnum.Singleton)],c);r.MidwayEnvironmentService=c},65338:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayFrameworkService=void 0;const o=n(8351);const a=n(87270);const c=n(73440);const u=n(70426);const p=n(31630);const g=n(720);const v=n(14625);const b=n(59550);const _=n(51926);const E=n(39023);const x=n(86248);const T=n(77404);const w=n(4334);const C=E.debuglog("midway:debug");let A=class MidwayFrameworkService{constructor(e,r){this.applicationContext=e;this.globalOptions=r;this.globalFrameworkList=[]}async init(){var e,r;this.decoratorService.registerPropertyHandler(o.CONFIG_KEY,((e,r)=>{var n;if(r.identifier===o.ALL){return this.configService.getConfiguration()}else{return this.configService.getConfiguration((n=r.identifier)!==null&&n!==void 0?n:e)}}));this.decoratorService.registerPropertyHandler(o.LOGGER_KEY,((e,r)=>{var n;return this.loggerService.getLogger((n=r.identifier)!==null&&n!==void 0?n:e)}));this.decoratorService.registerPropertyHandler(o.PIPELINE_IDENTIFIER,((e,r,n)=>{var i,s;return new g.MidwayPipelineService((s=(i=n[T.REQUEST_OBJ_CTX_KEY])===null||i===void 0?void 0:i.requestContext)!==null&&s!==void 0?s:this.applicationContext,r.valves)}));this.decoratorService.registerPropertyHandler(o.APPLICATION_KEY,((e,r)=>{if(r.type){const e=this.applicationManager.getApplication(r.type);if(!e){throw new x.MidwayCommonError(`Framework ${r.type} not Found`)}return e}else{return this.getMainApp()}}));this.decoratorService.registerPropertyHandler(o.PLUGIN_KEY,((e,r)=>{var n;return this.getMainApp()[(n=r.identifier)!==null&&n!==void 0?n:e]}));this.decoratorService.registerPropertyHandler(o.FACTORY_SERVICE_CLIENT_KEY,((e,r)=>{const n=this.applicationContext.get(r.serviceFactoryClz);const i=r.clientName||n.getDefaultClientName();if(i&&n.has(i)){return n.get(i)}else{if(!i){throw new x.MidwayParameterError(`Please set clientName or options.defaultClientName for ${r.serviceFactoryClz.name}).`)}else{throw new x.MidwayParameterError(`ClientName(${i} not found in ${r.serviceFactoryClz.name}).`)}}}));let n=(0,o.listModule)(o.FRAMEWORK_KEY);n=filterProtoFramework(n);C(`[core]: Found Framework length = ${n.length}`);if(n.length){for(const r of n){if(!this.applicationContext.hasDefinition((0,o.getProviderUUId)(r))){C(`[core]: Found Framework "${r.name}" but missing definition, skip initialize.`);continue}const n=await this.applicationContext.getAsync(r,[this.applicationContext]);if(n.isEnable()){w.MidwayInitializerPerformanceManager.frameworkInitializeStart(n.getFrameworkName());await n.initialize({applicationContext:this.applicationContext,namespace:n.getNamespace(),...this.globalOptions});w.MidwayInitializerPerformanceManager.frameworkInitializeEnd(n.getFrameworkName());C(`[core]: Found Framework "${n.getFrameworkName()}" and initialize.`)}else{C(`[core]: Found Framework "${n.getFrameworkName()}" and delay initialize.`)}const i=this.applicationContext.registry.getDefinition((0,o.getProviderUUId)(r));n.setNamespace(i===null||i===void 0?void 0:i.namespace);this.applicationManager.addFramework((e=i===null||i===void 0?void 0:i.namespace)!==null&&e!==void 0?e:n.getFrameworkName(),n);this.globalFrameworkList.push(n)}let i;const s=this.applicationContext.getNamespaceList();for(const e of s){const r=this.applicationManager.getApplication(e);if(r){i=e;break}}global["MIDWAY_MAIN_FRAMEWORK"]=this.mainFramework=(r=this.applicationManager.getFramework(i))!==null&&r!==void 0?r:this.globalFrameworkList[0];C(`[core]: Current main Framework is "${i}".`)}await this.aspectService.loadAspect()}getMainApp(){var e;return(e=this.mainFramework)===null||e===void 0?void 0:e.getApplication()}getMainFramework(){return this.mainFramework}getFramework(e){return this.applicationManager.getFramework(e)}async runFramework(){const e=this.applicationContext.getNamespaceList();this.globalFrameworkList=this.globalFrameworkList.sort(((r,n)=>e.indexOf(r.getNamespace())-e.indexOf(n.getNamespace())));for(const e of this.globalFrameworkList){if(e.isEnable()){w.MidwayInitializerPerformanceManager.frameworkRunStart(e.getFrameworkName());await e.run();C(`[core]: Found Framework "${e.getFrameworkName()}" and run.`);w.MidwayInitializerPerformanceManager.frameworkRunEnd(e.getFrameworkName())}}}async stopFramework(){await Promise.all(Array.from(this.globalFrameworkList).map((e=>e.stop())))}};i([(0,o.Inject)(),s("design:type",c.MidwayConfigService)],A.prototype,"configService",void 0);i([(0,o.Inject)(),s("design:type",u.MidwayLoggerService)],A.prototype,"loggerService",void 0);i([(0,o.Inject)(),s("design:type",b.MidwayAspectService)],A.prototype,"aspectService",void 0);i([(0,o.Inject)(),s("design:type",v.MidwayDecoratorService)],A.prototype,"decoratorService",void 0);i([(0,o.Inject)(),s("design:type",_.MidwayApplicationManager)],A.prototype,"applicationManager",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],A.prototype,"init",null);A=i([(0,o.Provide)(),(0,o.Scope)(a.ScopeEnum.Singleton),s("design:paramtypes",[Object,Object])],A);r.MidwayFrameworkService=A;function filterProtoFramework(e){const r=[];for(const n of e){let e=Object.getPrototypeOf(n);while(e.name&&e.name!==p.BaseFramework.name){r.push(e);e=Object.getPrototypeOf(e)}}return e.filter((e=>!r.includes(e)))}},34292:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayHealthService=void 0;const o=n(8351);const a=n(87270);const c=n(73440);const u=n(86110);let p=class MidwayHealthService{constructor(){this.healthCheckTimeout=1e3;this.healthCheckMethods=[]}async init(e){const r=this.configService.getConfiguration("core.healthCheckTimeout")||1e3;this.setCheckTimeout(r);for(const r of e){if(r.instance&&r.instance["onHealthCheck"]){this.healthCheckMethods.push({item:r.instance["onHealthCheck"].bind(r.instance),meta:{namespace:r.namespace}})}}}async getStatus(){const e=await(0,u.createPromiseTimeoutInvokeChain)({promiseItems:this.healthCheckMethods.map((e=>({item:e.item(this.applicationContext),meta:e.meta}))),timeout:this.healthCheckTimeout,methodName:"configuration.onHealthCheck",onSuccess:(e,r)=>{if(e["status"]!==undefined){return{namespace:r.namespace,...e}}else{return{status:false,namespace:r.namespace,reason:"configuration.onHealthCheck return value must be object and contain status field"}}},onFail:(e,r)=>({status:false,namespace:r.namespace,reason:e.message})});const r=e.find((e=>!e.status));return{status:!r,namespace:r===null||r===void 0?void 0:r.namespace,reason:r===null||r===void 0?void 0:r.reason,results:e}}setCheckTimeout(e){this.healthCheckTimeout=e}};i([(0,o.Inject)(),s("design:type",c.MidwayConfigService)],p.prototype,"configService",void 0);i([(0,o.ApplicationContext)(),s("design:type",Object)],p.prototype,"applicationContext",void 0);p=i([(0,o.Provide)(),(0,o.Scope)(a.ScopeEnum.Singleton)],p);r.MidwayHealthService=p},41560:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayInformationService=void 0;const o=n(87270);const a=n(86110);const c=n(16928);const u=n(8351);const p=n(79896);let g=class MidwayInformationService{init(){if(this.baseDir){if(!this.appDir){this.appDir=(0,c.dirname)(this.baseDir)}const e=(0,c.join)(this.appDir,"package.json");if((0,p.existsSync)(e)){const r=(0,p.readFileSync)(e,{encoding:"utf-8"});this.pkg=JSON.parse(r)}else{this.pkg={}}}else{this.pkg={}}}getAppDir(){return this.appDir}getBaseDir(){return this.baseDir}getHome(){return(0,a.getUserHome)()}getPkg(){return this.pkg}getProjectName(){var e;return((e=this.pkg)===null||e===void 0?void 0:e["name"])||""}getRoot(){const e=(0,a.isDevelopmentEnvironment)((0,a.getCurrentEnvironment)());return e?this.getAppDir():this.getHome()}};i([(0,u.Inject)(),s("design:type",String)],g.prototype,"appDir",void 0);i([(0,u.Inject)(),s("design:type",String)],g.prototype,"baseDir",void 0);i([(0,u.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],g.prototype,"init",null);g=i([(0,u.Provide)(),(0,u.Scope)(o.ScopeEnum.Singleton)],g);r.MidwayInformationService=g},1026:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayLifeCycleService=void 0;const o=n(87270);const a=n(8351);const c=n(65061);const u=n(65338);const p=n(73440);const g=n(39023);const v=n(67072);const b=n(34292);const _=n(4334);const E=(0,g.debuglog)("midway:debug");let x=class MidwayLifeCycleService{constructor(e){this.applicationContext=e;this.lifecycleInstanceList=[]}async init(){await this.mockService.initSimulation();const e=(0,a.listModule)(a.CONFIGURATION_KEY);E(`[core]: Found Configuration length = ${e.length}`);for(const r of e){if(r.target instanceof c.FunctionalConfiguration){r.instance=r.target}else{E(`[core]: Lifecycle run ${r.namespace} init`);r.instance=await this.applicationContext.getAsync(r.target)}r.instance&&this.lifecycleInstanceList.push(r)}await this.healthService.init(this.lifecycleInstanceList);await Promise.all([this.runObjectLifeCycle(this.lifecycleInstanceList,"onBeforeObjectCreated"),this.runObjectLifeCycle(this.lifecycleInstanceList,"onObjectCreated"),this.runObjectLifeCycle(this.lifecycleInstanceList,"onObjectInit"),this.runObjectLifeCycle(this.lifecycleInstanceList,"onBeforeObjectDestroy")]);await this.runContainerLifeCycle(this.lifecycleInstanceList,"onConfigLoad",(e=>{if(e){this.configService.addObject(e)}}));await this.mockService.runSimulatorSetup();await this.runContainerLifeCycle(this.lifecycleInstanceList,"onReady");await this.frameworkService.runFramework();await this.runContainerLifeCycle(this.lifecycleInstanceList,"onServerReady");if(!this.configService.getConfiguration("debug.recordConfigMergeOrder")){this.configService.clearConfigMergeOrder()}}async stop(){await this.mockService.runSimulatorTearDown();const e=(0,a.listModule)(a.CONFIGURATION_KEY)||[];for(const r of e.reverse()){let e;if(r.target instanceof c.FunctionalConfiguration){e=r.target}else{e=await this.applicationContext.getAsync(r.target)}await this.runContainerLifeCycle(e,"onStop")}await this.frameworkService.stopFramework()}async runContainerLifeCycle(e,r,n){if(Array.isArray(e)){for(const i of e){if(typeof i.instance[r]==="function"){E(`[core]: Lifecycle run ${i.instance.constructor.name} ${r}`);_.MidwayInitializerPerformanceManager.lifecycleStart(i.namespace,r);const e=await i.instance[r](this.applicationContext,this.frameworkService.getMainApp());if(n){n(e)}_.MidwayInitializerPerformanceManager.lifecycleEnd(i.namespace,r)}}}else{if(typeof e[r]==="function"){const i=e.constructor.name;E(`[core]: Lifecycle run ${i} ${r}`);_.MidwayInitializerPerformanceManager.lifecycleStart(i,r);const s=await e[r](this.applicationContext,this.frameworkService.getMainApp());if(n){n(s)}_.MidwayInitializerPerformanceManager.lifecycleEnd(i,r)}}}async runObjectLifeCycle(e,r){for(const n of e){if(typeof n.instance[r]==="function"){E(`[core]: Lifecycle run ${n.instance.constructor.name} ${r}`);return await this.applicationContext[r](n.instance[r].bind(n.instance))}}}getLifecycleInstanceList(){return this.lifecycleInstanceList}};i([(0,a.Inject)(),s("design:type",u.MidwayFrameworkService)],x.prototype,"frameworkService",void 0);i([(0,a.Inject)(),s("design:type",p.MidwayConfigService)],x.prototype,"configService",void 0);i([(0,a.Inject)(),s("design:type",v.MidwayMockService)],x.prototype,"mockService",void 0);i([(0,a.Inject)(),s("design:type",b.MidwayHealthService)],x.prototype,"healthService",void 0);i([(0,a.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],x.prototype,"init",null);x=i([(0,a.Provide)(),(0,a.Scope)(o.ScopeEnum.Singleton),s("design:paramtypes",[Object])],x);r.MidwayLifeCycleService=x},70426:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayLoggerService=void 0;const o=n(8351);const a=n(73440);const c=n(37940);const u=n(87270);const p=n(94853);const g=n(86248);let v=class MidwayLoggerService extends c.ServiceFactory{constructor(e,r={}){super();this.applicationContext=e;this.globalOptions=r;this.lazyLoggerConfigMap=new Map;this.aliasLoggerMap=new Map}init(){var e;const r=this.configService.getConfiguration("loggerFactory");this.loggerFactory=r||this.globalOptions["loggerFactory"]||new p.DefaultConsoleLoggerFactory;if(!this.loggerFactory.getDefaultMidwayLoggerConfig){throw new g.MidwayFeatureNoLongerSupportedError("please upgrade your @midwayjs/logger to latest version")}const n=this.loggerFactory.getDefaultMidwayLoggerConfig(this.configService.getAppInfo());this.configService.addObject(n,true);this.initClients(this.configService.getConfiguration("midwayLogger"));(e=this.applicationContext)===null||e===void 0?void 0:e.registerObject("logger",this.getLogger("appLogger"))}createClient(e,r){if(e.aliasName){this.aliasLoggerMap.set(e.aliasName,r)}if(!e.lazyLoad){this.loggerFactory.createLogger(r,e)}else{delete e["lazyLoad"];this.lazyLoggerConfigMap.set(r,e)}}getName(){return"logger"}createLogger(e,r){delete r["aliasName"];return this.loggerFactory.createLogger(e,r)}getLogger(e){if(this.aliasLoggerMap.has(e)){e=this.aliasLoggerMap.get(e)}const r=this.loggerFactory.getLogger(e);if(r){return r}if(this.lazyLoggerConfigMap.has(e)){this.createClient(this.lazyLoggerConfigMap.get(e),e);this.lazyLoggerConfigMap.delete(e)}return this.loggerFactory.getLogger(e)}getCurrentLoggerFactory(){return this.loggerFactory}createContextLogger(e,r,n){return this.loggerFactory.createContextLogger(e,r,n)}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}};i([(0,o.Inject)(),s("design:type",a.MidwayConfigService)],v.prototype,"configService",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],v.prototype,"init",null);v=i([(0,o.Provide)(),(0,o.Scope)(u.ScopeEnum.Singleton),s("design:paramtypes",[Object,Object])],v);r.MidwayLoggerService=v},66134:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayMiddlewareService=void 0;const o=n(8351);const a=n(87270);const c=n(86248);const u=n(86110);const p=n(73171);const g=n(39023);const v=(0,g.debuglog)("midway:debug");let b=class MidwayMiddlewareService{constructor(e){this.applicationContext=e}async compose(e,r,n){var i;if(!Array.isArray(e)){throw new c.MidwayParameterError("Middleware stack must be an array")}const s=[];for(let n of e){if(p.Types.isClass(n)||typeof n==="string"||(n===null||n===void 0?void 0:n["middleware"])){let e=(i=n===null||n===void 0?void 0:n["middleware"])!==null&&i!==void 0?i:n;const o=n===null||n===void 0?void 0:n["options"];let a=n===null||n===void 0?void 0:n["name"];if(typeof e==="string"&&!this.applicationContext.hasDefinition(e)){throw new c.MidwayCommonError(`Middleware definition of "${e}" not found in midway container`)}const p=await this.applicationContext.getAsync(e);if(p){a=a!==null&&a!==void 0?a:p.constructor.name;e=await p.resolve(r,o);if(!e){continue}if(!p.match&&!p.ignore){if(!e.name){e._name=a}s.push(e)}else{const r=(0,u.pathMatching)({match:p.match,ignore:p.ignore,thisResolver:p});n=(n,i,s)=>{if(!r(n))return i();return e(n,i,s)};n._name=a;s.push(n)}}else{throw new c.MidwayCommonError("Middleware must have resolve method!")}}else{s.push(n)}}const composeFn=(e,r)=>{const i=(0,u.isIncludeProperty)(e,"body");let o=-1;return dispatch(0);function dispatch(a){if(a<=o)return Promise.reject(new c.MidwayCommonError("next() called multiple times"));o=a;let u=s[a];if(a===s.length)u=r;if(!u)return Promise.resolve();const p=`${n?`${n}.`:""}${o} ${u._name||u.name||"anonymous"}`;const g=Date.now();v(`[middleware]: in ${p} +0`);try{if(i){return Promise.resolve(u(e,dispatch.bind(null,a+1),{index:o})).then((r=>{if(r!==undefined){e["body"]=r}else if(e["body"]!==undefined){r=e["body"]}v(`[middleware]: out ${p} +${Date.now()-g} with body`);return r}))}else{return Promise.resolve(u(e,dispatch.bind(null,a+1),{index:o})).then((e=>{v(`[middleware]: out ${p} +${Date.now()-g}`);return e}))}}catch(e){v(`[middleware]: out ${p} +${Date.now()-g} with err ${e.message}`);return Promise.reject(e)}}};if(n){composeFn._name=n}return composeFn}};b=i([(0,o.Provide)(),(0,o.Scope)(a.ScopeEnum.Singleton),s("design:paramtypes",[Object])],b);r.MidwayMiddlewareService=b},67072:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};var o;Object.defineProperty(r,"__esModule",{value:true});r.MidwayMockService=void 0;const a=n(87270);const c=n(8351);const u=n(73171);let p=o=class MidwayMockService{constructor(e){this.applicationContext=e;this.mocks=new Map;this.contextMocks=new Map;this.cache=new Map;this.simulatorList=[]}async init(){if(o.prepareMocks.length>0){for(const e of o.prepareMocks){this.mockProperty(e.obj,e.key,e.value,e.group)}o.prepareMocks=[]}}static mockClassProperty(e,r,n,i="default"){this.mockProperty(e.prototype,r,n,i)}static mockProperty(e,r,n,i="default"){this.prepareMocks.push({obj:e,key:r,value:n,group:i})}mockClassProperty(e,r,n,i="default"){return this.mockProperty(e.prototype,r,n,i)}mockProperty(e,r,n,i="default"){const s=e.hasOwnProperty(r);const o={obj:e,key:r,descriptor:Object.getOwnPropertyDescriptor(e,r),hasOwnProperty:s};if(!this.mocks.has(i)){this.mocks.set(i,[])}this.mocks.get(i).push(o);if(s){delete e[r]}let a=this.cache.get(i);if(!a){a=new Map;this.cache.set(i,a)}let c=a.get(e);if(!c){c=new Set;a.set(e,c)}c.add(r);const u=this.overridePropertyDescriptor(n);Object.defineProperty(e,r,u)}mockContext(e,r,n,i="default"){if(!this.contextMocks.has(i)){this.contextMocks.set(i,[])}this.contextMocks.get(i).push({app:e,key:r,value:n})}restore(e="default"){this.restoreGroup(e)}restoreAll(){const e=new Set([...this.mocks.keys(),...this.contextMocks.keys(),...this.cache.keys()]);for(const r of e){this.restoreGroup(r)}this.simulatorList=[]}restoreGroup(e){const r=this.mocks.get(e)||[];for(let e=r.length-1;e>=0;e--){const n=r[e];if(!n.hasOwnProperty){delete n.obj[n.key]}else{Object.defineProperty(n.obj,n.key,n.descriptor)}}this.mocks.delete(e);this.contextMocks.delete(e);this.cache.delete(e);this.simulatorList=this.simulatorList.filter((r=>r["group"]!==e))}isMocked(e,r,n="default"){if((0,u.isClass)(e)){e=e.prototype}const i=this.cache.get(n);const s=i?i.get(e):undefined;return s?s.has(r):false}applyContextMocks(e,r){for(const[,n]of this.contextMocks){for(const i of n){if(i.app===e){const e=this.overridePropertyDescriptor(i.value);if(typeof i.key==="string"){Object.defineProperty(r,i.key,e)}else{i.key(r)}}}}}getContextMocksSize(){return Array.from(this.contextMocks.values()).reduce(((e,r)=>e+r.length),0)}overridePropertyDescriptor(e){const r={configurable:true,enumerable:true};if(e&&(e.get||e.set)){r.get=e.get;r.set=e.set}else{r.value=e;r.writable=true}return r}async initSimulation(e="default"){const r=(0,c.listModule)(c.MOCK_KEY);for(const n of r){const r=await this.applicationContext.getAsync(n);if(await r.enableCondition()){r["group"]=e;this.simulatorList.push(r)}}}async runSimulatorSetup(){var e;for(const r of this.simulatorList){await((e=r.setup)===null||e===void 0?void 0:e.call(r))}}async runSimulatorTearDown(){var e;for(let r=this.simulatorList.length-1;r>=0;r--){const n=this.simulatorList[r];await((e=n.tearDown)===null||e===void 0?void 0:e.call(n))}}async runSimulatorAppSetup(e){var r;for(const n of this.simulatorList){await((r=n.appSetup)===null||r===void 0?void 0:r.call(n,e))}}async runSimulatorAppTearDown(e){var r;for(let n=this.simulatorList.length-1;n>=0;n--){const i=this.simulatorList[n];await((r=i.appTearDown)===null||r===void 0?void 0:r.call(i,e))}}async runSimulatorContextSetup(e,r){var n;for(const i of this.simulatorList){await((n=i.contextSetup)===null||n===void 0?void 0:n.call(i,e,r))}}async runSimulatorContextTearDown(e,r){var n;for(let i=this.simulatorList.length-1;i>=0;i--){const s=this.simulatorList[i];await((n=s===null||s===void 0?void 0:s.contextTearDown)===null||n===void 0?void 0:n.call(s,e,r))}}};p.prepareMocks=[];i([(0,c.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],p.prototype,"init",null);i([(0,c.Destroy)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],p.prototype,"restoreAll",null);p=o=i([(0,c.Provide)(),(0,c.Scope)(a.ScopeEnum.Singleton),s("design:paramtypes",[Object])],p);r.MidwayMockService=p},720:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayPipelineService=r.PipelineContext=void 0;const i=n(8351);class PipelineContext{constructor(e){this.info={current:null,currentName:null};this.data=new Map;this.args=e}get(e){return this.data.get(e)}set(e,r){this.data.set(e,r)}keys(){const e=[];const r=this.data.keys();for(const n of r){e.push(n)}return e}}r.PipelineContext=PipelineContext;class MidwayPipelineService{constructor(e,r){this.applicationContext=e;this.valves=r}async parallel(e){const r=this.prepareParallelValves(e);const n=await Promise.all(r);return this.packResult(n,false)}async concat(e){const r=this.prepareParallelValves(e);const n=await Promise.all(r);return this.packResult(n,true)}async series(e){const r=this.mergeValves(e.valves);const n=new PipelineContext(e.args);const i={success:true,result:null};const s={};const o={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let a=1;for(const e of r){o.prev=o.current;o.prevName=getName(o.prev);o.current=e;o.currentName=getName(o.current);if(a<r.length){o.next=r[a];o.nextName=getName(o.next)}else{o.next=undefined;o.nextName=undefined}a+=1;n.info=o;try{const r=await this.applicationContext.getAsync(e);const i=await r.invoke(n);let a=e;if(r.alias){a=r.alias}s[a]=i;o.prevValue=i}catch(r){i.success=false;i.error={valveName:typeof e==="string"?e:e.name,message:r.message,error:r};return i}}i.result=s;return i}async concatSeries(e){const r=this.mergeValves(e.valves);const n=new PipelineContext(e.args);const i={success:true,result:null};const s=[];const o={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let a=1;for(const e of r){o.prev=o.current;o.prevName=getName(o.prev);o.current=e;o.currentName=getName(o.current);if(a<r.length){o.next=r[a];o.nextName=getName(o.next)}else{o.next=undefined;o.nextName=undefined}a+=1;n.info=o;try{const r=await this.applicationContext.getAsync(e);const i=await r.invoke(n);s.push(i);o.prevValue=i}catch(r){i.success=false;i.error={valveName:typeof e==="string"?e:e.name,message:r.message,error:r};return i}}i.result=s;return i}async waterfall(e){const r=await this.concatSeries(e);if(r.success){const e=r.result;r.result=e[e.length-1]}return r}mergeValves(e){let r=[];if(this.valves&&this.valves.length>0){r=this.valves}let n=[];if(e){for(const i of e){if(r.includes(i)){n.push(i)}}}else{n=r}return n}prepareParallelValves(e){const r=this.mergeValves(e.valves);const n=new PipelineContext(e.args);return r.map((async e=>{const r={valveName:e,dataKey:e,data:null};try{const i=await this.applicationContext.getAsync(e);if(i.alias){r.dataKey=i.alias}r.data=await i.invoke(n)}catch(e){r.error=e}return r}))}packResult(e,r=false){const n={success:true,result:null};let i;if(r){i=[]}else{i={}}for(const s of e){if(s.error){n.success=false;n.error={valveName:typeof s.valveName==="string"?s.valveName:s.valveName.name,message:s.error.message,error:s.error};return n}else{if(r){i.push(s.data)}else{i[s.dataKey]=s.data}}}n.result=i;return n}}r.MidwayPipelineService=MidwayPipelineService;function getName(e){if(e){if(typeof e==="string"){return e}else{return(0,i.getProviderName)(e)}}return null}},42986:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.WebRouterCollector=r.MidwayServerlessFunctionService=void 0;const o=n(8351);const a=n(64259);const c=n(12922);const u=n(11207);const p=n(7269);const g=n(87270);let v=class MidwayServerlessFunctionService extends a.MidwayWebRouterService{constructor(e={}){super(Object.assign({},e,{includeFunctionRouter:true}));this.options=e}async analyze(){this.analyzeController();this.analyzeFunction();this.sortPrefixAndRouter();for(const e of this.routes.values()){for(const r of e){if(r.requestMethod==="all"){r.functionTriggerMetadata=r.functionTriggerMetadata||{};r.functionTriggerMetadata.method=["get","post","put","delete","head","patch","options"]}}}}analyzeFunction(){const e=(0,o.listModule)(o.FUNC_KEY);for(const r of e){this.collectFunctionRoute(r)}}collectFunctionRoute(e){var r,n,i,s,a,c,u,p,g,v,b,_,E,x,T,w,C;const A=(0,o.getClassMetadata)(o.FUNC_KEY,e);const k=(0,o.getProviderName)(e);const P=(0,o.getProviderUUId)(e);const I="/";if(!this.routes.has(I)){this.routes.set(I,[]);this.routesPriority.push({prefix:I,priority:-999,middleware:[],routerOptions:{},controllerId:k,routerModule:e})}for(const R of A){if((r=R["metadata"])===null||r===void 0?void 0:r["path"]){const r=(0,o.getPropertyDataFromClass)(o.WEB_ROUTER_PARAM_KEY,e,R["methodName"])||[];const b=(0,o.getPropertyMetadata)(o.WEB_RESPONSE_KEY,e,R["methodName"])||[];const _={id:P,prefix:I,routerName:"",url:R["metadata"]["path"],requestMethod:(i=(n=R["metadata"])===null||n===void 0?void 0:n["method"])!==null&&i!==void 0?i:"get",method:R["methodName"],description:"",summary:"",handlerName:`${k}.${R["methodName"]}`,funcHandlerName:`${k}.${R["methodName"]}`,controllerId:k,middleware:((s=R["metadata"])===null||s===void 0?void 0:s["middleware"])||[],controllerMiddleware:[],requestMetadata:r,responseMetadata:b};const E=(0,o.getPropertyMetadata)(o.SERVERLESS_FUNC_KEY,e,R["methodName"])||{};const x=(u=(a=E["functionName"])!==null&&a!==void 0?a:(c=R===null||R===void 0?void 0:R["metadata"])===null||c===void 0?void 0:c["functionName"])!==null&&u!==void 0?u:createFunctionName(e,R["methodName"]);const T=(v=(p=E["handlerName"])!==null&&p!==void 0?p:(g=R===null||R===void 0?void 0:R["metadata"])===null||g===void 0?void 0:g["handlerName"])!==null&&v!==void 0?v:_.funcHandlerName;_.functionName=x;_.funcHandlerName=T;_.functionTriggerName=R["type"];_.functionTriggerMetadata=R["metadata"];_.functionMetadata={functionName:x,...E};this.checkDuplicateAndPush(I,_)}else{const r=(0,o.getPropertyMetadata)(o.SERVERLESS_FUNC_KEY,e,R["methodName"])||{};const n=(E=(b=r["functionName"])!==null&&b!==void 0?b:(_=R===null||R===void 0?void 0:R["metadata"])===null||_===void 0?void 0:_["functionName"])!==null&&E!==void 0?E:createFunctionName(e,R["methodName"]);const i=(w=(x=r["handlerName"])!==null&&x!==void 0?x:(T=R===null||R===void 0?void 0:R["metadata"])===null||T===void 0?void 0:T["handlerName"])!==null&&w!==void 0?w:`${k}.${R["methodName"]}`;this.checkDuplicateAndPush(I,{id:P,prefix:I,routerName:"",url:"",requestMethod:"",method:R["methodName"],description:"",summary:"",handlerName:`${k}.${R["methodName"]}`,funcHandlerName:i,controllerId:k,middleware:((C=R["metadata"])===null||C===void 0?void 0:C["middleware"])||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:n,functionTriggerName:R["type"],functionTriggerMetadata:R["metadata"],functionMetadata:{functionName:n,...r}})}}}async getFunctionList(){return this.getFlattenRouterTable({compileUrlPattern:true})}addServerlessFunction(e,r,n={}){var i,s;const o="";if(!this.routes.has(o)){this.routes.set(o,[]);this.routesPriority.push({prefix:o,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}const a=(i=r.functionName)!==null&&i!==void 0?i:n.functionName;this.checkDuplicateAndPush(o,{id:null,method:e,url:r.metadata["path"]||"",requestMethod:r.metadata["method"]||"",description:"",summary:"",handlerName:"",funcHandlerName:r.handlerName||n.handlerName,controllerId:"",middleware:((s=r.metadata)===null||s===void 0?void 0:s.middleware)||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:a,functionTriggerName:r.metadata.name,functionTriggerMetadata:r.metadata,functionMetadata:{functionName:a,...n}})}};v=i([(0,o.Provide)(),(0,o.Scope)(g.ScopeEnum.Singleton),s("design:paramtypes",[Object])],v);r.MidwayServerlessFunctionService=v;function createFunctionName(e,r){return(0,o.getProviderName)(e).replace(/[:#]/g,"-")+"-"+r}class WebRouterCollector{constructor(e="",r={}){this.baseDir=e;this.options=r}async init(){if(!this.proxy){if(this.baseDir){const e=new c.MidwayContainer;(0,o.bindContainer)(e);e.setFileDetector(new u.CommonJSFileDetector({loadDir:this.baseDir}));await e.ready()}if(this.options.includeFunctionRouter){if((0,p.getCurrentMainFramework)()){this.proxy=await(0,p.getCurrentMainFramework)().getApplicationContext().getAsync(v,[this.options])}else{this.proxy=new v(this.options)}}else{if((0,p.getCurrentMainFramework)()){this.proxy=await(0,p.getCurrentMainFramework)().getApplicationContext().getAsync(a.MidwayWebRouterService,[this.options])}else{this.proxy=new a.MidwayWebRouterService(this.options)}}}}async getRoutePriorityList(){await this.init();return this.proxy.getRoutePriorityList()}async getRouterTable(){await this.init();return this.proxy.getRouterTable()}async getFlattenRouterTable(){await this.init();return this.proxy.getFlattenRouterTable()}}r.WebRouterCollector=WebRouterCollector},64259:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayWebRouterService=void 0;const o=n(8351);const a=n(86110);const c=n(86248);const u=n(39023);const p=n(66027);const g=n(73171);const v=n(87270);const b=u.debuglog("midway:debug");let _=class MidwayWebRouterService{constructor(e={}){this.options=e;this.isReady=false;this.routes=new Map;this.routesPriority=[]}async analyze(){this.analyzeController();this.sortPrefixAndRouter()}analyzeController(){const e=(0,o.listModule)(o.CONTROLLER_KEY);for(const r of e){const e=(0,o.getClassMetadata)(o.CONTROLLER_KEY,r);this.addController(r,e,this.options.includeFunctionRouter)}}sortPrefixAndRouter(){this.routesPriority=this.routesPriority.filter((e=>{const r=this.routes.get(e.prefix);if(r.length>0){return true}else{this.routes.delete(e.prefix);return false}}));for(const e of this.routes.keys()){const r=this.routes.get(e);this.routes.set(e,this.sortRouter(r))}this.routesPriority=this.routesPriority.sort(((e,r)=>r.prefix.length-e.prefix.length))}addController(e,r,n={},i=false){var s;if(n&&typeof n==="boolean"){i=n;n=undefined}if(!n){n={}}const u=(0,o.getProviderName)(e);b(`[core]: Found Controller ${u}.`);const p=(0,o.getProviderUUId)(e);r.routerOptions=r.routerOptions||{};let g;const _=r.routerOptions.middleware;const E=!!((s=r.routerOptions)===null||s===void 0?void 0:s.ignoreGlobalPrefix);let x=(0,a.joinURLPath)(this.options.globalPrefix,r.prefix||"/");const T=r.prefix||"/";if(E){x=T}if(/\*/.test(x)){throw new c.MidwayCommonError(`Router prefix ${x} can't set string with *`)}if(!this.routes.has(x)){this.routes.set(x,[]);this.routesPriority.push({prefix:x,priority:x==="/"&&g===undefined?-999:0,middleware:_,routerOptions:r.routerOptions,controllerId:u,routerModule:e})}else{if(_&&_.length>0){const e=this.routesPriority.filter((e=>e.prefix===x))[0];throw new c.MidwayDuplicateControllerOptionsError(x,u,e.controllerId)}}if(!this.routes.has(T)){this.routes.set(T,[]);this.routesPriority.push({prefix:T,priority:T==="/"&&g===undefined?-999:0,middleware:_,routerOptions:r.routerOptions,controllerId:u,routerModule:e})}const w=(0,o.getClassMetadata)(o.WEB_ROUTER_KEY,e);if(w&&typeof w[Symbol.iterator]==="function"){for(const r of w){const s=(0,o.getPropertyDataFromClass)(o.WEB_ROUTER_PARAM_KEY,e,r.method)||[];const c=(0,o.getPropertyMetadata)(o.WEB_RESPONSE_KEY,e,r.method)||[];const g={id:p,prefix:r.ignoreGlobalPrefix?T:x,routerName:r.routerName||"",url:r.path,requestMethod:r.requestMethod,method:r.method,description:r.description||"",summary:r.summary||"",handlerName:`${u}.${r.method}`,funcHandlerName:`${u}.${r.method}`,controllerId:u,controllerClz:e,middleware:r.middleware||[],controllerMiddleware:_||[],requestMetadata:s,responseMetadata:c};if(i){g.functionName=u+"-"+r.method;g.functionTriggerName=v.ServerlessTriggerType.HTTP;g.functionTriggerMetadata={path:(0,a.joinURLPath)(x,r.path.toString()),method:r.requestMethod};g.functionMetadata={functionName:g.functionName}}if(n.resourceFilter&&!n.resourceFilter(g)){continue}this.checkDuplicateAndPush(g.prefix,g)}}}addRouter(e,r){const n=r.prefix||"";r.requestMethod=(r.requestMethod||"GET").toUpperCase();if(!this.routes.has(n)){this.routes.set(n,[]);this.routesPriority.push({prefix:n,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}this.checkDuplicateAndPush(n,Object.assign(r,{method:e}));this.sortPrefixAndRouter()}sortRouter(e){return e.map((e=>{const r=e.url.toString();const n=g.Types.isRegExp(e.url)?r.split("\\/"):r.split("/");let i=0;for(const e of n){if(e===""||e.includes(":")||e.includes("*")){i+=0}else{i+=1}}let s=2;const o=r.includes(":")?r.replace(/:.+$/,""):"";if(o){s=1}if(r.includes("*")){s=0}return{...e,_pureRouter:r.replace(/\**$/,"").replace(/:\w+/,"123"),_level:r.split("/").length-1,_paramString:o,_category:s,_weight:i}})).sort(((e,r)=>{if(e._category!==r._category){return r._category-e._category}if(e._weight!==r._weight){return r._weight-e._weight}if(e._level===r._level){if(r._pureRouter===e._pureRouter){return e.url.toString().length-r.url.toString().length}return r._pureRouter.length-e._pureRouter.length}return r._level-e._level}))}async getRoutePriorityList(){if(!this.isReady){await this.analyze();this.isReady=true}return this.routesPriority}async getRouterTable(){if(!this.isReady){await this.analyze();this.isReady=true}return this.routes}async getFlattenRouterTable(e={}){if(!this.isReady){await this.analyze();this.isReady=true}let r=[];for(const e of this.routesPriority){r=r.concat(this.routes.get(e.prefix))}if(e.compileUrlPattern){for(const e of r){if(e.fullUrlFlattenString){e.fullUrlCompiledRegexp=p.PathToRegexpUtil.toRegexp(e.fullUrlFlattenString)}}}return r}async getMatchedRouterInfo(e,r){const n=await this.getFlattenRouterTable({compileUrlPattern:true});let i;for(const s of n){if(s.fullUrlCompiledRegexp){const n=s["requestMethod"].toUpperCase();if(("ALL"===n||r.toUpperCase()===n)&&s.fullUrlCompiledRegexp.test(e)){i=s;break}}}return i}checkDuplicateAndPush(e,r){const n=this.routes.get(e);const i=n.filter((e=>r.url&&r.requestMethod&&e.url===r.url&&e.requestMethod===r.requestMethod));if(i&&i.length){throw new c.MidwayDuplicateRouteError(`${r.requestMethod} ${r.url}`,`${i[0].handlerName}`,`${r.handlerName}`)}if(!r.fullUrlFlattenString&&r.url&&typeof r.url==="string"){r.fullUrl=(0,a.joinURLPath)(e,r.url);if(/\*$/.test(r.fullUrl)){r.fullUrlFlattenString=r.fullUrl.replace("*","(.*)")}else{r.fullUrlFlattenString=r.fullUrl}}n.push(r)}};_=i([(0,o.Provide)(),(0,o.Scope)(v.ScopeEnum.Singleton),s("design:paramtypes",[Object])],_);r.MidwayWebRouterService=_},33216:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.prepareGlobalApplicationContext=r.prepareGlobalApplicationContextAsync=r.destroyGlobalApplicationContext=r.initializeGlobalApplicationContext=void 0;const i=n(45573);const s=n(49211);const o=n(8351);const a=n(39023);const c=n(42986);const u=n(16928);const p=n(34292);const g=n(4334);const v=a.debuglog("midway:debug");let b=1;function printStepDebugInfo(e){v(`\n\nStep ${b++}: ${e}\n`)}async function initializeGlobalApplicationContext(e){g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);const r=await prepareGlobalApplicationContextAsync(e);printStepDebugInfo("Init logger");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);const n=await r.getAsync(i.MidwayLoggerService,[r,e]);if(n.getLogger("appLogger")){r.registerObject("logger",n.getLogger("appLogger"))}g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);printStepDebugInfo("Init MidwayMockService");await r.getAsync(i.MidwayMockService,[r]);printStepDebugInfo("Init framework");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);await r.getAsync(i.MidwayFrameworkService,[r,e]);g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);printStepDebugInfo("Init lifecycle");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);await r.getAsync(i.MidwayLifeCycleService,[r]);g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);printStepDebugInfo("Init preload modules");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);const s=(0,o.listPreloadModule)();for(const e of s){await r.getAsync(e)}g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);printStepDebugInfo("End of initialize and start");g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);return r}r.initializeGlobalApplicationContext=initializeGlobalApplicationContext;async function destroyGlobalApplicationContext(e){const r=await e.getAsync(i.MidwayLoggerService);const n=r.getCurrentLoggerFactory();const s=await e.getAsync(i.MidwayLifeCycleService);await s.stop();await e.stop();(0,o.clearBindContainer)();n.close();g.MidwayPerformanceManager.cleanAll();global["MIDWAY_APPLICATION_CONTEXT"]=undefined;global["MIDWAY_MAIN_FRAMEWORK"]=undefined}r.destroyGlobalApplicationContext=destroyGlobalApplicationContext;async function prepareGlobalApplicationContextAsync(e){var r,n,b,_,E;printStepDebugInfo("Ready to create applicationContext");v('[core]: start "initializeGlobalApplicationContext"');v(`[core]: bootstrap options = ${a.inspect(e)}`);const x=(r=e.appDir)!==null&&r!==void 0?r:"";const T=(n=e.baseDir)!==null&&n!==void 0?n:"";g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const w=(b=e.applicationContext)!==null&&b!==void 0?b:new i.MidwayContainer;v("[core]: delegate module map from decoratorManager");(0,o.bindContainer)(w);global["MIDWAY_APPLICATION_CONTEXT"]=w;w.registerObject("baseDir",T);w.registerObject("appDir",x);g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);v("[core]: set default file detector");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Ready module detector");if(!e.moduleLoadType){e.moduleLoadType="commonjs"}if(e.moduleDetector!==false){v("[core]: set module load type = %s",e.moduleLoadType);if(!e.imports){e.imports=[await(0,i.loadModule)((0,u.join)(T,`configuration${(0,i.isTypeScriptEnvironment)()?".ts":".js"}`),{loadMode:e.moduleLoadType,safeLoad:true})]}if(e.moduleDetector===undefined){if(e.moduleLoadType==="esm"){w.setFileDetector(new i.ESModuleFileDetector({loadDir:T,ignore:(_=e.ignore)!==null&&_!==void 0?_:[]}));e.moduleLoadType="esm"}else{w.setFileDetector(new i.CommonJSFileDetector({loadDir:T,ignore:(E=e.ignore)!==null&&E!==void 0?E:[]}))}}}g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");w.bindClass(i.MidwayEnvironmentService);w.bindClass(i.MidwayInformationService);w.bindClass(i.MidwayAspectService);w.bindClass(i.MidwayDecoratorService);w.bindClass(i.MidwayConfigService);w.bindClass(i.MidwayLoggerService);w.bindClass(i.MidwayApplicationManager);w.bindClass(i.MidwayFrameworkService);w.bindClass(i.MidwayMiddlewareService);w.bindClass(i.MidwayLifeCycleService);w.bindClass(i.MidwayMockService);w.bindClass(i.MidwayWebRouterService);w.bindClass(c.MidwayServerlessFunctionService);w.bindClass(p.MidwayHealthService);w.bindClass(i.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(e.preloadModules&&e.preloadModules.length){for(const r of e.preloadModules){w.bindClass(r)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const C=w.get(i.MidwayEnvironmentService);C.setModuleLoadType(e.moduleLoadType);const A=w.get(i.MidwayConfigService);A.add([{default:s.default}]);w.get(i.MidwayAspectService,[w]);w.get(i.MidwayDecoratorService,[w]);printStepDebugInfo("Load imports(component) and user code configuration module");w.load([].concat(e.imports).concat(e.configurationModule));printStepDebugInfo("Run applicationContext ready method");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);await w.ready();g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(e.globalConfig){if(Array.isArray(e.globalConfig)){A.add(e.globalConfig)}else{A.addObject(e.globalConfig)}}printStepDebugInfo("Load config file");A.load();v("[core]: Current config = %j",A.getConfiguration());g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);w.get(i.MidwayMiddlewareService,[w]);return w}r.prepareGlobalApplicationContextAsync=prepareGlobalApplicationContextAsync;function prepareGlobalApplicationContext(e){var r,n,b,_;printStepDebugInfo("Ready to create applicationContext");v('[core]: start "initializeGlobalApplicationContext"');v(`[core]: bootstrap options = ${a.inspect(e)}`);const E=(r=e.appDir)!==null&&r!==void 0?r:"";const x=(n=e.baseDir)!==null&&n!==void 0?n:"";g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const T=(b=e.applicationContext)!==null&&b!==void 0?b:new i.MidwayContainer;v("[core]: delegate module map from decoratorManager");(0,o.bindContainer)(T);global["MIDWAY_APPLICATION_CONTEXT"]=T;T.registerObject("baseDir",x);T.registerObject("appDir",E);g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);printStepDebugInfo("Ready module detector");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);if(!e.moduleLoadType){e.moduleLoadType="commonjs"}if(e.moduleDetector!==false){if(e.moduleDetector===undefined){T.setFileDetector(new i.CommonJSFileDetector({ignore:(_=e.ignore)!==null&&_!==void 0?_:[]}))}else if(e.moduleDetector){T.setFileDetector(e.moduleDetector)}}g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");T.bindClass(i.MidwayEnvironmentService);T.bindClass(i.MidwayInformationService);T.bindClass(i.MidwayAspectService);T.bindClass(i.MidwayDecoratorService);T.bindClass(i.MidwayConfigService);T.bindClass(i.MidwayLoggerService);T.bindClass(i.MidwayApplicationManager);T.bindClass(i.MidwayFrameworkService);T.bindClass(i.MidwayMiddlewareService);T.bindClass(i.MidwayLifeCycleService);T.bindClass(i.MidwayMockService);T.bindClass(i.MidwayWebRouterService);T.bindClass(c.MidwayServerlessFunctionService);T.bindClass(p.MidwayHealthService);T.bindClass(i.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(e.preloadModules&&e.preloadModules.length){for(const r of e.preloadModules){T.bindClass(r)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const w=T.get(i.MidwayEnvironmentService);w.setModuleLoadType(e.moduleLoadType);const C=T.get(i.MidwayConfigService);C.add([{default:s.default}]);T.get(i.MidwayAspectService,[T]);T.get(i.MidwayDecoratorService,[T]);printStepDebugInfo("Load imports(component) and user code configuration module");if(!e.imports){e.imports=[(0,i.safeRequire)((0,u.join)(e.baseDir,"configuration"))]}T.load([].concat(e.imports).concat(e.configurationModule));printStepDebugInfo("Run applicationContext ready method");g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);T.ready();g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);g.MidwayInitializerPerformanceManager.markStart(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(e.globalConfig){if(Array.isArray(e.globalConfig)){C.add(e.globalConfig)}else{C.addObject(e.globalConfig)}}printStepDebugInfo("Load config file");C.load();v("[core]: Current config = %j",C.getConfiguration());g.MidwayInitializerPerformanceManager.markEnd(g.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);T.get(i.MidwayMiddlewareService,[T]);return T}r.prepareGlobalApplicationContext=prepareGlobalApplicationContext},88504:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.pascalCase=r.camelCase=void 0;const n=/[\p{Lu}]/u;const i=/[\p{Ll}]/u;const s=/([\p{Alpha}\p{N}_]|$)/u;const o=/[_.\- ]+/;const a=new RegExp("^"+o.source);const c=new RegExp(o.source+s.source,"gu");const u=new RegExp("\\d+"+s.source,"gu");const preserveCamelCase=(e,r,s)=>{let o=false;let a=false;let c=false;for(let u=0;u<e.length;u++){const p=e[u];if(o&&n.test(p)){e=e.slice(0,u)+"-"+e.slice(u);o=false;c=a;a=true;u++}else if(a&&c&&i.test(p)){e=e.slice(0,u-1)+"-"+e.slice(u-1);c=a;a=false;o=true}else{o=r(p)===p&&s(p)!==p;c=a;a=s(p)===p&&r(p)!==p}}return e};const postProcess=(e,r)=>{c.lastIndex=0;u.lastIndex=0;return e.replace(c,((e,n)=>r(n))).replace(u,(e=>r(e)))};function camelCaseOrigin(e,r){r={pascalCase:false,...r};e=e.trim();if(e.length===0){return""}const toLowerCase=e=>e.toLowerCase();const toUpperCase=e=>e.toUpperCase();if(e.length===1){if(o.test(e)){return""}return r.pascalCase?toUpperCase(e):toLowerCase(e)}const n=e!==toLowerCase(e);if(n){e=preserveCamelCase(e,toLowerCase,toUpperCase)}e=e.replace(a,"");e=toLowerCase(e);if(r.pascalCase){e=toUpperCase(e.charAt(0))+e.slice(1)}return postProcess(e,toUpperCase)}function camelCase(e){return camelCaseOrigin(e,{pascalCase:false})}r.camelCase=camelCase;function pascalCase(e){return camelCaseOrigin(e,{pascalCase:true})}r.pascalCase=pascalCase},7269:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.getCurrentAsyncContextManager=r.getCurrentMainApp=r.getCurrentMainFramework=r.getCurrentApplicationContext=void 0;const i=n(77404);const getCurrentApplicationContext=()=>global["MIDWAY_APPLICATION_CONTEXT"];r.getCurrentApplicationContext=getCurrentApplicationContext;const getCurrentMainFramework=()=>global["MIDWAY_MAIN_FRAMEWORK"];r.getCurrentMainFramework=getCurrentMainFramework;const getCurrentMainApp=()=>{const e=(0,r.getCurrentMainFramework)();if(e){return e.getApplication()}return undefined};r.getCurrentMainApp=getCurrentMainApp;const getCurrentAsyncContextManager=()=>(0,r.getCurrentApplicationContext)().get(i.ASYNC_CONTEXT_MANAGER_KEY);r.getCurrentAsyncContextManager=getCurrentAsyncContextManager},90428:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.extend=void 0;const i=n(73171);function extend(...e){let r,n,s,o,a;let c=e[0];let u=1;const p=e.length;let g=false;if(typeof c==="boolean"){g=c;c=e[1]||{};u=2}else if(typeof c!=="object"&&typeof c!=="function"||c==null){c={}}for(;u<p;++u){r=e[u];if(r==null)continue;for(n in r){if(n==="__proto__")continue;s=c[n];o=r[n];if(c===o)continue;if(g&&o&&i.Types.isPlainObject(o)){a=s&&i.Types.isPlainObject(s)?s:{};c[n]=extend(g,a,o)}else if(typeof o!=="undefined"){c[n]=o}}}return c}r.extend=extend},21206:(e,r)=>{"use strict";
|
|
2
2
|
/*! (c) 2020 Andrea Giammarchi */Object.defineProperty(r,"__esModule",{value:true});r.safeStringify=r.safeParse=void 0;const{parse:n,stringify:i}=JSON;const{keys:s}=Object;const o=String;const a="string";const c={};const u="object";const noop=(e,r)=>r;const primitives=e=>e instanceof o?o(e):e;const Primitives=(e,r)=>typeof r===a?new o(r):r;const revive=(e,r,n,i)=>{const a=[];for(let p=s(n),{length:g}=p,v=0;v<g;v++){const s=p[v];const g=n[s];if(g instanceof o){const o=e[g];if(typeof o===u&&!r.has(o)){r.add(o);n[s]=c;a.push({k:s,a:[e,r,o,i]})}else n[s]=i.call(n,s,o)}else if(n[s]!==c)n[s]=i.call(n,s,g)}for(let{length:e}=a,r=0;r<e;r++){const{k:e,a:s}=a[r];n[e]=i.call(n,e,revive.apply(null,s))}return n};const set=(e,r,n)=>{const i=o(r.push(n)-1);e.set(n,i);return i};function safeParse(e,r){const i=n(e,Primitives).map(primitives);const s=i[0];const o=r||noop;const a=typeof s===u&&s?revive(i,new Set,s,o):s;return o.call({"":a},"",a)}r.safeParse=safeParse;function safeStringify(e,r,n){const s=r&&typeof r===u?(e,n)=>e===""||-1<r.indexOf(e)?n:void 0:r||noop;const o=new Map;const c=[];const p=[];let g=+set(o,c,s.call({"":e},"",e));let v=!g;while(g<c.length){v=true;p[g]=i(c[g++],replace,n)}return"["+p.join(",")+"]";function replace(e,r){if(v){v=!v;return r}const n=s.call(this,e,r);switch(typeof n){case u:if(n===null)return n;case a:return o.get(n)||set(o,c,n)}return n}}r.safeStringify=safeStringify},85439:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.FORMAT=void 0;const n=1e3;const i=n*60;const s=i*60;const o=s*24;const a=o*7;const c=o*365.25;const u={ONE_SECOND:n,ONE_MINUTE:i,ONE_HOUR:s,ONE_DAY:o,ONE_WEEK:a,ONE_YEAR:c};const p={EVERY_SECOND:"* * * * * *",EVERY_MINUTE:"0 * * * * *",EVERY_HOUR:"0 0 * * * *",EVERY_DAY:"0 0 0 * * *",EVERY_DAY_ZERO_FIFTEEN:"0 15 0 * * *",EVERY_DAY_ONE_FIFTEEN:"0 15 1 * * *",EVERY_PER_5_SECOND:"*/5 * * * * *",EVERY_PER_10_SECOND:"*/10 * * * * *",EVERY_PER_30_SECOND:"*/30 * * * * *",EVERY_PER_5_MINUTE:"0 */5 * * * *",EVERY_PER_10_MINUTE:"0 */10 * * * *",EVERY_PER_30_MINUTE:"0 */30 * * * *"};r.FORMAT={MS:u,CRONTAB:p}},93879:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.FileUtils=r.exists=void 0;const i=n(79896);async function exists(e){return i.promises.access(e,i.constants.F_OK).then((()=>true)).catch((()=>false))}r.exists=exists;r.FileUtils={exists:exists}},9527:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.HttpClient=r.makeHttpRequest=void 0;const i=n(58611);const s=n(65692);const o=n(87016);const a=n(39023);const c=n(86248);const u=(0,a.debuglog)("request-client");const p=o.URL;const g={text:"application/text",json:"application/json",octet:"application/octet-stream"};function isHeaderExists(e,r){return e[r]||e[r.toLowerCase()]||e[r.toUpperCase()]}async function makeHttpRequest(e,r={}){u(`request '${e}'`);const n=new p(e);const o=n.protocol==="https:"?s:i;r.method=(r.method||"GET").toUpperCase();const{contentType:a,dataType:v,method:b,timeout:_=5e3,headers:E,...x}=r;const T={Accept:g[v]||g.octet,...E};let w;if(b==="GET"&&r.data){for(const e of Object.keys(r.data)){n.searchParams.set(e,r.data[e])}T["Content-Length"]=0}else if(r.data){w=Buffer.from(JSON.stringify(r.data));if(!isHeaderExists(T,"Content-Type")){T["Content-Type"]=g[a]||g.octet}if(!isHeaderExists(T,"Content-Length")){T["Content-Length"]=w.byteLength}}return new Promise(((r,i)=>{const s=o.request(n.toString(),{method:b,headers:T,...x},(n=>{n.setTimeout(_,(()=>{n.destroy(new Error("Response Timeout"))}));n.on("error",(e=>{i(e)}));const s=[];n.on("data",(e=>{s.push(e)}));n.on("end",(()=>{let o=Buffer.concat(s);if(v==="text"||v==="json"){o=o.toString("utf8")}if(v==="json"){try{o=JSON.parse(o)}catch(e){return i(new Error("[httpclient] Unable to parse response data"))}}Object.assign(n,{status:n.statusCode,data:o});u(`request '${e}' resolved with status ${n.statusCode}`);r(n)}))}));s.setTimeout(_,(()=>{s.destroy(new c.MidwayUtilHttpClientTimeoutError("Request Timeout"))}));s.on("error",(e=>{i(e)}));if(b!=="GET"){s.end(w)}else{s.end()}}))}r.makeHttpRequest=makeHttpRequest;class HttpClient{constructor(e={}){this.defaultOptions=e}async request(e,r){return makeHttpRequest(e,Object.assign({},this.defaultOptions,r))}}r.HttpClient=HttpClient},86110:(e,r,n)=>{"use strict";e=n.nmd(e);Object.defineProperty(r,"__esModule",{value:true});r.Utils=r.createPromiseTimeoutInvokeChain=r.isTypeScriptEnvironment=r.toAsyncFunction=r.merge=r.generateRandomId=r.getParamNames=r.sleep=r.wrapAsync=r.isIncludeProperty=r.wrapMiddleware=r.pathMatching=r.toPathMatch=r.transformRequestObjectByType=r.deprecatedOutput=r.getCurrentDateString=r.delegateTargetProperties=r.delegateTargetMethod=r.delegateTargetAllPrototypeMethod=r.delegateTargetPrototypeMethod=r.joinURLPath=r.getUserHome=r.parsePrefix=r.safelyGet=r.loadModule=r.safeRequire=r.getCurrentEnvironment=r.isDevelopmentEnvironment=void 0;const i=n(16928);const s=n(79896);const o=n(39023);const a=n(40451);const c=n(66027);const u=n(86248);const p=n(88504);const g=n(49003);const v=n(21206);const b=n(76982);const _=n(73171);const E=n(87016);const x=(0,o.debuglog)("midway:debug");const isDevelopmentEnvironment=e=>["local","test","unittest"].includes(e);r.isDevelopmentEnvironment=isDevelopmentEnvironment;const getCurrentEnvironment=()=>process.env["MIDWAY_SERVER_ENV"]||process.env["NODE_ENV"]||"prod";r.getCurrentEnvironment=getCurrentEnvironment;const safeRequire=(r,n=true)=>{if(r.startsWith(`.${i.sep}`)||r.startsWith(`..${i.sep}`)){r=(0,i.resolve)((0,i.dirname)(e.parent.filename),r)}try{if(n){return require(r)}else{const e=(0,s.readFileSync)(r,{encoding:"utf-8"});return JSON.parse(e)}}catch(e){x(`[core]: SafeRequire Warning\n\n${e.message}\n`);return undefined}};r.safeRequire=safeRequire;const T={};const loadModule=async(r,o={})=>{var a,c,u;o.enableCache=(a=o.enableCache)!==null&&a!==void 0?a:true;o.safeLoad=(c=o.safeLoad)!==null&&c!==void 0?c:false;o.loadMode=(u=o.loadMode)!==null&&u!==void 0?u:"commonjs";if(r.startsWith(`.${i.sep}`)||r.startsWith(`..${i.sep}`)){r=(0,i.resolve)((0,i.dirname)(e.parent.filename),r)}x(`[core]: load module ${r}, cache: ${o.enableCache}, mode: ${o.loadMode}, safeLoad: ${o.safeLoad}`);try{if(o.enableCache){if(o.loadMode==="commonjs"){return require(r)}else{if(r.endsWith(".json")){if(!T[r]){const e=(0,s.readFileSync)(r,{encoding:"utf-8"});T[r]=JSON.parse(e)}return T[r]}else{return await n(62542)((0,E.pathToFileURL)(r).href)}}}else{const e=(0,s.readFileSync)(r,{encoding:"utf-8"});return JSON.parse(e)}}catch(e){if(!o.safeLoad){throw e}else{x(`[core]: SafeLoadModule Warning\n\n${e.message}\n`);return undefined}}};r.loadModule=loadModule;function safelyGet(e,r){if(arguments.length===1){return r=>safelyGet(e,r)}if(typeof r==="undefined"||typeof r!=="object"||r===null){return void 0}const n=typeof e==="string"?e.split("."):e;let i=r;for(const e of n){if(typeof i==="undefined"||i===null){return void 0}else if(typeof i!=="object"){return void 0}i=i[e]}return i}r.safelyGet=safelyGet;function parsePrefix(e){if(e.includes("@")){return e.slice(1)}return e}r.parsePrefix=parsePrefix;function getUserHome(){return process.env[process.platform==="win32"?"USERPROFILE":"HOME"]}r.getUserHome=getUserHome;function joinURLPath(...e){e=e.filter((e=>!!e));if(e.length===0){return""}let r=i.posix.join(...e);r=r.replace(/\/+$/,"");if(!/^\//.test(r)){r="/"+r}return r}r.joinURLPath=joinURLPath;function delegateTargetPrototypeMethod(e,r,n){r.forEach((r=>{if(r.prototype){Object.getOwnPropertyNames(r.prototype).forEach((r=>{if(r!=="constructor"&&!/^_/.test(r)&&!e.prototype[r]){e.prototype[r]=function(...e){return this.instance[r](...e)}}}))}}));if(n){delegateTargetMethod(e,n)}}r.delegateTargetPrototypeMethod=delegateTargetPrototypeMethod;function delegateTargetAllPrototypeMethod(e,r){do{delegateTargetPrototypeMethod(e,[r]);r=Object.getPrototypeOf(r)}while(r)}r.delegateTargetAllPrototypeMethod=delegateTargetAllPrototypeMethod;function delegateTargetMethod(e,r){r.forEach((r=>{e.prototype[r]=function(...e){return this.instance[r](...e)}}))}r.delegateTargetMethod=delegateTargetMethod;function delegateTargetProperties(e,r){r.forEach((r=>{Object.defineProperty(e.prototype,r,{get(){return this.instance[r]}})}))}r.delegateTargetProperties=delegateTargetProperties;const getCurrentDateString=(e=Date.now())=>{const r=new Date(e);return`${r.getFullYear()}-${(r.getMonth()+1).toString().padStart(2,"0")}-${r.getDate().toString().padStart(2,"0")}`};r.getCurrentDateString=getCurrentDateString;const deprecatedOutput=e=>{console.warn("DeprecationWarning: "+e)};r.deprecatedOutput=deprecatedOutput;const transformRequestObjectByType=(e,r)=>{if(r===undefined||r===null||r===Object||typeof e==="undefined"){return e}switch(r){case Number:return Number(e);case String:return String(e);case Boolean:if(e==="0"||e==="false"){return false}return Boolean(e);default:if(e instanceof r){return e}else{const n=a["plainToClass"]||a["plainToInstance"];return n(r,e)}}};r.transformRequestObjectByType=transformRequestObjectByType;function toPathMatch(e){if(typeof e==="boolean"){return r=>e}if(typeof e==="string"){const r=c.PathToRegexpUtil.toRegexp(e.replace("*","(.*)"));if(r.global)r.lastIndex=0;return e=>r.test(e.path)}if(e instanceof RegExp){return r=>{if(e.global)e.lastIndex=0;return e.test(r.path)}}if(typeof e==="function")return e;if(Array.isArray(e)){const r=e.map((e=>toPathMatch(e)));return e=>r.some((r=>r(e)))}throw new u.MidwayCommonError("match/ignore pattern must be RegExp, Array or String, but got "+e)}r.toPathMatch=toPathMatch;function pathMatching(e){e=e||{};if(e.match&&e.ignore)throw new u.MidwayCommonError("options.match and options.ignore can not both present");if(!e.match&&!e.ignore)return()=>true;if(e.match&&!Array.isArray(e.match)){e.match=[e.match]}if(e.ignore&&!Array.isArray(e.ignore)){e.ignore=[e.ignore]}const createMatch=r=>{const n=r.map((r=>{if(e.thisResolver){return toPathMatch(r).bind(e.thisResolver)}return toPathMatch(r)}));return e=>{for(let r=0;r<n.length;r++){const i=n[r](e);if(i){return true}}return false}};const r=e.match?createMatch(e.match):createMatch(e.ignore);return function pathMatch(n){const i=r(n);return e.match?i:!i}}r.pathMatching=pathMatching;function wrapMiddleware(e,r){if(r.enable===false)return null;if(!r.match&&!r.ignore)return e;const n=pathMatching(r);const fn=(r,i)=>{if(!n(r))return i();return e(r,i)};fn._name=e._name+"middlewareWrapper";return fn}r.wrapMiddleware=wrapMiddleware;function isOwnPropertyWritable(e,r){if(e==null)return false;const n=typeof e;if(n!=="object"&&n!=="function")return false;return!!Object.getOwnPropertyDescriptor(e,r)}function isIncludeProperty(e,r){while(e){if(isOwnPropertyWritable(e,r))return true;e=Object.getPrototypeOf(e)}return false}r.isIncludeProperty=isIncludeProperty;function wrapAsync(e){return(...r)=>{if(typeof r[r.length-1]==="function"){const n=r.pop();if(e.constructor.name!=="AsyncFunction"){const e=new TypeError("Must be an AsyncFunction");return n(e)}return e.apply(e,r).then((e=>{n(null,e)}),(e=>{n(e)}))}else{return e.apply(e,r)}}}r.wrapAsync=wrapAsync;function sleep(e=1e3){return new Promise((r=>{setTimeout((()=>{r()}),e)}))}r.sleep=sleep;const w=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function getParamNames(e){const r=e.toString().replace(w,"");let n=r.slice(r.indexOf("(")+1,r.indexOf(")")).split(",").map((e=>e.trim().replace(/\s?=.*$/,"")));if(n.length===1&&n[0]===""){n=[]}return n}r.getParamNames=getParamNames;function generateRandomId(){return b.randomBytes(16).toString("hex")}r.generateRandomId=generateRandomId;function merge(e,r){if(!e){e=r;r=null}if(!e){return null}if(Array.isArray(e)){return e.concat(r||[])}if(typeof e==="object"){return Object.assign({},e,r)}throw new Error("can not merge meta that type of "+typeof e)}r.merge=merge;function toAsyncFunction(e){if(_.Types.isAsyncFunction(e)){return e}else{return async function(...r){return Promise.resolve(e.call(this,...r))}}}r.toAsyncFunction=toAsyncFunction;function isTypeScriptEnvironment(){const e=process.env.MIDWAY_TS_MODE;if("false"===e){return false}return e==="true"||!!require.extensions[".ts"]}r.isTypeScriptEnvironment=isTypeScriptEnvironment;async function createPromiseTimeoutInvokeChain(e){var r;if(!e.onSuccess){e.onSuccess=async e=>e}e.isConcurrent=(r=e.isConcurrent)!==null&&r!==void 0?r:true;e.promiseItems=e.promiseItems.map((e=>{if(e instanceof Promise){return{item:e}}else{return e}}));e.promiseItems=e.promiseItems.filter((e=>e["item"]instanceof Promise));if(e.isConcurrent){const r=e.promiseItems.map((r=>{const n=new Promise(((n,i)=>{var s;setTimeout((()=>{var n;return i(new u.MidwayCodeInvokeTimeoutError(e.methodName,(n=r["timeout"])!==null&&n!==void 0?n:e.timeout))}),(s=r["timeout"])!==null&&s!==void 0?s:e.timeout)}));return Promise.race([r["item"],n]).then((n=>e.onSuccess(n,r["meta"]))).catch((n=>e.onFail(n,r["meta"])))}));return Promise.all(r)}else{const r=[];for(const n of e.promiseItems){const i=new Promise(((r,i)=>{var s;setTimeout((()=>{var r;return i(new u.MidwayCodeInvokeTimeoutError(e.methodName,(r=n["timeout"])!==null&&r!==void 0?r:e.timeout))}),(s=n["timeout"])!==null&&s!==void 0?s:e.timeout)}));try{const s=await Promise.race([n["item"],i]).then((r=>e.onSuccess(r,n["meta"])));r.push(s)}catch(i){r.push(e.onFail(i,n["meta"]));break}}return r}}r.createPromiseTimeoutInvokeChain=createPromiseTimeoutInvokeChain;r.Utils={sleep:sleep,getParamNames:getParamNames,camelCase:p.camelCase,pascalCase:p.pascalCase,randomUUID:g.randomUUID,generateRandomId:generateRandomId,toAsyncFunction:toAsyncFunction,safeStringify:v.safeStringify,safeParse:v.safeParse,isTypeScriptEnvironment:isTypeScriptEnvironment}},29837:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.getModuleRequirePathList=r.PathFileUtil=r.getFileContentSync=r.isPathEqual=r.isPath=void 0;const i=n(16928);const s=n(79896);function isPath(e){if(/(^[\.\/])|:|\\/.test(e)){return true}return false}r.isPath=isPath;function isPathEqual(e,r){if(!e||!r){return false}const n=(0,i.extname)(e);return e.replace(n,"")===r}r.isPathEqual=isPathEqual;function getFileContentSync(e,r){return typeof e==="string"?(0,s.readFileSync)(e,{encoding:r}):e}r.getFileContentSync=getFileContentSync;r.PathFileUtil={isPath:isPath,isPathEqual:isPathEqual,getFileContentSync:getFileContentSync};function getModuleRequirePathList(e){const r=[e,e.replace(/\//g,"_")];let n={};const i=[];Object.keys(require.cache||{}).forEach((e=>{let s=-1;for(const e of r){const r=e.indexOf(e);if(r!==-1){s=r;break}}if(s===-1){return}const o=e.slice(0,s);if(n[o]){return}n[o]=true;i.push(o)}));n=undefined;return i}r.getModuleRequirePathList=getModuleRequirePathList},66027:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.PathToRegexpUtil=void 0;function lexer(e){const r=[];let n=0;while(n<e.length){const i=e[n];if(i==="*"||i==="+"||i==="?"){r.push({type:"MODIFIER",index:n,value:e[n++]});continue}if(i==="\\"){r.push({type:"ESCAPED_CHAR",index:n++,value:e[n++]});continue}if(i==="{"){r.push({type:"OPEN",index:n,value:e[n++]});continue}if(i==="}"){r.push({type:"CLOSE",index:n,value:e[n++]});continue}if(i===":"){let i="";let s=n+1;while(s<e.length){const r=e.charCodeAt(s);if(r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r===95){i+=e[s++];continue}break}if(!i)throw new TypeError(`Missing parameter name at ${n}`);r.push({type:"NAME",index:n,value:i});n=s;continue}if(i==="("){let i=1;let s="";let o=n+1;if(e[o]==="?"){throw new TypeError(`Pattern cannot start with "?" at ${o}`)}while(o<e.length){if(e[o]==="\\"){s+=e[o++]+e[o++];continue}if(e[o]===")"){i--;if(i===0){o++;break}}else if(e[o]==="("){i++;if(e[o+1]!=="?"){throw new TypeError(`Capturing groups are not allowed at ${o}`)}}s+=e[o++]}if(i)throw new TypeError(`Unbalanced pattern at ${n}`);if(!s)throw new TypeError(`Missing pattern at ${n}`);r.push({type:"PATTERN",index:n,value:s});n=o;continue}r.push({type:"CHAR",index:n,value:e[n++]})}r.push({type:"END",index:n,value:""});return r}function parse(e,r={}){const n=lexer(e);const{prefixes:i="./"}=r;const s=`[^${escapeString(r.delimiter||"/#?")}]+?`;const o=[];let a=0;let c=0;let u="";const tryConsume=e=>{if(c<n.length&&n[c].type===e)return n[c++].value};const mustConsume=e=>{const r=tryConsume(e);if(r!==undefined)return r;const{type:i,index:s}=n[c];throw new TypeError(`Unexpected ${i} at ${s}, expected ${e}`)};const consumeText=()=>{let e="";let r;while(r=tryConsume("CHAR")||tryConsume("ESCAPED_CHAR")){e+=r}return e};while(c<n.length){const e=tryConsume("CHAR");const r=tryConsume("NAME");const n=tryConsume("PATTERN");if(r||n){let c=e||"";if(i.indexOf(c)===-1){u+=c;c=""}if(u){o.push(u);u=""}o.push({name:r||a++,prefix:c,suffix:"",pattern:n||s,modifier:tryConsume("MODIFIER")||""});continue}const c=e||tryConsume("ESCAPED_CHAR");if(c){u+=c;continue}if(u){o.push(u);u=""}const p=tryConsume("OPEN");if(p){const e=consumeText();const r=tryConsume("NAME")||"";const n=tryConsume("PATTERN")||"";const i=consumeText();mustConsume("CLOSE");o.push({name:r||(n?a++:""),pattern:r&&!n?s:n,prefix:e,suffix:i,modifier:tryConsume("MODIFIER")||""});continue}mustConsume("END")}return o}function compile(e,r){return tokensToFunction(parse(e,r),r)}function tokensToFunction(e,r={}){const n=flags(r);const{encode:i=e=>e,validate:s=true}=r;const o=e.map((e=>{if(typeof e==="object"){return new RegExp(`^(?:${e.pattern})$`,n)}}));return r=>{let n="";for(let a=0;a<e.length;a++){const c=e[a];if(typeof c==="string"){n+=c;continue}const u=r?r[c.name]:undefined;const p=c.modifier==="?"||c.modifier==="*";const g=c.modifier==="*"||c.modifier==="+";if(Array.isArray(u)){if(!g){throw new TypeError(`Expected "${c.name}" to not repeat, but got an array`)}if(u.length===0){if(p)continue;throw new TypeError(`Expected "${c.name}" to not be empty`)}for(let e=0;e<u.length;e++){const r=i(u[e],c);if(s&&!o[a].test(r)){throw new TypeError(`Expected all "${c.name}" to match "${c.pattern}", but got "${r}"`)}n+=c.prefix+r+c.suffix}continue}if(typeof u==="string"||typeof u==="number"){const e=i(String(u),c);if(s&&!o[a].test(e)){throw new TypeError(`Expected "${c.name}" to match "${c.pattern}", but got "${e}"`)}n+=c.prefix+e+c.suffix;continue}if(p)continue;const v=g?"an array":"a string";throw new TypeError(`Expected "${c.name}" to be ${v}`)}return n}}function match(e,r){const n=[];const i=toRegexp(e,n,r);return regexpToFunction(i,n,r)}function regexpToFunction(e,r,n={}){const{decode:i=e=>e}=n;return function(n){const s=e.exec(n);if(!s)return false;const{0:o,index:a}=s;const c=Object.create(null);for(let e=1;e<s.length;e++){if(s[e]===undefined)continue;const n=r[e-1];if(n.modifier==="*"||n.modifier==="+"){c[n.name]=s[e].split(n.prefix+n.suffix).map((e=>i(e,n)))}else{c[n.name]=i(s[e],n)}}return{path:o,index:a,params:c}}}function escapeString(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function flags(e){return e&&e.sensitive?"":"i"}function regexpToRegexp(e,r){if(!r)return e;const n=/\((?:\?<(.*?)>)?(?!\?)/g;let i=0;let s=n.exec(e.source);while(s){r.push({name:s[1]||i++,prefix:"",suffix:"",modifier:"",pattern:""});s=n.exec(e.source)}return e}function arrayToRegexp(e,r,n){const i=e.map((e=>toRegexp(e,r,n).source));return new RegExp(`(?:${i.join("|")})`,flags(n))}function stringToRegexp(e,r,n){return tokensToRegexp(parse(e,n),r,n)}function tokensToRegexp(e,r,n={}){const{strict:i=false,start:s=true,end:o=true,encode:a=e=>e,delimiter:c="/#?",endsWith:u=""}=n;const p=`[${escapeString(u)}]|$`;const g=`[${escapeString(c)}]`;let v=s?"^":"";for(const n of e){if(typeof n==="string"){v+=escapeString(a(n))}else{const e=escapeString(a(n.prefix));const i=escapeString(a(n.suffix));if(n.pattern){if(r)r.push(n);if(e||i){if(n.modifier==="+"||n.modifier==="*"){const r=n.modifier==="*"?"?":"";v+=`(?:${e}((?:${n.pattern})(?:${i}${e}(?:${n.pattern}))*)${i})${r}`}else{v+=`(?:${e}(${n.pattern})${i})${n.modifier}`}}else{if(n.modifier==="+"||n.modifier==="*"){v+=`((?:${n.pattern})${n.modifier})`}else{v+=`(${n.pattern})${n.modifier}`}}}else{v+=`(?:${e}${i})${n.modifier}`}}}if(o){if(!i)v+=`${g}?`;v+=!n.endsWith?"$":`(?=${p})`}else{const r=e[e.length-1];const n=typeof r==="string"?g.indexOf(r[r.length-1])>-1:r===undefined;if(!i){v+=`(?:${g}(?=${p}))?`}if(!n){v+=`(?=${g}|${p})`}}return new RegExp(v,flags(n))}function toRegexp(e,r,n){if(e instanceof RegExp)return regexpToRegexp(e,r);if(Array.isArray(e))return arrayToRegexp(e,r,n);return stringToRegexp(e,r,n)}r.PathToRegexpUtil={toRegexp:toRegexp,compile:compile,parse:parse,match:match}},73724:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.retryWith=r.retryWithAsync=void 0;const i=n(86110);const s=n(86248);function retryWithAsync(e,r=1,n={}){let o=r;let a;return async(...c)=>{do{try{return await e.bind(n.receiver||this)(...c)}catch(e){a=e}if(n.retryInterval>=0){await(0,i.sleep)(n.retryInterval)}}while(o-- >0);if(n.throwOriginError){throw a}else{throw new s.MidwayRetryExceededMaxTimesError(e.name||"anonymous",r,a)}}}r.retryWithAsync=retryWithAsync;function retryWith(e,r=1,n={}){let i=r;let o;return(...a)=>{do{try{return e.bind(n.receiver||this)(...a)}catch(e){o=e}}while(i-- >0);if(n.throwOriginError){throw o}else{throw new s.MidwayRetryExceededMaxTimesError(e.name||"anonymous",r,o)}}}r.retryWith=retryWith},73171:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Types=r.isNullOrUndefined=r.isNull=r.isUndefined=r.isRegExp=r.isSet=r.isMap=r.isProxy=r.isNumber=r.isPlainObject=r.isObject=r.isFunction=r.isPromise=r.isGeneratorFunction=r.isAsyncFunction=r.isClass=r.isString=void 0;const i=n(39023);const s=Function.prototype.toString;const o=Object.prototype.hasOwnProperty;const a=Object.prototype.toString;function isString(e){return typeof e==="string"}r.isString=isString;function isClass(e){if(typeof e!=="function"){return false}if(/^class[\s{]/.test(s.call(e))){return true}}r.isClass=isClass;function isAsyncFunction(e){return i.types.isAsyncFunction(e)}r.isAsyncFunction=isAsyncFunction;function isGeneratorFunction(e){return i.types.isGeneratorFunction(e)}r.isGeneratorFunction=isGeneratorFunction;function isPromise(e){return i.types.isPromise(e)}r.isPromise=isPromise;function isFunction(e){return typeof e==="function"}r.isFunction=isFunction;function isObject(e){return e!==null&&typeof e==="object"}r.isObject=isObject;function isPlainObject(e){if(!e||a.call(e)!=="[object Object]"){return false}const r=o.call(e,"constructor");const n=e.constructor&&e.constructor.prototype&&o.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n){return false}let i;for(i in e){}return typeof i==="undefined"||o.call(e,i)}r.isPlainObject=isPlainObject;function isNumber(e){return typeof e==="number"}r.isNumber=isNumber;function isProxy(e){return i.types.isProxy(e)}r.isProxy=isProxy;function isMap(e){return i.types.isMap(e)}r.isMap=isMap;function isSet(e){return i.types.isSet(e)}r.isSet=isSet;function isRegExp(e){return i.types.isRegExp(e)}r.isRegExp=isRegExp;function isUndefined(e){return e===undefined}r.isUndefined=isUndefined;function isNull(e){return e===null}r.isNull=isNull;function isNullOrUndefined(e){return isUndefined(e)||isNull(e)}r.isNullOrUndefined=isNullOrUndefined;r.Types={isClass:isClass,isAsyncFunction:isAsyncFunction,isGeneratorFunction:isGeneratorFunction,isString:isString,isPromise:isPromise,isFunction:isFunction,isObject:isObject,isPlainObject:isPlainObject,isNumber:isNumber,isProxy:isProxy,isMap:isMap,isSet:isSet,isRegExp:isRegExp,isUndefined:isUndefined,isNull:isNull,isNullOrUndefined:isNullOrUndefined}},49003:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.randomUUID=void 0;const i=n(76982);const s=new Uint8Array(256);let o=s.length;function rng(){if(o>s.length-16){i.randomFillSync(s);o=0}return s.slice(o,o+=16)}const a=[];for(let e=0;e<256;++e){a.push((e+256).toString(16).slice(1))}function unsafeStringify(e,r=0){return(a[e[r+0]]+a[e[r+1]]+a[e[r+2]]+a[e[r+3]]+"-"+a[e[r+4]]+a[e[r+5]]+"-"+a[e[r+6]]+a[e[r+7]]+"-"+a[e[r+8]]+a[e[r+9]]+"-"+a[e[r+10]]+a[e[r+11]]+a[e[r+12]]+a[e[r+13]]+a[e[r+14]]+a[e[r+15]]).toLowerCase()}function randomUUID(e){if(!e&&i["randomUUID"]){return i["randomUUID"]()}const r=rng();r[6]=r[6]&15|64;r[8]=r[8]&63|128;return unsafeStringify(r)}r.randomUUID=randomUUID},17816:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.extractExpressLikeValue=r.extractKoaLikeValue=void 0;const i=n(8351);const s=n(86110);const extractKoaLikeValue=(e,r,n)=>{if(i.ALL===r){r=undefined}return function(o,a){switch(e){case i.RouteParamTypes.NEXT:return a;case i.RouteParamTypes.BODY:return(0,s.transformRequestObjectByType)(r&&o.request.body?o.request.body[r]:o.request.body,n);case i.RouteParamTypes.PARAM:return(0,s.transformRequestObjectByType)(r?o.params[r]:o.params,n);case i.RouteParamTypes.QUERY:return(0,s.transformRequestObjectByType)(r?o.query[r]:o.query,n);case i.RouteParamTypes.HEADERS:return(0,s.transformRequestObjectByType)(r?o.get(r):o.headers,n);case i.RouteParamTypes.SESSION:return(0,s.transformRequestObjectByType)(r?o.session[r]:o.session,n);case i.RouteParamTypes.FILESTREAM:if(o.getFileStream){return o.getFileStream(r)}else if(o.files){if(Array.isArray(o.files)){return o.files[0]}else{return o.files}}else{return undefined}case i.RouteParamTypes.FILESSTREAM:if(o.multipart){return o.multipart(r)}else if(o.files){return o.files}else{return undefined}case i.RouteParamTypes.REQUEST_PATH:return o["path"];case i.RouteParamTypes.REQUEST_IP:return o["ip"];case i.RouteParamTypes.QUERIES:if(o.queries){return(0,s.transformRequestObjectByType)(r?o.queries[r]:o.queries,n)}else{return(0,s.transformRequestObjectByType)(r?o.query[r]:o.query,n)}case i.RouteParamTypes.FIELDS:return r?o.fields[r]:o.fields;case i.RouteParamTypes.CUSTOM:return r?r(o):undefined;default:return null}}};r.extractKoaLikeValue=extractKoaLikeValue;const extractExpressLikeValue=(e,r,n)=>{if(i.ALL===r){r=undefined}return function(o,a,c){switch(e){case i.RouteParamTypes.NEXT:return c;case i.RouteParamTypes.BODY:return(0,s.transformRequestObjectByType)(r&&o.body?o.body[r]:o.body,n);case i.RouteParamTypes.PARAM:return(0,s.transformRequestObjectByType)(r?o.params[r]:o.params,n);case i.RouteParamTypes.QUERY:return(0,s.transformRequestObjectByType)(r?o.query[r]:o.query,n);case i.RouteParamTypes.HEADERS:return(0,s.transformRequestObjectByType)(r?o.get(r):o.headers,n);case i.RouteParamTypes.SESSION:return(0,s.transformRequestObjectByType)(r?o.session[r]:o.session,n);case i.RouteParamTypes.FILESTREAM:return o.files?o.files[0]:undefined;case i.RouteParamTypes.FILESSTREAM:return o.files;case i.RouteParamTypes.REQUEST_PATH:return o["baseUrl"];case i.RouteParamTypes.REQUEST_IP:return o["ip"];case i.RouteParamTypes.QUERIES:if(o.queries){return(0,s.transformRequestObjectByType)(r?o.queries[r]:o.queries,n)}else{return(0,s.transformRequestObjectByType)(r?o.query[r]:o.query,n)}case i.RouteParamTypes.FIELDS:return r?o.fields[r]:o.fields;case i.RouteParamTypes.CUSTOM:return r?r(o,a):undefined;default:return null}}};r.extractExpressLikeValue=extractExpressLikeValue},5698:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.AbstractEventBus=r.AckResponder=r.createWaitHandler=void 0;const i=n(26452);const s=n(39023);const o=n(84557);const a="_default_";const c=null;function revertError(e){const r=new Error;r.name=e.name;r.message=e.message;r.stack=e.stack;return r}class MessageLimitSet extends Set{constructor(e){super();this.limit=e}add(e){if(this.size<this.limit){return super.add(e)}}}async function createWaitHandler(e,r={}){await new Promise(((n,i)=>{const s=setTimeout((()=>{clearInterval(a);clearTimeout(s);i(new o.EventBusTimeoutError)}),r.timeout||5e3);const a=setInterval((()=>{if(e()){clearInterval(a);clearTimeout(s);n(true)}}),r.timeoutCheckInterval||500)}))}r.createWaitHandler=createWaitHandler;class ChunkIterator{constructor(e){this.debugLogger=e;this.buffer=[]}publish(e){this.buffer.push(e);if(this.waitingPromiseDeferred){const e=this.waitingPromiseDeferred;this.waitingPromiseDeferred=null;e.resolve(this.buffer.shift())}}error(e){if(this.waitingPromiseDeferred){const r=this.waitingPromiseDeferred;this.waitingPromiseDeferred=null;r.reject(e)}else{this.errorRisen=e}this.clear()}[Symbol.asyncIterator](){return this}async tryToGetNextData(){if(this.errorRisen){throw this.errorRisen}if(this.buffer.length>0){return this.buffer.shift()}else{const e={};e.promise=new Promise(((r,n)=>{e.resolve=r;e.reject=n}));this.waitingPromiseDeferred=e;return e.promise}}async next(){this.debugLogger("1 ChunkIterator run next and wait data");const{data:e,isEnd:r}=await this.tryToGetNextData();this.debugLogger("2 ChunkIterator get data",e,r);if(r){this.clear();return{value:undefined,done:true}}else{return{value:e,done:false}}}clear(){this.buffer.length=0}}class AckResponder{constructor(){this.isEndFlag=false}onData(e){this.dataHandler=e}onError(e){this.errorHandler=e}end(e){if(!this.isEndFlag){this.isEndFlag=true;if(e){this.sendData(e)}this.sendData(c)}}sendData(e){if(this.dataHandler){this.dataHandler(e)}}send(e){if(!this.isEndFlag){this.sendData(e)}}error(e){if(!this.isEndFlag){if(this.errorHandler){this.errorHandler(e)}}}isEnd(){return this.isEndFlag}}r.AckResponder=AckResponder;class AbstractEventBus{constructor(e={}){this.options=e;this.isInited=false;this.workers=[];this.stopping=false;this.workerReady=new Map;this.topicListener=new Map;this.topicMessageCache=new Map;this.asyncMessageMap=new Map;this.eventListenerMap=new Map;this.debugLogger=this.createDebugger();this.debugLogger(`Start EventBus(${this.constructor.name}) in ${this.isWorker()?"worker":"main"}`);this.eventListenerMap.set(i.ListenerType.Error,(e=>{console.error(e)}));this.listener=(e,r)=>{var n,s;const o=this.topicListener.get(((n=e.messageOptions)===null||n===void 0?void 0:n.topic)||a);if(o){for(const n of o){if(n["_subscribeOnce"]){o.delete(n)}new Promise((async(i,s)=>{try{await i(n(e,r))}catch(e){s(e)}})).catch((e=>{if(r){r.error(e)}else{this.eventListenerMap.get(i.ListenerType.Error)(e)}}))}}else{const n=((s=e.messageOptions)===null||s===void 0?void 0:s.topic)||a;if(!this.topicMessageCache.has(n)){this.topicMessageCache.set(n,new MessageLimitSet(10))}this.topicMessageCache.get(n).add({message:e,responder:r})}};this.setupEventBind()}createDebugger(){return(0,s.debuglog)(`midway:event-bus:${this.isWorker()?"worker":"main "}`)}debugDataflow(e){if(e.messageCategory===i.MessageCategory.IN){if(this.isMain()){return`${e.message.type}|${e.messageCategory}: worker => main(△)`}else{return`${e.message.type}|${e.messageCategory}: main => worker(△)`}}else{if(this.isMain()){return`${e.message.type}|${e.messageCategory}: main(△) => worker`}else{return`${e.message.type}|${e.messageCategory}: worker(△) => main`}}}async start(e){this.isInited=true;if(this.isMain()){await createWaitHandler((()=>this.isAllWorkerReady()),{timeout:this.options.initTimeout,timeoutCheckInterval:this.options.initTimeoutCheckInterval})}else{this.workerSubscribeMessage((e=>{this.transit({messageCategory:i.MessageCategory.IN,message:e})}));this.transit({messageCategory:i.MessageCategory.OUT,message:{messageId:this.generateMessageId(),workerId:this.getWorkerId(),type:i.MessageType.Inited,body:this.isInited,error:e?{name:e.name,message:e.message,stack:e.stack}:undefined}})}}addWorker(e){this.debugLogger(`Add worker(${this.getWorkerId(e)})`);if(!this.workerReady.has(this.getWorkerId(e))){this.debugLogger(`Init worker(${this.getWorkerId(e)}) status = false`);this.workerReady.set(this.getWorkerId(e),{worker:e,ready:false})}else{this.debugLogger(`Skip init worker(${this.getWorkerId(e)}) status`)}e===null||e===void 0?void 0:e["on"]("exit",(async r=>{if(!this.stopping){this.workerReady.delete(this.getWorkerId(e));const r=this.workers.findIndex((r=>this.getWorkerId(r)===this.getWorkerId(e)));this.workers.splice(r,1)}}));this.workerListenMessage(e,(e=>{this.transit({messageCategory:i.MessageCategory.IN,message:e})}));this.workers.push(e)}isAllWorkerReady(){for(const[e,r]of this.workerReady){if(!r||!r.ready){this.debugLogger(`Worker(${e}) not ready.`);return false}}if(this.workerReady.size>0){this.debugLogger(`All worker(size=${this.workerReady.size}) is ready.`)}return true}setupEventBind(){this.messageReceiver=e=>{var r,n,s,o,a,u,p,g,v,b,_,E,x,T,w;if(!e.message||!e.message.messageId){return}this.debugLogger("EventCenter(%s) message = %j",this.debugDataflow(e),e);const C=e.message;if(e.messageCategory===i.MessageCategory.OUT){if(C.type===i.MessageType.Invoke||C.type===i.MessageType.Request||C.type===i.MessageType.Response||C.type===i.MessageType.Broadcast){this.postMessage(C);(r=this.eventListenerMap.get(i.ListenerType.Request))===null||r===void 0?void 0:r(C)}else if(C.type===i.MessageType.Inited){this.postMessage(C);(n=this.eventListenerMap.get(i.ListenerType.Inited))===null||n===void 0?void 0:n(C)}}else if(e.messageCategory===i.MessageCategory.IN){if(C.type===i.MessageType.Invoke){const e=((s=C.messageOptions)===null||s===void 0?void 0:s["isChunk"])===true;const r=new AckResponder;r.onData((n=>{var s;this.transit({messageCategory:i.MessageCategory.OUT,message:{messageId:this.generateMessageId(),workerId:this.getWorkerId(),type:i.MessageType.Response,body:n,messageOptions:{relatedMessageId:C.messageId,isChunk:e,topic:(s=C.messageOptions)===null||s===void 0?void 0:s.topic}}});if(!e){r.end()}}));r.onError((n=>{this.publish(n,{relatedMessageId:C.messageId,isChunk:e});r.end()}));(o=this.listener)===null||o===void 0?void 0:o.call(this,C,r);(a=this.eventListenerMap.get(i.ListenerType.Subscribe))===null||a===void 0?void 0:a(C)}else if(C.type===i.MessageType.Request){(u=this.listener)===null||u===void 0?void 0:u.call(this,C);(p=this.eventListenerMap.get(i.ListenerType.Subscribe))===null||p===void 0?void 0:p(C)}else if(C.type===i.MessageType.Broadcast){if(this.isMain()){if(C.messageOptions["includeMainFromWorker"]===true){(g=this.listener)===null||g===void 0?void 0:g.call(this,C);(v=this.eventListenerMap.get(i.ListenerType.Subscribe))===null||v===void 0?void 0:v(C)}this.broadcast(C.body,{...C.messageOptions,relatedMessageId:C.messageId,relatedWorkerId:C.workerId})}else{(b=this.listener)===null||b===void 0?void 0:b.call(this,C);(_=this.eventListenerMap.get(i.ListenerType.Subscribe))===null||_===void 0?void 0:_(C)}}else if(C.type===i.MessageType.Response){if((E=C.messageOptions)===null||E===void 0?void 0:E.relatedMessageId){const e=this.asyncMessageMap.get(C.messageOptions.relatedMessageId);const r=C.messageOptions["isChunk"]===true;if(e){if(!r||r&&C.body===c){this.asyncMessageMap.delete(C.messageOptions.relatedMessageId)}e(C.error?revertError(C.error):undefined,C.body,r?C.body===c:true)}else{}}else{(x=this.listener)===null||x===void 0?void 0:x.call(this,C);(T=this.eventListenerMap.get(i.ListenerType.Subscribe))===null||T===void 0?void 0:T(C)}}else if(C.type===i.MessageType.Inited){if(this.isMain()){if(C.error){this.debugLogger(`got worker ${C.workerId} ready failed`);this.eventListenerMap.get(i.ListenerType.Error)(revertError(C.error))}else{(w=this.eventListenerMap.get(i.ListenerType.Inited))===null||w===void 0?void 0:w(C);this.workerReady.get(C.workerId).ready=true;this.debugLogger(`got worker ${C.workerId} ready`)}}else{}}}}}transit(e){this.messageReceiver(e)}subscribe(e,r={}){const n=r.topic||a;if(!this.topicListener.has(n)){this.topicListener.set(n,new Set)}if(r.subscribeOnce){e["_subscribeOnce"]=true}this.topicListener.get(n).add(e);e["_abortController"]={abort:()=>{this.topicListener.get(n).delete(e)}};if(this.topicMessageCache.has(n)&&this.topicMessageCache.get(n).size>0){for(const e of this.topicMessageCache.get(n)){this.listener(e.message,e.responder);if(r.subscribeOnce){break}}this.topicMessageCache.get(n).clear()}return e["_abortController"]}subscribeOnce(e,r={}){r.subscribeOnce=true;return this.subscribe(e,r)}publish(e,r={}){if(e instanceof Error){this.transit({messageCategory:i.MessageCategory.OUT,message:{messageId:r.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:this.isMain()?i.MessageType.Request:i.MessageType.Response,body:undefined,error:{name:e.name,message:e.message,stack:e.stack},messageOptions:r}})}else{this.transit({messageCategory:i.MessageCategory.OUT,message:{messageId:r.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:this.isMain()?i.MessageType.Request:i.MessageType.Response,body:e,messageOptions:r}})}}publishAsync(e,r={}){return new Promise(((n,s)=>{const o=r.relatedMessageId||this.generateMessageId();this.useTimeout(o,r.timeout,n,s);this.transit({messageCategory:i.MessageCategory.OUT,message:{messageId:o,workerId:this.getWorkerId(),type:i.MessageType.Invoke,body:e,messageOptions:{topic:r.topic,dispatchToken:r.dispatchToken}}})}))}publishChunk(e,r={}){const n=r.relatedMessageId||this.generateMessageId();const s=new ChunkIterator(this.debugLogger);this.useTimeout(n,r.timeout,((e,r)=>{s.publish({data:e,isEnd:r})}),(e=>{s.error(e)}));this.transit({messageCategory:i.MessageCategory.OUT,message:{messageId:n,workerId:this.getWorkerId(),type:this.isMain()?i.MessageType.Invoke:i.MessageType.Response,body:e,messageOptions:{isChunk:true,topic:r.topic}}});return s}useTimeout(e,r=5e3,n,i){const s=setTimeout((()=>{clearTimeout(s);this.asyncMessageMap.delete(e);i(new o.EventBusPublishTimeoutError(e))}),r);this.asyncMessageMap.set(e,((e,r,o)=>{if(o||e){clearTimeout(s)}if(e){i(e)}else{n(r,o)}}))}broadcast(e,r={}){if(this.isWorker()){r={includeMainFromWorker:false,includeSelfFromWorker:false,...r}}this.transit({messageCategory:i.MessageCategory.OUT,message:{messageId:r.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:i.MessageType.Broadcast,body:e,messageOptions:r}})}postMessage(e){var r,n,s,a,c,u,p,g;if(this.isMain()){if(this.workers.length>0){if(e.type===i.MessageType.Broadcast){if(e.messageOptions&&e.messageOptions["relatedWorkerId"]){this.workers.forEach((r=>{if(e.messageOptions["includeSelfFromWorker"]===false&&this.getWorkerId(r)===e.messageOptions["relatedWorkerId"]){return}else{this.mainSendMessage(r,e)}}))}else{this.workers.forEach((r=>this.mainSendMessage(r,e)))}}else if((r=e.messageOptions)===null||r===void 0?void 0:r["targetWorkerId"]){const r=(s=this.workerReady.get((n=e.messageOptions)===null||n===void 0?void 0:n["targetWorkerId"]))===null||s===void 0?void 0:s.worker;if(!r){throw new o.EventBusPublishSpecifyWorkerError((a=e.messageOptions)===null||a===void 0?void 0:a["targetWorkerId"])}this.mainSendMessage(r,e)}else{if(this.options.dispatchStrategy){const r=this.options.dispatchStrategy(this.workers,(c=e.messageOptions)===null||c===void 0?void 0:c.dispatchToken);if(r){try{this.mainSendMessage(r,e)}catch(r){(u=this.eventListenerMap.get(i.ListenerType.Error))===null||u===void 0?void 0:u(new o.EventBusMainPostError(e,r))}}else{throw new o.EventBusDispatchStrategyError}}else{const[r,...n]=this.workers;try{this.mainSendMessage(r,e)}catch(r){(p=this.eventListenerMap.get(i.ListenerType.Error))===null||p===void 0?void 0:p(new o.EventBusMainPostError(e,r))}this.workers=[...n,r]}}}}else{try{this.workerSendMessage(e)}catch(r){(g=this.eventListenerMap.get(i.ListenerType.Error))===null||g===void 0?void 0:g(new o.EventBusWorkerPostError(e,r))}}}onInited(e){this.eventListenerMap.set(i.ListenerType.Inited,e)}onPublish(e){this.eventListenerMap.set(i.ListenerType.Request,e)}onSubscribe(e){this.eventListenerMap.set(i.ListenerType.Subscribe,e)}onError(e){this.eventListenerMap.set(i.ListenerType.Error,e)}async stop(){this.stopping=true;this.workerReady.clear();this.eventListenerMap.clear();this.listener=null;this.workers.length=0}generateMessageId(){return Math.random().toString(36).substring(2)}}r.AbstractEventBus=AbstractEventBus},19932:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ChildProcessEventBus=void 0;const i=n(5698);const s=n(29907);const o=n(932);class ChildProcessEventBus extends i.AbstractEventBus{workerSubscribeMessage(e){o.on("message",e)}workerListenMessage(e,r){e.on("message",r)}workerSendMessage(e){o.send(e)}mainSendMessage(e,r){e.send(r)}isMain(){return!this.isWorker()}isWorker(){var e;return(e=this.options.isWorker)!==null&&e!==void 0?e:s.isWorker}getWorkerId(e){var r;return String(e?(r=e.pid)!==null&&r!==void 0?r:e===null||e===void 0?void 0:e["process"].pid:o.pid)}}r.ChildProcessEventBus=ChildProcessEventBus},84557:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.EventBusDispatchStrategyError=r.EventBusPublishSpecifyWorkerError=r.EventBusWorkerPostError=r.EventBusMainPostError=r.EventBusTimeoutError=r.EventBusPublishTimeoutError=void 0;const i=n(39023);class EventBusPublishTimeoutError extends Error{constructor(e){super(`Message(${e}) publish timeout.`);this.name="EventBusPublishTimeoutError"}}r.EventBusPublishTimeoutError=EventBusPublishTimeoutError;class EventBusTimeoutError extends Error{constructor(){super("Waiting for ready timeout throws this error.");this.name="EventBusTimeoutError"}}r.EventBusTimeoutError=EventBusTimeoutError;class EventBusMainPostError extends Error{constructor(e,r){super((0,i.format)("Main thread post message [%j] error => %s.",e,r.stack));this.name="EventBusMainPostError"}}r.EventBusMainPostError=EventBusMainPostError;class EventBusWorkerPostError extends Error{constructor(e,r){super((0,i.format)("Worker post message [%j] error => %j.",e,r.stack));this.name="EventBusWorkerPostError"}}r.EventBusWorkerPostError=EventBusWorkerPostError;class EventBusPublishSpecifyWorkerError extends Error{constructor(e){super((0,i.format)("Worker(%s) not find in ready map, maybe it is a wrong pid.",e));this.name="EventBusPublishSpecifyWorkerError"}}r.EventBusPublishSpecifyWorkerError=EventBusPublishSpecifyWorkerError;class EventBusDispatchStrategyError extends Error{constructor(){super("Dispatch strategy not found a worker and stop post.");this.name="EventBusDispatchStrategyError"}}r.EventBusDispatchStrategyError=EventBusDispatchStrategyError},56095:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});s(n(79131),r);s(n(19932),r);s(n(70220),r);s(n(84557),r);s(n(26452),r)},26452:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MessageCategory=r.ListenerType=r.MessageType=void 0;var n;(function(e){e["Inited"]="inited";e["Request"]="request";e["Response"]="response";e["Invoke"]="invoke";e["Broadcast"]="broadcast"})(n=r.MessageType||(r.MessageType={}));var i;(function(e){e["Inited"]="inited";e["Request"]="request";e["Subscribe"]="Subscribe";e["WorkerChanged"]="worker_changed";e["Error"]="error"})(i=r.ListenerType||(r.ListenerType={}));var s;(function(e){e["IN"]="in";e["OUT"]="out"})(s=r.MessageCategory||(r.MessageCategory={}))},70220:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.LocalEventBus=void 0;const i=n(5698);class LocalDispatcher{constructor(){this.pidIdx=0;this.initMessageQueue=[]}clear(){this.mainWorker=null;this.childWorker=null;this.pidIdx=0}generatePid(){return this.pidIdx++}}const s=new LocalDispatcher;class LocalWorker{constructor(e){this.pid=e}onMessage(e){this.handler=e}on(){}getWorkerId(){return this.pid}terminate(){}}class LocalEventBus extends i.AbstractEventBus{constructor(e={}){super(e);this.worker=new LocalWorker(s.generatePid());if(this.isMain()){this.debugLogger(`Main id=${this.worker.getWorkerId()}`);s.mainWorker=this.worker}else{this.debugLogger(`Child id=${this.worker.getWorkerId()}`);s.childWorker=this.worker}}workerSubscribeMessage(e){if(this.isWorker()){s.childWorker.onMessage(e)}}workerListenMessage(e,r){if(this.isMain()){s.mainWorker.onMessage(r)}}workerSendMessage(e){if(s.mainWorker.handler){s.mainWorker.handler(e)}else{s.initMessageQueue.push({to:"main",message:e})}}mainSendMessage(e,r){if(s.childWorker.handler){s.childWorker.handler(r)}else{s.initMessageQueue.push({to:"worker",message:r})}}getWorkerId(e){return String((e||this.worker).getWorkerId())}isMain(){return!this.isWorker()}isWorker(){return this.options.isWorker}async start(e){if(this.isMain()){await(0,i.createWaitHandler)((()=>s.childWorker!=null),{timeout:this.options.waitWorkerTimeout,timeoutCheckInterval:this.options.waitWorkerCheckInterval||200});this.addWorker(s.childWorker);if(s.initMessageQueue.length){s.initMessageQueue.forEach((({to:e,message:r})=>{if(e==="worker"){this.mainSendMessage(s.childWorker,r)}else{this.workerSendMessage(r)}}));s.initMessageQueue=[]}}await super.start(e)}async stop(){s.clear();await super.stop()}}r.LocalEventBus=LocalEventBus},79131:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ThreadEventBus=void 0;const i=n(28167);const s=n(5698);class ThreadEventBus extends s.AbstractEventBus{constructor(e={}){super(e);if(!this.options.encoder){this.options.encoder=e=>e}if(!this.options.decoder){this.options.decoder=e=>e}}workerSubscribeMessage(e){i.parentPort.on("message",(r=>{e(this.options.decoder(r))}))}workerListenMessage(e,r){e.on("message",(e=>{r(this.options.decoder(e))}))}workerSendMessage(e){i.parentPort.postMessage(this.options.encoder(e))}mainSendMessage(e,r){e.postMessage(this.options.encoder(r))}isMain(){return!this.isWorker()}isWorker(){var e;return(e=this.options.isWorker)!==null&&e!==void 0?e:!i.isMainThread}getWorkerId(e){return String(e?e.threadId:i.threadId)}}r.ThreadEventBus=ThreadEventBus},30266:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.run=void 0;const i=n(79896);const s=n(16928);const o=n(14006);const a=n(39023);const c=n(70857);const u=(0,a.debuglog)("midway:glob");function formatWindowsPath(e){if(c.platform()==="win32"&&e){return e.map((e=>e.split(s.sep).join(s.posix.sep)))}return e}const run=(e,r={cwd:process.cwd(),ignore:[]})=>{u(`midway glob pattern = ${e}, options = ${JSON.stringify(r)}`);const n=Date.now();const a=r.cwd;e=formatWindowsPath(e)||[];u(`after format pattern = ${e}`);const c=o(e,{ignore:formatWindowsPath(r.ignore)||[]});const p=o("**",{ignore:formatWindowsPath(r.ignore)||[]});function globDirectory(e,r,n,o){if(!(0,i.existsSync)(e)){return[]}const c=(0,i.readdirSync)(e);const p=[];for(let g of c){const c=(0,s.resolve)(e,g);u(`resolvePath = ${c}`);const v=(0,i.statSync)(c);if(v.isDirectory()&&n(c.replace(a,""))){const e=globDirectory(c,r,n,o);p.push(...e)}else if(v.isFile()&&r(c.replace(a,""))){p.push(c)}}return p}const g=globDirectory(a,c,p,r);u(`midway glob timing ${Date.now()-n}ms`);return g};r.run=run},79105:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.httpProxy=void 0;r.httpProxy={enable:true}},30565:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.HttpProxyConfiguration=void 0;const o=n(45573);const a=n(79105);const c=n(90703);let u=class HttpProxyConfiguration{async onReady(){if(this.httpProxy.enable){this.applicationManager.getApplications(["koa","faas","express","egg"]).forEach((e=>{e.useMiddleware(c.HttpProxyMiddleware)}))}}};i([(0,o.Inject)(),s("design:type",o.MidwayApplicationManager)],u.prototype,"applicationManager",void 0);i([(0,o.Config)("httpProxy"),s("design:type",Object)],u.prototype,"httpProxy",void 0);u=i([(0,o.Configuration)({namespace:"http-proxy",importConfigs:[{default:a}]})],u);r.HttpProxyConfiguration=u},58139:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.Configuration=void 0;var o=n(30565);Object.defineProperty(r,"Configuration",{enumerable:true,get:function(){return o.HttpProxyConfiguration}});s(n(16320),r);s(n(90703),r)},16320:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},90703:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.HttpProxyMiddleware=void 0;const o=n(45573);const a=n(94671);let c=class HttpProxyMiddleware{resolve(e){if(e.getNamespace()==="express"){return async(e,r,n)=>this.execProxy(e,e,r,n,false)}else{const r=e.getNamespace()==="faas";return async(e,n)=>{var i;const s=((i=e.request)===null||i===void 0?void 0:i.req)||e.request;return this.execProxy(e,s,e,n,r)}}}async execProxy(e,r,n,i,s){var o,c,u;const p=this.getProxyList(e.url);if(!p){return i()}const{proxy:g,url:v}=p;const b={};for(const n of Object.keys(r.headers)){if(((o=g.ignoreHeaders)===null||o===void 0?void 0:o[n])||e.header[n]===undefined){continue}b[n.toLowerCase()]=e.header[n]}const _=r.headers["x-forwarded-for"];b["x-forwarded-for"]=_?`${_}, ${e.ip}`:e.ip;b["host"]=v.host;delete b["content-length"];const E=r.method.toUpperCase();const x=n.res||n;const T=!s&&x.on&&x.writable;const w={method:E,url:v.href,headers:b,responseType:T?"stream":"arrayBuffer",timeout:this.httpProxy.proxyTimeout||0};if(E==="POST"||E==="PUT"){w.data=(c=r.body)!==null&&c!==void 0?c:(u=e.request)===null||u===void 0?void 0:u.body;if(r.headers["content-type"]==="application/x-www-form-urlencoded"&&typeof w.data!=="string"){w.data=Object.keys(w.data).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(w.data[e])}`)).join("&")}}const C=await a(w).catch((e=>{if(!e||!e.response){throw e||new Error("proxy unknown error")}return e.response}));n.type=C.headers["content-type"];const A={"transfer-encoding":true};if(T){A["content-length"]=true}Object.keys(C.headers).forEach((e=>{if(A[e.toLowerCase()]){return}n.set(e,C.headers[e])}));n.status=C.status;if(T){await new Promise((e=>{x.on("finish",(()=>{if(x.end){x.end()}e(void 0)}));C.data.pipe(x)}))}else{n.body=C.data}}getProxyList(e){if(!this.httpProxy){return}this.httpProxy.default=this.httpProxy.default||{};const r=this.httpProxy.match?[this.httpProxy]:this.httpProxy.strategy?Object.values(this.httpProxy.strategy).map((e=>Object.assign({},this.httpProxy.default,e))):[];for(const n of r){if(!n.match){continue}if(!n.match.test(e)){continue}if(n.host){if(e[0]==="/"){e=n.host+e}const r=new URL(e);return{proxy:n,url:r}}else if(n.target){const r=e.replace(n.match,n.target);return{proxy:n,url:new URL(r)}}}}static getName(){return"http-proxy"}};i([(0,o.Config)("httpProxy"),s("design:type",Object)],c.prototype,"httpProxy",void 0);i([(0,o.Logger)(),s("design:type",Object)],c.prototype,"logger",void 0);c=i([(0,o.Middleware)()],c);r.HttpProxyMiddleware=c},43494:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.i18n=void 0;const i=n(45573);r.i18n={defaultLocale:"en_US",localeTable:{en_US:{}},fallbacks:{},writeCookie:true,resolver:{queryField:"locale",cookieField:{fieldName:"locale",cookieDomain:"",cookieMaxAge:i.FORMAT.MS.ONE_YEAR}},localsField:"i18n"}},82466:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.I18nConfiguration=void 0;const o=n(45573);const a=n(43494);const c=n(61990);let u=class I18nConfiguration{async onReady(){this.applicationManager.getApplications(["koa","egg","faas","express"]).forEach((e=>{e.useMiddleware(c.I18nMiddleware)}))}};i([(0,o.Inject)(),s("design:type",o.MidwayApplicationManager)],u.prototype,"applicationManager",void 0);u=i([(0,o.Configuration)({namespace:"i18n",importConfigs:[{default:a}]})],u);r.I18nConfiguration=u},95279:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayI18nService=r.MidwayI18nServiceSingleton=void 0;const o=n(45573);const a=n(5655);const c=n(14006);const u=n(56081);let p=class MidwayI18nServiceSingleton{constructor(){this.localeTextMap=new Map;this.fallbackMatch=[];this.localeMatchCache={}}async init(){this.defaultLocale=(0,u.formatLocale)(this.i18nConfig.defaultLocale);for(const e in this.i18nConfig.localeTable){this.addLocale(e,getES6Object(this.i18nConfig.localeTable[e]))}for(const e in this.i18nConfig.fallbacks){this.fallbackMatch.push({pattern:c((0,u.formatLocale)(e)),locale:(0,u.formatLocale)(this.i18nConfig.fallbacks[e])})}}addLocale(e,r){const n=getMap(this.localeTextMap,e,true);for(const e in r){if(typeof r[e]==="string"){getMap(n,"default").set(e,r[e])}else{for(const i in r[e]){getMap(n,e).set(i,r[e][i])}}}}translate(e,r={}){var n,i,s;const o=(0,u.formatLocale)((n=r.locale)!==null&&n!==void 0?n:this.defaultLocale);const a=(i=r.args)!==null&&i!==void 0?i:[];const c=(s=r.group)!==null&&s!==void 0?s:"default";let p=this.getLocaleMappingText(o,e,c,a);if(!p&&o!==this.defaultLocale){if(this.fallbackMatch.length){const r=this.fallbackMatch.find((e=>{if(e.pattern(o)){return true}}));if(r){p=this.getLocaleMappingText(r.locale,e,c,a)}}if(!p){p=this.getLocaleMappingText(this.defaultLocale,e,c,a)}}return p}getAvailableLocale(e,r="default"){e=(0,u.formatLocale)(e);if(this.localeMatchCache[e+"_"+r]){return this.localeMatchCache[e+"_"+r]}if(this.localeTextMap.has(e)&&this.localeTextMap.get(e).has(r)){this.localeMatchCache[e+"_"+r]=e;return e}if(this.fallbackMatch.length){const n=this.fallbackMatch.find((n=>{if(n.pattern(e)){if(this.localeTextMap.has(n.locale)&&this.localeTextMap.get(n.locale).has(r)){this.localeMatchCache[e+"_"+r]=n.locale;return true}}}));if(n){return n.locale}}this.localeMatchCache[e+"_"+r]=this.defaultLocale;return this.defaultLocale}hasAvailableLocale(e){e=(0,u.formatLocale)(e);if(this.localeTextMap.has(e)){return true}if(this.fallbackMatch.length){const r=this.fallbackMatch.find((r=>{if(r.pattern(e)){if(this.localeTextMap.has(r.locale)){return true}}}));if(r){return true}}return false}getLocaleMapping(e,r="default"){e=(0,u.formatLocale)(e);const n=this.localeTextMap.get(e);if(n){return n.get(r)}}getDefaultLocale(){return this.defaultLocale}getLocaleMappingText(e,r,n,i){const s=this.localeTextMap.get(e);if(s){const e=s.get(n);if(e){const n=e.get(r);if(n){return formatText(n,i)}}}}};i([(0,o.Config)("i18n"),s("design:type",Object)],p.prototype,"i18nConfig",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],p.prototype,"init",null);p=i([(0,o.Provide)(),(0,o.Scope)(o.ScopeEnum.Singleton)],p);r.MidwayI18nServiceSingleton=p;let g=class MidwayI18nService{translate(e,r={}){if(!r.locale){r.locale=this.ctx.getAttr&&this.ctx.getAttr(a.I18N_ATTR_KEY)}return this.i18nServiceSingleton.translate(e,r)}addLocale(e,r){this.i18nServiceSingleton.addLocale(e,r)}getLocaleMapping(e,r="default"){return this.i18nServiceSingleton.getLocaleMapping(e,r)}getDefaultLocale(){return this.i18nServiceSingleton.getDefaultLocale()}saveRequestLocale(e){var r,n;if(e){(r=this.ctx)===null||r===void 0?void 0:r.setAttr(a.I18N_ATTR_KEY,(0,u.formatLocale)(e))}else{(n=this.ctx)===null||n===void 0?void 0:n.setAttr(a.I18N_ATTR_KEY,(0,u.formatLocale)(this.getDefaultLocale()))}}getAvailableLocale(e,r="default"){return this.i18nServiceSingleton.getAvailableLocale(e,r)}hasAvailableLocale(e){return this.i18nServiceSingleton.hasAvailableLocale(e)}};i([(0,o.Inject)(),s("design:type",p)],g.prototype,"i18nServiceSingleton",void 0);i([(0,o.Inject)(),s("design:type",Object)],g.prototype,"ctx",void 0);g=i([(0,o.Provide)()],g);r.MidwayI18nService=g;function formatText(e,r){if(Array.isArray(r)){return(0,u.formatWithArray)(e,r)}else{return(0,u.formatWithObject)(e,r)}}function getES6Object(e){for(const r in e){if(e[r]["default"]&&Object.keys(e[r]).length===1){e[r]=e[r].default}}return e}function getMap(e,r,n=false){r=n?(0,u.formatLocale)(r):r;if(!e.has(r)){e.set(r,new Map)}return e.get(r)}},57800:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.formatLocale=r.Configuration=void 0;var o=n(82466);Object.defineProperty(r,"Configuration",{enumerable:true,get:function(){return o.I18nConfiguration}});s(n(95279),r);s(n(61990),r);s(n(5655),r);var a=n(56081);Object.defineProperty(r,"formatLocale",{enumerable:true,get:function(){return a.formatLocale}})},5655:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.I18N_ATTR_KEY=void 0;r.I18N_ATTR_KEY="i18n:locale"},61990:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.I18nMiddleware=r.I18nFilter=void 0;const o=n(45573);const a=n(5655);const c=n(95279);const u=n(56081);let p=class I18nFilter{match(e,r,n){const i=r.getAttr(a.I18N_ATTR_KEY);if(this.resolverConfig){if(this.i18nConfig.writeCookie&&i&&this.resolverConfig.cookieField){const e={httpOnly:false,maxAge:this.resolverConfig.cookieField.cookieMaxAge,signed:false,domain:this.resolverConfig.cookieField.cookieDomain};n.cookie(this.resolverConfig.cookieField.fieldName,i,e)}}return e}};i([(0,o.Config)("i18n.resolver"),s("design:type",Object)],p.prototype,"resolverConfig",void 0);i([(0,o.Config)("i18n"),s("design:type",Object)],p.prototype,"i18nConfig",void 0);p=i([(0,o.Match)()],p);r.I18nFilter=p;let g=class I18nMiddleware{resolve(e){if(e.getFrameworkType()===o.MidwayFrameworkType.WEB_EXPRESS){e.useFilter(p);return async(e,r,n)=>{const i=await e.requestContext.getAsync(c.MidwayI18nService);let s;if(this.resolverConfig){s=e.query[this.resolverConfig.queryField]||e.cookies[this.resolverConfig.cookieField.fieldName];if(!s){let r=e.acceptsLanguages();if(r){if(Array.isArray(r)){if(r[0]==="*"){r=r.slice(1)}if(r.length>0){for(let e=0;e<r.length;e++){const n=(0,u.formatLocale)(r[e]);if(i.hasAvailableLocale(n)){s=n;break}}}}else{s=r}}}}if(s){i.saveRequestLocale(s)}else{i.saveRequestLocale()}r.locals[this.i18nConfig.localsField]=(e,r)=>i.translate(e,{args:r});return n()}}else{return async(e,r)=>{if(this.resolverConfig){let r=e.query[this.resolverConfig.queryField]||e.cookies.get(this.resolverConfig.cookieField.fieldName,{signed:false});const n=await e.requestContext.getAsync(c.MidwayI18nService);if(!r){let i=e.acceptsLanguages();if(i){if(Array.isArray(i)){if(i[0]==="*"){i=i.slice(1)}if(i.length>0){for(let e=0;e<i.length;e++){const s=(0,u.formatLocale)(i[e]);if(n.hasAvailableLocale(s)){r=s;break}}}}else{r=i}}}if(r){n.saveRequestLocale(r)}else{n.saveRequestLocale()}if(e.locals){e.locals[this.i18nConfig.localsField]=(e,r)=>n.translate(e,{args:r})}}await r();const n=e.getAttr(a.I18N_ATTR_KEY);if(this.resolverConfig){if(this.i18nConfig.writeCookie&&n&&this.resolverConfig.cookieField){const r={httpOnly:false,maxAge:this.resolverConfig.cookieField.cookieMaxAge,signed:false,domain:this.resolverConfig.cookieField.cookieDomain,overwrite:true};e.cookies.set(this.resolverConfig.cookieField.fieldName,n,r)}}}}}static getName(){return"i18n"}};i([(0,o.Config)("i18n.resolver"),s("design:type",Object)],g.prototype,"resolverConfig",void 0);i([(0,o.Config)("i18n"),s("design:type",Object)],g.prototype,"i18nConfig",void 0);g=i([(0,o.Middleware)()],g);r.I18nMiddleware=g},56081:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.formatLocale=r.formatWithObject=r.formatWithArray=void 0;const n=/\{(\d+)\}/g;function formatWithArray(e,r){return e.replace(n,((e,n)=>{const i=parseInt(n);if(i<r.length){return r[i]}return e}))}r.formatWithArray=formatWithArray;const i=/\{(.+?)\}/g;function formatWithObject(e,r){return e.replace(i,((e,n)=>{const i=r[n];if(i){return i}return e}))}r.formatWithObject=formatWithObject;function formatLocale(e){return e.replace("_","-").toLowerCase()}r.formatLocale=formatLocale},15559:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.info=void 0;const i=n(35651);r.info={title:"Midway Info",infoPath:"/_info",hiddenKey:i.DefaultHiddenKey,ignoreKey:[]}},29014:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.InfoConfiguration=void 0;const o=n(45573);const a=n(72211);const c=n(15559);let u=class InfoConfiguration{async onReady(){this.applicationManager.getApplications(["koa","faas","express","egg"]).forEach((e=>{e.useMiddleware(a.InfoMiddleware)}))}};i([(0,o.Inject)(),s("design:type",o.MidwayApplicationManager)],u.prototype,"applicationManager",void 0);u=i([(0,o.Configuration)({namespace:"info",importConfigs:[{default:c}]})],u);r.InfoConfiguration=u},7252:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.Configuration=void 0;var o=n(29014);Object.defineProperty(r,"Configuration",{enumerable:true,get:function(){return o.InfoConfiguration}});s(n(22063),r);s(n(72211),r);s(n(35651),r)},22063:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.InfoService=void 0;const o=n(45573);const a=n(45573);const c=n(35651);const u=n(91837);const p=n(70857);const g=n(16928);const v=n(14006);let b=class InfoService{async init(){this.secretMatchList=Array.from(new Set(this.defaultHiddenKey)).map((e=>v(e)))}info(e){const r=[];r.push(this.projectInfo());r.push(this.systemInfo());r.push(this.resourceOccupationInfo());r.push(this.softwareInfo());r.push(this.midwayConfig());r.push(this.midwayService());r.push(this.timeInfo());r.push(this.envInfo());r.push(this.dependenciesInfo());r.push(this.networkInfo());const n=r.map((({type:e,info:r})=>{const n=Object.keys(r);const i=n.filter((e=>!this.ignoreKey.includes(e)));const s={};for(const e of i){s[e]=r[e]}return{type:e,info:s}}));if(e==="html"){return(0,u.renderToHtml)(n,this.titleConfig)}return n}projectInfo(){return{type:c.InfoType.PROJECT,info:{Project:this.midwayInformationService.getProjectName(),AppDir:this.midwayInformationService.getAppDir(),BaseDir:this.midwayInformationService.getBaseDir(),Root:this.midwayInformationService.getRoot(),Env:this.environment.getCurrentEnvironment()}}}systemInfo(){const e=process.platform;return{type:c.InfoType.SYSTEM,info:{Platform:e==="win32"?"Windows":e,Node:process.versions.node,V8:process.versions.v8,ProcessId:process.pid,Arch:process.arch,Hostname:(0,p.hostname)(),HomeDir:(0,p.homedir)(),CWD:process.cwd(),ExecCommand:[].concat(process.argv,process.execArgv).join(" ")}}}resourceOccupationInfo(){const e=process.memoryUsage();const r=(0,p.cpus)();return{type:c.InfoType.MEMORY_CPU,info:{"Memory Total Occupy":(0,u.bitToMB)(e.rss),"Heap Total Occupy":(0,u.bitToMB)(e.heapTotal),"Heap Used":(0,u.bitToMB)(e.heapUsed),"V8 C++ Object Memory":(0,u.bitToMB)(e.external),"System Total Memory":(0,u.bitToMB)((0,p.totalmem)()),CPU:`${r[0]?`${r[0].model} ${r[0].speed}MHz`:""} ${r.length} core `,"CPU Usage":r.map((e=>{const r=e.times;return((1-r.idle/(r.idle+r.user+r.nice+r.sys+r.irq))*100).toFixed(2)+"%"})).join(" / ")}}}softwareInfo(){const e=["@midwayjs/core","@midwayjs/decorator","@midwayjs/faas"];const r={};for(const n of e){const e=this.midwayInformationService.getPkg();if(e){r[n]=e.version}}return{type:c.InfoType.SOFTWARE,info:r}}envInfo(){const e={};Object.keys(process.env).forEach((r=>{e[r]=this.filterSecretContent(r,process.env[r])}));return{type:c.InfoType.ENVIRONMENT_VARIABLE,info:e}}timeInfo(){const e=(new Date).toString().split(" ");return{type:c.InfoType.TIME,info:{Current:Date.now(),Uptime:(0,p.uptime)(),Timezone:e.length>=7?e[5]:"",TimezoneName:e.length>=7?e.slice(6).join(" ").replace(/\(/g,"").replace(/\)/g,""):""}}}networkInfo(){const e=(0,p.networkInterfaces)();const r={};Object.keys(e).forEach((n=>{const i=e[n];let s=n;if(n[n.length-1]==="0"){s=n.slice(0,-1)}if(s==="lo"){return}r[s]=i.sort((e=>{if(e.family==="IPv4"){return-1}return 1})).map((e=>`${e.family} ${e.address}`)).join(" / ")}));return{type:c.InfoType.NETWORK,info:r}}dependenciesInfo(){const e=this.midwayInformationService.getPkg();const r=e.dependencies||{};const n={};Object.keys(r).forEach((e=>{const i=(0,u.safeRequire)((0,g.join)(e,"package.json"),{});n[e]=`${i.version||"Not Found"}(${r[e]})`}));return{type:c.InfoType.DEPENDENCIES,info:n}}midwayService(){var e;const r={};if((e=this.container)===null||e===void 0?void 0:e.registry){for(const e of this.container.registry){const[n,i]=e;const s=i?(i===null||i===void 0?void 0:i.name)||i:typeof i;r[n]=`${(i===null||i===void 0?void 0:i.namespace)?`${i===null||i===void 0?void 0:i.namespace}:`:""}${s}${(i===null||i===void 0?void 0:i.scope)?` [${i===null||i===void 0?void 0:i.scope}]`:""}`}}return{type:c.InfoType.MIDWAY_SERVICE,info:r}}midwayConfig(){const e={};const r=this.configService.getConfiguration()||{};Object.keys(r).forEach((n=>{e[n]=this.safeJson(this.filterSecretContent(n,r[n]))}));return{type:c.InfoType.MIDWAY_CONFIG,info:e}}filterSecretContent(e,r){if(typeof r==="string"){const n=this.secretMatchList.some((r=>r(e.toLowerCase())));if(n){return(0,u.safeContent)(r)}}else if(Array.isArray(r)){return r.map((r=>this.filterSecretContent(e,r)))}return r}safeJson(e){switch(typeof e){case"string":return`"${e}"`;case"number":return`${e}`;case"boolean":return String(e);case"object":if(!e){return"null"}if(Array.isArray(e)){return`[${e.map((e=>this.safeJson(e))).join(",")}]`}if(e instanceof RegExp){return`"${e.toString()}"`}const r=[];for(const n in e){r.push(`"${n}":${this.safeJson(this.filterSecretContent(n,e[n]))}`)}return`{${r.join(",")}}`;case"function":return`function ${e.name}(${e.length} args)`}return""}};i([(0,o.Inject)(),s("design:type",a.MidwayInformationService)],b.prototype,"midwayInformationService",void 0);i([(0,o.Inject)(),s("design:type",a.MidwayConfigService)],b.prototype,"configService",void 0);i([(0,o.Inject)(),s("design:type",a.MidwayEnvironmentService)],b.prototype,"environment",void 0);i([(0,o.Config)("info.title"),s("design:type",String)],b.prototype,"titleConfig",void 0);i([(0,o.Config)("info.hiddenKey"),s("design:type",Array)],b.prototype,"defaultHiddenKey",void 0);i([(0,o.Config)("info.ignoreKey"),s("design:type",Array)],b.prototype,"ignoreKey",void 0);i([(0,o.ApplicationContext)(),s("design:type",Object)],b.prototype,"container",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],b.prototype,"init",null);b=i([(0,o.Provide)(),(0,o.Scope)(o.ScopeEnum.Singleton)],b);r.InfoService=b},35651:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.InfoType=r.DefaultHiddenKey=void 0;r.DefaultHiddenKey=["keys","*key","*token","*secret*","pass*"];var n;(function(e){e["PROJECT"]="Project";e["SYSTEM"]="System";e["MEMORY_CPU"]="Memory & CPU";e["SOFTWARE"]="Software";e["ENVIRONMENT_VARIABLE"]="Environment Variable";e["TIME"]="Time";e["NETWORK"]="Network";e["RESOURCE"]="Resource";e["DEPENDENCIES"]="Dependencies";e["MIDWAY_SERVICE"]="Midway Service";e["MIDWAY_CONFIG"]="Midway Config"})(n=r.InfoType||(r.InfoType={}))},72211:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.InfoMiddleware=void 0;const o=n(45573);const a=n(22063);let c=class InfoMiddleware{resolve(e){if(e.getFrameworkType()===o.MidwayFrameworkType.WEB_EXPRESS){return async(e,r,n)=>{if(e.path===this.infoPath){r.type("html");r.send(this.infoService.info("html"))}else{n()}}}else{return async(e,r)=>{if(e.path===this.infoPath){return this.infoService.info("html")}return await r()}}}static getName(){return"info"}};i([(0,o.Config)("info.infoPath"),s("design:type",String)],c.prototype,"infoPath",void 0);i([(0,o.Inject)(),s("design:type",a.InfoService)],c.prototype,"infoService",void 0);c=i([(0,o.Middleware)()],c);r.InfoMiddleware=c},91837:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.safeContent=r.renderToHtml=r.bitToMB=r.safeRequire=void 0;const i=n(79896);function safeRequire(e,r){try{if(!(0,i.existsSync)(e)){return r}return JSON.parse((0,i.readFileSync)(e,"utf8"))}catch(e){return r}}r.safeRequire=safeRequire;function bitToMB(e){return Number((e||0)/1024/1024).toFixed(2)+" MB"}r.bitToMB=bitToMB;function renderToHtml(e,r){let n=`<div style="padding: 24px; font-size: 36px;background: #9999cb;font-weight: bold;">${r}</div>`;n+=e.map((e=>{const r=Object.keys(e.info||{});return`<div class="infoType">${e.type}</div>\n <table style="border-collapse: collapse;width: 100%;">${r.map((r=>`<tr style="border: 1px solid #666;"><td class="infoName">${r}</td><td class="infoValue">${e.info[r]}</td></tr>`)).join("")}</table>`})).join("");return`<style>\n .infoType {background: #8e8dc5;margin-top: 24px;padding: 12px;font-weight: bold;font-size: 16px;}\n .infoName {font-weight:bold;vertical-align: top;background:#c2c6fc;width: 200px;word-break:break-all;padding: 12px;}\n .infoValue {vertical-align: top;background:#d8d8d8;padding: 12px;word-break:break-all;}\n </style><div style="margin: 24px auto;max-width: 720px;min-width: 440px;">${n}</div>`}r.renderToHtml=renderToHtml;function safeContent(e=""){if(e.length<3){return"*".repeat(e.length)}else if(e.length<6){return e[0]+"*".repeat(e.length-1)}else if(e.length<10){return e[0]+"*".repeat(e.length-2)+e[e.length-1]}else if(e.length<15){return e.slice(0,2)+"*".repeat(e.length-4)+e.slice(-2)}else{return e.slice(0,3)+"*".repeat(e.length-6)+e.slice(-3)}}r.safeContent=safeContent},64319:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.siteFile=r.bodyParser=r.onerror=r.cookiesExtra=r.cookies=r.keys=r.koa=void 0;r.koa={contextLoggerFormat:e=>{var r,n,i;const s=e.ctx;const o=s.userId||"-";const a=(i=(r=s.traceId)!==null&&r!==void 0?r:(n=s.tracer)===null||n===void 0?void 0:n.traceId)!==null&&i!==void 0?i:"-";const c=Date.now()-s.startTime;const u=o+"/"+s.ip+"/"+a+"/"+c+"ms "+s.method+" "+s.url;return`${e.timestamp} ${e.LEVEL} ${e.pid} [${u}] ${e.message}`},serverTimeout:2*60*1e3};r.keys="";r.cookies={};r.cookiesExtra={defaultGetOptions:{}};r.onerror={};r.bodyParser={enable:true,encoding:"utf8",formLimit:"1mb",jsonLimit:"1mb",textLimit:"1mb",strict:true,queryString:{arrayLimit:100,depth:5,parameterLimit:1e3},onerror(e){e.message+=", check bodyParser config";throw e}};r.siteFile={enable:true,favicon:undefined}},41367:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.KoaConfiguration=void 0;const o=n(45573);const a=n(72026);const c=n(25945);const u=n(64319);const p=n(85365);const g=n(70165);let v=class KoaConfiguration{init(){this.decoratorService.registerParameterHandler(o.WEB_ROUTER_PARAM_KEY,(e=>(0,o.extractKoaLikeValue)(e.metadata.type,e.metadata.propertyData,e.originParamType)(e.originArgs[0],e.originArgs[1])))}async onReady(){this.koaFramework.useMiddleware([g.SiteFileMiddleware,p.BodyParserMiddleware])}};i([(0,o.Inject)(),s("design:type",o.MidwayDecoratorService)],v.prototype,"decoratorService",void 0);i([(0,o.Inject)(),s("design:type",c.MidwayKoaFramework)],v.prototype,"koaFramework",void 0);i([(0,o.Inject)(),s("design:type",o.MidwayConfigService)],v.prototype,"configService",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],v.prototype,"init",null);v=i([(0,o.Configuration)({namespace:"koa",imports:[a],importConfigs:[{default:u}]})],v);r.KoaConfiguration=v},25945:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.MidwayKoaFramework=void 0;const s=n(45573);const o=n(78439);const a=n(10126);const c=n(8107);const u=n(17088);const p=n(40240);const g=n(83480);const v=n(98860);const b=Symbol("context#cookies");class KoaControllerGenerator extends s.WebControllerGenerator{constructor(e,r){super(e,r);this.app=e;this.webRouterService=r}createRouter(e){const r=new a(e);r.prefix(e.prefix);return r}generateController(e){return this.generateKoaController(e)}}let _=class MidwayKoaFramework extends s.BaseFramework{configure(){return this.configService.getConfiguration("koa")}async applicationInitialize(e){const r=this.configService.getConfiguration("keys")||this.configurationOptions["keys"];if(!r){throw new s.MidwayConfigMissingError("config.keys")}const n=this.configService.getConfiguration("cookies");const i=this.configService.getConfiguration("cookiesExtra.defaultGetOptions");this.app=new c({keys:[].concat(r),proxy:this.configurationOptions.proxy,proxyIpHeader:this.configurationOptions.proxyIpHeader,subdomainOffset:this.configurationOptions.subdomainOffset,maxIpsCount:this.configurationOptions.maxIpsCount});Object.defineProperty(this.app.context,"cookies",{get(){if(!this[b]){this[b]=new o.Cookies(this,this.app.keys,n,i)}return this[b]},enumerable:true});Object.defineProperty(this.app.context,"locals",{get(){return this.state},set(e){this.state=e}});Object.defineProperty(this.app.context,"forward",{get(){return async function(e){const r=this.requestContext.get(s.MidwayWebRouterService);const n=await r.getMatchedRouterInfo(e,this.method);if(n){if(n.controllerClz){const e=await this.requestContext.getAsync(n.controllerClz);return e[n.method](this)}else if(typeof n.method==="function"){return n.method(this)}}else{throw new s.httpError.NotFoundError(`Forward url ${e} Not Found`)}}}});const a=this.configurationOptions.queryParseMode==="strict"?function(e){return!Array.isArray(e)?[e]:e}:this.configurationOptions.queryParseMode==="first"?function(e){return Array.isArray(e)?e[0]:e}:undefined;const v=this;Object.defineProperty(this.app.request,"query",{get(){const e=this.querystring;const r=this._querycache=this._querycache||{};if(r[e])return r[e];if(v.configurationOptions.queryParseMode){r[e]=p.parse(e,v.configurationOptions.queryParseOptions||{})}else{r[e]=g.parse(e)}if(a){for(const n in r[e]){r[e][n]=a(r[e][n])}}return r[e]},set(e){this._querycache=this._querycache||{};this._querycache[this.querystring]=e}});const _=this.configService.getConfiguration("onerror");(0,u.setupOnError)(this.app,_,this.logger);const notFound=async(e,r)=>{await r();if(!e._matchedRoute&&e.body===undefined){throw new s.httpError.NotFoundError(`${e.path} Not Found`)}};const midwayRootMiddleware=async(e,r)=>{this.app.createAnonymousContext(e);await(await this.applyMiddleware(notFound))(e,r);if(e.body===undefined&&!e.response._explicitStatus&&e._matchedRoute){e.body=undefined}};this.app.use(midwayRootMiddleware);this.webRouterService=await this.applicationContext.getAsync(s.MidwayWebRouterService,[{globalPrefix:this.configurationOptions.globalPrefix}]);this.generator=new KoaControllerGenerator(this.app,this.webRouterService);this.defineApplicationProperties();this.app.originUse=this.app.use;this.app.use=this.app.useMiddleware}async loadMidwayController(){await this.generator.loadMidwayController((e=>{var r;const n=e.middleware();n._name=`midwayController(${((r=e===null||e===void 0?void 0:e.opts)===null||r===void 0?void 0:r.prefix)||"/"})`;this.app.use(n)}))}generateController(e){return this.generator.generateKoaController(e)}async generateMiddleware(e){const r=await this.getApplicationContext().getAsync(e);return r.resolve()}async run(){var e;await this.loadMidwayController();this.app.use=this.app.originUse;const r={...this.configurationOptions,...this.configurationOptions.serverOptions};if(r.key&&r.cert){r.key=s.PathFileUtil.getFileContentSync(r.key);r.cert=s.PathFileUtil.getFileContentSync(r.cert);r.ca=s.PathFileUtil.getFileContentSync(r.ca);process.env.MIDWAY_HTTP_SSL="true";if(r.http2){this.server=n(85675).createSecureServer(r,this.app.callback())}else{this.server=n(65692).createServer(r,this.app.callback())}}else{if(r.http2){this.server=n(85675).createServer(r,this.app.callback())}else{this.server=n(58611).createServer(r,this.app.callback())}}this.applicationContext.registerObject(s.HTTP_SERVER_KEY,this.server);if(s.Types.isNumber(this.configurationOptions.serverTimeout)){this.server.setTimeout(this.configurationOptions.serverTimeout)}let i=(e=process.env.MIDWAY_HTTP_PORT)!==null&&e!==void 0?e:this.configurationOptions.port;if(i===0){i=await(0,v.getFreePort)()}if(i){new Promise((e=>{const r=[i];if(this.configurationOptions.hostname){r.push(this.configurationOptions.hostname)}r.push((()=>{e()}));this.server.listen(...r);process.env.MIDWAY_HTTP_PORT=String(i)}))}}async beforeStop(){if(this.server){new Promise((e=>{this.server.close(e)}))}}getFrameworkType(){return s.MidwayFrameworkType.WEB_KOA}getFrameworkName(){return"web:koa"}getServer(){return this.server}getPort(){return process.env.MIDWAY_HTTP_PORT}useMiddleware(e){this.middlewareManager.insertLast(e)}useFilter(e){this.filterManager.useFilter(e)}};_=i([(0,s.Framework)()],_);r.MidwayKoaFramework=_},78305:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.Configuration=r.Framework=void 0;var o=n(25945);Object.defineProperty(r,"Framework",{enumerable:true,get:function(){return o.MidwayKoaFramework}});s(n(32850),r);var a=n(41367);Object.defineProperty(r,"Configuration",{enumerable:true,get:function(){return a.KoaConfiguration}});s(n(70165),r);s(n(85365),r)},32850:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},85365:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.BodyParserMiddleware=void 0;const o=n(71047);const a=n(45573);let c=class BodyParserMiddleware{resolve(){if(this.bodyparserConfig.enable){return o(this.bodyparserConfig)}}static getName(){return"bodyParser"}};i([(0,a.Config)("bodyParser"),s("design:type",Object)],c.prototype,"bodyparserConfig",void 0);c=i([(0,a.Middleware)()],c);r.BodyParserMiddleware=c},70165:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.SiteFileMiddleware=void 0;const o=n(45573);const a=n(16928);const c="public, max-age=2592000";let u=class SiteFileMiddleware{resolve(){if(this.siteFileConfig.enable){return async(e,r)=>{if(e.method!=="HEAD"&&e.method!=="GET")return r();if(e.path[0]!=="/")return r();if(e.path!=="/favicon.ico"){return r()}let n=this.siteFileConfig["favicon"];if(n===undefined){n=Buffer.from("")}if(!n)return r();if(typeof n==="string")return e.redirect(n);if(Buffer.isBuffer(n)){e.set("cache-control",c);e.body=n;e.type=a.extname(e.path);return}return r()}}}static getName(){return"siteFile"}};i([(0,o.Config)("siteFile"),s("design:type",Object)],u.prototype,"siteFileConfig",void 0);u=i([(0,o.Middleware)()],u);r.SiteFileMiddleware=u},17088:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.setupOnError=void 0;const i=n(58611);const s=n(98860);const o=n(45573);function setupOnError(e,r,n){const a=Object.assign({accepts(){const e=r.accepts||s.accepts;return e(this)},text(r,n){n.res._headers={};n.set(r.headers);if((0,s.isProduction)(e)){n.body=i.STATUS_CODES[n.status]}else{n.body=r.message}},html(r,n){const o=(0,s.detectStatus)(r);if((0,s.isProduction)(e)){if(o>=500){n.status=500;n.body=`<h2>Internal Server Error, real status: ${o}</h2>`;return}else{n.status=o;n.body=`<h2>${o} ${i.STATUS_CODES[o]}</h2>`;return}}if(e.getEnv()==="unittest"||e.getEnv()==="test"){n.status=o;n.body=`${r.name}: ${r.message}\n${r.stack}`;return}n.body=s.tpl.replace("{{status}}",(0,s.escapeHtml)(r.status)).replace("{{errorCode}}",(0,s.escapeHtml)(r.code)).replace("{{stack}}",(0,s.escapeHtml)(r.stack));n.type="html"},json(r,n){const o=(0,s.detectStatus)(r);const a=r.code||r.type;if((0,s.isProduction)(e)){if(o>=500){n.body={code:a,message:i.STATUS_CODES[o]}}else{n.body={code:a,message:r.message}}}else{n.body={code:a,message:r.message,stack:r.stack}}}},r);e.on("error",((r,i)=>{i=i||e.createAnonymousContext();const o=(0,s.detectStatus)(r);if(o>=500){try{i.logger.error(r)}catch(e){n.error(r);n.error(e)}return}try{i.logger.warn(r)}catch(e){n.warn(r);n.error(e)}}));e.context.onerror=function(r){if(r==null)return;if(this.req)(0,s.sendToWormhole)(this.req);if(!(r instanceof Error)){let e=r;if(typeof r==="object"){try{e=o.Utils.safeStringify(r)}catch(e){}}const n=new Error("non-error thrown: "+e);if(r){if(r.name)n.name=r.name;if(r.message)n.message=r.message;if(r.stack)n.stack=r.stack;if(r.status)n["status"]=r.status;if(r.headers)n["headers"]=r.headers}r=n}const n=this.headerSent||!this.writable;if(n)r.headerSent=true;e.emit("error",r,this);if(n)return;if(r.code==="ENOENT")r.status=404;if(typeof r.status!=="number"||!i.STATUS_CODES[r.status]){r.status=500}this.status=r.status;this.set(r.headers);let c="text";if(a.accepts){c=a.accepts.call(this,"html","text","json")}else{c=this.accepts("html","text","json")}c=c||"text";if(a.all){a.all.call(this,r,this)}else{if(a.redirect&&c!=="json"){this.redirect(a.redirect)}else{a[c].call(this,r,this);this.type=c}}if(c==="json"){this.body=JSON.stringify(this.body)}this.res.end(this.body)}}r.setupOnError=setupOnError},98860:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.getFreePort=r.escapeHtml=r.tpl=r.isProduction=r.sendToWormhole=r.accepts=r.detectStatus=void 0;const i=n(69278);function detectStatus(e){let r=e.status||500;if(r<200){r=500}return r}r.detectStatus=detectStatus;function accepts(e){if(acceptJSON(e))return"json";return"html"}r.accepts=accepts;function acceptJSON(e){if(e.path.endsWith(".json"))return true;if(e.response.type&&e.response.type.indexOf("json")>=0)return true;if(e.accepts("html","text","json")==="json")return true;return false}function sendToWormhole(e){return new Promise((r=>{if(typeof e.resume!=="function"){return r()}e.unpipe&&e.unpipe();e.resume();if(e._readableState&&e._readableState.ended){return r()}if(!e.readable||e.destroyed){return r()}function cleanup(){e.removeListener("end",onEnd);e.removeListener("close",onEnd);e.removeListener("error",onError)}function onEnd(){cleanup();r()}function onError(){cleanup();r()}e.on("end",onEnd);e.on("close",onEnd);e.on("error",onError)}))}r.sendToWormhole=sendToWormhole;function isProduction(e){return e.getEnv()!=="local"&&e.getEnv()!=="unittest"}r.isProduction=isProduction;r.tpl=`\n<!DOCTYPE html>\n<html>\n <head>\n <title>Error - {{status}}</title>\n <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">\n\n <style>\n body {\n padding: 50px 80px;\n font: 14px "Helvetica Neue", Helvetica, sans-serif;\n }\n\n h1 {\n font-size: 2em;\n margin-bottom: 5px;\n }\n\n pre {\n font-size: .8em;\n }\n </style>\n </head>\n <body>\n <div id="error">\n <h1>Error</h1>\n <p>Looks like something broke!</p>\n <p><h2>Stack</h2></p>\n <pre>\n <code>\n{{stack}}\n </code>\n </pre>\n <p><h2>Error Code</h2></p>\n <pre>\n <code>\n{{errorCode}}\n </code>\n </pre>\n </div>\n </body>\n</html>`;const s=/["'&<>]/;function escapeHtml(e){const r=""+e;const n=s.exec(r);if(!n){return r}let i;let o="";let a=0;let c=0;for(a=n.index;a<r.length;a++){switch(r.charCodeAt(a)){case 34:i=""";break;case 38:i="&";break;case 39:i="'";break;case 60:i="<";break;case 62:i=">";break;default:continue}if(c!==a){o+=r.substring(c,a)}c=a+1;o+=i}return c!==a?o+r.substring(c,a):o}r.escapeHtml=escapeHtml;async function getFreePort(){return new Promise(((e,r)=>{const n=(0,i.createServer)();n.listen(0,(()=>{try{const r=n.address().port;n.close();e(r)}catch(e){r(e)}}))}))}r.getFreePort=getFreePort},66645:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.LEVEL=r.DefaultLogLevels=void 0;r.DefaultLogLevels={none:0,error:1,trace:2,warn:3,info:4,verbose:5,debug:6,silly:7,all:8};r.LEVEL={none:"NONE",error:"ERROR",trace:"TRACE",warn:"WARN",info:"INFO",verbose:"VERBOSE",debug:"DEBUG",silly:"SILLY",all:"ALL"}},67518:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.LoggerFactory=void 0;const i=n(90558);const s=n(39023);const o=n(16928);const a=n(50505);const c=s.debuglog("midway:debug");class LoggerFactory extends Map{constructor(e={}){super();this.factoryOptions=e}createLogger(e,r){if(!this.has(e)){c('[logger]: Create logger "%s" with options %j',e,r);const n=new i.MidwayLogger(Object.assign(r,this.factoryOptions));this.addLogger(e,n);return n}return this.getLogger(e)}addLogger(e,r,n=true){if(!n||!this.has(e)){if(this.get(e)!==r){if(r["onClose"]){r["onClose"]((()=>{this.delete(e)}))}if(r["on"]){r.on("close",(()=>this.delete(e)))}this.set(e,r)}}else{throw new Error(`logger id ${e} has duplicate`)}return this.get(e)}getLogger(e){return this.get(e)}removeLogger(e){const r=this.get(e);r===null||r===void 0?void 0:r["close"]();this.delete(e)}get(e){return super.get(e)}close(e){if(e){return this.removeLogger(e)}Array.from(this.keys()).forEach((e=>this.removeLogger(e)))}getDefaultMidwayLoggerConfig(e){var r;const n=(0,a.isDevelopmentEnvironment)(e.env);const i=(r=process.env["MIDWAY_LOGGER_WRITEABLE_DIR"])!==null&&r!==void 0?r:e.root;if(!i){throw new Error('Midway Logger requires a root path during initialization, but it was provided empty. Please set it manually in the "logger.default.dir" configuration.')}return{midwayLogger:{default:{fileLogName:"midway-app.log",errorLogName:"common-error.log",dir:(0,o.join)(i,"logs",e.name),auditFileDir:".audit",transports:{console:n?{autoColors:n}:false,file:{bufferWrite:!n},error:{bufferWrite:!n}}},clients:{coreLogger:{fileLogName:"midway-core.log"},appLogger:{}}}}}createContextLogger(e,r,n={}){return r.createContextLogger(e,n)}}r.LoggerFactory=LoggerFactory},84416:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.MidwayBaseLogger=r.MidwayLoggerContainer=r.createConsoleLogger=r.createFileLogger=r.createLogger=r.clearAllLoggers=r.loggers=void 0;const o=n(67518);const a=n(90558);s(n(86847),r);s(n(90558),r);s(n(61003),r);s(n(83698),r);s(n(62795),r);s(n(34665),r);s(n(67518),r);s(n(50505),r);r.loggers=new o.LoggerFactory;const clearAllLoggers=()=>{r.loggers.close()};r.clearAllLoggers=clearAllLoggers;const createLogger=(e,n={})=>r.loggers.createLogger(e,n);r.createLogger=createLogger;const createFileLogger=(e,n)=>r.loggers.createLogger(e,{transports:{file:{dir:__dirname,fileLogName:"custom-logger.log",...n}}});r.createFileLogger=createFileLogger;const createConsoleLogger=(e,n={})=>r.loggers.createLogger(e,{transports:{console:n}});r.createConsoleLogger=createConsoleLogger;r.MidwayLoggerContainer=o.LoggerFactory;r.MidwayBaseLogger=a.MidwayLogger},86847:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},90558:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayChildLogger=r.MidwayContextLogger=r.MidwayLogger=r.TransportManager=void 0;const i=n(50505);const s=n(70857);const o=n(61003);const a=n(62795);const c=n(83698);r.TransportManager=new Map;r.TransportManager.set("console",a.ConsoleTransport);r.TransportManager.set("file",c.FileTransport);r.TransportManager.set("error",c.ErrorTransport);r.TransportManager.set("json",c.JSONTransport);class MidwayLogger{constructor(e={}){this.transports=new Map;this.closeHandlers=[];e=(0,i.formatLegacyLoggerOptions)(e);this.options=e;this.options.level=this.options.level||"silly";this.options.eol=this.options.eol||s.EOL;if(this.options.transports){for(const e in this.options.transports){this.add(e,this.options.transports[e])}}}get level(){return this.options.level}set level(e){this.options.level=e}log(e,...r){this.transit(e,{},...r)}debug(...e){this.transit("debug",{},...e)}info(...e){this.transit("info",{},...e)}warn(...e){this.transit("warn",{},...e)}error(...e){this.transit("error",{},...e)}verbose(...e){this.transit("verbose",{},...e)}write(...e){this.transit(false,{},...e)}silly(...e){this.transit("silly",{},...e)}add(e,n){if(n){let i;if(!(n instanceof o.Transport)){if(!r.TransportManager.has(e)){throw new Error(`Transport ${e} is not supported`)}else{i=new(r.TransportManager.get(e))(n)}}else{i=n}i.setLoggerOptions(this.options);this.transports.set(e,i)}}get(e){return this.transports.get(e)}remove(e,r={}){if(this.transports.has(e)){if(r.close===undefined||r.close){this.transports.get(e).close()}this.transports.delete(e)}}close(){for(const e of this.transports.keys()){this.remove(e,{close:true})}for(const e of this.closeHandlers){e()}}onClose(e){this.closeHandlers.push(e)}createContextLogger(e,r={}){return new MidwayContextLogger(e,this,r)}transit(e,r={},...n){if(e!==false&&!(0,i.isEnableLevel)(e,this.level)){return}for(const i of this.transports.values()){i.log(e,r,...n)}}getChild(e={}){return new MidwayChildLogger(this,e)}}r.MidwayLogger=MidwayLogger;class MidwayContextLogger{constructor(e,r,n={}){this.ctx=e;this.parentLogger=r;this.options=n}debug(...e){this.transit("debug",...e)}info(...e){this.transit("info",...e)}warn(...e){this.transit("warn",...e)}error(...e){this.transit("error",...e)}verbose(...e){this.transit("verbose",...e)}write(...e){this.transit(false,...e)}transit(e,...r){this.parentLogger.transit(e,{ctx:this.ctx,contextFormat:this.options.contextFormat},...r)}getContext(){return this.ctx}}r.MidwayContextLogger=MidwayContextLogger;class MidwayChildLogger{constructor(e,r={}){this.parentLogger=e;this.meta=r}debug(...e){this.transit("debug",...e)}info(...e){this.transit("info",...e)}warn(...e){this.transit("warn",...e)}error(...e){this.transit("error",...e)}verbose(...e){this.transit("verbose",...e)}write(...e){this.transit(false,...e)}transit(e,...r){this.parentLogger.transit(e,this.meta,...r)}}r.MidwayChildLogger=MidwayChildLogger},62795:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ConsoleTransport=void 0;const i=n(61003);const s=n(50505);const o=n(56446);const a=o.supportsColor.stdout;class ConsoleTransport extends i.Transport{log(e,r,...n){if(!(0,s.isEnableLevel)(e,this.options.level)){return}let i=this.format(e,r,n);if(process.env.FORCE_ENABLE_COLOR||this.options.autoColors&&a){const r=this.getColor(e);i=(0,o.colorizeAll)(i,r)}i+=this.options.eol;if(e==="error"){process.stderr.write(i)}else{process.stdout.write(i)}}getColor(e){switch(e){case"debug":return o.Color.blue;case"info":return o.Color.green;case"warn":return o.Color.yellow;case"error":return o.Color.red;default:return o.Color.white}}close(){}}r.ConsoleTransport=ConsoleTransport},83698:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.JSONTransport=r.ErrorTransport=r.FileTransport=void 0;const i=n(61003);const s=n(34665);const o=n(16928);const a=n(43106);const c=n(79896);const u=n(50505);const p=n(33929);const g=n(37467);class FileTransport extends i.Transport{constructor(e={}){super(e);this.options=e;this.bufSize=0;this.buf=[];if(this.options.bufferWrite){this.options.bufferMaxLength=this.options.bufferMaxLength||1e3;this.options.bufferFlushInterval=this.options.bufferFlushInterval||1e3;this.timer=this.createInterval()}if(!(0,u.isValidFileName)(this.options.fileLogName)||!(0,u.isValidDirName)(this.options.dir)){throw new Error("Your path or filename contain an invalid character.")}const r={frequency:"custom",dateFormat:"YYYY-MM-DD",endStream:true,fileOptions:{flags:"a"},utc:false,extension:"",createSymlink:!(0,u.isWin32)(),maxFiles:"7d",zippedArchive:false};if(!this.options.auditFileDir){e.auditFileDir=this.options.dir}if(!o.isAbsolute(this.options.auditFileDir)){e.auditFileDir=o.join(this.options.dir,e.auditFileDir)}this.logStream=s.FileStreamRotatorManager.getStream({...r,filename:o.join(this.options.dir,this.options.fileLogName),size:(0,u.getMaxSize)(this.options.maxSize||"200m"),symlinkName:this.options.fileLogName,auditFile:o.join(e.auditFileDir,"."+(0,p.hash)(this.options)+"-audit.json"),...e});this.logStream.on("logRemoved",(r=>{if(e.zippedArchive){const e=r.name+".gz";if(c.existsSync(e)){try{c.unlinkSync(e)}catch(e){console.error(e)}return}}}));if(e.zippedArchive){this.logStream.on("rotate",(e=>{const r=c.existsSync(e);const n=c.existsSync(e+".gz");if(!r||n){return}const i=a.createGzip();const s=c.createReadStream(e);const o=c.createWriteStream(e+".gz");s.pipe(i).pipe(o).on("finish",(()=>{if(c.existsSync(e)){c.unlinkSync(e)}}))}))}}log(e,r,...n){if(!(0,u.isEnableLevel)(e,this.options.level)){return}let i=this.format(e,r,n);i+=this.options.eol;if(this.options.bufferWrite){this.bufSize+=i.length;this.buf.push(i);if(this.buf.length>this.options.bufferMaxLength){this.flush()}}else{this.logStream.write(i)}}close(){if(this.options.bufferWrite){if(this.buf&&this.buf.length>0){this.flush()}if(this.timer){clearInterval(this.timer);this.timer=null}}if(this.logStream){s.FileStreamRotatorManager.close(this.logStream);this.logStream=null}}flush(){if(this.buf.length>0&&this.writable){this.logStream.write(this.buf.join(""));this.buf=[];this.bufSize=0}}createInterval(){return setInterval((()=>this.flush()),this.options.bufferFlushInterval)}get writable(){return this.logStream&&this.logStream.canWrite()}}r.FileTransport=FileTransport;class ErrorTransport extends FileTransport{constructor(e){e.level="error";super(e)}}r.ErrorTransport=ErrorTransport;class JSONTransport extends FileTransport{log(e,r,...n){if(!(0,u.isEnableLevel)(e,this.options.level)){return}let i=this.format(e,r,n);if(typeof i==="string"||Buffer.isBuffer(i)){i=(0,g.stringify)({message:i.toString()})}else{i=(0,g.stringify)(i)}i+=this.options.eol;if(this.options.bufferWrite){this.bufSize+=i.length;this.buf.push(i);if(this.buf.length>this.options.bufferMaxLength){this.flush()}}else{this.logStream.write(i)}}}r.JSONTransport=JSONTransport},34665:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.FileStreamRotatorManager=r.FileStreamRotator=void 0;const i=n(79896);const s=n(16928);const o=n(76982);const a=n(24434);const c=n(39023);const u=n(3706);const p=n(85279);const g=n(42613);const v=n(50505);const b=(0,c.debuglog)("midway-logger");const _=["daily","test","s","m","h","custom"];const E="YYYYMMDDHHmm";u.extend(p);class FileStreamRotator{getFrequency(e){const r=e.toLowerCase().match(/^(\d+)([smh])$/);if(r){return(0,v.checkNumAndType)(r[2],parseInt(r[1]))}const n=(0,v.checkDailyAndTest)(e);if(n){return n}return false}parseFileSize(e){if(e&&typeof e==="string"){const r=e.toLowerCase().match(/^((?:0\.)?\d+)([kmg])$/);if(r){switch(r[2]){case"k":return r[1]*1024;case"m":return r[1]*1024*1024;case"g":return r[1]*1024*1024*1024}}}return null}getDate(e,r,n){r=r||E;const i=n?u.utc():u().local();if(e&&_.indexOf(e.type)!==-1){switch(e.type){case"s":const n=Math.floor(i.second()/e.digit)*e.digit;return i.second(n).format(r);case"m":const s=Math.floor(i.minute()/e.digit)*e.digit;return i.minute(s).format(r);case"h":const o=Math.floor(i.hour()/e.digit)*e.digit;return i.hour(o).format(r);case"daily":case"custom":case"test":return i.format(r)}}return i.format(r)}setAuditLog(e,r,n){let o=null;if(e){const a=e.toString().substr(-1);const c=e.toString().match(/^(\d+)/);if(Number(c[1])>0){const e=s.dirname(n.replace(/%DATE%.+/,"_filename"));try{if(r){const e=s.resolve(r);o=JSON.parse(i.readFileSync(e,{encoding:"utf-8"}))}else{const r=s.resolve(e+"/"+".audit.json");o=JSON.parse(i.readFileSync(r,{encoding:"utf-8"}))}}catch(n){if(n.code!=="ENOENT"){return null}o={keep:{days:false,amount:Number(c[1])},auditLog:r||e+"/"+".audit.json",files:[]}}o.keep={days:a==="d",amount:Number(c[1])}}}return o}writeAuditLog(e){try{(0,v.mkDirForFile)(e.auditLog);i.writeFileSync(e.auditLog,JSON.stringify(e,null,2))}catch(r){b((new Date).toLocaleString(),"[FileStreamRotator] Failed to store log audit at:",e.auditLog,"Error:",r)}}addLogToAudit(e,r,n){if(r&&r.files){const i=r.files.findIndex((r=>r.name===e));if(i!==-1){return r}const s=Date.now();r.files.push({date:s,name:e,hash:o.createHash(r.hashType).update(e+"LOG_FILE"+s).digest("hex")});if(r.keep.days){const e=u().subtract(r.keep.amount,"days").valueOf();r.files=r.files.filter((i=>{if(i.date>e){return true}i.hashType=r.hashType;(0,v.removeFile)(i);n.emit("logRemoved",i);return false}))}else{const e=r.files.splice(-r.keep.amount);if(r.files.length>0){r.files.filter((e=>{e.hashType=r.hashType;(0,v.removeFile)(e);n.emit("logRemoved",e);return false}))}r.files=e}this.writeAuditLog(r)}return r}getStream(e){let r=null;let n=null;g(e.filename,"options.filename must be supplied");if(e.frequency){r=this.getFrequency(e.frequency)}const s=this.setAuditLog(e.maxFiles,e.auditFile,e.filename);if(s!=null){s.hashType=e.auditHashType!==undefined?e.auditHashType:"md5"}let o=null;let p=0;let x=0;if(e.size){o=this.parseFileSize(e.size)}let T=e.dateFormat||E;if(r&&r.type==="daily"){if(!e.dateFormat){T="YYYY-MM-DD"}if(u().format(T)!==u().endOf("day").format(T)||u().format(T)===u().add(1,"day").format(T)){b((new Date).toLocaleString(),"[FileStreamRotator] Changing type to custom as date format changes more often than once a day or not every day");r.type="custom"}}if(r){n=e.frequency?this.getDate(r,T,e.utc):""}e.createSymlink=e.createSymlink||false;e.extension=e.extension||"";const w=e.filename;let C=null;let A=w+(n?"."+n:"");if(w.match(/%DATE%/)){A=w.replace(/%DATE%/g,n?n:this.getDate(null,T,e.utc))}if(o){let r=null;let n=A;if(s&&s.files&&s.files instanceof Array&&s.files.length>0){const e=s.files[s.files.length-1].name;if(e.match(n)){const r=e.match(n+"\\.(\\d+)");if(r){n=e;p=r[1]}}}if(p===0&&n===A){n+=e.extension}while(i.existsSync(n)){r=n;p++;n=A+"."+p+e.extension}if(r){const e=i.statSync(r);if(e.size<o){n=r;p--;x=e.size}}A=n}else{A+=e.extension}b((new Date).toLocaleString(),"[FileStreamRotator] Logging to: ",A);(0,v.mkDirForFile)(A);const k=e.fileOptions||{flags:"a"};let P=i.createWriteStream(A,k);if(n&&r&&_.indexOf(r.type)>-1||o>0){b((new Date).toLocaleString(),"[FileStreamRotator] Rotating file: ",r?r.type:"",o?"size: "+o:"");const u=new a;u.auditLog=s;u.filename=e.filename;u.end=(...e)=>{P.end(...e);g.clear()};u.canWrite=()=>!P.closed&&P.writable&&!P.destroyed;(0,v.BubbleEvents)(P,u);u.on("new",(r=>{u.auditLog=this.addLogToAudit(r,u.auditLog,u);if(e.createSymlink){(0,v.createCurrentSymLink)(r,e.symlinkName)}}));const g=(0,v.debounce)((()=>{let e=false;try{const e=i.statSync(A);if(e.size>x){x=e.size}}catch(r){e=true}return e}),1e3);u.write=(s,a)=>{const _=g();const E=r?this.getDate(r,T,e.utc):n;if(_||n&&E!==n||o&&x>o){let s=w+(n&&r?"."+E:"");if(w.match(/%DATE%/)&&n){s=w.replace(/%DATE%/g,E)}if(o&&x>o){p++;s+="."+p+e.extension}else{p=0;s+=e.extension}x=0;b((new Date).toLocaleString(),(0,c.format)("[FileStreamRotator] Changing logs from %s to %s",A,s));n=E;C=A;A=s;if(e.endStream===true){P.end()}else{P.destroy()}(0,v.mkDirForFile)(A);P=i.createWriteStream(s,k);u.emit("new",s);u.emit("rotate",C,s);(0,v.BubbleEvents)(P,u)}P.write(s,a);x+=Buffer.byteLength(s,a)};process.nextTick((()=>{u.emit("new",A)}));u.emit("new",A);return u}else{b((new Date).toLocaleString(),"[FileStreamRotator] File won't be rotated: ",e.frequency,e.size);process.nextTick((()=>{P.emit("new",A)}));return P}}}r.FileStreamRotator=FileStreamRotator;class FileStreamRotatorManager{static getStream(e){let r;if(this.enabled){if(!this.streamPool.has(e.filename)){const r=(new FileStreamRotator).getStream(e);this.streamPool.set(e.filename,r);this.loggerRef.set(r,0)}r=this.streamPool.get(e.filename);let n=this.loggerRef.get(r);this.loggerRef.set(r,n++)}else{r=(new FileStreamRotator).getStream(e)}return r}static close(e){if(this.enabled){if(this.loggerRef.has(e)){let r=this.loggerRef.get(e);r--;if(r===0){e.end();this.streamPool.delete(e.filename);this.loggerRef.delete(e)}else if(r>0){this.loggerRef.set(e,r)}else{}}}else{e.end()}}static clear(){for(const e of this.streamPool.values()){e.end();if(this.loggerRef.has(e)){this.loggerRef.delete(e)}}this.streamPool.clear();this.loggerRef=new WeakMap}}r.FileStreamRotatorManager=FileStreamRotatorManager;FileStreamRotatorManager.streamPool=new Map;FileStreamRotatorManager.loggerRef=new WeakMap;FileStreamRotatorManager.enabled=true},61003:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.EmptyTransport=r.Transport=void 0;const i=n(39023);const s=n(50505);const o=n(66645);class Transport{constructor(e={}){this.options=e;this.pid=process.pid}setLoggerOptions(e){this.loggerOptions=e;this.options.level=this.options.level||e.level;this.options.format=this.options.format||e.format;this.options.contextFormat=this.options.contextFormat||e.contextFormat;this.options.eol=this.options.eol||e.eol}format(e,r,n){const s=this.getLoggerInfo(e,r,n);if(Buffer.isBuffer(s.args[0])){return s.args[0]}if(e===false){return(0,i.format)(s.message)}const o=r.contextFormat||this.options.contextFormat;if(r.ctx&&o){return o(s)}const a=r.format||this.options.format;if(a){return a(s)}if(e){return(0,i.format)("%s %s %s %s",s.timestamp,s.LEVEL,s.pid,s.message)}else{return(0,i.format)(s.message)}}getLoggerInfo(e,r,n){const a=e||"";const c={level:a,pid:this.pid};Object.defineProperties(c,{timestamp:{get(){return(0,s.getFormatDate)(new Date)},enumerable:false},LEVEL:{get(){return o.LEVEL[a]||""},enumerable:false},args:{get(){return n},enumerable:false},originArgs:{get(){return n},enumerable:false},message:{get(){return(0,i.format)(...n)},enumerable:false},ctx:{get(){return r.ctx},enumerable:false},originError:{get(){return n.find((e=>e instanceof Error))},enumerable:false},meta:{get(){return r},enumerable:false}});return c}get level(){return this.options.level}set level(e){this.options.level=e}}r.Transport=Transport;class EmptyTransport extends Transport{log(e,...r){}close(){}}r.EmptyTransport=EmptyTransport},56446:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.supportsColor=r.colorizeAll=r.colorize=r.Color=void 0;const i=n(932);const s=n(70857);const o=n(52018);r.Color={red:e=>`[31m${e}[39m`,green:e=>`[32m${e}[39m`,yellow:e=>`[33m${e}[39m`,blue:e=>`[34m${e}[39m`,magenta:e=>`[35m${e}[39m`,cyan:e=>`[36m${e}[39m`,white:e=>`[37m${e}[39m`,gray:e=>`[90m${e}[39m`,grey:e=>`[90m${e}[39m`,black:e=>`[30m${e}[39m`,bgRed:e=>`[41m${e}[49m`,bgGreen:e=>`[42m${e}[49m`,bgYellow:e=>`[43m${e}[49m`,bgBlue:e=>`[44m${e}[49m`,bgMagenta:e=>`[45m${e}[49m`,bgCyan:e=>`[46m${e}[49m`,bgWhite:e=>`[47m${e}[49m`,bgBlack:e=>`[40m${e}[49m`,bold:e=>`[1m${e}[22m`,dim:e=>`[2m${e}[22m`,italic:e=>`[3m${e}[23m`,underline:e=>`[4m${e}[24m`,inverse:e=>`[7m${e}[27m`,hidden:e=>`[8m${e}[28m`,strikethrough:e=>`[9m${e}[29m`};const colorize=(e,n)=>{if(typeof n==="function"){return n(e)}else{return r.Color[n](e)}};r.colorize=colorize;const colorizeAll=(e,n)=>e.replace(/([^\s]+)/g,(e=>(0,r.colorize)(e,n)));r.colorizeAll=colorizeAll;function hasFlag(e,r=process.argv){const n=e.startsWith("-")?"":e.length===1?"-":"--";const i=r.indexOf(n+e);const s=r.indexOf("--");return i!==-1&&(s===-1||i<s)}let a;if(hasFlag("no-color")||hasFlag("no-colors")||hasFlag("color=false")||hasFlag("color=never")){a=0}else if(hasFlag("color")||hasFlag("colors")||hasFlag("color=true")||hasFlag("color=always")){a=1}function envForceColor(){if("FORCE_COLOR"in i.env){if(i.env.FORCE_COLOR==="true"){return 1}if(i.env.FORCE_COLOR==="false"){return 0}return i.env.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(i.env.FORCE_COLOR,10),3)}}function translateLevel(e){if(e===0){return false}return{level:e,hasBasic:true,has256:e>=2,has16m:e>=3}}function _supportsColor(e,r){const n=r.streamIsTTY;const o=true;const c=envForceColor();if(c!==undefined){a=c}const u=o?a:c;if(u===0){return 0}if(o){if(hasFlag("color=16m")||hasFlag("color=full")||hasFlag("color=truecolor")){return 3}if(hasFlag("color=256")){return 2}}if("TF_BUILD"in i.env&&"AGENT_NAME"in i.env){return 1}if(e&&!n&&u===undefined){return 0}const p=u||0;if(i.env.TERM==="dumb"){return p}if(i.platform==="win32"){const e=s.release().split(".");if(Number(e[0])>=10&&Number(e[2])>=10586){return Number(e[2])>=14931?3:2}return 1}if("CI"in i.env){if("GITHUB_ACTIONS"in i.env||"GITEA_ACTIONS"in i.env){return 3}if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((e=>e in i.env))||i.env.CI_NAME==="codeship"){return 1}return p}if("TEAMCITY_VERSION"in i.env){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(i.env.TEAMCITY_VERSION)?1:0}if(i.env.COLORTERM==="truecolor"){return 3}if(i.env.TERM==="xterm-kitty"){return 3}if("TERM_PROGRAM"in i.env){const e=Number.parseInt((i.env.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(i.env.TERM_PROGRAM){case"iTerm.app":{return e>=3?3:2}case"Apple_Terminal":{return 2}}}if(/-256(color)?$/i.test(i.env.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(i.env.TERM)){return 1}if("COLORTERM"in i.env){return 1}return p}function createSupportsColor(e){const r=_supportsColor(true,{streamIsTTY:e.isTTY});return translateLevel(r)}r.supportsColor={stdout:createSupportsColor({isTTY:o.isatty(1)}),stderr:createSupportsColor({isTTY:o.isatty(2)})}},33929:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.hash=void 0;const i=n(76982);const s=n(2203);function hash(e){const r={algorithm:"sha1",encoding:"hex",excludeValues:false,ignoreUnknown:false,respectType:true,respectFunctionNames:true,respectFunctionProperties:true,unorderedArrays:false,unorderedSets:true,unorderedObjects:true,replacer:undefined,excludeKeys:undefined};const n=i.createHash(r.algorithm);const s=typeHasher(r,n);s.dispatch(e);if(!n.update){n.end("")}return n.digest(r.encoding)}r.hash=hash;function typeHasher(e,r,n){n=n||[];const write=function(e){if(r.update){return r.update(e,"utf8")}else{return r.write(e,"utf8")}};return{dispatch:function(r){if(e.replacer){r=e.replacer(r)}let n=typeof r;if(r===null){n="null"}return this["_"+n](r)},_object:function(r){const i=/\[object (.*)\]/i;const s=Object.prototype.toString.call(r);let o=i.exec(s);if(!o){o="unknown:["+s+"]"}else{o=o[1]}o=o.toLowerCase();let a=null;if((a=n.indexOf(r))>=0){return this.dispatch("[CIRCULAR:"+a+"]")}else{n.push(r)}if(typeof Buffer!=="undefined"&&Buffer.isBuffer&&Buffer.isBuffer(r)){write("buffer:");return write(r)}if(o!=="object"&&o!=="function"&&o!=="asyncfunction"){if(this["_"+o]){this["_"+o](r)}else if(e.ignoreUnknown){return write("["+o+"]")}else{throw new Error('Unknown object type "'+o+'"')}}else{let n=Object.keys(r);if(e.unorderedObjects){n=n.sort()}if(e.respectType!==false&&!isNativeFunction(r)){n.splice(0,0,"prototype","__proto__","constructor")}if(e.excludeKeys){n=n.filter((r=>!e.excludeKeys(r)))}write("object:"+n.length+":");const i=this;return n.forEach((n=>{i.dispatch(n);write(":");if(!e.excludeValues){i.dispatch(r[n])}write(",")}))}},_array:function(r,i){i=typeof i!=="undefined"?i:e.unorderedArrays!==false;const o=this;write("array:"+r.length+":");if(!i||r.length<=1){return r.forEach((e=>o.dispatch(e)))}let a=[];const c=r.map((r=>{const i=new s.PassThrough;const o=n.slice();const c=typeHasher(e,i,o);c.dispatch(r);a=a.concat(o.slice(n.length));return i.read().toString()}));n=n.concat(a);c.sort();return this._array(c,false)},_date:function(e){return write("date:"+e.toJSON())},_symbol:function(e){return write("symbol:"+e.toString())},_error:function(e){return write("error:"+e.toString())},_boolean:function(e){return write("bool:"+e.toString())},_string:function(e){write("string:"+e.length+":");write(e.toString())},_function:function(r){write("fn:");if(isNativeFunction(r)){this.dispatch("[native]")}else{this.dispatch(r.toString())}if(e.respectFunctionNames!==false){this.dispatch("function-name:"+String(r.name))}if(e.respectFunctionProperties){this._object(r)}},_number:function(e){return write("number:"+e.toString())},_xml:function(e){return write("xml:"+e.toString())},_null:function(){return write("Null")},_undefined:function(){return write("Undefined")},_regexp:function(e){return write("regex:"+e.toString())},_uint8array:function(e){write("uint8array:");return this.dispatch(Array.prototype.slice.call(e))},_uint8clampedarray:function(e){write("uint8clampedarray:");return this.dispatch(Array.prototype.slice.call(e))},_int8array:function(e){write("int8array:");return this.dispatch(Array.prototype.slice.call(e))},_uint16array:function(e){write("uint16array:");return this.dispatch(Array.prototype.slice.call(e))},_int16array:function(e){write("int16array:");return this.dispatch(Array.prototype.slice.call(e))},_uint32array:function(e){write("uint32array:");return this.dispatch(Array.prototype.slice.call(e))},_int32array:function(e){write("int32array:");return this.dispatch(Array.prototype.slice.call(e))},_float32array:function(e){write("float32array:");return this.dispatch(Array.prototype.slice.call(e))},_float64array:function(e){write("float64array:");return this.dispatch(Array.prototype.slice.call(e))},_arraybuffer:function(e){write("arraybuffer:");return this.dispatch(new Uint8Array(e))},_url:function(e){return write("url:"+e.toString())},_map:function(r){write("map:");const n=Array.from(r);return this._array(n,e.unorderedSets!==false)},_set:function(r){write("set:");const n=Array.from(r);return this._array(n,e.unorderedSets!==false)},_file:function(e){write("file:");return this.dispatch([e.name,e.size,e.type,e.lastModfied])},_blob:function(){if(e.ignoreUnknown){return write("[blob]")}throw Error("Hashing Blob objects is currently not supported\n"+"(see https://github.com/puleos/object-hash/issues/26)\n"+'Use "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return write("domwindow")},_bigint:function(e){return write("bigint:"+e.toString())},_process:function(){return write("process")},_timer:function(){return write("timer")},_pipe:function(){return write("pipe")},_tcp:function(){return write("tcp")},_udp:function(){return write("udp")},_tty:function(){return write("tty")},_statwatcher:function(){return write("statwatcher")},_securecontext:function(){return write("securecontext")},_connection:function(){return write("connection")},_zlib:function(){return write("zlib")},_context:function(){return write("context")},_nodescript:function(){return write("nodescript")},_httpparser:function(){return write("httpparser")},_dataview:function(){return write("dataview")},_signal:function(){return write("signal")},_fsevent:function(){return write("fsevent")},_tlswrap:function(){return write("tlswrap")}}}function isNativeFunction(e){if(typeof e!=="function"){return false}const r=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;return r.exec(Function.prototype.toString.call(e))!=null}},50505:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.getFormatDate=r.isWin32=r.BubbleEvents=r.formatLegacyLoggerOptions=r.formatLoggerOptions=r.isDevelopmentEnvironment=r.debounce=r.throwIf=r.getMaxSize=r.isValidDirName=r.isValidFileName=r.removeFile=r.createCurrentSymLink=r.mkDirForFile=r.checkDailyAndTest=r.checkNumAndType=r.isEnableLevel=void 0;const i=n(66645);const s=n(79896);const o=n(16928);const a=n(76982);const c=n(16928);const u=n(70857);const p=n(61003);function isEnableLevel(e,r){if(!e||!r){return true}return i.DefaultLogLevels[e]<=i.DefaultLogLevels[r]}r.isEnableLevel=isEnableLevel;function checkNumAndType(e,r){if(typeof r==="number"){switch(e){case"s":case"m":if(r<0||r>60){return false}break;case"h":if(r<0||r>24){return false}break}return{type:e,digit:r}}}r.checkNumAndType=checkNumAndType;function checkDailyAndTest(e){switch(e){case"custom":case"daily":return{type:e,digit:undefined};case"test":return{type:e,digit:0}}return false}r.checkDailyAndTest=checkDailyAndTest;function mkDirForFile(e){const r=c.dirname(e);r.split(c.sep).reduce(((e,r)=>{e+=r+c.sep;if(!s.existsSync(e)){try{s.mkdirSync(e)}catch(e){if(e.code!=="EEXIST"){throw e}}}return e}),"")}r.mkDirForFile=mkDirForFile;function createCurrentSymLink(e,r){const n=r||"current.log";const i=(0,o.dirname)(e);const a=(0,o.basename)(e);const c=i+"/"+n;try{const e=s.lstatSync(c);if(e.isSymbolicLink()){s.unlinkSync(c);s.symlinkSync(a,c)}}catch(e){if(e&&e.code==="ENOENT"){try{s.symlinkSync(a,c)}catch(e){console.error((new Date).toLocaleString(),"[FileStreamRotator] Could not create symlink file: ",c," -> ",a)}}}}r.createCurrentSymLink=createCurrentSymLink;function removeFile(e){if(e.hash===a.createHash(e.hashType).update(e.name+"LOG_FILE"+e.date).digest("hex")){try{if(s.existsSync(e.name)){s.unlinkSync(e.name)}}catch(r){console.error((new Date).toLocaleString(),"[FileStreamRotator] Could not remove old log file: ",e.name)}}}r.removeFile=removeFile;function isValidFileName(e){return!/["<>|:*?\\/\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]/g.test(e)}r.isValidFileName=isValidFileName;function isValidDirName(e){return!/["<>|\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]/g.test(e)}r.isValidDirName=isValidDirName;function getMaxSize(e){if(e&&typeof e==="string"){const r=e.toLowerCase().match(/^((?:0\.)?\d+)([k|m|g])$/);if(r){return e}}else if(e&&Number.isInteger(e)){const r=Math.round(e/1024);return r===0?"1k":r+"k"}return null}r.getMaxSize=getMaxSize;function throwIf(e,...r){Array.prototype.slice.call(r,1).forEach((n=>{if(e[n]){throw new Error("Cannot set "+n+" and "+r[0]+" together")}}))}r.throwIf=throwIf;function debounce(e,r,n){let i,s,o,a,c;if(null==r)r=100;function later(){const u=Date.now()-a;if(u<r&&u>=0){i=setTimeout(later,r-u)}else{i=null;if(!n){c=e.apply(o,s);o=s=null}}}const debounced=(...s)=>{o=this;a=Date.now();const u=n&&!i;if(!i)i=setTimeout(later,r);if(u){c=e.apply(o,s);o=s=null}return c};debounced.clear=()=>{if(i){clearTimeout(i);i=null}};debounced.flush=()=>{if(i){c=e.apply(o,s);o=s=null;clearTimeout(i);i=null}};return debounced}r.debounce=debounce;const isDevelopmentEnvironment=e=>["local","test","unittest"].includes(e);r.isDevelopmentEnvironment=isDevelopmentEnvironment;const g={enableConsole:true,disableConsole:true,enableFile:true,enableError:true,enableJSON:true,disableFile:true,disableError:true};function formatLoggerOptions(e){if(Object.keys(e).some((e=>g[e]))){const r={transports:{}};for(const n of Object.keys(e)){if(!g[n]){r[n]=e[n]}}if(r.transports["console"]&&(e["enableConsole"]===false||e["disableConsole"]===true)){r.transports["console"]=false}if(r.transports["file"]&&(e["enableFile"]===false||e["disableFile"]===true)){r.transports["file"]=false}if(r.transports["error"]&&(e["enableError"]===false||e["disableError"]===true)){r.transports["error"]=false}if(r.transports["json"]&&e["enableJSON"]===false){r.transports["json"]=false}return r}return e}r.formatLoggerOptions=formatLoggerOptions;const v={level:{category:"top",mappingKey:"level",isOld:false},consoleLevel:{category:"console",mappingKey:"level",isOld:true},fileLevel:{category:"file",mappingKey:"level",isOld:true},jsonLevel:{category:"json",mappingKey:"level",isOld:true},format:{category:"top",mappingKey:"format",isOld:false},contextFormat:{category:"top",mappingKey:"contextFormat",isOld:false},jsonFormat:{category:"json",mappingKey:"format",isOld:true},dir:{category:["file","error","json"],mappingKey:"dir",isOld:true},errorDir:{category:"error",mappingKey:"dir",overwriteIfExists:true,isOld:true},jsonDir:{category:"json",mappingKey:"dir",overwriteIfExists:true,isOld:true},aliasName:{ignore:true,isOld:false},fileLogName:{category:["file"],mappingKey:"fileLogName",isOld:true},errorLogName:{category:"error",mappingKey:"fileLogName",overwriteIfExists:true,isOld:true},jsonLogName:{category:"json",mappingKey:"fileLogName",overwriteIfExists:true,isOld:true},enableConsole:{ignore:true,isOld:true},enableFile:{ignore:true,isOld:true},enableError:{ignore:true,isOld:true},enableJSON:{ignore:true,isOld:true},disableSymlink:{category:["file","error","json"],mappingKey:"createSymlink",isOld:true},disableFileSymlink:{category:"file",mappingKey:"createSymlink",reverseValue:true,overwriteIfExists:true,isOld:true},disableErrorSymlink:{category:"error",mappingKey:"createSymlink",reverseValue:true,overwriteIfExists:true,isOld:true},disableJSONSymlink:{category:"json",mappingKey:"createSymlink",reverseValue:true,overwriteIfExists:true,isOld:true},maxSize:{category:["file","error","json"],mappingKey:"maxSize",isOld:true},fileMaxSize:{category:"file",mappingKey:"maxSize",overwriteIfExists:true,isOld:true},errMaxSize:{category:"error",mappingKey:"maxSize",overwriteIfExists:true,isOld:true},jsonMaxSize:{category:"json",mappingKey:"maxSize",overwriteIfExists:true,isOld:true},maxFiles:{category:["file","error","json"],mappingKey:"maxFiles",isOld:true},fileMaxFiles:{category:"file",mappingKey:"maxFiles",overwriteIfExists:true,isOld:true},errMaxFiles:{category:"error",mappingKey:"maxFiles",overwriteIfExists:true,isOld:true},jsonMaxFiles:{category:"json",mappingKey:"maxFiles",overwriteIfExists:true,isOld:true},eol:{category:"top",mappingKey:"eol",isOld:false},jsonEol:{category:"json",mappingKey:"eol",isOld:true},zippedArchive:{category:["file","error","json"],mappingKey:"zippedArchive",isOld:true},fileZippedArchive:{category:"file",mappingKey:"zippedArchive",overwriteIfExists:true,isOld:true},errZippedArchive:{category:"error",mappingKey:"zippedArchive",overwriteIfExists:true,isOld:true},jsonZippedArchive:{category:"json",mappingKey:"zippedArchive",overwriteIfExists:true,isOld:true},datePattern:{category:["file","error","json"],mappingKey:"datePattern",isOld:true},fileDatePattern:{category:"file",mappingKey:"datePattern",overwriteIfExists:true,isOld:true},errDatePattern:{category:"error",mappingKey:"datePattern",overwriteIfExists:true,isOld:true},jsonDatePattern:{category:"json",mappingKey:"datePattern",overwriteIfExists:true,isOld:true},auditFileDir:{category:["file","error","json"],mappingKey:"auditFileDir",isOld:true},printFormat:{category:"top",mappingKey:"format",isOld:true},defaultMeta:{ignore:true,isOld:true},defaultLabel:{ignore:true,isOld:true},disableConsole:{ignore:true,isOld:true},disableFile:{ignore:true,isOld:true},disableError:{ignore:true,isOld:true},fileOptions:{category:["file","error","json"],mappingKey:"fileOptions",isOld:true}};const b=Object.prototype.hasOwnProperty;const _=Object.prototype.toString;function formatLegacyLoggerOptions(e){var r,n,i,s,o,a;function isPlainObject(e){if(!e||_.call(e)!=="[object Object]"){return false}const r=b.call(e,"constructor");const n=e.constructor&&e.constructor.prototype&&b.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n){return false}let i;for(i in e){}return typeof i==="undefined"||b.call(e,i)}function deepMerge(e,r){if(!e){return r}if(r&&!isPlainObject(r)){return r}for(const n of Object.keys(r)){if(r[n]instanceof Object){Object.assign(r[n],deepMerge(e[n],r[n]))}}Object.assign(e||{},r);return e}function setTransportOptions(r,n,i,s=false){var o,a;if(!r.transports[i]){r.transports[i]={}}const c=(o=v[n].mappingKey)!==null&&o!==void 0?o:n;if(s){r.transports[i][c]=e[n]}else{r.transports[i][c]=(a=r.transports[i][c])!==null&&a!==void 0?a:e[n]}}function isValidTransport(e){return e&&(e instanceof p.Transport||typeof e==="object"&&e["dir"]&&e["fileLogName"])}if(Object.keys(e).some((e=>{var r;return(r=v[e])===null||r===void 0?void 0:r.isOld}))){const c={transports:{}};for(const n of Object.keys(e)){if(!v[n]){continue}else{if(v[n].ignore){continue}v[n].category=[].concat(v[n].category);for(const i of v[n].category){if(i==="all"){for(const e of Object.keys(c.transports)){setTransportOptions(c,n,e,v[n].overwriteIfExists)}}else if(i==="top"){c[n]=(r=c[n])!==null&&r!==void 0?r:e[v[n].mappingKey]}else{setTransportOptions(c,n,i,v[n].overwriteIfExists)}}}}for(const r of Object.keys(e)){if(!v[r]){deepMerge(c[r],e[r])}}if(e["enableConsole"]===false||e["disableConsole"]===true){c.transports["console"]=false}else{c.transports["console"]=(n=c.transports["console"])!==null&&n!==void 0?n:{}}if(e["enableFile"]===false||e["disableFile"]===true){c.transports["file"]=false}else{c.transports["file"]=(i=c.transports["file"])!==null&&i!==void 0?i:{}}if(e["enableError"]===false||e["disableError"]===true){c.transports["error"]=false}else{c.transports["error"]=(s=c.transports["error"])!==null&&s!==void 0?s:{}}if(((o=e===null||e===void 0?void 0:e.transports)===null||o===void 0?void 0:o["json"])===undefined&&(e["enableJSON"]===undefined||e["enableJSON"]===false)){c.transports["json"]=false}else{}for(const e of["file","error","json"]){if((a=c===null||c===void 0?void 0:c.transports)===null||a===void 0?void 0:a[e]){if(!isValidTransport(c.transports[e])){delete c.transports[e]}}}return c}return e}r.formatLegacyLoggerOptions=formatLegacyLoggerOptions;function BubbleEvents(e,r){e.on("close",(()=>{r.emit("close")}));e.on("finish",(()=>{r.emit("finish")}));e.on("error",(e=>{r.emit("error",e)}));e.on("open",(e=>{r.emit("open",e)}))}r.BubbleEvents=BubbleEvents;function isWin32(){return u.platform()==="win32"}r.isWin32=isWin32;function getFormatDate(e){function pad(e,r=2){const n=e+"";return n.padStart(r,"0")}const r=e.getFullYear();const n=e.getMonth()+1;const i=e.getDate();const s=e.getHours();const o=e.getMinutes();const a=e.getSeconds();const c=e.getMilliseconds();return`${r}-${pad(n)}-${pad(i)} ${pad(s)}:${pad(o)}:${pad(a)}.${pad(c,3)}`}r.getFormatDate=getFormatDate},92136:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.session=void 0;r.session={enable:true,maxAge:24*3600*1e3,key:"MW_SESS",httpOnly:true,logValue:true}},73632:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.SessionConfiguration=void 0;const o=n(45573);const a=n(92136);const c=n(1519);let u=class SessionConfiguration{async onReady(){if(this.sessionConfig.enable){this.applicationManager.getApplications(["koa","faas"]).forEach((e=>{if(e.on){e.on("session:missed",(({ctx:e,key:r})=>{this.logger.warn("[session][missed] key(%s)",r)}));e.on("session:expired",(({ctx:e,key:r,value:n})=>{this.logger.warn("[session][expired] key(%s) value(%j)",r,this.sessionConfig.logValue?n:"")}));e.on("session:invalid",(({ctx:e,key:r,value:n})=>{this.logger.warn("[session][invalid] key(%s) value(%j)",r,this.sessionConfig.logValue?n:"")}))}e.useMiddleware(c.SessionMiddleware)}))}}};i([(0,o.Inject)(),s("design:type",o.MidwayApplicationManager)],u.prototype,"applicationManager",void 0);i([(0,o.Logger)("coreLogger"),s("design:type",Object)],u.prototype,"logger",void 0);i([(0,o.Config)("session"),s("design:type",Object)],u.prototype,"sessionConfig",void 0);u=i([(0,o.Configuration)({namespace:"session",importConfigs:[{default:a}]})],u);r.SessionConfiguration=u},72026:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.Configuration=void 0;s(n(38573),r);var o=n(73632);Object.defineProperty(r,"Configuration",{enumerable:true,get:function(){return o.SessionConfiguration}});s(n(1519),r);s(n(46799),r)},38573:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.SessionStore=void 0;class SessionStore{}r.SessionStore=SessionStore},73113:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ContextSession=void 0;const i=n(39023);const s=n(70704);const o=n(5786);const a=(0,i.debuglog)("session:context");class ContextSession{constructor(e,r){this.ctx=e;this.app=e.app;this.opts=Object.assign({},r);this.store=this.opts.ContextStore?new this.opts.ContextStore(e):this.opts.store}get(){const e=this.session;if(e)return e;if(e===false)return null;this.store?this.create():this.initFromCookie();return this.session}set(e){if(e===null){this.session=false;return}if(typeof e==="object"){this.create(e,this.externalKey);return}throw new Error("this.session can only be set as null or an object.")}async initFromExternal(){a("init from external");const e=this.ctx;const r=this.opts;let n;if(r.externalKey){n=r.externalKey.get(e);a("get external key from custom %s",n)}else{n=e.cookies.get(r.key,r);a("get external key from cookie %s",n)}if(!n){this.create();return}const i=await this.store.get(n,r.maxAge,{ctx:e,rolling:r.rolling});if(!this.valid(i,n)){this.create();return}this.create(i,n);this.prevHash=(0,s.hash)(this.session.toJSON())}initFromCookie(){a("init from cookie");const e=this.ctx;const r=this.opts;const n=e.cookies.get(r.key,r);if(!n){this.create();return}let i;a("parse %s",n);try{i=r.decode(n)}catch(i){a("decode %j error: %s",n,i);if(!(i instanceof SyntaxError)){e.cookies.set(r.key,"",r);i.headers={"set-cookie":e.response.get("set-cookie")};throw i}this.create();return}a("parsed %j",i);if(!this.valid(i)){this.create();return}this.create(i);this.prevHash=(0,s.hash)(this.session.toJSON())}valid(e,r){const n=this.ctx;if(!e){this.emit("missed",{key:r,value:e,ctx:n});return false}if(e._expire&&e._expire<Date.now()){a("expired session");this.emit("expired",{key:r,value:e,ctx:n});return false}const i=this.opts.valid;if(typeof i==="function"&&!i(n,e)){a("invalid session");this.emit("invalid",{key:r,value:e,ctx:n});return false}return true}emit(e,r){setImmediate((()=>{this.app.emit(`session:${e}`,r)}))}create(e,r){a("create session with val: %j externalKey: %s",e,r);if(this.store){this.externalKey=r||this.opts.genid&&this.opts.genid(this.ctx)}this.session=new o.Session(this,e,this.externalKey)}async commit({save:e=false,regenerate:r=false}={}){const n=this.session;const i=this.opts;const s=this.ctx;if(undefined===n)return;if(n===false){await this.remove();return}if(r){await this.remove();if(this.store)this.externalKey=i.genid&&i.genid(s)}const o=e||r||n._requireSave?"force":this._shouldSaveSession();a("should save session: %s",o);if(!o)return;if(typeof i.beforeSave==="function"){a("before save");i.beforeSave(s,n)}const c=o==="changed";await this.save(c)}_shouldSaveSession(){const e=this.prevHash;const r=this.session;const n=r.toJSON();if(!e&&!Object.keys(n).length)return"";const i=e!==(0,s.hash)(n);if(i)return"changed";if(this.opts.rolling)return"rolling";if(this.opts.renew){const e=r._expire;const n=r.maxAge;if(e&&n&&e-Date.now()<n/2)return"renew"}return""}async remove(){const e=Object.assign({},this.opts,{expires:s.COOKIE_EXP_DATE,maxAge:false});const r=this.ctx;const n=e.key;const i=this.externalKey;if(i){await this.store.destroy(i,{ctx:r})}r.cookies.set(n,"",e)}async save(e){const r=this.opts;const n=r.key;const i=this.externalKey;let o=this.session.toJSON();let c=r.maxAge?r.maxAge:s.ONE_DAY;if(c==="session"){r.maxAge=undefined;o._session=true}else{o._expire=c+Date.now();o._maxAge=c}if(i){a("save %j to external key %s",o,i);if(typeof c==="number"){c+=1e4}await this.store.set(i,o,c,{changed:e,ctx:this.ctx,rolling:r.rolling});if(r.externalKey){r.externalKey.set(this.ctx,i)}else{this.ctx.cookies.set(n,i,r)}return}a("save %j to cookie",o);o=r.encode(o);a("save %s",o);this.ctx.cookies.set(n,o,r)}}r.ContextSession=ContextSession},18872:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.crc32=void 0;const n=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function crc32(e,r=false){let i=~0;for(let r=0,s=e.length;r<s;r++){i=i>>>8^n[(i^e.charCodeAt(r))&255]}i=Math.abs(i^-1);return r?i.toString(16):i}r.crc32=crc32},5786:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Session=void 0;class Session{constructor(e,r,n){this.isNew=true;this._sessCtx=e;this._ctx=e.ctx;this._externalKey=n;if(!r){this.isNew=true}else{for(const e in r){if(e==="_maxAge")this._ctx.sessionOptions.maxAge=r._maxAge;else if(e==="_session")this._ctx.sessionOptions.maxAge="session";else this[e]=r[e]}}}toJSON(){const e={};Object.keys(this).forEach((r=>{if(r==="isNew")return;if(r[0]==="_")return;e[r]=this[r]}));return e}get length(){return Object.keys(this.toJSON()).length}get populated(){return!!this.length}get maxAge(){return this._ctx.sessionOptions.maxAge}set maxAge(e){this._ctx.sessionOptions.maxAge=e;this._requireSave=true}get externalKey(){return this._externalKey}save(e){return this.commit({save:true},e)}regenerate(e){return this.commit({regenerate:true},e)}manuallyCommit(){return this.commit()}commit(e,r){if(typeof e==="function"){r=e;e={}}const n=this._sessCtx.commit(e);if(r){n.then((()=>r()),r)}else{return n}}}r.Session=Session},46799:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.SessionStoreManager=void 0;const s=n(45573);let o=class SessionStoreManager{setSessionStore(e){this.sessionStore=e}getSessionStore(){return this.sessionStore}};o=i([(0,s.Provide)(),(0,s.Scope)(s.ScopeEnum.Singleton)],o);r.SessionStoreManager=o},70704:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ONE_DAY=r.COOKIE_EXP_DATE=r.hash=r.encode=r.decode=void 0;const i=n(18872);function decode(e){const r=Buffer.from(e,"base64").toString("utf8");return JSON.parse(r)}r.decode=decode;function encode(e){e=JSON.stringify(e);return Buffer.from(e).toString("base64")}r.encode=encode;function hash(e){return(0,i.crc32)(JSON.stringify(e))}r.hash=hash;r.COOKIE_EXP_DATE=new Date("Thu, 01 Jan 1970 00:00:00 GMT");r.ONE_DAY=24*60*60*1e3},1519:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.SessionMiddleware=void 0;const o=n(45573);const a=n(46799);const c=n(70704);const u=n(42613);const p=n(73113);const g=Symbol("context#contextSession");const v=Symbol("context#_contextSession");function formatOpts(e){e=e||{};e.key=e.key||"koa.sess";if(!("maxAge"in e))e.maxAge=e.maxage;if(e.overwrite==null)e.overwrite=true;if(e.httpOnly==null)e.httpOnly=true;if(e.sameSite==null)delete e.sameSite;if(e.signed==null)e.signed=true;if(e.autoCommit==null)e.autoCommit=true;if(typeof e.encode!=="function"){e.encode=c.encode}if(typeof e.decode!=="function"){e.decode=c.decode}const r=e.store;if(r){u(o.Types.isFunction(r.get),"store.get must be function");u(o.Types.isFunction(r.set),"store.set must be function");u(o.Types.isFunction(r.destroy),"store.destroy must be function")}const n=e.externalKey;if(n){u(o.Types.isFunction(n.get),"externalKey.get must be function");u(o.Types.isFunction(n.set),"externalKey.set must be function")}const i=e.ContextStore;if(i){u(o.Types.isClass(i),"ContextStore must be a class");u(o.Types.isFunction(i.prototype.get),"ContextStore.prototype.get must be function");u(o.Types.isFunction(i.prototype.set),"ContextStore.prototype.set must be function");u(o.Types.isFunction(i.prototype.destroy),"ContextStore.prototype.destroy must be function")}if(!e.genid){if(e.prefix){e.genid=()=>`${e.prefix}${o.Utils.randomUUID()}`}else{e.genid=o.Utils.randomUUID}}return e}function extendContext(e,r){if(e.hasOwnProperty(g)){return}Object.defineProperties(e,{[g]:{get(){if(this[v]){return this[v]}this[v]=new p.ContextSession(this,r);return this[v]}},session:{get(){return this[g].get()},set(e){this[g].set(e)},configurable:true},sessionOptions:{get(){return this[g].opts}}})}let b=class SessionMiddleware{resolve(e){if(!this.sessionConfig.httpOnly){this.logger.warn("[midway-session]: please set `config.session.httpOnly` to true. It is very dangerous if session can read by client JavaScript.")}const r=this.sessionStoreManager.getSessionStore();if(r){this.sessionConfig.store=r}const n=formatOpts(this.sessionConfig);extendContext(e.context,n);return async function session(e,r){const i=e[g];if(i.store){await i.initFromExternal()}try{await r()}finally{if(n.autoCommit){await i.commit()}}}}static getName(){return"session"}};i([(0,o.Config)("session"),s("design:type",Object)],b.prototype,"sessionConfig",void 0);i([(0,o.Logger)(),s("design:type",Object)],b.prototype,"logger",void 0);i([(0,o.Inject)(),s("design:type",a.SessionStoreManager)],b.prototype,"sessionStoreManager",void 0);b=i([(0,o.Middleware)()],b);r.SessionMiddleware=b},20073:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.SocketIOConfiguration=void 0;const s=n(45573);let o=class SocketIOConfiguration{};o=i([(0,s.Configuration)({namespace:"socketIO"})],o);r.SocketIOConfiguration=o},60475:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};Object.defineProperty(r,"__esModule",{value:true});r.MidwaySocketIOFramework=void 0;const s=n(45573);const o=n(39023);const a=(0,o.debuglog)("midway:socket.io");const c=n(91735);const u=n(45573);let p=class MidwaySocketIOFramework extends s.BaseFramework{constructor(){super(...arguments);this.namespaceList=[];this.connectionMiddlewareManager=this.createMiddlewareManager()}configure(){return this.configService.getConfiguration("socketIO")}applicationInitialize(){this.app=new c.Server(this.configurationOptions);this.defineApplicationProperties({useConnectionMiddleware:e=>this.useConnectionMiddleware(e),getConnectionMiddleware:()=>this.getConnectionMiddleware()})}async run(){await this.loadMidwayController();if(this.configurationOptions.adapter){this.app.adapter(this.configurationOptions.adapter);this.logger.debug("[midway:socketio] init socket.io-redis ready!")}if(this.configurationOptions.port){this.app.listen(this.configurationOptions.port,this.configurationOptions);this.logger.info(`[midway:socketio] Socket.io server port = ${this.configurationOptions.port} start success`)}else if(this.applicationContext.hasObject(s.HTTP_SERVER_KEY)){this.app.attach(this.applicationContext.get(s.HTTP_SERVER_KEY),this.configurationOptions);this.logger.info("[midway:socketio] Socket.io server start success and attach to web server")}}async beforeStop(){return new Promise((e=>{this.app.close((()=>{setTimeout((()=>{e()}),1e3)}))}))}getFrameworkType(){return s.MidwayFrameworkType.WS_IO}async loadMidwayController(){const e=(0,u.listModule)(u.WS_CONTROLLER_KEY);for(const r of e){await this.addNamespace(r)}}async addNamespace(e){var r,n;const i=(0,u.getClassMetadata)(u.WS_CONTROLLER_KEY,e);const o=this.app.of(i.namespace);this.namespaceList.push(i.namespace);const c=(r=i.routerOptions.middleware)!==null&&r!==void 0?r:[];const p=(n=i.routerOptions.connectionMiddleware)!==null&&n!==void 0?n:[];o.use(((e,r)=>{this.app.createAnonymousContext(e);e.requestContext.registerObject("socket",e);e.app=this.app;r()}));o.on("connect",(r=>{let n=this.middlewareService.compose([...this.connectionMiddlewareManager,...p],this.app).then((e=>e(r)));const i=(0,u.getClassMetadata)(u.WS_EVENT_KEY,e);const o={};const g=i.filter((e=>e.eventType===u.WSEventTypeEnum.ON_CONNECTION));if(g.length){n=n.then((()=>Promise.all(g.map((async n=>{var i;o[n.propertyName]=o[n.propertyName]||{responseEvents:[]};const s=await r.requestContext.getAsync(e);try{const e=await this.middlewareService.compose([...((i=n===null||n===void 0?void 0:n.eventOptions)===null||i===void 0?void 0:i.middleware)||[],async(e,i)=>s[n.propertyName].apply(s,[r])],this.app);const a=await e(r);await this.bindSocketResponse(a,r,n.propertyName,o)}catch(e){this.logger.error(e)}})))))}const v=i.filter((e=>e.eventType!==u.WSEventTypeEnum.ON_CONNECTION));if(v.length){for(const i of v){o[i.propertyName]=o[i.propertyName]||{responseEvents:[]};if(i.eventType===u.WSEventTypeEnum.ON_MESSAGE){r.on(i.messageEventName,(async(...u)=>{await n;const p=await r.requestContext.getAsync(e);a("got message",i.messageEventName,u);try{const n=await(await this.applyMiddleware((async(r,n)=>{var o;const a=await this.middlewareService.compose([...c,...((o=i===null||i===void 0?void 0:i.eventOptions)===null||o===void 0?void 0:o.middleware)||[],async(r,n)=>{const o=await this.app.getFramework().runGuard(r,e,i.propertyName);if(!o){throw new s.MidwayInvokeForbiddenError(i.propertyName,e)}return p[i.propertyName].apply(p,u)}],this.app);return await a(r,n)})))(r);if(typeof u[u.length-1]==="function"){u[u.length-1](n)}else{await this.bindSocketResponse(n,r,i.propertyName,o)}}catch(e){this.logger.error(e)}}))}else if(i.eventType===u.WSEventTypeEnum.ON_DISCONNECTION){r.on("disconnect",(async n=>{const s=await r.requestContext.getAsync(e);try{const e=await s[i.propertyName].apply(s,[n]);await this.bindSocketResponse(e,r,i.propertyName,o)}catch(e){this.logger.error(e)}}))}else{o[i.propertyName].responseEvents.push(i)}}}}));if(o.adapter&&o.adapter.on){o.adapter.on("error",(e=>{this.logger.error(e)}))}o.on("error",(e=>{this.logger.error(e)}))}async bindSocketResponse(e,r,n,i){if(e&&i[n]){for(const s of i[n].responseEvents){if(s.eventType===u.WSEventTypeEnum.EMIT){if(s.roomName.length){r=s.roomName.reduce(((e,r)=>e.to(r)),r)}r.emit.apply(r,[s.messageEventName].concat(e))}else if(s.eventType===u.WSEventTypeEnum.BROADCAST){r.nsp.emit.apply(r.nsp,[].concat(e))}}}}getFrameworkName(){return"midway:socketIO"}useConnectionMiddleware(e){this.connectionMiddlewareManager.insertLast(e)}getConnectionMiddleware(){return this.connectionMiddlewareManager}};p=i([(0,u.Framework)()],p);r.MidwaySocketIOFramework=p},65543:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.Configuration=r.createRedisAdapter=r.Framework=void 0;var o=n(60475);Object.defineProperty(r,"Framework",{enumerable:true,get:function(){return o.MidwaySocketIOFramework}});var a=n(40807);Object.defineProperty(r,"createRedisAdapter",{enumerable:true,get:function(){return a.createRedisAdapter}});s(n(94668),r);var c=n(20073);Object.defineProperty(r,"Configuration",{enumerable:true,get:function(){return c.SocketIOConfiguration}})},94668:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},40807:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.createRedisAdapter=void 0;const i=n(97164);function createRedisAdapter(e){if(e.host&&e.port){return(0,i.createAdapter)("redis://"+e.host+":"+e.port,e)}if(e.pubClient&&e.subClient){return(0,i.createAdapter)(e)}throw new Error("error socket adapter options")}r.createRedisAdapter=createRedisAdapter},20485:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const i=n(16928);r["default"]=e=>({staticFile:{dirs:{default:{prefix:"/public",dir:(0,i.join)(e.appDir,"public")}},dynamic:true,preload:false,buffer:false,maxFiles:1e3}})},91225:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.StaticFileConfiguration=void 0;const o=n(45573);const a=n(53808);const c=n(20485);let u=class StaticFileConfiguration{async onConfigLoad(){if(this.applicationManager.getApplication("faas")){return{staticFile:{buffer:true}}}}async onReady(e){this.applicationManager.getApplications(["koa","faas","egg"]).forEach((r=>{if(e.hasNamespace("cross-domain")){r.getMiddleware().insertAfter(a.StaticMiddleware,"cors")}else{r.getMiddleware().insertFirst(a.StaticMiddleware)}}))}};i([(0,o.Inject)(),s("design:type",o.MidwayApplicationManager)],u.prototype,"applicationManager",void 0);u=i([(0,o.Configuration)({namespace:"static-file",importConfigs:[{default:c}]})],u);r.StaticFileConfiguration=u},26245:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DirectoryNotFoundError=r.StaticFileErrorEnum=void 0;const i=n(45573);r.StaticFileErrorEnum=(0,i.registerErrorCode)("static_file",{DIRECTORY_NOT_EXISTS:1e4});class DirectoryNotFoundError extends i.MidwayError{constructor(e){super(`Path ${e} not exist, please check it.`,r.StaticFileErrorEnum.DIRECTORY_NOT_EXISTS)}}r.DirectoryNotFoundError=DirectoryNotFoundError},5783:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.Configuration=void 0;var o=n(91225);Object.defineProperty(r,"Configuration",{enumerable:true,get:function(){return o.StaticFileConfiguration}});s(n(53808),r);s(n(59100),r);s(n(26245),r)},59100:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},53808:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.StaticMiddleware=void 0;const o=n(45573);const a=n(42613);const c=n(13249);const u=n(18836);const p=n(38973);const g=n(26245);const v=n(79896);let b=class StaticMiddleware{async resolve(e){const r=Object.values(this.staticFileConfig.dirs);if(this.staticFileConfig.dir){r.push(this.staticFileConfig.dir)}const n=[];function rangeMiddleware(e,r){const i=n.some((r=>e.path.startsWith(r)));if(i){return p(e,r)}return r()}const i=[rangeMiddleware];for(const e of r){a(o.Types.isObject(e)||o.Types.isString(e),"`config.static.dir` must be `string | Array<string|object>`.");const r=Object.assign({},this.staticFileConfig,e);if(r.dynamic&&!r.files){r.files=new u(r.maxFiles)}if(r.prefix){n.push(r.prefix)}if(this.environmentService.isPkgEnvironment()){if(!v.existsSync(r.dir)){throw new g.DirectoryNotFoundError(r.dir)}}else{if(!await o.FileUtils.exists(r.dir)){throw new g.DirectoryNotFoundError(r.dir)}}this.logger.info("[midway:static] starting static serve %s -> %s",r.prefix,r.dir);i.push(c(r))}return await this.middlewareService.compose(i,e,"staticFile")}static getName(){return"staticFile"}};i([(0,o.Config)("staticFile"),s("design:type",Object)],b.prototype,"staticFileConfig",void 0);i([(0,o.Inject)(),s("design:type",o.MidwayMiddlewareService)],b.prototype,"middlewareService",void 0);i([(0,o.Inject)(),s("design:type",o.MidwayEnvironmentService)],b.prototype,"environmentService",void 0);i([(0,o.Logger)("coreLogger"),s("design:type",Object)],b.prototype,"logger",void 0);b=i([(0,o.Middleware)()],b);r.StaticMiddleware=b},92918:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.isEnumMetadata=r.isEnumDefined=r.isEnumArray=r.addEnumSchema=r.addEnumArraySchema=r.getEnumType=r.getEnumValues=void 0;function getEnumValues(e){if(Array.isArray(e)){return e}if(typeof e!=="object"){return[]}const r=Object.keys(e).filter((e=>isNaN(Number(e)))).map((r=>e[r]));return Array.from(new Set(r))}r.getEnumValues=getEnumValues;function getEnumType(e){const r=e.filter((e=>typeof e==="string")).length>0;return r?"string":"number"}r.getEnumType=getEnumType;function addEnumArraySchema(e,r){const n=e.schema||{};e.schema=n;n.type="array";delete e.isArray;const i=getEnumValues(r.enum);n.items={type:getEnumType(i),enum:i};if(r.enumName){e.enumName=r.enumName}}r.addEnumArraySchema=addEnumArraySchema;function addEnumSchema(e,r){const n=e.schema||{};const i=getEnumValues(r.enum);e.schema=n;n.enum=i;n.type=getEnumType(i);if(r.enumName){e.enumName=r.enumName}}r.addEnumSchema=addEnumSchema;const isEnumArray=e=>e.isArray&&e.enum;r.isEnumArray=isEnumArray;const isEnumDefined=e=>e.enum;r.isEnumDefined=isEnumDefined;const isEnumMetadata=e=>{var r;return e.enum||e.isArray&&((r=e.items)===null||r===void 0?void 0:r["enum"])};r.isEnumMetadata=isEnumMetadata},67578:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.HttpStatus=void 0;var n;(function(e){e[e["CONTINUE"]=100]="CONTINUE";e[e["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";e[e["PROCESSING"]=102]="PROCESSING";e[e["EARLYHINTS"]=103]="EARLYHINTS";e[e["OK"]=200]="OK";e[e["CREATED"]=201]="CREATED";e[e["ACCEPTED"]=202]="ACCEPTED";e[e["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";e[e["NO_CONTENT"]=204]="NO_CONTENT";e[e["RESET_CONTENT"]=205]="RESET_CONTENT";e[e["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";e[e["AMBIGUOUS"]=300]="AMBIGUOUS";e[e["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";e[e["FOUND"]=302]="FOUND";e[e["SEE_OTHER"]=303]="SEE_OTHER";e[e["NOT_MODIFIED"]=304]="NOT_MODIFIED";e[e["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";e[e["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";e[e["BAD_REQUEST"]=400]="BAD_REQUEST";e[e["UNAUTHORIZED"]=401]="UNAUTHORIZED";e[e["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";e[e["FORBIDDEN"]=403]="FORBIDDEN";e[e["NOT_FOUND"]=404]="NOT_FOUND";e[e["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";e[e["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";e[e["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";e[e["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";e[e["CONFLICT"]=409]="CONFLICT";e[e["GONE"]=410]="GONE";e[e["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";e[e["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";e[e["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";e[e["URI_TOO_LONG"]=414]="URI_TOO_LONG";e[e["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";e[e["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";e[e["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";e[e["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";e[e["MISDIRECTED"]=421]="MISDIRECTED";e[e["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";e[e["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";e[e["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";e[e["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";e[e["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";e[e["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";e[e["BAD_GATEWAY"]=502]="BAD_GATEWAY";e[e["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";e[e["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";e[e["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(n=r.HttpStatus||(r.HttpStatus={}))},17392:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.swagger=void 0;const i=n(48353);const s=n(45573);const o=(0,s.safeRequire)("swagger-ui-dist");r.swagger={title:"My Project",description:"This is a swagger-ui for midwayjs project",version:"1.0.0",swaggerPath:"/swagger-ui",swaggerUIRender:o&&o.getAbsoluteFSPath?i.renderSwaggerUIDist:i.renderSwaggerUIRemote,swaggerUIRenderOptions:{},isGenerateTagForController:true}},36088:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.SwaggerConfiguration=void 0;const o=n(45573);const a=n(66466);const c=n(17392);let u=class SwaggerConfiguration{async onReady(e){const r=this.applicationManager.getApplications(["express","koa","egg","faas"]);if(r.length){const n=await e.getAsync(a.SwaggerExplorer);n.scanApp();let i=this.configService.getConfiguration("globalPrefix")||this.configService.getConfiguration("koa.globalPrefix")||this.configService.getConfiguration("express.globalPrefix")||this.configService.getConfiguration("egg.globalPrefix");if(i){if(!/^\//.test(i)){i="/"+i}n.addGlobalPrefix(i)}r.forEach((e=>{e.useMiddleware(a.SwaggerMiddleware)}))}}};i([(0,o.Inject)(),s("design:type",o.MidwayApplicationManager)],u.prototype,"applicationManager",void 0);i([(0,o.Inject)(),s("design:type",o.MidwayConfigService)],u.prototype,"configService",void 0);u=i([(0,o.Configuration)({importConfigs:[{default:c}],namespace:"swagger"})],u);r.SwaggerConfiguration=u},51123:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DECORATORS=r.DECORATORS_METHOD_METADATA=r.DECORATORS_CLASS_METADATA=r.DECORATORS_PREFIX=void 0;r.DECORATORS_PREFIX="swagger";r.DECORATORS_CLASS_METADATA="swagger:class_metadata";r.DECORATORS_METHOD_METADATA="swagger:method_metadata";r.DECORATORS={API_OPERATION:`${r.DECORATORS_PREFIX}/apiOperation`,API_RESPONSE:`${r.DECORATORS_PREFIX}/apiResponse`,API_TAGS:`${r.DECORATORS_PREFIX}/apiUseTags`,API_PARAMETERS:`${r.DECORATORS_PREFIX}/apiParameters`,API_HEADERS:`${r.DECORATORS_PREFIX}/apiHeaders`,API_MODEL_PROPERTIES:`${r.DECORATORS_PREFIX}/apiModelProperties`,API_EXTRA_MODEL:`${r.DECORATORS_PREFIX}/apiExtraModel`,API_MODEL_PROPERTIES_ARRAY:`${r.DECORATORS_PREFIX}/apiModelPropertiesArray`,API_SECURITY:`${r.DECORATORS_PREFIX}/apiSecurity`,API_EXCLUDE_SECURITY:`${r.DECORATORS_PREFIX}/apiExcludeSecurity`,API_EXCLUDE_ENDPOINT:`${r.DECORATORS_PREFIX}/apiExcludeEndpoint`,API_EXCLUDE_CONTROLLER:`${r.DECORATORS_PREFIX}/apiExcludeController`,API_EXTENSION:`${r.DECORATORS_PREFIX}/apiExtension`}},29821:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiBasicAuth=void 0;const i=n(84823);function ApiBasicAuth(e="basic"){return(0,i.ApiSecurity)(e)}r.ApiBasicAuth=ApiBasicAuth},97676:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiBearerAuth=void 0;const i=n(84823);function ApiBearerAuth(e="bearer"){return(0,i.ApiSecurity)(e)}r.ApiBearerAuth=ApiBearerAuth},54925:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiBody=r.BodyContentType=void 0;const i=n(92918);const s=n(46392);var o;(function(e){e["FormUrlEncoded"]="application/x-www-form-urlencoded";e["JSON"]="application/json";e["Multipart"]="multipart/form-data";e["MultipartMixed"]="multipart/mixed";e["OctetStream"]="application/octet-stream"})(o=r.BodyContentType||(r.BodyContentType={}));const a={type:String,required:true};function ApiBody(e){const[r,n]=(0,s.getTypeIsArrayTuple)(e.type,e.isArray);const o={in:"body",...e,type:r,isArray:n};if((0,i.isEnumArray)(e)){(0,i.addEnumArraySchema)(o,e)}else if((0,i.isEnumDefined)(e)){(0,i.addEnumSchema)(o,e)}return(0,s.createParamDecorator)(o,a)}r.ApiBody=ApiBody},39875:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiCookieAuth=void 0;const i=n(84823);function ApiCookieAuth(e="cookie"){return(0,i.ApiSecurity)(e)}r.ApiCookieAuth=ApiCookieAuth},49576:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiExcludeController=void 0;const i=n(45573);const s=n(51123);function ApiExcludeController(e=true){return r=>{(0,i.saveClassMetadata)(s.DECORATORS.API_EXCLUDE_CONTROLLER,{disable:e},r)}}r.ApiExcludeController=ApiExcludeController},1365:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiExcludeEndpoint=void 0;const i=n(51123);const s=n(46392);function ApiExcludeEndpoint(e=true){return(0,s.createMixedDecorator)(i.DECORATORS.API_EXCLUDE_ENDPOINT,true)}r.ApiExcludeEndpoint=ApiExcludeEndpoint},37762:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiExtension=void 0;const i=n(51123);const s=n(46392);function ApiExtension(e,r){if(!e.startsWith("x-")){throw new Error("Extension key is not prefixed. Please ensure you prefix it with `x-`.")}const n={[e]:JSON.parse(JSON.stringify(r))};return(0,s.createMixedDecorator)(i.DECORATORS.API_EXTENSION,n)}r.ApiExtension=ApiExtension},89041:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiExtraModel=void 0;const i=n(51123);const s=n(46392);function ApiExtraModel(e){return(0,s.createMixedDecorator)(i.DECORATORS.API_EXTRA_MODEL,e)}r.ApiExtraModel=ApiExtraModel},54596:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiHeaders=r.ApiHeader=void 0;const i=n(51123);const s=n(92918);const o=n(46392);const a={name:""};function ApiHeader(e){const r={name:!e.name?a.name:e.name,in:"header",description:e.description,required:e.required,schema:{...e.schema||{},type:"string"}};if(e.enum){const n=(0,s.getEnumValues)(e.enum);r.schema={enum:n,type:(0,s.getEnumType)(n)}}return(e,n,s)=>{if(s){return(0,o.createMixedDecorator)(i.DECORATORS.API_HEADERS,r)(e,n,s)}return(0,o.createMixedDecorator)(i.DECORATORS.API_HEADERS,r)(e,undefined,undefined)}}r.ApiHeader=ApiHeader;const ApiHeaders=e=>(r,n,i)=>{e.forEach((e=>ApiHeader(e)(r,n,i)))};r.ApiHeaders=ApiHeaders},30554:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiOAuth2=void 0;const i=n(84823);function ApiOAuth2(e,r="oauth2"){return(0,i.ApiSecurity)(r,e)}r.ApiOAuth2=ApiOAuth2},11806:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiOperation=void 0;const i=n(51123);const s=n(46392);const o={summary:""};function ApiOperation(e){return(0,s.createMixedDecorator)(i.DECORATORS.API_OPERATION,{...o,...e})}r.ApiOperation=ApiOperation},60690:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiParam=void 0;const i=n(46392);const s=n(92918);const o={name:"",required:true};function ApiParam(e){const r={name:!e.name?o.name:e.name,in:"path",...e};const n=e;if(n.enum){r.schema=r.schema||{};const e=r.schema;const i=(0,s.getEnumValues)(n.enum);e.type=(0,s.getEnumType)(i);e.enum=i;if(n.enumName){r.enumName=n.enumName}}return(0,i.createParamDecorator)(r,o)}r.ApiParam=ApiParam},35660:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiResponseProperty=r.ApiPropertyOptional=r.createApiPropertyDecorator=r.ApiProperty=void 0;const i=n(51123);const s=n(92918);const o=n(46392);const isEnumArray=e=>e.isArray&&!!e.enum;function ApiProperty(e={}){return createApiPropertyDecorator(e)}r.ApiProperty=ApiProperty;function createApiPropertyDecorator(e={}){const[r,n]=(0,o.getTypeIsArrayTuple)(e.type,e.isArray);e={...e,type:r};if(isEnumArray(e)){e.type="array";const r=(0,s.getEnumValues)(e.enum);e.items={type:(0,s.getEnumType)(r),enum:r};delete e.enum}else if(e.enum){const r=(0,s.getEnumValues)(e.enum);e.enum=r;e.type=(0,s.getEnumType)(r)}if(n){e.type="array";e.items={type:r}}return(0,o.createPropertyDecorator)(i.DECORATORS.API_MODEL_PROPERTIES,e)}r.createApiPropertyDecorator=createApiPropertyDecorator;function ApiPropertyOptional(e={}){return ApiProperty({...e,required:false})}r.ApiPropertyOptional=ApiPropertyOptional;function ApiResponseProperty(e={}){return ApiProperty({readOnly:true,...e})}r.ApiResponseProperty=ApiResponseProperty},92399:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiQuery=void 0;const i=n(92918);const s=n(46392);const o={name:"",required:true};function ApiQuery(e){const r=e;const[n,a]=(0,s.getTypeIsArrayTuple)(r.type,r.isArray);const c={name:!e.name?o.name:e.name,in:"query",...e,type:n};if((0,i.isEnumArray)(e)){(0,i.addEnumArraySchema)(c,e)}else if((0,i.isEnumDefined)(e)){(0,i.addEnumSchema)(c,e)}if(a){c.isArray=a}return(0,s.createParamDecorator)(c,o)}r.ApiQuery=ApiQuery},39638:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiDefaultResponse=r.ApiUnsupportedMediaTypeResponse=r.ApiUnprocessableEntityResponse=r.ApiServiceUnavailableResponse=r.ApiRequestTimeoutResponse=r.ApiPayloadTooLargeResponse=r.ApiPreconditionFailedResponse=r.ApiNotImplementedResponse=r.ApiNotAcceptableResponse=r.ApiMethodNotAllowedResponse=r.ApiGoneResponse=r.ApiGatewayTimeoutResponse=r.ApiForbiddenResponse=r.ApiConflictResponse=r.ApiBadGatewayResponse=r.ApiInternalServerErrorResponse=r.ApiNotFoundResponse=r.ApiTooManyRequestsResponse=r.ApiUnauthorizedResponse=r.ApiBadRequestResponse=r.ApiFoundResponse=r.ApiMovedPermanentlyResponse=r.ApiNoContentResponse=r.ApiAcceptedResponse=r.ApiCreatedResponse=r.ApiOkResponse=r.ApiResponse=void 0;const i=n(51123);const s=n(46392);const o=n(67578);function ApiResponse(e){const[r,n]=(0,s.getTypeIsArrayTuple)(e.type,e.isArray);e.type=r;e.isArray=n;e.description=e.description?e.description:"";const o={[e.status||"default"]:e};return(0,s.createMixedDecorator)(i.DECORATORS.API_RESPONSE,o)}r.ApiResponse=ApiResponse;const ApiOkResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.OK});r.ApiOkResponse=ApiOkResponse;const ApiCreatedResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.CREATED});r.ApiCreatedResponse=ApiCreatedResponse;const ApiAcceptedResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.ACCEPTED});r.ApiAcceptedResponse=ApiAcceptedResponse;const ApiNoContentResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.NO_CONTENT});r.ApiNoContentResponse=ApiNoContentResponse;const ApiMovedPermanentlyResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.MOVED_PERMANENTLY});r.ApiMovedPermanentlyResponse=ApiMovedPermanentlyResponse;const ApiFoundResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.FOUND});r.ApiFoundResponse=ApiFoundResponse;const ApiBadRequestResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.BAD_REQUEST});r.ApiBadRequestResponse=ApiBadRequestResponse;const ApiUnauthorizedResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.UNAUTHORIZED});r.ApiUnauthorizedResponse=ApiUnauthorizedResponse;const ApiTooManyRequestsResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.TOO_MANY_REQUESTS});r.ApiTooManyRequestsResponse=ApiTooManyRequestsResponse;const ApiNotFoundResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.NOT_FOUND});r.ApiNotFoundResponse=ApiNotFoundResponse;const ApiInternalServerErrorResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.INTERNAL_SERVER_ERROR});r.ApiInternalServerErrorResponse=ApiInternalServerErrorResponse;const ApiBadGatewayResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.BAD_GATEWAY});r.ApiBadGatewayResponse=ApiBadGatewayResponse;const ApiConflictResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.CONFLICT});r.ApiConflictResponse=ApiConflictResponse;const ApiForbiddenResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.FORBIDDEN});r.ApiForbiddenResponse=ApiForbiddenResponse;const ApiGatewayTimeoutResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.GATEWAY_TIMEOUT});r.ApiGatewayTimeoutResponse=ApiGatewayTimeoutResponse;const ApiGoneResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.GONE});r.ApiGoneResponse=ApiGoneResponse;const ApiMethodNotAllowedResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.METHOD_NOT_ALLOWED});r.ApiMethodNotAllowedResponse=ApiMethodNotAllowedResponse;const ApiNotAcceptableResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.NOT_ACCEPTABLE});r.ApiNotAcceptableResponse=ApiNotAcceptableResponse;const ApiNotImplementedResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.NOT_IMPLEMENTED});r.ApiNotImplementedResponse=ApiNotImplementedResponse;const ApiPreconditionFailedResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.PRECONDITION_FAILED});r.ApiPreconditionFailedResponse=ApiPreconditionFailedResponse;const ApiPayloadTooLargeResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.PAYLOAD_TOO_LARGE});r.ApiPayloadTooLargeResponse=ApiPayloadTooLargeResponse;const ApiRequestTimeoutResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.REQUEST_TIMEOUT});r.ApiRequestTimeoutResponse=ApiRequestTimeoutResponse;const ApiServiceUnavailableResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.SERVICE_UNAVAILABLE});r.ApiServiceUnavailableResponse=ApiServiceUnavailableResponse;const ApiUnprocessableEntityResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.UNPROCESSABLE_ENTITY});r.ApiUnprocessableEntityResponse=ApiUnprocessableEntityResponse;const ApiUnsupportedMediaTypeResponse=(e={})=>ApiResponse({...e,status:o.HttpStatus.UNSUPPORTED_MEDIA_TYPE});r.ApiUnsupportedMediaTypeResponse=ApiUnsupportedMediaTypeResponse;const ApiDefaultResponse=(e={})=>ApiResponse({...e,status:"default"});r.ApiDefaultResponse=ApiDefaultResponse},84823:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiExcludeSecurity=r.ApiSecurity=void 0;const i=n(51123);const s=n(46392);function ApiSecurity(e,r=[]){let n;if(typeof e==="string"){n={[e]:r||[]}}else{n=e}return(0,s.createMixedDecorator)(i.DECORATORS.API_SECURITY,n)}r.ApiSecurity=ApiSecurity;function ApiExcludeSecurity(){return(0,s.createMixedDecorator)(i.DECORATORS.API_EXCLUDE_SECURITY,true)}r.ApiExcludeSecurity=ApiExcludeSecurity},38780:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ApiTags=void 0;const i=n(51123);const s=n(46392);function ApiTags(e){return(0,s.createMixedDecorator)(i.DECORATORS.API_TAGS,e)}r.ApiTags=ApiTags},46392:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.getSchemaPath=r.getTypeIsArrayTuple=r.createParamDecorator=r.createMixedDecorator=r.createPropertyDecorator=void 0;const i=n(45573);const s=n(51123);function createPropertyDecorator(e,r){return(0,i.createCustomPropertyDecorator)(e,r,false)}r.createPropertyDecorator=createPropertyDecorator;function createMixedDecorator(e,r){return(n,o)=>{if(o){(0,i.attachPropertyDataToClass)(s.DECORATORS_METHOD_METADATA,{key:e,propertyName:o,metadata:r},n,o)}else{(0,i.attachClassMetadata)(s.DECORATORS_CLASS_METADATA,{key:e,metadata:r},n)}}}r.createMixedDecorator=createMixedDecorator;function createParamDecorator(e,r){return createMixedDecorator(s.DECORATORS.API_PARAMETERS,{...r,...e})}r.createParamDecorator=createParamDecorator;function getTypeIsArrayTuple(e,r){if(!e){return[e,r]}if(r){return[e,r]}const n=Array.isArray(e);const i=n?e[0]:e;return[i,n]}r.getTypeIsArrayTuple=getTypeIsArrayTuple;function getSchemaPath(e){let r=e;if(typeof e!=="string"){r=e?e.name:e}return`#/components/schemas/${r}`}r.getSchemaPath=getSchemaPath},75389:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.getSchemaPath=r.ApiResponseProperty=r.ApiPropertyOptional=r.ApiProperty=void 0;s(n(54925),r);s(n(1365),r);s(n(49576),r);s(n(54596),r);s(n(11806),r);s(n(60690),r);var o=n(35660);Object.defineProperty(r,"ApiProperty",{enumerable:true,get:function(){return o.ApiProperty}});Object.defineProperty(r,"ApiPropertyOptional",{enumerable:true,get:function(){return o.ApiPropertyOptional}});Object.defineProperty(r,"ApiResponseProperty",{enumerable:true,get:function(){return o.ApiResponseProperty}});s(n(92399),r);s(n(39638),r);s(n(38780),r);s(n(37762),r);s(n(29821),r);s(n(97676),r);s(n(39875),r);s(n(30554),r);s(n(84823),r);s(n(89041),r);var a=n(46392);Object.defineProperty(r,"getSchemaPath",{enumerable:true,get:function(){return a.getSchemaPath}})},54850:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DocumentBuilder=void 0;class DocumentBuilder{constructor(){this.document={openapi:"3.0.1",info:{title:"",description:"",version:"1.0.0",contact:{}},tags:[],servers:[],components:{},paths:{}}}setTitle(e){this.document.info.title=e;return this}setDescription(e){this.document.info.description=e;return this}setVersion(e){this.document.info.version=e;return this}setTermsOfService(e){this.document.info.termsOfService=e;return this}setContact(e,r,n){this.document.info.contact={name:e,url:r,email:n};return this}setLicense(e,r){this.document.info.license={name:e,url:r};return this}addServer(e,r,n){this.document.servers.push({url:e,description:r,variables:n});return this}setExternalDoc(e,r){this.document.externalDocs={description:e,url:r};return this}addPaths(e){Object.assign(this.document.paths,e);return this}getPaths(){return this.document.paths}setPaths(e){this.document.paths=e;return this}addSchema(e){if(!this.document.components.schemas){this.document.components.schemas={}}Object.assign(this.document.components.schemas,e);return this}getSchema(e){var r,n;if((r=this.document.components)===null||r===void 0?void 0:r.schemas){return(n=this.document.components)===null||n===void 0?void 0:n.schemas[e]}return undefined}addTag(e,r="",n){const i=this.document.tags||[];if(Array.isArray(e)){const r=e;for(const n of r){if(!i.find((r=>r.name===e))){i.push({name:n,description:""})}}return this}if(!i.find((r=>r.name===e))){i.push({name:e,description:r,externalDocs:n})}else{i.forEach((i=>{if(i.name===e){if(r){i.description=r}if(n){i.externalDocs=n}}}))}this.document.tags=i;return this}addSecurity(e,r){this.document.components.securitySchemes={...this.document.components.securitySchemes||{},[e]:r};return this}addSecurityRequirements(e,r=[]){let n;if(typeof e==="string"){n={[e]:r}}else{n=e}this.document.security=(this.document.security||[]).concat({...n});return this}addBearerAuth(e={type:"http"},r="bearer"){this.addSecurity(r,{type:"http",scheme:"bearer",bearerFormat:"JWT",...e});return this}addOAuth2(e={type:"oauth2"},r="oauth2"){if(!r){r="oauth2"}this.addSecurity(r,{type:"oauth2",flows:{...e===null||e===void 0?void 0:e.flows}});return this}addApiKey(e={type:"apiKey"},r="api_key"){if(!r){r="api_key"}this.addSecurity(r,{type:"apiKey",in:"header",name:r,...e});return this}addBasicAuth(e={type:"http"},r="basic"){if(!r){r="basic"}this.addSecurity(r,{type:"http",scheme:"basic",...e});return this}addCookieAuth(e="connect.sid",r={type:"apiKey"},n="cookie"){if(!e){e="connect.sid"}if(!n){n="cookie"}this.addSecurity(n,{type:"apiKey",in:"cookie",name:e,...r});return this}sortTags(){const e=this.document.tags;this.document.tags=e.sort(((e,r)=>{const n=e.name;const i=r.name;const s=n.length>i.length?i.length:n.length;for(let e=0;e<s;e++){if(n.charCodeAt(e)>i.charCodeAt(e)){return 1}else if(n.charCodeAt(e)<i.charCodeAt(e)){return-1}}return 0}))}build(){return this.document}}r.DocumentBuilder=DocumentBuilder},66466:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.renderJSON=r.renderSwaggerUIDist=r.renderSwaggerUIRemote=r.SwaggerMiddleware=r.SwaggerExplorer=r.Configuration=void 0;s(n(75389),r);s(n(84263),r);var o=n(36088);Object.defineProperty(r,"Configuration",{enumerable:true,get:function(){return o.SwaggerConfiguration}});var a=n(50165);Object.defineProperty(r,"SwaggerExplorer",{enumerable:true,get:function(){return a.SwaggerExplorer}});var c=n(79126);Object.defineProperty(r,"SwaggerMiddleware",{enumerable:true,get:function(){return c.SwaggerMiddleware}});var u=n(48353);Object.defineProperty(r,"renderSwaggerUIRemote",{enumerable:true,get:function(){return u.renderSwaggerUIRemote}});Object.defineProperty(r,"renderSwaggerUIDist",{enumerable:true,get:function(){return u.renderSwaggerUIDist}});Object.defineProperty(r,"renderJSON",{enumerable:true,get:function(){return u.renderJSON}});s(n(51123),r)},84263:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true})},50165:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.SwaggerExplorer=void 0;const o=n(45573);const a=n(51123);const c=n(54850);const u=n(66466);const p=n(92918);let g=class SwaggerExplorer{constructor(){this.swaggerConfig={};this.documentBuilder=new c.DocumentBuilder;this.operationIdFactory=(e,r)=>`${e.toLowerCase()}_${r.method.toLocaleLowerCase()}`}async init(){var e,r,n,i,s,o,a,c,u,p,g,v,b,_,E,x,T,w,C,A,k,P,I,R,N,L,B,j,U,q,V;this.documentBuilder.setTitle(this.swaggerConfig.title);this.documentBuilder.setVersion(this.swaggerConfig.version);this.documentBuilder.setDescription(this.swaggerConfig.description);if(((e=this.swaggerConfig)===null||e===void 0?void 0:e.contact)&&typeof((r=this.swaggerConfig)===null||r===void 0?void 0:r.contact)==="object"){this.documentBuilder.setContact((i=(n=this.swaggerConfig)===null||n===void 0?void 0:n.contact)===null||i===void 0?void 0:i.name,(o=(s=this.swaggerConfig)===null||s===void 0?void 0:s.contact)===null||o===void 0?void 0:o.url,(c=(a=this.swaggerConfig)===null||a===void 0?void 0:a.contact)===null||c===void 0?void 0:c.email)}if(((u=this.swaggerConfig)===null||u===void 0?void 0:u.license)&&typeof((p=this.swaggerConfig)===null||p===void 0?void 0:p.license)==="object"){this.documentBuilder.setLicense((v=(g=this.swaggerConfig)===null||g===void 0?void 0:g.license)===null||v===void 0?void 0:v.name,(_=(b=this.swaggerConfig)===null||b===void 0?void 0:b.license)===null||_===void 0?void 0:_.url)}if(this.swaggerConfig.termsOfService){this.documentBuilder.setTermsOfService(this.swaggerConfig.termsOfService)}if(((E=this.swaggerConfig)===null||E===void 0?void 0:E.externalDocs)&&typeof((x=this.swaggerConfig)===null||x===void 0?void 0:x.externalDocs)==="object"){this.documentBuilder.setExternalDoc((w=(T=this.swaggerConfig)===null||T===void 0?void 0:T.externalDocs)===null||w===void 0?void 0:w.description,(A=(C=this.swaggerConfig)===null||C===void 0?void 0:C.externalDocs)===null||A===void 0?void 0:A.url)}if(((k=this.swaggerConfig)===null||k===void 0?void 0:k.servers)&&Array.isArray((P=this.swaggerConfig)===null||P===void 0?void 0:P.servers)){for(const e of(I=this.swaggerConfig)===null||I===void 0?void 0:I.servers){this.documentBuilder.addServer(e===null||e===void 0?void 0:e.url,e===null||e===void 0?void 0:e.description,e===null||e===void 0?void 0:e.variables)}}if(((R=this.swaggerConfig)===null||R===void 0?void 0:R.tags)&&Array.isArray((N=this.swaggerConfig)===null||N===void 0?void 0:N.tags)){for(const e of(L=this.swaggerConfig)===null||L===void 0?void 0:L.tags){this.documentBuilder.addTag(e.name,e.description,e.externalDocs)}}if((j=(B=this.swaggerConfig)===null||B===void 0?void 0:B.documentOptions)===null||j===void 0?void 0:j.operationIdFactory){this.operationIdFactory=this.swaggerConfig.documentOptions.operationIdFactory}if(Array.isArray((U=this.swaggerConfig)===null||U===void 0?void 0:U.auth)){for(const e of(q=this.swaggerConfig)===null||q===void 0?void 0:q.auth){this.setAuth(e)}}else{this.setAuth((V=this.swaggerConfig)===null||V===void 0?void 0:V.auth)}}addGlobalPrefix(e){if(!e){return}const r=this.documentBuilder.getPaths();const n={};for(const[i,s]of Object.entries(r)){if(!/^\//.test(i)){n[`${e}/${i}`]=s}else{n[`${e}${i}`]=s}}this.documentBuilder.setPaths(n)}scanApp(){var e;const r=(0,o.listModule)(o.CONTROLLER_KEY);for(const e of r){this.generatePath(e)}if((e=this.swaggerConfig)===null||e===void 0?void 0:e.tagSortable){this.documentBuilder.sortTags()}}getData(){return this.documentBuilder.build()}getDocumentBuilder(){return this.documentBuilder}generatePath(e){var r;const n=(0,o.getClassMetadata)(a.DECORATORS.API_EXCLUDE_CONTROLLER,e);if(n&&n.disable){return}const i=(r=this.swaggerConfig.isGenerateTagForController)!==null&&r!==void 0?r:true;this.parseExtraModel(e);const s=(0,o.getClassMetadata)(a.DECORATORS_CLASS_METADATA,e)||[];const c=(0,o.getClassMetadata)(o.INJECT_CUSTOM_PARAM,e)||[];const u=(0,o.getClassMetadata)(o.CONTROLLER_KEY,e);const p=u.prefix;const g=s.filter((e=>e.key===a.DECORATORS.API_TAGS));let v=[];const b=[];if(g.length>0){v=parseTags(g);v.forEach((e=>{addTag(e,b)}))}else{if(i){const e={name:"",description:""};if(p!=="/"){e.name=(u===null||u===void 0?void 0:u.routerOptions.tagName)||(/^\//.test(p)?p.split("/")[1]:p);e.description=(u===null||u===void 0?void 0:u.routerOptions.description)||e.name}else{e.name=u===null||u===void 0?void 0:u.routerOptions.tagName;e.description=(u===null||u===void 0?void 0:u.routerOptions.description)||e.name}if(e.name){v.push(e.name);addTag([e.name,e.description],b)}}else{}}const _=(0,o.getClassMetadata)(o.WEB_ROUTER_KEY,e);let E=s.filter((e=>e.key===a.DECORATORS.API_HEADERS));if(E.length>0){E=E.map((e=>e.metadata))}const x=s.filter((e=>e.key===a.DECORATORS.API_SECURITY));const T={};if(_&&typeof _[Symbol.iterator]==="function"){for(const r of _){let n=(p+r.path).replace("//","/");n=replaceUrl(n,parseParamsInPath(n));const i=(0,o.getPropertyDataFromClass)(a.DECORATORS_METHOD_METADATA,e,r.method)||[];const u=i.filter((e=>e.key===a.DECORATORS.API_SECURITY));const g=i.filter((e=>e.key===a.DECORATORS.API_EXCLUDE_ENDPOINT&&e.propertyName===r.method));if(g[0]){continue}if(this.swaggerConfig.routerFilter){const e=this.swaggerConfig.routerFilter(n,r);if(e){continue}}const _=c[r.method]||[];const w=_.filter((e=>{var r;return e.key===o.WEB_ROUTER_PARAM_KEY&&((r=e===null||e===void 0?void 0:e.metadata)===null||r===void 0?void 0:r.type)===o.RouteParamTypes.BODY}));if(w.length>1){continue}this.generateRouteMethod(n,r,T,i,_,E,e);if(T[n][r.requestMethod].tags.length===0){T[n][r.requestMethod].tags=v}else{T[n][r.requestMethod].tags.forEach((e=>{addTag(e,b)}))}const C=i.filter((e=>e.key===a.DECORATORS.API_EXTENSION&&e.propertyName===r.method));for(const e of C){if(e.metadata){Object.assign(T[n][r.requestMethod],e.metadata)}}const A=i.find((e=>e.key===a.DECORATORS.API_EXCLUDE_SECURITY));const k=u.length>0;const P=s.find((e=>e.key===a.DECORATORS.API_EXCLUDE_SECURITY));const I=x.length>0;if(A){T[n][r.requestMethod].security=[]}else if(k){T[n][r.requestMethod].security=u.map((e=>e.metadata)).filter(Boolean)}else if(P){T[n][r.requestMethod].security=[]}else if(I){T[n][r.requestMethod].security=x.map((e=>e.metadata)).filter(Boolean)}}}this.documentBuilder.addPaths(T);if(Object.keys(T).length>0){b.forEach((e=>{if(Array.isArray(e)){this.documentBuilder.addTag(e[0],e[1])}else{this.documentBuilder.addTag(e)}}))}}generateRouteMethod(e,r,n,i,s,c,p){var g,v,b,_,E,x,T,w,C,A,k,P,I,R,N,L,B,j,U;const q=i.filter((e=>e.key===a.DECORATORS.API_OPERATION&&e.propertyName===r.method))[0];const V=i.filter((e=>e.key===a.DECORATORS.API_TAGS&&e.propertyName===r.method));const z=parseTags(V);let K=n[e];if(!K){K={}}const W=[];K[r.requestMethod]={summary:getNotEmptyValue((g=q===null||q===void 0?void 0:q.metadata)===null||g===void 0?void 0:g.summary,r.summary),description:getNotEmptyValue((v=q===null||q===void 0?void 0:q.metadata)===null||v===void 0?void 0:v.description,r.description),operationId:((b=q===null||q===void 0?void 0:q.metadata)===null||b===void 0?void 0:b.operationId)||this.getOperationId(p.name,r),tags:z.length?z:(E=(_=q===null||q===void 0?void 0:q.metadata)===null||_===void 0?void 0:_.tags)!==null&&E!==void 0?E:[]};if(((x=q===null||q===void 0?void 0:q.metadata)===null||x===void 0?void 0:x.deprecated)!=null){K[r.requestMethod].deprecated=!!((T=q===null||q===void 0?void 0:q.metadata)===null||T===void 0?void 0:T.deprecated)}const H=s.filter((e=>{var r;return e.key===o.WEB_ROUTER_PARAM_KEY&&((r=e===null||e===void 0?void 0:e.metadata)===null||r===void 0?void 0:r.type)!==o.RouteParamTypes.CUSTOM}));const G=(0,o.getMethodParamTypes)(p,r.method);const X=i.filter((e=>e.key===a.DECORATORS.API_PARAMETERS&&e.propertyName===r.method));for(const e of X){if(e.metadata.schema===undefined){e.metadata.schema={};if(e.metadata.type){e.metadata.schema["type"]=e.metadata.type;delete e.metadata.type}if(e.metadata.isArray){e.metadata.schema["items"]={type:e.metadata.schema["type"]};e.metadata.schema["type"]="array";delete e.metadata.isArray}if(e.metadata.enum!==undefined){e.metadata.schema.enum=e.metadata.enum;delete e.metadata.enum}}else{delete e.metadata.type;delete e.metadata.isArray;delete e.metadata.enum}const n=e.metadata;n.schema=this.formatType(e.metadata.schema);if(n.in==="query"||n.in==="path"||n.in==="header"){W.push(n)}else if(n.in==="body"){n.content=(w=n.content)!==null&&w!==void 0?w:{};if(Object.keys(n.content).length===0){n.content[n.contentType||"application/json"]=(C=n.content[n.contentType||"application/json"])!==null&&C!==void 0?C:{schema:n.schema}}for(const e in n.content){n.content[e].schema=this.formatType(n.content[e].schema)}K[r.requestMethod].requestBody=(A=K[r.requestMethod].requestBody)!==null&&A!==void 0?A:{};K[r.requestMethod].requestBody.description=(k=K[r.requestMethod].requestBody.description)!==null&&k!==void 0?k:n.description;K[r.requestMethod].requestBody.content=(P=K[r.requestMethod].requestBody.content)!==null&&P!==void 0?P:n.content;K[r.requestMethod].requestBody.required=(I=K[r.requestMethod].requestBody.required)!==null&&I!==void 0?I:n.required}}for(const n of H){const i=G[n.parameterIndex];const s={name:(R=n===null||n===void 0?void 0:n.metadata)===null||R===void 0?void 0:R.propertyData,in:convertTypeToString((N=n.metadata)===null||N===void 0?void 0:N.type),required:false};const a=W.find((e=>{var r;return e.name===((r=n===null||n===void 0?void 0:n.metadata)===null||r===void 0?void 0:r.propertyData)&&e.in===s.in}));if(a){continue}if(s.in==="path"){s.required=true;if(e.indexOf("{"+s.name+"}")===-1){continue}}if(o.Types.isClass(i)){this.parseClzz(i)}if(s.in==="query"||s.in==="path"){if(o.Types.isClass(i)){const e=this.documentBuilder.getSchema(i.name);Object.keys(e.properties).forEach((r=>{var n,i;const o={name:r,in:s.in,description:(n=e.properties[r])===null||n===void 0?void 0:n.description,schema:e.properties[r],required:((i=e.required)===null||i===void 0?void 0:i.includes(r))||false};W.push(o)}));continue}else{if(!s.name){continue}s.schema={type:convertSchemaType((L=i===null||i===void 0?void 0:i.name)!==null&&L!==void 0?L:i)}}}else if(s.in==="body"){if(r.requestMethod===o.RequestMethod.GET){continue}if(K[r.requestMethod].requestBody){continue}if(((B=n.metadata)===null||B===void 0?void 0:B.type)===o.RouteParamTypes.FILESSTREAM){s.content={};s.content[u.BodyContentType.Multipart]={schema:{type:"object",properties:{files:{type:"array",items:{type:"string",format:"binary"},description:s.description}}}}}else if(((j=n.metadata)===null||j===void 0?void 0:j.type)===o.RouteParamTypes.FILESTREAM){s.content={};s.content[u.BodyContentType.Multipart]={schema:{type:"object",properties:{file:{type:"string",format:"binary",description:s.description}}}}}else{if(o.Types.isClass(i)){s.content={"application/json":{schema:{$ref:"#/components/schemas/"+i.name}}}}else{s.content={"text/plain":{schema:{type:convertSchemaType((U=i===null||i===void 0?void 0:i.name)!==null&&U!==void 0?U:i)}}}}}K[r.requestMethod].requestBody={required:true,description:s.description||s.name,content:s.content};continue}W.push(s)}if(c&&c.length){c.forEach((e=>W.unshift(e)))}const Y=i.filter((e=>e.key===a.DECORATORS.API_HEADERS));if(Y.length>0){Y.forEach((e=>W.unshift(e.metadata)))}K[r.requestMethod].parameters=W;const J=i.filter((e=>e.key===a.DECORATORS.API_RESPONSE&&e.propertyName===r.method));const Q={};for(const e of J){const r=e.metadata;const n=Object.keys(r);for(const e of n){const n=r[e];if(n.schema){n.content={"application/json":{schema:this.formatType(n.schema)}};delete n.schema}else if(n.type){if(o.Types.isClass(n.type)){this.parseClzz(n.type);if(n.isArray){n.content={"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/"+n.type.name}}}}}else{n.content={"application/json":{schema:{$ref:"#/components/schemas/"+n.type.name}}}}}else{n.content={"text/plain":{schema:{type:convertSchemaType(n.type)}}}}}delete n.status;delete n.type;delete n.isArray;delete n.format}Object.assign(Q,r)}if(Object.keys(Q).length>0){K[r.requestMethod].responses=Q}else{K[r.requestMethod].responses={200:{description:"OK"}}}n[e]=K}getOperationId(e,r){return this.operationIdFactory(e,r)}parseExtraModel(e){const r=(0,o.getClassMetadata)(a.DECORATORS_CLASS_METADATA,e)||[];const n=r.filter((e=>e.key===a.DECORATORS.API_EXTRA_MODEL));for(const e of n){if(Array.isArray(e.metadata)){for(const r of e.metadata){this.parseClzz(r)}}else{this.parseClzz(e.metadata)}}}parseSubPropertyType(e){var r,n,i;let s;if(e===null||e===void 0?void 0:e.enum){s={type:e===null||e===void 0?void 0:e.type,enum:e===null||e===void 0?void 0:e.enum,default:e===null||e===void 0?void 0:e.default};if(e===null||e===void 0?void 0:e.description){s.description=e===null||e===void 0?void 0:e.description}return s}if((r=e===null||e===void 0?void 0:e.items)===null||r===void 0?void 0:r.enum){s={type:e===null||e===void 0?void 0:e.type,items:e===null||e===void 0?void 0:e.items,default:e===null||e===void 0?void 0:e.default};if(e===null||e===void 0?void 0:e.description){s.description=e===null||e===void 0?void 0:e.description}return s}let a=false;let c=parseTypeSchema(e===null||e===void 0?void 0:e.type);e===null||e===void 0?true:delete e.type;if(c==="array"){a=true;c=parseTypeSchema((n=e===null||e===void 0?void 0:e.items)===null||n===void 0?void 0:n.type);e===null||e===void 0?true:delete e.items.type}if(e===null||e===void 0?void 0:e.oneOf){s={oneOf:[]};e===null||e===void 0?void 0:e.oneOf.forEach((e=>{s.push(this.parseSubPropertyType(e))}));e===null||e===void 0?true:delete e.oneOf}if(o.Types.isClass(c)){this.parseClzz(c);if(a){s={type:"array",items:{$ref:"#/components/schemas/"+(c===null||c===void 0?void 0:c.name)}}}else{s={$ref:"#/components/schemas/"+(c===null||c===void 0?void 0:c.name)}}delete e.items}else{if(a){if(!c){if((i=e===null||e===void 0?void 0:e.items)===null||i===void 0?void 0:i["$ref"]){e.items["$ref"]=parseTypeSchema(e.items["$ref"])}s={type:"array",items:e===null||e===void 0?void 0:e.items}}else{s={type:"array",items:{type:convertSchemaType((c===null||c===void 0?void 0:c.name)||c)}}}delete e.items}else{s={type:c,format:e===null||e===void 0?void 0:e.format};if(s.type==="Date"){s.type="string";if(!s.format){s.format="date"}}delete e.format}}return Object.assign(s,e)}formatType(e){if(e===null){return null}if(e.enum){if(Array.isArray(e.enum)){e.enum.map((e=>this.formatType(e)))}else{e.enum=(0,p.getEnumValues)(e.enum)}}if(e.not){e.not=this.formatType(e.not)}if(e["$ref"]&&typeof e["$ref"]==="function"){e["$ref"]=e["$ref"]()}if(e.oneOf){e.oneOf=e.oneOf.map((e=>this.formatType(e)))}else if(e.anyOf){e.anyOf=e.anyOf.map((e=>this.formatType(e)))}else if(e.allOf){e.allOf=e.allOf.map((e=>this.formatType(e)))}["not","$ref","oneOf","anyOf","allOf"].forEach((r=>{if(e[r]){delete e["type"]}}));if(e.properties){const r={};for(const n in e.properties){r[n]=this.formatType(e.properties[n])}e.properties=r}if(e.additionalProperties){e.additionalProperties=this.formatType(e.additionalProperties)}if(["string","number","boolean","integer"].includes(e.type)){}else if(e.type===Number){e.type="number"}else if(e.type===String){e.type="string"}else if(e.type===Boolean){e.type="boolean"}else if(e.type==="date"||e.type==="Date"||e.type===Date){e.type="string";e.format="date-time"}else if(e.type===Array||e.type==="array"){e.type="array";if(e.items){e.items=this.formatType(e.items)}}else if(Array.isArray(e.type)){e.items=this.formatType({type:e.type[0]});e.type="array"}else if(e.type===Object||e.type==="object"){e.type="object"}else if(o.Types.isClass(e.type)){this.parseClzz(e.type);e["$ref"]="#/components/schemas/"+e.type.name;delete e["type"]}else if(e.type instanceof Function){e.type=e.type();this.formatType(e)}return e}parseClzz(e){if(this.documentBuilder.getSchema(e.name)){return this.documentBuilder.getSchema(e.name)}this.parseExtraModel(e);const r=(0,o.getClassExtendedMetadata)(o.INJECT_CUSTOM_PROPERTY,e);const n={type:"object",properties:{}};this.documentBuilder.addSchema({[e.name]:n});if(r){for(const i of Object.keys(r)){const s=r[i].metadata||{};if(!s.type){s.type=(0,o.getPropertyType)(e.prototype,i).name}n.properties[i]=n.properties[i]||{};for(const e in s){if(e==="required"&&s["required"]){if(!n.required){n.required=[]}n.required.push(i)}else if(["oneOf","anyOf","allOf"].includes(e)){n.properties[i][e]=[];s[e].forEach((r=>{n.properties[i][e].push(this.formatType(r))}))}else if(e==="not"){n.properties[i][e]=this.formatType(s[e])}else if(e==="type"){this.formatType(s);if(s.type){n.properties[i].type=s.type}if(s["$ref"]){n.properties[i].$ref=s["$ref"]}if(s.items){n.properties[i].items=s.items}if(s.format){n.properties[i].format=s.format}if(s.pattern){n.properties[i].pattern=s.pattern}if(s.enum){n.properties[i].enum=s.enum}}else if(e==="items"||e==="pattern"||e==="format"||e==="enum"||e==="$ref"){}else{n.properties[i][e]=s[e]}}}}return n}setAuth(e){if(!e){return}const{authType:r,name:n="",addSecurityRequirements:i=false,...s}=e;if(!r){return}switch(r){case"basic":{this.documentBuilder.addBasicAuth(s,n);break}case"bearer":{this.documentBuilder.addBearerAuth(s,n);break}case"cookie":{const{cookieName:e,securityName:r,...n}=s;this.documentBuilder.addCookieAuth(e,n,r);break}case"oauth2":{this.documentBuilder.addOAuth2(s,n);break}case"apikey":{this.documentBuilder.addApiKey(s,n);break}case"custom":{this.documentBuilder.addSecurity(n,s);break}}if(i){this.documentBuilder.addSecurityRequirements(n)}}};i([(0,o.Config)("swagger"),s("design:type",Object)],g.prototype,"swaggerConfig",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],g.prototype,"init",null);g=i([(0,o.Provide)(),(0,o.Scope)(o.ScopeEnum.Singleton)],g);r.SwaggerExplorer=g;function parseParamsInPath(e){const r=[];e.split("/").forEach((e=>{if(e.startsWith(":")){const n=e.slice(1);r.push(n)}}));return r}function replaceUrl(e,r){r.forEach((r=>{e=e.replace(`:${r}`,`{${r}}`)}));return e}function convertTypeToString(e){switch(e){case o.RouteParamTypes.HEADERS:return"header";case o.RouteParamTypes.QUERY:return"query";case o.RouteParamTypes.PARAM:return"path";case o.RouteParamTypes.BODY:case o.RouteParamTypes.FIELDS:case o.RouteParamTypes.FILESSTREAM:case o.RouteParamTypes.FILESTREAM:return"body";default:return"header"}}function convertSchemaType(e){switch(e){case"Object":return"object";case"Boolean":return"boolean";case"Number":return"number";case"String":return"string";default:return"object"}}function getNotEmptyValue(...e){for(const r of e){if(r){return r}}}function parseTypeSchema(e){switch(e){case String:return"string";case Number:return"number";case Boolean:return"boolean";default:if(typeof e==="function"&&!o.Types.isClass(e)){e=e()}return e}}function parseTags(e){let r=[];if(e.length>0){for(const n of e){r=r.concat(n.metadata)}}return r}function addTag(e,r=[]){if(r.find((r=>{if(Array.isArray(e)){return r===e[0]}else{return r===e}}))){}else{r.push(e)}}},79126:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.SwaggerMiddleware=void 0;const o=n(45573);const a=n(50165);let c=class SwaggerMiddleware{async init(){if(typeof this.swaggerConfig.swaggerUIRender!=="function"){throw new o.MidwayInvalidConfigPropertyError("swagger.swaggerRender")}this.swaggerRender=this.swaggerConfig.swaggerUIRender(this.swaggerConfig,this.swaggerExplorer)}resolve(e){if(e.getNamespace()==="express"){return async(e,r,n)=>{const i=e.path;const s=await this.swaggerRender(i);if(s){const{ext:e,content:n}=s;if(e===".js"){r.type("application/javascript")}else if(e===".map"){r.type("application/json")}else if(e===".css"){r.type("text/css")}else if(e===".png"){r.type("image/png")}r.send(n)}else{return n()}}}else{return async(e,r)=>{const n=e.path;const i=await this.swaggerRender(n);if(i){const{ext:r,content:n}=i;if(r===".js"){e.set("Content-Type","application/javascript")}else if(r===".map"){e.set("Content-Type","application/json")}else if(r===".css"){e.set("Content-Type","text/css")}else if(r===".png"){e.set("Content-Type","image/png")}e.body=n}else{return r()}}}}static getName(){return"swagger"}};i([(0,o.Config)("swagger"),s("design:type",Object)],c.prototype,"swaggerConfig",void 0);i([(0,o.Inject)(),s("design:type",a.SwaggerExplorer)],c.prototype,"swaggerExplorer",void 0);i([(0,o.Inject)(),s("design:type",o.MidwayEnvironmentService)],c.prototype,"environmentService",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],c.prototype,"init",null);c=i([(0,o.Provide)(),(0,o.Scope)(o.ScopeEnum.Singleton)],c);r.SwaggerMiddleware=c},48353:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.renderSwaggerUIRemote=r.renderJSON=r.renderSwaggerUIDist=void 0;const i=n(45573);const s=n(79896);const o=n(16928);function renderSwaggerUIDist(e,r){const{getAbsoluteFSPath:n}=(0,i.safeRequire)("swagger-ui-dist");if(!n){throw new i.MidwayCommonError("swagger-ui-dist is not installed")}const a=e.swaggerUIRenderOptions||{};if(a.customInitializer){if((0,o.isAbsolute)(a.customInitializer)){a.customInitializer=(0,s.readFileSync)(a.customInitializer)}else{throw new i.MidwayInvalidConfigPropertyError("swagger.swaggerRenderOptions.customInitializer",["Buffer","String"])}}function replaceInfo(r){let n=`location.href.replace('${e.swaggerPath}/index.html', '${e.swaggerPath}/index.json'),\n validatorUrl: null,`;if(e.displayOptions){Object.keys(e.displayOptions).forEach((r=>{n+=`\n${r}: ${e.displayOptions[r]},`}))}return r.replace('"https://petstore.swagger.io/v2/swagger.json",',n)}const c=n();return async n=>{if(!c||n.indexOf(e.swaggerPath)===-1){return}const i=n.split("/");let u=i.pop();if(u==="index.json"){return{ext:"json",content:r.getData()}}if(!u){u="index.html"}let p=(0,s.readFileSync)((0,o.join)(c,u));if(u==="swagger-initializer.js"&&(a===null||a===void 0?void 0:a.customInitializer)){return{ext:"js",content:a.customInitializer}}if(u==="index.html"||u==="swagger-initializer.js"){p=p.toString("utf8");p=replaceInfo(p)}const g=(0,o.extname)(u);return{ext:g,content:p}}}r.renderSwaggerUIDist=renderSwaggerUIDist;function renderJSON(e,r){return async n=>{if(n.indexOf(e.swaggerPath)===-1){return}const i=n.split("/");const s=i.pop();if(s==="index.json"){return{ext:"json",content:r.getData()}}return}}r.renderJSON=renderJSON;function renderSwaggerUIRemote(e,r){const n=e.swaggerUIRenderOptions||{};const i=(n===null||n===void 0?void 0:n.indexPagePath)||(0,o.join)(__dirname,"../../index.html");return async n=>{if(n.indexOf(e.swaggerPath)===-1){return}const o=n.split("/");let a=o.pop();if(a==="index.json"){return{ext:"json",content:r.getData()}}if(!a){a="index.html"}if(a==="index.html"){const e=(0,s.readFileSync)(i,"utf8");return{ext:"html",content:e}}return}}r.renderSwaggerUIRemote=renderSwaggerUIRemote},70360:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.i18n=r.validate=void 0;r.validate={validationOptions:{},errorStatus:422};r.i18n={localeTable:{en_US:{validate:n(39391)},zh_CN:{validate:n(82545)}}}},59888:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.ValidateConfiguration=void 0;const o=n(45573);const a=n(70360);const c=n(22057);const u=n(57800);const p=n(21692);const g=n(69339);let v=class ValidateConfiguration{async init(){this.decoratorService.registerParameterHandler(g.VALID_KEY,(({parameterIndex:e,originParamType:r,originArgs:n,metadata:i})=>{if(!i.schema){i.schema=this.validateService.getSchema(r)}return n[e]}))}async onReady(e){await e.getAsync(p.ValidationPipe);await e.getAsync(p.ParseIntPipe);await e.getAsync(p.ParseBoolPipe);await e.getAsync(p.ParseFloatPipe);await e.getAsync(p.DecoratorValidPipe);this.decoratorService.registerParameterPipes(o.WEB_ROUTER_PARAM_KEY,[p.ValidationPipe])}};i([(0,o.Inject)(),s("design:type",o.MidwayDecoratorService)],v.prototype,"decoratorService",void 0);i([(0,o.Inject)(),s("design:type",c.ValidateService)],v.prototype,"validateService",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],v.prototype,"init",null);v=i([(0,o.Configuration)({namespace:"validate",imports:[u],importConfigs:[{default:a}]})],v);r.ValidateConfiguration=v},69339:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.VALID_KEY=r.VALIDATE_KEY=r.RULES_CLASS_KEY=r.RULES_KEY=void 0;r.RULES_KEY="common:rules";r.RULES_CLASS_KEY="common:class_rules";r.VALIDATE_KEY="common:validate";r.VALID_KEY="validate:valid"},51236:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.RuleType=r.Rule=void 0;const i=n(81154);r.RuleType=i;const s=n(45573);const o=n(69339);function Rule(e,r={required:true}){return function(n,a){if(a){if(!i.isSchema(e)){e=i.object((0,s.getClassMetadata)(o.RULES_KEY,e)).meta({id:e.name});if((0,s.getPropertyType)(n,a).name==="Array"){e=i.array().items(e);if(r.min){e=e.min(r.min)}if(r.max){e=e.max(r.max)}}if(r.required){e=e.required()}}(0,s.attachClassMetadata)(o.RULES_KEY,e,n,a)}else{if(i.isSchema(e)){}}}}r.Rule=Rule},50758:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Valid=void 0;const i=n(45573);const s=n(69339);const o=n(21692);function Valid(e,r){if(Array.isArray(e)){r=e;e=undefined}else{r=r||[]}return(0,i.createCustomParamDecorator)(s.VALID_KEY,{schema:e},{pipes:[o.DecoratorValidPipe,...r]})}r.Valid=Valid},66428:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Validate=void 0;const i=n(45573);const s=n(69339);function Validate(e={}){return(r,n,o)=>{(0,i.savePropertyMetadata)(s.VALIDATE_KEY,e,r,n)}}r.Validate=Validate},88611:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.OmitDto=r.PickDto=void 0;const i=n(45573);const s=n(69339);function PickDto(e,r){const pickedDto=function(){};pickedDto.prototype=e.prototype;const n=(0,i.getClassExtendedMetadata)(s.RULES_KEY,e);const o={};for(const e of r){if(n[e]){o[e]=n[e]}}(0,i.saveClassMetadata)(s.RULES_KEY,o,pickedDto);return pickedDto}r.PickDto=PickDto;function OmitDto(e,r){const pickedDto=function(){};pickedDto.prototype=e.prototype;const n=(0,i.getClassExtendedMetadata)(s.RULES_KEY,e);const o=Object.assign({},n);for(const e of r){delete o[e]}(0,i.saveClassMetadata)(s.RULES_KEY,o,pickedDto);return pickedDto}r.OmitDto=OmitDto},21424:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MidwayValidationError=void 0;const i=n(45573);const s=(0,i.registerErrorCode)("validate",{VALIDATE_FAIL:1e4});class MidwayValidationError extends i.MidwayHttpError{constructor(e,r,n){super(e,r,s.VALIDATE_FAIL,{cause:n})}}r.MidwayValidationError=MidwayValidationError},30794:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var s=Object.getOwnPropertyDescriptor(r,n);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,s)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var s=this&&this.__exportStar||function(e,r){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n))i(r,e,n)};Object.defineProperty(r,"__esModule",{value:true});r.Configuration=void 0;var o=n(59888);Object.defineProperty(r,"Configuration",{enumerable:true,get:function(){return o.ValidateConfiguration}});s(n(51236),r);s(n(66428),r);s(n(50758),r);s(n(88611),r);s(n(22057),r);s(n(21424),r);s(n(21692),r)},21692:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.DefaultValuePipe=r.ParseFloatPipe=r.ParseBoolPipe=r.ParseIntPipe=r.DecoratorValidPipe=r.ParsePipe=r.ValidationPipe=r.AbstractValidationPipe=void 0;const o=n(45573);const a=n(22057);const c=n(57800);const u=n(69339);const p=n(81154);class AbstractValidationPipe{validateWithSchema(e,r,n){const i=this.parseValidationOptions(r);const s=this.validateService.validateWithSchema(n,e,i);if(s&&s.value!==undefined){return s.value}return e}validate(e,r){const n=this.parseValidationOptions(r);if(r.metaType.isBaseType){return e}const i=this.validateService.validate(r.metaType.originDesign,e,n);if(i&&i.value){return i.value}return e}parseValidationOptions(e){const r=(0,o.getPropertyMetadata)(u.VALIDATE_KEY,e.target,e.methodName)||{};if(!r.locale){const n=e.target[o.REQUEST_OBJ_CTX_KEY];if(n&&n.getAttr){r.locale=n.getAttr(c.I18N_ATTR_KEY)}}return r}getSchema(){return undefined}}i([(0,o.Inject)(),s("design:type",a.ValidateService)],AbstractValidationPipe.prototype,"validateService",void 0);r.AbstractValidationPipe=AbstractValidationPipe;let g=class ValidationPipe extends AbstractValidationPipe{transform(e,r){return this.validate(e,r)}};g=i([(0,o.Pipe)()],g);r.ValidationPipe=g;class ParsePipe extends AbstractValidationPipe{transform(e,r){return this.validateWithSchema(e,r,r.metadata["schema"]||this.getSchema())}}r.ParsePipe=ParsePipe;let v=class DecoratorValidPipe extends ParsePipe{};v=i([(0,o.Pipe)()],v);r.DecoratorValidPipe=v;let b=class ParseIntPipe extends ParsePipe{getSchema(){return p.number().integer().required()}};b=i([(0,o.Pipe)()],b);r.ParseIntPipe=b;let _=class ParseBoolPipe extends ParsePipe{getSchema(){return p.boolean().required()}};_=i([(0,o.Pipe)()],_);r.ParseBoolPipe=_;let E=class ParseFloatPipe extends ParsePipe{getSchema(){return p.number().required()}};E=i([(0,o.Pipe)()],E);r.ParseFloatPipe=E;class DefaultValuePipe{constructor(e){this.defaultValue=e}transform(e,r){if(e===undefined||e===null||typeof e==="number"&&isNaN(e)){return this.defaultValue}return e}}r.DefaultValuePipe=DefaultValuePipe},22057:function(e,r,n){"use strict";var i=this&&this.__decorate||function(e,r,n,i){var s=arguments.length,o=s<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)if(a=e[c])o=(s<3?a(o):s>3?a(r,n,o):a(r,n))||o;return s>3&&o&&Object.defineProperty(r,n,o),o};var s=this&&this.__metadata||function(e,r){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,r)};Object.defineProperty(r,"__esModule",{value:true});r.getSchema=r.ValidateService=void 0;const o=n(45573);const a=n(70360);const c=n(69339);const u=n(81154);const p=n(57800);const g=n(21424);let v=class ValidateService{constructor(){this.messages={}}async init(){const e=Object.keys(a.i18n.localeTable);e.forEach((e=>{this.messages[(0,p.formatLocale)(e)]=Object.fromEntries(this.i18nService.getLocaleMapping(e,"validate"))}))}validate(e,r,n={}){const i=this.getSchema(e);return this.validateWithSchema(i,r,n)}validateWithSchema(e,r,n={}){var i,s,o;if(!e){return undefined}n.validationOptions=n.validationOptions||{};n.validationOptions.errors=n.validationOptions.errors||{};n.validationOptions.errors.language=(0,p.formatLocale)(this.i18nService.getAvailableLocale(n.validationOptions.errors.language||n.locale||this.i18nConfig.defaultLocale,"validate"));const a=e.validate(r,Object.assign({},(i=this.validateConfig.validationOptions)!==null&&i!==void 0?i:{},{messages:this.messages},(s=n.validationOptions)!==null&&s!==void 0?s:{}));if(a.error){throw new g.MidwayValidationError(a.error.message,(o=n===null||n===void 0?void 0:n.errorStatus)!==null&&o!==void 0?o:this.validateConfig.errorStatus,a.error)}else{return a}}getSchema(e){return getSchema(e)}};i([(0,o.Config)("validate"),s("design:type",Object)],v.prototype,"validateConfig",void 0);i([(0,o.Config)("i18n"),s("design:type",Object)],v.prototype,"i18nConfig",void 0);i([(0,o.Inject)(),s("design:type",p.MidwayI18nServiceSingleton)],v.prototype,"i18nService",void 0);i([(0,o.Init)(),s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",Promise)],v.prototype,"init",null);v=i([(0,o.Provide)(),(0,o.Scope)(o.ScopeEnum.Singleton)],v);r.ValidateService=v;function getSchema(e){const r=(0,o.getClassExtendedMetadata)(c.RULES_KEY,e);if(r){return u.object(r)}}r.getSchema=getSchema},29641:(e,r,n)=>{"use strict";const i=n(87016);const s=n(98446);const o={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:i.URL||URL};r.analyze=function(e,r={}){if(!e){return s.code("DOMAIN_NON_EMPTY_STRING")}if(typeof e!=="string"){throw new Error("Invalid input: domain must be a string")}if(e.length>256){return s.code("DOMAIN_TOO_LONG")}const n=!o.nonAsciiRx.test(e);if(!n){if(r.allowUnicode===false){return s.code("DOMAIN_INVALID_UNICODE_CHARS")}e=e.normalize("NFC")}if(o.domainControlRx.test(e)){return s.code("DOMAIN_INVALID_CHARS")}e=o.punycode(e);if(r.allowFullyQualified&&e[e.length-1]==="."){e=e.slice(0,-1)}const i=r.minDomainSegments||o.minDomainSegments;const a=e.split(".");if(a.length<i){return s.code("DOMAIN_SEGMENTS_COUNT")}if(r.maxDomainSegments){if(a.length>r.maxDomainSegments){return s.code("DOMAIN_SEGMENTS_COUNT_MAX")}}const c=r.tlds;if(c){const e=a[a.length-1].toLowerCase();if(c.deny&&c.deny.has(e)||c.allow&&!c.allow.has(e)){return s.code("DOMAIN_FORBIDDEN_TLDS")}}for(let e=0;e<a.length;++e){const r=a[e];if(!r.length){return s.code("DOMAIN_EMPTY_SEGMENT")}if(r.length>63){return s.code("DOMAIN_LONG_SEGMENT")}if(e<a.length-1){if(!o.domainSegmentRx.test(r)){return s.code("DOMAIN_INVALID_CHARS")}}else{if(!o.tldSegmentRx.test(r)){return s.code("DOMAIN_INVALID_TLDS_CHARS")}}}return null};r.isValid=function(e,n){return!r.analyze(e,n)};o.punycode=function(e){if(e.includes("%")){e=e.replace(/%/g,"%25")}try{return new o.URL(`http://${e}`).host}catch(r){return e}}},70865:(e,r,n)=>{"use strict";const i=n(39023);const s=n(29641);const o=n(98446);const a={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(i.TextEncoder||TextEncoder)};r.analyze=function(e,r){return a.email(e,r)};r.isValid=function(e,r){return!a.email(e,r)};a.email=function(e,r={}){if(typeof e!=="string"){throw new Error("Invalid input: email must be a string")}if(!e){return o.code("EMPTY_STRING")}const n=!a.nonAsciiRx.test(e);if(!n){if(r.allowUnicode===false){return o.code("FORBIDDEN_UNICODE")}e=e.normalize("NFC")}const i=e.split("@");if(i.length!==2){return i.length>2?o.code("MULTIPLE_AT_CHAR"):o.code("MISSING_AT_CHAR")}const[c,u]=i;if(!c){return o.code("EMPTY_LOCAL")}if(!r.ignoreLength){if(e.length>254){return o.code("ADDRESS_TOO_LONG")}if(a.encoder.encode(c).length>64){return o.code("LOCAL_TOO_LONG")}}return a.local(c,n)||s.analyze(u,r)};a.local=function(e,r){const n=e.split(".");for(const e of n){if(!e.length){return o.code("EMPTY_LOCAL_SEGMENT")}if(r){if(!a.atextRx.test(e)){return o.code("INVALID_LOCAL_CHARS")}continue}for(const r of e){if(a.atextRx.test(r)){continue}const e=a.binary(r);if(!a.atomRx.test(e)){return o.code("INVALID_LOCAL_CHARS")}}}};a.binary=function(e){return Array.from(a.encoder.encode(e)).map((e=>String.fromCharCode(e))).join("")};a.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/;a.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},98446:(e,r)=>{"use strict";r.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"};r.code=function(e){return{code:e,error:r.codes[e]}}},19760:(e,r,n)=>{"use strict";const i=n(15676);const s=n(12995);const o={};r.regex=function(e={}){i(e.cidr===undefined||typeof e.cidr==="string","options.cidr must be a string");const r=e.cidr?e.cidr.toLowerCase():"optional";i(["required","optional","forbidden"].includes(r),"options.cidr must be one of required, optional, forbidden");i(e.version===undefined||typeof e.version==="string"||Array.isArray(e.version),"options.version must be a string or an array of string");let n=e.version||["ipv4","ipv6","ipvfuture"];if(!Array.isArray(n)){n=[n]}i(n.length>=1,"options.version must have at least 1 version specified");for(let e=0;e<n.length;++e){i(typeof n[e]==="string","options.version must only contain strings");n[e]=n[e].toLowerCase();i(["ipv4","ipv6","ipvfuture"].includes(n[e]),"options.version contains unknown version "+n[e]+" - must be one of ipv4, ipv6, ipvfuture")}n=Array.from(new Set(n));const o=n.map((e=>{if(r==="forbidden"){return s.ip[e]}const n=`\\/${e==="ipv4"?s.ip.v4Cidr:s.ip.v6Cidr}`;if(r==="required"){return`${s.ip[e]}${n}`}return`${s.ip[e]}(?:${n})?`}));const a=`(?:${o.join("|")})`;const c=new RegExp(`^${a}$`);return{cidr:r,versions:n,regex:c,raw:a}}},34736:e=>{"use strict";const r={};r.tlds=["AAA","AARP","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"];e.exports=new Set(r.tlds.map((e=>e.toLowerCase())))},12995:(e,r,n)=>{"use strict";const i=n(15676);const s=n(33574);const o={};o.generate=function(){const e={};const r="\\dA-Fa-f";const n="["+r+"]";const i="\\w-\\.~";const s="!\\$&'\\(\\)\\*\\+,;=";const o="%"+r;const a=i+o+s+":@";const c="["+a+"]";const u="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+u+"\\.){3}"+u;const p=n+"{1,4}";const g="(?:"+p+":"+p+"|"+e.ipv4address+")";const v="(?:"+p+":){6}"+g;const b="::(?:"+p+":){5}"+g;const _="(?:"+p+")?::(?:"+p+":){4}"+g;const E="(?:(?:"+p+":){0,1}"+p+")?::(?:"+p+":){3}"+g;const x="(?:(?:"+p+":){0,2}"+p+")?::(?:"+p+":){2}"+g;const T="(?:(?:"+p+":){0,3}"+p+")?::"+p+":"+g;const w="(?:(?:"+p+":){0,4}"+p+")?::"+g;const C="(?:(?:"+p+":){0,5}"+p+")?::"+p;const A="(?:(?:"+p+":){0,6}"+p+")?::";e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])";e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])";e.ipv6address="(?:"+v+"|"+b+"|"+_+"|"+E+"|"+x+"|"+T+"|"+w+"|"+C+"|"+A+")";e.ipvFuture="v"+n+"+\\.["+i+s+":]+";e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*";e.schemeRegex=new RegExp(e.scheme);const k="["+i+o+s+":]*";const P="\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]";const I="["+i+o+s+"]{1,255}";const R="(?:"+P+"|"+e.ipv4address+"|"+I+")";const N="\\d*";const L="(?:"+k+"@)?"+R+"(?::"+N+")?";const B="(?:"+k+"@)?("+R+")(?::"+N+")?";const j=c+"*";const U=c+"+";const q="["+i+o+s+"@"+"]+";const V="";const z="(?:\\/"+j+")*";const K="\\/(?:"+U+z+")?";const W=U+z;const H=q+z;const G="(?:\\/\\/\\/"+j+z+")";e.hierPart="(?:"+"(?:\\/\\/"+L+z+")"+"|"+K+"|"+W+"|"+G+")";e.hierPartCapture="(?:"+"(?:\\/\\/"+B+z+")"+"|"+K+"|"+W+")";e.relativeRef="(?:"+"(?:\\/\\/"+L+z+")"+"|"+K+"|"+H+"|"+V+")";e.relativeRefCapture="(?:"+"(?:\\/\\/"+B+z+")"+"|"+K+"|"+H+"|"+V+")";e.query="["+a+"\\/\\?]*(?=#|$)";e.queryWithSquareBrackets="["+a+"\\[\\]\\/\\?]*(?=#|$)";e.fragment="["+a+"\\/\\?]*";return e};o.rfc3986=o.generate();r.ip={v4Cidr:o.rfc3986.ipv4Cidr,v6Cidr:o.rfc3986.ipv6Cidr,ipv4:o.rfc3986.ipv4address,ipv6:o.rfc3986.ipv6address,ipvfuture:o.rfc3986.ipvFuture};o.createRegex=function(e){const r=o.rfc3986;const n=e.allowQuerySquareBrackets?r.queryWithSquareBrackets:r.query;const a="(?:\\?"+n+")?"+"(?:#"+r.fragment+")?";const c=e.domain?r.relativeRefCapture:r.relativeRef;if(e.relativeOnly){return o.wrap(c+a)}let u="";if(e.scheme){i(e.scheme instanceof RegExp||typeof e.scheme==="string"||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const n=[].concat(e.scheme);i(n.length>=1,"scheme must have at least 1 scheme specified");const o=[];for(let e=0;e<n.length;++e){const a=n[e];i(a instanceof RegExp||typeof a==="string","scheme at position "+e+" must be a RegExp or String");if(a instanceof RegExp){o.push(a.source.toString())}else{i(r.schemeRegex.test(a),"scheme at position "+e+" must be a valid scheme");o.push(s(a))}}u=o.join("|")}const p=u?"(?:"+u+")":r.scheme;const g="(?:"+p+":"+(e.domain?r.hierPartCapture:r.hierPart)+")";const v=e.allowRelative?"(?:"+g+"|"+c+")":g;return o.wrap(v+a,u)};o.wrap=function(e,r){e=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${e}`;return{raw:e,regex:new RegExp(`^${e}$`),scheme:r}};o.uriRegex=o.createRegex({});r.regex=function(e={}){if(e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain){return o.createRegex(e)}return o.uriRegex}},41399:(e,r)=>{"use strict";const n={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};r.Parser=class{constructor(e,r={}){if(!r[n.settings]&&r.constants){for(const e in r.constants){const n=r.constants[e];if(n!==null&&!["boolean","number","string"].includes(typeof n)){throw new Error(`Formula constant ${e} contains invalid ${typeof n} value type`)}}}this.settings=r[n.settings]?r:Object.assign({[n.settings]:true,constants:{},functions:{}},r);this.single=null;this._parts=null;this._parse(e)}_parse(e){let i=[];let s="";let o=0;let a=false;const flush=e=>{if(o){throw new Error("Formula missing closing parenthesis")}const c=i.length?i[i.length-1]:null;if(!a&&!s&&!e){return}if(c&&c.type==="reference"&&e===")"){c.type="function";c.value=this._subFormula(s,c.value);s="";return}if(e===")"){const e=new r.Parser(s,this.settings);i.push({type:"segment",value:e})}else if(a){if(a==="]"){i.push({type:"reference",value:s});s="";return}i.push({type:"literal",value:s})}else if(n.operatorCharacters.includes(s)){if(c&&c.type==="operator"&&n.operators.includes(c.value+s)){c.value+=s}else{i.push({type:"operator",value:s})}}else if(s.match(n.numberRx)){i.push({type:"constant",value:parseFloat(s)})}else if(this.settings.constants[s]!==undefined){i.push({type:"constant",value:this.settings.constants[s]})}else{if(!s.match(n.tokenRx)){throw new Error(`Formula contains invalid token: ${s}`)}i.push({type:"reference",value:s})}s=""};for(const r of e){if(a){if(r===a){flush();a=false}else{s+=r}}else if(o){if(r==="("){s+=r;++o}else if(r===")"){--o;if(!o){flush(r)}else{s+=r}}else{s+=r}}else if(r in n.literals){a=n.literals[r]}else if(r==="("){flush();++o}else if(n.operatorCharacters.includes(r)){flush();s=r;flush()}else if(r!==" "){s+=r}else{flush()}}flush();i=i.map(((e,r)=>{if(e.type!=="operator"||e.value!=="-"||r&&i[r-1].type!=="operator"){return e}return{type:"operator",value:"n"}}));let c=false;for(const e of i){if(e.type==="operator"){if(n.operatorsPrefix.includes(e.value)){continue}if(!c){throw new Error("Formula contains an operator in invalid position")}if(!n.operators.includes(e.value)){throw new Error(`Formula contains an unknown operator ${e.value}`)}}else if(c){throw new Error("Formula missing expected operator")}c=!c}if(!c){throw new Error("Formula contains invalid trailing operator")}if(i.length===1&&["reference","literal","constant"].includes(i[0].type)){this.single={type:i[0].type==="reference"?"reference":"value",value:i[0].value}}this._parts=i.map((e=>{if(e.type==="operator"){return n.operatorsPrefix.includes(e.value)?e:e.value}if(e.type!=="reference"){return e.value}if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value)){throw new Error(`Formula contains invalid reference ${e.value}`)}if(this.settings.reference){return this.settings.reference(e.value)}return n.reference(e.value)}))}_subFormula(e,i){const s=this.settings.functions[i];if(typeof s!=="function"){throw new Error(`Formula contains unknown function ${i}`)}let o=[];if(e){let r="";let s=0;let a=false;const flush=()=>{if(!r){throw new Error(`Formula contains function ${i} with invalid arguments ${e}`)}o.push(r);r=""};for(let i=0;i<e.length;++i){const o=e[i];if(a){r+=o;if(o===a){a=false}}else if(o in n.literals&&!s){r+=o;a=n.literals[o]}else if(o===","&&!s){flush()}else{r+=o;if(o==="("){++s}else if(o===")"){--s}}}flush()}o=o.map((e=>new r.Parser(e,this.settings)));return function(e){const r=[];for(const n of o){r.push(n.evaluate(e))}return s.call(e,...r)}}evaluate(e){const r=this._parts.slice();for(let i=r.length-2;i>=0;--i){const s=r[i];if(s&&s.type==="operator"){const o=r[i+1];r.splice(i+1,1);const a=n.evaluate(o,e);r[i]=n.single(s.value,a)}}n.operatorsOrder.forEach((i=>{for(let s=1;s<r.length-1;){if(i.includes(r[s])){const i=r[s];const o=n.evaluate(r[s-1],e);const a=n.evaluate(r[s+1],e);r.splice(s,2);const c=n.calculate(i,o,a);r[s-1]=c===0?0:c}else{s+=2}}}));return n.evaluate(r[0],e)}};r.Parser.prototype[n.symbol]=true;n.reference=function(e){return function(r){return r&&r[e]!==undefined?r[e]:null}};n.evaluate=function(e,r){if(e===null){return null}if(typeof e==="function"){return e(r)}if(e[n.symbol]){return e.evaluate(r)}return e};n.single=function(e,r){if(e==="!"){return r?false:true}const n=-r;if(n===0){return 0}return n};n.calculate=function(e,r,i){if(e==="??"){return n.exists(r)?r:i}if(typeof r==="string"||typeof i==="string"){if(e==="+"){r=n.exists(r)?r:"";i=n.exists(i)?i:"";return r+i}}else{switch(e){case"^":return Math.pow(r,i);case"*":return r*i;case"/":return r/i;case"%":return r%i;case"+":return r+i;case"-":return r-i}}switch(e){case"<":return r<i;case"<=":return r<=i;case">":return r>i;case">=":return r>=i;case"==":return r===i;case"!=":return r!==i;case"&&":return r&&i;case"||":return r||i}return null};n.exists=function(e){return e!==null&&e!==undefined}},12080:(e,r)=>{"use strict";const n={};r.location=function(e=0){const r=Error.prepareStackTrace;Error.prepareStackTrace=(e,r)=>r;const n={};Error.captureStackTrace(n,this);const i=n.stack[e+1];Error.prepareStackTrace=r;return{filename:i.getFileName(),line:i.getLineNumber()}}},21371:(e,r,n)=>{"use strict";
|
|
3
3
|
/**
|
|
4
4
|
* @vue/compiler-core v3.5.18
|