comp-hub 0.41.2 → 0.42.2

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 CHANGED
@@ -1,4 +1,4 @@
1
- (()=>{var __webpack_modules__={53196:St=>{function webpackEmptyAsyncContext(St){return Promise.resolve().then((()=>{var Dt=new Error("Cannot find module '"+St+"'");Dt.code="MODULE_NOT_FOUND";throw Dt}))}webpackEmptyAsyncContext.keys=()=>[];webpackEmptyAsyncContext.resolve=webpackEmptyAsyncContext;webpackEmptyAsyncContext.id=53196;St.exports=webpackEmptyAsyncContext},14071:function(St,Dt,rr){"use strict";var cr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});const pr=cr(rr(22078));const mr=rr(23718);const{logLevel:gr=""}=(0,pr.default)(process.argv.slice(2));Dt["default"]={keys:"1755564797722_8890",koa:{globalPrefix:"/api"},midwayLogger:{default:{transports:{console:{level:"all"}}},clients:{appLogger:{level:gr||"warn"},coreLogger:{level:gr||"info"}}},cacheManager:{clients:{default:{store:"memory"}}},i18n:{defaultLocale:"zh",localeTable:{en:{default:mr.backendMessages.en},zh:{default:mr.backendMessages.zh}},writeCookie:false}}},91921:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt["default"]={}},12799:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var Sr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MainConfiguration=void 0;const $r=rr(46123);const Er=gr(rr(47453));const Ir=gr(rr(99375));const Or=gr(rr(65295));const Hr=gr(rr(2865));const Gr=gr(rr(49179));const Tn=gr(rr(62487));const Wn=gr(rr(96955));const Gn=gr(rr(87735));const mi=gr(rr(16928));const $i=gr(rr(79896));const ki=Sr(rr(76982));const Ni=rr(79896);const Ri=rr(24434);const Vi=Sr(rr(99819));const ji=Sr(rr(44400));const Ui=Sr(rr(77036));const zi=rr(31855);const Ki=rr(26815);const Xi=rr(54633);const Yi=rr(59416);const xa=rr(61142);const Ta=rr(64754);const wa=rr(10778);const Ia=rr(49969);const Oa=rr(67872);const Ra=rr(4145);const La=gr(rr(14071));const Ba=gr(rr(91921));const Ua=rr(87518);const Ja=rr(18801);const za=gr(rr(68255));const Ha={DEFAULT_PORT:Number(Ua.uri.getUrlPort(Ki.KEYS.LOCAL_SERVICE_URL_DEV)),MAX_SUB_PORT_RETRIES:20};let Ka=class MainConfiguration{constructor(){this.appConfig=null;this.subServer=null;this._websitePath=null}get websitePath(){if(!this._websitePath){const St=this.app.getEnv();this._websitePath=mi.resolve(__dirname,St===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL?"../../../website":"./website")}return this._websitePath}get apiUrl(){const St=this.app.getEnv();return St===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL?Ki.KEYS.REMOTE_SERVICE_URL_DEV:Ki.KEYS.REMOTE_SERVICE_URL_PROD}getVersion(){const St=this.app.getEnv();if(St===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const St=mi.join(__dirname,"../../cli/package.json");const Dt=JSON.parse((0,Ni.readFileSync)(St,"utf8"));return Dt.version}return process.env.COMP_HUB_VERSION||"unknown"}createProxyConfig(St){const Dt=new Ri.EventEmitter;const rr={...St,on:{...St.on,error:St=>{this.logger.error("Proxy Error:",St.message);Dt.emit("error",St)},proxyRes:()=>Dt.emit("proxyRes"),proxyReq:St=>{const rr=`${St.protocol}//${St.host}${St.path}`;this.logger.debug("[Proxy] →",rr);Dt.emit("proxyReq",St)},proxyReqWs:(...St)=>Dt.emit("proxyReqWs",...St)}};const cr=St.pathRewrite;const pr=Object.keys(cr??{});if(pr.length>0){const[St]=pr;rr.pathRewrite=Dt=>{let rr=Dt.replace(Ki.KEYS.PROXY_PATH_PREFIX,"");rr=rr.replace(new RegExp(St),cr[St]);return rr}}else{rr.pathRewrite=St=>St.replace(Ki.KEYS.PROXY_PATH_PREFIX,"")}return{proxy:(0,zi.createProxyMiddleware)(rr),opt:rr,event:Dt}}createProxyMap(St){const Dt={};for(const[rr,cr]of Object.entries(St)){Dt[rr]=this.createProxyConfig(cr)}return Dt}setupProxy(){const St=this.app.getAttr(Ki.KEYS.COMPHUB_CONFIG_KEY);if(Ta.ProxyController.proxys){for(const St of Object.values(Ta.ProxyController.proxys)){St.event.removeAllListeners()}}Ta.ProxyController.proxys={};if(!St.proxy)return;Ta.ProxyController.proxys=this.createProxyMap(St.proxy)}async buildConfig(St){const Dt=this.app.getEnv();const rr=St.cwd||process.cwd();this.logger.info("cwd:",rr);this.logger.info("env:",Dt);const cr={port:St.port||Ha.DEFAULT_PORT,allowDebug:St.allowDebug??false,api:St.api||this.apiUrl,dir:St.dir||"",cwd:rr,proxy:St.proxy};const pr=mi.join(this.websitePath,Ki.KEYS.WEBSITE_PATH_MAIN);const mr=mi.join(rr,cr.dir||"").replace(/[\\/]$/,"");const gr=mi.join(rr,Ki.KEYS.PREBUILD_MODULE_DIR);const yr=mi.join(rr,"node_modules");await $i.promises.mkdir(gr,{recursive:true});const Sr={websitePath:pr,prebuildModulePath:gr,cwd:rr,port:cr.port,srcPath:mr,remoteServer:cr.api,version:this.getVersion(),allowDebug:cr.allowDebug,proxy:cr.proxy,projectHash:ki.default.createHash("sha256").update(rr).digest("hex").slice(0,8)};wa.remoteInstance.defaults.baseURL=Sr.remoteServer;if(Dt===Ki.KEYS.LOCAL_MIDWAY_ENV_PROD){Sr.port=await(0,Ui.default)({port:Ui.default.makeRange(Sr.port,Sr.port+100)})}this.appConfig=Sr;const $r={dirs:{default:{prefix:`/${Ki.KEYS.WEBSITE_PATH_MAIN}`,dir:pr},[Ki.KEYS.MODULE_LOAD_PREFIX]:{prefix:Ki.KEYS.MODULE_LOAD_PREFIX,dir:gr,maxAge:0},[Ki.KEYS.NODE_MODULES_LOAD_PREFIX]:{prefix:Ki.KEYS.NODE_MODULES_LOAD_PREFIX,dir:yr,maxAge:0},[Ki.KEYS.COMP_PREVIEW_PREFIX_LOCAL]:{prefix:Ki.KEYS.COMP_PREVIEW_PREFIX_LOCAL,dir:Sr.srcPath,maxAge:0}}};try{await $i.promises.access(pr,$i.constants.F_OK)}catch(St){this.logger.warn("websitePathMain 不存在:请先构建前端项目",(0,Ia.getErrorMessage)(St));await $i.promises.mkdir(pr,{recursive:true})}if(Dt===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await $i.promises.writeFile(mi.join(__dirname,".comphubConfig.json"),JSON.stringify(Sr,null,2))}return{koa:{port:Sr.port},staticFile:$r,httpProxy:{strategy:{[Ki.KEYS.REMOTE_SERVICE_PREFIX]:{match:new RegExp(`^/${Ki.KEYS.REMOTE_SERVICE_PREFIX}/(.*)$`),target:`${Sr.remoteServer}/$1`}}}}}async startSubPort(){const St=this.app.getEnv();const Dt=this.app.getAttr(Ki.KEYS.COMPHUB_CONFIG_KEY);const{port:rr,remoteServer:cr}=Dt;let pr=await(0,Ui.default)({port:Ui.default.makeRange(rr,rr+100)});const mr=new Vi.default;mr.use((async(St,pr)=>{if(St.path.startsWith(Ki.KEYS.COMP_PREVIEW_PREFIX_LOCAL)){const{srcPath:rr}=Dt;const cr=St.path[0];const pr=St.path.replace(Ki.KEYS.COMP_PREVIEW_PREFIX_LOCAL,"");const mr=await Ua.locate.resolveBuildPath(pr,{baseDir:rr});if(mr){const Dt=mr.replace(rr,"");const gr=Ja.textKit.replaceSlashWithSpecifiedSeparator(Dt,cr);if(pr!==gr){const Dt=gr.replace(pr,"");St.redirect(St.path+Dt);return}}}const mr=[{prefix:`/${Ki.KEYS.REMOTE_SERVICE_PREFIX}`,target:cr,rewrite:{[`^/${Ki.KEYS.REMOTE_SERVICE_PREFIX}`]:""}},{prefix:`/${Ki.KEYS.LOCAL_SERVICE_PREFIX}`,target:`${Ki.KEYS.IFRAME_HOST}:${rr}`,rewrite:{[`^/${Ki.KEYS.LOCAL_SERVICE_PREFIX}`]:""}},{prefix:Ki.KEYS.MODULE_LOAD_PREFIX,target:`${Ki.KEYS.IFRAME_HOST}:${rr}`,rewrite:{}},{prefix:Ki.KEYS.NODE_MODULES_LOAD_PREFIX,target:`${Ki.KEYS.IFRAME_HOST}:${rr}`,rewrite:{}},{prefix:Ki.KEYS.COMP_PREVIEW_PREFIX_LOCAL,target:`${Ki.KEYS.IFRAME_HOST}:${rr}`,rewrite:{}}];for(const Dt of mr){if(St.path.startsWith(Dt.prefix)){await(0,Oa.createKoaProxy)(St,Dt.target,Dt.rewrite);return}}await pr()}));mr.use((0,ji.default)(this.websitePath,{index:false}));mr.use((async St=>{try{const Dt=(()=>{if(St.path.startsWith(`${Ki.KEYS.IFRAME_ITEM_WEBSITE_PATH}/`)){return Ki.KEYS.IFRAME_ITEM_WEBSITE_PATH}if(St.path.startsWith(`${Ki.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}/`)){return Ki.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}return""})();const rr=mi.join(this.websitePath,Dt,"index.html");const cr=await $i.promises.readFile(rr,"utf-8");const mr=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify({subPort:pr})};<\/script>`;const gr=cr.replace("\x3c!--GLOBAL_CONFIG--\x3e",mr);St.type="text/html; charset=utf-8";St.status=200;St.body=gr}catch(Dt){this.logger.error("读取 index.html 失败:",Dt);St.status=500;St.body="服务器内部错误"}}));await new Promise(((rr,cr)=>{let gr=0;const yr=mr.listen(pr,(()=>{this.subServer=yr;this.app.setAttr(Ki.KEYS.COMPHUB_CONFIG_KEY,{...Dt,subPort:pr});if(process.send){process.send({type:"subPort",subPort:pr})}if(St===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL){this.logger.info(`子端口 ${pr} 已启动`)}rr()}));yr.on("error",(St=>{if(St.code==="EADDRINUSE"&&gr<Ha.MAX_SUB_PORT_RETRIES){gr++;this.logger.error(`子端口 ${pr} 被占用,正在尝试端口 ${++pr}`);yr.close();yr.listen(pr)}else{cr(St)}}))}))}async printAccessInfo(St){const Dt=await St.getAsync(Er.Framework);const rr=Dt.getServer();const cr=rr.address();const pr=this.app.getEnv();const mr=this.app.getAttr(Ki.KEYS.COMPHUB_CONFIG_KEY);this.logger.info("cwd:",mr.cwd);this.logger.info("env:",pr);this.logger.info("port:",mr.port);if(mr.subPort)this.logger.info("subPort:",mr.subPort);if(cr&&typeof cr!=="string"){const St=cr.port;this.logger.info("Local Address:",`http://localhost:${St}`);if(pr===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const Dt=Ua.network.getLocalIPv4();if(Dt)this.logger.info("Network Address:",`http://${Dt}:${St}`);this.logger.info("Swagger UI:",`http://localhost:${St}/swagger-ui/index.html`)}}}async onConfigLoad(){const St=await(0,Ra.waitForIpcConfig)();const Dt=await this.buildConfig(St);const rr=this.app.getEnv();if(rr===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await $i.promises.writeFile(mi.join(__dirname,".start.json"),JSON.stringify(Dt,null,2))}return Dt}async onReady(){this.app.setAttr(Ki.KEYS.COMPHUB_CONFIG_KEY,this.appConfig);this.app.useMiddleware([xa.ReportMiddleware]);this.app.useFilter([Yi.BadRequestErrorFilter,Xi.DefaultErrorFilter]);process.on("disconnect",(()=>{this.logger.info("Master process exited, shutting down...");if(this.subServer){this.subServer.close()}process.exit(0)}))}async onServerReady(St){this.setupProxy();await this.startSubPort();await this.printAccessInfo(St)}async onStop(){if(this.subServer){await new Promise((St=>{this.subServer.close((()=>St()))}));this.logger.info("子服务已关闭")}}};Dt.MainConfiguration=Ka;mr([(0,$r.Logger)("coreLogger"),yr("design:type",Object)],Ka.prototype,"logger",void 0);mr([(0,$r.App)(),yr("design:type",Object)],Ka.prototype,"app",void 0);Dt.MainConfiguration=Ka=mr([(0,$r.Configuration)({imports:[Er,Ir,Hr,Tn,Wn,Gn,za,{component:Or,enabledEnvironment:[Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL]},{component:Gr,enabledEnvironment:[Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL]}],importConfigs:[{default:La,local:Ba}]})],Ka)},83465:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr=this&&this.__param||function(St,Dt){return function(rr,cr){Dt(rr,cr,St)}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.CompController=void 0;const gr=rr(46123);const yr=rr(48795);const Sr=rr(63366);const $r=rr(49179);const Er=rr(8131);const Ir=rr(101);const Or=rr(19465);const Hr=rr(19385);const Gr=rr(4990);const Tn=(0,Hr.createNoData)($r.ApiProperty);let Wn=class CompController{async dir(St){const Dt=await this.compService.getCompDir(St.compPath);return Hr.resUtil.success(Dt)}async file(St){const{filePath:Dt}=St;const rr=await this.compService.getCompFile(Dt);return Hr.resUtil.success({content:rr})}async check(St){const Dt=await this.compService.checkCompConfig(St.compPath,St.framework);return Hr.resUtil.success(Dt)}async updateVersion(St){const{compPath:Dt,version:rr}=St;await this.compService.updateCompVersion(Dt,rr);return Hr.resUtil.noData()}async generateCompJson(St){const{compPath:Dt}=St;await this.compService.generateCompJson(Dt);return Hr.resUtil.noData()}async dep(St){const{compPath:Dt}=St;const rr=await this.compService.getCompDep(Dt);return Hr.resUtil.success({thirdParty:rr})}async checkCompRepeat(St){await Gr.remoteApi.v1Token.tokencontrollerApproachexpire();const Dt=await this.compService.checkCompRepeat(St);return Hr.resUtil.success(Dt)}async submit(St){await Gr.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.submitComp(St);return Hr.resUtil.noData()}async update(St){await Gr.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.updateComp(St);return Hr.resUtil.noData()}async download(St){const Dt=await this.compService.downloadComp(St);if(Dt?.isRepeat){return Hr.resUtil.success({isRepeat:true})}return Hr.resUtil.success({isRepeat:false})}async localCompsByIds(St){const{compIds:Dt}=St;const rr=await this.compService.getLocalCompsByIds(Dt);return Hr.resUtil.success({compInfos:rr})}async compFilesOssSignedUrl(St){const Dt=await this.compService.getCompFilesOssSignedUrl(St);return Hr.resUtil.success(Dt)}async packageJson(){const St=await this.compService.getPackageJsonContent();return Hr.resUtil.success({packageJson:St})}async compFileHash(St){const Dt=await this.compService.getCompFileHash(St);return Hr.resUtil.success(Dt)}async localComps(St){const Dt=await this.compService.getLocalComps(St);return Hr.resUtil.success(Dt)}async openCompPathInVscode(St){await this.compService.openCompPathInVscode(St);return Hr.resUtil.noData()}async localCompDetailByPathHash(St){const Dt=await this.compService.getLocalCompDetailByPathHash(St);return Hr.resUtil.success(Dt)}async writeFile(St){await this.compService.writeCompFile(St);return Hr.resUtil.noData()}async renameDir(St){await this.compService.renameCompDir(St);return Hr.resUtil.noData()}};Dt.CompController=Wn;cr([(0,gr.App)(),pr("design:type",Object)],Wn.prototype,"app",void 0);cr([(0,gr.Inject)(),pr("design:type",yr.CompService)],Wn.prototype,"compService",void 0);cr([(0,gr.Inject)(),pr("design:type",Sr.ConfigService)],Wn.prototype,"configService",void 0);cr([(0,$r.ApiOperation)({summary:"获取组件目录"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.CompFileVO)}),(0,gr.Post)("/dir"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CompDirDTO]),pr("design:returntype",Promise)],Wn.prototype,"dir",null);cr([(0,$r.ApiOperation)({summary:"获取组件目录内指定文件的内容"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.CompFileContentVO)}),(0,gr.Post)("/file"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CompFileDTO]),pr("design:returntype",Promise)],Wn.prototype,"file",null);cr([(0,$r.ApiOperation)({summary:"检查组件配置是否符合规范"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.CompCheckVO)}),(0,gr.Post)("/check"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CompCheckDTO]),pr("design:returntype",Promise)],Wn.prototype,"check",null);cr([(0,$r.ApiOperation)({summary:"更新组件版本号"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/updateVersion"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.UpdateVersionDTO]),pr("design:returntype",Promise)],Wn.prototype,"updateVersion",null);cr([(0,$r.ApiOperation)({summary:"生成组件指纹文件"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/generateCompJson"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.GenerateCompJsonDTO]),pr("design:returntype",Promise)],Wn.prototype,"generateCompJson",null);cr([(0,$r.ApiOperation)({summary:"获取组件依赖关系"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.ImportScanResultVO)}),(0,gr.Post)("/dep"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.DepDTO]),pr("design:returntype",Promise)],Wn.prototype,"dep",null);cr([(0,$r.ApiOperation)({summary:"检查组件是否重复"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.CompSimilarListVO)}),(0,gr.Post)("/checkCompRepeat",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CheckCompRepeatDTO]),pr("design:returntype",Promise)],Wn.prototype,"checkCompRepeat",null);cr([(0,$r.ApiOperation)({summary:"提交组件"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/submit",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.SubmitCompDTO]),pr("design:returntype",Promise)],Wn.prototype,"submit",null);cr([(0,$r.ApiOperation)({summary:"更新组件"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/update",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.UpdateCompDTO]),pr("design:returntype",Promise)],Wn.prototype,"update",null);cr([(0,$r.ApiOperation)({summary:"下载组件"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.DownloadCompVO)}),(0,gr.Post)("/download",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.DownloadCompDTO]),pr("design:returntype",Promise)],Wn.prototype,"download",null);cr([(0,$r.ApiOperation)({summary:"通过ids在本地查询组件"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.LocalCompsByIdsVO)}),(0,gr.Post)("/localCompsByIds"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.LocalCompsByIdsDTO]),pr("design:returntype",Promise)],Wn.prototype,"localCompsByIds",null);cr([(0,$r.ApiOperation)({summary:"获取组件文件夹下所有文件的oss签名访问地址"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.CompFilesOssSignedUrlVO)}),(0,gr.Post)("/compFilesOssSignedUrl",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CompFilesOssSignedUrlDTO]),pr("design:returntype",Promise)],Wn.prototype,"compFilesOssSignedUrl",null);cr([(0,$r.ApiOperation)({summary:"获取package.json"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.PackageJsonVO)}),(0,gr.Post)("/packageJson"),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Wn.prototype,"packageJson",null);cr([(0,$r.ApiOperation)({summary:"获取组件文件hash"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.CompFileHashVO)}),(0,gr.Post)("/compFileHash"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CompFileHashDTO]),pr("design:returntype",Promise)],Wn.prototype,"compFileHash",null);cr([(0,$r.ApiOperation)({summary:"获取本地组件列表,分页查询"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,(0,Hr.createListWrapper)($r.ApiProperty,Ir.LocalCompsVO))}),(0,gr.Post)("/localComps",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.LocalCompsDTO]),pr("design:returntype",Promise)],Wn.prototype,"localComps",null);cr([(0,$r.ApiOperation)({summary:"通过组件路径打开在vscode中打开所在文件夹"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/openCompPathInVscode"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.OpenCompPathInVscodeDTO]),pr("design:returntype",Promise)],Wn.prototype,"openCompPathInVscode",null);cr([(0,$r.ApiOperation)({summary:"通过组件完整文件路径hash获取组件信息"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.LocalCompDetailVO)}),(0,gr.Post)("/localCompDetailByPathHash"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.LocalCompDetailByPathHashDTO]),pr("design:returntype",Promise)],Wn.prototype,"localCompDetailByPathHash",null);cr([(0,$r.ApiOperation)({summary:"写入文件到组件目录"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/writeFile"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CompWriteFileDTO]),pr("design:returntype",Promise)],Wn.prototype,"writeFile",null);cr([(0,$r.ApiOperation)({summary:"重命名组件目录"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/renameDir"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.RenameCompDirDTO]),pr("design:returntype",Promise)],Wn.prototype,"renameDir",null);Dt.CompController=Wn=cr([(0,$r.ApiTags)(["comp"]),(0,gr.Controller)("/comp")],Wn)},96736:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr=this&&this.__param||function(St,Dt){return function(rr,cr){Dt(rr,cr,St)}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.ModuleController=void 0;const gr=rr(46123);const yr=rr(49179);const Sr=rr(85984);const $r=rr(19428);const Er=rr(71692);const Ir=rr(61275);const Or=rr(19385);const Hr=(0,Or.createNoData)(yr.ApiProperty);let Gr=class ModuleController{async preBuild(St){const{deps:Dt}=St;let rr=null;await this.queueService.enqueue((async()=>{rr=await this.moduleService.preBuild(Dt)}));return Or.resUtil.success(rr)}async buildTemplateCompiler(St){let Dt=null;await this.queueService.enqueue((async()=>{Dt=await this.moduleService.buildTemplateCompiler(St.vueVersion)}));return Or.resUtil.success(Dt)}async preBuildSize(){const St=await this.moduleService.preBuildSize();return Or.resUtil.success({size:St})}async clearPreBuild(){await this.moduleService.clearPreBuild();return Or.resUtil.noData()}};Dt.ModuleController=Gr;cr([(0,gr.Inject)(),pr("design:type",Sr.ModuleService)],Gr.prototype,"moduleService",void 0);cr([(0,gr.Inject)(),pr("design:type",Ir.QueueService)],Gr.prototype,"queueService",void 0);cr([(0,yr.ApiOperation)({summary:"模块预构建"}),(0,yr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(yr.ApiProperty,Er.PreBuildVO)}),(0,gr.Post)("/preBuild"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[$r.PreBuildDTO]),pr("design:returntype",Promise)],Gr.prototype,"preBuild",null);cr([(0,yr.ApiOperation)({summary:"构建 vue-template-compiler 浏览器 bundle"}),(0,yr.ApiResponse)({status:200,description:"返回 vue-template-compiler 浏览器 bundle 文件名",type:(0,Or.createSuccessWrapper)(yr.ApiProperty,Er.BuildTemplateCompilerVO)}),(0,gr.Post)("/buildTemplateCompiler"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[$r.BuildTemplateCompilerDTO]),pr("design:returntype",Promise)],Gr.prototype,"buildTemplateCompiler",null);cr([(0,yr.ApiOperation)({summary:"获取预构建模块文件总大小"}),(0,yr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(yr.ApiProperty,Er.PreBuildSizeVO)}),(0,gr.Post)("/preBuildSize"),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Gr.prototype,"preBuildSize",null);cr([(0,yr.ApiOperation)({summary:"清除预构建模块文件"}),(0,yr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,gr.Post)("/clearPreBuild"),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Gr.prototype,"clearPreBuild",null);Dt.ModuleController=Gr=cr([(0,yr.ApiTags)(["module"]),(0,gr.Controller)("/module")],Gr)},54991:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr=this&&this.__param||function(St,Dt){return function(rr,cr){Dt(rr,cr,St)}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.OssController=void 0;const gr=rr(46123);const yr=rr(49179);const Sr=rr(19385);const $r=rr(56415);const Er=rr(75049);const Ir=rr(80799);const Or=rr(19465);let Hr=class OssController{async fileSignUrl(St){const{objectId:Dt}=St;const rr=await this.ossService.getDownloadSts();const cr=await this.ossService.getFilePreviewUrl(rr,Dt);return Sr.resUtil.success({signUrl:cr})}};Dt.OssController=Hr;cr([(0,gr.App)(),pr("design:type",Object)],Hr.prototype,"app",void 0);cr([(0,gr.Inject)(),pr("design:type",Ir.OssService)],Hr.prototype,"ossService",void 0);cr([(0,yr.ApiOperation)({summary:"获取文件访问地址",description:"获取文件访问地址"}),(0,yr.ApiResponse)({status:200,description:"返回结果",type:(0,Sr.createSuccessWrapper)(yr.ApiProperty,Er.SignedUrlVO)}),(0,gr.Post)("/fileSignUrl",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[$r.SignedUrlDTO]),pr("design:returntype",Promise)],Hr.prototype,"fileSignUrl",null);Dt.OssController=Hr=cr([(0,yr.ApiTags)(["oss"]),(0,gr.Controller)("/oss")],Hr)},55360:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr=this&&this.__param||function(St,Dt){return function(rr,cr){Dt(rr,cr,St)}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.PreprocessingController=void 0;const gr=rr(49179);const yr=rr(46123);const Sr=rr(90218);const $r=rr(18922);const Er=rr(5578);const Ir=rr(19385);let Or=class PreprocessingController{async preprocess(St){const Dt=await this.preprocessingService.preprocessCode(St);return Ir.resUtil.success({preprocessedCode:Dt})}};Dt.PreprocessingController=Or;cr([(0,yr.Inject)(),pr("design:type",Er.PreprocessingService)],Or.prototype,"preprocessingService",void 0);cr([(0,gr.ApiOperation)({summary:"css预处理",description:"预处理css代码"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(gr.ApiProperty,$r.PreprocessedCodeVO)}),(0,yr.Post)("/preprocess"),mr(0,(0,yr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Sr.PreprocessingDTO]),pr("design:returntype",Promise)],Or.prototype,"preprocess",null);Dt.PreprocessingController=Or=cr([(0,gr.ApiTags)(["preprocessing"]),(0,yr.Controller)("/preprocessing")],Or)},64754:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr;Object.defineProperty(Dt,"__esModule",{value:true});Dt.ProxyController=void 0;const gr=rr(46123);const yr=rr(26815);const Sr=yr.KEYS.PROXY_PATH_PREFIX;let $r=mr=class ProxyController{async proxy(){const St=this.ctx.path.replace(Sr,"");let Dt=null;for(const[rr,cr]of Object.entries(mr.proxys)){const pr=new RegExp(rr);if(pr.test(St)||St.startsWith(rr)){Dt=cr;break}}if(!Dt){this.ctx.status=404;this.ctx.body={message:"Proxy not found"};return}const{proxy:rr,event:cr}=Dt;await new Promise(((St,Dt)=>{rr(this.ctx.req,this.ctx.res);cr.on("error",Dt);cr.on("proxyRes",St)}))}};Dt.ProxyController=$r;cr([(0,gr.Inject)(),pr("design:type",Object)],$r.prototype,"ctx",void 0);cr([(0,gr.All)("/*"),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],$r.prototype,"proxy",null);Dt.ProxyController=$r=mr=cr([(0,gr.Controller)(Sr,{ignoreGlobalPrefix:true})],$r)},17076:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SpaController=void 0;const Sr=rr(46123);const $r=gr(rr(79896));const Er=rr(16928);const Ir=rr(49179);const Or=rr(63366);const Hr=rr(26815);let Gr=class SpaController{async index(){this.ctx.redirect(`/${Hr.KEYS.WEBSITE_PATH_MAIN}/`)}async spa(){const St=this.configService.comphubConfig();const{websitePath:Dt}=St;const rr=(0,Er.resolve)(Dt,"index.html");let cr=await $r.promises.readFile(rr,"utf-8");const pr=this.configService.getGlobalConfig();const{projectHash:mr}=pr;if(mr){cr=cr.replace(/<base[^>]*>/gi,"");cr=cr.replace("\x3c!--BASE_HREF--\x3e",`<base href="/${mr}/main/">`)}const gr=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify(pr)};<\/script>`;cr=cr.replace("\x3c!--GLOBAL_CONFIG--\x3e",gr);return cr}async getGlobalConfig(){return this.configService.getGlobalConfig()}};Dt.SpaController=Gr;mr([(0,Sr.Inject)(),yr("design:type",Object)],Gr.prototype,"ctx",void 0);mr([(0,Sr.App)(),yr("design:type",Object)],Gr.prototype,"app",void 0);mr([(0,Sr.Inject)(),yr("design:type",Or.ConfigService)],Gr.prototype,"configService",void 0);mr([(0,Sr.Get)("/"),yr("design:type",Function),yr("design:paramtypes",[]),yr("design:returntype",Promise)],Gr.prototype,"index",null);mr([(0,Sr.Get)(`/${Hr.KEYS.WEBSITE_PATH_MAIN}/*`),yr("design:type",Function),yr("design:paramtypes",[]),yr("design:returntype",Promise)],Gr.prototype,"spa",null);mr([(0,Sr.Get)(Hr.KEYS.GLOBAL_CONFIG_PATH),yr("design:type",Function),yr("design:paramtypes",[]),yr("design:returntype",Promise)],Gr.prototype,"getGlobalConfig",null);Dt.SpaController=Gr=mr([(0,Ir.ApiExcludeController)(),(0,Sr.Controller)("/",{ignoreGlobalPrefix:true})],Gr)},44734:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr=this&&this.__param||function(St,Dt){return function(rr,cr){Dt(rr,cr,St)}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.VuefinderController=void 0;const gr=rr(46123);const yr=rr(5808);const Sr=rr(49179);const $r=rr(23444);let Er=class VuefinderController{async list(St){const Dt=await this.vuefinderService.list(St);return Dt}};Dt.VuefinderController=Er;cr([(0,gr.App)(),pr("design:type",Object)],Er.prototype,"app",void 0);cr([(0,gr.Inject)(),pr("design:type",yr.VuefinderService)],Er.prototype,"vuefinderService",void 0);cr([(0,Sr.ApiOperation)({summary:"list"}),(0,gr.Get)("/list"),mr(0,(0,gr.Query)()),pr("design:type",Function),pr("design:paramtypes",[$r.VueFinderIndexDTO]),pr("design:returntype",Promise)],Er.prototype,"list",null);Dt.VuefinderController=Er=cr([(0,Sr.ApiTags)(["vuefinder"]),(0,gr.Controller)("/vuefinder")],Er)},60149:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.BasePageDTO=void 0;const mr=rr(49179);const gr=rr(99375);class BasePageDTO{}Dt.BasePageDTO=BasePageDTO;cr([(0,mr.ApiProperty)({example:1,description:"当前页码",required:false}),(0,gr.Rule)(gr.RuleType.number().min(1)),pr("design:type",Number)],BasePageDTO.prototype,"page",void 0);cr([(0,mr.ApiProperty)({example:10,description:"每页数量",required:false}),(0,gr.Rule)(gr.RuleType.number().min(1).max(50)),pr("design:type",Number)],BasePageDTO.prototype,"pageSize",void 0);cr([(0,gr.Rule)(gr.RuleType.string().allow("").max(50).pattern(/\{\s*\$\w+:/i,{invert:true}).trim()),(0,mr.ApiProperty)({example:"小明",description:"关键词",required:false}),pr("design:type",String)],BasePageDTO.prototype,"keyword",void 0)},8131:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.RenameCompDirDTO=Dt.CompWriteFileDTO=Dt.LocalCompDetailByPathHashDTO=Dt.OpenCompPathInVscodeDTO=Dt.LocalCompsDTO=Dt.CompFilesOssSignedUrlDTO=Dt.DownloadCompDTO=Dt.UpdateCompDTO=Dt.SubmitCompDTO=Dt.CompFileDTO=Dt.UpdateVersionDTO=Dt.CompFileHashDTO=Dt.CheckCompRepeatDTO=Dt.LocalCompsByIdsDTO=Dt.DepDTO=Dt.GenerateCompJsonDTO=Dt.CompCheckDTO=Dt.CompDirDTO=void 0;const mr=rr(49179);const gr=rr(99375);const yr=rr(26815);const Sr=rr(60149);class CompPathDTO{}cr([(0,mr.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompPathDTO.prototype,"compPath",void 0);class CompIdDTO{}cr([(0,mr.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompIdDTO.prototype,"compId",void 0);class CompDirDTO extends CompPathDTO{}Dt.CompDirDTO=CompDirDTO;class CompCheckDTO extends CompPathDTO{}Dt.CompCheckDTO=CompCheckDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件框架类型",example:"vue"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompCheckDTO.prototype,"framework",void 0);class GenerateCompJsonDTO extends CompPathDTO{}Dt.GenerateCompJsonDTO=GenerateCompJsonDTO;class DepDTO extends CompPathDTO{}Dt.DepDTO=DepDTO;class LocalCompsByIdsDTO{}Dt.LocalCompsByIdsDTO=LocalCompsByIdsDTO;cr([(0,mr.ApiProperty)({type:[String],required:true,description:"组件id列表",example:["123","456"]}),(0,gr.Rule)(gr.RuleType.array().required().items(gr.RuleType.string())),pr("design:type",Array)],LocalCompsByIdsDTO.prototype,"compIds",void 0);class CheckCompRepeatDTO extends CompPathDTO{}Dt.CheckCompRepeatDTO=CheckCompRepeatDTO;cr([(0,mr.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,gr.Rule)(gr.RuleType.string()),pr("design:type",String)],CheckCompRepeatDTO.prototype,"teamId",void 0);class CompFileHashDTO extends CompPathDTO{}Dt.CompFileHashDTO=CompFileHashDTO;class UpdateVersionDTO extends CompPathDTO{}Dt.UpdateVersionDTO=UpdateVersionDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件版本号",example:"1.0.0"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],UpdateVersionDTO.prototype,"version",void 0);class CompFileDTO{}Dt.CompFileDTO=CompFileDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件文件路径",example:"/src/components/MyComp/index.vue"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompFileDTO.prototype,"filePath",void 0);class PreviewItemDTO{}cr([(0,mr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),(0,gr.Rule)(gr.RuleType.array().required().items(gr.RuleType.string())),pr("design:type",Array)],PreviewItemDTO.prototype,"miniPath",void 0);cr([(0,mr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),(0,gr.Rule)(gr.RuleType.array().optional().items(gr.RuleType.string())),pr("design:type",Array)],PreviewItemDTO.prototype,"fullPath",void 0);cr([(0,mr.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),(0,gr.Rule)(gr.RuleType.string()),pr("design:type",String)],PreviewItemDTO.prototype,"desc",void 0);class ParentDTO{}cr([(0,mr.ApiProperty)({description:"父库名称",required:true,example:"vue"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],ParentDTO.prototype,"name",void 0);cr([(0,mr.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],ParentDTO.prototype,"version",void 0);class DepItemDTO{}cr([(0,mr.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],DepItemDTO.prototype,"name",void 0);cr([(0,mr.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],DepItemDTO.prototype,"version",void 0);cr([(0,mr.ApiProperty)({type:ParentDTO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),(0,gr.Rule)(gr.RuleType.object().optional()),pr("design:type",ParentDTO)],DepItemDTO.prototype,"parent",void 0);class SubmitCompDTO{}Dt.SubmitCompDTO=SubmitCompDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],SubmitCompDTO.prototype,"name",void 0);cr([(0,mr.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],SubmitCompDTO.prototype,"compPath",void 0);cr([(0,mr.ApiProperty)({type:[DepItemDTO],required:true,description:"组件依赖"}),(0,gr.Rule)(gr.RuleType.array().required()),pr("design:type",Array)],SubmitCompDTO.prototype,"dep",void 0);cr([(0,mr.ApiProperty)({type:[PreviewItemDTO],required:true,description:"组件预览数据"}),(0,gr.Rule)(gr.RuleType.array().required()),pr("design:type",Array)],SubmitCompDTO.prototype,"previewConfigs",void 0);cr([(0,mr.ApiProperty)({required:true,description:"组件描述",example:"这是一个组件"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],SubmitCompDTO.prototype,"desc",void 0);cr([(0,mr.ApiProperty)({required:false,description:"组件背景颜色",example:"#f0f0f0"}),(0,gr.Rule)(gr.RuleType.string().empty("").default("")),pr("design:type",String)],SubmitCompDTO.prototype,"bgColor",void 0);cr([(0,mr.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,gr.Rule)(gr.RuleType.string()),pr("design:type",String)],SubmitCompDTO.prototype,"teamId",void 0);cr([(0,mr.ApiProperty)({required:false,description:"组件标签",example:["hooks","图表"],type:[String]}),(0,gr.Rule)(gr.RuleType.array().items(gr.RuleType.string())),pr("design:type",Array)],SubmitCompDTO.prototype,"tags",void 0);cr([(0,mr.ApiProperty)({required:false,description:"组件框架类型",example:"vue"}),(0,gr.Rule)(gr.RuleType.string()),pr("design:type",String)],SubmitCompDTO.prototype,"framework",void 0);class UpdateCompDTO extends SubmitCompDTO{}Dt.UpdateCompDTO=UpdateCompDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],UpdateCompDTO.prototype,"compId",void 0);cr([(0,mr.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,gr.Rule)(gr.RuleType.string()),pr("design:type",String)],UpdateCompDTO.prototype,"teamId",void 0);cr([(0,mr.ApiProperty)({required:false,description:"组件升级描述",example:"升级组件描述"}),(0,gr.Rule)(gr.RuleType.string().allow("").max(200)),pr("design:type",String)],UpdateCompDTO.prototype,"upgradeDesc",void 0);class DownloadCompDTO extends CompIdDTO{}Dt.DownloadCompDTO=DownloadCompDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件下载路径",example:"/src/components/MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],DownloadCompDTO.prototype,"savePath",void 0);cr([(0,mr.ApiProperty)({required:false,description:"是否覆盖",example:true}),(0,gr.Rule)(gr.RuleType.boolean().default(false)),pr("design:type",Boolean)],DownloadCompDTO.prototype,"isCover",void 0);cr([(0,mr.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],DownloadCompDTO.prototype,"compName",void 0);cr([(0,mr.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],DownloadCompDTO.prototype,"version",void 0);class CompFilesOssSignedUrlDTO{}Dt.CompFilesOssSignedUrlDTO=CompFilesOssSignedUrlDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"version",void 0);cr([(0,mr.ApiProperty)({required:true,description:"对象存储id",example:"123"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"objectId",void 0);cr([(0,mr.ApiProperty)({type:[String],required:true,description:"组件文件路径",example:"MyComp/index.vue"}),(0,gr.Rule)(gr.RuleType.array().required().items(gr.RuleType.string())),pr("design:type",Array)],CompFilesOssSignedUrlDTO.prototype,"files",void 0);class LocalCompsDTO extends Sr.BasePageDTO{}Dt.LocalCompsDTO=LocalCompsDTO;class OpenCompPathInVscodeDTO{}Dt.OpenCompPathInVscodeDTO=OpenCompPathInVscodeDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],OpenCompPathInVscodeDTO.prototype,"folderPath",void 0);cr([(0,mr.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],OpenCompPathInVscodeDTO.prototype,"relativeFilePath",void 0);class LocalCompDetailByPathHashDTO{}Dt.LocalCompDetailByPathHashDTO=LocalCompDetailByPathHashDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件完整文件路径hash",example:"1234567890"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],LocalCompDetailByPathHashDTO.prototype,"fullPathHash",void 0);class CompWriteFileDTO{}Dt.CompWriteFileDTO=CompWriteFileDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompWriteFileDTO.prototype,"compPath",void 0);cr([(0,mr.ApiProperty)({required:true,description:"文件名",example:yr.KEYS.COMP_SCREENSHOT_MINI_FILENAME}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompWriteFileDTO.prototype,"filename",void 0);cr([(0,mr.ApiProperty)({required:true,description:"文件内容(base64,不含前缀)",example:"iVBORw0KGgo..."}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompWriteFileDTO.prototype,"content",void 0);class RenameCompDirDTO extends CompPathDTO{}Dt.RenameCompDirDTO=RenameCompDirDTO;cr([(0,mr.ApiProperty)({required:true,description:"新目录名称",example:"NewCompName"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],RenameCompDirDTO.prototype,"newName",void 0)},19428:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.BuildTemplateCompilerDTO=Dt.PreBuildDTO=void 0;const mr=rr(49179);const gr=rr(99375);class PreBuildDTO{}Dt.PreBuildDTO=PreBuildDTO;cr([(0,mr.ApiProperty)({type:[String],required:true,description:"组件依赖",example:["axios","md5"]}),(0,gr.Rule)(gr.RuleType.array().required().items(gr.RuleType.string())),pr("design:type",Array)],PreBuildDTO.prototype,"deps",void 0);class BuildTemplateCompilerDTO{}Dt.BuildTemplateCompilerDTO=BuildTemplateCompilerDTO;cr([(0,mr.ApiProperty)({type:String,required:true,description:"Vue 版本号,如 2.6.14",example:"2.6.14"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],BuildTemplateCompilerDTO.prototype,"vueVersion",void 0)},56415:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SignedUrlDTO=void 0;const mr=rr(49179);const gr=rr(99375);class SignedUrlDTO{}Dt.SignedUrlDTO=SignedUrlDTO;cr([(0,gr.Rule)(gr.RuleType.string().required().error(new Error("对象id不能为空"))),(0,mr.ApiProperty)({example:"",description:"对象id",required:true}),pr("design:type",String)],SignedUrlDTO.prototype,"objectId",void 0)},90218:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.PreprocessingDTO=void 0;const mr=rr(49179);const gr=rr(99375);const yr=rr(34985);class PreprocessingDTO{}Dt.PreprocessingDTO=PreprocessingDTO;cr([(0,mr.ApiProperty)({description:"css代码",required:true,example:"body { color: red; }"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],PreprocessingDTO.prototype,"cssCode",void 0);cr([(0,mr.ApiProperty)({enum:yr.PrecompilerEnum,example:yr.PrecompilerEnum.SASS,description:"预编译器类型",required:false}),(0,gr.Rule)(gr.RuleType.string().valid(...Object.values(yr.PrecompilerEnum))),pr("design:type",String)],PreprocessingDTO.prototype,"precompilerType",void 0)},23444:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.VueFinderIndexDTO=void 0;const mr=rr(49179);const gr=rr(99375);class VueFinderIndexDTO{}Dt.VueFinderIndexDTO=VueFinderIndexDTO;cr([(0,mr.ApiProperty)({required:false,description:"文件路径"}),(0,gr.Rule)(gr.RuleType.string()),pr("design:type",String)],VueFinderIndexDTO.prototype,"path",void 0)},59416:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.BadRequestErrorFilter=void 0;const pr=rr(46123);const mr=rr(19385);const gr=rr(26815);let yr=class BadRequestErrorFilter{async catch(St,Dt){const rr=Dt.app.getEnv();if(rr===gr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){Dt.logger.error("BadRequestErrorFilter==>",St)}return mr.resUtil.error(St.message,St.status)}};Dt.BadRequestErrorFilter=yr;Dt.BadRequestErrorFilter=yr=cr([(0,pr.Catch)(pr.httpError.BadRequestError)],yr)},54633:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.DefaultErrorFilter=void 0;const pr=rr(46123);const mr=rr(26815);let gr=class DefaultErrorFilter{async catch(St,Dt){const rr=Dt.app.getEnv();try{const Dt=JSON.parse(St.message);return{...Dt}}catch(St){if(rr===mr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){Dt.logger.error("解析错误信息失败==>",St.message,"\n")}}finally{if(rr===mr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){Dt.logger.error("原始错误==>",St)}}Dt.status=St.status??500;return{code:St.status??500,message:St.message??"未知错误"}}};Dt.DefaultErrorFilter=gr;Dt.DefaultErrorFilter=gr=cr([(0,pr.Catch)()],gr)},15545:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.Configuration=void 0;var mr=rr(12799);Object.defineProperty(Dt,"Configuration",{enumerable:true,get:function(){return mr.MainConfiguration}});pr(rr(14071),Dt);pr(rr(91921),Dt);pr(rr(83465),Dt);pr(rr(96736),Dt);pr(rr(54991),Dt);pr(rr(55360),Dt);pr(rr(64754),Dt);pr(rr(17076),Dt);pr(rr(44734),Dt);pr(rr(60149),Dt);pr(rr(8131),Dt);pr(rr(19428),Dt);pr(rr(56415),Dt);pr(rr(34985),Dt);pr(rr(90218),Dt);pr(rr(23444),Dt);pr(rr(59416),Dt);pr(rr(54633),Dt);pr(rr(9711),Dt);pr(rr(53951),Dt);pr(rr(77523),Dt);pr(rr(61142),Dt);pr(rr(19465),Dt);pr(rr(95637),Dt);pr(rr(48795),Dt);pr(rr(63366),Dt);pr(rr(23086),Dt);pr(rr(85984),Dt);pr(rr(80799),Dt);pr(rr(5578),Dt);pr(rr(61275),Dt);pr(rr(19452),Dt);pr(rr(5808),Dt);pr(rr(66593),Dt);pr(rr(58953),Dt);pr(rr(49969),Dt);pr(rr(4145),Dt);pr(rr(10778),Dt);pr(rr(67872),Dt);pr(rr(101),Dt);pr(rr(71692),Dt);pr(rr(75049),Dt);pr(rr(18922),Dt)},9711:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},53951:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},34985:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.PrecompilerEnum=void 0;var rr;(function(St){St["LESS"]="less";St["SASS"]="sass";St["SCSS"]="scss"})(rr||(Dt.PrecompilerEnum=rr={}))},77523:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},61142:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.ReportMiddleware=void 0;const pr=rr(46123);let mr=class ReportMiddleware{resolve(){return async(St,Dt)=>{const rr=Date.now();const cr=await Dt();const pr=St.url;St.logger.info(`请求 ${St.method} ${pr} → ${St.status} (${Date.now()-rr}ms)`);return cr}}static getName(){return"report"}};Dt.ReportMiddleware=mr;Dt.ReportMiddleware=mr=cr([(0,pr.Middleware)()],mr)},19465:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.TokenMiddleware=void 0;const pr=rr(46123);const mr=rr(10778);let gr=class TokenMiddleware{resolve(){return async(St,Dt)=>{(0,mr.setHeader)(St.header);await Dt()}}static getName(){return"token"}};Dt.TokenMiddleware=gr;Dt.TokenMiddleware=gr=cr([(0,pr.Middleware)()],gr)},95637:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.CommandService=void 0;const gr=rr(46123);const yr=mr(rr(79896));const Sr=rr(63366);const $r=rr(7455);const Er=mr(rr(16928));const Ir=rr(68255);let Or=class CommandService{async revealInVSCode(St,Dt,rr=1,cr=1){const{cwd:pr}=this.configService.comphubConfig();if(!St||!yr.default.existsSync(St)||!yr.default.statSync(St).isDirectory()){throw new gr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist"))}const mr=Er.default.resolve(St,Dt);if(!yr.default.existsSync(mr)||yr.default.statSync(mr).isDirectory()){throw new gr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist"))}(0,$r.launchIDE)({file:pr});(0,$r.launchIDE)({file:mr,line:rr,column:cr})}};Dt.CommandService=Or;cr([(0,gr.Inject)(),pr("design:type",Sr.ConfigService)],Or.prototype,"configService",void 0);cr([(0,gr.Inject)(),pr("design:type",Object)],Or.prototype,"ctx",void 0);cr([(0,gr.Inject)(),pr("design:type",Ir.MidwayI18nService)],Or.prototype,"i18nService",void 0);Dt.CommandService=Or=cr([(0,gr.Provide)()],Or)},48795:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.CompService=void 0;const Sr=rr(46123);const $r=gr(rr(16928));const Er=gr(rr(79896));const Ir=rr(63366);const Or=rr(23086);const Hr=rr(80799);const Gr=gr(rr(70857));const Tn=gr(rr(10232));const Wn=rr(87518);const Gn=rr(84464);const mi=rr(95637);const $i=rr(26815);const ki=rr(18801);const Ni=rr(4990);const Ri=rr(68255);let Vi=class CompService{getCompFullPath(St){const{srcPath:Dt}=this.configService.comphubConfig();St=St.replace($i.KEYS.FILE_MANAGER_DIRNAME,"");const rr=$r.join(Dt,St);return rr}checkCompEntryIndex(St,Dt=$i.KEYS.COMP_FRAMEWORK_VUE){if(Dt===$i.KEYS.COMP_FRAMEWORK_REACT){for(const Dt of $i.KEYS.COMP_USE_ENTRY_FILE_REACT){const rr=$r.join(St,Dt);if(Er.existsSync(rr)){return Dt}}throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[$i.KEYS.COMP_USE_ENTRY_FILE_REACT.join(" / ")]}))}const rr=$r.join(St,$i.KEYS.COMP_USE_ENTRY_FILE);if(!Er.existsSync(rr)){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[$i.KEYS.COMP_USE_ENTRY_FILE]}))}return $i.KEYS.COMP_USE_ENTRY_FILE}checkCompJson(St){const Dt=this.getCompFullPath(St);const rr=$r.join(Dt,$i.KEYS.COMP_CONFIG_FILENAME);if(!Er.existsSync(rr)){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.configFileNotExist"))}}checkCompJsonFormat(St){const Dt=Object.keys(St);const rr=$i.ARRAY.COMP_DEFAULT_FIELD.every((St=>!St.required||Dt.includes(St.name)));if(!rr)return false;return ki.versionKit.validateVersion(St.version)}async updateCompJson(St,Dt){const rr=this.getCompFullPath(St);const cr=$r.join(rr,$i.KEYS.COMP_CONFIG_FILENAME);const pr=await this.getCompFile(cr);const mr=Dt(JSON.parse(pr));await Er.promises.writeFile(cr,JSON.stringify(mr,null,4))}async readCompVersion(St){const Dt=$r.join(St,$i.KEYS.COMP_CONFIG_FILENAME);const rr=await this.getCompFile(Dt);const cr=JSON.parse(rr);return cr.version}initCompJson(){return $i.ARRAY.COMP_DEFAULT_FIELD.reduce(((St,Dt)=>{const rr={};if(Dt.required){rr[Dt.name]=Dt.default}return{...St,...rr}}),{})}async uploadCompFolderToOss({compFullPath:St,version:Dt,ossData:rr}){const{files:cr}=await Wn.fileTree.generateTree(St);const pr=cr.map((({absolutePath:Dt,size:rr})=>{const cr=Dt.replace(St,"");return{filePath:cr,fileFullPath:Dt,size:rr??0}}));pr.sort(((St,Dt)=>Dt.size-St.size));for(let St=0;St<pr.length;St++){const{filePath:cr,fileFullPath:mr}=pr[St];const gr=$r.join(rr.key,Dt,cr);const yr={...rr,key:gr.replace(new RegExp(ki.textKit.escapeRegExp($r.sep),"g"),"/")};const Sr=Er.createReadStream(mr);await this.ossService.uploadFileToOss(yr,Sr)}}async getCompHash(St){const Dt=await Wn.digest.getFileHashList(St);const rr=Dt.map((St=>`${St.relativePath}-${St.hash}`)).join(";");return Wn.digest.getStringHash(rr)}async getCompFeatures(St){const Dt=await Wn.digest.getFileHashAndSsdeepList(St);const rr=Dt.map((St=>{const Dt=(0,Gn.omit)(St,["relativePath"]);return{...Dt,path:St.relativePath}}));const cr=await Wn.digest.getRelativeDirList(St);const pr=JSON.stringify(cr);const mr=Wn.digest.getStringFuzzyHash(pr);const gr=await this.getCompHash(St);return{fileHashList:rr,compHash:gr,dirHash:Wn.digest.getStringHash(pr),dirSsdeep:Wn.digest.getSsdeepStruct(mr)}}async getCompFileList(St){const{files:Dt}=await Wn.fileTree.generateTree(St,{withStats:true,calculateSize:true});const rr=Dt.map((({name:Dt,size:rr,absolutePath:cr})=>({name:Dt,size:rr??0,path:cr.replace(St,"").replace(new RegExp(ki.textKit.escapeRegExp($r.sep),"g"),"/")})));return rr}checkCompFileSize(St){if(St>$i.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSizeExceeded",{args:[Math.floor($i.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE/1024/1024).toString()]}))}}checkCompFileNum(St){if(St>$i.KEYS.COMP_SUBMIT_MAX_FILE_COUNT){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitFileCountExceeded",{args:[$i.KEYS.COMP_SUBMIT_MAX_FILE_COUNT.toString()]}))}}checkCompSingleFileSize(St){const Dt=$i.KEYS.COMP_SUBMIT_MAX_SINGLE_FILE_SIZE;const rr=Math.floor(Dt/1024/1024);for(const cr of St){if(cr.size>Dt){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSingleFileSizeExceeded",{args:[cr.path,rr.toString()]}))}}}async findCompJsonPath(St){const{files:Dt}=await Wn.fileTree.generateTree(St,{ignore:["node_modules"]});this.ctx.logger.debug("项目文件数量:",Dt.length);const rr=Dt.filter((({absolutePath:St})=>St.endsWith($i.KEYS.COMP_CONFIG_FILENAME)));return rr}async getAllLocalCompIds(){const{srcPath:St}=this.configService.comphubConfig();const Dt=await this.findCompJsonPath(St);this.ctx.logger.debug("组件文件数量:",Dt.length);const rr=Dt.map((async({absolutePath:St})=>{const Dt=await Er.promises.readFile(St,"utf8");const rr=JSON.parse(Dt);const cr=this.checkCompJsonFormat(rr);const pr=$r.dirname(St);return{compjson:rr,isCompHub:cr,compPath:pr,pathHash:Wn.digest.getStringHash(pr)}}));const cr=await Promise.all(rr);return cr.filter((St=>St.isCompHub&&St.compjson[$i.KEYS.COMP_FIELD_COMP_ID]))}async getCompDir(St){const{srcPath:Dt}=this.configService.comphubConfig();const rr=$r.join(St.replace($i.KEYS.FILE_MANAGER_DIRNAME,`${Dt}${$r.sep}`));const{tree:cr,files:pr}=await Wn.fileTree.generateTree(rr,{sortBy:"type"});const _handleTree=St=>{const Dt={name:St.name,path:St.absolutePath,type:St.type};if(St.children&&St.children.length>0){Dt.children=St.children.map((St=>_handleTree(St)))}return Dt};return{tree:_handleTree(cr),files:pr.map((St=>St.absolutePath))}}async getCompFile(St){const Dt=await Er.promises.readFile(St,"utf-8");return Dt}async checkCompConfig(St,Dt=$i.KEYS.COMP_FRAMEWORK_VUE){const rr=$r.basename(St);const cr=this.getCompFullPath(St);let pr;try{const St=this.checkCompEntryIndex(cr,Dt);pr=$r.join(rr,St)}catch(St){this.ctx.logger.error("检查组件入口文件失败",St);return{errorMsg:St.message}}try{this.checkCompJson(St)}catch(St){this.ctx.logger.error("检查组件配置文件comp.json失败",St);return{entryIndexPath:pr,errorMsg:St.message}}const mr=$r.join(rr,$i.KEYS.COMP_CONFIG_FILENAME);try{const Dt=$r.join(this.getCompFullPath(St),$i.KEYS.COMP_CONFIG_FILENAME);const rr=await this.getCompFile(Dt);const cr=this.checkCompJsonFormat(JSON.parse(rr));if(!cr){return{entryIndexPath:pr,compJsonPath:mr,errorMsg:this.i18nService.translate("local.comp.check.configJsonFormatError")}}}catch(St){this.ctx.logger.error("读取组件配置文件comp.json失败",St);return{entryIndexPath:pr,compJsonPath:mr,errorMsg:this.i18nService.translate("local.comp.check.configJsonReadError")}}return{entryIndexPath:pr,compJsonPath:mr,errorMsg:""}}async updateCompVersion(St,Dt){const rr=ki.versionKit.validateVersion(Dt);if(!rr){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidVersionFormat"))}const cr=this.getCompFullPath(St);const pr=$r.join(cr,$i.KEYS.COMP_CONFIG_FILENAME);const mr=await this.getCompFile(pr);const gr=JSON.parse(mr);gr.version=Dt;const yr=JSON.stringify(gr,null,2);await Er.promises.writeFile(pr,yr)}async generateCompJson(St){const Dt=this.getCompFullPath(St);const rr=$r.basename(Dt);const cr=this.initCompJson();cr.name=rr;await Er.promises.writeFile($r.join(Dt,$i.KEYS.COMP_CONFIG_FILENAME),JSON.stringify(cr,null,4))}async getCompDep(St){const{cwd:Dt}=this.configService.comphubConfig();const rr=this.getCompFullPath(St);const cr=await this.depsService.getModuleEntry(rr,Dt);return cr}async getCompFileHash(St){const{compPath:Dt}=St;const rr=this.getCompFullPath(Dt);const cr=await this.getCompFeatures(rr);return{compHash:cr.compHash}}async checkCompRepeat(St){const{compPath:Dt,teamId:rr}=St;const cr=this.getCompFullPath(Dt);const pr=await this.getCompFeatures(cr);const mr=await Ni.remoteApi.v1Comp.compcontrollerCheckcompexistbyhash(pr,{headers:{"team-id":rr}});return mr.data}async submitComp(St){let Dt="";let rr={};try{const{compPath:cr,dep:pr,previewConfigs:mr,desc:gr,bgColor:yr,name:Sr,teamId:$r,tags:Er,framework:Ir}=St;rr={"team-id":$r};this.checkCompJson(cr);const Or=this.getCompFullPath(cr);const Hr=await this.getCompFeatures(Or);this.checkCompEntryIndex(Or,Ir);const Gr=await this.readCompVersion(Or);const Tn=await this.getCompFileList(Or);const Wn=Tn.reduce(((St,Dt)=>St+Dt.size),0);this.checkCompFileNum(Tn.length);this.checkCompFileSize(Wn);this.checkCompSingleFileSize(Tn);const Gn={name:Sr,dep:pr,previewConfigs:mr,desc:gr,version:Gr,size:Wn,files:Tn,bgColor:yr,compFeatures:Hr,tags:Er};const mi=await Ni.remoteApi.v1Comp.compcontrollerUpload(Gn,{headers:rr});const ki=mi.data._id;Dt=ki;await this.updateCompJson(cr,(St=>({...St,name:Sr,[$i.KEYS.COMP_FIELD_COMP_ID]:ki})));const{data:{componentDir:Ri}}=await Ni.remoteApi.v1Oss.osscontrollerCompossdir();const Vi=await Ni.remoteApi.v1Oss.osscontrollerPutpolicy({type:Ri});const ji={compFullPath:Or,version:Gr,ossData:Vi.data};await this.uploadCompFolderToOss(ji);const{key:Ui}=Vi.data;const zi={compId:ki,objectId:`${Ri}${Ui}`};await Ni.remoteApi.v1Comp.compcontrollerUpdateobjectid(zi)}catch(St){if(Dt){await Ni.remoteApi.v1Comp.compcontrollerDeletefailedcomp({compId:Dt},{headers:rr})}if(St instanceof Sr.httpError.BadRequestError){throw new Sr.httpError.BadRequestError(St)}throw new Error(St.message)}}async updateComp(St){const{compId:Dt,compPath:rr,dep:cr,previewConfigs:pr,desc:mr,bgColor:gr,name:yr,upgradeDesc:Sr,teamId:Ir,tags:Or,framework:Hr}=St;const Gr=this.getCompFullPath(rr);const Tn=await this.getCompFeatures(Gr);this.checkCompEntryIndex(Gr,Hr);const Wn=await Ni.remoteApi.v1Comp.compcontrollerCompdetail({compId:Dt});const{objectId:Gn,version:mi}=Wn.data;const ki=await this.readCompVersion(Gr);const Ri=await this.getCompFileList(Gr);const Vi=Ri.reduce(((St,Dt)=>St+Dt.size),0);this.checkCompFileNum(Ri.length);this.checkCompFileSize(Vi);this.checkCompSingleFileSize(Ri);const ji={compId:Dt,name:yr,dep:cr,previewConfigs:pr,desc:mr,version:ki,size:Vi,files:Ri,bgColor:gr,compFeatures:Tn,upgradeDesc:Sr,tags:Or};const Ui=await Ni.remoteApi.v1Comp.compcontrollerUpdate(ji,{headers:{"team-id":Ir}});const{isFileChange:zi}=Ui.data;if(!zi&&mi===ki){const St=$r.join(Gr,$i.KEYS.COMP_SCREENSHOT_MINI_FILENAME);if(Er.existsSync(St)){const Dt=await Ni.remoteApi.v1Oss.osscontrollerCompossdir();const rr=await Ni.remoteApi.v1Oss.osscontrollerPutpolicy({type:Dt.data.componentDir});const cr=Gn.replace(rr.data.dir,"");const pr=$r.join(cr,ki,$i.KEYS.COMP_SCREENSHOT_MINI_FILENAME).replace(/\\/g,"/");const mr=Er.createReadStream(St);const gr={...rr.data,key:pr};await this.ossService.uploadFileToOss(gr,mr,true)}return}const Ki=await Ni.remoteApi.v1Oss.osscontrollerCompossdir();const{componentDir:Xi}=Ki.data;const Yi=await Ni.remoteApi.v1Oss.osscontrollerPutpolicy({type:Xi});const xa=Gn.replace(Yi.data.dir,"");const Ta={...Yi.data,key:xa};const wa={compFullPath:Gr,version:ki,ossData:Ta};await this.uploadCompFolderToOss(wa);await this.updateCompJson(rr,(St=>({...St,name:yr,[$i.KEYS.COMP_FIELD_COMP_ID]:Dt})))}async downloadComp(St){const{compId:Dt,savePath:rr,isCover:cr,compName:pr,version:mr}=St;const{srcPath:gr}=this.configService.comphubConfig();const yr=$i.KEYS.FILE_MANAGER_DIRNAME;const Ir=rr.replace(yr,"").replace(/[/\\]/g,$r.sep);const Or=$r.join(gr,Ir,pr);if(!cr&&Er.existsSync(Or)){return{isRepeat:true}}const Hr=Gr.tmpdir();const Gn=$r.join(Hr,$i.KEYS.COMP_TEMP_DIR);this.ctx.logger.debug("组件下载到临时目录",Gn);const mi=await Ni.remoteApi.v1Comp.compcontrollerCompdetail({compId:Dt,version:mr});if(!mi?.data){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compNotExist"))}const{files:ki,objectId:Ri,name:Vi}=mi.data;let ji=[];const Ui=$r.join(Gn,Ri,mr);if(Er.existsSync(Ui)){const{files:St}=await Wn.fileTree.generateTree(Ui);ji=St}await Ni.remoteApi.v1Comp.compcontrollerUpdatecompdownloadcount({compId:Dt,version:mr});if(ki.length===ji.length){const St=ji.find((({absolutePath:St})=>St.replace(Ui,"").startsWith(`${$r.sep}${$i.KEYS.COMP_CONFIG_FILENAME}`)));if(St){const Dt=await Er.promises.readFile(St.absolutePath,"utf8");const rr=JSON.parse(Dt);const{name:cr}=rr;if(Vi===cr){await Tn.copy(Ui,Or);this.ctx.logger.debug("组件缓存文件和服务器文件一致,直接使用缓存文件");return}}}const zi=ki.map((St=>{const Dt=$r.join(Ri,mr,St.path);return{path:Dt.replace(/[/\\]/g,"/")}}));const Ki=await this.ossService.getDownloadSts();await this.ossService.downloadFileToPath(Ki,zi,Gn);const Xi=$r.join(Gn,Ri,mr);await Tn.copy(Xi,Or)}async getLocalCompsByIds(St){const{srcPath:Dt}=this.configService.comphubConfig();const rr=await this.findCompJsonPath(Dt);this.ctx.logger.debug("组件文件数量:",rr.length);const cr=rr.map((async({absolutePath:St})=>{const Dt=await Er.promises.readFile(St,"utf8");const rr=JSON.parse(Dt);return{...rr,path:$r.dirname(St)}}));const pr=await Promise.all(cr);const mr=pr.filter((Dt=>St.includes(Dt[$i.KEYS.COMP_FIELD_COMP_ID])));if(!mr){return[]}const gr=$i.KEYS.FILE_MANAGER_DIRNAME;const yr=new RegExp(ki.textKit.escapeRegExp($r.sep),"g");const Sr=mr.map((St=>{const rr=St.path.replace(Dt,"").replace(yr,"/").slice(1);return{id:St[$i.KEYS.COMP_FIELD_COMP_ID],path:gr+rr,fullPath:St.path,fullPathHash:Wn.digest.getStringHash(St.path),basename:$r.basename(St.path)}}));return Sr}async getCompFilesOssSignedUrl(St){const{version:Dt,objectId:rr,files:cr}=St;const pr=await this.ossService.getDownloadSts();const mr=cr.map((async St=>{const cr=$r.join(rr,Dt,St);const mr=await this.ossService.getFilePreviewUrl(pr,cr.replace(/[/\\]/g,"/"));return{path:St,signedUrl:mr}}));const gr=await Promise.all(mr);return{signedUrls:gr}}async getPackageJsonContent(){const St=this.configService.comphubConfig();const Dt=$r.join(St.cwd,"package.json");return await Wn.fileSys.readJsonFile(Dt)}async getLocalComps(St){const{page:Dt=1,pageSize:rr=10}=St;const{srcPath:cr}=this.configService.comphubConfig();const pr=await this.getAllLocalCompIds();const mr=pr.map((St=>({id:St.compjson[$i.KEYS.COMP_FIELD_COMP_ID],pathHash:St.pathHash})));mr.sort(((St,Dt)=>St.id.localeCompare(Dt.id)));const gr=[...new Set(mr.map((St=>St.id)))];const yr=await Ni.remoteApi.v1Comp.compcontrollerExistcompsbyids({compIds:gr});const{ids:Er=[]}=yr.data;const Ir=mr.filter((St=>Er.includes(St.id)));const Or=Ir.length;const Hr=Ir.slice((Dt-1)*rr,Dt*rr);const Gr=new Map(pr.map((St=>[`${St.compjson[$i.KEYS.COMP_FIELD_COMP_ID]}_${St.pathHash}`,St])));const Tn=await Ni.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:Hr.map((St=>St.id))});const{rows:Gn=[]}=Tn.data;const mi=new Map(Gn.map((St=>[St._id,St])));const Ri=new RegExp(ki.textKit.escapeRegExp($r.sep),"g");const Vi=$i.KEYS.FILE_MANAGER_DIRNAME;const ji=Hr.map((async({id:St,pathHash:Dt})=>{const rr=Gr.get(`${St}_${Dt}`);const pr=mi.get(St);if(!pr||!rr){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithIdNotExist",{args:[St]}))}const mr=rr.compPath.replace(cr,"").replace(Ri,"/").slice(1);return{_id:Wn.digest.getStringHash(rr.compPath),name:pr.name,compId:St,version:rr.compjson.version,path:Vi+mr,previewConfigs:pr.previewConfigs,bgColor:pr.bgColor,fullPath:rr.compPath}}));const Ui=await Promise.all(ji);return{total:Or,page:Dt,pageSize:rr,rows:Ui}}async getLocalCompDetailByPathHash(St){const{fullPathHash:Dt}=St;const rr=await this.getAllLocalCompIds();const cr=rr.find((St=>St.pathHash===Dt));if(!cr){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithPathNotExist",{args:[Dt]}))}const{srcPath:pr}=this.configService.comphubConfig();const mr=cr.compjson[$i.KEYS.COMP_FIELD_COMP_ID];const{version:gr}=cr.compjson;const yr=await Ni.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:[mr]});const{rows:Er=[]}=yr.data;const Ir=Er[0];const Or=new RegExp(ki.textKit.escapeRegExp($r.sep),"g");const Hr=$i.KEYS.FILE_MANAGER_DIRNAME;const Gr=cr.compPath.replace(pr,"").replace(Or,"/").slice(1);return{_id:Dt,name:Ir.name,compId:mr,version:gr,path:Hr+Gr,previewConfigs:Ir.previewConfigs,bgColor:Ir.bgColor,fullPath:cr.compPath}}async openCompPathInVscode(St){const{folderPath:Dt,relativeFilePath:rr}=St;await this.commandService.revealInVSCode(Dt,rr)}async writeCompFile(St){const{compPath:Dt,filename:rr,content:cr}=St;const pr=this.getCompFullPath(Dt);const mr=$r.join(pr,rr);Er.writeFileSync(mr,Buffer.from(cr,"base64"))}async renameCompDir(St){const{compPath:Dt,newName:rr}=St;if(!ki.textKit.validateCompName(rr)){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidCompName",{args:[rr]}))}const cr=this.getCompFullPath(Dt);const pr=$r.basename(cr);if(pr===rr)return;const mr=$r.dirname(cr);const gr=$r.join(mr,rr);if(Er.existsSync(gr)){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.dirAlreadyExists",{args:[rr]}))}await Er.promises.rename(cr,gr)}};Dt.CompService=Vi;mr([(0,Sr.App)(),yr("design:type",Object)],Vi.prototype,"app",void 0);mr([(0,Sr.Inject)(),yr("design:type",Ir.ConfigService)],Vi.prototype,"configService",void 0);mr([(0,Sr.Inject)(),yr("design:type",Hr.OssService)],Vi.prototype,"ossService",void 0);mr([(0,Sr.Inject)(),yr("design:type",mi.CommandService)],Vi.prototype,"commandService",void 0);mr([(0,Sr.Inject)(),yr("design:type",Or.DepsService)],Vi.prototype,"depsService",void 0);mr([(0,Sr.Inject)(),yr("design:type",Object)],Vi.prototype,"ctx",void 0);mr([(0,Sr.Inject)(),yr("design:type",Ri.MidwayI18nService)],Vi.prototype,"i18nService",void 0);Dt.CompService=Vi=mr([(0,Sr.Provide)()],Vi)},63366:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.ConfigService=void 0;const Sr=rr(46123);const $r=rr(26815);const Er=gr(rr(16928));let Ir=class ConfigService{comphubConfig(){const St=this.app.getAttr($r.KEYS.COMPHUB_CONFIG_KEY);return St}getGlobalConfig(){const St=this.comphubConfig();const{cwd:Dt,srcPath:rr,version:cr,allowDebug:pr,subPort:mr,projectHash:gr}=St;return{cwd:Dt,srcPath:rr,sep:Er.sep,version:cr,allowDebug:pr,subPort:mr,projectHash:gr}}};Dt.ConfigService=Ir;mr([(0,Sr.App)(),yr("design:type",Object)],Ir.prototype,"app",void 0);Dt.ConfigService=Ir=mr([(0,Sr.Provide)()],Ir)},23086:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.DepsService=void 0;const Sr=rr(46123);const $r=gr(rr(16928));const Er=gr(rr(79896));const Ir=rr(64713);const Or=rr(87518);const Hr=rr(26815);const Gr=rr(63366);const Tn=rr(58953);let Wn=class DepsService{async getModuleEntry(St,Dt){const rr=await Or.fileSys.readJsonFile($r.join(Dt,"package.json"));if(!rr){this.ctx.logger.error("未找到 package.json 文件");return[]}const cr=Or.resolver.findDependencyVersion(rr,"vue");const pr=Or.resolver.findDependencyVersion(rr,"react");const mr=await Or.depGraph.detectImports(St,{pathAliases:["@"]});if(cr&&pr){throw new Sr.httpError.BadRequestError("组件同时依赖 vue 和 react,无法确定框架类型")}if(cr){mr.vue={version:cr}}if(pr){mr.react={version:pr};const St=Or.resolver.findDependencyVersion(rr,"react-dom");if(St){mr["react-dom/client"]={version:St}}}const gr={};for(const[St]of Object.entries(mr)){const cr=Or.resolver.findDependencyVersion(rr,St);const pr={version:cr};const mr=await Or.resolver.findOwningPackage(St,Dt);if(mr){pr.version=mr.version;if(!cr){pr.parent={name:mr.name,version:mr.version}}}gr[St]=pr}return Object.entries(gr).map((([St,Dt])=>({name:St,version:Dt.version,...Dt.parent&&{parent:Dt.parent}})))}async buildTemplateCompiler(St,Dt,rr){const cr=$r.join(Dt,"node_modules","vue-template-compiler","package.json");let pr;try{const Dt=JSON.parse(await Er.promises.readFile(cr,"utf-8"));pr=Dt.version;this.ctx.logger.info(`[buildTemplateCompiler] 找到 vue-template-compiler@${pr},Vue 版本: ${St}`)}catch{throw new Error(`未在 node_modules 中找到 vue-template-compiler,请确保项目已安装: npm install vue-template-compiler@${St}`)}const[mr,gr]=St.split(".").map(Number);const[yr,Sr]=(pr||"").split(".").map(Number);if(mr!==yr||gr!==Sr){this.ctx.logger.warn(`[buildTemplateCompiler] 版本不完全匹配: vue@${St} vs vue-template-compiler@${pr},`+`建议安装匹配版本: npm install vue-template-compiler@${St}`)}const Or=`export * from 'vue-template-compiler';`;const Hr=$r.join(rr,"__compiler_entry__.js");await Er.promises.mkdir(rr,{recursive:true});await Er.promises.writeFile(Hr,Or);const Gr=`vue2-template-compiler-${St.replace(/\./g,"_")}.js`;const Tn=$r.join(rr,Gr);try{await(0,Ir.build)({entryPoints:[Hr],bundle:true,format:"iife",globalName:"VueTemplateCompiler",outfile:Tn,platform:"browser",target:"es2015",absWorkingDir:Dt,nodePaths:[$r.join(Dt,"node_modules")],external:[],sourcemap:false,minify:false});this.ctx.logger.info(`[buildTemplateCompiler] esbuild 构建完成: ${Gr}`)}catch(St){await Er.promises.unlink(Hr).catch((()=>{}));throw new Error(`esbuild 构建 vue-template-compiler 失败: ${St.message}`)}await Er.promises.unlink(Hr).catch((()=>{}));return{fileName:Gr}}async precompileModule(St,Dt,rr){const cr=await Or.fileSys.readJsonFile($r.join(rr,"package.json"));if(!cr){this.ctx.logger.error("未找到 package.json 文件");return{entryNameToFile:{}}}const{entryPoints:pr,skippedModules:mr}=(0,Tn.buildEntryPoints)(Dt,cr,rr);const{entryPoints:gr,mergedPackages:yr}=(0,Tn.mergeSubPathEntries)(pr);for(const[,Dt]of Object.entries(yr)){const rr=(0,Tn.generateMergedWrapper)(Dt.subExportMap);const cr=$r.join(St,`${Dt.entryKey}.js`);gr[Dt.entryKey]=cr;await Er.promises.mkdir($r.dirname(cr),{recursive:true});await Er.promises.writeFile(cr,rr)}await Er.promises.mkdir(St,{recursive:true});const Sr={};for(const[St,Dt]of Object.entries(gr)){if(St.startsWith("__merged__")||Or.resolver.isModuleInstalled(St,rr)){Sr[St]=Dt}}const Gr={};for(const St of mr){Gr[St]=St}const Wn=$r.join(St,Hr.KEYS.META_FILE_NAME);const Gn=await Or.fileSys.readJsonFile(Wn);const{filteredEntryPoints:mi,cachedMappings:$i}=(0,Tn.filterCachedModules)(Sr,Gn);for(const[,Dt]of Object.entries(yr)){const rr=Dt.entryKey;if(Gn?.[rr]){const cr=Gn[rr].file;for(const rr of Dt.wrapperSubPaths){const pr=Dt.subExportMap[rr];const mr=`${pr}-w.js`;const gr=$r.join(St,mr);if(!Er.existsSync(gr)){await Er.promises.writeFile(gr,(0,Tn.generateSubWrapper)(pr,cr))}$i[rr]=mr}$i[rr]=cr}}Object.assign(Gr,$i);if(Object.keys(mi).length===0){return{entryNameToFile:Gr}}const ki={entryPoints:mi,bundle:true,format:"esm",splitting:true,outdir:St,entryNames:"[name]-[hash]",chunkNames:"chunk-[hash]",outExtension:{".js":".js"},metafile:true,write:true,target:"esnext",sourcemap:false,external:["vue","react"],absWorkingDir:rr,nodePaths:[$r.join(rr,"node_modules")]};const Ni=await(0,Ir.build)(ki);const{optimized:Ri,entryNameToFile:Vi}=(0,Tn.analyzeBuildOutputs)(Ni,mi,St);for(const[,Dt]of Object.entries(yr)){const rr=Dt.entryKey;if(!(rr in mi))continue;const cr=Vi[rr];if(!cr)continue;for(const rr of Dt.wrapperSubPaths){const pr=Dt.subExportMap[rr];const mr=`${pr}-w.js`;const gr=$r.join(St,mr);await Er.promises.writeFile(gr,(0,Tn.generateSubWrapper)(pr,cr));Vi[rr]=mr}}const ji={...Gn,...Ri};await(0,Tn.saveBuildMetadata)(Wn,ji);return{entryNameToFile:{...Gr,...Vi}}}};Dt.DepsService=Wn;mr([(0,Sr.App)(),yr("design:type",Object)],Wn.prototype,"app",void 0);mr([(0,Sr.Inject)(),yr("design:type",Object)],Wn.prototype,"ctx",void 0);mr([(0,Sr.Inject)(),yr("design:type",Gr.ConfigService)],Wn.prototype,"configService",void 0);Dt.DepsService=Wn=mr([(0,Sr.Provide)()],Wn)},85984:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.ModuleService=void 0;const Sr=rr(46123);const $r=rr(63366);const Er=rr(23086);const Ir=gr(rr(16928));const Or=rr(87518);const Hr=gr(rr(79896));const Gr=rr(26815);let Tn=class ModuleService{async getPreBuildModuleDir(){const{cwd:St}=this.configService.comphubConfig();const Dt=Ir.join(St,Gr.KEYS.PREBUILD_MODULE_DIR);await Hr.promises.mkdir(Dt,{recursive:true});return Dt}async preBuild(St){const Dt=await this.getPreBuildModuleDir();const{cwd:rr}=this.configService.comphubConfig();return await this.depsService.precompileModule(Dt,St,rr)}async buildTemplateCompiler(St){const Dt=await this.getPreBuildModuleDir();const{cwd:rr}=this.configService.comphubConfig();return await this.depsService.buildTemplateCompiler(St,rr,Dt)}async preBuildSize(){const St=await this.getPreBuildModuleDir();return await Or.fileSys.dirSize(St)}async clearPreBuild(){const St=await this.getPreBuildModuleDir();await Hr.promises.rm(St,{recursive:true,force:true})}};Dt.ModuleService=Tn;mr([(0,Sr.Inject)(),yr("design:type",$r.ConfigService)],Tn.prototype,"configService",void 0);mr([(0,Sr.Inject)(),yr("design:type",Er.DepsService)],Tn.prototype,"depsService",void 0);mr([(0,Sr.App)(),yr("design:type",Object)],Tn.prototype,"app",void 0);Dt.ModuleService=Tn=mr([(0,Sr.Provide)()],Tn)},80799:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var Sr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.OssService=void 0;const $r=rr(46123);const Er=Sr(rr(54504));const Ir=Sr(rr(12593));const Or=Sr(rr(18451));const Hr=gr(rr(16928));const Gr=gr(rr(79896));const Tn=rr(96955);const Wn=rr(4990);const Gn=Sr(rr(26506));const mi=Sr(rr(23046));const $i=rr(45853);const ki=rr(26815);const Ni=rr(68255);let Ri=class OssService{createOssClient(St){const Dt={endpoint:ki.KEYS.OSS_CUSTOM_DOMAIN,authorizationV4:true,cname:true,...St};return new Or.default(Dt)}getContentTypeWithCharset(St){const Dt=Hr.extname(St).toLowerCase();const rr={".css":"text/css; charset=utf-8",".js":"application/javascript; charset=utf-8",".mjs":"application/javascript; charset=utf-8",".cjs":"application/javascript; charset=utf-8",".ts":"text/typescript; charset=utf-8",".tsx":"text/typescript; charset=utf-8",".jsx":"text/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".html":"text/html; charset=utf-8",".htm":"text/html; charset=utf-8",".vue":"text/plain; charset=utf-8",".md":"text/markdown; charset=utf-8",".svg":"image/svg+xml; charset=utf-8",".xml":"application/xml; charset=utf-8",".scss":"text/css; charset=utf-8",".sass":"text/css; charset=utf-8",".less":"text/css; charset=utf-8"};return rr[Dt]}createOssFormData(St,Dt,rr=false){const cr=new Er.default;const pr=St.dir+St.key;cr.append("success_action_status","200");cr.append("policy",St.policy);cr.append("x-oss-signature",St.signature);cr.append("x-oss-signature-version",St.x_oss_signature_version);cr.append("x-oss-credential",St.x_oss_credential);cr.append("x-oss-date",St.x_oss_date);cr.append("key",pr);cr.append("x-oss-security-token",St.security_token);cr.append("x-oss-forbid-overwrite",rr?"false":"true");cr.append("Cache-Control","public, max-age=31536000");const mr={};const gr=Dt.path?.toString();if(gr){const St=this.getContentTypeWithCharset(gr);if(St){mr.contentType=St}}cr.append("file",Dt,mr);return{host:St.host,filePath:pr,formData:cr}}async getDownloadSts(){const St=await this.cache.get(ki.KEYS.CACHE_KEY_STS_TOKEN);if(St){return St}const Dt=await Wn.remoteApi.v1Oss.osscontrollerGetsts();const rr=new Date(Dt.data.Expiration).getTime()-1*60*1e3;await this.cache.set(ki.KEYS.CACHE_KEY_STS_EXPIRE_TIME,rr);const cr=rr-Date.now();this.ctx.logger.debug("STS过期时间",(0,mi.default)(rr).format("YYYY-MM-DD HH:mm:ss"));this.cache.set(ki.KEYS.CACHE_KEY_STS_TOKEN,Dt.data,cr);return Dt.data}async uploadFileToOss(St,Dt,rr=false){const{host:cr,formData:pr}=this.createOssFormData(St,Dt,rr);const mr=await Ir.default.post(cr,pr,{headers:{...pr.getHeaders()}}).catch((async St=>{const Dt=St.response.data;const rr=await(0,$i.parseStringPromise)(Dt);if(rr?.Error){throw new $r.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[rr.Error.Message]}))}throw new $r.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[St.message||St]}))}));if(mr.status!==200){throw new $r.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[mr.data]}))}}async downloadFileToPath(St,Dt,rr){const cr=this.createOssClient({region:St.region,accessKeyId:St.AccessKeyId,accessKeySecret:St.AccessKeySecret,stsToken:St.SecurityToken,bucket:St.bucket,refreshSTSToken:async()=>{const St=await this.getDownloadSts();return{accessKeyId:St.AccessKeyId,accessKeySecret:St.AccessKeySecret,stsToken:St.SecurityToken}}});const pr=Dt.map((async St=>{const{path:Dt}=St;const pr=Hr.join(rr,Dt);const mr=Hr.dirname(pr);if(!Gr.existsSync(mr)){Gr.mkdirSync(mr,{recursive:true})}return await cr.get(Dt,pr)}));return await Promise.all(pr)}async getFilePreviewUrl(St,Dt){const rr=(0,Gn.default)(Dt);const cr=await this.cache.get(ki.KEYS.CACHE_KEY_STS_EXPIRE_TIME);const pr=await this.cache.get(rr);const mr=Math.floor((Number(cr)-Date.now())/1e3);this.ctx.logger.debug("文件地址过期时间:",mr,"秒",Math.floor(mr/60),"分钟");if(pr&&mr>0){return pr}const gr=this.createOssClient({region:St.region,accessKeyId:St.AccessKeyId,accessKeySecret:St.AccessKeySecret,stsToken:St.SecurityToken,bucket:St.bucket,refreshSTSToken:async()=>{const St=await this.getDownloadSts();return{accessKeyId:St.AccessKeyId,accessKeySecret:St.AccessKeySecret,stsToken:St.SecurityToken}}});this.ctx.logger.debug("文件地址过期时间:",mr,"秒",Math.floor(mr/60),"分钟");const yr=gr.signatureUrl(Dt,{expires:mr});await this.cache.set(rr,yr,mr*1e3);this.ctx.logger.debug("缓存预览URL",Dt);return yr}};Dt.OssService=Ri;mr([(0,$r.Inject)(),yr("design:type",Object)],Ri.prototype,"ctx",void 0);mr([(0,$r.InjectClient)(Tn.CachingFactory,"default"),yr("design:type",Object)],Ri.prototype,"cache",void 0);mr([(0,$r.Inject)(),yr("design:type",Ni.MidwayI18nService)],Ri.prototype,"i18nService",void 0);Dt.OssService=Ri=mr([(0,$r.Provide)()],Ri)},5578:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.PreprocessingService=void 0;const mr=rr(46123);const gr=rr(34985);const yr=rr(16165);const Sr=pr(rr(86674));let $r=class PreprocessingService{async preprocessCode(St){const{cssCode:Dt,precompilerType:rr}=St;if(rr===gr.PrecompilerEnum.SASS||rr===gr.PrecompilerEnum.SCSS){const St=(0,yr.compileString)(Dt);return St.css}else if(rr===gr.PrecompilerEnum.LESS){const St=await Sr.default.render(Dt);return St.css}return Dt}};Dt.PreprocessingService=$r;Dt.PreprocessingService=$r=cr([(0,mr.Provide)()],$r)},61275:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.QueueService=void 0;const pr=rr(46123);let mr=class QueueService{constructor(){this.queue=[];this.isProcessing=false}async processQueue(){if(this.isProcessing||this.queue.length===0){return}this.isProcessing=true;const St=this.queue.shift();if(St){await St()}this.isProcessing=false;this.processQueue()}async enqueue(St){return new Promise((Dt=>{this.queue.push((async()=>{try{await St()}finally{Dt()}}));this.processQueue()}))}};Dt.QueueService=mr;Dt.QueueService=mr=cr([(0,pr.Provide)(),(0,pr.Scope)(pr.ScopeEnum.Singleton)],mr)},19452:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var Sr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.TerminalService=void 0;const $r=rr(46123);const Er=rr(35317);const Ir=rr(63366);const Or=gr(rr(1999));const Hr=rr(73024);const Gr=rr(51455);const Tn=rr(87518);const Wn=Sr(rr(44644));let Gn=class TerminalService{constructor(){this.subprocess=null;this.cwd="";this.tabIndex=0}getPrompt(){return`${this.cwd}`}smartDecode(St){if(!St||St.length===0)return"";try{new TextDecoder("utf-8",{fatal:true}).decode(St);return Or.decode(St,"utf-8")}catch{return Or.decode(St,"gbk")}}async folderExists(St){try{await(0,Gr.access)(St,Hr.constants.F_OK|Hr.constants.R_OK);return true}catch{return false}}async shutdown(St=5e3){const Dt=this.subprocess;if(!Dt||Dt.killed){this.ctx.emit("output",{cwd:this.getPrompt()});return}return new Promise((rr=>{let cr=false;const done=()=>{if(!cr){cr=true;rr(0)}};Dt.once("exit",done);(0,Wn.default)(Dt.pid,"SIGTERM",(St=>{if(St){this.ctx.emit("output",{err:St.message})}}));const pr=setTimeout((()=>{(0,Wn.default)(Dt.pid,"SIGKILL",(St=>{if(St){this.ctx.emit("output",{err:St.message})}done()}))}),St);Dt.once("exit",(()=>clearTimeout(pr)))}))}async execCmd({cwd:St,oldCwd:Dt,command:rr}){if(!await this.folderExists(St)){this.ctx.emit("output",{err:`${St} 路径不存在`});this.ctx.emit("output",{cwd:Dt});return}this.cwd=St;if(!rr.trim()){this.ctx.emit("output",{cwd:this.getPrompt()});return}if(rr==="^C"){await this.shutdown();return}this.subprocess=(0,Er.spawn)(rr,{shell:true,cwd:St,stdio:["pipe","pipe","pipe"],detached:false,env:{...process.env,FORCE_COLOR:"3",NPM_CONFIG_COLOR:"always",COLORTERM:"truecolor",TERM:"xterm-256color"}});this.subprocess.stdout?.on("data",(St=>{this.ctx.emit("output",{stdout:this.smartDecode(St)})}));this.subprocess.stderr?.on("data",(St=>{this.ctx.emit("output",{stderr:this.smartDecode(St)})}));this.subprocess.on("close",(()=>{this.subprocess=null;this.ctx.emit("output",{cwd:this.getPrompt(),command:rr})}));this.subprocess.on("error",(St=>{this.ctx.emit("output",{err:St.message})}))}async cmdTab({cwd:St,lastWord:Dt}){let rr=await Tn.fileSys.readDirFiles(St);if(Dt){rr=rr.filter((St=>St.name.startsWith(Dt)))}if(rr.length===0){return}this.tabIndex=(this.tabIndex+1)%rr.length;const cr=rr[this.tabIndex];this.ctx.emit("output",{tab:cr.name})}};Dt.TerminalService=Gn;mr([(0,$r.Inject)(),yr("design:type",Ir.ConfigService)],Gn.prototype,"configService",void 0);mr([(0,$r.Inject)(),yr("design:type",Object)],Gn.prototype,"ctx",void 0);Dt.TerminalService=Gn=mr([(0,$r.Provide)()],Gn)},5808:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.VuefinderService=void 0;const Sr=rr(46123);const $r=gr(rr(16928));const Er=gr(rr(79896));const Ir=rr(63366);const Or=gr(rr(93900));const Hr=rr(26815);let Gr=class VuefinderService{async list({path:St}){const Dt=this.configService.comphubConfig();const{srcPath:rr}=Dt;const cr=St?.replace(Hr.KEYS.FILE_MANAGER_DIRNAME,"")||"";let pr=$r.join(rr,cr);const mr=await Er.promises.access(pr).then((()=>true)).catch((()=>false));if(!mr){pr=rr;St=Hr.KEYS.FILE_MANAGER_DIRNAME}const gr=await Er.promises.readdir(pr);const yr=gr.map((async Dt=>{const rr=$r.join(pr,Dt);const cr=await Er.promises.stat(rr);const mr=cr.isDirectory();const gr=St===Hr.KEYS.FILE_MANAGER_DIRNAME?`${St}${Dt}`:`${St}/${Dt}`;return{type:mr?"dir":"file",path:gr,file_size:cr.size,visibility:"public",last_modified:Math.floor(cr.mtimeMs/1e3),basename:Dt,extension:mr?"":$r.extname(Dt).slice(1),mime_type:Or.lookup(Dt)||""}}));const Sr=await Promise.all(yr);Sr.sort(((St,Dt)=>{if(St.type==="dir"&&Dt.type==="file"){return-1}else if(St.type==="file"&&Dt.type==="dir"){return 1}else{return 0}}));return{storages:gr,dirname:St,files:Sr}}};Dt.VuefinderService=Gr;mr([(0,Sr.App)(),yr("design:type",Object)],Gr.prototype,"app",void 0);mr([(0,Sr.Inject)(),yr("design:type",Ir.ConfigService)],Gr.prototype,"configService",void 0);Dt.VuefinderService=Gr=mr([(0,Sr.Provide)()],Gr)},66593:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.TerminalSocketController=void 0;const mr=rr(46123);const gr=rr(19452);let yr=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(St){this.terminalService.execCmd(St)}async onTab(St){this.terminalService.cmdTab(St)}};Dt.TerminalSocketController=yr;cr([(0,mr.Inject)(),pr("design:type",Object)],yr.prototype,"ctx",void 0);cr([(0,mr.Inject)(),pr("design:type",gr.TerminalService)],yr.prototype,"terminalService",void 0);cr([(0,mr.OnWSConnection)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],yr.prototype,"onConnection",null);cr([(0,mr.OnWSDisConnection)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],yr.prototype,"onDisConnection",null);cr([(0,mr.OnWSMessage)("command"),pr("design:type",Function),pr("design:paramtypes",[Object]),pr("design:returntype",Promise)],yr.prototype,"onCommand",null);cr([(0,mr.OnWSMessage)("tab"),pr("design:type",Function),pr("design:paramtypes",[Object]),pr("design:returntype",Promise)],yr.prototype,"onTab",null);Dt.TerminalSocketController=yr=cr([(0,mr.WSController)("/terminal")],yr)},58953:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();Object.defineProperty(Dt,"__esModule",{value:true});Dt.analyzeBuildOutputs=analyzeBuildOutputs;Dt.saveBuildMetadata=saveBuildMetadata;Dt.filterCachedModules=filterCachedModules;Dt.buildEntryPoints=buildEntryPoints;Dt.mergeSubPathEntries=mergeSubPathEntries;Dt.generateMergedWrapper=generateMergedWrapper;Dt.generateSubWrapper=generateSubWrapper;const gr=mr(rr(16928));const yr=mr(rr(79896));const Sr=rr(87518);const $r=rr(18801);const Er=rr(26815);function resolveModuleEntry(St,Dt){if(St!=="vue")return St;const rr=$r.versionKit.getMajorVersion(Dt);return rr==="3"?Er.KEYS.VUE_ESM_BUNDLER:St}function extractModuleName(St){const Dt=St.slice(0,-12);return gr.basename(Dt)}function matchEntryKey(St,Dt){return St.find((St=>{const rr=St.split("/");const cr=rr.length===1?rr[0]:rr[rr.length-1];return Dt===cr}))}function analyzeBuildOutputs(St,Dt,rr){const cr={};const pr={};const mr=Object.keys(Dt);const $r=St.metafile?.outputs??{};for(const[St,Dt]of Object.entries($r)){if(!Dt.entryPoint)continue;const $r=gr.basename(St);const Er=extractModuleName(St);const Ir=matchEntryKey(mr,Er);if(!Ir)continue;pr[Ir]=$r;const Or=gr.join(rr,$r);const Hr=yr.readFileSync(Or,"utf-8");const Gr=Sr.digest.getStringHash(Hr).slice(0,8);cr[Ir]={src:Dt.entryPoint,file:$r,fileHash:Gr,needsInterop:false}}return{optimized:cr,entryNameToFile:pr}}async function saveBuildMetadata(St,Dt){await yr.promises.writeFile(St,JSON.stringify(Dt,null,2))}function filterCachedModules(St,Dt){if(!Dt){return{filteredEntryPoints:St,cachedMappings:{}}}const rr={};const cr={};for(const[pr,mr]of Object.entries(St)){if(Dt[pr]){cr[pr]=Dt[pr].file}else{rr[pr]=mr}}return{filteredEntryPoints:rr,cachedMappings:cr}}function buildEntryPoints(St,Dt,rr){const cr={};const pr=[];for(const mr of St){if(Sr.resolver.shouldSkipByExtension(mr)){pr.push(mr);continue}const St=Sr.resolver.findDependencyVersion(Dt,mr);if(!St){const St=Sr.resolver.findOwningPackage(mr,rr);if(!St)continue}cr[mr]=resolveModuleEntry(mr,St)}return{entryPoints:cr,skippedModules:pr}}function extractPackageName(St){if(St.startsWith("@")){const Dt=St.split("/");return Dt.slice(0,2).join("/")}return St.split("/")[0]}function toSafeIdentifier(St){return St.replace(/\.js$/,"").replace(/[./]/g,"_")}function mergeSubPathEntries(St){const Dt={};const rr={};for(const[cr,pr]of Object.entries(St)){const St=extractPackageName(cr);if(cr!==St){if(!Dt[St])Dt[St]={};Dt[St][cr]=pr}else{rr[cr]=pr}}const cr={};for(const[St,pr]of Object.entries(Dt)){const Dt=Object.keys(pr);if(Dt.length<=1){Object.assign(rr,pr);continue}if(rr[St]){pr[St]=rr[St];delete rr[St]}const mr=`__merged__${St}`;const gr={};const yr=[];for(const St of Object.keys(pr)){const Dt=toSafeIdentifier(St);gr[St]=Dt;yr.push(St)}rr[mr]=mr;cr[St]={entryKey:mr,subExportMap:gr,wrapperSubPaths:yr}}return{entryPoints:rr,mergedPackages:cr}}function generateMergedWrapper(St){const Dt=[];const rr=[];const cr=[];const pr=new Set;for(const[mr,gr]of Object.entries(St)){if(pr.has(gr))continue;pr.add(gr);const St=`__imp_${gr}`;Dt.push(`import * as ${St} from '${mr}';`);rr.push(`export const ${gr} = ${St}.default || Object.assign({}, ${St});`);cr.push(`export * from '${mr}';`)}return["// Auto-generated by comp-hub: merged entry for esbuild",...Dt,...rr,...cr,""].join("\n")}function generateSubWrapper(St,Dt){return[`// Auto-generated: sub-wrapper for ${St}`,`export { ${St} as default } from './${Dt}';`,`export * from './${Dt}';`,""].join("\n")}},49969:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.getErrorMessage=getErrorMessage;function getErrorMessage(St){if(St instanceof Error)return St.message;if(typeof St==="string")return St;return String(St)}},4145:function(St,Dt,rr){"use strict";var cr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.waitForIpcConfig=waitForIpcConfig;const pr=cr(rr(16928));const mr=rr(26815);function parseCwdArg(St){for(let Dt=0;Dt<St.length;Dt++){if(St[Dt]==="--cwd"&&Dt+1<St.length){return St[Dt+1]}if(St[Dt].startsWith("--cwd=")){return St[Dt].replace("--cwd=","")}}return undefined}function waitForIpcConfig(){const St=parseCwdArg(process.argv);if(St){return Promise.resolve({type:"config",port:0,cwd:pr.default.resolve(St),allowDebug:process.env.MIDWAY_SERVER_ENV===mr.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}if(process.send){return new Promise(((St,Dt)=>{const rr=setTimeout((()=>{Dt(new Error("No IPC config received within 10s. MidwayJS must be started by master via fork."))}),1e4);process.once("message",(Dt=>{if(Dt?.type==="config"){clearTimeout(rr);St(Dt)}}))}))}return Promise.resolve({type:"config",port:0,cwd:process.cwd(),allowDebug:process.env.MIDWAY_SERVER_ENV===mr.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}},10778:function(St,Dt,rr){"use strict";var cr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.remoteInstance=Dt.setHeader=void 0;const pr=rr(42552);const mr=rr(26815);const gr=cr(rr(65692));const yr=(0,pr.initInstance)(mr.KEYS.REMOTE_SERVICE_PREFIX,{timeout:1e4,httpsAgent:new gr.default.Agent({rejectUnauthorized:false})},(St=>St.replace(mr.KEYS.REMOTE_SERVICE_PREFIX,"")));Dt.remoteInstance=yr;let Sr=null;const setHeader=St=>{Sr=St};Dt.setHeader=setHeader;yr.interceptors.request.use((St=>{St.headers[mr.KEYS.AUTHORIZATION_HEADER_NAME]=Sr[mr.KEYS.AUTHORIZATION_HEADER_NAME];St.headers[mr.KEYS.CSRF_TOKEN_HEADER_NAME]=Sr[mr.KEYS.CSRF_TOKEN_HEADER_NAME];St.headers[mr.KEYS.ACCEPT_LANGUAGE_HEADER_NAME]=Sr[mr.KEYS.ACCEPT_LANGUAGE_HEADER_NAME.toLowerCase()];St.headers["cookie"]=Sr.cookie;return St}),(St=>Promise.reject(St)));yr.interceptors.response.use((async St=>{if(St.data.code!==0){throw new Error(JSON.stringify(St.data))}return St.data}),(St=>Promise.reject(St)))},67872:function(St,Dt,rr){"use strict";var cr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.createKoaProxy=createKoaProxy;const pr=cr(rr(58611));const mr=rr(31855);const gr=new pr.default.Agent({keepAlive:true,keepAliveMsecs:3e4,maxSockets:50,maxFreeSockets:10});const yr=new Map;function getOrCreateSubProxy(St,Dt){const rr=`${St}|${JSON.stringify(Dt)}`;if(!yr.has(rr)){yr.set(rr,(0,mr.createProxyMiddleware)({target:St,changeOrigin:true,secure:false,agent:gr,pathRewrite:Dt,on:{error:St=>{}}}))}return yr.get(rr)}async function createKoaProxy(St,Dt,rr){const cr=getOrCreateSubProxy(Dt,rr);return new Promise(((Dt,rr)=>{St.res.on("finish",Dt);St.res.on("close",Dt);St.res.on("error",rr);cr(St.req,St.res,(St=>{if(St)rr(St);else Dt()}))}))}},101:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.PackageJsonVO=Dt.LocalCompDetailVO=Dt.LocalCompsVO=Dt.CompFileHashVO=Dt.CompSimilarListVO=Dt.CompFilesOssSignedUrlVO=Dt.DownloadCompVO=Dt.LocalCompsByIdsVO=Dt.ImportScanResultVO=Dt.CompCheckVO=Dt.CompFileContentVO=Dt.CompFileVO=Dt.CompSimilarListItemVO=Dt.FileNode=void 0;const mr=rr(49179);const gr=rr(26815);class FileNode{}Dt.FileNode=FileNode;cr([(0,mr.ApiProperty)({description:"目录/文件名称",example:"index.vue",required:true}),pr("design:type",String)],FileNode.prototype,"name",void 0);cr([(0,mr.ApiProperty)({description:"目录/文件路径",example:"/src/components/MyComp/index.vue",required:true}),pr("design:type",String)],FileNode.prototype,"path",void 0);cr([(0,mr.ApiProperty)({description:"目录/文件类型",example:"file",required:true,enum:gr.ENUM.FileType}),pr("design:type",String)],FileNode.prototype,"type",void 0);cr([(0,mr.ApiProperty)({description:"子节点",type:[FileNode]}),pr("design:type",Array)],FileNode.prototype,"children",void 0);class CompSimilarListItemVO{}Dt.CompSimilarListItemVO=CompSimilarListItemVO;cr([(0,mr.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),pr("design:type",String)],CompSimilarListItemVO.prototype,"_id",void 0);cr([(0,mr.ApiProperty)({example:"组件名称",description:"组件名称",required:true}),pr("design:type",String)],CompSimilarListItemVO.prototype,"name",void 0);class CompFileVO{}Dt.CompFileVO=CompFileVO;cr([(0,mr.ApiProperty)({type:FileNode,description:"组件文件树",required:true}),pr("design:type",FileNode)],CompFileVO.prototype,"tree",void 0);cr([(0,mr.ApiProperty)({type:[String],description:"组件文件列表",required:true}),pr("design:type",Array)],CompFileVO.prototype,"files",void 0);class CompFileContentVO{}Dt.CompFileContentVO=CompFileContentVO;cr([(0,mr.ApiProperty)({description:"组件文件内容",example:"let a=123;",required:true}),pr("design:type",String)],CompFileContentVO.prototype,"content",void 0);class CompCheckVO{}Dt.CompCheckVO=CompCheckVO;cr([(0,mr.ApiProperty)({description:"组件入口文件路径",required:false}),pr("design:type",String)],CompCheckVO.prototype,"entryIndexPath",void 0);cr([(0,mr.ApiProperty)({description:"组件配置文件路径",required:false}),pr("design:type",String)],CompCheckVO.prototype,"compJsonPath",void 0);cr([(0,mr.ApiProperty)({description:"异常结果内容",required:true}),pr("design:type",String)],CompCheckVO.prototype,"errorMsg",void 0);class ParentVO{}cr([(0,mr.ApiProperty)({description:"父库名称",required:true,example:"vue"}),pr("design:type",String)],ParentVO.prototype,"name",void 0);cr([(0,mr.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),pr("design:type",String)],ParentVO.prototype,"version",void 0);class ImportDetailVO{}cr([(0,mr.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),pr("design:type",String)],ImportDetailVO.prototype,"name",void 0);cr([(0,mr.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),pr("design:type",String)],ImportDetailVO.prototype,"version",void 0);cr([(0,mr.ApiProperty)({type:ParentVO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),pr("design:type",ParentVO)],ImportDetailVO.prototype,"parent",void 0);class ImportScanResultVO{}Dt.ImportScanResultVO=ImportScanResultVO;cr([(0,mr.ApiProperty)({type:[ImportDetailVO],required:true,description:"第三方库导入详情"}),pr("design:type",Array)],ImportScanResultVO.prototype,"thirdParty",void 0);class CompInfoVO{}cr([(0,mr.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),pr("design:type",String)],CompInfoVO.prototype,"id",void 0);cr([(0,mr.ApiProperty)({description:"组件文件路径",example:"local:///MyComp/index.vue",required:true}),pr("design:type",String)],CompInfoVO.prototype,"path",void 0);cr([(0,mr.ApiProperty)({description:"组件文件名称",example:"base-table",required:true}),pr("design:type",String)],CompInfoVO.prototype,"basename",void 0);cr([(0,mr.ApiProperty)({description:"组件文件完整路径",example:"/src/components/MyComp/index.vue",required:true}),pr("design:type",String)],CompInfoVO.prototype,"fullPath",void 0);cr([(0,mr.ApiProperty)({description:"组件文件完整路径哈希值",example:"123",required:true}),pr("design:type",String)],CompInfoVO.prototype,"fullPathHash",void 0);class LocalCompsByIdsVO{}Dt.LocalCompsByIdsVO=LocalCompsByIdsVO;cr([(0,mr.ApiProperty)({type:[CompInfoVO],required:true}),pr("design:type",Array)],LocalCompsByIdsVO.prototype,"compInfos",void 0);class DownloadCompVO{}Dt.DownloadCompVO=DownloadCompVO;cr([(0,mr.ApiProperty)({description:"组件是否重复",example:true,required:true}),pr("design:type",Boolean)],DownloadCompVO.prototype,"isRepeat",void 0);class SignedUrlItem{}cr([(0,mr.ApiProperty)({description:"文件路径",example:"/src/components/MyComp/index.vue",required:true}),pr("design:type",String)],SignedUrlItem.prototype,"path",void 0);cr([(0,mr.ApiProperty)({description:"文件oss签名访问地址",example:"https://comp-hub.oss-cn-beijing.aliyuncs.com/src/components/MyComp/index.vue?x-oss-security-token=...",required:true}),pr("design:type",String)],SignedUrlItem.prototype,"signedUrl",void 0);class CompFilesOssSignedUrlVO{}Dt.CompFilesOssSignedUrlVO=CompFilesOssSignedUrlVO;cr([(0,mr.ApiProperty)({description:"文件oss签名访问地址列表",type:[SignedUrlItem],required:true}),pr("design:type",Array)],CompFilesOssSignedUrlVO.prototype,"signedUrls",void 0);class CompSimilarListVO{}Dt.CompSimilarListVO=CompSimilarListVO;cr([(0,mr.ApiProperty)({type:[CompSimilarListItemVO],description:"相似组件列表",required:true}),pr("design:type",Array)],CompSimilarListVO.prototype,"similarList",void 0);class CompFileHashVO{}Dt.CompFileHashVO=CompFileHashVO;cr([(0,mr.ApiProperty)({example:"123",description:"组件哈希值",required:true}),pr("design:type",String)],CompFileHashVO.prototype,"compHash",void 0);class PreviewItem{}cr([(0,mr.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"预览配置项主键ID(自动生成)",required:false}),pr("design:type",String)],PreviewItem.prototype,"_id",void 0);cr([(0,mr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),pr("design:type",Array)],PreviewItem.prototype,"miniPath",void 0);cr([(0,mr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),pr("design:type",Array)],PreviewItem.prototype,"fullPath",void 0);cr([(0,mr.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),pr("design:type",String)],PreviewItem.prototype,"desc",void 0);class LocalCompsVO{}Dt.LocalCompsVO=LocalCompsVO;cr([(0,mr.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"内容id,这里用路径哈希值",required:true}),pr("design:type",String)],LocalCompsVO.prototype,"_id",void 0);cr([(0,mr.ApiProperty)({type:String,example:"qin-table",description:"组件名称",required:true}),pr("design:type",String)],LocalCompsVO.prototype,"name",void 0);cr([(0,mr.ApiProperty)({type:String,example:"123456",description:"组件ID",required:true}),pr("design:type",String)],LocalCompsVO.prototype,"compId",void 0);cr([(0,mr.ApiProperty)({type:String,example:"1.0.0",description:"组件版本",required:true}),pr("design:type",String)],LocalCompsVO.prototype,"version",void 0);cr([(0,mr.ApiProperty)({type:[PreviewItem],required:true}),pr("design:type",Array)],LocalCompsVO.prototype,"previewConfigs",void 0);cr([(0,mr.ApiProperty)({type:String,example:"local://components/QinTable",description:"组件文件路径",required:true}),pr("design:type",String)],LocalCompsVO.prototype,"path",void 0);cr([(0,mr.ApiProperty)({type:String,example:"D:/src/components/QinTable/index.vue",description:"组件文件完整路径",required:true}),pr("design:type",String)],LocalCompsVO.prototype,"fullPath",void 0);cr([(0,mr.ApiProperty)({type:String,example:"#f0f0f0",description:"组件背景颜色",required:false}),pr("design:type",String)],LocalCompsVO.prototype,"bgColor",void 0);class LocalCompDetailVO extends LocalCompsVO{}Dt.LocalCompDetailVO=LocalCompDetailVO;class PackageJsonVO{}Dt.PackageJsonVO=PackageJsonVO;cr([(0,mr.ApiProperty)({type:Object,description:"组件package.json文件内容",required:true}),pr("design:type",Object)],PackageJsonVO.prototype,"packageJson",void 0)},71692:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.BuildTemplateCompilerVO=Dt.PreBuildSizeVO=Dt.PreBuildVO=void 0;const mr=rr(49179);class PreBuildVO{}Dt.PreBuildVO=PreBuildVO;cr([(0,mr.ApiProperty)({description:"预构建模块对应文件",required:true,example:{vue:"vue-hash.js"}}),pr("design:type",Object)],PreBuildVO.prototype,"entryNameToFile",void 0);class PreBuildSizeVO{}Dt.PreBuildSizeVO=PreBuildSizeVO;cr([(0,mr.ApiProperty)({description:"预构建模块文件总大小",required:true,example:1024}),pr("design:type",Number)],PreBuildSizeVO.prototype,"size",void 0);class BuildTemplateCompilerVO{}Dt.BuildTemplateCompilerVO=BuildTemplateCompilerVO;cr([(0,mr.ApiProperty)({description:"vue-template-compiler 浏览器 bundle 文件名,通过 /_module_load_prefix_/ 前缀加载",required:true,example:"vue2-template-compiler-2_6_14.js"}),pr("design:type",String)],BuildTemplateCompilerVO.prototype,"fileName",void 0)},75049:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SignedUrlVO=void 0;const mr=rr(49179);class SignedUrlVO{}Dt.SignedUrlVO=SignedUrlVO;cr([(0,mr.ApiProperty)({example:"xxxx",description:"带签名的访问地址",required:true}),pr("design:type",String)],SignedUrlVO.prototype,"signUrl",void 0)},18922:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.PreprocessedCodeVO=void 0;const mr=rr(49179);class PreprocessedCodeVO{}Dt.PreprocessedCodeVO=PreprocessedCodeVO;cr([(0,mr.ApiProperty)({description:"预处理后的css代码",required:true}),pr("design:type",String)],PreprocessedCodeVO.prototype,"preprocessedCode",void 0)},15798:(St,Dt)=>{"use strict";const rr={suspectRx:/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*\:/};Dt.parse=function(St,...cr){const pr=typeof cr[0]==="object"&&cr[0];const mr=cr.length>1||!pr?cr[0]:undefined;const gr=cr.length>1&&cr[1]||pr||{};const yr=JSON.parse(St,mr);if(gr.protoAction==="ignore"){return yr}if(!yr||typeof yr!=="object"){return yr}if(!St.match(rr.suspectRx)){return yr}Dt.scan(yr,gr);return yr};Dt.scan=function(St,Dt={}){let rr=[St];while(rr.length){const St=rr;rr=[];for(const cr of St){if(Object.prototype.hasOwnProperty.call(cr,"__proto__")){if(Dt.protoAction!=="remove"){throw new SyntaxError("Object contains forbidden prototype property")}delete cr.__proto__}for(const St in cr){const Dt=cr[St];if(Dt&&typeof Dt==="object"){rr.push(cr[St])}}}}};Dt.safeParse=function(St,rr){try{return Dt.parse(St,rr)}catch(St){return null}}},35522:(St,Dt,rr)=>{"use strict";const cr=rr(99583);const pr=rr(43700);const mr=rr(66621);const gr=rr(69322);const yr={};St.exports=function(St,Dt,rr={}){cr(St&&typeof St==="object","Invalid defaults value: must be an object");cr(!Dt||Dt===true||typeof Dt==="object","Invalid source value: must be true, falsy or an object");cr(typeof rr==="object","Invalid options: must be an object");if(!Dt){return null}if(rr.shallow){return yr.applyToDefaultsWithShallow(St,Dt,rr)}const gr=pr(St);if(Dt===true){return gr}const Sr=rr.nullOverride!==undefined?rr.nullOverride:false;return mr(gr,Dt,{nullOverride:Sr,mergeArrays:false})};yr.applyToDefaultsWithShallow=function(St,Dt,rr){const Sr=rr.shallow;cr(Array.isArray(Sr),"Invalid keys");const $r=new Map;const Er=Dt===true?null:new Set;for(let rr of Sr){rr=Array.isArray(rr)?rr:rr.split(".");const cr=gr(St,rr);if(cr&&typeof cr==="object"){$r.set(cr,Er&&gr(Dt,rr)||cr)}else if(Er){Er.add(rr)}}const Ir=pr(St,{},$r);if(!Er){return Ir}for(const St of Er){yr.reachCopy(Ir,Dt,St)}const Or=rr.nullOverride!==undefined?rr.nullOverride:false;return mr(Ir,Dt,{nullOverride:Or,mergeArrays:false})};yr.reachCopy=function(St,Dt,rr){for(const St of rr){if(!(St in Dt)){return}const rr=Dt[St];if(typeof rr!=="object"||rr===null){return}Dt=rr}const cr=Dt;let pr=St;for(let St=0;St<rr.length-1;++St){const Dt=rr[St];if(typeof pr[Dt]!=="object"){pr[Dt]={}}pr=pr[Dt]}pr[rr[rr.length-1]]=cr}},99583:(St,Dt,rr)=>{"use strict";const cr=rr(16443);const pr={};St.exports=function(St,...Dt){if(St){return}if(Dt.length===1&&Dt[0]instanceof Error){throw Dt[0]}throw new cr(Dt)}},43700:(St,Dt,rr)=>{"use strict";const cr=rr(69322);const pr=rr(99704);const mr=rr(87492);const gr={needsProtoHack:new Set([pr.set,pr.map,pr.weakSet,pr.weakMap])};St.exports=gr.clone=function(St,Dt={},rr=null){if(typeof St!=="object"||St===null){return St}let cr=gr.clone;let yr=rr;if(Dt.shallow){if(Dt.shallow!==true){return gr.cloneWithShallow(St,Dt)}cr=St=>St}else if(yr){const Dt=yr.get(St);if(Dt){return Dt}}else{yr=new Map}const Sr=pr.getInternalProto(St);if(Sr===pr.buffer){return Buffer&&Buffer.from(St)}if(Sr===pr.date){return new Date(St.getTime())}if(Sr===pr.regex){return new RegExp(St)}const $r=gr.base(St,Sr,Dt);if($r===St){return St}if(yr){yr.set(St,$r)}if(Sr===pr.set){for(const rr of St){$r.add(cr(rr,Dt,yr))}}else if(Sr===pr.map){for(const[rr,pr]of St){$r.set(rr,cr(pr,Dt,yr))}}const Er=mr.keys(St,Dt);for(const rr of Er){if(rr==="__proto__"){continue}if(Sr===pr.array&&rr==="length"){$r.length=St.length;continue}const mr=Object.getOwnPropertyDescriptor(St,rr);if(mr){if(mr.get||mr.set){Object.defineProperty($r,rr,mr)}else if(mr.enumerable){$r[rr]=cr(St[rr],Dt,yr)}else{Object.defineProperty($r,rr,{enumerable:false,writable:true,configurable:true,value:cr(St[rr],Dt,yr)})}}else{Object.defineProperty($r,rr,{enumerable:true,writable:true,configurable:true,value:cr(St[rr],Dt,yr)})}}return $r};gr.cloneWithShallow=function(St,Dt){const rr=Dt.shallow;Dt=Object.assign({},Dt);Dt.shallow=false;const pr=new Map;for(const Dt of rr){const rr=cr(St,Dt);if(typeof rr==="object"||typeof rr==="function"){pr.set(rr,rr)}}return gr.clone(St,Dt,pr)};gr.base=function(St,Dt,rr){if(rr.prototype===false){if(gr.needsProtoHack.has(Dt)){return new Dt.constructor}return Dt===pr.array?[]:{}}const cr=Object.getPrototypeOf(St);if(cr&&cr.isImmutable){return St}if(Dt===pr.array){const St=[];if(cr!==Dt){Object.setPrototypeOf(St,cr)}return St}if(gr.needsProtoHack.has(Dt)){const St=new cr.constructor;if(cr!==Dt){Object.setPrototypeOf(St,cr)}return St}return Object.create(cr)}},35879:(St,Dt,rr)=>{"use strict";const cr=rr(99704);const pr={mismatched:null};St.exports=function(St,Dt,rr){rr=Object.assign({prototype:true},rr);return!!pr.isDeepEqual(St,Dt,rr,[])};pr.isDeepEqual=function(St,Dt,rr,mr){if(St===Dt){return St!==0||1/St===1/Dt}const gr=typeof St;if(gr!==typeof Dt){return false}if(St===null||Dt===null){return false}if(gr==="function"){if(!rr.deepFunction||St.toString()!==Dt.toString()){return false}}else if(gr!=="object"){return St!==St&&Dt!==Dt}const yr=pr.getSharedType(St,Dt,!!rr.prototype);switch(yr){case cr.buffer:return Buffer&&Buffer.prototype.equals.call(St,Dt);case cr.promise:return St===Dt;case cr.regex:return St.toString()===Dt.toString();case pr.mismatched:return false}for(let rr=mr.length-1;rr>=0;--rr){if(mr[rr].isSame(St,Dt)){return true}}mr.push(new pr.SeenEntry(St,Dt));try{return!!pr.isDeepEqualObj(yr,St,Dt,rr,mr)}finally{mr.pop()}};pr.getSharedType=function(St,Dt,rr){if(rr){if(Object.getPrototypeOf(St)!==Object.getPrototypeOf(Dt)){return pr.mismatched}return cr.getInternalProto(St)}const mr=cr.getInternalProto(St);if(mr!==cr.getInternalProto(Dt)){return pr.mismatched}return mr};pr.valueOf=function(St){const Dt=St.valueOf;if(Dt===undefined){return St}try{return Dt.call(St)}catch(St){return St}};pr.hasOwnEnumerableProperty=function(St,Dt){return Object.prototype.propertyIsEnumerable.call(St,Dt)};pr.isSetSimpleEqual=function(St,Dt){for(const rr of Set.prototype.values.call(St)){if(!Set.prototype.has.call(Dt,rr)){return false}}return true};pr.isDeepEqualObj=function(St,Dt,rr,mr,gr){const{isDeepEqual:yr,valueOf:Sr,hasOwnEnumerableProperty:$r}=pr;const{keys:Er,getOwnPropertySymbols:Ir}=Object;if(St===cr.array){if(mr.part){for(const St of Dt){for(const Dt of rr){if(yr(St,Dt,mr,gr)){return true}}}}else{if(Dt.length!==rr.length){return false}for(let St=0;St<Dt.length;++St){if(!yr(Dt[St],rr[St],mr,gr)){return false}}return true}}else if(St===cr.set){if(Dt.size!==rr.size){return false}if(!pr.isSetSimpleEqual(Dt,rr)){const St=new Set(Set.prototype.values.call(rr));for(const rr of Set.prototype.values.call(Dt)){if(St.delete(rr)){continue}let Dt=false;for(const cr of St){if(yr(rr,cr,mr,gr)){St.delete(cr);Dt=true;break}}if(!Dt){return false}}}}else if(St===cr.map){if(Dt.size!==rr.size){return false}for(const[St,cr]of Map.prototype.entries.call(Dt)){if(cr===undefined&&!Map.prototype.has.call(rr,St)){return false}if(!yr(cr,Map.prototype.get.call(rr,St),mr,gr)){return false}}}else if(St===cr.error){if(Dt.name!==rr.name||Dt.message!==rr.message){return false}}const Or=Sr(Dt);const Hr=Sr(rr);if((Dt!==Or||rr!==Hr)&&!yr(Or,Hr,mr,gr)){return false}const Gr=Er(Dt);if(!mr.part&&Gr.length!==Er(rr).length&&!mr.skip){return false}let Tn=0;for(const St of Gr){if(mr.skip&&mr.skip.includes(St)){if(rr[St]===undefined){++Tn}continue}if(!$r(rr,St)){return false}if(!yr(Dt[St],rr[St],mr,gr)){return false}}if(!mr.part&&Gr.length-Tn!==Er(rr).length){return false}if(mr.symbols!==false){const St=Ir(Dt);const cr=new Set(Ir(rr));for(const pr of St){if(!mr.skip||!mr.skip.includes(pr)){if($r(Dt,pr)){if(!$r(rr,pr)){return false}if(!yr(Dt[pr],rr[pr],mr,gr)){return false}}else if($r(rr,pr)){return false}}cr.delete(pr)}for(const St of cr){if($r(rr,St)){return false}}}return true};pr.SeenEntry=class{constructor(St,Dt){this.obj=St;this.ref=Dt}isSame(St,Dt){return this.obj===St&&this.ref===Dt}}},16443:(St,Dt,rr)=>{"use strict";const cr=rr(72912);const pr={};St.exports=class extends Error{constructor(St){const rr=St.filter((St=>St!=="")).map((St=>typeof St==="string"?St:St instanceof Error?St.message:cr(St)));super(rr.join(" ")||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,Dt.assert)}}}},57391:St=>{"use strict";const Dt={};St.exports=function(St){if(!St){return""}let rr="";for(let cr=0;cr<St.length;++cr){const pr=St.charCodeAt(cr);if(Dt.isSafe(pr)){rr+=St[cr]}else{rr+=Dt.escapeHtmlChar(pr)}}return rr};Dt.escapeHtmlChar=function(St){const rr=Dt.namedHtml.get(St);if(rr){return rr}if(St>=256){return"&#"+St+";"}const cr=St.toString(16).padStart(2,"0");return`&#x${cr};`};Dt.isSafe=function(St){return Dt.safeCharCodes.has(St)};Dt.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]);Dt.safeCharCodes=function(){const St=new Set;for(let Dt=32;Dt<123;++Dt){if(Dt>=97||Dt>=65&&Dt<=90||Dt>=48&&Dt<=57||Dt===32||Dt===46||Dt===44||Dt===45||Dt===58||Dt===95){St.add(Dt)}}return St}()},43935:St=>{"use strict";const Dt={};St.exports=function(St){return St.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},85363:St=>{"use strict";const Dt={};St.exports=function(){}},66621:(St,Dt,rr)=>{"use strict";const cr=rr(99583);const pr=rr(43700);const mr=rr(87492);const gr={};St.exports=gr.merge=function(St,Dt,rr){cr(St&&typeof St==="object","Invalid target value: must be an object");cr(Dt===null||Dt===undefined||typeof Dt==="object","Invalid source value: must be null, undefined, or an object");if(!Dt){return St}rr=Object.assign({nullOverride:true,mergeArrays:true},rr);if(Array.isArray(Dt)){cr(Array.isArray(St),"Cannot merge array onto an object");if(!rr.mergeArrays){St.length=0}for(let cr=0;cr<Dt.length;++cr){St.push(pr(Dt[cr],{symbols:rr.symbols}))}return St}const yr=mr.keys(Dt,rr);for(let cr=0;cr<yr.length;++cr){const mr=yr[cr];if(mr==="__proto__"||!Object.prototype.propertyIsEnumerable.call(Dt,mr)){continue}const Sr=Dt[mr];if(Sr&&typeof Sr==="object"){if(St[mr]===Sr){continue}if(!St[mr]||typeof St[mr]!=="object"||Array.isArray(St[mr])!==Array.isArray(Sr)||Sr instanceof Date||Buffer&&Buffer.isBuffer(Sr)||Sr instanceof RegExp){St[mr]=pr(Sr,{symbols:rr.symbols})}else{gr.merge(St[mr],Sr,rr)}}else{if(Sr!==null&&Sr!==undefined){St[mr]=Sr}else if(rr.nullOverride){St[mr]=Sr}}}return St}},69322:(St,Dt,rr)=>{"use strict";const cr=rr(99583);const pr={};St.exports=function(St,Dt,rr){if(Dt===false||Dt===null||Dt===undefined){return St}rr=rr||{};if(typeof rr==="string"){rr={separator:rr}}const mr=Array.isArray(Dt);cr(!mr||!rr.separator,"Separator option is not valid for array-based chain");const gr=mr?Dt:Dt.split(rr.separator||".");let yr=St;for(let St=0;St<gr.length;++St){let mr=gr[St];const Sr=rr.iterables&&pr.iterables(yr);if(Array.isArray(yr)||Sr==="set"){const St=Number(mr);if(Number.isInteger(St)){mr=St<0?yr.length+St:St}}if(!yr||typeof yr==="function"&&rr.functions===false||!Sr&&yr[mr]===undefined){cr(!rr.strict||St+1===gr.length,"Missing segment",mr,"in reach path ",Dt);cr(typeof yr==="object"||rr.functions===true||typeof yr!=="function","Invalid segment",mr,"in reach path ",Dt);yr=rr.default;break}if(!Sr){yr=yr[mr]}else if(Sr==="set"){yr=[...yr][mr]}else{yr=yr.get(mr)}}return yr};pr.iterables=function(St){if(St instanceof Set){return"set"}if(St instanceof Map){return"map"}}},72912:St=>{"use strict";const Dt={};St.exports=function(...St){try{return JSON.stringify(...St)}catch(St){return"[Cannot display object: "+St.message+"]"}}},99704:(St,Dt)=>{"use strict";const rr={};Dt=St.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};rr.typeMap=new Map([["[object Error]",Dt.error],["[object Map]",Dt.map],["[object Promise]",Dt.promise],["[object Set]",Dt.set],["[object WeakMap]",Dt.weakMap],["[object WeakSet]",Dt.weakSet]]);Dt.getInternalProto=function(St){if(Array.isArray(St)){return Dt.array}if(Buffer&&St instanceof Buffer){return Dt.buffer}if(St instanceof Date){return Dt.date}if(St instanceof RegExp){return Dt.regex}if(St instanceof Error){return Dt.error}const cr=Object.prototype.toString.call(St);return rr.typeMap.get(cr)||Dt.generic}},87492:(St,Dt)=>{"use strict";const rr={};Dt.keys=function(St,Dt={}){return Dt.symbols!==false?Reflect.ownKeys(St):Object.getOwnPropertyNames(St)}},75663:(St,Dt,rr)=>{"use strict";const cr=rr(99583);const pr={};Dt.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(St,Dt){Dt=Dt||{};const rr=[].concat(Dt.before||[]);const pr=[].concat(Dt.after||[]);const mr=Dt.group||"?";const gr=Dt.sort||0;cr(!rr.includes(mr),`Item cannot come before itself: ${mr}`);cr(!rr.includes("?"),"Item cannot come before unassociated items");cr(!pr.includes(mr),`Item cannot come after itself: ${mr}`);cr(!pr.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(St)){St=[St]}for(const Dt of St){const St={seq:this._items.length,sort:gr,before:rr,after:pr,group:mr,node:Dt};this._items.push(St)}if(!Dt.manual){const St=this._sort();cr(St,"item",mr!=="?"?`added into group ${mr}`:"","created a dependencies error")}return this.nodes}merge(St){if(!Array.isArray(St)){St=[St]}for(const Dt of St){if(Dt){for(const St of Dt._items){this._items.push(Object.assign({},St))}}}this._items.sort(pr.mergeSort);for(let St=0;St<this._items.length;++St){this._items[St].seq=St}const Dt=this._sort();cr(Dt,"merge created a dependencies error");return this.nodes}sort(){const St=this._sort();cr(St,"sort created a dependencies error");return this.nodes}_sort(){const St={};const Dt=Object.create(null);const rr=Object.create(null);for(const cr of this._items){const pr=cr.seq;const mr=cr.group;rr[mr]=rr[mr]||[];rr[mr].push(pr);St[pr]=cr.before;for(const St of cr.after){Dt[St]=Dt[St]||[];Dt[St].push(pr)}}for(const Dt in St){const cr=[];for(const pr in St[Dt]){const mr=St[Dt][pr];rr[mr]=rr[mr]||[];cr.push(...rr[mr])}St[Dt]=cr}for(const cr in Dt){if(rr[cr]){for(const pr of rr[cr]){St[pr].push(...Dt[cr])}}}const cr={};for(const Dt in St){const rr=St[Dt];for(const St of rr){cr[St]=cr[St]||[];cr[St].push(Dt)}}const pr={};const mr=[];for(let St=0;St<this._items.length;++St){let Dt=St;if(cr[St]){Dt=null;for(let St=0;St<this._items.length;++St){if(pr[St]===true){continue}if(!cr[St]){cr[St]=[]}const rr=cr[St].length;let mr=0;for(let Dt=0;Dt<rr;++Dt){if(pr[cr[St][Dt]]){++mr}}if(mr===rr){Dt=St;break}}}if(Dt!==null){pr[Dt]=true;mr.push(Dt)}}if(mr.length!==this._items.length){return false}const gr={};for(const St of this._items){gr[St.seq]=St}this._items=[];this.nodes=[];for(const St of mr){const Dt=gr[St];this.nodes.push(Dt.node);this._items.push(Dt)}return true}};pr.mergeSort=(St,Dt)=>St.sort===Dt.sort?0:St.sort<Dt.sort?-1:1},3563:(St,Dt,rr)=>{const{parse:cr,format:pr}=rr(87016);const{pathToRegexp:mr,compile:gr,parse:yr}=rr(44985);St.exports=Layer;function Layer(St,Dt,rr,cr={}){this.opts=cr;this.name=this.opts.name||null;this.methods=[];this.paramNames=[];this.stack=Array.isArray(rr)?rr:[rr];for(const St of Dt){const Dt=this.methods.push(St.toUpperCase());if(this.methods[Dt-1]==="GET")this.methods.unshift("HEAD")}for(let rr=0;rr<this.stack.length;rr++){const cr=this.stack[rr];const pr=typeof cr;if(pr!=="function")throw new Error(`${Dt.toString()} \`${this.opts.name||St}\`: \`middleware\` must be a function, not \`${pr}\``)}this.path=St;this.regexp=mr(St,this.paramNames,this.opts)}Layer.prototype.match=function(St){return this.regexp.test(St)};Layer.prototype.params=function(St,Dt,rr={}){for(let St=Dt.length,cr=0;cr<St;cr++){if(this.paramNames[cr]){const St=Dt[cr];if(St&&St.length>0)rr[this.paramNames[cr].name]=St?safeDecodeURIComponent(St):St}}return rr};Layer.prototype.captures=function(St){return this.opts.ignoreCaptures?[]:St.match(this.regexp).slice(1)};Layer.prototype.url=function(St,Dt){let rr=St;const mr=this.path.replace(/\(\.\*\)/g,"");if(typeof St!=="object"){rr=Array.prototype.slice.call(arguments);if(typeof rr[rr.length-1]==="object"){Dt=rr[rr.length-1];rr=rr.slice(0,-1)}}const Sr=gr(mr,{encode:encodeURIComponent,...Dt});let $r;const Er=yr(mr);let Ir={};if(Array.isArray(rr)){for(let St=Er.length,Dt=0,cr=0;Dt<St;Dt++){if(Er[Dt].name)Ir[Er[Dt].name]=rr[cr++]}}else if(Er.some((St=>St.name))){Ir=St}else if(!Dt){Dt=St}$r=Sr(Ir);if(Dt&&Dt.query){$r=cr($r);if(typeof Dt.query==="string"){$r.search=Dt.query}else{$r.search=undefined;$r.query=Dt.query}return pr($r)}return $r};Layer.prototype.param=function(St,Dt){const{stack:rr}=this;const cr=this.paramNames;const middleware=function(rr,cr){return Dt.call(this,rr.params[St],rr,cr)};middleware.param=St;const pr=cr.map((function(St){return St.name}));const mr=pr.indexOf(St);if(mr>-1){rr.some((function(St,Dt){if(!St.param||pr.indexOf(St.param)>mr){rr.splice(Dt,0,middleware);return true}}))}return this};Layer.prototype.setPrefix=function(St){if(this.path){this.path=this.path!=="/"||this.opts.strict===true?`${St}${this.path}`:St;this.paramNames=[];this.regexp=mr(this.path,this.paramNames,this.opts)}return this};function safeDecodeURIComponent(St){try{return decodeURIComponent(St)}catch{return St}}},53777:(St,Dt,rr)=>{const cr=rr(77246);const pr=rr(58024);const mr=rr(93);const{pathToRegexp:gr}=rr(44985);const yr=rr(3563);const Sr=rr(26675)("koa-router");St.exports=Router;function Router(St={}){if(!(this instanceof Router))return new Router(St);this.opts=St;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 $r of mr){function setMethodVerb(St){Router.prototype[St]=function(Dt,rr,cr){if(typeof rr==="string"||rr instanceof RegExp){cr=Array.prototype.slice.call(arguments,2)}else{cr=Array.prototype.slice.call(arguments,1);rr=Dt;Dt=null}if(typeof rr!=="string"&&!(rr instanceof RegExp)&&(!Array.isArray(rr)||rr.length===0))throw new Error(`You have to provide a path when adding a ${St} handler`);this.register(rr,[St],cr,{name:Dt});return this}}setMethodVerb($r)}Router.prototype.del=Router.prototype["delete"];Router.prototype.use=function(){const St=this;const Dt=Array.prototype.slice.call(arguments);let rr;if(Array.isArray(Dt[0])&&typeof Dt[0][0]==="string"){const pr=Dt[0];for(const mr of pr){St.use.apply(St,[mr].concat(Dt.slice(1)))}return this}const cr=typeof Dt[0]==="string";if(cr)rr=Dt.shift();for(const Sr of Dt){if(Sr.router){const $r=Object.assign(Object.create(Router.prototype),Sr.router,{stack:[...Sr.router.stack]});for(let Er=0;Er<$r.stack.length;Er++){const Ir=$r.stack[Er];const Or=Object.assign(Object.create(yr.prototype),Ir);if(rr)Or.setPrefix(rr);if(St.opts.prefix)Or.setPrefix(St.opts.prefix);St.stack.push(Or);$r.stack[Er]=Or}if(St.params){function setRouterParams(Dt){const rr=Dt;for(const Dt of rr){$r.param(Dt,St.params[Dt])}}setRouterParams(Object.keys(St.params))}}else{const Hr=[];gr(St.opts.prefix||"",Hr);const Gr=St.opts.prefix&&Hr.length;St.register(rr||"([^/]*)",[],Sr,{end:false,ignoreCaptures:!cr&&!Gr})}}return this};Router.prototype.prefix=function(St){St=St.replace(/\/$/,"");this.opts.prefix=St;for(let Dt=0;Dt<this.stack.length;Dt++){const rr=this.stack[Dt];rr.setPrefix(St)}return this};Router.prototype.routes=Router.prototype.middleware=function(){const St=this;const Dt=function dispatch(Dt,rr){Sr("%s %s",Dt.method,Dt.path);const pr=St.matchHost(Dt.host);if(!pr){return rr()}const mr=St.opts.routerPath||Dt.newRouterPath||Dt.path||Dt.routerPath;const gr=St.match(mr,Dt.method);let yr;if(Dt.matched){Dt.matched.push.apply(Dt.matched,gr.path)}else{Dt.matched=gr.path}Dt.router=St;if(!gr.route)return rr();const $r=gr.pathAndMethod;const Er=$r[$r.length-1];Dt._matchedRoute=Er.path;if(Er.name){Dt._matchedRouteName=Er.name}yr=(St.exclusive?[Er]:$r).reduce((function(St,Dt){St.push((function(St,rr){St.captures=Dt.captures(mr,St.captures);St.params=St.request.params=Dt.params(mr,St.captures,St.params);St.routerPath=Dt.path;St.routerName=Dt.name;St._matchedRoute=Dt.path;if(Dt.name){St._matchedRouteName=Dt.name}return rr()}));return St.concat(Dt.stack)}),[]);return cr(yr)(Dt,rr)};Dt.router=this;return Dt};Router.prototype.allowedMethods=function(St={}){const Dt=this.methods;return function allowedMethods(rr,cr){return cr().then((function(){const cr={};if(!rr.status||rr.status===404){for(let St=0;St<rr.matched.length;St++){const Dt=rr.matched[St];for(let St=0;St<Dt.methods.length;St++){const rr=Dt.methods[St];cr[rr]=rr}}const mr=Object.keys(cr);if(!~Dt.indexOf(rr.method)){if(St.throw){const Dt=typeof St.notImplemented==="function"?St.notImplemented():new pr.NotImplemented;throw Dt}else{rr.status=501;rr.set("Allow",mr.join(", "))}}else if(mr.length>0){if(rr.method==="OPTIONS"){rr.status=200;rr.body="";rr.set("Allow",mr.join(", "))}else if(!cr[rr.method]){if(St.throw){const Dt=typeof St.methodNotAllowed==="function"?St.methodNotAllowed():new pr.MethodNotAllowed;throw Dt}else{rr.status=405;rr.set("Allow",mr.join(", "))}}}}}))}};Router.prototype.all=function(St,Dt,rr){if(typeof Dt==="string"){rr=Array.prototype.slice.call(arguments,2)}else{rr=Array.prototype.slice.call(arguments,1);Dt=St;St=null}if(typeof Dt!=="string"&&!(Dt instanceof RegExp)&&(!Array.isArray(Dt)||Dt.length===0))throw new Error("You have to provide a path when adding an all handler");this.register(Dt,mr,rr,{name:St});return this};Router.prototype.redirect=function(St,Dt,rr){if(typeof St==="symbol"||St[0]!=="/"){St=this.url(St);if(St instanceof Error)throw St}if(typeof Dt==="symbol"||Dt[0]!=="/"&&!Dt.includes("://")){Dt=this.url(Dt);if(Dt instanceof Error)throw Dt}return this.all(St,(St=>{St.redirect(Dt);St.status=rr||301}))};Router.prototype.register=function(St,Dt,rr,cr={}){const pr=this;const{stack:mr}=this;if(Array.isArray(St)){for(const mr of St){pr.register.call(pr,mr,Dt,rr,cr)}return this}const gr=new yr(St,Dt,rr,{end:cr.end===false?cr.end:true,name:cr.name,sensitive:cr.sensitive||this.opts.sensitive||false,strict:cr.strict||this.opts.strict||false,prefix:cr.prefix||this.opts.prefix||"",ignoreCaptures:cr.ignoreCaptures});if(this.opts.prefix){gr.setPrefix(this.opts.prefix)}for(let St=0;St<Object.keys(this.params).length;St++){const Dt=Object.keys(this.params)[St];gr.param(Dt,this.params[Dt])}mr.push(gr);Sr("defined route %s %s",gr.methods,gr.path);return gr};Router.prototype.route=function(St){const Dt=this.stack;for(let rr=Dt.length,cr=0;cr<rr;cr++){if(Dt[cr].name&&Dt[cr].name===St)return Dt[cr]}return false};Router.prototype.url=function(St,Dt){const rr=this.route(St);if(rr){const St=Array.prototype.slice.call(arguments,1);return rr.url.apply(rr,St)}return new Error(`No route found for name: ${String(St)}`)};Router.prototype.match=function(St,Dt){const rr=this.stack;let cr;const pr={path:[],pathAndMethod:[],route:false};for(let mr=rr.length,gr=0;gr<mr;gr++){cr=rr[gr];Sr("test %s %s",cr.path,cr.regexp);if(cr.match(St)){pr.path.push(cr);if(cr.methods.length===0||~cr.methods.indexOf(Dt)){pr.pathAndMethod.push(cr);if(cr.methods.length>0)pr.route=true}}}return pr};Router.prototype.matchHost=function(St){const{host:Dt}=this;if(!Dt){return true}if(!St){return false}if(typeof Dt==="string"){return St===Dt}if(typeof Dt==="object"&&Dt instanceof RegExp){return Dt.test(St)}};Router.prototype.param=function(St,Dt){this.params[St]=Dt;for(let rr=0;rr<this.stack.length;rr++){const cr=this.stack[rr];cr.param(St,Dt)}return this};Router.url=function(St){const Dt=Array.prototype.slice.call(arguments,1);return yr.prototype.url.apply({path:St},Dt)}},86979:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.AsyncHooksContextManager=void 0;const cr=rr(46123);const pr=rr(90290);class AsyncHooksContextManager{constructor(){this._contexts=new Map;this._stack=[];this._asyncHook=pr.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 St;return(St=this._stack[this._stack.length-1])!==null&&St!==void 0?St:cr.ASYNC_ROOT_CONTEXT}with(St,Dt,rr,...cr){this._enterContext(St);try{return Dt.call(rr,...cr)}finally{this._exitContext()}}enable(){this._asyncHook.enable();return this}disable(){this._asyncHook.disable();this._contexts.clear();this._stack=[];return this}_init(St,Dt){if(Dt==="TIMERWRAP")return;const rr=this._stack[this._stack.length-1];if(rr!==undefined){this._contexts.set(St,rr)}}_destroy(St){this._contexts.delete(St)}_before(St){const Dt=this._contexts.get(St);if(Dt!==undefined){this._enterContext(Dt)}}_after(){this._exitContext()}_enterContext(St){this._stack.push(St)}_exitContext(){this._stack.pop()}bind(St,Dt){if(typeof Dt==="function"){const rr=this;const contextWrapper=function(...cr){return rr.with(St,(()=>Dt.apply(this,cr)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:Dt.length});return contextWrapper}return Dt}}Dt.AsyncHooksContextManager=AsyncHooksContextManager},63259:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.AsyncLocalStorageContextManager=void 0;const cr=rr(46123);const pr=rr(90290);class AsyncLocalStorageContextManager{constructor(){this._asyncLocalStorage=new pr.AsyncLocalStorage}active(){var St;return(St=this._asyncLocalStorage.getStore())!==null&&St!==void 0?St:cr.ASYNC_ROOT_CONTEXT}with(St,Dt,rr,...cr){const pr=rr==null?Dt:Dt.bind(rr);return this._asyncLocalStorage.run(St,pr,...cr)}enable(){return this}disable(){this._asyncLocalStorage.disable();return this}bind(St,Dt){if(typeof Dt==="function"){const rr=this;const contextWrapper=function(...cr){return rr.with(St,(()=>Dt.apply(this,cr)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:Dt.length});return contextWrapper}return Dt}}Dt.AsyncLocalStorageContextManager=AsyncLocalStorageContextManager},44101:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.createContextManager=Dt.isSemverGreaterThanOrEqualTo=void 0;pr(rr(86979),Dt);pr(rr(63259),Dt);var mr=rr(43349);Object.defineProperty(Dt,"isSemverGreaterThanOrEqualTo",{enumerable:true,get:function(){return mr.isSemverGreaterThanOrEqualTo}});Object.defineProperty(Dt,"createContextManager",{enumerable:true,get:function(){return mr.createContextManager}})},43349:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.createContextManager=Dt.isSemverGreaterThanOrEqualTo=void 0;const cr=rr(63259);const pr=rr(86979);const mr=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z-]+(?:\.[\da-z-]+)*))?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)?)?$/i;function isSemverGreaterThanOrEqualTo(St,Dt){const rr=mr.exec(St);const cr=mr.exec(Dt);if(rr&&cr){if(rr[1]===cr[1]&&rr[2]===cr[2]&&rr[3]===cr[3]&&rr[4]===cr[4]){return true}return gteString(rr[1],cr[1])||rr[1]===cr[1]&&gteString(rr[2],cr[2])||rr[1]===cr[1]&&rr[2]===cr[2]&&gteString(rr[3],cr[3])||rr[1]===cr[1]&&rr[2]===cr[2]&&rr[3]===cr[3]&&gteString(rr[4],cr[4])}return false}Dt.isSemverGreaterThanOrEqualTo=isSemverGreaterThanOrEqualTo;function gteString(St,Dt){const rr=parseInt(St,10);const cr=parseInt(Dt,10);return rr>cr}function createContextManager(){const St=isSemverGreaterThanOrEqualTo(process.version,"14.8.0")?cr.AsyncLocalStorageContextManager:pr.AsyncHooksContextManager;return new St}Dt.createContextManager=createContextManager},26733:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Bootstrap=Dt.BootstrapStarter=void 0;const cr=rr(46123);const pr=rr(16928);const mr=rr(51169);const gr=rr(44101);const yr=rr(5982);const Sr=rr(92364);class BootstrapStarter{constructor(){this.globalOptions={}}configure(St={}){this.globalOptions=St;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 yr.ChildProcessEventBus({isWorker:true})}else if(process.env["MIDWAY_FORK_MODE"]==="thread"){this.eventBus=new yr.ThreadEventBus({isWorker:true})}}if(!this.globalOptions.moduleLoadType){const St=await(0,cr.loadModule)((0,pr.join)(this.appDir,"package.json"),{safeLoad:true,enableCache:false});this.globalOptions.moduleLoadType=(St===null||St===void 0?void 0:St.type)==="module"?"esm":"commonjs"}this.applicationContext=await(0,cr.initializeGlobalApplicationContext)({asyncContextManager:(0,gr.createContextManager)(),loggerFactory:mr.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 St=this.applicationContext.get(cr.MidwayApplicationManager);const Dt=St.getApplication("socketIO");(0,Sr.setupWorker)(Dt)}}const St=this.applicationContext.get(cr.MidwayFrameworkService);if(!St.getMainApp()){throw new cr.MidwayMainFrameworkMissingError}}async stop(){if(this.applicationContext){await(0,cr.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,cr.isTypeScriptEnvironment)()){return(0,pr.join)(this.appDir,"src")}else{return(0,pr.join)(this.appDir,"dist")}}}Dt.BootstrapStarter=BootstrapStarter;class Bootstrap{static configure(St={}){this.configured=true;if(!this.logger&&!St.logger){this.logger=this.bootstrapLoggerFactory.createLogger("bootstrap",{enableError:false,enableFile:false,enableConsole:true});if(St.logger===false){if(this.logger["disableConsole"]){this.logger["disableConsole"]()}else{this.logger["level"]="none"}}St.logger=this.logger}else{this.logger=this.logger||St.logger}if(St.appDir&&St.appDir!==process.cwd()){process.chdir(St.appDir)}this.getStarter().configure(St);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((St=>{this.logger.error(St);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(St){this.logger.info("[midway:bootstrap] receive signal %s, closing",St);try{await this.stop();this.logger.info("[midway:bootstrap] close done, exiting with code:0");process.exit(0)}catch(St){this.logger.error("[midway:bootstrap] close with error: ",St);process.exit(1)}}static onExit(St){this.logger.info("[midway:bootstrap] exit with code:%s",St)}static uncaughtExceptionHandler(St){if(!(St instanceof Error)){St=new Error(String(St))}if(St.name==="Error"){St.name="unhandledExceptionError"}this.logger.error(St)}static unhandledRejectionHandler(St){if(!(St instanceof Error)){const Dt=new Error(String(St));if(St){if(St.name)Dt.name=St.name;if(St.message)Dt.message=St.message;if(St.stack)Dt.stack=St.stack}St=Dt}if(St.name==="Error"){St.name="unhandledRejectionError"}this.logger.error(St)}static getApplicationContext(){return this.getStarter().getApplicationContext()}}Dt.Bootstrap=Bootstrap;Bootstrap.configured=false;Bootstrap.bootstrapLoggerFactory=new mr.MidwayLoggerContainer},84575:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.setupStickyMaster=Dt.AbstractForkManager=Dt.ClusterManager=Dt.BootstrapStarter=Dt.Bootstrap=void 0;pr(rr(82516),Dt);var mr=rr(26733);Object.defineProperty(Dt,"Bootstrap",{enumerable:true,get:function(){return mr.Bootstrap}});Object.defineProperty(Dt,"BootstrapStarter",{enumerable:true,get:function(){return mr.BootstrapStarter}});var gr=rr(93772);Object.defineProperty(Dt,"ClusterManager",{enumerable:true,get:function(){return gr.ClusterManager}});var yr=rr(84338);Object.defineProperty(Dt,"AbstractForkManager",{enumerable:true,get:function(){return yr.AbstractForkManager}});var Sr=rr(92364);Object.defineProperty(Dt,"setupStickyMaster",{enumerable:true,get:function(){return Sr.setupStickyMaster}})},82516:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},84338:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.AbstractForkManager=void 0;const cr=rr(70857);const pr=rr(39023);const mr=rr(53599);const gr=rr(24434);const yr=rr(39023);const Sr=(0,yr.debuglog)("midway:bootstrap");class AbstractForkManager{constructor(St){this.options=St;this.reforks=[];this.disconnectCount=0;this.unexpectedCount=0;this.disconnects={};this.hub=new gr.EventEmitter;this.workers=new Map;this.isClosing=false;St.count=St.count||cr.cpus().length-1;St.refork=St.refork!==false;St.limit=St.limit||60;St.duration=St.duration||6e4;St.logger=St.logger||console;St.workerInitTimeout=St.workerInitTimeout||3e4;this.eventBus=this.createEventBus({initTimeout:St.workerInitTimeout})}async start(){Sr("Start manager with options: %j",this.options);this.bindWorkerDisconnect((St=>{Sr(" - worker(%s): trigger event = disconnect",this.getWorkerId(St));const Dt=this.options.logger[St["disableRefork"]?"info":"error"];this.disconnectCount++;const rr=this.isWorkerDead(St);if(rr){Sr(" - worker(%s): worker is dead",this.getWorkerId(St));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork, because worker:%s exit event emit before disconnect",(0,mr.logDate)(),process.pid,this.getWorkerId(St));return}if(St["disableRefork"]){Sr(" - worker(%s): worker is disableRefork(maybe terminated by master)",this.getWorkerId(St));Dt("[%s] [bootstrap:master:%s] don't fork, because worker:%s will be kill soon",(0,mr.logDate)(),process.pid,this.getWorkerId(St));return}this.disconnects[this.getWorkerId(St)]=(0,mr.logDate)();this.tryToRefork(St)}));this.bindWorkerExit(((St,Dt,rr)=>{Sr(" - worker(%s): trigger event = exit",this.getWorkerId(St));this.workers.delete(this.getWorkerId(St));if(St["disableRefork"]){return}const cr=!!this.disconnects[this.getWorkerId(St)];Sr(" - worker(%s): isExpected=%s",this.getWorkerId(St),cr);if(cr){delete this.disconnects[this.getWorkerId(St)];return}Sr(" - worker(%s): isWorkerDead=%s",this.getWorkerId(St),this.isWorkerDead(St));if(this.isWorkerDead(St)){return}Sr(" - worker(%s): unexpectedCount will add");this.unexpectedCount++;this.tryToRefork(St);this.onUnexpected(St,Dt,rr)}));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 St=0;St<this.options.count;St++){const St=this.createWorker();Sr(" - worker(%s) created",this.getWorkerId(St));this.eventBus.addWorker(St);this.workers.set(this.getWorkerId(St),St)}await this.eventBus.start()}tryToRefork(St){if(this.allowRefork()){Sr(" - worker(%s): allow refork and will fork new",this.getWorkerId(St));const Dt=this.createWorker(St);this.workers.set(this.getWorkerId(Dt),Dt);this.options.logger.info("[%s] [bootstrap:master:%s] new worker:%s fork (state: %s)",(0,mr.logDate)(),process.pid,this.getWorkerId(Dt),Dt["state"]);this.eventBus.addWorker(Dt)}else{Sr(" - worker(%s): forbidden refork and will stop",this.getWorkerId(St));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork new work (refork: %s)",(0,mr.logDate)(),process.pid,this.options.refork)}}allowRefork(){if(!this.options.refork||this.isClosing){return false}const St=this.reforks.push(Date.now());if(St>this.options.limit){this.reforks.shift()}const Dt=this.reforks[this.reforks.length-1]-this.reforks[0];const rr=this.reforks.length<this.options.limit||Dt>this.options.duration;if(!rr){this.hub.emit("reachReforkLimit")}return rr}onerror(St){if(!St){return}this.options.logger.error("[%s] [bootstrap:master:%s] master uncaughtException: %s",(0,mr.logDate)(),process.pid,St.stack);this.options.logger.error(St);this.options.logger.error("(total %d disconnect, %d unexpected exit)",this.disconnectCount,this.unexpectedCount)}onUnexpected(St,Dt,rr){const cr=St.hasOwnProperty("exitedAfterDisconnect")?"exitedAfterDisconnect":"suicide";const gr=new Error(pr.format("worker:%s died unexpected (code: %s, signal: %s, %s: %s, state: %s)",this.getWorkerId(St),Dt,rr,cr,St[cr],St["state"]));gr.name="WorkerDiedUnexpectedError";this.options.logger.error("[%s] [bootstrap:master:%s] (total %d disconnect, %d unexpected exit) %s",(0,mr.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount,gr.stack)}onReachReforkLimit(){this.options.logger.error("[%s] [bootstrap:master:%s] worker died too fast (total %d disconnect, %d unexpected exit)",(0,mr.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount)}async killWorker(St,Dt){await this.closeWorker(St);await Promise.race([(0,gr.once)(St,"exit"),(0,mr.sleep)(Dt)]);if(St.killed)return;(St.process||St).kill("SIGKILL")}async stop(St=2e3){Sr("run close");this.isClosing=true;await this.eventBus.stop();for(const Dt of this.workers.values()){Dt["disableRefork"]=true;await this.killWorker(Dt,St)}if(this.exitListener){await this.exitListener()}}hasWorker(St){return this.workers.has(St)}getWorker(St){return this.workers.get(St)}getWorkerIds(){return Array.from(this.workers.keys())}onStop(St){this.exitListener=St}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(St){if(!this.isClosing){this.options.logger.info("[bootstrap:master] receive signal %s, closing",St);try{await this.stop();this.options.logger.info("[bootstrap:master] close done, exiting with code:0");process.exit(0)}catch(St){this.options.logger.error("[midway:master] close with error: ",St);process.exit(1)}}}onMasterExit(St){this.options.logger.info("[bootstrap:master] exit with code:%s",St)}}Dt.AbstractForkManager=AbstractForkManager},93772:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ClusterManager=void 0;const cr=rr(5982);const pr=rr(84338);const mr=rr(29907);const gr=rr(39023);const yr=rr(46123);const Sr=(0,gr.debuglog)("midway:bootstrap");class ClusterManager extends pr.AbstractForkManager{constructor(St={}){super(St);this.options=St;St.args=St.args||[];St.execArgv=St.execArgv||[];if((0,yr.isTypeScriptEnvironment)()){St.execArgv.push(...["--require","ts-node/register"])}}createWorker(){if(mr["setupPrimary"]){mr["setupPrimary"](this.options)}else if(mr["setupMaster"]){mr["setupMaster"](this.options)}return mr.fork({MIDWAY_FORK_MODE:"cluster",MIDWAY_STICKY_MODE:this.options.sticky?"true":"false",...this.options.env})}bindWorkerDisconnect(St){Sr("Bind cluster.disconnect event");mr.on("disconnect",St)}bindWorkerExit(St){Sr("Bind cluster.exit event");mr.on("exit",St)}getWorkerId(St){return String(St.process.pid)}isWorkerDead(St){return St.isDead()}closeWorker(St){St.kill("SIGTERM")}createEventBus(St){return new cr.ChildProcessEventBus(St)}isPrimary(){return!mr.isWorker}}Dt.ClusterManager=ClusterManager},92364:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.setupWorker=Dt.setupStickyMaster=void 0;const cr=rr(29907);const pr=rr(76982);const randomId=()=>(0,pr.randomBytes)(8).toString("hex");function setupStickyMaster(St,Dt={}){const rr={loadBalancingMethod:"least-connection",...Dt};const pr=new Map;const mr=/sid=([\w-]{20})/;let gr=0;const computeWorkerId=St=>{const Dt=mr.exec(St);if(Dt){const St=Dt[1];const rr=pr.get(St);if(rr&&cr.workers[rr]){return rr}}switch(rr.loadBalancingMethod){case"random":{const St=Object.keys(cr.workers);return St[Math.floor(Math.random()*St.length)]}case"round-robin":{const St=Object.keys(cr.workers);gr++;if(gr>=St.length){gr=0}return St[gr]}case"least-connection":let St;for(const Dt in cr.workers){const rr=cr.workers[Dt];if(St===undefined){St=rr}else{const Dt=rr["clientsCount"]||0;const cr=St["clientsCount"]||0;if(Dt<cr){St=rr}}}return St.id}};St.on("connection",(St=>{let Dt,rr;const sendCallback=Dt=>{if(Dt){St.destroy()}};St.on("data",(pr=>{let mr="utf-8";let gr=pr.toString(mr);if(Dt&&rr){cr.workers[Dt].send({type:"sticky:http-chunk",data:gr,encoding:mr,connectionId:rr},sendCallback);return}Dt=computeWorkerId(gr);const yr=!(gr.startsWith("GET")||gr.substring(0,gr.indexOf("\r\n\r\n")).includes("pgrade: websocket"));if(gr.startsWith("POST")&&gr.includes("multipart/form-data")){mr="base64";gr=pr.toString("base64")}St.pause();if(yr){rr=randomId()}cr.workers[Dt].send({type:"sticky:connection",data:gr,encoding:mr,connectionId:rr},St,{keepOpen:yr},sendCallback)}))}));St.on("request",(St=>{St.on("data",(()=>{}))}));cr.on("message",((St,{type:Dt,data:cr})=>{switch(Dt){case"sticky:connection":pr.set(cr,St.id);if(rr.loadBalancingMethod==="least-connection"){St["clientsCount"]=(St["clientsCount"]||0)+1}break;case"sticky:disconnection":pr.delete(cr);if(rr.loadBalancingMethod==="least-connection"){St["clientsCount"]--}break}}))}Dt.setupStickyMaster=setupStickyMaster;function setupWorker(St){const Dt=new Map;process.on("message",(({type:rr,data:cr,encoding:pr,connectionId:mr},gr)=>{switch(rr){case"sticky:connection":if(!gr){return}St.httpServer.emit("connection",gr);gr.emit("data",Buffer.from(cr,pr));gr.resume();if(mr){Dt.set(mr,gr);gr.on("close",(()=>{Dt.delete(mr)}))}break;case"sticky:http-chunk":{const St=Dt.get(mr);if(St){St.emit("data",Buffer.from(cr,pr))}}}}));const ignoreError=()=>{};St.engine.on("connection",(St=>{process.send({type:"sticky:connection",data:St.id},ignoreError);St.once("close",(()=>{process.send({type:"sticky:disconnection",data:St.id},ignoreError)}))}))}Dt.setupWorker=setupWorker},53599:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.sleep=Dt.logDate=void 0;function logDate(){const St=new Date;let Dt=St.getDate();if(Dt<10){Dt="0"+Dt}let rr=St.getMonth()+1;if(rr<10){rr="0"+rr}let cr=St.getHours();if(cr<10){cr="0"+cr}let pr=St.getMinutes();if(pr<10){pr="0"+pr}let mr=St.getSeconds();if(mr<10){mr="0"+mr}let gr=St.getMilliseconds();if(gr<10){gr="00"+gr}else if(gr<100){gr="0"+gr}return St.getFullYear()+"-"+rr+"-"+Dt+" "+cr+":"+pr+":"+mr+"."+gr}Dt.logDate=logDate;async function sleep(St){return new Promise((Dt=>{setTimeout(Dt,St)}))}Dt.sleep=sleep},64080:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.multiCaching=Dt.createCache=Dt.caching=void 0;const cr=rr(48851);const pr=rr(87932);async function caching(St,Dt){if(St==="memory"){const St=(0,pr.memoryStore)(Dt);return createCache(St,Dt)}if(typeof St==="function"){const rr=await St(Dt);return createCache(rr,Dt)}return createCache(St,Dt)}Dt.caching=caching;function createCache(St,Dt){return{wrap:async(rr,pr,mr)=>(0,cr.coalesceAsync)(rr,(async()=>{const gr=await St.get(rr);if(gr===undefined){const Dt=await pr();const cr=typeof mr==="function"?mr(Dt):mr;await St.set(rr,Dt,cr);return Dt}else if(Dt===null||Dt===void 0?void 0:Dt.refreshThreshold){const yr=typeof mr==="function"?mr(gr):mr;const Sr=await St.ttl(rr);if(Sr!==-1&&Sr<Dt.refreshThreshold){(0,cr.coalesceAsync)(`+++${rr}`,pr).then((Dt=>St.set(rr,Dt,yr)))}}return gr})),store:St,del:Dt=>St.del(Dt),get:Dt=>St.get(Dt),set:(Dt,rr,cr)=>St.set(Dt,rr,cr),reset:()=>St.reset(),methodWrap:async(rr,pr,mr,gr)=>(0,cr.coalesceAsync)(rr,(async()=>{const yr=await St.get(rr);if(yr===undefined){const Dt=await pr(...mr);const cr=typeof gr==="function"?gr(Dt):gr;await St.set(rr,Dt,cr);return Dt}else if(Dt===null||Dt===void 0?void 0:Dt.refreshThreshold){const Sr=typeof gr==="function"?gr(yr):gr;const $r=await St.ttl(rr);if($r!==-1&&$r<Dt.refreshThreshold){(0,cr.coalesceAsync)(`+++${rr}`,(()=>pr(...mr))).then((Dt=>St.set(rr,Dt,Sr)))}}return yr}))}}Dt.createCache=createCache;function multiCaching(St){const get=async Dt=>{for(const rr of St){try{const St=await rr.get(Dt);if(St!==undefined)return St}catch(St){}}};const set=async(Dt,rr,cr)=>{await Promise.all(St.map((St=>St.set(Dt,rr,cr))))};return{get:get,set:set,del:async Dt=>{await Promise.all(St.map((St=>St.del(Dt))))},async wrap(Dt,rr,cr){let pr;let mr=0;for(;mr<St.length;mr++){try{pr=await St[mr].get(Dt);if(pr!==undefined)break}catch(St){}}if(pr===undefined){const St=await rr();const pr=typeof cr==="function"?cr(St):cr;await set(Dt,St,pr);return St}else{const gr=typeof cr==="function"?cr(pr):cr;Promise.all(St.slice(0,mr).map((St=>St.set(Dt,pr,gr)))).then();St[mr].wrap(Dt,rr,cr).then()}return pr},reset:async()=>{await Promise.all(St.map((St=>St.reset())))},mget:async(...Dt)=>{const rr=new Array(Dt.length).fill(undefined);for(const cr of St){if(rr.every((St=>St!==undefined)))break;try{const St=await cr.store.mget(...Dt);St.forEach(((St,Dt)=>{if(rr[Dt]===undefined&&St!==undefined)rr[Dt]=St}))}catch(St){}}return rr},mset:async(Dt,rr)=>{await Promise.all(St.map((St=>St.store.mset(Dt,rr))))},mdel:async(...Dt)=>{await Promise.all(St.map((St=>St.store.mdel(...Dt))))},methodWrap:async(Dt,rr,cr,pr)=>{let mr;let gr=0;for(;gr<St.length;gr++){try{mr=await St[gr].get(Dt);if(mr!==undefined)break}catch(St){}}if(mr===undefined){const St=await rr(...cr);const mr=typeof pr==="function"?pr(St):pr;await set(Dt,St,mr);return St}else{const yr=typeof pr==="function"?pr(mr):pr;Promise.all(St.slice(0,gr).map((St=>St.set(Dt,mr,yr)))).then();St[gr].methodWrap(Dt,rr,cr,pr).then()}return mr}}}Dt.multiCaching=multiCaching},8869:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});pr(rr(64080),Dt);pr(rr(87932),Dt);pr(rr(91724),Dt)},48851:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.coalesceAsync=void 0;const rr=new Map;async function coalesceAsync(St,Dt){if(!hasKey(St)){addKey(St);try{const rr=await Promise.resolve(Dt());coalesce({key:St,result:rr});return rr}catch(Dt){coalesce({key:St,error:Dt});throw Dt}}return enqueue(St)}Dt.coalesceAsync=coalesceAsync;function hasKey(St){return rr.has(St)}function addKey(St){rr.set(St,[])}function removeKey(St){rr.delete(St)}function addCallbackToKey(St,Dt){const cr=getCallbacksByKey(St);cr.push(Dt);rr.set(St,cr)}function getCallbacksByKey(St){var Dt;return(Dt=rr.get(St))!==null&&Dt!==void 0?Dt:[]}function enqueue(St){return new Promise(((Dt,rr)=>{const cr={resolve:Dt,reject:rr};addCallbackToKey(St,cr)}))}function dequeue(St){const Dt=getCallbacksByKey(St);removeKey(St);return Dt}function coalesce(St){const{key:Dt,error:rr,result:cr}=St;dequeue(Dt).forEach((St=>{if(rr){St.reject(rr)}else{St.resolve(cr)}}))}},87932:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.memoryStore=void 0;const cr=rr(57223);const pr=rr(19944);function clone(St){if(typeof St==="object"&&St!==null){return pr(St)}return St}function memoryStore(St){var Dt;const rr=(St===null||St===void 0?void 0:St.shouldCloneBeforeSet)!==false;const pr=(Dt=St===null||St===void 0?void 0:St.isCacheable)!==null&&Dt!==void 0?Dt:St=>St!==undefined;const mr={ttlAutopurge:true,...St,max:(St===null||St===void 0?void 0:St.max)||500,ttl:(St===null||St===void 0?void 0:St.ttl)!==undefined?St.ttl:0};const gr=new cr(mr);return{async del(St){gr.delete(St)},get:async St=>gr.get(St),keys:async()=>[...gr.keys()],mget:async(...St)=>St.map((St=>gr.get(St))),async mset(St,Dt){const cr={ttl:Dt!==undefined?Dt:mr.ttl};for(const[Dt,mr]of St){if(!pr(mr))throw new Error(`no cacheable value ${JSON.stringify(mr)}`);if(rr)gr.set(Dt,clone(mr),cr);else gr.set(Dt,mr,cr)}},async mdel(...St){for(const Dt of St)gr.delete(Dt)},async reset(){gr.clear()},ttl:async St=>gr.getRemainingTTL(St),async set(St,Dt,cr){if(!pr(Dt))throw new Error(`no cacheable value ${JSON.stringify(Dt)}`);if(rr)Dt=clone(Dt);const yr=cr!==undefined?cr:mr.ttl;gr.set(St,Dt,{ttl:yr})},get calculatedSize(){return gr.calculatedSize},get size(){return gr.size},dump:()=>gr.dump(),load:(...St)=>gr.load(...St)}}Dt.memoryStore=memoryStore},91724:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},68805:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.CacheConfiguration=Dt.getClassMethodDefaultCacheKey=void 0;const mr=rr(46123);const gr=rr(42696);const yr=rr(91761);function getClassMethodDefaultCacheKey(St,Dt){return St.name+"-"+(0,mr.getProviderUUId)(St)+"-"+Dt}Dt.getClassMethodDefaultCacheKey=getClassMethodDefaultCacheKey;let Sr=class CacheConfiguration{async onReady(St){this.cacheService=await St.getAsync(yr.CachingFactory);this.decoratorService.registerMethodHandler(gr.CACHE_DECORATOR_KEY,(({target:St,propertyName:Dt,metadata:rr})=>{if(!rr.cacheKey){rr.cacheKey=getClassMethodDefaultCacheKey(St,Dt)}return{around:async St=>{let Dt=rr.cacheKey;const cr=this.cacheService.get(rr.cacheInstanceName);if(typeof Dt==="function"){Dt=await Dt({methodArgs:St.args,ctx:St.target[mr.REQUEST_OBJ_CTX_KEY],target:St.target})}if(typeof Dt==="string"){return cr.methodWrap(Dt,St.proceed,St.args,rr.ttl)}else{return St.proceed(...St.args)}}}}))}};cr([(0,mr.Inject)(),pr("design:type",mr.MidwayDecoratorService)],Sr.prototype,"decoratorService",void 0);Sr=cr([(0,mr.Configuration)({namespace:"cacheManager",importConfigs:[{default:{cacheManager:{}}}]})],Sr);Dt.CacheConfiguration=Sr},42696:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Caching=Dt.CACHE_DECORATOR_KEY=void 0;const cr=rr(46123);Dt.CACHE_DECORATOR_KEY="cache-manager:caching";function Caching(St,rr,pr){if(typeof rr==="number"){pr=rr;rr=undefined}return(0,cr.createCustomMethodDecorator)(Dt.CACHE_DECORATOR_KEY,{cacheInstanceName:St,cacheKey:rr,ttl:pr})}Dt.Caching=Caching},91761:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.CachingFactory=void 0;const mr=rr(46123);const gr=rr(8869);let yr=class CachingFactory extends mr.ServiceFactory{async init(){await this.initClients(this.cacheManagerConfig)}async createClient(St,Dt){if(Array.isArray(St.store)){const rr=[];for(const cr of St.store){if(typeof cr==="string"){if(!this.has(cr)){throw new mr.MidwayCommonError(`cache instance "${cr}" not found in "${Dt}", please check your configuration.`)}rr.push(this.get(cr))}else if(typeof cr==="function"){rr.push(await cr())}else if(cr["wrap"]){rr.push(cr["wrap"])}else if(typeof cr==="object"){if(typeof cr.store==="function"){cr.store=await cr.store(cr["options"]||{},this.applicationContext)}if(!cr.store){throw new mr.MidwayCommonError(`cache instance "${Dt}" store is undefined, please check your configuration.`)}rr.push(await(0,gr.caching)(cr.store,cr["options"]))}else{throw new mr.MidwayCommonError("invalid cache config")}}return await(0,gr.multiCaching)(rr)}else{if(typeof St.store==="function"){St.store=await St.store(St["options"]||{},this.applicationContext)}if(!St.store){throw new mr.MidwayCommonError(`cache instance "${Dt}" store is undefined, please check your configuration.`)}return await(0,gr.caching)(St.store,St["options"])}}getName(){return"cache-manager"}getCaching(St){return this.get(St)}getMultiCaching(St){return this.get(St)}};cr([(0,mr.Config)("cacheManager"),pr("design:type",Object)],yr.prototype,"cacheManagerConfig",void 0);cr([(0,mr.ApplicationContext)(),pr("design:type",Object)],yr.prototype,"applicationContext",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],yr.prototype,"init",null);yr=cr([(0,mr.Provide)(),(0,mr.Scope)(mr.ScopeEnum.Singleton)],yr);Dt.CachingFactory=yr},96955:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.CacheManager=Dt.getClassMethodDefaultCacheKey=Dt.Configuration=void 0;var mr=rr(68805);Object.defineProperty(Dt,"Configuration",{enumerable:true,get:function(){return mr.CacheConfiguration}});Object.defineProperty(Dt,"getClassMethodDefaultCacheKey",{enumerable:true,get:function(){return mr.getClassMethodDefaultCacheKey}});pr(rr(43488),Dt);pr(rr(91761),Dt);pr(rr(42696),Dt);Dt.CacheManager=rr(8869);pr(rr(93730),Dt)},43488:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},93730:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.createRedisStore=void 0;const cr=rr(46123);const getVal=St=>JSON.stringify(St)||'"undefined"';function createRedisStore(St){return async(Dt,rr)=>{const{RedisServiceFactory:pr}=(0,cr.safeRequire)("@midwayjs/redis");const mr=await rr.getAsync(pr);const gr=mr.get(St);return createStore(gr,Dt)}}Dt.createRedisStore=createRedisStore;function createStore(St,Dt){const rr=(Dt===null||Dt===void 0?void 0:Dt.isCacheable)||(St=>St!==undefined&&St!==null);const keys=Dt=>St.keys(Dt);return{async get(Dt){const rr=await St.get(Dt);if(rr===undefined||rr===null)return undefined;else{try{return JSON.parse(rr)}catch(St){return rr}}},async set(pr,mr,gr){if(!rr(mr))throw new cr.MidwayCommonError(`"${mr}" is not a cacheable value`);const yr=gr===undefined?Dt===null||Dt===void 0?void 0:Dt.ttl:gr;if(yr!==undefined&&yr!==0)await St.set(pr,getVal(mr),"PX",yr);else await St.set(pr,getVal(mr))},async mset(pr,mr){const gr=mr===undefined?Dt===null||Dt===void 0?void 0:Dt.ttl:mr;if(gr!==undefined&&gr!==0){const Dt=St.multi();for(const[St,mr]of pr){if(!rr(mr))throw new cr.MidwayCommonError(`"${getVal(mr)}" is not a cacheable value`);Dt.set(St,getVal(mr),"PX",gr)}await Dt.exec()}else await St.mset(pr.flatMap((([St,Dt])=>{if(!rr(Dt))throw new Error(`"${getVal(Dt)}" is not a cacheable value`);return[St,getVal(Dt)]})))},mget:(...Dt)=>St.mget(Dt).then((St=>St.map((St=>{if(St===null||St===undefined){return undefined}else{try{return JSON.parse(St)}catch(Dt){return St}}})))),async mdel(...Dt){await St.del(Dt)},async del(Dt){await St.del(Dt)},ttl:async Dt=>St.pttl(Dt),keys:(St="*")=>keys(St),reset:()=>{throw new cr.MidwayCommonError("flushdb() is too dangerous, if necessary, please use redisServiceFactory.get(client) to get the instance and call it manually.")},isCacheable:rr}}},4074:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Cookie=void 0;const cr=rr(42613);const pr=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;const mr=/^(?:none|lax|strict)$/i;class Cookie{constructor(St,Dt,rr){cr(pr.test(St),"argument name is invalid");cr(!Dt||pr.test(Dt),"argument value is invalid");this.name=St;this.value=Dt||"";this.attrs=mergeDefaultAttrs(rr);cr(!this.attrs.path||pr.test(this.attrs.path),"argument option path is invalid");cr(!this.attrs.domain||pr.test(this.attrs.domain),"argument option domain is invalid");cr(!this.attrs.sameSite||this.attrs.sameSite===true||mr.test(this.attrs.sameSite),"argument option sameSite is invalid");if(!Dt){this.attrs.expires=new Date(0);this.attrs.maxAge=null}}toString(){return this.name+"="+this.value}toHeader(){let St=this.toString();const Dt=this.attrs;if(Dt.path)St+="; path="+Dt.path;const rr=typeof Dt.maxAge==="string"?parseInt(Dt.maxAge,10):Dt.maxAge;if(rr){St+="; max-age="+Math.round(rr/1e3);Dt.expires=new Date(Date.now()+rr)}if(Dt.expires)St+="; expires="+Dt.expires.toUTCString();if(Dt.domain)St+="; domain="+Dt.domain;if(Dt.sameSite)St+="; samesite="+(Dt.sameSite===true?"strict":Dt.sameSite.toLowerCase());if(Dt.secure)St+="; secure";if(Dt.httpOnly)St+="; httponly";if(Dt.priority)St+="; priority="+Dt.priority;if(Dt.partitioned)St+="; partitioned";return St}}Dt.Cookie=Cookie;const gr=["path","expires","domain","httpOnly","secure","partitioned","maxAge","overwrite","sameSite","priority"];function mergeDefaultAttrs(St){const Dt={path:"/",httpOnly:true,secure:false,overwrite:false,sameSite:false,partitioned:false};if(!St)return Dt;for(let rr=0;rr<gr.length;rr++){const cr=gr[rr];if(cr in St)Dt[cr]=St[cr]}return Dt}},11033:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.urlSafeDecode=Dt.urlSafeEncode=Dt.Cookies=void 0;const cr=rr(42613);const pr=rr(4074);const mr=rr(5693);const gr=rr(86054);const yr=Symbol("midwayCookies:keysArray");const Sr=Symbol("midwayCookies:keys");const $r=new Map;class Cookies{constructor(St,Dt,rr,cr){var pr;this[yr]=Dt?[].concat(Dt):Dt;this._defaultCookieOptions=rr;this._defaultGetCookieOptions=cr;this.ctx=St;this.secure=(pr=rr===null||rr===void 0?void 0:rr.secure)!==null&&pr!==void 0?pr:this.ctx.secure;this.app=St.app}get keys(){if(!this[Sr]){const St=this[yr];cr(Array.isArray(St),".keys required for encrypt/sign cookies");const Dt=$r.get(St);if(Dt){this[Sr]=Dt}else{this[Sr]=new mr.Keygrip(this[yr]);$r.set(St,this[Sr])}}return this[Sr]}get(St,Dt){Dt=Object.assign({},this._defaultGetCookieOptions||{},Dt);const rr=computeSigned(Dt);const cr=this.ctx.get("cookie");if(!cr)return;const pr=cr.match(getPattern(St));if(!pr)return;let mr=pr[1];if(!Dt.encrypt&&!rr)return mr;if(rr){const Dt=St+".sig";const rr=this.get(Dt,{signed:false});if(!rr)return;const cr=St+"="+mr;const pr=this.keys.verify(cr,rr);if(pr<0){this.set(Dt,null,{path:"/",signed:false});return}if(pr>0){this.set(Dt,this.keys.sign(cr),{signed:false})}return mr}mr=urlSafeDecode(mr);const gr=this.keys.decrypt(mr);if(gr===null||gr===void 0?void 0:gr.value){return gr.value.toString()}return undefined}set(St,Dt,rr){if(!rr&&typeof Dt!=="string"){rr=Dt;Dt=""}rr=Object.assign({},this._defaultCookieOptions,rr);const cr=computeSigned(rr);Dt=Dt||"";if(!this.secure&&rr.secure){throw new Error("Cannot send secure cookie over unencrypted connection")}let mr=this.ctx.response.get("set-cookie")||[];if(!Array.isArray(mr))mr=[mr];if(rr.encrypt){Dt=Dt&&urlSafeEncode(this.keys.encrypt(Dt))}if(Dt.length>4093){this.app.emit("cookieLimitExceed",{name:St,value:Dt,ctx:this.ctx})}const gr=this.ctx.get("user-agent");if(rr.sameSite&&typeof rr.sameSite==="string"&&rr.sameSite.toLowerCase()==="none"){if(!this.secure||gr&&!this.isSameSiteNoneCompatible(gr)){rr.sameSite=false}}if(rr.partitioned){if(!this.secure||!gr||gr&&!this.isPartitionedCompatible(gr)){rr.partitioned=false}}if(rr.partitioned&&rr.removeUnpartitioned){const Dt=rr.overwrite;if(Dt){rr.overwrite=false;mr=ignoreCookiesByName(mr,St)}const gr=Object.assign({},rr,{partitioned:false});const yr=new pr.Cookie(St,"",gr);if(rr.secure===undefined)yr.attrs.secure=this.secure;mr=pushCookie(mr,yr);if(cr){yr.name+=".sig";mr=ignoreCookiesByName(mr,yr.name);mr=pushCookie(mr,yr)}}if(rr.priority){if(!gr||gr&&!this.isPriorityCompatible(gr)){rr.priority=undefined}}const yr=new pr.Cookie(St,Dt,rr);if(rr.secure===undefined)yr.attrs.secure=this.secure;mr=pushCookie(mr,yr);if(cr){yr.value=Dt&&this.keys.sign(yr.toString());yr.name+=".sig";mr=pushCookie(mr,yr)}this.ctx.set("set-cookie",mr);return this}isSameSiteNoneCompatible(St){const Dt=this.parseChromiumAndMajorVersion(St);if(Dt.chromium&&Dt.majorVersion){return Dt.majorVersion>=80}return(0,gr.isSameSiteNoneCompatible)(St)}isPartitionedCompatible(St){const Dt=this.parseChromiumAndMajorVersion(St);if(Dt.chromium&&Dt.majorVersion){return Dt.majorVersion>=114}return false}parseChromiumAndMajorVersion(St){if(!this.uaParseResult){const Dt=/Chrom[^ /]+\/(\d+)[.\d]* /.exec(St);if(!Dt)return{chromium:false,majorVersion:undefined};this.uaParseResult={chromium:true,majorVersion:parseInt(Dt[1])}}return this.uaParseResult}isPriorityCompatible(St){const Dt=this.parseChromiumAndMajorVersion(St);if(Dt.chromium&&Dt.majorVersion){return Dt.majorVersion>=81}return false}}Dt.Cookies=Cookies;const Er=new Map;function getPattern(St){const Dt=Er.get(St);if(Dt)return Dt;const rr=new RegExp("(?:^|;) *"+St.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)");Er.set(St,rr);return rr}function computeSigned(St){if(St.encrypt)return false;return St.signed!==false}function pushCookie(St,Dt){if(Dt.attrs.overwrite){St=ignoreCookiesByName(St,Dt.name)}St.push(Dt.toHeader());return St}function ignoreCookiesByName(St,Dt){const rr=`${Dt}=`;return St.filter((St=>!St.startsWith(rr)))}function urlSafeEncode(St){return St.replace(/\+/g,"-").replace(/\//g,"_")}Dt.urlSafeEncode=urlSafeEncode;function urlSafeDecode(St){return St.replace(/-/g,"+").replace(/_/g,"/")}Dt.urlSafeDecode=urlSafeDecode},60990:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});pr(rr(33249),Dt);pr(rr(11033),Dt)},33249:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},5693:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Keygrip=void 0;const cr=rr(42613);const pr=rr(39023);const mr=rr(76982);const gr=rr(48978);const yr=(0,pr.debuglog)("midway:cookies");const Sr={"/":"_","+":"-","=":""};class Keygrip{constructor(St){cr(Array.isArray(St)&&St.length,"keys must be provided and should be an array");this.keys=St;this.hash="sha256"}encrypt(St,Dt){Dt=Dt||this.keys[0];try{St=String(St);const rr=getAlgorithm();const cr=(0,mr.randomBytes)(64);const pr=(0,mr.randomBytes)(16);const gr=Math.floor(Math.random()*(99999-1e4+1))+1e4;const yr=deriveKeyFromPassword(Dt,cr,Math.floor(gr*.47+1337));const Sr=(0,mr.createCipheriv)(rr,yr,pr);const $r=Buffer.concat([Sr.update(St,"utf8"),Sr.final()]);const Er=Sr.getAuthTag();const Ir=Buffer.concat([cr,pr,Er,Buffer.from(gr.toString()),$r]).toString("hex");return getEncryptedPrefix()+Ir}catch(St){yr("crypt error",St.stack);return undefined}}decrypt(St,Dt){if(!Dt){const Dt=this.keys;for(let rr=0;rr<Dt.length;rr++){const cr=this.decrypt(St,Dt[rr]);if(cr!==false)return{value:cr,index:rr}}return false}try{const rr=getAlgorithm();const cr=St.split(getEncryptedPrefix());if(cr.length!==2){return void 0}else{St=cr[1]}const pr=Buffer.from(St,"hex");const gr=pr.slice(0,64);const yr=pr.slice(64,80);const Sr=pr.slice(80,96);const $r=parseInt(pr.slice(96,101).toString("utf-8"),10);const Er=pr.slice(101);const Ir=deriveKeyFromPassword(Dt,gr,Math.floor($r*.47+1337));const Or=(0,mr.createDecipheriv)(rr,Ir,yr);Or.setAuthTag(Sr);return Or.update(Er,"binary","utf-8")+Or.final("utf-8")}catch(St){yr("crypt error",St.stack);return false}}sign(St,Dt){Dt=Dt||this.keys[0];return(0,mr.createHmac)(this.hash,Dt).update(St).digest("base64").replace(/\/|\+|=/g,(St=>Sr[St]))}verify(St,Dt){const rr=this.keys;for(let cr=0;cr<rr.length;cr++){if(gr(Buffer.from(Dt),Buffer.from(this.sign(St,rr[cr])))){yr("data %s match key %s",St,rr[cr]);return cr}}return-1}}Dt.Keygrip=Keygrip;function getAlgorithm(){return"aes-256-gcm"}function getEncryptedPrefix(){return"enc::"}function deriveKeyFromPassword(St,Dt,rr){return(0,mr.pbkdf2Sync)(St,Dt,rr,32,"sha512")}},83872:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.BaseFramework=void 0;const mr=rr(6192);const gr=rr(2222);const yr=rr(49757);const Sr=rr(97983);const $r=rr(70275);const Er=rr(78842);const Ir=rr(37482);const Or=rr(34888);const Hr=rr(12738);const Gr=rr(68220);const Tn=rr(39408);const Wn=rr(77306);const Gn=rr(39023);const mi=rr(75351);const $i=rr(40581);const ki=Gn.debuglog("midway:debug");class BaseFramework{constructor(St){this.applicationContext=St;this.defaultContext={};this.middlewareManager=this.createMiddlewareManager();this.filterManager=this.createFilterManager();this.guardManager=this.createGuardManager();this.composeMiddleware=null}async init(){var St,Dt;this.configurationOptions=(St=this.configure())!==null&&St!==void 0?St:{};this.contextLoggerApplyLogger=(Dt=this.configurationOptions.contextLoggerApplyLogger)!==null&&Dt!==void 0?Dt:"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(St){this.bootstrapOptions=St;await this.beforeContainerInitialize(St);await this.containerInitialize(St);await this.afterContainerInitialize(St);await this.containerDirectoryLoad(St);await this.afterContainerDirectoryLoad(St);await this.applicationInitialize(St);await this.containerReady(St);await this.afterContainerReady(St);await this.mockService.runSimulatorAppSetup(this.app)}async containerInitialize(St){}async containerDirectoryLoad(St){}async containerReady(St){if(!this.app.getApplicationContext){this.defineApplicationProperties()}}getApplicationContext(){return this.applicationContext}getConfiguration(St){return this.configService.getConfiguration(St)}getCurrentEnvironment(){return this.environmentService.getCurrentEnvironment()}getApplication(){return this.app}createContextLogger(St,Dt){if(Dt&&Dt!=="appLogger"){const rr=this.getLogger(Dt);let cr=St.getAttr(gr.REQUEST_CTX_LOGGER_CACHE_KEY);if(!cr){cr=new Map;St.setAttr(gr.REQUEST_CTX_LOGGER_CACHE_KEY,cr)}if(cr.has(Dt)){return cr.get(Dt)}const pr=this.loggerService.createContextLogger(St,rr);cr.set(Dt,pr);return pr}else{const rr=this.getLogger(Dt!==null&&Dt!==void 0?Dt:this.contextLoggerApplyLogger);if(St["_logger"]){return St["_logger"]}St["_logger"]=this.loggerService.createContextLogger(St,rr,{contextFormat:this.contextLoggerFormat});return St["_logger"]}}async stop(){await this.mockService.runSimulatorAppTearDown(this.app);await this.beforeStop()}getAppDir(){return this.informationService.getAppDir()}getBaseDir(){return this.informationService.getBaseDir()}defineApplicationProperties(St={},Dt=[]){const rr={getBaseDir:()=>this.getBaseDir(),getAppDir:()=>this.getAppDir(),getEnv:()=>this.getCurrentEnvironment(),getApplicationContext:()=>this.getApplicationContext(),getConfig:St=>this.getConfiguration(St),getFrameworkType:()=>{if(this["getFrameworkType"]){return this["getFrameworkType"]()}},getProcessType:()=>mr.MidwayProcessTypeEnum.APPLICATION,getCoreLogger:()=>this.getCoreLogger(),getLogger:St=>this.getLogger(St),createLogger:(St,Dt={})=>this.createLogger(St,Dt),getFramework:()=>this,getProjectName:()=>this.getProjectName(),createAnonymousContext:St=>{const Dt=St||Object.create(this.defaultContext);if(!Dt.startTime){Dt.startTime=Date.now()}if(!Dt.logger){Dt.logger=this.createContextLogger(Dt)}if(!Dt.requestContext){Dt.requestContext=new Sr.MidwayRequestContainer(Dt,this.getApplicationContext());Dt.requestContext.ready()}if(!Dt.getLogger){Dt.getLogger=St=>this.createContextLogger(Dt,St)}Dt.setAttr=(St,rr)=>{Dt.requestContext.setAttr(St,rr)};Dt.getAttr=St=>Dt.requestContext.getAttr(St);Dt.getApp=()=>this.getApplication();return Dt},addConfigObject:St=>{this.configService.addObject(St)},setAttr:(St,Dt)=>{this.getApplicationContext().setAttr(St,Dt)},getAttr:St=>this.getApplicationContext().getAttr(St),useMiddleware:St=>this.useMiddleware(St),getMiddleware:()=>this.getMiddleware(),useFilter:St=>this.useFilter(St),useGuard:St=>this.useGuard(St),getNamespace:()=>this.getNamespace()};for(const St of Dt){delete rr[St]}Object.assign(this.app,rr,St)}async beforeStop(){}async beforeContainerInitialize(St){}async afterContainerInitialize(St){}async afterContainerDirectoryLoad(St){}async afterContainerReady(St){}async applyMiddleware(St){var Dt;if(!this.composeMiddleware){if(!this.applicationContext.hasObject(gr.ASYNC_CONTEXT_MANAGER_KEY)){const St=this.configService.getConfiguration("asyncContextManager.enable")||false;const rr=St?((Dt=this.bootstrapOptions)===null||Dt===void 0?void 0:Dt.asyncContextManager)||new mi.NoopContextManager:new mi.NoopContextManager;if(St){rr.enable()}this.applicationContext.registerObject(gr.ASYNC_CONTEXT_MANAGER_KEY,rr)}this.middlewareManager.insertFirst((async(St,Dt)=>{const rr=mi.ASYNC_ROOT_CONTEXT.setValue(gr.ASYNC_CONTEXT_KEY,St);const cr=this.applicationContext.get(gr.ASYNC_CONTEXT_MANAGER_KEY);return await cr.with(rr,(async()=>{await this.mockService.runSimulatorContextSetup(St,this.app);this.mockService.applyContextMocks(this.app,St);let rr=undefined;try{const cr=await Dt();rr=await this.filterManager.runResultFilter(cr,St)}catch(Dt){rr=await this.filterManager.runErrorFilter(Dt,St)}finally{await this.mockService.runSimulatorContextTearDown(St,this.app)}if(rr.error){throw rr.error}return rr.result}))}));ki(`[core]: Compose middleware = [${this.middlewareManager.getNames()}]`);this.composeMiddleware=await this.middlewareService.compose(this.middlewareManager,this.app);await this.filterManager.init(this.applicationContext)}if(St){St=Array.isArray(St)?St:[St];return await this.middlewareService.compose([this.composeMiddleware,...St],this.app)}return this.composeMiddleware}getLogger(St){var Dt;return(Dt=this.loggerService.getLogger(St))!==null&&Dt!==void 0?Dt:this.appLogger}getCoreLogger(){return this.logger}createLogger(St,Dt={}){return this.loggerService.createLogger(St,Dt)}getProjectName(){return this.informationService.getProjectName()}getFrameworkName(){return this.constructor.name}useMiddleware(St){this.middlewareManager.insertLast(St)}getMiddleware(){return this.middlewareManager}useFilter(St){return this.filterManager.useFilter(St)}useGuard(St){return this.guardManager.addGlobalGuard(St)}async runGuard(St,Dt,rr){return this.guardManager.runGuard(St,Dt,rr)}createMiddlewareManager(){return new Hr.ContextMiddlewareManager}createFilterManager(){return new Tn.FilterManager}createGuardManager(){return new $i.GuardManager}setNamespace(St){this.namespace=St}getNamespace(){return this.namespace}}cr([(0,yr.Inject)(),pr("design:type",Or.MidwayLoggerService)],BaseFramework.prototype,"loggerService",void 0);cr([(0,yr.Inject)(),pr("design:type",$r.MidwayEnvironmentService)],BaseFramework.prototype,"environmentService",void 0);cr([(0,yr.Inject)(),pr("design:type",Er.MidwayConfigService)],BaseFramework.prototype,"configService",void 0);cr([(0,yr.Inject)(),pr("design:type",Ir.MidwayInformationService)],BaseFramework.prototype,"informationService",void 0);cr([(0,yr.Inject)(),pr("design:type",Gr.MidwayMiddlewareService)],BaseFramework.prototype,"middlewareService",void 0);cr([(0,yr.Inject)(),pr("design:type",Wn.MidwayMockService)],BaseFramework.prototype,"mockService",void 0);cr([(0,yr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],BaseFramework.prototype,"init",null);Dt.BaseFramework=BaseFramework},43436:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayApplicationManager=void 0;const pr=rr(6192);const mr=rr(49757);let gr=class MidwayApplicationManager{constructor(){this.globalFrameworkMap=new Map;this.globalFrameworkTypeMap=new WeakMap}addFramework(St,Dt){this.globalFrameworkMap.set(St,Dt);if(Dt["getFrameworkType"]){this.globalFrameworkTypeMap.set(Dt["getFrameworkType"](),Dt)}}getFramework(St){if(typeof St==="string"){if(this.globalFrameworkMap.has(St)){return this.globalFrameworkMap.get(St)}}else{if(this.globalFrameworkTypeMap.has(St)){return this.globalFrameworkTypeMap.get(St)}}}getApplication(St){if(typeof St==="string"){if(this.globalFrameworkMap.has(St)){return this.globalFrameworkMap.get(St).getApplication()}}else{if(this.globalFrameworkTypeMap.has(St)){return this.globalFrameworkTypeMap.get(St).getApplication()}}}getApplications(St){if(!St){return Array.from(this.globalFrameworkMap.values()).map((St=>St.getApplication())).filter((St=>!!St))}else{return St.map((St=>this.getApplication(St))).filter((St=>!!St))}}};gr=cr([(0,mr.Provide)(),(0,mr.Scope)(pr.ScopeEnum.Singleton)],gr);Dt.MidwayApplicationManager=gr},75351:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.NoopContextManager=Dt.ASYNC_ROOT_CONTEXT=void 0;class AsyncBaseContext{constructor(St){const Dt=this;Dt._currentContext=St?new Map(St):new Map;Dt.getValue=St=>Dt._currentContext.get(St);Dt.setValue=(St,rr)=>{const cr=new AsyncBaseContext(Dt._currentContext);cr._currentContext.set(St,rr);return cr};Dt.deleteValue=St=>{const rr=new AsyncBaseContext(Dt._currentContext);rr._currentContext.delete(St);return rr}}}Dt.ASYNC_ROOT_CONTEXT=new AsyncBaseContext;class NoopContextManager{active(){return Dt.ASYNC_ROOT_CONTEXT}with(St,Dt,rr,...cr){return Dt.call(rr,...cr)}bind(St,Dt){return Dt}enable(){return this}disable(){return this}}Dt.NoopContextManager=NoopContextManager},46673:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.DataListener=void 0;const mr=rr(49757);class DataListener{async init(){this.innerData=await this.initData();await this.onData(this.setData.bind(this))}setData(St){this.innerData=St}getData(){return this.innerData}async stop(){await this.destroyListener()}async destroyListener(){}}cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],DataListener.prototype,"init",null);cr([(0,mr.Destroy)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],DataListener.prototype,"stop",null);Dt.DataListener=DataListener},12849:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.globModels=Dt.formatGlobString=Dt.DataSourceManager=void 0;const mr=rr(83486);const gr=rr(86314);const yr=rr(62525);const Sr=rr(16928);const $r=rr(63289);const Er=rr(2222);const Ir=rr(39023);const Or=rr(65308);const Hr=rr(49757);const Gr=rr(70275);const Tn=rr(78842);const Wn=rr(67934);const Gn=(0,Ir.debuglog)("midway:debug");class DataSourceManager{constructor(){this.dataSource=new Map;this.options={};this.modelMapping=new WeakMap;this.dataSourcePriority={}}async initDataSource(St,Dt){var rr,cr;this.options=St;if(!this.options.dataSource){throw new gr.MidwayParameterError("[DataSourceManager] must set options.dataSource.")}if(typeof Dt==="string"){Dt={baseDir:Dt,entitiesConfigKey:"entities"}}const pr=Dt;const mr=(cr=(rr=this.configService)===null||rr===void 0?void 0:rr.getConfiguration("core.concurrentDataSourceInitialization"))!==null&&cr!==void 0?cr:false;const processDataSource=async Dt=>{var rr;const cr=St.dataSource[Dt];const mr=cr[pr.entitiesConfigKey];if(mr){const St=new Set;for(const cr of mr){if(typeof cr==="string"){const mr=await globModels(cr,pr.baseDir,(rr=this.environmentService)===null||rr===void 0?void 0:rr.getModuleLoadType());for(const rr of mr){St.add(rr);this.modelMapping.set(rr,Dt)}}else{St.add(cr);this.modelMapping.set(cr,Dt)}}cr[pr.entitiesConfigKey]=Array.from(St);Gn(`[core]: DataManager load ${cr[pr.entitiesConfigKey].length} models from ${Dt}.`)}const gr={cacheInstance:St.cacheInstance,validateConnection:St.validateConnection};await this.createInstance(cr,Dt,gr)};const yr=Object.keys(St.dataSource);if(mr){await Promise.all(yr.map(processDataSource))}else{for(const St of yr){await processDataSource(St)}}}getDataSource(St){return this.dataSource.get(St)}hasDataSource(St){return this.dataSource.has(St)}getDataSourceNames(){return Array.from(this.dataSource.keys())}getAllDataSources(){return this.dataSource}async isConnected(St){const Dt=this.getDataSource(St);return Dt?this.checkConnected(Dt):false}async createInstance(St,Dt,rr){const cr=rr&&typeof rr.cacheInstance==="boolean"?rr.cacheInstance:true;const pr=rr&&rr.validateConnection||false;const yr=(0,mr.extend)(true,{},this.options["default"],St);const Sr=await this.createDataSource(yr,Dt);if(cr&&Dt&&Sr){this.dataSource.set(Dt,Sr)}if(pr){if(!Sr){throw new gr.MidwayCommonError(`[DataSourceManager] ${Dt} initialization failed.`)}const St=await this.checkConnected(Sr);if(!St){throw new gr.MidwayCommonError(`[DataSourceManager] ${Dt} is not connected.`)}}return Sr}getDataSourceNameByModel(St){return this.modelMapping.get(St)}async stop(){const St=Array.from(this.dataSource.values());await Promise.all(St.map((St=>this.destroyDataSource(St))));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(St){return this.priorityManager.getPriority(this.dataSourcePriority[St])}isHighPriority(St){return this.priorityManager.isHighPriority(this.dataSourcePriority[St])}isMediumPriority(St){return this.priorityManager.isMediumPriority(this.dataSourcePriority[St])}isLowPriority(St){return this.priorityManager.isLowPriority(this.dataSourcePriority[St])}}cr([(0,Hr.Inject)(),pr("design:type",String)],DataSourceManager.prototype,"appDir",void 0);cr([(0,Hr.Inject)(),pr("design:type",Gr.MidwayEnvironmentService)],DataSourceManager.prototype,"environmentService",void 0);cr([(0,Hr.Inject)(),pr("design:type",Tn.MidwayConfigService)],DataSourceManager.prototype,"configService",void 0);cr([(0,Hr.Inject)(),pr("design:type",Wn.MidwayPriorityManager)],DataSourceManager.prototype,"priorityManager",void 0);Dt.DataSourceManager=DataSourceManager;function formatGlobString(St){let Dt;if(!/^\*/.test(St)){St="/"+St}const rr=(0,Sr.parse)(St);if(rr.base&&(/\*/.test(rr.base)||rr.ext)){Dt=[St]}else{Dt=[...Er.DEFAULT_PATTERN.map((Dt=>(0,Sr.join)(St,Dt)))]}return Dt}Dt.formatGlobString=formatGlobString;async function globModels(St,Dt,rr){const cr=formatGlobString(St);const pr=[];const mr=(0,yr.run)(cr,{cwd:Dt,ignore:Er.IGNORE_PATTERN});for(const St of mr){const Dt=await(0,Or.loadModule)(St,{loadMode:rr});if($r.Types.isClass(Dt)){pr.push(Dt)}else{for(const St in Dt){const rr=Dt[St];if($r.Types.isClass(rr)){pr.push(rr)}}}}return pr}Dt.globModels=globModels},1845:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.CustomModuleDetector=Dt.ESModuleFileDetector=Dt.CommonJSFileDetector=Dt.AbstractFileDetector=void 0;const cr=rr(63289);const pr=rr(62525);const mr=rr(86314);const gr=rr(2222);const yr=rr(49757);const Sr=rr(65308);class AbstractFileDetector{constructor(St){this.options=St;this.extraDetectorOptions={}}setExtraDetectorOptions(St){this.extraDetectorOptions=St}}Dt.AbstractFileDetector=AbstractFileDetector;const $r=["**/**.tsx"].concat(gr.DEFAULT_PATTERN);const Er=["**/logs/**","**/run/**","**/public/**","**/app/view/**","**/app/views/**","**/app/extend/**","**/node_modules/**","**/**.test.ts","**/**.test.js","**/__test__/**"].concat(gr.IGNORE_PATTERN);class CommonJSFileDetector extends AbstractFileDetector{constructor(){super(...arguments);this.duplicateModuleCheckSet=new Map}run(St){if(this.getType()==="commonjs"){return this.loadSync(St)}else{return this.loadAsync(St)}}loadSync(St){var Dt;this.options=this.options||{};const rr=[].concat((Dt=this.options.loadDir)!==null&&Dt!==void 0?Dt:St.get("baseDir"));for(const Dt of rr){const rr=(0,pr.run)($r.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:Dt,ignore:Er.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(St,Dt)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&cr.Types.isClass(St)){const rr=(0,yr.getProviderName)(St);if(rr){if(this.duplicateModuleCheckSet.has(rr)){throw new mr.MidwayDuplicateClassNameError(rr,Dt.srcPath,this.duplicateModuleCheckSet.get(rr))}else{this.duplicateModuleCheckSet.set(rr,Dt.srcPath)}}}};for(const Dt of rr){const rr=require(Dt);St.bindClass(rr,{namespace:this.options.namespace,srcPath:Dt,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}async loadAsync(St){var Dt;this.options=this.options||{};const rr=[].concat((Dt=this.options.loadDir)!==null&&Dt!==void 0?Dt:St.get("baseDir"));for(const Dt of rr){const rr=(0,pr.run)($r.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:Dt,ignore:Er.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(St,Dt)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&cr.Types.isClass(St)){const rr=(0,yr.getProviderName)(St);if(rr){if(this.duplicateModuleCheckSet.has(rr)){throw new mr.MidwayDuplicateClassNameError(rr,Dt.srcPath,this.duplicateModuleCheckSet.get(rr))}else{this.duplicateModuleCheckSet.set(rr,Dt.srcPath)}}}};for(const Dt of rr){const rr=await(0,Sr.loadModule)(Dt,{loadMode:"esm"});St.bindClass(rr,{namespace:this.options.namespace,srcPath:Dt,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}getType(){return"commonjs"}}Dt.CommonJSFileDetector=CommonJSFileDetector;class ESModuleFileDetector extends CommonJSFileDetector{getType(){return"module"}}Dt.ESModuleFileDetector=ESModuleFileDetector;class CustomModuleDetector extends AbstractFileDetector{async run(St){for(const Dt of this.options.modules){St.bindClass(Dt,{namespace:this.options.namespace,createFrom:"module"})}}}Dt.CustomModuleDetector=CustomModuleDetector},39408:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.FilterManager=void 0;const cr=rr(49757);const pr=rr(65308);class FilterManager{constructor(){this.errFilterList=[];this.successFilterList=[];this.exceptionMap=new WeakMap;this.defaultErrFilter=undefined;this.matchFnList=[];this.protoMatchList=[]}useFilter(St){if(!Array.isArray(St)){St=[St]}for(const Dt of St){if((0,cr.getClassMetadata)(cr.CATCH_KEY,Dt)){this.errFilterList.push(Dt)}if((0,cr.getClassMetadata)(cr.MATCH_KEY,Dt)){this.successFilterList.push(Dt)}}}async init(St){for(const Dt of this.errFilterList){const rr=await St.getAsync(Dt);const pr=(0,cr.getClassMetadata)(cr.CATCH_KEY,Dt);if(pr&&pr.catchTargets){pr.catchOptions=pr.catchOptions||{};for(const St of pr.catchTargets){this.exceptionMap.set(St,{filter:rr,catchOptions:pr.catchOptions});if(pr.catchOptions["matchPrototype"]){this.protoMatchList.push((Dt=>{if(Dt instanceof St){return St}else{return false}}))}}}else{this.defaultErrFilter=rr}}for(const Dt of this.successFilterList){const rr=await St.getAsync(Dt);const mr=(0,cr.getClassMetadata)(cr.MATCH_KEY,Dt);if(mr&&mr.matchPattern){this.matchFnList.push({matchFn:(0,pr.toPathMatch)(mr.matchPattern),target:rr})}}}async runErrorFilter(St,Dt,rr,cr){let pr,mr;let gr=false;if(St&&this.exceptionMap.has(St.constructor)){gr=true;const mr=this.exceptionMap.get(St.constructor);pr=await mr.filter.catch(St,Dt,rr,cr)}if(!gr&&this.protoMatchList.length){let mr;for(const Dt of this.protoMatchList){mr=Dt(St);if(mr){break}}if(mr){gr=true;const yr=this.exceptionMap.get(mr);pr=await yr.filter.catch(St,Dt,rr,cr)}}if(!gr&&this.defaultErrFilter){gr=true;pr=await this.defaultErrFilter.catch(St,Dt,rr,cr)}if(!gr){mr=St}return{result:pr,error:mr}}async runResultFilter(St,Dt,rr,cr){let pr=St;for(const St of this.matchFnList){if(St.matchFn(Dt,rr)){pr=await St.target.match(pr,Dt,rr,cr)}}return{result:pr,error:undefined}}}Dt.FilterManager=FilterManager},40581:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.GuardManager=void 0;const cr=rr(49757);class GuardManager extends Array{addGlobalGuard(St){if(!Array.isArray(St)){this.push(St)}else{this.push(...St)}}async runGuard(St,Dt,rr){for(const cr of this){const pr=await St.requestContext.getAsync(cr);const mr=await pr.canActivate(St,Dt,rr);if(!mr){return false}}const pr=(0,cr.getClassMetadata)(cr.GUARD_KEY,Dt);if(pr){for(const cr of pr){const pr=await St.requestContext.getAsync(cr);const mr=await pr.canActivate(St,Dt,rr);if(!mr){return false}}}const mr=(0,cr.getPropertyMetadata)(cr.GUARD_KEY,Dt,rr);if(mr){for(const cr of mr){const pr=await St.requestContext.getAsync(cr);const mr=await pr.canActivate(St,Dt,rr);if(!mr){return false}}}return true}}Dt.GuardManager=GuardManager},82535:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.DefaultConsoleLoggerFactory=Dt.LoggerFactory=void 0;class LoggerFactory{}Dt.LoggerFactory=LoggerFactory;class DefaultConsoleLoggerFactory{constructor(){this.instance=new Map}createLogger(St,Dt){this.instance.set(St,console);return console}getLogger(St){return this.instance.get(St)}close(St){}removeLogger(St){}getDefaultMidwayLoggerConfig(){return{midwayLogger:{default:{},clients:{coreLogger:{},appLogger:{}}}}}createContextLogger(St,Dt,rr){return Dt}getClients(){return this.instance}getClientKeys(){return Array.from(this.instance.keys())}}Dt.DefaultConsoleLoggerFactory=DefaultConsoleLoggerFactory},12738:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.createMiddleware=Dt.ContextMiddlewareManager=void 0;class ContextMiddlewareManager extends Array{insertFirst(St){if(Array.isArray(St)){this.unshift(...St)}else{this.unshift(St)}}insertLast(St){if(Array.isArray(St)){this.push(...St)}else{this.push(St)}}insertBefore(St,Dt){if(typeof Dt!=="number"){Dt=this.findItemIndex(Dt)}if(Array.isArray(St)){this.splice(Dt,0,...St)}else{this.splice(Dt,0,St)}}insertAfter(St,Dt){if(typeof Dt!=="number"){Dt=this.findItemIndex(Dt)}if(Array.isArray(St)){this.splice(Dt+1,0,...St)}else{this.splice(Dt+1,0,St)}}findAndInsertAfter(St,Dt){St=this.findItem(St);Dt=this.findItem(Dt);if(!St||!Dt||St===Dt){return}if(Dt){const rr=this.remove(St);if(rr){this.insertAfter(rr,Dt)}}}findAndInsertBefore(St,Dt){St=this.findItem(St);Dt=this.findItem(Dt);if(!St||!Dt||St===Dt){return}if(Dt){const rr=this.remove(St);if(rr){this.insertBefore(rr,Dt)}}}findAndInsertFirst(St){const Dt=this.remove(St);if(Dt){this.insertFirst(Dt)}}findAndInsertLast(St){const Dt=this.remove(St);if(Dt){this.insertLast(Dt)}}findItemIndex(St){if(typeof St==="number"){return St}else if(typeof St==="string"){return this.findIndex((Dt=>this.getMiddlewareName(Dt)===St))}else{return this.findIndex((Dt=>Dt===St))}}findItem(St){if(typeof St==="number"){if(St>=0&&St<=this.length-1){return this[St]}}else if(typeof St==="string"){return this.find((Dt=>this.getMiddlewareName(Dt)===St))}else{return St}}getMiddlewareName(St){var Dt,rr,cr;if(St["middleware"]){return(Dt=St.name)!==null&&Dt!==void 0?Dt:this.getMiddlewareName(St["middleware"])}return(cr=(rr=St.getName&&St.getName())!==null&&rr!==void 0?rr:St._name)!==null&&cr!==void 0?cr:St.name}remove(St){if(typeof St==="number"&&St!==-1){return this.splice(St,1)[0]}else{const Dt=this.findItemIndex(St);if(Dt!==-1){return this.splice(Dt,1)[0]}}}push(...St){St.forEach((St=>{if(typeof St!=="string"&&!this.getMiddlewareName(St)){St._name="anonymous"}}));return super.push(...St)}unshift(...St){St.forEach((St=>{if(typeof St!=="string"&&!this.getMiddlewareName(St)){St._name="anonymous"}}));return super.unshift(...St)}getNames(){return this.map((St=>this.getMiddlewareName(St)))}}Dt.ContextMiddlewareManager=ContextMiddlewareManager;function createMiddleware(St,Dt,rr){return{middleware:St,options:Dt,name:rr}}Dt.createMiddleware=createMiddleware},70032:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayInitializerPerformanceManager=Dt.MidwayPerformanceManager=void 0;const cr=rr(82987);class MidwayPerformanceManager{constructor(St){this.group=St;this.observer=null;this.marks=new Set;this.measures=new Set}static getInstance(St){if(!this.instances.has(St)){this.instances.set(St,new MidwayPerformanceManager(St))}return this.instances.get(St)}formatKey(St,Dt){return`${this.group}:${St}-${Dt}`}markStart(St){const Dt=this.formatKey(St,"start");cr.performance.mark(Dt);this.marks.add(Dt)}markEnd(St){const Dt=this.formatKey(St,"start");const rr=this.formatKey(St,"end");const pr=`${this.group}:${St}`;cr.performance.mark(rr);this.marks.add(rr);cr.performance.measure(pr,Dt,rr);this.measures.add(pr)}observeMeasure(St){if(this.observer){return}this.observer=new cr.PerformanceObserver((Dt=>{const rr=Dt.getEntries().filter((St=>St.name.startsWith(`${this.group}:`)));if(rr.length>0){St({getEntries:()=>rr})}}));this.observer.observe({entryTypes:["measure"]});return this.observer}disconnect(){if(this.observer){this.observer.disconnect();this.observer=null}}clean(){this.marks.forEach((St=>{try{cr.performance.clearMarks(St)}catch(Dt){console.warn(`Failed to clear mark ${St}: ${Dt}`)}}));this.marks.clear();this.measures.forEach((St=>{try{cr.performance.clearMeasures(St)}catch(Dt){console.warn(`Failed to clear measure ${St}: ${Dt}`)}}));this.measures.clear();this.disconnect()}static cleanAll(){this.instances.forEach((St=>St.clean()));this.instances.clear()}static getInitialPerformanceEntries(){const St=[];cr.performance===null||cr.performance===void 0?void 0:cr.performance.getEntries().forEach((Dt=>{if(Dt.name.startsWith(this.DEFAULT_GROUP.INITIALIZE)){St.push(Dt.toJSON())}}));return St}}Dt.MidwayPerformanceManager=MidwayPerformanceManager;MidwayPerformanceManager.instances=new Map;MidwayPerformanceManager.DEFAULT_GROUP={INITIALIZE:"MidwayInitialize"};class MidwayInitializerPerformanceManager{static markStart(St){const Dt=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);Dt.markStart(St)}static markEnd(St){const Dt=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);Dt.markEnd(St)}static frameworkInitializeStart(St){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${St}`)}static frameworkInitializeEnd(St){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${St}`)}static frameworkRunStart(St){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${St}`)}static frameworkRunEnd(St){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${St}`)}static lifecycleStart(St,Dt){this.markStart(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${St}:${Dt}`)}static lifecycleEnd(St,Dt){this.markEnd(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${St}:${Dt}`)}}Dt.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"}},67934:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayPriorityManager=Dt.DEFAULT_PRIORITY=void 0;const pr=rr(49757);const mr=rr(6192);Dt.DEFAULT_PRIORITY={L1:"High",L2:"Medium",L3:"Low"};let gr=class MidwayPriorityManager{constructor(){this.priorityList=Dt.DEFAULT_PRIORITY;this.defaultPriority=Dt.DEFAULT_PRIORITY.L2}getCurrentPriorityList(){return this.priorityList}getDefaultPriority(){return this.defaultPriority}isHighPriority(St=Dt.DEFAULT_PRIORITY.L2){return St===Dt.DEFAULT_PRIORITY.L1}isMediumPriority(St=Dt.DEFAULT_PRIORITY.L2){return St===Dt.DEFAULT_PRIORITY.L2}isLowPriority(St=Dt.DEFAULT_PRIORITY.L2){return St===Dt.DEFAULT_PRIORITY.L3}getPriority(St){return St||this.getDefaultPriority()}};gr=cr([(0,pr.Provide)(),(0,pr.Scope)(mr.ScopeEnum.Singleton)],gr);Dt.MidwayPriorityManager=gr},64842:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.ServiceFactory=void 0;const mr=rr(83486);const gr=rr(67934);const yr=rr(49757);class ServiceFactory{constructor(){this.clients=new Map;this.options={}}async initClients(St={}){this.options=St;if(St.client){St.clients=St.clients||{};St.clients["default"]=St.clients["default"]||{};(0,mr.extend)(true,St.clients["default"],St.client)}if(St.clients){for(const Dt of Object.keys(St.clients)){await this.createInstance(St.clients[Dt],Dt)}}this.clientPriority=St.priority||{}}get(St="default"){return this.clients.get(St)}has(St){return this.clients.has(St)}async createInstance(St,Dt){St=(0,mr.extend)(true,{},this.options["default"],St);const rr=await this.createClient(St,Dt);if(rr){if(Dt){this.clients.set(Dt,rr)}return rr}}async destroyClient(St,Dt){}async stop(){for(const[St,Dt]of this.clients.entries()){await this.destroyClient(Dt,St)}}getDefaultClientName(){return this.options["defaultClientName"]}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}getClientPriority(St){return this.priorityManager.getPriority(this.clientPriority[St])}isHighPriority(St){return this.priorityManager.isHighPriority(this.clientPriority[St])}isMediumPriority(St){return this.priorityManager.isMediumPriority(this.clientPriority[St])}isLowPriority(St){return this.priorityManager.isLowPriority(this.clientPriority[St])}}cr([(0,yr.Inject)(),pr("design:type",gr.MidwayPriorityManager)],ServiceFactory.prototype,"priorityManager",void 0);Dt.ServiceFactory=ServiceFactory},11330:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.TypedResourceManager=void 0;class TypedResourceManager{constructor(St){this.typedResourceInitializerOptions=St;this.resourceMap=new Map;this.resourceBindingMap=new Map}async createResource(St,Dt){const rr=await this.typedResourceInitializerOptions.resourceInitialize(Dt,St);this.resourceMap.set(St,rr);return rr}async init(){for(const St of Object.keys(this.typedResourceInitializerOptions.initializeValue)){const Dt=this.typedResourceInitializerOptions.initializeValue[St];const rr=this.typedResourceInitializerOptions.initializeClzProvider[St];const cr=await this.createResource(St,Dt);const pr=await this.typedResourceInitializerOptions.resourceBinding(rr,Dt,cr,St);if(pr){this.resourceBindingMap.set(St,pr)}}}async startParallel(){const St=[];for(const[Dt,rr]of this.resourceMap.entries()){St.push(this.typedResourceInitializerOptions.resourceStart(rr,this.typedResourceInitializerOptions.initializeValue[Dt],this.resourceBindingMap.get(Dt)))}await Promise.all(St)}async start(){for(const[St,Dt]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceStart(Dt,this.typedResourceInitializerOptions.initializeValue[St],this.resourceBindingMap.get(St))}}async destroyParallel(){const St=[];for(const[Dt,rr]of this.resourceMap.entries()){St.push(this.typedResourceInitializerOptions.resourceDestroy(rr,this.typedResourceInitializerOptions.initializeValue[Dt]))}await Promise.all(St)}async destroy(){for(const[St,Dt]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceDestroy(Dt,this.typedResourceInitializerOptions.initializeValue[St])}this.resourceMap.clear();this.resourceBindingMap.clear()}getResource(St){return this.resourceMap.get(St)}}Dt.TypedResourceManager=TypedResourceManager},11026:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.WebControllerGenerator=void 0;const cr=rr(49757);const pr=rr(39023);const mr=rr(6192);const gr=rr(86314);const yr=rr(68220);const Sr=pr.debuglog("midway:debug");class WebControllerGenerator{constructor(St,Dt){this.app=St;this.midwayWebRouterService=Dt}generateKoaController(St){return async(Dt,rr)=>{if(St.controllerClz&&typeof St.method==="string"){const rr=await this.app.getFramework().runGuard(Dt,St.controllerClz,St.method);if(!rr){throw new gr.httpError.ForbiddenError}}const pr=[Dt,rr];let mr;if(typeof St.method!=="string"){mr=await St.method(Dt,rr)}else{const rr=await Dt.requestContext.getAsync(St.id);mr=await rr[St.method].apply(rr,pr)}if(mr!==undefined){if(mr===null){Dt.response._body=null;Dt.response._midwayControllerNullBody=true}else{Dt.body=mr}}if(Array.isArray(St.responseMetadata)&&St.responseMetadata.length){for(const rr of St.responseMetadata){switch(rr.type){case cr.WEB_RESPONSE_HTTP_CODE:Dt.status=rr.code;break;case cr.WEB_RESPONSE_HEADER:for(const St in(rr===null||rr===void 0?void 0:rr.setHeaders)||{}){Dt.set(St,rr.setHeaders[St])}break;case cr.WEB_RESPONSE_CONTENT_TYPE:Dt.type=rr.contentType;break;case cr.WEB_RESPONSE_REDIRECT:Dt.status=rr.code;Dt.redirect(rr.url);return}}}}}async loadMidwayController(St){var Dt,rr;const cr=await this.midwayWebRouterService.getRouterTable();const pr=await this.midwayWebRouterService.getRoutePriorityList();const gr=this.app.getApplicationContext();const $r=this.app.getCoreLogger();const Er=gr.get(yr.MidwayMiddlewareService);for(const yr of pr){gr.bindClass(yr.routerModule);$r.debug(`Load Controller "${yr.controllerId}", prefix=${yr.prefix}`);Sr(`[core]: Load Controller "${yr.controllerId}", prefix=${yr.prefix}`);const pr=this.createRouter({prefix:yr.prefix,...yr.routerOptions});yr.middleware=(Dt=yr.middleware)!==null&&Dt!==void 0?Dt:[];if(yr.middleware.length){const St=await Er.compose(yr.middleware,this.app);pr.use(St)}const Ir=cr.get(yr.prefix);for(const St of Ir){const Dt=[];St.middleware=(rr=St.middleware)!==null&&rr!==void 0?rr:[];if(St.middleware.length){const rr=await Er.compose(St.middleware,this.app);Dt.push(rr)}if(this.app.getFrameworkType()===mr.MidwayFrameworkType.WEB_KOA){if(typeof St.url==="string"&&/\*$/.test(St.url)){St.url=St.url.replace("*","(.*)")}}const cr=[St.routerName,St.url,...Dt,this.generateController(St)];$r.debug(`Load Router "${St.requestMethod.toUpperCase()} ${St.url}"`);Sr(`[core]: Load Router "${St.requestMethod.toUpperCase()} ${St.url}"`);pr[St.requestMethod.toLowerCase()].apply(pr,cr)}St&&St(pr)}}}Dt.WebControllerGenerator=WebControllerGenerator},42193:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});const cr=rr(65308);Dt["default"]=St=>{const Dt=(0,cr.isDevelopmentEnvironment)((0,cr.getCurrentEnvironment)());return{core:{healthCheckTimeout:1e3,concurrentDataSourceInitialization:false},asyncContextManager:{enable:false},midwayLogger:{default:{level:"info"},clients:{coreLogger:{level:Dt?"info":"warn"},appLogger:{aliasName:"logger"}}},debug:{recordConfigMergeOrder:Dt}}}},2222:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.SINGLETON_CONTAINER_CTX=Dt.IGNORE_PATTERN=Dt.DEFAULT_PATTERN=Dt.ASYNC_CONTEXT_MANAGER_KEY=Dt.ASYNC_CONTEXT_KEY=Dt.REQUEST_CTX_LOGGER_CACHE_KEY=Dt.HTTP_SERVER_KEY=Dt.CONTAINER_OBJ_SCOPE=Dt.REQUEST_OBJ_CTX_KEY=Dt.REQUEST_CTX_KEY=Dt.MIDWAY_LOGGER_WRITEABLE_DIR=Dt.FUNCTION_INJECT_KEY=Dt.KEYS=void 0;Dt.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"};Dt.FUNCTION_INJECT_KEY="midway:function_inject_key";Dt.MIDWAY_LOGGER_WRITEABLE_DIR="MIDWAY_LOGGER_WRITEABLE_DIR";Dt.REQUEST_CTX_KEY="ctx";Dt.REQUEST_OBJ_CTX_KEY="_req_ctx";Dt.CONTAINER_OBJ_SCOPE="_obj_scope";Dt.HTTP_SERVER_KEY="_midway_http_server";Dt.REQUEST_CTX_LOGGER_CACHE_KEY="_midway_ctx_logger_cache";Dt.ASYNC_CONTEXT_KEY=Symbol("ASYNC_CONTEXT_KEY");Dt.ASYNC_CONTEXT_MANAGER_KEY="MIDWAY_ASYNC_CONTEXT_MANAGER_KEY";Dt.DEFAULT_PATTERN=["**/**.ts","**/**.js","**/**.mts","**/**.mjs","**/**.cts","**/**.cjs"];Dt.IGNORE_PATTERN=["**/**.d.ts","**/**.d.mts","**/**.d.cts"];Dt.SINGLETON_CONTAINER_CTX={_MAIN_CTX_:true}},9288:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayContainer=void 0;const cr=rr(49757);const pr=rr(24451);const mr=rr(39023);const gr=rr(20873);const yr=rr(6192);const Sr=rr(2222);const $r=rr(47698);const Er=rr(34881);const Ir=rr(80932);const Or=rr(70275);const Hr=rr(78842);const Gr=rr(24434);const Tn=rr(86314);const Wn=rr(63289);const Gn=rr(65308);const mi=mr.debuglog("midway:debug");const $i=mr.debuglog("midway:bind");const ki=9;class ContainerConfiguration{constructor(St){this.container=St;this.loadedMap=new WeakMap;this.namespaceList=[];this.configurationOptionsList=[]}load(St){let Dt=cr.MAIN_MODULE_KEY;const rr=this.getConfigurationExport(St);if(!rr.length)return;for(let St=0;St<rr.length;St++){const mr=rr[St];if(this.loadedMap.get(mr)){continue}let gr;if(mr instanceof pr.FunctionalConfiguration){gr=mr.getConfigurationOptions()}else{gr=(0,cr.getClassMetadata)(cr.CONFIGURATION_KEY,mr)}this.loadedMap.set(mr,true);if(gr){if(gr.namespace!==undefined){Dt=gr.namespace;this.namespaceList.push(Dt)}this.configurationOptionsList.push(gr);mi(`[core]: load configuration in namespace="${Dt}"`);this.addImports(gr.imports);this.addImportObjects(gr.importObjects);this.addImportConfigs(gr.importConfigs);this.addImportConfigFilter(gr.importConfigFilter);this.bindConfigurationClass(mr,Dt)}}this.container.bindClass(St,{namespace:Dt})}addImportConfigs(St){if(St){if(Array.isArray(St)){this.container.get(Hr.MidwayConfigService).add(St)}else{this.container.get(Hr.MidwayConfigService).addObject(St)}}}addImportConfigFilter(St){if(St){this.container.get(Hr.MidwayConfigService).addFilter(St)}}addImports(St=[]){var Dt;for(let rr of St){if(!rr)continue;if(typeof rr==="string"){rr=require(rr)}if("Configuration"in rr){this.load(rr)}else if("component"in rr){if(rr===null||rr===void 0?void 0:rr.enabledEnvironment){if((Dt=rr===null||rr===void 0?void 0:rr.enabledEnvironment)===null||Dt===void 0?void 0:Dt.includes(this.container.get(Or.MidwayEnvironmentService).getCurrentEnvironment())){this.load(rr.component)}}else{this.load(rr.component)}}else{this.load(rr)}}}addImportObjects(St){if(St){const Dt=Object.keys(St);for(const rr of Dt){if(typeof St[rr]!==undefined){this.container.registerObject(rr,St[rr])}}}}bindConfigurationClass(St,Dt){if(St instanceof pr.FunctionalConfiguration){}else{(0,cr.saveProviderId)(undefined,St);const rr=(0,cr.getProviderUUId)(St);this.container.bind(rr,St,{namespace:Dt,scope:yr.ScopeEnum.Singleton})}const rr=(0,cr.listModule)(cr.CONFIGURATION_KEY);const mr=rr.find((Dt=>Dt.target===St));if(!mr){(0,cr.saveModule)(cr.CONFIGURATION_KEY,{target:St,namespace:Dt})}}getConfigurationExport(St){const Dt=[];if(Wn.Types.isClass(St)||Wn.Types.isFunction(St)||St instanceof pr.FunctionalConfiguration){Dt.push(St)}else{for(const rr in St){const cr=St[rr];if(Wn.Types.isClass(cr)||Wn.Types.isFunction(cr)||cr instanceof pr.FunctionalConfiguration){Dt.push(cr)}}}return Dt}getNamespaceList(){return this.namespaceList}getConfigurationOptionsList(){return this.configurationOptionsList}}class MidwayContainer{constructor(St){this._resolverFactory=null;this._registry=null;this._identifierMapping=null;this.moduleMap=null;this.parent=null;this.ctx=Sr.SINGLETON_CONTAINER_CTX;this.attrMap=new Map;this._namespaceSet=null;this.parent=St;this.init()}init(){this.registerObject(Sr.REQUEST_CTX_KEY,this.ctx)}get objectCreateEventTarget(){if(!this._objectCreateEventTarget){this._objectCreateEventTarget=new Gr}return this._objectCreateEventTarget}get registry(){if(!this._registry){this._registry=new gr.ObjectDefinitionRegistry}return this._registry}set registry(St){this._registry=St}get managedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new Ir.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(St){var Dt,rr,cr;if(!Array.isArray(St)){St=[St]}const pr=new ContainerConfiguration(this);for(const Dt of St){if(Dt){pr.load(Dt)}}for(const St of pr.getNamespaceList()){this.namespaceSet.add(St);mi(`[core]: load configuration in namespace="${St}" complete`)}const mr=(Dt=pr.getConfigurationOptionsList())!==null&&Dt!==void 0?Dt:[];const gr=(rr=mr.find((St=>!St.namespace)))!==null&&rr!==void 0?rr:{};this.fileDetector=(cr=gr.detector)!==null&&cr!==void 0?cr:this.fileDetector;if(this.fileDetector){this.fileDetector.setExtraDetectorOptions({conflictCheck:gr.conflictCheck,...gr.detectorOptions})}}loadDefinitions(){if(this.fileDetector){return this.fileDetector.run(this)}}bindClass(St,Dt){if(Wn.Types.isClass(St)||Wn.Types.isFunction(St)){this.bindModule(St,Dt)}else{for(const rr in St){const cr=St[rr];if(Wn.Types.isClass(cr)||Wn.Types.isFunction(cr)){this.bindModule(cr,Dt)}}}}bind(St,Dt,rr){var pr;if(Wn.Types.isClass(St)||Wn.Types.isFunction(St)){return this.bindModule(St,Dt)}if(this.registry.hasDefinition(St)){return}if(rr===null||rr===void 0?void 0:rr.bindHook){rr.bindHook(Dt,rr)}let mr;if(Wn.Types.isClass(Dt)){mr=new $r.ObjectDefinition;mr.name=(0,cr.getProviderName)(Dt)}else{mr=new Er.FunctionDefinition;if(!Wn.Types.isAsyncFunction(Dt)){mr.asynchronous=false}mr.name=mr.id}mr.path=Dt;mr.id=St;mr.srcPath=(rr===null||rr===void 0?void 0:rr.srcPath)||null;mr.namespace=(rr===null||rr===void 0?void 0:rr.namespace)||"";mr.scope=(rr===null||rr===void 0?void 0:rr.scope)||yr.ScopeEnum.Request;mr.createFrom=rr===null||rr===void 0?void 0:rr.createFrom;if(mr.srcPath){mi(`[core]: bind id "${mr.name} (${mr.srcPath}) ${St}"`)}else{mi(`[core]: bind id "${mr.name}" ${St}`)}const gr=(0,cr.getPropertyInject)(Dt);for(const St in gr){const Dt=gr[St];$i(`${" ".repeat(ki)}inject properties => [${JSON.stringify(Dt)}]`);const rr=new Ir.ManagedReference;rr.args=Dt.args;rr.name=Dt.value;rr.injectMode=Dt["injectMode"];mr.properties.set(Dt["targetKey"],rr)}const Sr=(0,cr.getClassExtendedMetadata)(cr.INJECT_CUSTOM_PROPERTY,Dt);for(const St in Sr){const Dt=Sr[St];mr.handlerProps.push(Dt)}const Or=(pr=(0,cr.getObjectDefinition)(Dt))!==null&&pr!==void 0?pr:{};if(Or.initMethod){$i(`${" ".repeat(ki)}register initMethod = ${Or.initMethod}`);mr.initMethod=Or.initMethod}if(Or.destroyMethod){$i(`${" ".repeat(ki)}register destroyMethod = ${Or.destroyMethod}`);mr.destroyMethod=Or.destroyMethod}if(Or.scope){$i(`${" ".repeat(ki)}register scope = ${Or.scope}`);mr.scope=Or.scope}if(Or.allowDowngrade){$i(`${" ".repeat(ki)}register allowDowngrade = ${Or.allowDowngrade}`);mr.allowDowngrade=Or.allowDowngrade}this.objectCreateEventTarget.emit(yr.ObjectLifeCycleEvent.BEFORE_BIND,Dt,{context:this,definition:mr,replaceCallback:St=>{mr=St}});if(mr){this.registry.registerDefinition(mr.id,mr)}}bindModule(St,Dt){if(Wn.Types.isClass(St)){const rr=(0,cr.getProviderUUId)(St);if(rr){this.identifierMapping.saveClassRelation(St,Dt===null||Dt===void 0?void 0:Dt.namespace);this.bind(rr,St,Dt)}else{}}else{const rr=St[Sr.FUNCTION_INJECT_KEY];if(rr&&rr.id){if(!rr.scope){rr.scope=yr.ScopeEnum.Request}const cr=Gn.Utils.generateRandomId();this.identifierMapping.saveFunctionRelation(rr.id,cr);this.bind(cr,St,{scope:rr.scope,namespace:Dt.namespace,srcPath:Dt.srcPath,createFrom:Dt.createFrom})}}}setFileDetector(St){this.fileDetector=St}createChild(){return new MidwayContainer(this)}setAttr(St,Dt){this.attrMap.set(St,Dt)}getAttr(St){return this.attrMap.get(St)}getIdentifier(St){return(0,cr.getProviderUUId)(St)}getManagedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new Ir.ManagedResolverFactory(this)}return this._resolverFactory}async stop(){await this.getManagedResolverFactory().destroyCache();this.registry.clearAll()}ready(){return this.loadDefinitions()}get(St,Dt,rr){var cr;Dt=Dt!==null&&Dt!==void 0?Dt:[];rr=rr!==null&&rr!==void 0?rr:{originName:St};if(typeof St!=="string"){rr.originName=St.name;St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const pr=this.registry.getDefinition(St);if(!pr&&this.parent){return this.parent.get(St,Dt)}if(!pr){throw new Tn.MidwayDefinitionNotFoundError((cr=rr===null||rr===void 0?void 0:rr.originName)!==null&&cr!==void 0?cr:St)}return this.getManagedResolverFactory().create({definition:pr,args:Dt})}async getAsync(St,Dt,rr){var cr;Dt=Dt!==null&&Dt!==void 0?Dt:[];rr=rr!==null&&rr!==void 0?rr:{originName:St};if(typeof St!=="string"){rr.originName=St.name;St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const pr=this.registry.getDefinition(St);if(!pr&&this.parent){return this.parent.getAsync(St,Dt)}if(!pr){throw new Tn.MidwayDefinitionNotFoundError((cr=rr===null||rr===void 0?void 0:rr.originName)!==null&&cr!==void 0?cr:St)}return this.getManagedResolverFactory().createAsync({definition:pr,args:Dt})}registerObject(St,Dt){this.registry.registerObject(St,Dt)}onBeforeBind(St){this.objectCreateEventTarget.on(yr.ObjectLifeCycleEvent.BEFORE_BIND,St)}onBeforeObjectCreated(St){this.objectCreateEventTarget.on(yr.ObjectLifeCycleEvent.BEFORE_CREATED,St)}onObjectCreated(St){this.objectCreateEventTarget.on(yr.ObjectLifeCycleEvent.AFTER_CREATED,St)}onObjectInit(St){this.objectCreateEventTarget.on(yr.ObjectLifeCycleEvent.AFTER_INIT,St)}onBeforeObjectDestroy(St){this.objectCreateEventTarget.on(yr.ObjectLifeCycleEvent.BEFORE_DESTROY,St)}saveModule(St,Dt){if(!this.moduleMap.has(St)){this.moduleMap.set(St,new Set)}this.moduleMap.get(St).add(Dt)}listModule(St){return Array.from(this.moduleMap.get(St)||{})}transformModule(St){this.moduleMap=new Map(St)}hasNamespace(St){return this.namespaceSet.has(St)}getNamespaceList(){return Array.from(this.namespaceSet)}hasDefinition(St){return this.registry.hasDefinition(St)}hasObject(St){return this.registry.hasObject(St)}getInstanceScope(St){if(St[Sr.CONTAINER_OBJ_SCOPE]){return St[Sr.CONTAINER_OBJ_SCOPE]}return undefined}}Dt.MidwayContainer=MidwayContainer},20873:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ObjectDefinitionRegistry=void 0;const cr=rr(49757);const pr="_id_default_";class LegacyIdentifierRelation extends Map{saveClassRelation(St,Dt){const rr=(0,cr.getProviderUUId)(St);this.set(rr,rr);if(rr){const pr=(0,cr.getProviderId)(St);if(pr){this.set(pr,rr)}this.set((0,cr.getProviderName)(St),rr);if(Dt){this.set(Dt+":"+(0,cr.getProviderName)(St),rr)}}}saveFunctionRelation(St,Dt){this.set(Dt,Dt);this.set(St,Dt)}hasRelation(St){return this.has(St)}getRelation(St){return this.get(St)}}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(St){this._identifierRelation=St}get identifiers(){const St=[];for(const Dt of this.keys()){if(Dt.indexOf(pr)===-1){St.push(Dt)}}return St}get count(){return this.size}getSingletonDefinitionIds(){return this.singletonIds}getDefinitionByName(St){const Dt=[];for(const rr of this.values()){const cr=rr;if(cr.name===St){Dt.push(cr)}}return Dt}registerDefinition(St,Dt){if(Dt.isSingletonScope()){this.singletonIds.push(St)}this.set(St,Dt)}getDefinition(St){var Dt;St=(Dt=this.identifierRelation.getRelation(St))!==null&&Dt!==void 0?Dt:St;return this.get(St)}removeDefinition(St){this.delete(St)}hasDefinition(St){var Dt;St=(Dt=this.identifierRelation.getRelation(St))!==null&&Dt!==void 0?Dt:St;return this.has(St)}clearAll(){this.singletonIds=[];this.clear()}hasObject(St){var Dt;St=(Dt=this.identifierRelation.getRelation(St))!==null&&Dt!==void 0?Dt:St;return this.has(pr+St)}registerObject(St,Dt){this.set(pr+St,Dt)}getObject(St){var Dt;St=(Dt=this.identifierRelation.getRelation(St))!==null&&Dt!==void 0?Dt:St;return this.get(pr+St)}getIdentifierRelation(){return this.identifierRelation}setIdentifierRelation(St){this.identifierRelation=St}}Dt.ObjectDefinitionRegistry=ObjectDefinitionRegistry},80932:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ManagedResolverFactory=Dt.ManagedReference=void 0;const cr=rr(2222);const pr=rr(6192);const mr=rr(39023);const gr=rr(86314);const yr=mr.debuglog("midway:managedresolver");const Sr=mr.debuglog("midway:debug");class ManagedReference{constructor(){this.type=cr.KEYS.REF_ELEMENT}}Dt.ManagedReference=ManagedReference;class RefResolver{constructor(St){this.factory=St}get type(){return cr.KEYS.REF_ELEMENT}resolve(St,Dt){var rr;const cr=St;if(cr.injectMode===pr.InjectModeEnum.Class&&!((rr=this.factory.context.parent)!==null&&rr!==void 0?rr:this.factory.context).hasDefinition(cr.name)){if(Dt==="loggerService"){throw new gr.MidwayInconsistentVersionError}else{throw new gr.MidwayMissingImportComponentError(Dt)}}return this.factory.context.get(cr.name,cr.args,{originName:Dt})}async resolveAsync(St,Dt){var rr;const cr=St;if(cr.injectMode===pr.InjectModeEnum.Class&&!((rr=this.factory.context.parent)!==null&&rr!==void 0?rr:this.factory.context).hasDefinition(cr.name)){if(Dt==="loggerService"){throw new gr.MidwayInconsistentVersionError}else{throw new gr.MidwayMissingImportComponentError(Dt)}}return this.factory.context.getAsync(cr.name,cr.args,{originName:Dt})}}class ManagedResolverFactory{constructor(St){this.resolvers={};this.creating=new Map;this.singletonCache=new Map;this.context=St;this.resolvers={ref:new RefResolver(this)}}registerResolver(St){this.resolvers[St.type]=St}resolveManaged(St,Dt){const rr=this.resolvers[St.type];if(!rr||rr.type!==St.type){throw new gr.MidwayResolverMissingError(St.type)}return rr.resolve(St,Dt)}async resolveManagedAsync(St,Dt){const rr=this.resolvers[St.type];if(!rr||rr.type!==St.type){throw new gr.MidwayResolverMissingError(St.type)}return rr.resolveAsync(St,Dt)}create(St){const{definition:Dt,args:rr}=St;if(Dt.isSingletonScope()&&this.singletonCache.has(Dt.id)){return this.singletonCache.get(Dt.id)}let mr=this.createProxyReference(Dt);if(mr){return mr}this.compareAndSetCreateStatus(Dt);if(Dt.hasDependsOn()){for(const St of Dt.dependsOn){this.context.get(St,rr)}}Sr(`[core]: Create id = "${Dt.name}" ${Dt.id}.`);const yr=Dt.creator.load();let $r=[];if(rr&&Array.isArray(rr)&&rr.length>0){$r=rr}this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.BEFORE_CREATED,yr,{constructorArgs:$r,definition:Dt,context:this.context});mr=Dt.creator.doConstruct(yr,$r,this.context);if(Dt.isRequestScope()&&Dt.constructor.name==="ObjectDefinition"){Object.defineProperty(mr,cr.REQUEST_OBJ_CTX_KEY,{value:this.context.get(cr.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(Dt.properties){const St=Dt.properties.propertyKeys();for(const rr of St){this.checkSingletonInvokeRequest(Dt,rr);try{mr[rr]=this.resolveManaged(Dt.properties.get(rr),rr)}catch(St){if(gr.MidwayDefinitionNotFoundError.isClosePrototypeOf(St)){const rr=Dt.path.name;St.updateErrorMsg(rr)}this.removeCreateStatus(Dt,true);throw St}}}this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.AFTER_CREATED,mr,{context:this.context,definition:Dt,replaceCallback:St=>{mr=St}});Dt.creator.doInit(mr);this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.AFTER_INIT,mr,{context:this.context,definition:Dt});if(Dt.id){if(Dt.isSingletonScope()){this.singletonCache.set(Dt.id,mr);this.setInstanceScope(mr,pr.ScopeEnum.Singleton)}else if(Dt.isRequestScope()){this.context.registerObject(Dt.id,mr);this.setInstanceScope(mr,pr.ScopeEnum.Request)}else{this.setInstanceScope(mr,pr.ScopeEnum.Prototype)}}this.removeCreateStatus(Dt,true);return mr}async createAsync(St){const{definition:Dt,args:rr}=St;if(Dt.isSingletonScope()&&this.singletonCache.has(Dt.id)){yr(`id = ${Dt.id}(${Dt.name}) get from singleton cache.`);return this.singletonCache.get(Dt.id)}let mr=this.createProxyReference(Dt);if(mr){yr(`id = ${Dt.id}(${Dt.name}) from proxy reference.`);return mr}this.compareAndSetCreateStatus(Dt);if(Dt.hasDependsOn()){for(const St of Dt.dependsOn){yr("id = %s init depend %s.",Dt.id,St);await this.context.getAsync(St,rr)}}Sr(`[core]: Create id = "${Dt.name}" ${Dt.id}.`);const $r=Dt.creator.load();let Er=[];if(rr&&Array.isArray(rr)&&rr.length>0){Er=rr}this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.BEFORE_CREATED,$r,{constructorArgs:Er,context:this.context});mr=await Dt.creator.doConstructAsync($r,Er,this.context);if(!mr){this.removeCreateStatus(Dt,false);throw new gr.MidwayCommonError(`${Dt.id} construct return undefined`)}if(Dt.isRequestScope()&&Dt.constructor.name==="ObjectDefinition"){yr("id = %s inject ctx",Dt.id);Object.defineProperty(mr,cr.REQUEST_OBJ_CTX_KEY,{value:this.context.get(cr.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(Dt.properties){const St=Dt.properties.propertyKeys();for(const rr of St){this.checkSingletonInvokeRequest(Dt,rr);try{mr[rr]=await this.resolveManagedAsync(Dt.properties.get(rr),rr)}catch(St){if(gr.MidwayDefinitionNotFoundError.isClosePrototypeOf(St)){const rr=Dt.path.name;St.updateErrorMsg(rr)}this.removeCreateStatus(Dt,false);throw St}}}this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.AFTER_CREATED,mr,{context:this.context,definition:Dt,replaceCallback:St=>{mr=St}});await Dt.creator.doInitAsync(mr);this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.AFTER_INIT,mr,{context:this.context,definition:Dt});if(Dt.id){if(Dt.isSingletonScope()){yr(`id = ${Dt.id}(${Dt.name}) set to singleton cache`);this.singletonCache.set(Dt.id,mr);this.setInstanceScope(mr,pr.ScopeEnum.Singleton)}else if(Dt.isRequestScope()){yr(`id = ${Dt.id}(${Dt.name}) set to register object`);this.context.registerObject(Dt.id,mr);this.setInstanceScope(mr,pr.ScopeEnum.Request)}else{this.setInstanceScope(mr,pr.ScopeEnum.Prototype)}}this.removeCreateStatus(Dt,true);return mr}async destroyCache(){for(const St of this.singletonCache.keys()){const Dt=this.context.registry.getDefinition(St);if(Dt.creator){const rr=this.singletonCache.get(St);this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.BEFORE_DESTROY,rr,{context:this.context,definition:Dt});await Dt.creator.doDestroyAsync(rr)}}this.singletonCache.clear();this.creating.clear()}removeCreateStatus(St,Dt){if(this.creating.has(St.id)){this.creating.set(St.id,false)}return true}isCreating(St){return this.creating.has(St.id)&&this.creating.get(St.id)}compareAndSetCreateStatus(St){if(!this.creating.has(St.id)||!this.creating.get(St.id)){this.creating.set(St.id,true)}}createProxyReference(St){if(this.isCreating(St)){yr("create proxy for %s.",St.id);if(!this.depthFirstSearch(St.id,St)){yr("id = %s after dfs return null",St.id);return null}return new Proxy({__is_proxy__:true,__target_id__:St.id},{get:(Dt,rr)=>{let cr;if(St.isRequestScope()){cr=this.context.registry.getObject(St.id)}else if(St.isSingletonScope()){cr=this.singletonCache.get(St.id)}else{cr=this.context.get(St.id)}if(cr){if(typeof cr[rr]==="function"){return cr[rr].bind(cr)}return cr[rr]}return undefined}})}return null}depthFirstSearch(St,Dt,rr){var cr;if(Dt){yr("dfs for %s == %s start.",St,Dt.id);if(Dt.properties){const pr=Dt.properties.propertyKeys();if(pr.indexOf(St)>-1){yr("dfs exist in properties %s == %s.",St,Dt.id);return true}for(const mr of pr){if(!Array.isArray(rr)){rr=[St]}let pr=mr;const gr=Dt.properties.get(mr);if(gr&&gr.name){pr=(cr=this.context.identifierMapping.getRelation(gr.name))!==null&&cr!==void 0?cr:gr.name}if(pr===St){yr("dfs exist in properties key %s == %s.",St,Dt.id);return true}if(rr.indexOf(pr)>-1){yr("dfs depth circular %s == %s, %s, %j.",St,Dt.id,pr,rr);continue}else{rr.push(pr);yr("dfs depth push %s == %s, %j.",St,pr,rr)}let Sr=this.context.registry.getDefinition(pr);if(!Sr&&this.context.parent){Sr=this.context.parent.registry.getDefinition(pr)}if(this.depthFirstSearch(St,Sr,rr)){yr("dfs exist in sub tree %s == %s subId = %s.",St,Dt.id,Sr.id);return true}}}yr("dfs for %s == %s end.",St,Dt.id)}return false}getObjectEventTarget(){if(this.context.parent){return this.context.parent.objectCreateEventTarget}return this.context.objectCreateEventTarget}checkSingletonInvokeRequest(St,Dt){if(St.isSingletonScope()){const rr=St.properties.get(Dt);if(this.context.hasDefinition(rr===null||rr===void 0?void 0:rr.name)){const Dt=this.context.registry.getDefinition(rr.name);if(Dt.isRequestScope()&&!Dt.allowDowngrade){throw new gr.MidwaySingletonInjectRequestError(St.path.name,Dt.path.name)}}}return true}setInstanceScope(St,Dt){if(typeof St==="object"){if(Dt===pr.ScopeEnum.Request&&St[cr.REQUEST_OBJ_CTX_KEY]===cr.SINGLETON_CONTAINER_CTX){Dt=pr.ScopeEnum.Singleton}Object.defineProperty(St,cr.CONTAINER_OBJ_SCOPE,{value:Dt,writable:false,enumerable:false,configurable:false})}}}Dt.ManagedResolverFactory=ManagedResolverFactory},28695:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.providerWrapper=void 0;const cr=rr(2222);function providerWrapper(St){for(const Dt of St){Object.defineProperty(Dt.provider,cr.FUNCTION_INJECT_KEY,{value:Dt,writable:false})}}Dt.providerWrapper=providerWrapper},97983:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayRequestContainer=void 0;const cr=rr(9288);const pr=rr(49757);const mr=rr(2222);class MidwayRequestContainer extends cr.MidwayContainer{constructor(St,Dt){super(Dt);this.applicationContext=Dt;this.registry.setIdentifierRelation(this.applicationContext.registry.getIdentifierRelation());this.ctx=St;this.registerObject(mr.REQUEST_CTX_KEY,St);this.registerObject("res",{});if(St.logger){this.registerObject("logger",St.logger)}}init(){}get(St,Dt){if(typeof St!=="string"){St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const rr=this.applicationContext.registry.getDefinition(St);if(rr){if(rr.isRequestScope()||rr.id===pr.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().create({definition:rr,args:Dt})}}if(this.parent){return this.parent.get(St,Dt)}}async getAsync(St,Dt){if(typeof St!=="string"){St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const rr=this.applicationContext.registry.getDefinition(St);if(rr){if(rr.isRequestScope()||rr.id===pr.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().createAsync({definition:rr,args:Dt})}}if(this.parent){return this.parent.getAsync(St,Dt)}}async ready(){}getContext(){return this.ctx}}Dt.MidwayRequestContainer=MidwayRequestContainer},76271:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Aspect=void 0;const cr=rr(49757);const pr=rr(18025);const mr=rr(6192);function Aspect(St,Dt,rr){return function(gr){(0,cr.saveModule)(cr.ASPECT_KEY,gr);const yr=[].concat(St);for(const St of yr){(0,cr.attachClassMetadata)(cr.ASPECT_KEY,{aspectTarget:St,match:Dt,priority:rr},gr)}(0,pr.Scope)(mr.ScopeEnum.Singleton)(gr);(0,cr.Provide)()(gr)}}Dt.Aspect=Aspect},2940:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Autoload=void 0;const cr=rr(45317);const pr=rr(39990);function Autoload(){return function(St){(0,cr.savePreloadModule)(St);(0,pr.Provide)()(St)}}Dt.Autoload=Autoload},73821:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Configuration=void 0;const cr=rr(49757);function Configuration(St={}){return Dt=>{(0,cr.saveClassMetadata)(cr.CONFIGURATION_KEY,St,Dt)}}Dt.Configuration=Configuration},41573:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Match=Dt.Catch=void 0;const cr=rr(45317);const pr=rr(75105);const mr=rr(18025);const gr=rr(39990);const yr=rr(6192);function Catch(St,Dt={}){return function(rr){const Sr=St?[].concat(St):undefined;(0,cr.saveClassMetadata)(pr.CATCH_KEY,{catchTargets:Sr,catchOptions:Dt},rr);(0,mr.Scope)(yr.ScopeEnum.Singleton)(rr);(0,gr.Provide)()(rr)}}Dt.Catch=Catch;function Match(St=true){return function(Dt){(0,cr.saveClassMetadata)(pr.MATCH_KEY,{matchPattern:St},Dt);(0,mr.Scope)(yr.ScopeEnum.Singleton)(Dt);(0,gr.Provide)()(Dt)}}Dt.Match=Match},1623:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApplicationContext=Dt.Logger=Dt.App=Dt.Config=Dt.Plugin=Dt.Framework=void 0;const cr=rr(49757);const pr=rr(6192);function Framework(){return St=>{(0,cr.saveModule)(cr.FRAMEWORK_KEY,St);(0,cr.Scope)(pr.ScopeEnum.Singleton)(St);(0,cr.Provide)()(St)}}Dt.Framework=Framework;function Plugin(St){return(0,cr.createCustomPropertyDecorator)(cr.PLUGIN_KEY,{identifier:St})}Dt.Plugin=Plugin;function Config(St){return(0,cr.createCustomPropertyDecorator)(cr.CONFIG_KEY,{identifier:St})}Dt.Config=Config;function App(St){return(0,cr.createCustomPropertyDecorator)(cr.APPLICATION_KEY,{type:St})}Dt.App=App;function Logger(St){return(0,cr.createCustomPropertyDecorator)(cr.LOGGER_KEY,{identifier:St})}Dt.Logger=Logger;function ApplicationContext(){return(0,cr.createCustomPropertyDecorator)(cr.APPLICATION_CONTEXT_KEY,{})}Dt.ApplicationContext=ApplicationContext},41958:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Guard=Dt.UseGuard=void 0;const cr=rr(45317);const pr=rr(6192);const mr=rr(75105);const gr=rr(39990);const yr=rr(18025);function UseGuard(St){return(Dt,rr,pr)=>{if(!Array.isArray(St)){St=[St]}if(rr){(0,cr.savePropertyMetadata)(mr.GUARD_KEY,St,Dt,rr)}else{(0,cr.saveClassMetadata)(mr.GUARD_KEY,St,Dt)}}}Dt.UseGuard=UseGuard;function Guard(){return St=>{(0,gr.Provide)()(St);(0,yr.Scope)(pr.ScopeEnum.Singleton)(St)}}Dt.Guard=Guard},92922:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.InjectClient=Dt.Inject=void 0;const cr=rr(45317);const pr=rr(75105);function Inject(St){return function(Dt,rr){(0,cr.savePropertyInject)({target:Dt,targetKey:rr,identifier:St})}}Dt.Inject=Inject;function InjectClient(St,Dt){return(0,cr.createCustomPropertyDecorator)(pr.FACTORY_SERVICE_CLIENT_KEY,{serviceFactoryClz:St,clientName:Dt})}Dt.InjectClient=InjectClient},17511:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Middleware=void 0;const cr=rr(49757);const pr=rr(6192);function Middleware(){return St=>{(0,cr.Scope)(pr.ScopeEnum.Singleton)(St);(0,cr.Provide)()(St)}}Dt.Middleware=Middleware},56329:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Mock=void 0;const cr=rr(49757);const pr=rr(6192);function Mock(){return St=>{(0,cr.saveModule)(cr.MOCK_KEY,St);(0,cr.Scope)(pr.ScopeEnum.Singleton)(St);(0,cr.Provide)()(St)}}Dt.Mock=Mock},18025:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Singleton=Dt.Scope=Dt.Destroy=Dt.Init=void 0;const cr=rr(45317);const pr=rr(39990);const mr=rr(6192);function Init(){return function(St,Dt){(0,cr.saveObjectDefinition)(St,{initMethod:Dt})}}Dt.Init=Init;function Destroy(){return function(St,Dt){(0,cr.saveObjectDefinition)(St,{destroyMethod:Dt})}}Dt.Destroy=Destroy;function Scope(St,Dt){return function(rr){(0,cr.saveObjectDefinition)(rr,{scope:St,...Dt})}}Dt.Scope=Scope;function Singleton(){return function(St){Scope(mr.ScopeEnum.Singleton)(St);(0,pr.Provide)()(St)}}Dt.Singleton=Singleton},64331:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Pipe=void 0;const cr=rr(49757);const pr=rr(6192);function Pipe(){return St=>{(0,cr.Scope)(pr.ScopeEnum.Singleton)(St);(0,cr.Provide)()(St)}}Dt.Pipe=Pipe},52953:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Pipeline=void 0;const cr=rr(45317);const pr=rr(75105);function Pipeline(St){return(0,cr.createCustomPropertyDecorator)(pr.PIPELINE_IDENTIFIER,{valves:St})}Dt.Pipeline=Pipeline},39990:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Provide=void 0;const cr=rr(45317);function Provide(St){return function(Dt){return(0,cr.saveProviderId)(St,Dt)}}Dt.Provide=Provide},75105:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.TAGGED_CLS=Dt.INJECT_CUSTOM_PARAM=Dt.INJECT_CUSTOM_METHOD=Dt.INJECT_CUSTOM_PROPERTY=Dt.INJECT_TAG=Dt.NAMED_TAG=Dt.CLASS_KEY_CONSTRUCTOR=Dt.APPLICATION_CONTEXT_KEY=Dt.APPLICATION_KEY=Dt.LOGGER_KEY=Dt.PLUGIN_KEY=Dt.CONFIG_KEY=Dt.MS_HSF_METHOD_KEY=Dt.MS_DUBBO_METHOD_KEY=Dt.MS_GRPC_METHOD_KEY=Dt.MS_PROVIDER_KEY=Dt.MS_PRODUCER_KEY=Dt.MS_CONSUMER_KEY=Dt.RPC_DUBBO_KEY=Dt.RPC_GRPC_KEY=Dt.HSF_KEY=Dt.WS_EVENT_KEY=Dt.WS_CONTROLLER_KEY=Dt.MODULE_TASK_QUEUE_OPTIONS=Dt.MODULE_TASK_QUEUE_KEY=Dt.MODULE_TASK_TASK_LOCAL_OPTIONS=Dt.MODULE_TASK_TASK_LOCAL_KEY=Dt.MODULE_TASK_METADATA=Dt.MODULE_TASK_KEY=Dt.WEB_RESPONSE_RENDER=Dt.WEB_RESPONSE_CONTENT_TYPE=Dt.WEB_RESPONSE_HEADER=Dt.WEB_RESPONSE_REDIRECT=Dt.WEB_RESPONSE_HTTP_CODE=Dt.WEB_RESPONSE_KEY=Dt.WEB_ROUTER_PARAM_KEY=Dt.WEB_ROUTER_KEY=Dt.CONTROLLER_KEY=Dt.SERVERLESS_FUNC_KEY=Dt.FUNC_KEY=Dt.FACTORY_SERVICE_CLIENT_KEY=Dt.MOCK_KEY=Dt.GUARD_KEY=Dt.MATCH_KEY=Dt.CATCH_KEY=Dt.ASPECT_KEY=Dt.FRAMEWORK_KEY=Dt.CONFIGURATION_KEY=Dt.SCHEDULE_KEY=Dt.ALL=void 0;Dt.PRIVATE_META_DATA_KEY=Dt.MAIN_MODULE_KEY=Dt.LIFECYCLE_IDENTIFIER_PREFIX=Dt.PIPELINE_IDENTIFIER=Dt.OBJ_DEF_CLS=Dt.TAGGED_FUN=void 0;Dt.ALL="common:all_value_key";Dt.SCHEDULE_KEY="common:schedule";Dt.CONFIGURATION_KEY="common:configuration";Dt.FRAMEWORK_KEY="common:framework";Dt.ASPECT_KEY="common:aspect";Dt.CATCH_KEY="common:catch";Dt.MATCH_KEY="common:match";Dt.GUARD_KEY="common:guard";Dt.MOCK_KEY="common:mock";Dt.FACTORY_SERVICE_CLIENT_KEY="common:service_factory:client";Dt.FUNC_KEY="faas:func";Dt.SERVERLESS_FUNC_KEY="faas:serverless:function";Dt.CONTROLLER_KEY="web:controller";Dt.WEB_ROUTER_KEY="web:router";Dt.WEB_ROUTER_PARAM_KEY="web:router_param";Dt.WEB_RESPONSE_KEY="web:response";Dt.WEB_RESPONSE_HTTP_CODE="web:response_http_code";Dt.WEB_RESPONSE_REDIRECT="web:response_redirect";Dt.WEB_RESPONSE_HEADER="web:response_header";Dt.WEB_RESPONSE_CONTENT_TYPE="web:response_content_type";Dt.WEB_RESPONSE_RENDER="web:response_render";Dt.MODULE_TASK_KEY="task:task";Dt.MODULE_TASK_METADATA="task:task:options";Dt.MODULE_TASK_TASK_LOCAL_KEY="task:task:task_local";Dt.MODULE_TASK_TASK_LOCAL_OPTIONS="task:task:task_local:options";Dt.MODULE_TASK_QUEUE_KEY="task:task:queue";Dt.MODULE_TASK_QUEUE_OPTIONS="task:task:queue:options";Dt.WS_CONTROLLER_KEY="ws:controller";Dt.WS_EVENT_KEY="ws:event";Dt.HSF_KEY="rpc:hsf";Dt.RPC_GRPC_KEY="rpc:grpc";Dt.RPC_DUBBO_KEY="rpc:dubbo";Dt.MS_CONSUMER_KEY="ms:consumer";Dt.MS_PRODUCER_KEY="ms:producer";Dt.MS_PROVIDER_KEY="ms:provider";Dt.MS_GRPC_METHOD_KEY="ms:grpc:method";Dt.MS_DUBBO_METHOD_KEY="ms:dubbo:method";Dt.MS_HSF_METHOD_KEY="ms:hsf:method";Dt.CONFIG_KEY="config";Dt.PLUGIN_KEY="plugin";Dt.LOGGER_KEY="logger";Dt.APPLICATION_KEY="__midway_framework_app__";Dt.APPLICATION_CONTEXT_KEY="__midway_application_context__";Dt.CLASS_KEY_CONSTRUCTOR="midway:class_key_constructor";Dt.NAMED_TAG="named";Dt.INJECT_TAG="inject";Dt.INJECT_CUSTOM_PROPERTY="inject_custom_property";Dt.INJECT_CUSTOM_METHOD="inject_custom_method";Dt.INJECT_CUSTOM_PARAM="inject_custom_param";Dt.TAGGED_CLS="injection:tagged_class";Dt.TAGGED_FUN="injection:tagged_function";Dt.OBJ_DEF_CLS="injection:object_definition_class";Dt.PIPELINE_IDENTIFIER="__pipeline_identifier__";Dt.LIFECYCLE_IDENTIFIER_PREFIX="__lifecycle__";Dt.MAIN_MODULE_KEY="__main__";Dt.PRIVATE_META_DATA_KEY="__midway_private_meta_data__"},45317:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.createCustomParamDecorator=Dt.createCustomMethodDecorator=Dt.createCustomPropertyDecorator=Dt.getMethodReturnTypes=Dt.getPropertyType=Dt.getMethodParamTypes=Dt.BaseType=Dt.isProvide=Dt.getProviderUUId=Dt.getProviderName=Dt.getProviderId=Dt.saveProviderId=Dt.getObjectDefinition=Dt.saveObjectDefinition=Dt.getPropertyInject=Dt.savePropertyInject=Dt.transformTypeFromTSDesign=Dt.clearAllModule=Dt.resetModule=Dt.listModule=Dt.clearBindContainer=Dt.bindContainer=Dt.saveModule=Dt.listPreloadModule=Dt.savePreloadModule=Dt.getPropertyMetadata=Dt.attachPropertyMetadata=Dt.savePropertyMetadata=Dt.listPropertyDataFromClass=Dt.getPropertyDataFromClass=Dt.attachPropertyDataToClass=Dt.savePropertyDataToClass=Dt.getClassMetadata=Dt.getClassExtendedMetadata=Dt.attachClassMetadata=Dt.saveClassMetadata=Dt.DecoratorManager=Dt.INJECT_CLASS_KEY_PREFIX=Dt.PRELOAD_MODULE_KEY=void 0;rr(37159);const cr=rr(6192);const pr=rr(75105);const mr=rr(63289);const gr=rr(90406);const yr=rr(65308);const Sr=rr(61327);const $r=rr(39023).debuglog("midway:core");Dt.PRELOAD_MODULE_KEY="INJECTION_PRELOAD_MODULE_KEY";Dt.INJECT_CLASS_KEY_PREFIX="INJECTION_CLASS_META_DATA";class DecoratorManager extends Map{constructor(){super(...arguments);this.injectClassKeyPrefix=Dt.INJECT_CLASS_KEY_PREFIX;this.injectClassMethodKeyPrefix="INJECTION_CLASS_METHOD_META_DATA";this.injectMethodKeyPrefix="INJECTION_METHOD_META_DATA"}saveModule(St,Dt){if(this.container){return this.container.saveModule(St,Dt)}if(!this.has(St)){this.set(St,new Set)}this.get(St).add(Dt)}listModule(St){if(this.container){return this.container.listModule(St)}return Array.from(this.get(St)||{})}resetModule(St){this.set(St,new Set)}bindContainer(St){this.container=St;this.container.transformModule(this)}static getDecoratorClassKey(St){return St.toString()+"_CLS"}static removeDecoratorClassKeySuffix(St){return St.toString().replace("_CLS","")}static getDecoratorMethodKey(St){return St.toString()+"_METHOD"}static getDecoratorClsExtendedKey(St){return St.toString()+"_EXT"}static getDecoratorClsMethodPrefix(St){return St.toString()+"_CLS_METHOD"}static getDecoratorClsMethodKey(St,Dt){return DecoratorManager.getDecoratorClsMethodPrefix(St)+":"+Dt.toString()}static getDecoratorMethod(St,Dt){return DecoratorManager.getDecoratorMethodKey(St)+"_"+Dt.toString()}static saveMetadata(St,Dt,rr,cr){if(typeof Dt==="object"&&Dt.constructor){Dt=Dt.constructor}let pr;if(Reflect.hasOwnMetadata(St,Dt)){pr=Reflect.getMetadata(St,Dt)}else{pr=new Map}pr.set(rr,cr);Reflect.defineMetadata(St,pr,Dt)}static attachMetadata(St,Dt,rr,cr,pr,mr="one"){if(typeof Dt==="object"&&Dt.constructor){Dt=Dt.constructor}let gr;if(Reflect.hasOwnMetadata(St,Dt)){gr=Reflect.getMetadata(St,Dt)}else{gr=new Map}if(!gr.has(rr)){if(pr){gr.set(rr,{})}else{gr.set(rr,[])}}if(pr){if(mr==="one"){gr.get(rr)[pr]=cr}else{if(gr.get(rr)[pr]){gr.get(rr)[pr].push(cr)}else{gr.get(rr)[pr]=[cr]}}}else{gr.get(rr).push(cr)}Reflect.defineMetadata(St,gr,Dt)}static getMetadata(St,Dt,rr){if(typeof Dt==="object"&&Dt.constructor){Dt=Dt.constructor}let cr;if(!Reflect.hasOwnMetadata(St,Dt)){cr=new Map;Reflect.defineMetadata(St,cr,Dt)}else{cr=Reflect.getMetadata(St,Dt)}if(!rr){return cr}return cr.get(rr)}saveMetadata(St,Dt,rr,cr){if(cr){const pr=DecoratorManager.getDecoratorMethod(St,cr);DecoratorManager.saveMetadata(this.injectMethodKeyPrefix,rr,pr,Dt)}else{const cr=DecoratorManager.getDecoratorClassKey(St);DecoratorManager.saveMetadata(this.injectClassKeyPrefix,rr,cr,Dt)}}attachMetadata(St,Dt,rr,cr,pr,mr){if(cr){const gr=DecoratorManager.getDecoratorMethod(St,cr);DecoratorManager.attachMetadata(this.injectMethodKeyPrefix,rr,gr,Dt,pr,mr)}else{const cr=DecoratorManager.getDecoratorClassKey(St);DecoratorManager.attachMetadata(this.injectClassKeyPrefix,rr,cr,Dt,pr,mr)}}getMetadata(St,Dt,rr){if(rr){const cr=DecoratorManager.getDecoratorMethod(St,rr);return DecoratorManager.getMetadata(this.injectMethodKeyPrefix,Dt,cr)}else{const rr=`${DecoratorManager.getDecoratorClassKey(St)}`;return DecoratorManager.getMetadata(this.injectClassKeyPrefix,Dt,rr)}}savePropertyDataToClass(St,Dt,rr,cr){const pr=DecoratorManager.getDecoratorClsMethodKey(St,cr);DecoratorManager.saveMetadata(this.injectClassMethodKeyPrefix,rr,pr,Dt)}attachPropertyDataToClass(St,Dt,rr,cr,pr){const mr=DecoratorManager.getDecoratorClsMethodKey(St,cr);DecoratorManager.attachMetadata(this.injectClassMethodKeyPrefix,rr,mr,Dt,pr)}getPropertyDataFromClass(St,Dt,rr){const cr=DecoratorManager.getDecoratorClsMethodKey(St,rr);return DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,Dt,cr)}listPropertyDataFromClass(St,Dt){const rr=DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,Dt);const cr=[];for(const[Dt,pr]of rr){if(Dt.indexOf(DecoratorManager.getDecoratorClsMethodPrefix(St))!==-1){cr.push(pr)}}return cr}}Dt.DecoratorManager=DecoratorManager;let Er=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 St=(0,Sr.getModuleRequirePathList)("@midwayjs/core");if(St.length){console.info("The module may be located in:");St.forEach(((St,Dt)=>{console.info(`${Dt+1}. ${St}`)}))}Er=global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]}else{global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]=Er}}function saveClassMetadata(St,Dt,rr,cr){if(cr&&typeof Dt==="object"){const cr=Er.getMetadata(St,rr);if(!cr){return Er.saveMetadata(St,Dt,rr)}if(Array.isArray(cr)){return Er.saveMetadata(St,cr.concat(Dt),rr)}else{return Er.saveMetadata(St,Object.assign(cr,Dt),rr)}}else{return Er.saveMetadata(St,Dt,rr)}}Dt.saveClassMetadata=saveClassMetadata;function attachClassMetadata(St,Dt,rr,cr,pr){return Er.attachMetadata(St,Dt,rr,undefined,cr,pr)}Dt.attachClassMetadata=attachClassMetadata;function getClassExtendedMetadata(St,Dt,rr,cr){if(cr===undefined){cr=true}const pr=DecoratorManager.getDecoratorClsExtendedKey(St);let mr=Er.getMetadata(pr,Dt,rr);if(cr&&mr!==undefined){return mr}const gr=Reflect.getPrototypeOf(Dt);if(gr&&gr.constructor!==Object){mr=(0,yr.merge)(getClassExtendedMetadata(St,gr,rr,cr),Er.getMetadata(St,Dt,rr))}Er.saveMetadata(pr,mr||null,Dt,rr);return mr}Dt.getClassExtendedMetadata=getClassExtendedMetadata;function getClassMetadata(St,Dt){return Er.getMetadata(St,Dt)}Dt.getClassMetadata=getClassMetadata;function savePropertyDataToClass(St,Dt,rr,cr){return Er.savePropertyDataToClass(St,Dt,rr,cr)}Dt.savePropertyDataToClass=savePropertyDataToClass;function attachPropertyDataToClass(St,Dt,rr,cr,pr){return Er.attachPropertyDataToClass(St,Dt,rr,cr,pr)}Dt.attachPropertyDataToClass=attachPropertyDataToClass;function getPropertyDataFromClass(St,Dt,rr){return Er.getPropertyDataFromClass(St,Dt,rr)}Dt.getPropertyDataFromClass=getPropertyDataFromClass;function listPropertyDataFromClass(St,Dt){return Er.listPropertyDataFromClass(St,Dt)}Dt.listPropertyDataFromClass=listPropertyDataFromClass;function savePropertyMetadata(St,Dt,rr,cr){return Er.saveMetadata(St,Dt,rr,cr)}Dt.savePropertyMetadata=savePropertyMetadata;function attachPropertyMetadata(St,Dt,rr,cr){return Er.attachMetadata(St,Dt,rr,cr)}Dt.attachPropertyMetadata=attachPropertyMetadata;function getPropertyMetadata(St,Dt,rr){return Er.getMetadata(St,Dt,rr)}Dt.getPropertyMetadata=getPropertyMetadata;function savePreloadModule(St){return saveModule(Dt.PRELOAD_MODULE_KEY,St)}Dt.savePreloadModule=savePreloadModule;function listPreloadModule(){return listModule(Dt.PRELOAD_MODULE_KEY)}Dt.listPreloadModule=listPreloadModule;function saveModule(St,Dt){if((0,mr.isClass)(Dt)){saveProviderId(undefined,Dt)}return Er.saveModule(St,Dt)}Dt.saveModule=saveModule;function bindContainer(St){return Er.bindContainer(St)}Dt.bindContainer=bindContainer;function clearBindContainer(){return Er.container=null}Dt.clearBindContainer=clearBindContainer;function listModule(St,Dt){const rr=Er.listModule(St);if(Dt){return rr.filter(Dt)}else{return rr}}Dt.listModule=listModule;function resetModule(St){return Er.resetModule(St)}Dt.resetModule=resetModule;function clearAllModule(){$r("--- clear all module here ---");return Er.clear()}Dt.clearAllModule=clearAllModule;function transformTypeFromTSDesign(St){if((0,mr.isNullOrUndefined)(St)){return{name:"undefined",isBaseType:true,originDesign:St}}switch(St.name){case"String":return{name:"string",isBaseType:true,originDesign:St};case"Number":return{name:"number",isBaseType:true,originDesign:St};case"Boolean":return{name:"boolean",isBaseType:true,originDesign:St};case"Symbol":return{name:"symbol",isBaseType:true,originDesign:St};case"Object":return{name:"object",isBaseType:true,originDesign:St};case"Function":return{name:"function",isBaseType:true,originDesign:St};default:return{name:St.name,isBaseType:false,originDesign:St}}}Dt.transformTypeFromTSDesign=transformTypeFromTSDesign;function savePropertyInject(St){let Dt=St.identifier;let rr=cr.InjectModeEnum.Identifier;if(!Dt){const pr=getPropertyType(St.target,St.targetKey);if(!pr.isBaseType&&(0,mr.isClass)(pr.originDesign)&&isProvide(pr.originDesign)){Dt=getProviderUUId(pr.originDesign);rr=cr.InjectModeEnum.Class}if(!Dt){Dt=St.targetKey;rr=cr.InjectModeEnum.PropertyName}}attachClassMetadata(pr.INJECT_TAG,{targetKey:St.targetKey,value:Dt,args:St.args,injectMode:rr},St.target,St.targetKey)}Dt.savePropertyInject=savePropertyInject;function getPropertyInject(St,Dt){return getClassExtendedMetadata(pr.INJECT_TAG,St,undefined,Dt)}Dt.getPropertyInject=getPropertyInject;function saveObjectDefinition(St,Dt={}){saveClassMetadata(pr.OBJ_DEF_CLS,Dt,St,true);return St}Dt.saveObjectDefinition=saveObjectDefinition;function getObjectDefinition(St){return getClassExtendedMetadata(pr.OBJ_DEF_CLS,St)}Dt.getObjectDefinition=getObjectDefinition;function saveProviderId(St,Dt){if(isProvide(Dt)){if(St){const rr=getClassMetadata(pr.TAGGED_CLS,Dt);if(rr.id!==St){rr.id=St;saveClassMetadata(pr.TAGGED_CLS,rr,Dt);$r(`update provide: ${Dt.name} -> ${rr.uuid}`)}}}else{const rr=(0,yr.generateRandomId)();saveClassMetadata(pr.TAGGED_CLS,{id:St,originName:Dt.name,uuid:rr,name:(0,gr.camelCase)(Dt.name)},Dt);$r(`save provide: ${Dt.name} -> ${rr}`)}return Dt}Dt.saveProviderId=saveProviderId;function getProviderId(St){const Dt=getClassMetadata(pr.TAGGED_CLS,St);if(Dt&&Dt.id){return Dt.id}}Dt.getProviderId=getProviderId;function getProviderName(St){const Dt=getClassMetadata(pr.TAGGED_CLS,St);if(Dt&&Dt.name){return Dt.name}}Dt.getProviderName=getProviderName;function getProviderUUId(St){const Dt=getClassMetadata(pr.TAGGED_CLS,St);if(Dt&&Dt.uuid){return Dt.uuid}}Dt.getProviderUUId=getProviderUUId;function isProvide(St){return!!getClassMetadata(pr.TAGGED_CLS,St)}Dt.isProvide=isProvide;var Ir;(function(St){St["Boolean"]="boolean";St["Number"]="number";St["String"]="string"})(Ir=Dt.BaseType||(Dt.BaseType={}));function getMethodParamTypes(St,Dt){if((0,mr.isClass)(St)){St=St.prototype}return Reflect.getMetadata("design:paramtypes",St,Dt)}Dt.getMethodParamTypes=getMethodParamTypes;function getPropertyType(St,Dt){return transformTypeFromTSDesign(Reflect.getMetadata("design:type",St,Dt))}Dt.getPropertyType=getPropertyType;function getMethodReturnTypes(St,Dt){if((0,mr.isClass)(St)){St=St.prototype}return Reflect.getMetadata("design:returntype",St,Dt)}Dt.getMethodReturnTypes=getMethodReturnTypes;function createCustomPropertyDecorator(St,Dt,rr=true){return function(cr,mr){attachClassMetadata(pr.INJECT_CUSTOM_PROPERTY,{propertyName:mr,key:St,metadata:Dt,impl:rr},cr,mr)}}Dt.createCustomPropertyDecorator=createCustomPropertyDecorator;function createCustomMethodDecorator(St,Dt,rr={impl:true}){if(typeof rr==="boolean"){rr={impl:rr}}if(rr.impl===undefined){rr.impl=true}return function(cr,mr,gr){attachClassMetadata(pr.INJECT_CUSTOM_METHOD,{propertyName:mr,key:St,metadata:Dt,options:rr},cr)}}Dt.createCustomMethodDecorator=createCustomMethodDecorator;function createCustomParamDecorator(St,Dt,rr={impl:true}){if(typeof rr==="boolean"){rr={impl:rr}}if(rr.impl===undefined){rr.impl=true}return function(cr,mr,gr){attachClassMetadata(pr.INJECT_CUSTOM_PARAM,{key:St,parameterIndex:gr,propertyName:mr,metadata:Dt,options:rr},cr,mr,"multi")}}Dt.createCustomParamDecorator=createCustomParamDecorator},69193:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ServerlessTrigger=Dt.ServerlessFunction=void 0;const cr=rr(49757);const pr=rr(6192);function ServerlessFunction(St){return(Dt,rr,pr)=>{(0,cr.savePropertyMetadata)(cr.SERVERLESS_FUNC_KEY,St,Dt,rr)}}Dt.ServerlessFunction=ServerlessFunction;function ServerlessTrigger(St,Dt={}){return(rr,mr,gr)=>{var yr;if(St===pr.ServerlessTriggerType.HTTP||St===pr.ServerlessTriggerType.API_GATEWAY){Dt["method"]=(yr=Dt["method"])!==null&&yr!==void 0?yr:"get"}(0,cr.saveModule)(cr.FUNC_KEY,rr.constructor);Dt=Dt||{};(0,cr.attachClassMetadata)(cr.FUNC_KEY,{type:St,methodName:mr,metadata:Dt},rr)}}Dt.ServerlessTrigger=ServerlessTrigger},49757:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});pr(rr(39990),Dt);pr(rr(92922),Dt);pr(rr(52953),Dt);pr(rr(76271),Dt);pr(rr(2940),Dt);pr(rr(73821),Dt);pr(rr(18025),Dt);pr(rr(1623),Dt);pr(rr(41573),Dt);pr(rr(17511),Dt);pr(rr(41958),Dt);pr(rr(64331),Dt);pr(rr(56329),Dt);pr(rr(69193),Dt);pr(rr(86690),Dt);pr(rr(58843),Dt);pr(rr(29619),Dt);pr(rr(92233),Dt);pr(rr(75105),Dt);pr(rr(45317),Dt);pr(rr(573),Dt);pr(rr(4132),Dt);pr(rr(76543),Dt);pr(rr(64767),Dt);pr(rr(41684),Dt);pr(rr(17640),Dt);pr(rr(81970),Dt);pr(rr(52963),Dt);pr(rr(57706),Dt);pr(rr(67999),Dt);pr(rr(20551),Dt)},573:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Consumer=void 0;const cr=rr(49757);const pr=rr(6192);function Consumer(St,Dt={}){return rr=>{(0,cr.saveModule)(cr.MS_CONSUMER_KEY,rr);(0,cr.saveClassMetadata)(cr.MS_CONSUMER_KEY,{type:St,metadata:Dt},rr);(0,cr.Scope)(pr.ScopeEnum.Request)(rr);(0,cr.Provide)()(rr)}}Dt.Consumer=Consumer},64767:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.KafkaListener=void 0;const cr=rr(49757);function KafkaListener(St,Dt={}){return(rr,pr)=>{Dt.topic=St;Dt.propertyKey=pr;(0,cr.attachPropertyDataToClass)(cr.MS_CONSUMER_KEY,Dt,rr,pr)}}Dt.KafkaListener=KafkaListener},4132:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.DubboMethod=Dt.GrpcMethod=Dt.GrpcStreamTypeEnum=Dt.Provider=void 0;const cr=rr(49757);const pr=rr(6192);function Provider(St,Dt={}){return rr=>{(0,cr.saveModule)(cr.MS_PROVIDER_KEY,rr);(0,cr.saveClassMetadata)(cr.MS_PROVIDER_KEY,{type:St,metadata:Dt},rr);(0,cr.Scope)(pr.ScopeEnum.Request)(rr);(0,cr.Provide)()(rr)}}Dt.Provider=Provider;var mr;(function(St){St["BASE"]="base";St["DUPLEX"]="ServerDuplexStream";St["READABLE"]="ServerReadableStream";St["WRITEABLE"]="ServerWritableStream"})(mr=Dt.GrpcStreamTypeEnum||(Dt.GrpcStreamTypeEnum={}));function GrpcMethod(St={}){return(Dt,rr,pr)=>{if(!St.type){St.type=mr.BASE}(0,cr.savePropertyMetadata)(cr.MS_GRPC_METHOD_KEY,{methodName:St.methodName||rr,type:St.type,onEnd:St.onEnd},Dt,rr);return pr}}Dt.GrpcMethod=GrpcMethod;function DubboMethod(St){return(Dt,rr,pr)=>{(0,cr.attachClassMetadata)(cr.MS_DUBBO_METHOD_KEY,{methodName:St||rr},Dt);return pr}}Dt.DubboMethod=DubboMethod},76543:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.RabbitMQListener=void 0;const cr=rr(49757);function RabbitMQListener(St,Dt={}){return(rr,pr)=>{Dt.queueName=St;Dt.propertyKey=pr;(0,cr.attachPropertyDataToClass)(cr.MS_CONSUMER_KEY,Dt,rr,pr)}}Dt.RabbitMQListener=RabbitMQListener},41684:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.HSF=void 0;const cr=rr(49757);const pr=rr(6192);function HSF(St={}){return Dt=>{(0,cr.saveModule)(cr.HSF_KEY,Dt);(0,cr.saveClassMetadata)(cr.HSF_KEY,St,Dt);(0,cr.Scope)(pr.ScopeEnum.Request)(Dt);(0,cr.Provide)()(Dt)}}Dt.HSF=HSF},17640:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Queue=void 0;const cr=rr(49757);const pr=rr(75105);function Queue(St){return function(Dt){(0,cr.saveModule)(pr.MODULE_TASK_QUEUE_KEY,Dt);(0,cr.saveClassMetadata)(pr.MODULE_TASK_QUEUE_OPTIONS,{options:St,name:Dt.name},Dt);(0,cr.Provide)()(Dt)}}Dt.Queue=Queue},57706:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Schedule=void 0;const cr=rr(49757);const pr=rr(6192);function Schedule(St){return function(Dt){(0,cr.saveModule)(cr.SCHEDULE_KEY,Dt);(0,cr.saveClassMetadata)(cr.SCHEDULE_KEY,St,Dt);(0,cr.Scope)(pr.ScopeEnum.Request)(Dt);(0,cr.Provide)()(Dt)}}Dt.Schedule=Schedule},81970:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Task=void 0;const cr=rr(49757);const pr=rr(75105);function Task(St){return function(Dt,rr,mr){(0,cr.saveModule)(pr.MODULE_TASK_KEY,Dt.constructor);(0,cr.attachClassMetadata)(pr.MODULE_TASK_METADATA,{options:St,propertyKey:rr,value:mr.value,name:Dt.constructor.name},Dt)}}Dt.Task=Task},52963:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.TaskLocal=void 0;const cr=rr(49757);const pr=rr(75105);function TaskLocal(St){return function(Dt,rr,mr){(0,cr.saveModule)(pr.MODULE_TASK_TASK_LOCAL_KEY,Dt.constructor);(0,cr.attachClassMetadata)(pr.MODULE_TASK_TASK_LOCAL_OPTIONS,{options:St,propertyKey:rr,value:mr.value},Dt)}}Dt.TaskLocal=TaskLocal},86690:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Controller=void 0;const cr=rr(49757);const pr=rr(6192);function Controller(St="/",Dt={middleware:[],sensitive:true}){return rr=>{(0,cr.saveModule)(cr.CONTROLLER_KEY,rr);if(St)(0,cr.saveClassMetadata)(cr.CONTROLLER_KEY,{prefix:St,routerOptions:Dt},rr);(0,cr.Scope)(pr.ScopeEnum.Request)(rr);(0,cr.Provide)()(rr)}}Dt.Controller=Controller},58843:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Fields=Dt.Queries=Dt.RequestIP=Dt.RequestPath=Dt.Files=Dt.File=Dt.Headers=Dt.Param=Dt.Query=Dt.Body=Dt.Session=Dt.createRequestParamDecorator=Dt.RouteParamTypes=void 0;const cr=rr(49757);var pr;(function(St){St["QUERY"]="query";St["BODY"]="body";St["PARAM"]="param";St["HEADERS"]="headers";St["SESSION"]="session";St["FILESTREAM"]="file_stream";St["FILESSTREAM"]="files_stream";St["NEXT"]="next";St["REQUEST_PATH"]="request_path";St["REQUEST_IP"]="request_ip";St["QUERIES"]="queries";St["FIELDS"]="fields";St["CUSTOM"]="custom"})(pr=Dt.RouteParamTypes||(Dt.RouteParamTypes={}));const createParamMapping=function(St){return(Dt,rr={})=>{let pr=Dt;if(Array.isArray(Dt)&&rr.pipes===undefined){rr.pipes=Dt;pr=undefined}return(0,cr.createCustomParamDecorator)(cr.WEB_ROUTER_PARAM_KEY,{type:St,propertyData:pr},rr)}};const createRequestParamDecorator=function(St,Dt){Dt=Dt||{};if(Array.isArray(Dt)){Dt={pipes:Dt}}return createParamMapping(pr.CUSTOM)(St,Dt)};Dt.createRequestParamDecorator=createRequestParamDecorator;const Session=(St,Dt)=>createParamMapping(pr.SESSION)(St,{pipes:Dt});Dt.Session=Session;const Body=(St,Dt)=>createParamMapping(pr.BODY)(St,{pipes:Dt});Dt.Body=Body;const Query=(St,Dt)=>createParamMapping(pr.QUERY)(St,{pipes:Dt});Dt.Query=Query;const Param=(St,Dt)=>createParamMapping(pr.PARAM)(St,{pipes:Dt});Dt.Param=Param;const Headers=(St,Dt)=>createParamMapping(pr.HEADERS)(St,{pipes:Dt});Dt.Headers=Headers;const File=(St,Dt)=>createParamMapping(pr.FILESTREAM)(St,{pipes:Dt});Dt.File=File;const Files=(St,Dt)=>createParamMapping(pr.FILESSTREAM)(St,{pipes:Dt});Dt.Files=Files;const RequestPath=St=>createParamMapping(pr.REQUEST_PATH)(undefined,{pipes:St});Dt.RequestPath=RequestPath;const RequestIP=St=>createParamMapping(pr.REQUEST_IP)(undefined,{pipes:St});Dt.RequestIP=RequestIP;const Queries=(St,Dt)=>createParamMapping(pr.QUERIES)(St,{pipes:Dt});Dt.Queries=Queries;const Fields=(St,Dt)=>createParamMapping(pr.FIELDS)(St,{pipes:Dt});Dt.Fields=Fields},29619:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.All=Dt.Head=Dt.Options=Dt.Patch=Dt.Put=Dt.Del=Dt.Get=Dt.Post=Dt.RequestMapping=Dt.RequestMethod=void 0;const cr=rr(49757);Dt.RequestMethod={GET:"get",POST:"post",PUT:"put",DELETE:"delete",PATCH:"patch",ALL:"all",OPTIONS:"options",HEAD:"head"};const pr={path:"/",requestMethod:Dt.RequestMethod.GET,routerName:null,middleware:[]};const RequestMapping=(St=pr)=>{const rr=St.path||"/";const mr=St.requestMethod||Dt.RequestMethod.GET;const gr=St.routerName;const yr=St.middleware;return(Dt,pr,Sr)=>{var $r;(0,cr.attachClassMetadata)(cr.WEB_ROUTER_KEY,{path:rr,requestMethod:mr,routerName:gr,method:pr,middleware:yr,summary:(St===null||St===void 0?void 0:St.summary)||"",description:(St===null||St===void 0?void 0:St.description)||"",ignoreGlobalPrefix:($r=St===null||St===void 0?void 0:St.ignoreGlobalPrefix)!==null&&$r!==void 0?$r:false},Dt);return Sr}};Dt.RequestMapping=RequestMapping;const createMappingDecorator=St=>(rr,cr={middleware:[]})=>(0,Dt.RequestMapping)(Object.assign(cr,{requestMethod:St,path:rr}));Dt.Post=createMappingDecorator(Dt.RequestMethod.POST);Dt.Get=createMappingDecorator(Dt.RequestMethod.GET);Dt.Del=createMappingDecorator(Dt.RequestMethod.DELETE);Dt.Put=createMappingDecorator(Dt.RequestMethod.PUT);Dt.Patch=createMappingDecorator(Dt.RequestMethod.PATCH);Dt.Options=createMappingDecorator(Dt.RequestMethod.OPTIONS);Dt.Head=createMappingDecorator(Dt.RequestMethod.HEAD);Dt.All=createMappingDecorator(Dt.RequestMethod.ALL)},92233:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.createRender=Dt.ContentType=Dt.SetHeader=Dt.HttpCode=Dt.Redirect=void 0;const cr=rr(49757);function Redirect(St,Dt=302){return(rr,pr,mr)=>{(0,cr.attachPropertyMetadata)(cr.WEB_RESPONSE_KEY,{type:cr.WEB_RESPONSE_REDIRECT,url:St,code:Dt},rr,pr);return mr}}Dt.Redirect=Redirect;function HttpCode(St){return(Dt,rr,pr)=>{(0,cr.attachPropertyMetadata)(cr.WEB_RESPONSE_KEY,{type:cr.WEB_RESPONSE_HTTP_CODE,code:St},Dt,rr);return pr}}Dt.HttpCode=HttpCode;function SetHeader(St,Dt){return(rr,pr,mr)=>{let gr={};if(Dt){gr[St]=Dt}else{gr=St}(0,cr.attachPropertyMetadata)(cr.WEB_RESPONSE_KEY,{type:cr.WEB_RESPONSE_HEADER,setHeaders:gr},rr,pr);return mr}}Dt.SetHeader=SetHeader;function ContentType(St){return(Dt,rr,pr)=>{(0,cr.attachPropertyMetadata)(cr.WEB_RESPONSE_KEY,{type:cr.WEB_RESPONSE_CONTENT_TYPE,contentType:St},Dt,rr);return pr}}Dt.ContentType=ContentType;function createRender(St){return St=>(Dt,rr,pr)=>{(0,cr.attachPropertyMetadata)(cr.WEB_RESPONSE_KEY,{type:cr.WEB_RESPONSE_RENDER,templateName:St},Dt,rr);return pr}}Dt.createRender=createRender},67999:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.WSController=void 0;const cr=rr(49757);const pr=rr(6192);function WSController(St="/",Dt={middleware:[],connectionMiddleware:[]}){return rr=>{(0,cr.saveModule)(cr.WS_CONTROLLER_KEY,rr);(0,cr.saveClassMetadata)(cr.WS_CONTROLLER_KEY,{namespace:St,routerOptions:Dt},rr);(0,cr.Scope)(pr.ScopeEnum.Request)(rr);(0,cr.Provide)()(rr)}}Dt.WSController=WSController},20551:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.OnConnection=Dt.OnDisConnection=Dt.Emit=Dt.OnMessage=Dt.WSBroadCast=Dt.WSEmit=Dt.OnWSMessage=Dt.OnWSDisConnection=Dt.OnWSConnection=Dt.WSEventTypeEnum=void 0;const cr=rr(49757);var pr;(function(St){St["ON_CONNECTION"]="ws:onConnection";St["ON_DISCONNECTION"]="ws:onDisconnection";St["ON_MESSAGE"]="ws:onMessage";St["ON_SOCKET_ERROR"]="ws:onSocketError";St["EMIT"]="ws:Emit";St["BROADCAST"]="ws:broadcast"})(pr=Dt.WSEventTypeEnum||(Dt.WSEventTypeEnum={}));function OnWSConnection(St={}){return(Dt,rr,mr)=>{(0,cr.attachClassMetadata)(cr.WS_EVENT_KEY,{eventType:pr.ON_CONNECTION,propertyName:rr,eventOptions:St,descriptor:mr},Dt.constructor)}}Dt.OnWSConnection=OnWSConnection;function OnWSDisConnection(){return(St,Dt,rr)=>{(0,cr.attachClassMetadata)(cr.WS_EVENT_KEY,{eventType:pr.ON_DISCONNECTION,propertyName:Dt,descriptor:rr},St.constructor)}}Dt.OnWSDisConnection=OnWSDisConnection;function OnWSMessage(St,Dt={}){return(rr,mr,gr)=>{(0,cr.attachClassMetadata)(cr.WS_EVENT_KEY,{eventType:pr.ON_MESSAGE,messageEventName:St,propertyName:mr,eventOptions:Dt,descriptor:gr},rr.constructor)}}Dt.OnWSMessage=OnWSMessage;function WSEmit(St,Dt=[]){return(rr,mr,gr)=>{(0,cr.attachClassMetadata)(cr.WS_EVENT_KEY,{eventType:pr.EMIT,propertyName:mr,messageEventName:St,roomName:[].concat(Dt),descriptor:gr},rr.constructor)}}Dt.WSEmit=WSEmit;function WSBroadCast(St="",Dt=[]){return(rr,mr,gr)=>{(0,cr.attachClassMetadata)(cr.WS_EVENT_KEY,{eventType:pr.BROADCAST,propertyName:mr,messageEventName:St,roomName:[].concat(Dt),descriptor:gr},rr.constructor)}}Dt.WSBroadCast=WSBroadCast;Dt.OnMessage=OnWSMessage;Dt.Emit=WSEmit;Dt.OnDisConnection=OnWSDisConnection;Dt.OnConnection=OnWSConnection},34881:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.FunctionDefinition=void 0;const cr=rr(6192);const pr=rr(59327);class FunctionWrapperCreator extends pr.ObjectCreator{doConstruct(St,Dt,rr){if(!St){return null}return St(rr,Dt)}async doConstructAsync(St,Dt,rr){if(!St){return null}return St(rr,Dt)}}class FunctionDefinition{constructor(){this.constructorArgs=[];this.namespace="";this.asynchronous=true;this.handlerProps=[];this.allowDowngrade=false;this.innerAutowire=false;this.innerScope=cr.ScopeEnum.Singleton;this.creator=new FunctionWrapperCreator(this)}getAttr(St){}hasAttr(St){return false}hasConstructorArgs(){return false}hasDependsOn(){return false}isAsync(){return this.asynchronous}isDirect(){return false}isExternal(){return false}set scope(St){this.innerScope=St}isSingletonScope(){return this.innerScope===cr.ScopeEnum.Singleton}isRequestScope(){return this.innerScope===cr.ScopeEnum.Request}setAttr(St,Dt){}}Dt.FunctionDefinition=FunctionDefinition},59327:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ObjectCreator=void 0;const cr=rr(86314);const pr=rr(63289);class ObjectCreator{constructor(St){this.definition=St}load(){let St=null;if(typeof this.definition.path==="string"){if(!this.definition.path){return St}const Dt=this.definition.path;if(this.definition.export){St=require(Dt)[this.definition.export]}else{St=require(Dt)}}else{St=this.definition.path}return St}doConstruct(St,Dt){if(!St){return Object.create(null)}let rr;if(this.definition.constructMethod){rr=St[this.definition.constructMethod].apply(St,Dt)}else{rr=Reflect.construct(St,Dt)}return rr}async doConstructAsync(St,Dt){if(!St){return Object.create(null)}let rr;if(this.definition.constructMethod){const cr=St[this.definition.constructMethod];if(pr.Types.isAsyncFunction(cr)){rr=await cr.apply(St,Dt)}else{rr=cr.apply(St,Dt)}}else{rr=Reflect.construct(St,Dt)}return rr}doInit(St){const Dt=St;if(this.definition.initMethod&&Dt[this.definition.initMethod]){if(pr.Types.isGeneratorFunction(Dt[this.definition.initMethod])||pr.Types.isAsyncFunction(Dt[this.definition.initMethod])){throw new cr.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}else{const St=Dt[this.definition.initMethod].call(Dt);if(pr.Types.isPromise(St)){throw new cr.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}}}}async doInitAsync(St){const Dt=St;if(this.definition.initMethod&&Dt[this.definition.initMethod]){const St=Dt[this.definition.initMethod];if(pr.Types.isAsyncFunction(St)){await St.call(Dt)}else{if(St.length===1){await new Promise((rr=>{St.call(Dt,rr)}))}else{St.call(Dt)}}}}doDestroy(St){if(this.definition.destroyMethod&&St[this.definition.destroyMethod]){St[this.definition.destroyMethod].call(St)}}async doDestroyAsync(St){if(this.definition.destroyMethod&&St[this.definition.destroyMethod]){const Dt=St[this.definition.destroyMethod];if(pr.Types.isAsyncFunction(Dt)){await Dt.call(St)}else{if(Dt.length===1){await new Promise((rr=>{Dt.call(St,rr)}))}else{Dt.call(St)}}}}}Dt.ObjectCreator=ObjectCreator},47698:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ObjectDefinition=void 0;const cr=rr(6192);const pr=rr(74701);const mr=rr(59327);class ObjectDefinition{constructor(){this._attrs=new Map;this._asynchronous=false;this.scope=cr.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 pr.ObjectProperties;this.namespace="";this.handlerProps=[];this.allowDowngrade=false;this.creator=new mr.ObjectCreator(this)}set asynchronous(St){this._asynchronous=St}isAsync(){return this._asynchronous}isSingletonScope(){return this.scope===cr.ScopeEnum.Singleton}isRequestScope(){return this.scope===cr.ScopeEnum.Request}hasDependsOn(){return this.dependsOn.length>0}hasConstructorArgs(){return this.constructorArgs.length>0}getAttr(St){return this._attrs.get(St)}hasAttr(St){return this._attrs.has(St)}setAttr(St,Dt){this._attrs.set(St,Dt)}}Dt.ObjectDefinition=ObjectDefinition},74701:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ObjectProperties=void 0;class ObjectProperties extends Map{propertyKeys(){return Array.from(this.keys())}getProperty(St,Dt){if(this.has(St)){return this.get(St)}return Dt}setProperty(St,Dt){return this.set(St,Dt)}}Dt.ObjectProperties=ObjectProperties},21769:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayHttpError=Dt.MidwayError=Dt.registerErrorCode=void 0;const cr=rr(58611);const pr=new Set;function registerErrorCode(St,Dt){if(pr.has(St)){throw new MidwayError(`Error group ${St} is duplicated, please check before adding.`)}else{pr.add(St)}const rr={};for(const cr in Dt){rr[cr]=St.toUpperCase()+"_"+String(Dt[cr]).toUpperCase()}return rr}Dt.registerErrorCode=registerErrorCode;class MidwayError extends Error{constructor(St,Dt,rr){super(St);if(!Dt||typeof Dt==="object"){rr=Dt;Dt="MIDWAY_10000"}this.name=this.constructor.name;this.code=Dt;this.cause=rr===null||rr===void 0?void 0:rr.cause}}Dt.MidwayError=MidwayError;class MidwayHttpError extends MidwayError{constructor(St,Dt,rr,pr){super(St?typeof St==="string"?St:St.message:cr.STATUS_CODES[Dt],rr!==null&&rr!==void 0?rr:String(Dt),pr);if(St&&St["stack"]){this.stack=St["stack"]}this.status=Dt}}Dt.MidwayHttpError=MidwayHttpError},37198:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayEmptyValueError=Dt.MidwayInvalidConfigPropertyError=Dt.MidwayMainFrameworkMissingError=Dt.MidwayCodeInvokeTimeoutError=Dt.MidwayInvokeForbiddenError=Dt.MidwayRetryExceededMaxTimesError=Dt.MidwayDuplicateControllerOptionsError=Dt.MidwayDuplicateClassNameError=Dt.MidwayInconsistentVersionError=Dt.MidwayUtilHttpClientTimeoutError=Dt.MidwayMissingImportComponentError=Dt.MidwaySingletonInjectRequestError=Dt.MidwayUseWrongMethodError=Dt.MidwayDuplicateRouteError=Dt.MidwayResolverMissingError=Dt.MidwayInvalidConfigError=Dt.MidwayConfigMissingError=Dt.MidwayFeatureNotImplementedError=Dt.MidwayFeatureNoLongerSupportedError=Dt.MidwayDefinitionNotFoundError=Dt.MidwayParameterError=Dt.MidwayCommonError=Dt.FrameworkErrorEnum=void 0;const cr=rr(21769);Dt.FrameworkErrorEnum=(0,cr.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 cr.MidwayError{constructor(St){super(St,Dt.FrameworkErrorEnum.COMMON)}}Dt.MidwayCommonError=MidwayCommonError;class MidwayParameterError extends cr.MidwayError{constructor(St){super(St!==null&&St!==void 0?St:"Parameter type not match",Dt.FrameworkErrorEnum.PARAM_TYPE)}}Dt.MidwayParameterError=MidwayParameterError;class MidwayDefinitionNotFoundError extends cr.MidwayError{static isClosePrototypeOf(St){return St?St[MidwayDefinitionNotFoundError.type]===MidwayDefinitionNotFoundError.type:false}constructor(St){super(`${St} is not valid in current context`,Dt.FrameworkErrorEnum.DEFINITION_NOT_FOUND);this[MidwayDefinitionNotFoundError.type]=MidwayDefinitionNotFoundError.type}updateErrorMsg(St){const Dt=this.message.split(" is not valid in current context")[0];this.message=`${Dt} in class ${St} is not valid in current context`}}Dt.MidwayDefinitionNotFoundError=MidwayDefinitionNotFoundError;MidwayDefinitionNotFoundError.type=Symbol.for("#NotFoundError");class MidwayFeatureNoLongerSupportedError extends cr.MidwayError{constructor(St){super("This feature no longer supported \n"+St,Dt.FrameworkErrorEnum.FEATURE_NO_LONGER_SUPPORTED)}}Dt.MidwayFeatureNoLongerSupportedError=MidwayFeatureNoLongerSupportedError;class MidwayFeatureNotImplementedError extends cr.MidwayError{constructor(St){super("This feature not implemented \n"+St,Dt.FrameworkErrorEnum.FEATURE_NOT_IMPLEMENTED)}}Dt.MidwayFeatureNotImplementedError=MidwayFeatureNotImplementedError;class MidwayConfigMissingError extends cr.MidwayError{constructor(St){super(`Can't found config key "${St}" in your config, please set it first`,Dt.FrameworkErrorEnum.MISSING_CONFIG)}}Dt.MidwayConfigMissingError=MidwayConfigMissingError;class MidwayInvalidConfigError extends cr.MidwayError{constructor(St){super("Invalid config file \n"+St,Dt.FrameworkErrorEnum.INVALID_CONFIG)}}Dt.MidwayInvalidConfigError=MidwayInvalidConfigError;class MidwayResolverMissingError extends cr.MidwayError{constructor(St){super(`Resolver "${St}" is missing.`,Dt.FrameworkErrorEnum.MISSING_RESOLVER)}}Dt.MidwayResolverMissingError=MidwayResolverMissingError;class MidwayDuplicateRouteError extends cr.MidwayError{constructor(St,rr,cr){super(`Duplicate router "${St}" at "${rr}" and "${cr}"`,Dt.FrameworkErrorEnum.DUPLICATE_ROUTER)}}Dt.MidwayDuplicateRouteError=MidwayDuplicateRouteError;class MidwayUseWrongMethodError extends cr.MidwayError{constructor(St,rr,cr){const pr=cr?`${cr} not valid by ${St}, Use ${rr} instead!`:`You should not invoked by ${St}, Use ${rr} instead!`;super(pr,Dt.FrameworkErrorEnum.USE_WRONG_METHOD)}}Dt.MidwayUseWrongMethodError=MidwayUseWrongMethodError;class MidwaySingletonInjectRequestError extends cr.MidwayError{constructor(St,rr){const cr=`${St} with singleton scope can't implicitly inject ${rr} with request scope directly, please add "@Scope(ScopeEnum.Request, { allowDowngrade: true })" in ${rr} or use "ctx.requestContext.getAsync(${rr})".`;super(cr,Dt.FrameworkErrorEnum.SINGLETON_INJECT_REQUEST)}}Dt.MidwaySingletonInjectRequestError=MidwaySingletonInjectRequestError;class MidwayMissingImportComponentError extends cr.MidwayError{constructor(St){const rr=`"${St}" can't inject and maybe forgot add "{imports: [***]}" in @Configuration.`;super(rr,Dt.FrameworkErrorEnum.MISSING_IMPORTS)}}Dt.MidwayMissingImportComponentError=MidwayMissingImportComponentError;class MidwayUtilHttpClientTimeoutError extends cr.MidwayError{constructor(St){super(St,Dt.FrameworkErrorEnum.UTIL_HTTP_TIMEOUT)}}Dt.MidwayUtilHttpClientTimeoutError=MidwayUtilHttpClientTimeoutError;class MidwayInconsistentVersionError extends cr.MidwayError{constructor(){const St='We find a latest dependency package installed, please remove the lock file and use "npm update" to upgrade all dependencies first.';super(St,Dt.FrameworkErrorEnum.INCONSISTENT_VERSION)}}Dt.MidwayInconsistentVersionError=MidwayInconsistentVersionError;class MidwayDuplicateClassNameError extends cr.MidwayError{constructor(St,rr,cr){super(`"${St}" duplicated between "${rr}" and "${cr}"`,Dt.FrameworkErrorEnum.DUPLICATE_CLASS_NAME)}}Dt.MidwayDuplicateClassNameError=MidwayDuplicateClassNameError;class MidwayDuplicateControllerOptionsError extends cr.MidwayError{constructor(St,rr,cr){super(`"Prefix ${St}" with duplicated controller options between "${rr}" and "${cr}"`,Dt.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS)}}Dt.MidwayDuplicateControllerOptionsError=MidwayDuplicateControllerOptionsError;class MidwayRetryExceededMaxTimesError extends cr.MidwayError{constructor(St,rr,cr){super(`Invoke "${St}" retries exceeded the maximum number of times(${rr}), error: ${cr.message}`,Dt.FrameworkErrorEnum.RETRY_OVER_MAX_TIME,{cause:cr})}}Dt.MidwayRetryExceededMaxTimesError=MidwayRetryExceededMaxTimesError;class MidwayInvokeForbiddenError extends cr.MidwayError{constructor(St,rr){super(`Invoke "${rr?rr.name:"unknown"}.${St}" is forbidden.`,Dt.FrameworkErrorEnum.INVOKE_METHOD_FORBIDDEN)}}Dt.MidwayInvokeForbiddenError=MidwayInvokeForbiddenError;class MidwayCodeInvokeTimeoutError extends cr.MidwayError{constructor(St,rr){super(`Invoke "${St}" running timeout(${rr}ms)`,Dt.FrameworkErrorEnum.CODE_INVOKE_TIMEOUT)}}Dt.MidwayCodeInvokeTimeoutError=MidwayCodeInvokeTimeoutError;class MidwayMainFrameworkMissingError extends cr.MidwayError{constructor(){super("Main framework missing, please check your configuration.",Dt.FrameworkErrorEnum.MAIN_FRAMEWORK_MISSING)}}Dt.MidwayMainFrameworkMissingError=MidwayMainFrameworkMissingError;class MidwayInvalidConfigPropertyError extends cr.MidwayError{constructor(St,rr){super(`Invalid config property "${St}", ${rr?`only ${rr.join(",")} can be set`:"please check your configuration"}.`,Dt.FrameworkErrorEnum.INVALID_CONFIG_PROPERTY)}}Dt.MidwayInvalidConfigPropertyError=MidwayInvalidConfigPropertyError;class MidwayEmptyValueError extends cr.MidwayError{constructor(St){super(St!==null&&St!==void 0?St:"There is an empty value got and it is not allowed.",Dt.FrameworkErrorEnum.EMPTY_VALUE)}}Dt.MidwayEmptyValueError=MidwayEmptyValueError},9504:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.httpError=Dt.GatewayTimeoutError=Dt.ServiceUnavailableError=Dt.BadGatewayError=Dt.NotImplementedError=Dt.InternalServerErrorError=Dt.TooManyRequestsError=Dt.UnprocessableEntityError=Dt.UnsupportedMediaTypeError=Dt.PayloadTooLargeError=Dt.GoneError=Dt.ConflictError=Dt.RequestTimeoutError=Dt.NotAcceptableError=Dt.ForbiddenError=Dt.NotFoundError=Dt.UnauthorizedError=Dt.BadRequestError=Dt.HttpStatus=void 0;const cr=rr(21769);var pr;(function(St){St[St["CONTINUE"]=100]="CONTINUE";St[St["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";St[St["PROCESSING"]=102]="PROCESSING";St[St["EARLYHINTS"]=103]="EARLYHINTS";St[St["OK"]=200]="OK";St[St["CREATED"]=201]="CREATED";St[St["ACCEPTED"]=202]="ACCEPTED";St[St["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";St[St["NO_CONTENT"]=204]="NO_CONTENT";St[St["RESET_CONTENT"]=205]="RESET_CONTENT";St[St["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";St[St["AMBIGUOUS"]=300]="AMBIGUOUS";St[St["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";St[St["FOUND"]=302]="FOUND";St[St["SEE_OTHER"]=303]="SEE_OTHER";St[St["NOT_MODIFIED"]=304]="NOT_MODIFIED";St[St["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";St[St["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";St[St["BAD_REQUEST"]=400]="BAD_REQUEST";St[St["UNAUTHORIZED"]=401]="UNAUTHORIZED";St[St["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";St[St["FORBIDDEN"]=403]="FORBIDDEN";St[St["NOT_FOUND"]=404]="NOT_FOUND";St[St["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";St[St["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";St[St["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";St[St["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";St[St["CONFLICT"]=409]="CONFLICT";St[St["GONE"]=410]="GONE";St[St["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";St[St["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";St[St["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";St[St["URI_TOO_LONG"]=414]="URI_TOO_LONG";St[St["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";St[St["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";St[St["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";St[St["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";St[St["MISDIRECTED"]=421]="MISDIRECTED";St[St["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";St[St["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";St[St["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";St[St["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";St[St["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";St[St["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";St[St["BAD_GATEWAY"]=502]="BAD_GATEWAY";St[St["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";St[St["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";St[St["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(pr=Dt.HttpStatus||(Dt.HttpStatus={}));class BadRequestError extends cr.MidwayHttpError{constructor(St){super(St,pr.BAD_REQUEST)}}Dt.BadRequestError=BadRequestError;class UnauthorizedError extends cr.MidwayHttpError{constructor(St){super(St,pr.UNAUTHORIZED)}}Dt.UnauthorizedError=UnauthorizedError;class NotFoundError extends cr.MidwayHttpError{constructor(St){super(St,pr.NOT_FOUND)}}Dt.NotFoundError=NotFoundError;class ForbiddenError extends cr.MidwayHttpError{constructor(St){super(St,pr.FORBIDDEN)}}Dt.ForbiddenError=ForbiddenError;class NotAcceptableError extends cr.MidwayHttpError{constructor(St){super(St,pr.NOT_ACCEPTABLE)}}Dt.NotAcceptableError=NotAcceptableError;class RequestTimeoutError extends cr.MidwayHttpError{constructor(St){super(St,pr.REQUEST_TIMEOUT)}}Dt.RequestTimeoutError=RequestTimeoutError;class ConflictError extends cr.MidwayHttpError{constructor(St){super(St,pr.CONFLICT)}}Dt.ConflictError=ConflictError;class GoneError extends cr.MidwayHttpError{constructor(St){super(St,pr.GONE)}}Dt.GoneError=GoneError;class PayloadTooLargeError extends cr.MidwayHttpError{constructor(St){super(St,pr.PAYLOAD_TOO_LARGE)}}Dt.PayloadTooLargeError=PayloadTooLargeError;class UnsupportedMediaTypeError extends cr.MidwayHttpError{constructor(St){super(St,pr.UNSUPPORTED_MEDIA_TYPE)}}Dt.UnsupportedMediaTypeError=UnsupportedMediaTypeError;class UnprocessableEntityError extends cr.MidwayHttpError{constructor(St){super(St,pr.UNPROCESSABLE_ENTITY)}}Dt.UnprocessableEntityError=UnprocessableEntityError;class TooManyRequestsError extends cr.MidwayHttpError{constructor(St){super(St,pr.TOO_MANY_REQUESTS)}}Dt.TooManyRequestsError=TooManyRequestsError;class InternalServerErrorError extends cr.MidwayHttpError{constructor(St){super(St,pr.INTERNAL_SERVER_ERROR)}}Dt.InternalServerErrorError=InternalServerErrorError;class NotImplementedError extends cr.MidwayHttpError{constructor(St){super(St,pr.NOT_IMPLEMENTED)}}Dt.NotImplementedError=NotImplementedError;class BadGatewayError extends cr.MidwayHttpError{constructor(St){super(St,pr.BAD_GATEWAY)}}Dt.BadGatewayError=BadGatewayError;class ServiceUnavailableError extends cr.MidwayHttpError{constructor(St){super(St,pr.SERVICE_UNAVAILABLE)}}Dt.ServiceUnavailableError=ServiceUnavailableError;class GatewayTimeoutError extends cr.MidwayHttpError{constructor(St){super(St,pr.GATEWAY_TIMEOUT)}}Dt.GatewayTimeoutError=GatewayTimeoutError;Dt.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}},86314:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.httpError=Dt.HttpStatus=void 0;pr(rr(21769),Dt);var mr=rr(9504);Object.defineProperty(Dt,"HttpStatus",{enumerable:true,get:function(){return mr.HttpStatus}});Object.defineProperty(Dt,"httpError",{enumerable:true,get:function(){return mr.httpError}});pr(rr(37198),Dt)},24451:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.createConfiguration=Dt.FunctionalConfiguration=void 0;class FunctionalConfiguration{constructor(St){this.options=St;this.readyHandler=()=>{};this.stopHandler=()=>{};this.configLoadHandler=()=>{};this.serverReadyHandler=()=>{}}onConfigLoad(St,Dt){if(typeof St==="function"){this.configLoadHandler=St}else{return this.configLoadHandler(St,Dt)}return this}onReady(St,Dt){if(typeof St==="function"){this.readyHandler=St}else{return this.readyHandler(St,Dt)}return this}onServerReady(St,Dt){if(typeof St==="function"){this.serverReadyHandler=St}else{return this.serverReadyHandler(St,Dt)}return this}onStop(St,Dt){if(typeof St==="function"){this.stopHandler=St}else{return this.stopHandler(St,Dt)}return this}getConfigurationOptions(){return this.options}}Dt.FunctionalConfiguration=FunctionalConfiguration;const createConfiguration=St=>new FunctionalConfiguration(St);Dt.createConfiguration=createConfiguration},46123:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayPerformanceManager=Dt.TypedResourceManager=Dt.HttpServerResponse=Dt.ServerResponse=Dt.FORMAT=Dt.FileUtils=Dt.PathFileUtil=Dt.Types=Dt.retryWith=Dt.retryWithAsync=Dt.extend=Dt.Utils=Dt.sleep=Dt.isTypeScriptEnvironment=Dt.wrapAsync=Dt.wrapMiddleware=Dt.pathMatching=Dt.transformRequestObjectByType=Dt.deprecatedOutput=Dt.delegateTargetAllPrototypeMethod=Dt.delegateTargetProperties=Dt.delegateTargetMethod=Dt.delegateTargetPrototypeMethod=Dt.loadModule=Dt.safeRequire=Dt.safelyGet=Dt.ASYNC_ROOT_CONTEXT=Dt.MidwayPriorityManager=Dt.DEFAULT_PRIORITY=Dt.DataSourceManager=Dt.WebRouterCollector=Dt.MidwayServerlessFunctionService=Dt.MidwayWebRouterService=Dt.MidwayHealthService=Dt.MidwayMockService=Dt.MidwayDecoratorService=Dt.MidwayMiddlewareService=Dt.MidwayLifeCycleService=Dt.MidwayAspectService=Dt.MidwayFrameworkService=Dt.MidwayLoggerService=Dt.MidwayInformationService=Dt.MidwayEnvironmentService=Dt.MidwayConfigService=Dt.FunctionalConfiguration=Dt.createConfiguration=Dt.BaseFramework=Dt.MidwayRequestContainer=void 0;pr(rr(6192),Dt);pr(rr(9288),Dt);var mr=rr(97983);Object.defineProperty(Dt,"MidwayRequestContainer",{enumerable:true,get:function(){return mr.MidwayRequestContainer}});var gr=rr(83872);Object.defineProperty(Dt,"BaseFramework",{enumerable:true,get:function(){return gr.BaseFramework}});pr(rr(28695),Dt);pr(rr(2222),Dt);var yr=rr(24451);Object.defineProperty(Dt,"createConfiguration",{enumerable:true,get:function(){return yr.createConfiguration}});Object.defineProperty(Dt,"FunctionalConfiguration",{enumerable:true,get:function(){return yr.FunctionalConfiguration}});var Sr=rr(78842);Object.defineProperty(Dt,"MidwayConfigService",{enumerable:true,get:function(){return Sr.MidwayConfigService}});var $r=rr(70275);Object.defineProperty(Dt,"MidwayEnvironmentService",{enumerable:true,get:function(){return $r.MidwayEnvironmentService}});var Er=rr(37482);Object.defineProperty(Dt,"MidwayInformationService",{enumerable:true,get:function(){return Er.MidwayInformationService}});var Ir=rr(34888);Object.defineProperty(Dt,"MidwayLoggerService",{enumerable:true,get:function(){return Ir.MidwayLoggerService}});var Or=rr(33332);Object.defineProperty(Dt,"MidwayFrameworkService",{enumerable:true,get:function(){return Or.MidwayFrameworkService}});var Hr=rr(70812);Object.defineProperty(Dt,"MidwayAspectService",{enumerable:true,get:function(){return Hr.MidwayAspectService}});var Gr=rr(13328);Object.defineProperty(Dt,"MidwayLifeCycleService",{enumerable:true,get:function(){return Gr.MidwayLifeCycleService}});var Tn=rr(68220);Object.defineProperty(Dt,"MidwayMiddlewareService",{enumerable:true,get:function(){return Tn.MidwayMiddlewareService}});var Wn=rr(96367);Object.defineProperty(Dt,"MidwayDecoratorService",{enumerable:true,get:function(){return Wn.MidwayDecoratorService}});var Gn=rr(77306);Object.defineProperty(Dt,"MidwayMockService",{enumerable:true,get:function(){return Gn.MidwayMockService}});var mi=rr(658);Object.defineProperty(Dt,"MidwayHealthService",{enumerable:true,get:function(){return mi.MidwayHealthService}});var $i=rr(19985);Object.defineProperty(Dt,"MidwayWebRouterService",{enumerable:true,get:function(){return $i.MidwayWebRouterService}});var ki=rr(42592);Object.defineProperty(Dt,"MidwayServerlessFunctionService",{enumerable:true,get:function(){return ki.MidwayServerlessFunctionService}});Object.defineProperty(Dt,"WebRouterCollector",{enumerable:true,get:function(){return ki.WebRouterCollector}});var Ni=rr(12849);Object.defineProperty(Dt,"DataSourceManager",{enumerable:true,get:function(){return Ni.DataSourceManager}});var Ri=rr(67934);Object.defineProperty(Dt,"DEFAULT_PRIORITY",{enumerable:true,get:function(){return Ri.DEFAULT_PRIORITY}});Object.defineProperty(Dt,"MidwayPriorityManager",{enumerable:true,get:function(){return Ri.MidwayPriorityManager}});pr(rr(28602),Dt);pr(rr(82535),Dt);pr(rr(64842),Dt);pr(rr(46673),Dt);pr(rr(1845),Dt);pr(rr(11026),Dt);pr(rr(12738),Dt);pr(rr(39408),Dt);pr(rr(43436),Dt);pr(rr(29222),Dt);pr(rr(86314),Dt);var Vi=rr(75351);Object.defineProperty(Dt,"ASYNC_ROOT_CONTEXT",{enumerable:true,get:function(){return Vi.ASYNC_ROOT_CONTEXT}});pr(rr(49757),Dt);pr(rr(45317),Dt);pr(rr(75105),Dt);var ji=rr(65308);Object.defineProperty(Dt,"safelyGet",{enumerable:true,get:function(){return ji.safelyGet}});Object.defineProperty(Dt,"safeRequire",{enumerable:true,get:function(){return ji.safeRequire}});Object.defineProperty(Dt,"loadModule",{enumerable:true,get:function(){return ji.loadModule}});Object.defineProperty(Dt,"delegateTargetPrototypeMethod",{enumerable:true,get:function(){return ji.delegateTargetPrototypeMethod}});Object.defineProperty(Dt,"delegateTargetMethod",{enumerable:true,get:function(){return ji.delegateTargetMethod}});Object.defineProperty(Dt,"delegateTargetProperties",{enumerable:true,get:function(){return ji.delegateTargetProperties}});Object.defineProperty(Dt,"delegateTargetAllPrototypeMethod",{enumerable:true,get:function(){return ji.delegateTargetAllPrototypeMethod}});Object.defineProperty(Dt,"deprecatedOutput",{enumerable:true,get:function(){return ji.deprecatedOutput}});Object.defineProperty(Dt,"transformRequestObjectByType",{enumerable:true,get:function(){return ji.transformRequestObjectByType}});Object.defineProperty(Dt,"pathMatching",{enumerable:true,get:function(){return ji.pathMatching}});Object.defineProperty(Dt,"wrapMiddleware",{enumerable:true,get:function(){return ji.wrapMiddleware}});Object.defineProperty(Dt,"wrapAsync",{enumerable:true,get:function(){return ji.wrapAsync}});Object.defineProperty(Dt,"isTypeScriptEnvironment",{enumerable:true,get:function(){return ji.isTypeScriptEnvironment}});Object.defineProperty(Dt,"sleep",{enumerable:true,get:function(){return ji.sleep}});Object.defineProperty(Dt,"Utils",{enumerable:true,get:function(){return ji.Utils}});var Ui=rr(83486);Object.defineProperty(Dt,"extend",{enumerable:true,get:function(){return Ui.extend}});pr(rr(46422),Dt);pr(rr(50539),Dt);pr(rr(73861),Dt);pr(rr(87653),Dt);var zi=rr(25198);Object.defineProperty(Dt,"retryWithAsync",{enumerable:true,get:function(){return zi.retryWithAsync}});Object.defineProperty(Dt,"retryWith",{enumerable:true,get:function(){return zi.retryWith}});var Ki=rr(63289);Object.defineProperty(Dt,"Types",{enumerable:true,get:function(){return Ki.Types}});var Xi=rr(61327);Object.defineProperty(Dt,"PathFileUtil",{enumerable:true,get:function(){return Xi.PathFileUtil}});var Yi=rr(7589);Object.defineProperty(Dt,"FileUtils",{enumerable:true,get:function(){return Yi.FileUtils}});var xa=rr(30001);Object.defineProperty(Dt,"FORMAT",{enumerable:true,get:function(){return xa.FORMAT}});var Ta=rr(89995);Object.defineProperty(Dt,"ServerResponse",{enumerable:true,get:function(){return Ta.ServerResponse}});Object.defineProperty(Dt,"HttpServerResponse",{enumerable:true,get:function(){return Ta.HttpServerResponse}});var wa=rr(11330);Object.defineProperty(Dt,"TypedResourceManager",{enumerable:true,get:function(){return wa.TypedResourceManager}});var Ia=rr(70032);Object.defineProperty(Dt,"MidwayPerformanceManager",{enumerable:true,get:function(){return Ia.MidwayPerformanceManager}})},6192:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayProcessTypeEnum=Dt.ObjectLifeCycleEvent=Dt.ServerlessTriggerType=Dt.MidwayFrameworkType=Dt.FrameworkType=Dt.MSListenerType=Dt.MSProviderType=Dt.InjectModeEnum=Dt.ScopeEnum=void 0;var rr;(function(St){St["Singleton"]="Singleton";St["Request"]="Request";St["Prototype"]="Prototype"})(rr=Dt.ScopeEnum||(Dt.ScopeEnum={}));var cr;(function(St){St["Identifier"]="Identifier";St["Class"]="Class";St["PropertyName"]="PropertyName"})(cr=Dt.InjectModeEnum||(Dt.InjectModeEnum={}));var pr;(function(St){St["DUBBO"]="dubbo";St["GRPC"]="gRPC"})(pr=Dt.MSProviderType||(Dt.MSProviderType={}));var mr;(function(St){St["RABBITMQ"]="rabbitmq";St["MQTT"]="mqtt";St["KAFKA"]="kafka";St["REDIS"]="redis"})(mr=Dt.MSListenerType||(Dt.MSListenerType={}));class FrameworkType{}Dt.FrameworkType=FrameworkType;class MidwayFrameworkType extends FrameworkType{constructor(St){super();this.name=St}}Dt.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 gr;(function(St){St["EVENT"]="event";St["HTTP"]="http";St["API_GATEWAY"]="apigw";St["OS"]="os";St["CDN"]="cdn";St["LOG"]="log";St["TIMER"]="timer";St["MQ"]="mq";St["KAFKA"]="kafka";St["HSF"]="hsf";St["MTOP"]="mtop";St["SSR"]="ssr"})(gr=Dt.ServerlessTriggerType||(Dt.ServerlessTriggerType={}));var yr;(function(St){St["BEFORE_BIND"]="beforeBind";St["BEFORE_CREATED"]="beforeObjectCreated";St["AFTER_CREATED"]="afterObjectCreated";St["AFTER_INIT"]="afterObjectInit";St["BEFORE_DESTROY"]="beforeObjectDestroy"})(yr=Dt.ObjectLifeCycleEvent||(Dt.ObjectLifeCycleEvent={}));var Sr;(function(St){St["APPLICATION"]="APPLICATION";St["AGENT"]="AGENT"})(Sr=Dt.MidwayProcessTypeEnum||(Dt.MidwayProcessTypeEnum={}))},72838:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ServerResponse=void 0;class ServerResponse{constructor(St){this.isSuccess=true;this.ctx=St}json(St){return Object.getPrototypeOf(this).constructor.JSON_TPL(St,this.isSuccess,this.ctx)}text(St){return Object.getPrototypeOf(this).constructor.TEXT_TPL(St,this.isSuccess,this.ctx)}blob(St){return Object.getPrototypeOf(this).constructor.BLOB_TPL(St,this.isSuccess,this.ctx)}success(){this.isSuccess=true;return this}fail(){this.isSuccess=false;return this}}Dt.ServerResponse=ServerResponse;ServerResponse.TEXT_TPL=(St,Dt,rr)=>St;ServerResponse.JSON_TPL=(St,Dt,rr)=>{if(Dt){return{success:"true",data:St}}else{return{success:"false",message:St||"fail"}}};ServerResponse.BLOB_TPL=(St,Dt,rr)=>St},91959:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.HttpServerResponse=void 0;const cr=rr(79896);const pr=rr(72838);const mr=rr(82738);const gr=rr(37407);const yr=rr(16928);class HttpServerResponse extends pr.ServerResponse{constructor(St){super(St)}status(St){this.ctx.res.statusCode=St;return this}header(St,Dt){this.ctx.res.setHeader(St,Dt);return this}headers(St){if(this.ctx.res.setHeaders){this.ctx.res.setHeaders(new Map(Object.entries(St)))}else{for(const Dt in St){this.header(Dt,St[Dt])}}return this}json(St){this.header("Content-Type","application/json");return Object.getPrototypeOf(this).constructor.JSON_TPL(St,this.isSuccess,this.ctx)}text(St){this.header("Content-Type","text/plain");return Object.getPrototypeOf(this).constructor.TEXT_TPL(St,this.isSuccess,this.ctx)}file(St,Dt){this.header("Content-Type",Dt||"application/octet-stream");this.header("Content-Disposition",`attachment; filename=${(0,yr.basename)(St)}`);return Object.getPrototypeOf(this).constructor.FILE_TPL(typeof St==="string"?(0,cr.createReadStream)(St):St,this.isSuccess,this.ctx)}blob(St,Dt){this.header("Content-Type",Dt||"application/octet-stream");return Object.getPrototypeOf(this).constructor.BLOB_TPL(St,this.isSuccess,this.ctx)}html(St){this.header("Content-Type","text/html");return Object.getPrototypeOf(this).constructor.HTML_TPL(St,this.isSuccess,this.ctx)}redirect(St,Dt=302){this.status(Dt);if(this.ctx.redirect){return this.ctx.redirect(St)}else if(this.ctx.res.redirect){return this.ctx.res.redirect(St)}else{this.header("Location",St)}}sse(St={}){return new mr.ServerSendEventStream(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.SSE_TPL,...St})}stream(St={}){return new gr.HttpStreamResponse(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.STREAM_TPL,...St})}}Dt.HttpServerResponse=HttpServerResponse;HttpServerResponse.FILE_TPL=(St,Dt,rr)=>St;HttpServerResponse.SSE_TPL=(St,Dt)=>St;HttpServerResponse.STREAM_TPL=(St,Dt)=>St;HttpServerResponse.HTML_TPL=(St,Dt,rr)=>St},89995:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.HttpServerResponse=Dt.ServerResponse=void 0;var cr=rr(72838);Object.defineProperty(Dt,"ServerResponse",{enumerable:true,get:function(){return cr.ServerResponse}});var pr=rr(91959);Object.defineProperty(Dt,"HttpServerResponse",{enumerable:true,get:function(){return pr.HttpServerResponse}})},82738:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ServerSendEventStream=void 0;const cr=rr(2203);class ServerSendEventStream extends cr.Transform{constructor(St,Dt={}){super({objectMode:true,...Dt});this.isActive=false;this.ctx=St;this.closeEvent=Dt.closeEvent||"close";this.options=Dt;this.ctx.req.on("close",this.handleClose.bind(this))}_transform(St,Dt,rr){try{let Dt,cr="data: ";const pr=/^\s*:\s*/;const mr=[];if(!this.isActive){this.isActive=true;const St={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(const Dt in St){this.ctx.res.setHeader(Dt,St[Dt])}this.ctx.req.socket.setTimeout(0);this.ctx.req.socket.setNoDelay(true);this.ctx.req.socket.setKeepAlive(true);mr.push(": ok")}const gr=St;if(gr.event)mr.push("event: "+gr.event);if(gr.retry)mr.push("retry: "+gr.retry);if(gr.id)mr.push("id: "+gr.id);if(typeof gr.data==="object"){Dt=JSON.stringify(gr.data);mr.push(cr+Dt)}else if(typeof gr.data==="undefined"){mr.push(cr)}else{gr.data=String(gr.data);if(gr.data.search(pr)!==-1){gr.data=gr.data.replace(pr,"");cr=": "}gr.data=gr.data.replace(/(\r\n|\r|\n)/g,"\n");Dt=gr.data.split(/\n/);for(let St=0,rr=Dt.length;St<rr;++St){const pr=Dt[St];if(St+1===rr){mr.push(cr+pr)}else{mr.push(cr+pr)}}}this.push(mr.join("\n")+"\n\n");rr()}catch(St){this.ctx.logger.error(St);this.sendError(St);this.end();rr(St)}}sendError(St){this.send({event:"error",data:St.message||"An error occurred"})}sendEnd(St){St.event=this.closeEvent;this.send(St)}send(St){super.write(this.options.tpl(St,this.ctx))}handleClose(){this.end()}}Dt.ServerSendEventStream=ServerSendEventStream},37407:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.HttpStreamResponse=void 0;const cr=rr(2203);class HttpStreamResponse extends cr.Transform{constructor(St,Dt={}){super({objectMode:true,...Dt});this.isActive=false;this.ctx=St;this.options=Dt}_transform(St,Dt,rr){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 St==="string"){this.ctx.res.write(St)}else{this.ctx.res.write(JSON.stringify(St))}rr()}catch(St){this.ctx.logger.error(St);this.end();this.ctx.res.end();rr(St)}}send(St){if(!this.writable){return}this.write(this.options.tpl(St,this.ctx))}sendError(St){this.ctx.logger.error(St);this.end();this.ctx.res.end()}_flush(St){this.ctx.res.end();St()}}Dt.HttpStreamResponse=HttpStreamResponse},70812:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayAspectService=void 0;const mr=rr(65675);const gr=rr(6192);const yr=rr(49757);const Sr=rr(63289);let $r=class MidwayAspectService{constructor(St){this.applicationContext=St}async loadAspect(){const St=(0,yr.listModule)(yr.ASPECT_KEY);let Dt=[];for(const rr of St){const St=(0,yr.getClassMetadata)(yr.ASPECT_KEY,rr);Dt=Dt.concat(St.map((St=>{St.aspectModule=rr;return St})))}Dt.sort(((St,Dt)=>(Dt.priority||0)-(St.priority||0)));for(const St of Dt){const Dt=await this.applicationContext.getAsync(St.aspectModule);await this.addAspect(Dt,St)}}async addAspect(St,Dt){const rr=Dt.aspectTarget;const cr=Object.getOwnPropertyNames(rr.prototype);const pr=Dt.match?mr(Dt.match):()=>true;for(const Dt of cr){if(Dt==="constructor"||!pr(Dt)){continue}const cr=Object.getOwnPropertyDescriptor(rr.prototype,Dt);if(!cr||cr.writable===false){continue}this.interceptPrototypeMethod(rr,Dt,St)}}interceptPrototypeMethod(St,Dt,rr){const cr=St.prototype[Dt];if(Sr.Types.isAsyncFunction(St.prototype[Dt])){St.prototype[Dt]=async function(...St){var pr,mr,gr;let yr,Sr;const newProceed=(...St)=>cr.apply(this,St);const $r={methodName:Dt,target:this,args:St,proceed:newProceed,proceedIsAsyncFunction:true};if(typeof rr==="function"){rr=rr()}try{await((pr=rr.before)===null||pr===void 0?void 0:pr.call(rr,$r));if(rr.around){Sr=await rr.around($r)}else{Sr=await cr.call(this,...$r.args)}$r.proceed=undefined;const St=await((mr=rr.afterReturn)===null||mr===void 0?void 0:mr.call(rr,$r,Sr));Sr=typeof St==="undefined"?Sr:St;return Sr}catch(St){$r.proceed=undefined;yr=St;if(rr.afterThrow){await rr.afterThrow($r,yr)}else{throw St}}finally{await((gr=rr.after)===null||gr===void 0?void 0:gr.call(rr,$r,Sr,yr))}}}else{St.prototype[Dt]=function(...St){var pr,mr,gr;let yr,Sr;const newProceed=(...St)=>cr.apply(this,St);const $r={methodName:Dt,target:this,args:St,proceed:newProceed,proceedIsAsyncFunction:false};if(typeof rr==="function"){rr=rr()}try{(pr=rr.before)===null||pr===void 0?void 0:pr.call(rr,$r);if(rr.around){Sr=rr.around($r)}else{Sr=cr.call(this,...$r.args)}$r.proceed=undefined;const St=(mr=rr.afterReturn)===null||mr===void 0?void 0:mr.call(rr,$r,Sr);Sr=typeof St==="undefined"?Sr:St;return Sr}catch(St){$r.proceed=undefined;yr=St;if(rr.afterThrow){rr.afterThrow($r,yr)}else{throw St}}finally{(gr=rr.after)===null||gr===void 0?void 0:gr.call(rr,$r,Sr,yr)}}}}};$r=cr([(0,yr.Provide)(),(0,yr.Scope)(gr.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],$r);Dt.MidwayAspectService=$r},78842:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayConfigService=void 0;const mr=rr(16928);const gr=rr(6192);const yr=rr(65308);const Sr=rr(79896);const $r=rr(39023);const Er=rr(70275);const Ir=rr(37482);const Or=rr(83486);const Hr=rr(86314);const Gr=rr(49757);const Tn=rr(63289);const Wn=$r.debuglog("midway:debug");let Gn=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(St){for(const Dt of St){if(typeof Dt==="string"){if(/\.\w+$/.test(Dt)){const St=this.getConfigEnv(Dt);const rr=this.getEnvSet(St);rr.add(Dt);if(this.aliasMap[St]){this.getEnvSet(this.aliasMap[St]).add(Dt)}}else{const St=(0,Sr.statSync)(Dt);if(St.isDirectory()){const St=(0,Sr.readdirSync)(Dt);this.add(St.map((St=>(0,mr.join)(Dt,St))))}}}else{for(const St in Dt){this.getEnvSet(St).add(Dt[St]);if(this.aliasMap[St]){this.getEnvSet(this.aliasMap[St]).add(Dt[St])}}}}}addObject(St,Dt=false){if(this.isReady){St=this.runWithFilter(St);if(!St){Wn("[config]: Filter config and got undefined will be drop it");return}this.configMergeOrder.push({env:"default",extraPath:"",value:St});if(Dt){this.configuration=(0,Or.extend)(true,St,this.configuration)}else{(0,Or.extend)(true,this.configuration,St)}}else{this.externalObject.push(St)}}getEnvSet(St){if(!this.envDirMap.has(St)){this.envDirMap.set(St,new Set)}return this.envDirMap.get(St)}getConfigEnv(St){const Dt=(0,mr.basename)(St);const rr=Dt.split(".");const cr=rr.pop();if(cr!=="js"&&cr!=="ts"){return cr}return rr.pop()}load(){if(this.isReady)return;const St=this.getEnvSet("default");const Dt=this.getEnvSet(this.environmentService.getCurrentEnvironment());const rr={};const cr=St.size;for(const[pr,mr]of[...St,...Dt].entries()){let St=this.loadConfig(mr);if(Tn.Types.isFunction(St)){St=St.apply(null,[this.appInfo,rr])}if(!St){continue}St=this.runWithFilter(St);if(!St){Wn("[config]: Filter config and got undefined will be drop it");continue}if(typeof mr==="string"){Wn("[config]: Loaded config %s, %j",mr,St)}else{Wn("[config]: Loaded config %j",St)}this.configMergeOrder.push({env:pr<cr?"default":this.environmentService.getCurrentEnvironment(),extraPath:mr,value:St});(0,Or.extend)(true,rr,St)}if(this.externalObject.length){for(let St of this.externalObject){if(St){St=this.runWithFilter(St);if(!St){Wn("[config]: Filter config and got undefined will be drop it");continue}Wn("[config]: Loaded external object %j",St);(0,Or.extend)(true,rr,St);this.configMergeOrder.push({env:"default",extraPath:"",value:St})}}}this.configuration=rr;this.isReady=true}getConfiguration(St){if(St){return(0,yr.safelyGet)(St,this.configuration)}return this.configuration}getConfigMergeOrder(){return this.configMergeOrder}loadConfig(St){let Dt=typeof St==="string"?require(St):St;if(Dt&&Dt.__esModule){if(Dt&&Dt.default){if(Object.keys(Dt).length>1){throw new Hr.MidwayInvalidConfigError(`${St} should not have both a default export and named export`)}Dt=Dt.default}}return Dt}clearAllConfig(){this.configuration={}}clearConfigMergeOrder(){this.configMergeOrder.length=0}addFilter(St){this.configFilterList.push(St)}runWithFilter(St){for(const Dt of this.configFilterList){Wn(`[config]: Filter config by filter = "${Dt.name||"anonymous filter"}"`);St=Dt(St);Wn("[config]: Filter config result = %j",St)}return St}getAppInfo(){return this.appInfo}};cr([(0,Gr.Inject)(),pr("design:type",Er.MidwayEnvironmentService)],Gn.prototype,"environmentService",void 0);cr([(0,Gr.Inject)(),pr("design:type",Ir.MidwayInformationService)],Gn.prototype,"informationService",void 0);cr([(0,Gr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",void 0)],Gn.prototype,"init",null);Gn=cr([(0,Gr.Provide)(),(0,Gr.Scope)(gr.ScopeEnum.Singleton)],Gn);Dt.MidwayConfigService=Gn},96367:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayDecoratorService=void 0;const mr=rr(49757);const gr=rr(6192);const yr=rr(70812);const Sr=rr(86314);const $r=rr(39023);const Er=rr(63289);const Ir=$r.debuglog("midway:debug");let Or=class MidwayDecoratorService{constructor(St){this.applicationContext=St;this.propertyHandlerMap=new Map;this.methodDecoratorMap=new Map;this.parameterDecoratorMap=new Map;this.parameterDecoratorPipes=new Map}init(){this.applicationContext.onBeforeBind((St=>{const Dt=(0,mr.getClassMetadata)(mr.INJECT_CUSTOM_METHOD,St);if(Dt){for(const rr of Dt){const{propertyName:Dt,key:cr,metadata:pr,options:mr}=rr;if(!mr||!mr.impl){continue}this.aspectService.interceptPrototypeMethod(St,Dt,(()=>{const rr=this.methodDecoratorMap.get(cr);if(!rr){throw new Sr.MidwayCommonError(`Method Decorator "${cr}" handler not found, please register first.`)}return rr({target:St,propertyName:Dt,metadata:pr})}))}}const rr=(0,mr.getClassMetadata)(mr.INJECT_CUSTOM_PARAM,St);if(rr){for(const Dt of Object.keys(rr)){this.aspectService.interceptPrototypeMethod(St,Dt,(()=>({before:async cr=>{const pr=[...cr.args];for(const gr of rr[Dt]){const{propertyName:Dt,key:rr,metadata:yr,parameterIndex:$r,options:Or}=gr;let Hr;if(Or&&Or.impl){Hr=this.parameterDecoratorMap.get(rr);if(!Hr){throw new Sr.MidwayCommonError(`Parameter Decorator "${rr}" handler not found, please register first.`)}}else{Hr=async({parameterIndex:St,originArgs:Dt})=>Dt[St]}const Gr=(0,mr.getMethodParamTypes)(St,Dt);let Tn=false;try{pr[$r]=await Hr({metadata:yr,propertyName:Dt,parameterIndex:$r,target:St,originArgs:pr,originParamType:Gr[$r],instance:cr.target})}catch(St){Tn=true;if((Or===null||Or===void 0?void 0:Or.throwError)===true){throw St}else{Ir(`[core]: Parameter decorator throw error and use origin args, ${St.stack}`)}}if(Tn){continue}const Wn=[...this.parameterDecoratorPipes.get(rr)||[],...(Or===null||Or===void 0?void 0:Or.pipes)||[]];for(const St of Wn){let Dt;if("transform"in St){Dt=St["transform"].bind(St)}else if((0,Er.isClass)(St)){const rr=await this.applicationContext.getAsync(St);Dt=rr.transform.bind(rr)}else if(typeof St==="function"){Dt=St}else{throw new Sr.MidwayParameterError("Pipe must be a function or implement PipeTransform interface")}pr[$r]=await Dt(pr[$r],{metaType:(0,mr.transformTypeFromTSDesign)(Gr[$r]),metadata:yr,target:cr.target,methodName:cr.methodName})}}cr.args=pr}})))}}}));this.applicationContext.onObjectCreated(((St,Dt)=>{if(this.propertyHandlerMap.size>0&&Array.isArray(Dt.definition.handlerProps)){for(const rr of Dt.definition.handlerProps){this.defineGetterPropertyValue(rr,St,this.getHandler(rr.key))}}}));this.registerPropertyHandler(mr.APPLICATION_CONTEXT_KEY,((St,Dt)=>this.applicationContext))}registerPropertyHandler(St,Dt){Ir(`[core]: Register property decorator key="${St}"`);this.propertyHandlerMap.set(St,Dt)}registerMethodHandler(St,Dt){Ir(`[core]: Register method decorator key="${St}"`);this.methodDecoratorMap.set(St,Dt)}registerParameterHandler(St,Dt){Ir(`[core]: Register parameter decorator key="${St}"`);this.parameterDecoratorMap.set(St,Dt)}registerParameterPipes(St,Dt){if(!this.parameterDecoratorPipes.has(St)){this.parameterDecoratorPipes.set(St,[])}this.parameterDecoratorPipes.set(St,this.parameterDecoratorPipes.get(St).concat(Dt))}defineGetterPropertyValue(St,Dt,rr){if(St&&rr){if(St.propertyName){Object.defineProperty(Dt,St.propertyName,{get:()=>{var cr;return rr(St.propertyName,(cr=St.metadata)!==null&&cr!==void 0?cr:{},Dt)},configurable:true,enumerable:true})}}}getHandler(St){if(this.propertyHandlerMap.has(St)){return this.propertyHandlerMap.get(St)}}};cr([(0,mr.Inject)(),pr("design:type",yr.MidwayAspectService)],Or.prototype,"aspectService",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",void 0)],Or.prototype,"init",null);Or=cr([(0,mr.Provide)(),(0,mr.Scope)(gr.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],Or);Dt.MidwayDecoratorService=Or},70275:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayEnvironmentService=void 0;const pr=rr(6192);const mr=rr(65308);const gr=rr(49757);let yr=class MidwayEnvironmentService{constructor(){this.moduleLoadType="commonjs"}getCurrentEnvironment(){if(!this.environment){this.environment=(0,mr.getCurrentEnvironment)()}return this.environment}setCurrentEnvironment(St){this.environment=St}isDevelopmentEnvironment(){return(0,mr.isDevelopmentEnvironment)(this.environment)}setModuleLoadType(St){this.moduleLoadType=St}getModuleLoadType(){return this.moduleLoadType}isPkgEnvironment(){return typeof process["pkg"]!=="undefined"}};yr=cr([(0,gr.Provide)(),(0,gr.Scope)(pr.ScopeEnum.Singleton)],yr);Dt.MidwayEnvironmentService=yr},33332:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayFrameworkService=void 0;const mr=rr(49757);const gr=rr(6192);const yr=rr(78842);const Sr=rr(34888);const $r=rr(83872);const Er=rr(28602);const Ir=rr(96367);const Or=rr(70812);const Hr=rr(43436);const Gr=rr(39023);const Tn=rr(86314);const Wn=rr(2222);const Gn=rr(70032);const mi=Gr.debuglog("midway:debug");let $i=class MidwayFrameworkService{constructor(St,Dt){this.applicationContext=St;this.globalOptions=Dt;this.globalFrameworkList=[]}async init(){var St,Dt;this.decoratorService.registerPropertyHandler(mr.CONFIG_KEY,((St,Dt)=>{var rr;if(Dt.identifier===mr.ALL){return this.configService.getConfiguration()}else{return this.configService.getConfiguration((rr=Dt.identifier)!==null&&rr!==void 0?rr:St)}}));this.decoratorService.registerPropertyHandler(mr.LOGGER_KEY,((St,Dt)=>{var rr;return this.loggerService.getLogger((rr=Dt.identifier)!==null&&rr!==void 0?rr:St)}));this.decoratorService.registerPropertyHandler(mr.PIPELINE_IDENTIFIER,((St,Dt,rr)=>{var cr,pr;return new Er.MidwayPipelineService((pr=(cr=rr[Wn.REQUEST_OBJ_CTX_KEY])===null||cr===void 0?void 0:cr.requestContext)!==null&&pr!==void 0?pr:this.applicationContext,Dt.valves)}));this.decoratorService.registerPropertyHandler(mr.APPLICATION_KEY,((St,Dt)=>{if(Dt.type){const St=this.applicationManager.getApplication(Dt.type);if(!St){throw new Tn.MidwayCommonError(`Framework ${Dt.type} not Found`)}return St}else{return this.getMainApp()}}));this.decoratorService.registerPropertyHandler(mr.PLUGIN_KEY,((St,Dt)=>{var rr;return this.getMainApp()[(rr=Dt.identifier)!==null&&rr!==void 0?rr:St]}));this.decoratorService.registerPropertyHandler(mr.FACTORY_SERVICE_CLIENT_KEY,((St,Dt)=>{const rr=this.applicationContext.get(Dt.serviceFactoryClz);const cr=Dt.clientName||rr.getDefaultClientName();if(cr&&rr.has(cr)){return rr.get(cr)}else{if(!cr){throw new Tn.MidwayParameterError(`Please set clientName or options.defaultClientName for ${Dt.serviceFactoryClz.name}).`)}else{throw new Tn.MidwayParameterError(`ClientName(${cr} not found in ${Dt.serviceFactoryClz.name}).`)}}}));let rr=(0,mr.listModule)(mr.FRAMEWORK_KEY);rr=filterProtoFramework(rr);mi(`[core]: Found Framework length = ${rr.length}`);if(rr.length){for(const Dt of rr){if(!this.applicationContext.hasDefinition((0,mr.getProviderUUId)(Dt))){mi(`[core]: Found Framework "${Dt.name}" but missing definition, skip initialize.`);continue}const rr=await this.applicationContext.getAsync(Dt,[this.applicationContext]);if(rr.isEnable()){Gn.MidwayInitializerPerformanceManager.frameworkInitializeStart(rr.getFrameworkName());await rr.initialize({applicationContext:this.applicationContext,namespace:rr.getNamespace(),...this.globalOptions});Gn.MidwayInitializerPerformanceManager.frameworkInitializeEnd(rr.getFrameworkName());mi(`[core]: Found Framework "${rr.getFrameworkName()}" and initialize.`)}else{mi(`[core]: Found Framework "${rr.getFrameworkName()}" and delay initialize.`)}const cr=this.applicationContext.registry.getDefinition((0,mr.getProviderUUId)(Dt));rr.setNamespace(cr===null||cr===void 0?void 0:cr.namespace);this.applicationManager.addFramework((St=cr===null||cr===void 0?void 0:cr.namespace)!==null&&St!==void 0?St:rr.getFrameworkName(),rr);this.globalFrameworkList.push(rr)}let cr;const pr=this.applicationContext.getNamespaceList();for(const St of pr){const Dt=this.applicationManager.getApplication(St);if(Dt){cr=St;break}}global["MIDWAY_MAIN_FRAMEWORK"]=this.mainFramework=(Dt=this.applicationManager.getFramework(cr))!==null&&Dt!==void 0?Dt:this.globalFrameworkList[0];mi(`[core]: Current main Framework is "${cr}".`)}await this.aspectService.loadAspect()}getMainApp(){var St;return(St=this.mainFramework)===null||St===void 0?void 0:St.getApplication()}getMainFramework(){return this.mainFramework}getFramework(St){return this.applicationManager.getFramework(St)}async runFramework(){const St=this.applicationContext.getNamespaceList();this.globalFrameworkList=this.globalFrameworkList.sort(((Dt,rr)=>St.indexOf(Dt.getNamespace())-St.indexOf(rr.getNamespace())));for(const St of this.globalFrameworkList){if(St.isEnable()){Gn.MidwayInitializerPerformanceManager.frameworkRunStart(St.getFrameworkName());await St.run();mi(`[core]: Found Framework "${St.getFrameworkName()}" and run.`);Gn.MidwayInitializerPerformanceManager.frameworkRunEnd(St.getFrameworkName())}}}async stopFramework(){await Promise.all(Array.from(this.globalFrameworkList).map((St=>St.stop())))}};cr([(0,mr.Inject)(),pr("design:type",yr.MidwayConfigService)],$i.prototype,"configService",void 0);cr([(0,mr.Inject)(),pr("design:type",Sr.MidwayLoggerService)],$i.prototype,"loggerService",void 0);cr([(0,mr.Inject)(),pr("design:type",Or.MidwayAspectService)],$i.prototype,"aspectService",void 0);cr([(0,mr.Inject)(),pr("design:type",Ir.MidwayDecoratorService)],$i.prototype,"decoratorService",void 0);cr([(0,mr.Inject)(),pr("design:type",Hr.MidwayApplicationManager)],$i.prototype,"applicationManager",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],$i.prototype,"init",null);$i=cr([(0,mr.Provide)(),(0,mr.Scope)(gr.ScopeEnum.Singleton),pr("design:paramtypes",[Object,Object])],$i);Dt.MidwayFrameworkService=$i;function filterProtoFramework(St){const Dt=[];for(const rr of St){let St=Object.getPrototypeOf(rr);while(St.name&&St.name!==$r.BaseFramework.name){Dt.push(St);St=Object.getPrototypeOf(St)}}return St.filter((St=>!Dt.includes(St)))}},658:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayHealthService=void 0;const mr=rr(49757);const gr=rr(6192);const yr=rr(78842);const Sr=rr(65308);let $r=class MidwayHealthService{constructor(){this.healthCheckTimeout=1e3;this.healthCheckMethods=[]}async init(St){const Dt=this.configService.getConfiguration("core.healthCheckTimeout")||1e3;this.setCheckTimeout(Dt);for(const Dt of St){if(Dt.instance&&Dt.instance["onHealthCheck"]){this.healthCheckMethods.push({item:Dt.instance["onHealthCheck"].bind(Dt.instance),meta:{namespace:Dt.namespace}})}}}async getStatus(){const St=await(0,Sr.createPromiseTimeoutInvokeChain)({promiseItems:this.healthCheckMethods.map((St=>({item:St.item(this.applicationContext),meta:St.meta}))),timeout:this.healthCheckTimeout,methodName:"configuration.onHealthCheck",onSuccess:(St,Dt)=>{if(St["status"]!==undefined){return{namespace:Dt.namespace,...St}}else{return{status:false,namespace:Dt.namespace,reason:"configuration.onHealthCheck return value must be object and contain status field"}}},onFail:(St,Dt)=>({status:false,namespace:Dt.namespace,reason:St.message})});const Dt=St.find((St=>!St.status));return{status:!Dt,namespace:Dt===null||Dt===void 0?void 0:Dt.namespace,reason:Dt===null||Dt===void 0?void 0:Dt.reason,results:St}}setCheckTimeout(St){this.healthCheckTimeout=St}};cr([(0,mr.Inject)(),pr("design:type",yr.MidwayConfigService)],$r.prototype,"configService",void 0);cr([(0,mr.ApplicationContext)(),pr("design:type",Object)],$r.prototype,"applicationContext",void 0);$r=cr([(0,mr.Provide)(),(0,mr.Scope)(gr.ScopeEnum.Singleton)],$r);Dt.MidwayHealthService=$r},37482:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayInformationService=void 0;const mr=rr(6192);const gr=rr(65308);const yr=rr(16928);const Sr=rr(49757);const $r=rr(79896);let Er=class MidwayInformationService{init(){if(this.baseDir){if(!this.appDir){this.appDir=(0,yr.dirname)(this.baseDir)}const St=(0,yr.join)(this.appDir,"package.json");if((0,$r.existsSync)(St)){const Dt=(0,$r.readFileSync)(St,{encoding:"utf-8"});this.pkg=JSON.parse(Dt)}else{this.pkg={}}}else{this.pkg={}}}getAppDir(){return this.appDir}getBaseDir(){return this.baseDir}getHome(){return(0,gr.getUserHome)()}getPkg(){return this.pkg}getProjectName(){var St;return((St=this.pkg)===null||St===void 0?void 0:St["name"])||""}getRoot(){const St=(0,gr.isDevelopmentEnvironment)((0,gr.getCurrentEnvironment)());return St?this.getAppDir():this.getHome()}};cr([(0,Sr.Inject)(),pr("design:type",String)],Er.prototype,"appDir",void 0);cr([(0,Sr.Inject)(),pr("design:type",String)],Er.prototype,"baseDir",void 0);cr([(0,Sr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",void 0)],Er.prototype,"init",null);Er=cr([(0,Sr.Provide)(),(0,Sr.Scope)(mr.ScopeEnum.Singleton)],Er);Dt.MidwayInformationService=Er},13328:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayLifeCycleService=void 0;const mr=rr(6192);const gr=rr(49757);const yr=rr(24451);const Sr=rr(33332);const $r=rr(78842);const Er=rr(39023);const Ir=rr(77306);const Or=rr(658);const Hr=rr(70032);const Gr=(0,Er.debuglog)("midway:debug");let Tn=class MidwayLifeCycleService{constructor(St){this.applicationContext=St;this.lifecycleInstanceList=[]}async init(){await this.mockService.initSimulation();const St=(0,gr.listModule)(gr.CONFIGURATION_KEY);Gr(`[core]: Found Configuration length = ${St.length}`);for(const Dt of St){if(Dt.target instanceof yr.FunctionalConfiguration){Dt.instance=Dt.target}else{Gr(`[core]: Lifecycle run ${Dt.namespace} init`);Dt.instance=await this.applicationContext.getAsync(Dt.target)}Dt.instance&&this.lifecycleInstanceList.push(Dt)}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",(St=>{if(St){this.configService.addObject(St)}}));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 St=(0,gr.listModule)(gr.CONFIGURATION_KEY)||[];for(const Dt of St.reverse()){let St;if(Dt.target instanceof yr.FunctionalConfiguration){St=Dt.target}else{St=await this.applicationContext.getAsync(Dt.target)}await this.runContainerLifeCycle(St,"onStop")}await this.frameworkService.stopFramework()}async runContainerLifeCycle(St,Dt,rr){if(Array.isArray(St)){for(const cr of St){if(typeof cr.instance[Dt]==="function"){Gr(`[core]: Lifecycle run ${cr.instance.constructor.name} ${Dt}`);Hr.MidwayInitializerPerformanceManager.lifecycleStart(cr.namespace,Dt);const St=await cr.instance[Dt](this.applicationContext,this.frameworkService.getMainApp());if(rr){rr(St)}Hr.MidwayInitializerPerformanceManager.lifecycleEnd(cr.namespace,Dt)}}}else{if(typeof St[Dt]==="function"){const cr=St.constructor.name;Gr(`[core]: Lifecycle run ${cr} ${Dt}`);Hr.MidwayInitializerPerformanceManager.lifecycleStart(cr,Dt);const pr=await St[Dt](this.applicationContext,this.frameworkService.getMainApp());if(rr){rr(pr)}Hr.MidwayInitializerPerformanceManager.lifecycleEnd(cr,Dt)}}}async runObjectLifeCycle(St,Dt){for(const rr of St){if(typeof rr.instance[Dt]==="function"){Gr(`[core]: Lifecycle run ${rr.instance.constructor.name} ${Dt}`);return await this.applicationContext[Dt](rr.instance[Dt].bind(rr.instance))}}}getLifecycleInstanceList(){return this.lifecycleInstanceList}};cr([(0,gr.Inject)(),pr("design:type",Sr.MidwayFrameworkService)],Tn.prototype,"frameworkService",void 0);cr([(0,gr.Inject)(),pr("design:type",$r.MidwayConfigService)],Tn.prototype,"configService",void 0);cr([(0,gr.Inject)(),pr("design:type",Ir.MidwayMockService)],Tn.prototype,"mockService",void 0);cr([(0,gr.Inject)(),pr("design:type",Or.MidwayHealthService)],Tn.prototype,"healthService",void 0);cr([(0,gr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Tn.prototype,"init",null);Tn=cr([(0,gr.Provide)(),(0,gr.Scope)(mr.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],Tn);Dt.MidwayLifeCycleService=Tn},34888:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayLoggerService=void 0;const mr=rr(49757);const gr=rr(78842);const yr=rr(64842);const Sr=rr(6192);const $r=rr(82535);const Er=rr(86314);let Ir=class MidwayLoggerService extends yr.ServiceFactory{constructor(St,Dt={}){super();this.applicationContext=St;this.globalOptions=Dt;this.lazyLoggerConfigMap=new Map;this.aliasLoggerMap=new Map}init(){var St;const Dt=this.configService.getConfiguration("loggerFactory");this.loggerFactory=Dt||this.globalOptions["loggerFactory"]||new $r.DefaultConsoleLoggerFactory;if(!this.loggerFactory.getDefaultMidwayLoggerConfig){throw new Er.MidwayFeatureNoLongerSupportedError("please upgrade your @midwayjs/logger to latest version")}const rr=this.loggerFactory.getDefaultMidwayLoggerConfig(this.configService.getAppInfo());this.configService.addObject(rr,true);this.initClients(this.configService.getConfiguration("midwayLogger"));(St=this.applicationContext)===null||St===void 0?void 0:St.registerObject("logger",this.getLogger("appLogger"))}createClient(St,Dt){if(St.aliasName){this.aliasLoggerMap.set(St.aliasName,Dt)}if(!St.lazyLoad){this.loggerFactory.createLogger(Dt,St)}else{delete St["lazyLoad"];this.lazyLoggerConfigMap.set(Dt,St)}}getName(){return"logger"}createLogger(St,Dt){delete Dt["aliasName"];return this.loggerFactory.createLogger(St,Dt)}getLogger(St){if(this.aliasLoggerMap.has(St)){St=this.aliasLoggerMap.get(St)}const Dt=this.loggerFactory.getLogger(St);if(Dt){return Dt}if(this.lazyLoggerConfigMap.has(St)){this.createClient(this.lazyLoggerConfigMap.get(St),St);this.lazyLoggerConfigMap.delete(St)}return this.loggerFactory.getLogger(St)}getCurrentLoggerFactory(){return this.loggerFactory}createContextLogger(St,Dt,rr){return this.loggerFactory.createContextLogger(St,Dt,rr)}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}};cr([(0,mr.Inject)(),pr("design:type",gr.MidwayConfigService)],Ir.prototype,"configService",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",void 0)],Ir.prototype,"init",null);Ir=cr([(0,mr.Provide)(),(0,mr.Scope)(Sr.ScopeEnum.Singleton),pr("design:paramtypes",[Object,Object])],Ir);Dt.MidwayLoggerService=Ir},68220:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayMiddlewareService=void 0;const mr=rr(49757);const gr=rr(6192);const yr=rr(86314);const Sr=rr(65308);const $r=rr(63289);const Er=rr(39023);const Ir=(0,Er.debuglog)("midway:debug");let Or=class MidwayMiddlewareService{constructor(St){this.applicationContext=St}async compose(St,Dt,rr){var cr;if(!Array.isArray(St)){throw new yr.MidwayParameterError("Middleware stack must be an array")}const pr=[];for(let rr of St){if($r.Types.isClass(rr)||typeof rr==="string"||(rr===null||rr===void 0?void 0:rr["middleware"])){let St=(cr=rr===null||rr===void 0?void 0:rr["middleware"])!==null&&cr!==void 0?cr:rr;const mr=rr===null||rr===void 0?void 0:rr["options"];let gr=rr===null||rr===void 0?void 0:rr["name"];if(typeof St==="string"&&!this.applicationContext.hasDefinition(St)){throw new yr.MidwayCommonError(`Middleware definition of "${St}" not found in midway container`)}const $r=await this.applicationContext.getAsync(St);if($r){gr=gr!==null&&gr!==void 0?gr:$r.constructor.name;St=await $r.resolve(Dt,mr);if(!St){continue}if(!$r.match&&!$r.ignore){if(!St.name){St._name=gr}pr.push(St)}else{const Dt=(0,Sr.pathMatching)({match:$r.match,ignore:$r.ignore,thisResolver:$r});rr=(rr,cr,pr)=>{if(!Dt(rr))return cr();return St(rr,cr,pr)};rr._name=gr;pr.push(rr)}}else{throw new yr.MidwayCommonError("Middleware must have resolve method!")}}else{pr.push(rr)}}const composeFn=(St,Dt)=>{const cr=(0,Sr.isIncludeProperty)(St,"body");let mr=-1;return dispatch(0);function dispatch(gr){if(gr<=mr)return Promise.reject(new yr.MidwayCommonError("next() called multiple times"));mr=gr;let Sr=pr[gr];if(gr===pr.length)Sr=Dt;if(!Sr)return Promise.resolve();const $r=`${rr?`${rr}.`:""}${mr} ${Sr._name||Sr.name||"anonymous"}`;const Er=Date.now();Ir(`[middleware]: in ${$r} +0`);try{if(cr){return Promise.resolve(Sr(St,dispatch.bind(null,gr+1),{index:mr})).then((Dt=>{if(Dt!==undefined&&Dt!==St["body"]){St["body"]=Dt}else if(St["body"]!==undefined){Dt=St["body"]}Ir(`[middleware]: out ${$r} +${Date.now()-Er} with body`);return Dt}))}else{return Promise.resolve(Sr(St,dispatch.bind(null,gr+1),{index:mr})).then((St=>{Ir(`[middleware]: out ${$r} +${Date.now()-Er}`);return St}))}}catch(St){Ir(`[middleware]: out ${$r} +${Date.now()-Er} with err ${St.message}`);return Promise.reject(St)}}};if(rr){composeFn._name=rr}return composeFn}};Or=cr([(0,mr.Provide)(),(0,mr.Scope)(gr.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],Or);Dt.MidwayMiddlewareService=Or},77306:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr;Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayMockService=void 0;const gr=rr(6192);const yr=rr(49757);const Sr=rr(63289);let $r=mr=class MidwayMockService{constructor(St){this.applicationContext=St;this.mocks=new Map;this.contextMocks=new Map;this.cache=new Map;this.simulatorList=[]}async init(){if(mr.prepareMocks.length>0){for(const St of mr.prepareMocks){this.mockProperty(St.obj,St.key,St.value,St.group)}mr.prepareMocks=[]}}static mockClassProperty(St,Dt,rr,cr="default"){this.mockProperty(St.prototype,Dt,rr,cr)}static mockProperty(St,Dt,rr,cr="default"){this.prepareMocks.push({obj:St,key:Dt,value:rr,group:cr})}mockClassProperty(St,Dt,rr,cr="default"){return this.mockProperty(St.prototype,Dt,rr,cr)}mockProperty(St,Dt,rr,cr="default"){const pr=St.hasOwnProperty(Dt);const mr={obj:St,key:Dt,descriptor:Object.getOwnPropertyDescriptor(St,Dt),hasOwnProperty:pr};if(!this.mocks.has(cr)){this.mocks.set(cr,[])}this.mocks.get(cr).push(mr);if(pr){delete St[Dt]}let gr=this.cache.get(cr);if(!gr){gr=new Map;this.cache.set(cr,gr)}let yr=gr.get(St);if(!yr){yr=new Set;gr.set(St,yr)}yr.add(Dt);const Sr=this.overridePropertyDescriptor(rr);Object.defineProperty(St,Dt,Sr)}mockContext(St,Dt,rr,cr="default"){if(!this.contextMocks.has(cr)){this.contextMocks.set(cr,[])}this.contextMocks.get(cr).push({app:St,key:Dt,value:rr})}restore(St="default"){this.restoreGroup(St)}restoreAll(){const St=new Set([...this.mocks.keys(),...this.contextMocks.keys(),...this.cache.keys()]);for(const Dt of St){this.restoreGroup(Dt)}this.simulatorList=[]}restoreGroup(St){const Dt=this.mocks.get(St)||[];for(let St=Dt.length-1;St>=0;St--){const rr=Dt[St];if(!rr.hasOwnProperty){delete rr.obj[rr.key]}else{Object.defineProperty(rr.obj,rr.key,rr.descriptor)}}this.mocks.delete(St);this.contextMocks.delete(St);this.cache.delete(St);this.simulatorList=this.simulatorList.filter((Dt=>Dt["group"]!==St))}isMocked(St,Dt,rr="default"){if((0,Sr.isClass)(St)){St=St.prototype}const cr=this.cache.get(rr);const pr=cr?cr.get(St):undefined;return pr?pr.has(Dt):false}applyContextMocks(St,Dt){for(const[,rr]of this.contextMocks){for(const cr of rr){if(cr.app===St){const St=this.overridePropertyDescriptor(cr.value);if(typeof cr.key==="string"){Object.defineProperty(Dt,cr.key,St)}else{cr.key(Dt)}}}}}getContextMocksSize(){return Array.from(this.contextMocks.values()).reduce(((St,Dt)=>St+Dt.length),0)}overridePropertyDescriptor(St){const Dt={configurable:true,enumerable:true};if(St&&(St.get||St.set)){Dt.get=St.get;Dt.set=St.set}else{Dt.value=St;Dt.writable=true}return Dt}async initSimulation(St="default"){const Dt=(0,yr.listModule)(yr.MOCK_KEY);for(const rr of Dt){const Dt=await this.applicationContext.getAsync(rr);if(await Dt.enableCondition()){Dt["group"]=St;this.simulatorList.push(Dt)}}}async runSimulatorSetup(){var St;for(const Dt of this.simulatorList){await((St=Dt.setup)===null||St===void 0?void 0:St.call(Dt))}}async runSimulatorTearDown(){var St;for(let Dt=this.simulatorList.length-1;Dt>=0;Dt--){const rr=this.simulatorList[Dt];await((St=rr.tearDown)===null||St===void 0?void 0:St.call(rr))}}async runSimulatorAppSetup(St){var Dt;for(const rr of this.simulatorList){await((Dt=rr.appSetup)===null||Dt===void 0?void 0:Dt.call(rr,St))}}async runSimulatorAppTearDown(St){var Dt;for(let rr=this.simulatorList.length-1;rr>=0;rr--){const cr=this.simulatorList[rr];await((Dt=cr.appTearDown)===null||Dt===void 0?void 0:Dt.call(cr,St))}}async runSimulatorContextSetup(St,Dt){var rr;for(const cr of this.simulatorList){await((rr=cr.contextSetup)===null||rr===void 0?void 0:rr.call(cr,St,Dt))}}async runSimulatorContextTearDown(St,Dt){var rr;for(let cr=this.simulatorList.length-1;cr>=0;cr--){const pr=this.simulatorList[cr];await((rr=pr===null||pr===void 0?void 0:pr.contextTearDown)===null||rr===void 0?void 0:rr.call(pr,St,Dt))}}};$r.prepareMocks=[];cr([(0,yr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],$r.prototype,"init",null);cr([(0,yr.Destroy)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",void 0)],$r.prototype,"restoreAll",null);$r=mr=cr([(0,yr.Provide)(),(0,yr.Scope)(gr.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],$r);Dt.MidwayMockService=$r},28602:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayPipelineService=Dt.PipelineContext=void 0;const cr=rr(49757);class PipelineContext{constructor(St){this.info={current:null,currentName:null};this.data=new Map;this.args=St}get(St){return this.data.get(St)}set(St,Dt){this.data.set(St,Dt)}keys(){const St=[];const Dt=this.data.keys();for(const rr of Dt){St.push(rr)}return St}}Dt.PipelineContext=PipelineContext;class MidwayPipelineService{constructor(St,Dt){this.applicationContext=St;this.valves=Dt}async parallel(St){const Dt=this.prepareParallelValves(St);const rr=await Promise.all(Dt);return this.packResult(rr,false)}async concat(St){const Dt=this.prepareParallelValves(St);const rr=await Promise.all(Dt);return this.packResult(rr,true)}async series(St){const Dt=this.mergeValves(St.valves);const rr=new PipelineContext(St.args);const cr={success:true,result:null};const pr={};const mr={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let gr=1;for(const St of Dt){mr.prev=mr.current;mr.prevName=getName(mr.prev);mr.current=St;mr.currentName=getName(mr.current);if(gr<Dt.length){mr.next=Dt[gr];mr.nextName=getName(mr.next)}else{mr.next=undefined;mr.nextName=undefined}gr+=1;rr.info=mr;try{const Dt=await this.applicationContext.getAsync(St);const cr=await Dt.invoke(rr);let gr=St;if(Dt.alias){gr=Dt.alias}pr[gr]=cr;mr.prevValue=cr}catch(Dt){cr.success=false;cr.error={valveName:typeof St==="string"?St:St.name,message:Dt.message,error:Dt};return cr}}cr.result=pr;return cr}async concatSeries(St){const Dt=this.mergeValves(St.valves);const rr=new PipelineContext(St.args);const cr={success:true,result:null};const pr=[];const mr={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let gr=1;for(const St of Dt){mr.prev=mr.current;mr.prevName=getName(mr.prev);mr.current=St;mr.currentName=getName(mr.current);if(gr<Dt.length){mr.next=Dt[gr];mr.nextName=getName(mr.next)}else{mr.next=undefined;mr.nextName=undefined}gr+=1;rr.info=mr;try{const Dt=await this.applicationContext.getAsync(St);const cr=await Dt.invoke(rr);pr.push(cr);mr.prevValue=cr}catch(Dt){cr.success=false;cr.error={valveName:typeof St==="string"?St:St.name,message:Dt.message,error:Dt};return cr}}cr.result=pr;return cr}async waterfall(St){const Dt=await this.concatSeries(St);if(Dt.success){const St=Dt.result;Dt.result=St[St.length-1]}return Dt}mergeValves(St){let Dt=[];if(this.valves&&this.valves.length>0){Dt=this.valves}let rr=[];if(St){for(const cr of St){if(Dt.includes(cr)){rr.push(cr)}}}else{rr=Dt}return rr}prepareParallelValves(St){const Dt=this.mergeValves(St.valves);const rr=new PipelineContext(St.args);return Dt.map((async St=>{const Dt={valveName:St,dataKey:St,data:null};try{const cr=await this.applicationContext.getAsync(St);if(cr.alias){Dt.dataKey=cr.alias}Dt.data=await cr.invoke(rr)}catch(St){Dt.error=St}return Dt}))}packResult(St,Dt=false){const rr={success:true,result:null};let cr;if(Dt){cr=[]}else{cr={}}for(const pr of St){if(pr.error){rr.success=false;rr.error={valveName:typeof pr.valveName==="string"?pr.valveName:pr.valveName.name,message:pr.error.message,error:pr.error};return rr}else{if(Dt){cr.push(pr.data)}else{cr[pr.dataKey]=pr.data}}}rr.result=cr;return rr}}Dt.MidwayPipelineService=MidwayPipelineService;function getName(St){if(St){if(typeof St==="string"){return St}else{return(0,cr.getProviderName)(St)}}return null}},42592:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.WebRouterCollector=Dt.MidwayServerlessFunctionService=void 0;const mr=rr(49757);const gr=rr(19985);const yr=rr(9288);const Sr=rr(1845);const $r=rr(50539);const Er=rr(6192);let Ir=class MidwayServerlessFunctionService extends gr.MidwayWebRouterService{constructor(St={}){super(Object.assign({},St,{includeFunctionRouter:true}));this.options=St}async analyze(){this.analyzeController();this.analyzeFunction();this.sortPrefixAndRouter();for(const St of this.routes.values()){for(const Dt of St){if(Dt.requestMethod==="all"){Dt.functionTriggerMetadata=Dt.functionTriggerMetadata||{};Dt.functionTriggerMetadata.method=["get","post","put","delete","head","patch","options"]}}}}analyzeFunction(){const St=(0,mr.listModule)(mr.FUNC_KEY);for(const Dt of St){this.collectFunctionRoute(Dt)}}collectFunctionRoute(St){var Dt,rr,cr,pr,gr,yr,Sr,$r,Er,Ir,Or,Hr,Gr,Tn,Wn,Gn,mi;const $i=(0,mr.getClassMetadata)(mr.FUNC_KEY,St);const ki=(0,mr.getProviderName)(St);const Ni=(0,mr.getProviderUUId)(St);const Ri="/";if(!this.routes.has(Ri)){this.routes.set(Ri,[]);this.routesPriority.push({prefix:Ri,priority:-999,middleware:[],routerOptions:{},controllerId:ki,routerModule:St})}for(const Vi of $i){if((Dt=Vi["metadata"])===null||Dt===void 0?void 0:Dt["path"]){const Dt=(0,mr.getPropertyDataFromClass)(mr.WEB_ROUTER_PARAM_KEY,St,Vi["methodName"])||[];const Or=(0,mr.getPropertyMetadata)(mr.WEB_RESPONSE_KEY,St,Vi["methodName"])||[];const Hr={id:Ni,prefix:Ri,routerName:"",url:Vi["metadata"]["path"],requestMethod:(cr=(rr=Vi["metadata"])===null||rr===void 0?void 0:rr["method"])!==null&&cr!==void 0?cr:"get",method:Vi["methodName"],description:"",summary:"",handlerName:`${ki}.${Vi["methodName"]}`,funcHandlerName:`${ki}.${Vi["methodName"]}`,controllerId:ki,middleware:((pr=Vi["metadata"])===null||pr===void 0?void 0:pr["middleware"])||[],controllerMiddleware:[],requestMetadata:Dt,responseMetadata:Or};const Gr=(0,mr.getPropertyMetadata)(mr.SERVERLESS_FUNC_KEY,St,Vi["methodName"])||{};const Tn=(Sr=(gr=Gr["functionName"])!==null&&gr!==void 0?gr:(yr=Vi===null||Vi===void 0?void 0:Vi["metadata"])===null||yr===void 0?void 0:yr["functionName"])!==null&&Sr!==void 0?Sr:createFunctionName(St,Vi["methodName"]);const Wn=(Ir=($r=Gr["handlerName"])!==null&&$r!==void 0?$r:(Er=Vi===null||Vi===void 0?void 0:Vi["metadata"])===null||Er===void 0?void 0:Er["handlerName"])!==null&&Ir!==void 0?Ir:Hr.funcHandlerName;Hr.functionName=Tn;Hr.funcHandlerName=Wn;Hr.functionTriggerName=Vi["type"];Hr.functionTriggerMetadata=Vi["metadata"];Hr.functionMetadata={functionName:Tn,...Gr};this.checkDuplicateAndPush(Ri,Hr)}else{const Dt=(0,mr.getPropertyMetadata)(mr.SERVERLESS_FUNC_KEY,St,Vi["methodName"])||{};const rr=(Gr=(Or=Dt["functionName"])!==null&&Or!==void 0?Or:(Hr=Vi===null||Vi===void 0?void 0:Vi["metadata"])===null||Hr===void 0?void 0:Hr["functionName"])!==null&&Gr!==void 0?Gr:createFunctionName(St,Vi["methodName"]);const cr=(Gn=(Tn=Dt["handlerName"])!==null&&Tn!==void 0?Tn:(Wn=Vi===null||Vi===void 0?void 0:Vi["metadata"])===null||Wn===void 0?void 0:Wn["handlerName"])!==null&&Gn!==void 0?Gn:`${ki}.${Vi["methodName"]}`;this.checkDuplicateAndPush(Ri,{id:Ni,prefix:Ri,routerName:"",url:"",requestMethod:"",method:Vi["methodName"],description:"",summary:"",handlerName:`${ki}.${Vi["methodName"]}`,funcHandlerName:cr,controllerId:ki,middleware:((mi=Vi["metadata"])===null||mi===void 0?void 0:mi["middleware"])||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:rr,functionTriggerName:Vi["type"],functionTriggerMetadata:Vi["metadata"],functionMetadata:{functionName:rr,...Dt}})}}}async getFunctionList(){return this.getFlattenRouterTable({compileUrlPattern:true})}addServerlessFunction(St,Dt,rr={}){var cr,pr;const mr="";if(!this.routes.has(mr)){this.routes.set(mr,[]);this.routesPriority.push({prefix:mr,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}const gr=(cr=Dt.functionName)!==null&&cr!==void 0?cr:rr.functionName;this.checkDuplicateAndPush(mr,{id:null,method:St,url:Dt.metadata["path"]||"",requestMethod:Dt.metadata["method"]||"",description:"",summary:"",handlerName:"",funcHandlerName:Dt.handlerName||rr.handlerName,controllerId:"",middleware:((pr=Dt.metadata)===null||pr===void 0?void 0:pr.middleware)||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:gr,functionTriggerName:Dt.metadata.name,functionTriggerMetadata:Dt.metadata,functionMetadata:{functionName:gr,...rr}})}};Ir=cr([(0,mr.Provide)(),(0,mr.Scope)(Er.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],Ir);Dt.MidwayServerlessFunctionService=Ir;function createFunctionName(St,Dt){return(0,mr.getProviderName)(St).replace(/[:#]/g,"-")+"-"+Dt}class WebRouterCollector{constructor(St="",Dt={}){this.baseDir=St;this.options=Dt}async init(){if(!this.proxy){if(this.baseDir){const St=new yr.MidwayContainer;(0,mr.bindContainer)(St);St.setFileDetector(new Sr.CommonJSFileDetector({loadDir:this.baseDir}));await St.ready()}if(this.options.includeFunctionRouter){if((0,$r.getCurrentMainFramework)()){this.proxy=await(0,$r.getCurrentMainFramework)().getApplicationContext().getAsync(Ir,[this.options])}else{this.proxy=new Ir(this.options)}}else{if((0,$r.getCurrentMainFramework)()){this.proxy=await(0,$r.getCurrentMainFramework)().getApplicationContext().getAsync(gr.MidwayWebRouterService,[this.options])}else{this.proxy=new gr.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()}}Dt.WebRouterCollector=WebRouterCollector},19985:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayWebRouterService=void 0;const mr=rr(49757);const gr=rr(65308);const yr=rr(86314);const Sr=rr(39023);const $r=rr(73861);const Er=rr(63289);const Ir=rr(6192);const Or=Sr.debuglog("midway:debug");let Hr=class MidwayWebRouterService{constructor(St={}){this.options=St;this.isReady=false;this.routes=new Map;this.routesPriority=[]}async analyze(){this.analyzeController();this.sortPrefixAndRouter()}analyzeController(){const St=(0,mr.listModule)(mr.CONTROLLER_KEY);for(const Dt of St){const St=(0,mr.getClassMetadata)(mr.CONTROLLER_KEY,Dt);this.addController(Dt,St,this.options.includeFunctionRouter)}}sortPrefixAndRouter(){this.routesPriority=this.routesPriority.filter((St=>{const Dt=this.routes.get(St.prefix);if(Dt.length>0){return true}else{this.routes.delete(St.prefix);return false}}));for(const St of this.routes.keys()){const Dt=this.routes.get(St);this.routes.set(St,this.sortRouter(Dt))}this.routesPriority=this.routesPriority.sort(((St,Dt)=>Dt.prefix.length-St.prefix.length))}addController(St,Dt,rr={},cr=false){var pr;if(rr&&typeof rr==="boolean"){cr=rr;rr=undefined}if(!rr){rr={}}const Sr=(0,mr.getProviderName)(St);Or(`[core]: Found Controller ${Sr}.`);const $r=(0,mr.getProviderUUId)(St);Dt.routerOptions=Dt.routerOptions||{};let Er;const Hr=Dt.routerOptions.middleware;const Gr=!!((pr=Dt.routerOptions)===null||pr===void 0?void 0:pr.ignoreGlobalPrefix);let Tn=(0,gr.joinURLPath)(this.options.globalPrefix,Dt.prefix||"/");const Wn=Dt.prefix||"/";if(Gr){Tn=Wn}if(/\*/.test(Tn)){throw new yr.MidwayCommonError(`Router prefix ${Tn} can't set string with *`)}if(!this.routes.has(Tn)){this.routes.set(Tn,[]);this.routesPriority.push({prefix:Tn,priority:Tn==="/"&&Er===undefined?-999:0,middleware:Hr,routerOptions:Dt.routerOptions,controllerId:Sr,routerModule:St})}else{if(Hr&&Hr.length>0){const St=this.routesPriority.filter((St=>St.prefix===Tn))[0];throw new yr.MidwayDuplicateControllerOptionsError(Tn,Sr,St.controllerId)}}if(!this.routes.has(Wn)){this.routes.set(Wn,[]);this.routesPriority.push({prefix:Wn,priority:Wn==="/"&&Er===undefined?-999:0,middleware:Hr,routerOptions:Dt.routerOptions,controllerId:Sr,routerModule:St})}const Gn=(0,mr.getClassMetadata)(mr.WEB_ROUTER_KEY,St);if(Gn&&typeof Gn[Symbol.iterator]==="function"){for(const Dt of Gn){const pr=(0,mr.getPropertyDataFromClass)(mr.WEB_ROUTER_PARAM_KEY,St,Dt.method)||[];const yr=(0,mr.getPropertyMetadata)(mr.WEB_RESPONSE_KEY,St,Dt.method)||[];const Er={id:$r,prefix:Dt.ignoreGlobalPrefix?Wn:Tn,routerName:Dt.routerName||"",url:Dt.path,requestMethod:Dt.requestMethod,method:Dt.method,description:Dt.description||"",summary:Dt.summary||"",handlerName:`${Sr}.${Dt.method}`,funcHandlerName:`${Sr}.${Dt.method}`,controllerId:Sr,controllerClz:St,middleware:Dt.middleware||[],controllerMiddleware:Hr||[],requestMetadata:pr,responseMetadata:yr};if(cr){Er.functionName=Sr+"-"+Dt.method;Er.functionTriggerName=Ir.ServerlessTriggerType.HTTP;Er.functionTriggerMetadata={path:(0,gr.joinURLPath)(Tn,Dt.path.toString()),method:Dt.requestMethod};Er.functionMetadata={functionName:Er.functionName}}if(rr.resourceFilter&&!rr.resourceFilter(Er)){continue}this.checkDuplicateAndPush(Er.prefix,Er)}}}addRouter(St,Dt){const rr=Dt.prefix||"";Dt.requestMethod=(Dt.requestMethod||"GET").toUpperCase();if(!this.routes.has(rr)){this.routes.set(rr,[]);this.routesPriority.push({prefix:rr,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}this.checkDuplicateAndPush(rr,Object.assign(Dt,{method:St}));this.sortPrefixAndRouter()}sortRouter(St){return St.map((St=>{const Dt=St.url.toString();const rr=Er.Types.isRegExp(St.url)?Dt.split("\\/"):Dt.split("/");let cr=0;for(const St of rr){if(St===""||St.includes(":")||St.includes("*")){cr+=0}else{cr+=1}}let pr=2;const mr=Dt.includes(":")?Dt.replace(/:.+$/,""):"";if(mr){pr=1}if(Dt.includes("*")){pr=0}return{...St,_pureRouter:Dt.replace(/\**$/,"").replace(/:\w+/,"123"),_level:Dt.split("/").length-1,_paramString:mr,_category:pr,_weight:cr}})).sort(((St,Dt)=>{if(St._category!==Dt._category){return Dt._category-St._category}if(St._weight!==Dt._weight){return Dt._weight-St._weight}if(St._level===Dt._level){if(Dt._pureRouter===St._pureRouter){return St.url.toString().length-Dt.url.toString().length}return Dt._pureRouter.length-St._pureRouter.length}return Dt._level-St._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(St={}){if(!this.isReady){await this.analyze();this.isReady=true}let Dt=[];for(const St of this.routesPriority){Dt=Dt.concat(this.routes.get(St.prefix))}if(St.compileUrlPattern){for(const St of Dt){if(St.fullUrlFlattenString){St.fullUrlCompiledRegexp=$r.PathToRegexpUtil.toRegexp(St.fullUrlFlattenString)}}}return Dt}async getMatchedRouterInfo(St,Dt){const rr=await this.getFlattenRouterTable({compileUrlPattern:true});let cr;for(const pr of rr){if(pr.fullUrlCompiledRegexp){const rr=pr["requestMethod"].toUpperCase();if(("ALL"===rr||Dt.toUpperCase()===rr)&&pr.fullUrlCompiledRegexp.test(St)){cr=pr;break}}}return cr}checkDuplicateAndPush(St,Dt){const rr=this.routes.get(St);const cr=rr.filter((St=>Dt.url&&Dt.requestMethod&&St.url===Dt.url&&St.requestMethod===Dt.requestMethod));if(cr&&cr.length){throw new yr.MidwayDuplicateRouteError(`${Dt.requestMethod} ${Dt.url}`,`${cr[0].handlerName}`,`${Dt.handlerName}`)}if(!Dt.fullUrlFlattenString&&Dt.url&&typeof Dt.url==="string"){Dt.fullUrl=(0,gr.joinURLPath)(St,Dt.url);if(/\*$/.test(Dt.fullUrl)){Dt.fullUrlFlattenString=Dt.fullUrl.replace("*","(.*)")}else{Dt.fullUrlFlattenString=Dt.fullUrl}}rr.push(Dt)}};Hr=cr([(0,mr.Provide)(),(0,mr.Scope)(Ir.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],Hr);Dt.MidwayWebRouterService=Hr},29222:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.prepareGlobalApplicationContext=Dt.prepareGlobalApplicationContextAsync=Dt.destroyGlobalApplicationContext=Dt.initializeGlobalApplicationContext=void 0;const cr=rr(46123);const pr=rr(42193);const mr=rr(49757);const gr=rr(39023);const yr=rr(42592);const Sr=rr(16928);const $r=rr(658);const Er=rr(70032);const Ir=gr.debuglog("midway:debug");let Or=1;function printStepDebugInfo(St){Ir(`\n\nStep ${Or++}: ${St}\n`)}async function initializeGlobalApplicationContext(St){Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);const Dt=await prepareGlobalApplicationContextAsync(St);printStepDebugInfo("Init logger");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);const rr=await Dt.getAsync(cr.MidwayLoggerService,[Dt,St]);if(rr.getLogger("appLogger")){Dt.registerObject("logger",rr.getLogger("appLogger"))}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);printStepDebugInfo("Init MidwayMockService");await Dt.getAsync(cr.MidwayMockService,[Dt]);printStepDebugInfo("Init framework");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);await Dt.getAsync(cr.MidwayFrameworkService,[Dt,St]);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);printStepDebugInfo("Init lifecycle");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);await Dt.getAsync(cr.MidwayLifeCycleService,[Dt]);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);printStepDebugInfo("Init preload modules");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);const pr=(0,mr.listPreloadModule)();for(const St of pr){await Dt.getAsync(St)}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);printStepDebugInfo("End of initialize and start");Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);return Dt}Dt.initializeGlobalApplicationContext=initializeGlobalApplicationContext;async function destroyGlobalApplicationContext(St){const Dt=await St.getAsync(cr.MidwayLoggerService);const rr=Dt.getCurrentLoggerFactory();const pr=await St.getAsync(cr.MidwayLifeCycleService);await pr.stop();await St.stop();(0,mr.clearBindContainer)();rr.close();Er.MidwayPerformanceManager.cleanAll();global["MIDWAY_APPLICATION_CONTEXT"]=undefined;global["MIDWAY_MAIN_FRAMEWORK"]=undefined}Dt.destroyGlobalApplicationContext=destroyGlobalApplicationContext;async function prepareGlobalApplicationContextAsync(St){var Dt,rr,Or,Hr,Gr;printStepDebugInfo("Ready to create applicationContext");Ir('[core]: start "initializeGlobalApplicationContext"');Ir(`[core]: bootstrap options = ${gr.inspect(St)}`);const Tn=(Dt=St.appDir)!==null&&Dt!==void 0?Dt:"";const Wn=(rr=St.baseDir)!==null&&rr!==void 0?rr:"";Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const Gn=(Or=St.applicationContext)!==null&&Or!==void 0?Or:new cr.MidwayContainer;Ir("[core]: delegate module map from decoratorManager");(0,mr.bindContainer)(Gn);global["MIDWAY_APPLICATION_CONTEXT"]=Gn;Gn.registerObject("baseDir",Wn);Gn.registerObject("appDir",Tn);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);Ir("[core]: set default file detector");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Ready module detector");if(!St.moduleLoadType){St.moduleLoadType="commonjs"}if(St.moduleDetector!==false){Ir("[core]: set module load type = %s",St.moduleLoadType);if(!St.imports){St.imports=[await(0,cr.loadModule)((0,Sr.join)(Wn,`configuration${(0,cr.isTypeScriptEnvironment)()?".ts":".js"}`),{loadMode:St.moduleLoadType,safeLoad:true})]}if(St.moduleDetector===undefined){if(St.moduleLoadType==="esm"){Gn.setFileDetector(new cr.ESModuleFileDetector({loadDir:Wn,ignore:(Hr=St.ignore)!==null&&Hr!==void 0?Hr:[]}));St.moduleLoadType="esm"}else{Gn.setFileDetector(new cr.CommonJSFileDetector({loadDir:Wn,ignore:(Gr=St.ignore)!==null&&Gr!==void 0?Gr:[]}))}}}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");Gn.bindClass(cr.MidwayEnvironmentService);Gn.bindClass(cr.MidwayInformationService);Gn.bindClass(cr.MidwayAspectService);Gn.bindClass(cr.MidwayDecoratorService);Gn.bindClass(cr.MidwayConfigService);Gn.bindClass(cr.MidwayLoggerService);Gn.bindClass(cr.MidwayApplicationManager);Gn.bindClass(cr.MidwayFrameworkService);Gn.bindClass(cr.MidwayMiddlewareService);Gn.bindClass(cr.MidwayLifeCycleService);Gn.bindClass(cr.MidwayMockService);Gn.bindClass(cr.MidwayWebRouterService);Gn.bindClass(yr.MidwayServerlessFunctionService);Gn.bindClass($r.MidwayHealthService);Gn.bindClass(cr.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(St.preloadModules&&St.preloadModules.length){for(const Dt of St.preloadModules){Gn.bindClass(Dt)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const mi=Gn.get(cr.MidwayEnvironmentService);mi.setModuleLoadType(St.moduleLoadType);const $i=Gn.get(cr.MidwayConfigService);$i.add([{default:pr.default}]);Gn.get(cr.MidwayAspectService,[Gn]);Gn.get(cr.MidwayDecoratorService,[Gn]);printStepDebugInfo("Load imports(component) and user code configuration module");Gn.load([].concat(St.imports).concat(St.configurationModule));printStepDebugInfo("Run applicationContext ready method");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);await Gn.ready();Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(St.globalConfig){if(Array.isArray(St.globalConfig)){$i.add(St.globalConfig)}else{$i.addObject(St.globalConfig)}}printStepDebugInfo("Load config file");$i.load();Ir("[core]: Current config = %j",$i.getConfiguration());Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);Gn.get(cr.MidwayMiddlewareService,[Gn]);return Gn}Dt.prepareGlobalApplicationContextAsync=prepareGlobalApplicationContextAsync;function prepareGlobalApplicationContext(St){var Dt,rr,Or,Hr;printStepDebugInfo("Ready to create applicationContext");Ir('[core]: start "initializeGlobalApplicationContext"');Ir(`[core]: bootstrap options = ${gr.inspect(St)}`);const Gr=(Dt=St.appDir)!==null&&Dt!==void 0?Dt:"";const Tn=(rr=St.baseDir)!==null&&rr!==void 0?rr:"";Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const Wn=(Or=St.applicationContext)!==null&&Or!==void 0?Or:new cr.MidwayContainer;Ir("[core]: delegate module map from decoratorManager");(0,mr.bindContainer)(Wn);global["MIDWAY_APPLICATION_CONTEXT"]=Wn;Wn.registerObject("baseDir",Tn);Wn.registerObject("appDir",Gr);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);printStepDebugInfo("Ready module detector");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);if(!St.moduleLoadType){St.moduleLoadType="commonjs"}if(St.moduleDetector!==false){if(St.moduleDetector===undefined){Wn.setFileDetector(new cr.CommonJSFileDetector({ignore:(Hr=St.ignore)!==null&&Hr!==void 0?Hr:[]}))}else if(St.moduleDetector){Wn.setFileDetector(St.moduleDetector)}}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");Wn.bindClass(cr.MidwayEnvironmentService);Wn.bindClass(cr.MidwayInformationService);Wn.bindClass(cr.MidwayAspectService);Wn.bindClass(cr.MidwayDecoratorService);Wn.bindClass(cr.MidwayConfigService);Wn.bindClass(cr.MidwayLoggerService);Wn.bindClass(cr.MidwayApplicationManager);Wn.bindClass(cr.MidwayFrameworkService);Wn.bindClass(cr.MidwayMiddlewareService);Wn.bindClass(cr.MidwayLifeCycleService);Wn.bindClass(cr.MidwayMockService);Wn.bindClass(cr.MidwayWebRouterService);Wn.bindClass(yr.MidwayServerlessFunctionService);Wn.bindClass($r.MidwayHealthService);Wn.bindClass(cr.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(St.preloadModules&&St.preloadModules.length){for(const Dt of St.preloadModules){Wn.bindClass(Dt)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const Gn=Wn.get(cr.MidwayEnvironmentService);Gn.setModuleLoadType(St.moduleLoadType);const mi=Wn.get(cr.MidwayConfigService);mi.add([{default:pr.default}]);Wn.get(cr.MidwayAspectService,[Wn]);Wn.get(cr.MidwayDecoratorService,[Wn]);printStepDebugInfo("Load imports(component) and user code configuration module");if(!St.imports){St.imports=[(0,cr.safeRequire)((0,Sr.join)(St.baseDir,"configuration"))]}Wn.load([].concat(St.imports).concat(St.configurationModule));printStepDebugInfo("Run applicationContext ready method");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Wn.ready();Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(St.globalConfig){if(Array.isArray(St.globalConfig)){mi.add(St.globalConfig)}else{mi.addObject(St.globalConfig)}}printStepDebugInfo("Load config file");mi.load();Ir("[core]: Current config = %j",mi.getConfiguration());Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);Wn.get(cr.MidwayMiddlewareService,[Wn]);return Wn}Dt.prepareGlobalApplicationContext=prepareGlobalApplicationContext},90406:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.pascalCase=Dt.camelCase=void 0;const rr=/[\p{Lu}]/u;const cr=/[\p{Ll}]/u;const pr=/([\p{Alpha}\p{N}_]|$)/u;const mr=/[_.\- ]+/;const gr=new RegExp("^"+mr.source);const yr=new RegExp(mr.source+pr.source,"gu");const Sr=new RegExp("\\d+"+pr.source,"gu");const preserveCamelCase=(St,Dt,pr)=>{let mr=false;let gr=false;let yr=false;for(let Sr=0;Sr<St.length;Sr++){const $r=St[Sr];if(mr&&rr.test($r)){St=St.slice(0,Sr)+"-"+St.slice(Sr);mr=false;yr=gr;gr=true;Sr++}else if(gr&&yr&&cr.test($r)){St=St.slice(0,Sr-1)+"-"+St.slice(Sr-1);yr=gr;gr=false;mr=true}else{mr=Dt($r)===$r&&pr($r)!==$r;yr=gr;gr=pr($r)===$r&&Dt($r)!==$r}}return St};const postProcess=(St,Dt)=>{yr.lastIndex=0;Sr.lastIndex=0;return St.replace(yr,((St,rr)=>Dt(rr))).replace(Sr,(St=>Dt(St)))};function camelCaseOrigin(St,Dt){Dt={pascalCase:false,...Dt};St=St.trim();if(St.length===0){return""}const toLowerCase=St=>St.toLowerCase();const toUpperCase=St=>St.toUpperCase();if(St.length===1){if(mr.test(St)){return""}return Dt.pascalCase?toUpperCase(St):toLowerCase(St)}const rr=St!==toLowerCase(St);if(rr){St=preserveCamelCase(St,toLowerCase,toUpperCase)}St=St.replace(gr,"");St=toLowerCase(St);if(Dt.pascalCase){St=toUpperCase(St.charAt(0))+St.slice(1)}return postProcess(St,toUpperCase)}function camelCase(St){return camelCaseOrigin(St,{pascalCase:false})}Dt.camelCase=camelCase;function pascalCase(St){return camelCaseOrigin(St,{pascalCase:true})}Dt.pascalCase=pascalCase},50539:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.getCurrentAsyncContextManager=Dt.getCurrentMainApp=Dt.getCurrentMainFramework=Dt.getCurrentApplicationContext=void 0;const cr=rr(2222);const getCurrentApplicationContext=()=>global["MIDWAY_APPLICATION_CONTEXT"];Dt.getCurrentApplicationContext=getCurrentApplicationContext;const getCurrentMainFramework=()=>global["MIDWAY_MAIN_FRAMEWORK"];Dt.getCurrentMainFramework=getCurrentMainFramework;const getCurrentMainApp=()=>{const St=(0,Dt.getCurrentMainFramework)();if(St){return St.getApplication()}return undefined};Dt.getCurrentMainApp=getCurrentMainApp;const getCurrentAsyncContextManager=()=>(0,Dt.getCurrentApplicationContext)().get(cr.ASYNC_CONTEXT_MANAGER_KEY);Dt.getCurrentAsyncContextManager=getCurrentAsyncContextManager},83486:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.extend=void 0;const cr=rr(63289);function extend(...St){let Dt,rr,pr,mr,gr;let yr=St[0];let Sr=1;const $r=St.length;let Er=false;if(typeof yr==="boolean"){Er=yr;yr=St[1]||{};Sr=2}else if(typeof yr!=="object"&&typeof yr!=="function"||yr==null){yr={}}for(;Sr<$r;++Sr){Dt=St[Sr];if(Dt==null)continue;for(rr in Dt){if(rr==="__proto__")continue;pr=yr[rr];mr=Dt[rr];if(yr===mr)continue;if(Er&&mr&&cr.Types.isPlainObject(mr)){gr=pr&&cr.Types.isPlainObject(pr)?pr:{};yr[rr]=extend(Er,gr,mr)}else if(typeof mr!=="undefined"){yr[rr]=mr}}}return yr}Dt.extend=extend},2764:(St,Dt)=>{"use strict";
1
+ (()=>{var __webpack_modules__={53196:St=>{function webpackEmptyAsyncContext(St){return Promise.resolve().then((()=>{var Dt=new Error("Cannot find module '"+St+"'");Dt.code="MODULE_NOT_FOUND";throw Dt}))}webpackEmptyAsyncContext.keys=()=>[];webpackEmptyAsyncContext.resolve=webpackEmptyAsyncContext;webpackEmptyAsyncContext.id=53196;St.exports=webpackEmptyAsyncContext},14071:function(St,Dt,rr){"use strict";var cr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});const pr=cr(rr(22078));const mr=rr(23718);const{logLevel:gr=""}=(0,pr.default)(process.argv.slice(2));Dt["default"]={keys:"1755564797722_8890",koa:{globalPrefix:"/api"},midwayLogger:{default:{transports:{console:{level:"all"}}},clients:{appLogger:{level:gr||"warn"},coreLogger:{level:gr||"info"}}},cacheManager:{clients:{default:{store:"memory"}}},i18n:{defaultLocale:"zh",localeTable:{en:{default:mr.backendMessages.en},zh:{default:mr.backendMessages.zh}},writeCookie:false}}},91921:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt["default"]={}},12799:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var Sr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MainConfiguration=void 0;const $r=rr(46123);const Er=gr(rr(47453));const Ir=gr(rr(99375));const Or=gr(rr(65295));const Hr=gr(rr(2865));const Gr=gr(rr(49179));const Tn=gr(rr(62487));const Wn=gr(rr(96955));const Gn=gr(rr(87735));const mi=gr(rr(16928));const $i=gr(rr(79896));const ki=Sr(rr(76982));const Ni=rr(79896);const Ri=rr(24434);const Vi=Sr(rr(99819));const ji=Sr(rr(44400));const Ui=Sr(rr(77036));const zi=rr(31855);const Ki=rr(26815);const Xi=rr(54633);const Yi=rr(59416);const xa=rr(61142);const Ta=rr(64754);const wa=rr(10778);const Ia=rr(49969);const Oa=rr(67872);const Ra=rr(4145);const La=gr(rr(14071));const Ba=gr(rr(91921));const Ua=rr(87518);const Ja=rr(18801);const za=gr(rr(68255));const Ha={DEFAULT_PORT:Number(Ua.uri.getUrlPort(Ki.KEYS.LOCAL_SERVICE_URL_DEV)),MAX_SUB_PORT_RETRIES:20};let Ka=class MainConfiguration{constructor(){this.appConfig=null;this.subServer=null;this._websitePath=null}get websitePath(){if(!this._websitePath){const St=this.app.getEnv();this._websitePath=mi.resolve(__dirname,St===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL?"../../../website":"./website")}return this._websitePath}get apiUrl(){const St=this.app.getEnv();return St===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL?Ki.KEYS.REMOTE_SERVICE_URL_DEV:Ki.KEYS.REMOTE_SERVICE_URL_PROD}getVersion(){const St=this.app.getEnv();if(St===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const St=mi.join(__dirname,"../../cli/package.json");const Dt=JSON.parse((0,Ni.readFileSync)(St,"utf8"));return Dt.version}return process.env.COMP_HUB_VERSION||"unknown"}createProxyConfig(St){const Dt=new Ri.EventEmitter;const rr={...St,on:{...St.on,error:St=>{this.logger.error("Proxy Error:",St.message);Dt.emit("error",St)},proxyRes:()=>Dt.emit("proxyRes"),proxyReq:St=>{const rr=`${St.protocol}//${St.host}${St.path}`;this.logger.debug("[Proxy] →",rr);Dt.emit("proxyReq",St)},proxyReqWs:(...St)=>Dt.emit("proxyReqWs",...St)}};const cr=St.pathRewrite;const pr=Object.keys(cr??{});if(pr.length>0){const[St]=pr;rr.pathRewrite=Dt=>{let rr=Dt.replace(Ki.KEYS.PROXY_PATH_PREFIX,"");rr=rr.replace(new RegExp(St),cr[St]);return rr}}else{rr.pathRewrite=St=>St.replace(Ki.KEYS.PROXY_PATH_PREFIX,"")}return{proxy:(0,zi.createProxyMiddleware)(rr),opt:rr,event:Dt}}createProxyMap(St){const Dt={};for(const[rr,cr]of Object.entries(St)){Dt[rr]=this.createProxyConfig(cr)}return Dt}setupProxy(){const St=this.app.getAttr(Ki.KEYS.COMPHUB_CONFIG_KEY);if(Ta.ProxyController.proxys){for(const St of Object.values(Ta.ProxyController.proxys)){St.event.removeAllListeners()}}Ta.ProxyController.proxys={};if(!St.proxy)return;Ta.ProxyController.proxys=this.createProxyMap(St.proxy)}async buildConfig(St){const Dt=this.app.getEnv();const rr=St.cwd||process.cwd();this.logger.info("cwd:",rr);this.logger.info("env:",Dt);const cr={port:St.port||Ha.DEFAULT_PORT,allowDebug:St.allowDebug??false,api:St.api||this.apiUrl,dir:St.dir||"",cwd:rr,proxy:St.proxy};const pr=mi.join(this.websitePath,Ki.KEYS.WEBSITE_PATH_MAIN);const mr=mi.join(rr,cr.dir||"").replace(/[\\/]$/,"");const gr=mi.join(rr,Ki.KEYS.PREBUILD_MODULE_DIR);const yr=mi.join(rr,"node_modules");await $i.promises.mkdir(gr,{recursive:true});const Sr={websitePath:pr,prebuildModulePath:gr,cwd:rr,port:cr.port,srcPath:mr,remoteServer:cr.api,version:this.getVersion(),allowDebug:cr.allowDebug,proxy:cr.proxy,projectHash:ki.default.createHash("sha256").update(rr).digest("hex").slice(0,8)};wa.remoteInstance.defaults.baseURL=Sr.remoteServer;if(Dt===Ki.KEYS.LOCAL_MIDWAY_ENV_PROD){Sr.port=await(0,Ui.default)({port:Ui.default.makeRange(Sr.port,Sr.port+100)})}this.appConfig=Sr;const $r={dirs:{default:{prefix:`/${Ki.KEYS.WEBSITE_PATH_MAIN}`,dir:pr},[Ki.KEYS.MODULE_LOAD_PREFIX]:{prefix:Ki.KEYS.MODULE_LOAD_PREFIX,dir:gr,maxAge:0},[Ki.KEYS.NODE_MODULES_LOAD_PREFIX]:{prefix:Ki.KEYS.NODE_MODULES_LOAD_PREFIX,dir:yr,maxAge:0},[Ki.KEYS.COMP_PREVIEW_PREFIX_LOCAL]:{prefix:Ki.KEYS.COMP_PREVIEW_PREFIX_LOCAL,dir:Sr.srcPath,maxAge:0}}};try{await $i.promises.access(pr,$i.constants.F_OK)}catch(St){this.logger.warn("websitePathMain 不存在:请先构建前端项目",(0,Ia.getErrorMessage)(St));await $i.promises.mkdir(pr,{recursive:true})}if(Dt===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await $i.promises.writeFile(mi.join(__dirname,".comphubConfig.json"),JSON.stringify(Sr,null,2))}return{koa:{port:Sr.port},staticFile:$r,httpProxy:{strategy:{[Ki.KEYS.REMOTE_SERVICE_PREFIX]:{match:new RegExp(`^/${Ki.KEYS.REMOTE_SERVICE_PREFIX}/(.*)$`),target:`${Sr.remoteServer}/$1`}}}}}async startSubPort(){const St=this.app.getEnv();const Dt=this.app.getAttr(Ki.KEYS.COMPHUB_CONFIG_KEY);const{port:rr,remoteServer:cr}=Dt;let pr=await(0,Ui.default)({port:Ui.default.makeRange(rr,rr+100)});const mr=new Vi.default;mr.use((async(St,pr)=>{if(St.path.startsWith(Ki.KEYS.COMP_PREVIEW_PREFIX_LOCAL)){const{srcPath:rr}=Dt;const cr=St.path[0];const pr=St.path.replace(Ki.KEYS.COMP_PREVIEW_PREFIX_LOCAL,"");const mr=await Ua.locate.resolveBuildPath(pr,{baseDir:rr});if(mr){const Dt=mr.replace(rr,"");const gr=Ja.textKit.replaceSlashWithSpecifiedSeparator(Dt,cr);if(pr!==gr){const Dt=gr.replace(pr,"");St.redirect(St.path+Dt);return}}}const mr=[{prefix:`/${Ki.KEYS.REMOTE_SERVICE_PREFIX}`,target:cr,rewrite:{[`^/${Ki.KEYS.REMOTE_SERVICE_PREFIX}`]:""}},{prefix:`/${Ki.KEYS.LOCAL_SERVICE_PREFIX}`,target:`${Ki.KEYS.IFRAME_HOST}:${rr}`,rewrite:{[`^/${Ki.KEYS.LOCAL_SERVICE_PREFIX}`]:""}},{prefix:Ki.KEYS.MODULE_LOAD_PREFIX,target:`${Ki.KEYS.IFRAME_HOST}:${rr}`,rewrite:{}},{prefix:Ki.KEYS.NODE_MODULES_LOAD_PREFIX,target:`${Ki.KEYS.IFRAME_HOST}:${rr}`,rewrite:{}},{prefix:Ki.KEYS.COMP_PREVIEW_PREFIX_LOCAL,target:`${Ki.KEYS.IFRAME_HOST}:${rr}`,rewrite:{}}];for(const Dt of mr){if(St.path.startsWith(Dt.prefix)){await(0,Oa.createKoaProxy)(St,Dt.target,Dt.rewrite);return}}await pr()}));mr.use((0,ji.default)(this.websitePath,{index:false}));mr.use((async St=>{try{const Dt=(()=>{if(St.path.startsWith(`${Ki.KEYS.IFRAME_ITEM_WEBSITE_PATH}/`)){return Ki.KEYS.IFRAME_ITEM_WEBSITE_PATH}if(St.path.startsWith(`${Ki.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}/`)){return Ki.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}return""})();const rr=mi.join(this.websitePath,Dt,"index.html");const cr=await $i.promises.readFile(rr,"utf-8");const mr=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify({subPort:pr})};<\/script>`;const gr=cr.replace("\x3c!--GLOBAL_CONFIG--\x3e",mr);St.type="text/html; charset=utf-8";St.status=200;St.body=gr}catch(Dt){this.logger.error("读取 index.html 失败:",Dt);St.status=500;St.body="服务器内部错误"}}));await new Promise(((rr,cr)=>{let gr=0;const yr=mr.listen(pr,(()=>{this.subServer=yr;this.app.setAttr(Ki.KEYS.COMPHUB_CONFIG_KEY,{...Dt,subPort:pr});if(process.send){process.send({type:"subPort",subPort:pr})}if(St===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL){this.logger.info(`子端口 ${pr} 已启动`)}rr()}));yr.on("error",(St=>{if(St.code==="EADDRINUSE"&&gr<Ha.MAX_SUB_PORT_RETRIES){gr++;this.logger.error(`子端口 ${pr} 被占用,正在尝试端口 ${++pr}`);yr.close();yr.listen(pr)}else{cr(St)}}))}))}async printAccessInfo(St){const Dt=await St.getAsync(Er.Framework);const rr=Dt.getServer();const cr=rr.address();const pr=this.app.getEnv();const mr=this.app.getAttr(Ki.KEYS.COMPHUB_CONFIG_KEY);this.logger.info("cwd:",mr.cwd);this.logger.info("env:",pr);this.logger.info("port:",mr.port);if(mr.subPort)this.logger.info("subPort:",mr.subPort);if(cr&&typeof cr!=="string"){const St=cr.port;this.logger.info("Local Address:",`http://localhost:${St}`);if(pr===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const Dt=Ua.network.getLocalIPv4();if(Dt)this.logger.info("Network Address:",`http://${Dt}:${St}`);this.logger.info("Swagger UI:",`http://localhost:${St}/swagger-ui/index.html`)}}}async onConfigLoad(){const St=await(0,Ra.waitForIpcConfig)();const Dt=await this.buildConfig(St);const rr=this.app.getEnv();if(rr===Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await $i.promises.writeFile(mi.join(__dirname,".start.json"),JSON.stringify(Dt,null,2))}return Dt}async onReady(){this.app.setAttr(Ki.KEYS.COMPHUB_CONFIG_KEY,this.appConfig);this.app.useMiddleware([xa.ReportMiddleware]);this.app.useFilter([Yi.BadRequestErrorFilter,Xi.DefaultErrorFilter]);process.on("disconnect",(()=>{this.logger.info("Master process exited, shutting down...");if(this.subServer){this.subServer.close()}process.exit(0)}))}async onServerReady(St){this.setupProxy();await this.startSubPort();await this.printAccessInfo(St)}async onStop(){if(this.subServer){await new Promise((St=>{this.subServer.close((()=>St()))}));this.logger.info("子服务已关闭")}}};Dt.MainConfiguration=Ka;mr([(0,$r.Logger)("coreLogger"),yr("design:type",Object)],Ka.prototype,"logger",void 0);mr([(0,$r.App)(),yr("design:type",Object)],Ka.prototype,"app",void 0);Dt.MainConfiguration=Ka=mr([(0,$r.Configuration)({imports:[Er,Ir,Hr,Tn,Wn,Gn,za,{component:Or,enabledEnvironment:[Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL]},{component:Gr,enabledEnvironment:[Ki.KEYS.LOCAL_MIDWAY_ENV_LOCAL]}],importConfigs:[{default:La,local:Ba}]})],Ka)},83465:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr=this&&this.__param||function(St,Dt){return function(rr,cr){Dt(rr,cr,St)}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.CompController=void 0;const gr=rr(46123);const yr=rr(48795);const Sr=rr(63366);const $r=rr(49179);const Er=rr(8131);const Ir=rr(101);const Or=rr(19465);const Hr=rr(19385);const Gr=rr(4990);const Tn=(0,Hr.createNoData)($r.ApiProperty);let Wn=class CompController{async dir(St){const Dt=await this.compService.getCompDir(St.compPath);return Hr.resUtil.success(Dt)}async file(St){const{filePath:Dt}=St;const rr=await this.compService.getCompFile(Dt);return Hr.resUtil.success({content:rr})}async check(St){const Dt=await this.compService.checkCompConfig(St.compPath,St.framework);return Hr.resUtil.success(Dt)}async updateVersion(St){const{compPath:Dt,version:rr}=St;await this.compService.updateCompVersion(Dt,rr);return Hr.resUtil.noData()}async generateCompJson(St){const{compPath:Dt}=St;await this.compService.generateCompJson(Dt);return Hr.resUtil.noData()}async dep(St){const{compPath:Dt}=St;const rr=await this.compService.getCompDep(Dt);return Hr.resUtil.success({thirdParty:rr})}async checkCompRepeat(St){await Gr.remoteApi.v1Token.tokencontrollerApproachexpire();const Dt=await this.compService.checkCompRepeat(St);return Hr.resUtil.success(Dt)}async submit(St){await Gr.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.submitComp(St);return Hr.resUtil.noData()}async update(St){await Gr.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.updateComp(St);return Hr.resUtil.noData()}async download(St){const Dt=await this.compService.downloadComp(St);if(Dt?.isRepeat){return Hr.resUtil.success({isRepeat:true})}return Hr.resUtil.success({isRepeat:false})}async localCompsByIds(St){const{compIds:Dt}=St;const rr=await this.compService.getLocalCompsByIds(Dt);return Hr.resUtil.success({compInfos:rr})}async compFilesOssSignedUrl(St){const Dt=await this.compService.getCompFilesOssSignedUrl(St);return Hr.resUtil.success(Dt)}async packageJson(){const St=await this.compService.getPackageJsonContent();return Hr.resUtil.success({packageJson:St})}async compFileHash(St){const Dt=await this.compService.getCompFileHash(St);return Hr.resUtil.success(Dt)}async localComps(St){const Dt=await this.compService.getLocalComps(St);return Hr.resUtil.success(Dt)}async openCompPathInVscode(St){await this.compService.openCompPathInVscode(St);return Hr.resUtil.noData()}async localCompDetailByPathHash(St){const Dt=await this.compService.getLocalCompDetailByPathHash(St);return Hr.resUtil.success(Dt)}async writeFile(St){await this.compService.writeCompFile(St);return Hr.resUtil.noData()}async renameDir(St){await this.compService.renameCompDir(St);return Hr.resUtil.noData()}};Dt.CompController=Wn;cr([(0,gr.App)(),pr("design:type",Object)],Wn.prototype,"app",void 0);cr([(0,gr.Inject)(),pr("design:type",yr.CompService)],Wn.prototype,"compService",void 0);cr([(0,gr.Inject)(),pr("design:type",Sr.ConfigService)],Wn.prototype,"configService",void 0);cr([(0,$r.ApiOperation)({summary:"获取组件目录"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.CompFileVO)}),(0,gr.Post)("/dir"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CompDirDTO]),pr("design:returntype",Promise)],Wn.prototype,"dir",null);cr([(0,$r.ApiOperation)({summary:"获取组件目录内指定文件的内容"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.CompFileContentVO)}),(0,gr.Post)("/file"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CompFileDTO]),pr("design:returntype",Promise)],Wn.prototype,"file",null);cr([(0,$r.ApiOperation)({summary:"检查组件配置是否符合规范"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.CompCheckVO)}),(0,gr.Post)("/check"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CompCheckDTO]),pr("design:returntype",Promise)],Wn.prototype,"check",null);cr([(0,$r.ApiOperation)({summary:"更新组件版本号"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/updateVersion"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.UpdateVersionDTO]),pr("design:returntype",Promise)],Wn.prototype,"updateVersion",null);cr([(0,$r.ApiOperation)({summary:"生成组件指纹文件"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/generateCompJson"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.GenerateCompJsonDTO]),pr("design:returntype",Promise)],Wn.prototype,"generateCompJson",null);cr([(0,$r.ApiOperation)({summary:"获取组件依赖关系"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.ImportScanResultVO)}),(0,gr.Post)("/dep"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.DepDTO]),pr("design:returntype",Promise)],Wn.prototype,"dep",null);cr([(0,$r.ApiOperation)({summary:"检查组件是否重复"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.CompSimilarListVO)}),(0,gr.Post)("/checkCompRepeat",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CheckCompRepeatDTO]),pr("design:returntype",Promise)],Wn.prototype,"checkCompRepeat",null);cr([(0,$r.ApiOperation)({summary:"提交组件"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/submit",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.SubmitCompDTO]),pr("design:returntype",Promise)],Wn.prototype,"submit",null);cr([(0,$r.ApiOperation)({summary:"更新组件"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/update",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.UpdateCompDTO]),pr("design:returntype",Promise)],Wn.prototype,"update",null);cr([(0,$r.ApiOperation)({summary:"下载组件"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.DownloadCompVO)}),(0,gr.Post)("/download",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.DownloadCompDTO]),pr("design:returntype",Promise)],Wn.prototype,"download",null);cr([(0,$r.ApiOperation)({summary:"通过ids在本地查询组件"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.LocalCompsByIdsVO)}),(0,gr.Post)("/localCompsByIds"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.LocalCompsByIdsDTO]),pr("design:returntype",Promise)],Wn.prototype,"localCompsByIds",null);cr([(0,$r.ApiOperation)({summary:"获取组件文件夹下所有文件的oss签名访问地址"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.CompFilesOssSignedUrlVO)}),(0,gr.Post)("/compFilesOssSignedUrl",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CompFilesOssSignedUrlDTO]),pr("design:returntype",Promise)],Wn.prototype,"compFilesOssSignedUrl",null);cr([(0,$r.ApiOperation)({summary:"获取package.json"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.PackageJsonVO)}),(0,gr.Post)("/packageJson"),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Wn.prototype,"packageJson",null);cr([(0,$r.ApiOperation)({summary:"获取组件文件hash"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.CompFileHashVO)}),(0,gr.Post)("/compFileHash"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CompFileHashDTO]),pr("design:returntype",Promise)],Wn.prototype,"compFileHash",null);cr([(0,$r.ApiOperation)({summary:"获取本地组件列表,分页查询"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,(0,Hr.createListWrapper)($r.ApiProperty,Ir.LocalCompsVO))}),(0,gr.Post)("/localComps",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.LocalCompsDTO]),pr("design:returntype",Promise)],Wn.prototype,"localComps",null);cr([(0,$r.ApiOperation)({summary:"通过组件路径打开在vscode中打开所在文件夹"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/openCompPathInVscode"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.OpenCompPathInVscodeDTO]),pr("design:returntype",Promise)],Wn.prototype,"openCompPathInVscode",null);cr([(0,$r.ApiOperation)({summary:"通过组件完整文件路径hash获取组件信息"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:(0,Hr.createSuccessWrapper)($r.ApiProperty,Ir.LocalCompDetailVO)}),(0,gr.Post)("/localCompDetailByPathHash"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.LocalCompDetailByPathHashDTO]),pr("design:returntype",Promise)],Wn.prototype,"localCompDetailByPathHash",null);cr([(0,$r.ApiOperation)({summary:"写入文件到组件目录"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/writeFile"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.CompWriteFileDTO]),pr("design:returntype",Promise)],Wn.prototype,"writeFile",null);cr([(0,$r.ApiOperation)({summary:"重命名组件目录"}),(0,$r.ApiResponse)({status:200,description:"返回结果",type:Tn}),(0,gr.Post)("/renameDir"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Er.RenameCompDirDTO]),pr("design:returntype",Promise)],Wn.prototype,"renameDir",null);Dt.CompController=Wn=cr([(0,$r.ApiTags)(["comp"]),(0,gr.Controller)("/comp")],Wn)},96736:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr=this&&this.__param||function(St,Dt){return function(rr,cr){Dt(rr,cr,St)}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.ModuleController=void 0;const gr=rr(46123);const yr=rr(49179);const Sr=rr(85984);const $r=rr(19428);const Er=rr(71692);const Ir=rr(61275);const Or=rr(19385);const Hr=(0,Or.createNoData)(yr.ApiProperty);let Gr=class ModuleController{async preBuild(St){const{deps:Dt}=St;let rr=null;await this.queueService.enqueue((async()=>{rr=await this.moduleService.preBuild(Dt)}));return Or.resUtil.success(rr)}async buildTemplateCompiler(St){let Dt=null;await this.queueService.enqueue((async()=>{Dt=await this.moduleService.buildTemplateCompiler(St.vueVersion)}));return Or.resUtil.success(Dt)}async preBuildSize(){const St=await this.moduleService.preBuildSize();return Or.resUtil.success({size:St})}async clearPreBuild(){await this.moduleService.clearPreBuild();return Or.resUtil.noData()}};Dt.ModuleController=Gr;cr([(0,gr.Inject)(),pr("design:type",Sr.ModuleService)],Gr.prototype,"moduleService",void 0);cr([(0,gr.Inject)(),pr("design:type",Ir.QueueService)],Gr.prototype,"queueService",void 0);cr([(0,yr.ApiOperation)({summary:"模块预构建"}),(0,yr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(yr.ApiProperty,Er.PreBuildVO)}),(0,gr.Post)("/preBuild"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[$r.PreBuildDTO]),pr("design:returntype",Promise)],Gr.prototype,"preBuild",null);cr([(0,yr.ApiOperation)({summary:"构建 vue-template-compiler 浏览器 bundle"}),(0,yr.ApiResponse)({status:200,description:"返回 vue-template-compiler 浏览器 bundle 文件名",type:(0,Or.createSuccessWrapper)(yr.ApiProperty,Er.BuildTemplateCompilerVO)}),(0,gr.Post)("/buildTemplateCompiler"),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[$r.BuildTemplateCompilerDTO]),pr("design:returntype",Promise)],Gr.prototype,"buildTemplateCompiler",null);cr([(0,yr.ApiOperation)({summary:"获取预构建模块文件总大小"}),(0,yr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(yr.ApiProperty,Er.PreBuildSizeVO)}),(0,gr.Post)("/preBuildSize"),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Gr.prototype,"preBuildSize",null);cr([(0,yr.ApiOperation)({summary:"清除预构建模块文件"}),(0,yr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,gr.Post)("/clearPreBuild"),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Gr.prototype,"clearPreBuild",null);Dt.ModuleController=Gr=cr([(0,yr.ApiTags)(["module"]),(0,gr.Controller)("/module")],Gr)},54991:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr=this&&this.__param||function(St,Dt){return function(rr,cr){Dt(rr,cr,St)}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.OssController=void 0;const gr=rr(46123);const yr=rr(49179);const Sr=rr(19385);const $r=rr(56415);const Er=rr(75049);const Ir=rr(80799);const Or=rr(19465);let Hr=class OssController{async fileSignUrl(St){const{objectId:Dt}=St;const rr=await this.ossService.getDownloadSts();const cr=await this.ossService.getFilePreviewUrl(rr,Dt);return Sr.resUtil.success({signUrl:cr})}};Dt.OssController=Hr;cr([(0,gr.App)(),pr("design:type",Object)],Hr.prototype,"app",void 0);cr([(0,gr.Inject)(),pr("design:type",Ir.OssService)],Hr.prototype,"ossService",void 0);cr([(0,yr.ApiOperation)({summary:"获取文件访问地址",description:"获取文件访问地址"}),(0,yr.ApiResponse)({status:200,description:"返回结果",type:(0,Sr.createSuccessWrapper)(yr.ApiProperty,Er.SignedUrlVO)}),(0,gr.Post)("/fileSignUrl",{middleware:[Or.TokenMiddleware]}),mr(0,(0,gr.Body)()),pr("design:type",Function),pr("design:paramtypes",[$r.SignedUrlDTO]),pr("design:returntype",Promise)],Hr.prototype,"fileSignUrl",null);Dt.OssController=Hr=cr([(0,yr.ApiTags)(["oss"]),(0,gr.Controller)("/oss")],Hr)},55360:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr=this&&this.__param||function(St,Dt){return function(rr,cr){Dt(rr,cr,St)}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.PreprocessingController=void 0;const gr=rr(49179);const yr=rr(46123);const Sr=rr(90218);const $r=rr(18922);const Er=rr(5578);const Ir=rr(19385);let Or=class PreprocessingController{async preprocess(St){const Dt=await this.preprocessingService.preprocessCode(St);return Ir.resUtil.success({preprocessedCode:Dt})}};Dt.PreprocessingController=Or;cr([(0,yr.Inject)(),pr("design:type",Er.PreprocessingService)],Or.prototype,"preprocessingService",void 0);cr([(0,gr.ApiOperation)({summary:"css预处理",description:"预处理css代码"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(gr.ApiProperty,$r.PreprocessedCodeVO)}),(0,yr.Post)("/preprocess"),mr(0,(0,yr.Body)()),pr("design:type",Function),pr("design:paramtypes",[Sr.PreprocessingDTO]),pr("design:returntype",Promise)],Or.prototype,"preprocess",null);Dt.PreprocessingController=Or=cr([(0,gr.ApiTags)(["preprocessing"]),(0,yr.Controller)("/preprocessing")],Or)},64754:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr;Object.defineProperty(Dt,"__esModule",{value:true});Dt.ProxyController=void 0;const gr=rr(46123);const yr=rr(26815);const Sr=yr.KEYS.PROXY_PATH_PREFIX;let $r=mr=class ProxyController{async proxy(){const St=this.ctx.path.replace(Sr,"");let Dt=null;for(const[rr,cr]of Object.entries(mr.proxys)){const pr=new RegExp(rr);if(pr.test(St)||St.startsWith(rr)){Dt=cr;break}}if(!Dt){this.ctx.status=404;this.ctx.body={message:"Proxy not found"};return}const{proxy:rr,event:cr}=Dt;await new Promise(((St,Dt)=>{rr(this.ctx.req,this.ctx.res);cr.on("error",Dt);cr.on("proxyRes",St)}))}};Dt.ProxyController=$r;cr([(0,gr.Inject)(),pr("design:type",Object)],$r.prototype,"ctx",void 0);cr([(0,gr.All)("/*"),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],$r.prototype,"proxy",null);Dt.ProxyController=$r=mr=cr([(0,gr.Controller)(Sr,{ignoreGlobalPrefix:true})],$r)},17076:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SpaController=void 0;const Sr=rr(46123);const $r=gr(rr(79896));const Er=rr(16928);const Ir=rr(49179);const Or=rr(63366);const Hr=rr(26815);let Gr=class SpaController{async index(){this.ctx.redirect(`/${Hr.KEYS.WEBSITE_PATH_MAIN}/`)}async spa(){const St=this.configService.comphubConfig();const{websitePath:Dt}=St;const rr=(0,Er.resolve)(Dt,"index.html");let cr=await $r.promises.readFile(rr,"utf-8");const pr=this.configService.getGlobalConfig();const{projectHash:mr}=pr;if(mr){cr=cr.replace(/<base[^>]*>/gi,"");cr=cr.replace("\x3c!--BASE_HREF--\x3e",`<base href="/${mr}/main/">`)}const gr=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify(pr)};<\/script>`;cr=cr.replace("\x3c!--GLOBAL_CONFIG--\x3e",gr);return cr}async getGlobalConfig(){return this.configService.getGlobalConfig()}};Dt.SpaController=Gr;mr([(0,Sr.Inject)(),yr("design:type",Object)],Gr.prototype,"ctx",void 0);mr([(0,Sr.App)(),yr("design:type",Object)],Gr.prototype,"app",void 0);mr([(0,Sr.Inject)(),yr("design:type",Or.ConfigService)],Gr.prototype,"configService",void 0);mr([(0,Sr.Get)("/"),yr("design:type",Function),yr("design:paramtypes",[]),yr("design:returntype",Promise)],Gr.prototype,"index",null);mr([(0,Sr.Get)(`/${Hr.KEYS.WEBSITE_PATH_MAIN}/*`),yr("design:type",Function),yr("design:paramtypes",[]),yr("design:returntype",Promise)],Gr.prototype,"spa",null);mr([(0,Sr.Get)(Hr.KEYS.GLOBAL_CONFIG_PATH),yr("design:type",Function),yr("design:paramtypes",[]),yr("design:returntype",Promise)],Gr.prototype,"getGlobalConfig",null);Dt.SpaController=Gr=mr([(0,Ir.ApiExcludeController)(),(0,Sr.Controller)("/",{ignoreGlobalPrefix:true})],Gr)},44734:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr=this&&this.__param||function(St,Dt){return function(rr,cr){Dt(rr,cr,St)}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.VuefinderController=void 0;const gr=rr(46123);const yr=rr(5808);const Sr=rr(49179);const $r=rr(23444);let Er=class VuefinderController{async list(St){const Dt=await this.vuefinderService.list(St);return Dt}};Dt.VuefinderController=Er;cr([(0,gr.App)(),pr("design:type",Object)],Er.prototype,"app",void 0);cr([(0,gr.Inject)(),pr("design:type",yr.VuefinderService)],Er.prototype,"vuefinderService",void 0);cr([(0,Sr.ApiOperation)({summary:"list"}),(0,gr.Get)("/list"),mr(0,(0,gr.Query)()),pr("design:type",Function),pr("design:paramtypes",[$r.VueFinderIndexDTO]),pr("design:returntype",Promise)],Er.prototype,"list",null);Dt.VuefinderController=Er=cr([(0,Sr.ApiTags)(["vuefinder"]),(0,gr.Controller)("/vuefinder")],Er)},60149:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.BasePageDTO=void 0;const mr=rr(49179);const gr=rr(99375);class BasePageDTO{}Dt.BasePageDTO=BasePageDTO;cr([(0,mr.ApiProperty)({example:1,description:"当前页码",required:false}),(0,gr.Rule)(gr.RuleType.number().min(1)),pr("design:type",Number)],BasePageDTO.prototype,"page",void 0);cr([(0,mr.ApiProperty)({example:10,description:"每页数量",required:false}),(0,gr.Rule)(gr.RuleType.number().min(1).max(50)),pr("design:type",Number)],BasePageDTO.prototype,"pageSize",void 0);cr([(0,gr.Rule)(gr.RuleType.string().allow("").max(50).pattern(/\{\s*\$\w+:/i,{invert:true}).trim()),(0,mr.ApiProperty)({example:"小明",description:"关键词",required:false}),pr("design:type",String)],BasePageDTO.prototype,"keyword",void 0)},8131:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.RenameCompDirDTO=Dt.CompWriteFileDTO=Dt.LocalCompDetailByPathHashDTO=Dt.OpenCompPathInVscodeDTO=Dt.LocalCompsDTO=Dt.CompFilesOssSignedUrlDTO=Dt.DownloadCompDTO=Dt.UpdateCompDTO=Dt.SubmitCompDTO=Dt.CompFileDTO=Dt.UpdateVersionDTO=Dt.CompFileHashDTO=Dt.CheckCompRepeatDTO=Dt.LocalCompsByIdsDTO=Dt.DepDTO=Dt.GenerateCompJsonDTO=Dt.CompCheckDTO=Dt.CompDirDTO=void 0;const mr=rr(49179);const gr=rr(99375);const yr=rr(26815);const Sr=rr(60149);class CompPathDTO{}cr([(0,mr.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompPathDTO.prototype,"compPath",void 0);class CompIdDTO{}cr([(0,mr.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompIdDTO.prototype,"compId",void 0);class CompDirDTO extends CompPathDTO{}Dt.CompDirDTO=CompDirDTO;class CompCheckDTO extends CompPathDTO{}Dt.CompCheckDTO=CompCheckDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件框架类型",example:"vue"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompCheckDTO.prototype,"framework",void 0);class GenerateCompJsonDTO extends CompPathDTO{}Dt.GenerateCompJsonDTO=GenerateCompJsonDTO;class DepDTO extends CompPathDTO{}Dt.DepDTO=DepDTO;class LocalCompsByIdsDTO{}Dt.LocalCompsByIdsDTO=LocalCompsByIdsDTO;cr([(0,mr.ApiProperty)({type:[String],required:true,description:"组件id列表",example:["123","456"]}),(0,gr.Rule)(gr.RuleType.array().required().items(gr.RuleType.string())),pr("design:type",Array)],LocalCompsByIdsDTO.prototype,"compIds",void 0);class CheckCompRepeatDTO extends CompPathDTO{}Dt.CheckCompRepeatDTO=CheckCompRepeatDTO;cr([(0,mr.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,gr.Rule)(gr.RuleType.string()),pr("design:type",String)],CheckCompRepeatDTO.prototype,"teamId",void 0);class CompFileHashDTO extends CompPathDTO{}Dt.CompFileHashDTO=CompFileHashDTO;class UpdateVersionDTO extends CompPathDTO{}Dt.UpdateVersionDTO=UpdateVersionDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件版本号",example:"1.0.0"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],UpdateVersionDTO.prototype,"version",void 0);class CompFileDTO{}Dt.CompFileDTO=CompFileDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件文件路径",example:"/src/components/MyComp/index.vue"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompFileDTO.prototype,"filePath",void 0);class PreviewItemDTO{}cr([(0,mr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),(0,gr.Rule)(gr.RuleType.array().required().items(gr.RuleType.string())),pr("design:type",Array)],PreviewItemDTO.prototype,"miniPath",void 0);cr([(0,mr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),(0,gr.Rule)(gr.RuleType.array().optional().items(gr.RuleType.string())),pr("design:type",Array)],PreviewItemDTO.prototype,"fullPath",void 0);cr([(0,mr.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),(0,gr.Rule)(gr.RuleType.string()),pr("design:type",String)],PreviewItemDTO.prototype,"desc",void 0);class ParentDTO{}cr([(0,mr.ApiProperty)({description:"父库名称",required:true,example:"vue"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],ParentDTO.prototype,"name",void 0);cr([(0,mr.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],ParentDTO.prototype,"version",void 0);class DepItemDTO{}cr([(0,mr.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],DepItemDTO.prototype,"name",void 0);cr([(0,mr.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],DepItemDTO.prototype,"version",void 0);cr([(0,mr.ApiProperty)({type:ParentDTO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),(0,gr.Rule)(gr.RuleType.object().optional()),pr("design:type",ParentDTO)],DepItemDTO.prototype,"parent",void 0);class SubmitCompDTO{}Dt.SubmitCompDTO=SubmitCompDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],SubmitCompDTO.prototype,"name",void 0);cr([(0,mr.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],SubmitCompDTO.prototype,"compPath",void 0);cr([(0,mr.ApiProperty)({type:[DepItemDTO],required:true,description:"组件依赖"}),(0,gr.Rule)(gr.RuleType.array().required()),pr("design:type",Array)],SubmitCompDTO.prototype,"dep",void 0);cr([(0,mr.ApiProperty)({type:[PreviewItemDTO],required:true,description:"组件预览数据"}),(0,gr.Rule)(gr.RuleType.array().required()),pr("design:type",Array)],SubmitCompDTO.prototype,"previewConfigs",void 0);cr([(0,mr.ApiProperty)({required:true,description:"组件描述",example:"这是一个组件"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],SubmitCompDTO.prototype,"desc",void 0);cr([(0,mr.ApiProperty)({required:false,description:"组件背景颜色",example:"#f0f0f0"}),(0,gr.Rule)(gr.RuleType.string().empty("").default("")),pr("design:type",String)],SubmitCompDTO.prototype,"bgColor",void 0);cr([(0,mr.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,gr.Rule)(gr.RuleType.string()),pr("design:type",String)],SubmitCompDTO.prototype,"teamId",void 0);cr([(0,mr.ApiProperty)({required:false,description:"组件标签",example:["hooks","图表"],type:[String]}),(0,gr.Rule)(gr.RuleType.array().items(gr.RuleType.string())),pr("design:type",Array)],SubmitCompDTO.prototype,"tags",void 0);cr([(0,mr.ApiProperty)({required:false,description:"组件框架类型",example:"vue"}),(0,gr.Rule)(gr.RuleType.string()),pr("design:type",String)],SubmitCompDTO.prototype,"framework",void 0);class UpdateCompDTO extends SubmitCompDTO{}Dt.UpdateCompDTO=UpdateCompDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],UpdateCompDTO.prototype,"compId",void 0);cr([(0,mr.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,gr.Rule)(gr.RuleType.string()),pr("design:type",String)],UpdateCompDTO.prototype,"teamId",void 0);cr([(0,mr.ApiProperty)({required:false,description:"组件升级描述",example:"升级组件描述"}),(0,gr.Rule)(gr.RuleType.string().allow("").max(200)),pr("design:type",String)],UpdateCompDTO.prototype,"upgradeDesc",void 0);class DownloadCompDTO extends CompIdDTO{}Dt.DownloadCompDTO=DownloadCompDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件下载路径",example:"/src/components/MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],DownloadCompDTO.prototype,"savePath",void 0);cr([(0,mr.ApiProperty)({required:false,description:"是否覆盖",example:true}),(0,gr.Rule)(gr.RuleType.boolean().default(false)),pr("design:type",Boolean)],DownloadCompDTO.prototype,"isCover",void 0);cr([(0,mr.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],DownloadCompDTO.prototype,"compName",void 0);cr([(0,mr.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],DownloadCompDTO.prototype,"version",void 0);class CompFilesOssSignedUrlDTO{}Dt.CompFilesOssSignedUrlDTO=CompFilesOssSignedUrlDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"version",void 0);cr([(0,mr.ApiProperty)({required:true,description:"对象存储id",example:"123"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"objectId",void 0);cr([(0,mr.ApiProperty)({type:[String],required:true,description:"组件文件路径",example:"MyComp/index.vue"}),(0,gr.Rule)(gr.RuleType.array().required().items(gr.RuleType.string())),pr("design:type",Array)],CompFilesOssSignedUrlDTO.prototype,"files",void 0);class LocalCompsDTO extends Sr.BasePageDTO{}Dt.LocalCompsDTO=LocalCompsDTO;class OpenCompPathInVscodeDTO{}Dt.OpenCompPathInVscodeDTO=OpenCompPathInVscodeDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],OpenCompPathInVscodeDTO.prototype,"folderPath",void 0);cr([(0,mr.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],OpenCompPathInVscodeDTO.prototype,"relativeFilePath",void 0);class LocalCompDetailByPathHashDTO{}Dt.LocalCompDetailByPathHashDTO=LocalCompDetailByPathHashDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件完整文件路径hash",example:"1234567890"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],LocalCompDetailByPathHashDTO.prototype,"fullPathHash",void 0);class CompWriteFileDTO{}Dt.CompWriteFileDTO=CompWriteFileDTO;cr([(0,mr.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompWriteFileDTO.prototype,"compPath",void 0);cr([(0,mr.ApiProperty)({required:true,description:"文件名",example:yr.KEYS.COMP_SCREENSHOT_MINI_FILENAME}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompWriteFileDTO.prototype,"filename",void 0);cr([(0,mr.ApiProperty)({required:true,description:"文件内容(base64,不含前缀)",example:"iVBORw0KGgo..."}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],CompWriteFileDTO.prototype,"content",void 0);class RenameCompDirDTO extends CompPathDTO{}Dt.RenameCompDirDTO=RenameCompDirDTO;cr([(0,mr.ApiProperty)({required:true,description:"新目录名称",example:"NewCompName"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],RenameCompDirDTO.prototype,"newName",void 0)},19428:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.BuildTemplateCompilerDTO=Dt.PreBuildDTO=void 0;const mr=rr(49179);const gr=rr(99375);class PreBuildDTO{}Dt.PreBuildDTO=PreBuildDTO;cr([(0,mr.ApiProperty)({type:[String],required:true,description:"组件依赖",example:["axios","md5"]}),(0,gr.Rule)(gr.RuleType.array().required().items(gr.RuleType.string())),pr("design:type",Array)],PreBuildDTO.prototype,"deps",void 0);class BuildTemplateCompilerDTO{}Dt.BuildTemplateCompilerDTO=BuildTemplateCompilerDTO;cr([(0,mr.ApiProperty)({type:String,required:true,description:"Vue 版本号,如 2.6.14",example:"2.6.14"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],BuildTemplateCompilerDTO.prototype,"vueVersion",void 0)},56415:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SignedUrlDTO=void 0;const mr=rr(49179);const gr=rr(99375);class SignedUrlDTO{}Dt.SignedUrlDTO=SignedUrlDTO;cr([(0,gr.Rule)(gr.RuleType.string().required().error(new Error("对象id不能为空"))),(0,mr.ApiProperty)({example:"",description:"对象id",required:true}),pr("design:type",String)],SignedUrlDTO.prototype,"objectId",void 0)},90218:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.PreprocessingDTO=void 0;const mr=rr(49179);const gr=rr(99375);const yr=rr(34985);class PreprocessingDTO{}Dt.PreprocessingDTO=PreprocessingDTO;cr([(0,mr.ApiProperty)({description:"css代码",required:true,example:"body { color: red; }"}),(0,gr.Rule)(gr.RuleType.string().required()),pr("design:type",String)],PreprocessingDTO.prototype,"cssCode",void 0);cr([(0,mr.ApiProperty)({enum:yr.PrecompilerEnum,example:yr.PrecompilerEnum.SASS,description:"预编译器类型",required:false}),(0,gr.Rule)(gr.RuleType.string().valid(...Object.values(yr.PrecompilerEnum))),pr("design:type",String)],PreprocessingDTO.prototype,"precompilerType",void 0)},23444:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.VueFinderIndexDTO=void 0;const mr=rr(49179);const gr=rr(99375);class VueFinderIndexDTO{}Dt.VueFinderIndexDTO=VueFinderIndexDTO;cr([(0,mr.ApiProperty)({required:false,description:"文件路径"}),(0,gr.Rule)(gr.RuleType.string()),pr("design:type",String)],VueFinderIndexDTO.prototype,"path",void 0)},59416:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.BadRequestErrorFilter=void 0;const pr=rr(46123);const mr=rr(19385);const gr=rr(26815);let yr=class BadRequestErrorFilter{async catch(St,Dt){const rr=Dt.app.getEnv();if(rr===gr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){Dt.logger.error("BadRequestErrorFilter==>",St)}return mr.resUtil.error(St.message,St.status)}};Dt.BadRequestErrorFilter=yr;Dt.BadRequestErrorFilter=yr=cr([(0,pr.Catch)(pr.httpError.BadRequestError)],yr)},54633:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.DefaultErrorFilter=void 0;const pr=rr(46123);const mr=rr(26815);let gr=class DefaultErrorFilter{async catch(St,Dt){const rr=Dt.app.getEnv();try{const Dt=JSON.parse(St.message);return{...Dt}}catch(St){if(rr===mr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){Dt.logger.error("解析错误信息失败==>",St.message,"\n")}}finally{if(rr===mr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){Dt.logger.error("原始错误==>",St)}}Dt.status=St.status??500;return{code:St.status??500,message:St.message??"未知错误"}}};Dt.DefaultErrorFilter=gr;Dt.DefaultErrorFilter=gr=cr([(0,pr.Catch)()],gr)},15545:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.Configuration=void 0;var mr=rr(12799);Object.defineProperty(Dt,"Configuration",{enumerable:true,get:function(){return mr.MainConfiguration}});pr(rr(14071),Dt);pr(rr(91921),Dt);pr(rr(83465),Dt);pr(rr(96736),Dt);pr(rr(54991),Dt);pr(rr(55360),Dt);pr(rr(64754),Dt);pr(rr(17076),Dt);pr(rr(44734),Dt);pr(rr(60149),Dt);pr(rr(8131),Dt);pr(rr(19428),Dt);pr(rr(56415),Dt);pr(rr(34985),Dt);pr(rr(90218),Dt);pr(rr(23444),Dt);pr(rr(59416),Dt);pr(rr(54633),Dt);pr(rr(9711),Dt);pr(rr(53951),Dt);pr(rr(77523),Dt);pr(rr(61142),Dt);pr(rr(19465),Dt);pr(rr(95637),Dt);pr(rr(48795),Dt);pr(rr(63366),Dt);pr(rr(23086),Dt);pr(rr(85984),Dt);pr(rr(80799),Dt);pr(rr(5578),Dt);pr(rr(61275),Dt);pr(rr(19452),Dt);pr(rr(5808),Dt);pr(rr(66593),Dt);pr(rr(58953),Dt);pr(rr(49969),Dt);pr(rr(4145),Dt);pr(rr(10778),Dt);pr(rr(67872),Dt);pr(rr(101),Dt);pr(rr(71692),Dt);pr(rr(75049),Dt);pr(rr(18922),Dt)},9711:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},53951:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},34985:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.PrecompilerEnum=void 0;var rr;(function(St){St["LESS"]="less";St["SASS"]="sass";St["SCSS"]="scss"})(rr||(Dt.PrecompilerEnum=rr={}))},77523:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},61142:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.ReportMiddleware=void 0;const pr=rr(46123);let mr=class ReportMiddleware{resolve(){return async(St,Dt)=>{const rr=Date.now();const cr=await Dt();const pr=St.url;St.logger.info(`请求 ${St.method} ${pr} → ${St.status} (${Date.now()-rr}ms)`);return cr}}static getName(){return"report"}};Dt.ReportMiddleware=mr;Dt.ReportMiddleware=mr=cr([(0,pr.Middleware)()],mr)},19465:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.TokenMiddleware=void 0;const pr=rr(46123);const mr=rr(10778);let gr=class TokenMiddleware{resolve(){return async(St,Dt)=>{(0,mr.setHeader)(St.header);await Dt()}}static getName(){return"token"}};Dt.TokenMiddleware=gr;Dt.TokenMiddleware=gr=cr([(0,pr.Middleware)()],gr)},95637:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.CommandService=void 0;const gr=rr(46123);const yr=mr(rr(79896));const Sr=rr(63366);const $r=rr(7455);const Er=mr(rr(16928));const Ir=rr(68255);let Or=class CommandService{async revealInVSCode(St,Dt,rr=1,cr=1){const{cwd:pr}=this.configService.comphubConfig();if(!St||!yr.default.existsSync(St)||!yr.default.statSync(St).isDirectory()){throw new gr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist"))}const mr=Er.default.resolve(St,Dt);if(!yr.default.existsSync(mr)||yr.default.statSync(mr).isDirectory()){throw new gr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist"))}(0,$r.launchIDE)({file:pr});(0,$r.launchIDE)({file:mr,line:rr,column:cr})}};Dt.CommandService=Or;cr([(0,gr.Inject)(),pr("design:type",Sr.ConfigService)],Or.prototype,"configService",void 0);cr([(0,gr.Inject)(),pr("design:type",Object)],Or.prototype,"ctx",void 0);cr([(0,gr.Inject)(),pr("design:type",Ir.MidwayI18nService)],Or.prototype,"i18nService",void 0);Dt.CommandService=Or=cr([(0,gr.Provide)()],Or)},48795:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.CompService=void 0;const Sr=rr(46123);const $r=gr(rr(16928));const Er=gr(rr(79896));const Ir=rr(63366);const Or=rr(23086);const Hr=rr(80799);const Gr=gr(rr(70857));const Tn=gr(rr(10232));const Wn=rr(87518);const Gn=rr(84464);const mi=rr(95637);const $i=rr(26815);const ki=rr(18801);const Ni=rr(4990);const Ri=rr(68255);let Vi=class CompService{getCompFullPath(St){const{srcPath:Dt}=this.configService.comphubConfig();St=St.replace($i.KEYS.FILE_MANAGER_DIRNAME,"");const rr=$r.join(Dt,St);return rr}checkCompEntryIndex(St,Dt=$i.KEYS.COMP_FRAMEWORK_VUE){if(Dt===$i.KEYS.COMP_FRAMEWORK_REACT){for(const Dt of $i.KEYS.COMP_USE_ENTRY_FILE_REACT){const rr=$r.join(St,Dt);if(Er.existsSync(rr)){return Dt}}throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[$i.KEYS.COMP_USE_ENTRY_FILE_REACT.join(" / ")]}))}const rr=$r.join(St,$i.KEYS.COMP_USE_ENTRY_FILE);if(!Er.existsSync(rr)){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[$i.KEYS.COMP_USE_ENTRY_FILE]}))}return $i.KEYS.COMP_USE_ENTRY_FILE}checkCompJson(St){const Dt=this.getCompFullPath(St);const rr=$r.join(Dt,$i.KEYS.COMP_CONFIG_FILENAME);if(!Er.existsSync(rr)){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.configFileNotExist"))}}checkCompJsonFormat(St){const Dt=Object.keys(St);const rr=$i.ARRAY.COMP_DEFAULT_FIELD.every((St=>!St.required||Dt.includes(St.name)));if(!rr)return false;return ki.versionKit.validateVersion(St.version)}async updateCompJson(St,Dt){const rr=this.getCompFullPath(St);const cr=$r.join(rr,$i.KEYS.COMP_CONFIG_FILENAME);const pr=await this.getCompFile(cr);const mr=Dt(JSON.parse(pr));await Er.promises.writeFile(cr,JSON.stringify(mr,null,4))}async readCompVersion(St){const Dt=$r.join(St,$i.KEYS.COMP_CONFIG_FILENAME);const rr=await this.getCompFile(Dt);const cr=JSON.parse(rr);return cr.version}initCompJson(){return $i.ARRAY.COMP_DEFAULT_FIELD.reduce(((St,Dt)=>{const rr={};if(Dt.required){rr[Dt.name]=Dt.default}return{...St,...rr}}),{})}async uploadCompFolderToOss({compFullPath:St,version:Dt,ossData:rr}){const{files:cr}=await Wn.fileTree.generateTree(St);const pr=cr.map((({absolutePath:Dt,size:rr})=>{const cr=Dt.replace(St,"");return{filePath:cr,fileFullPath:Dt,size:rr??0}}));pr.sort(((St,Dt)=>Dt.size-St.size));for(let St=0;St<pr.length;St++){const{filePath:cr,fileFullPath:mr}=pr[St];const gr=$r.join(rr.key,Dt,cr);const yr={...rr,key:gr.replace(new RegExp(ki.textKit.escapeRegExp($r.sep),"g"),"/")};const Sr=Er.createReadStream(mr);await this.ossService.uploadFileToOss(yr,Sr)}}async getCompHash(St){const Dt=await Wn.digest.getFileHashList(St);const rr=Dt.map((St=>`${St.relativePath}-${St.hash}`)).join(";");return Wn.digest.getStringHash(rr)}async getCompFeatures(St){const Dt=await Wn.digest.getFileHashAndSsdeepList(St);const rr=Dt.map((St=>{const Dt=(0,Gn.omit)(St,["relativePath"]);return{...Dt,path:St.relativePath}}));const cr=await Wn.digest.getRelativeDirList(St);const pr=JSON.stringify(cr);const mr=Wn.digest.getStringFuzzyHash(pr);const gr=await this.getCompHash(St);return{fileHashList:rr,compHash:gr,dirHash:Wn.digest.getStringHash(pr),dirSsdeep:Wn.digest.getSsdeepStruct(mr)}}async getCompFileList(St){const{files:Dt}=await Wn.fileTree.generateTree(St,{withStats:true,calculateSize:true});const rr=Dt.map((({name:Dt,size:rr,absolutePath:cr})=>({name:Dt,size:rr??0,path:cr.replace(St,"").replace(new RegExp(ki.textKit.escapeRegExp($r.sep),"g"),"/")})));return rr}checkCompFileSize(St){if(St>$i.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSizeExceeded",{args:[Math.floor($i.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE/1024/1024).toString()]}))}}checkCompFileNum(St){if(St>$i.KEYS.COMP_SUBMIT_MAX_FILE_COUNT){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitFileCountExceeded",{args:[$i.KEYS.COMP_SUBMIT_MAX_FILE_COUNT.toString()]}))}}checkCompSingleFileSize(St){const Dt=$i.KEYS.COMP_SUBMIT_MAX_SINGLE_FILE_SIZE;const rr=Math.floor(Dt/1024/1024);for(const cr of St){if(cr.size>Dt){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSingleFileSizeExceeded",{args:[cr.path,rr.toString()]}))}}}async findCompJsonPath(St){const{files:Dt}=await Wn.fileTree.generateTree(St,{ignore:["node_modules"]});this.ctx.logger.debug("项目文件数量:",Dt.length);const rr=Dt.filter((({absolutePath:St})=>St.endsWith($i.KEYS.COMP_CONFIG_FILENAME)));return rr}async getAllLocalCompIds(){const{srcPath:St}=this.configService.comphubConfig();const Dt=await this.findCompJsonPath(St);this.ctx.logger.debug("组件文件数量:",Dt.length);const rr=Dt.map((async({absolutePath:St})=>{const Dt=await Er.promises.readFile(St,"utf8");const rr=JSON.parse(Dt);const cr=this.checkCompJsonFormat(rr);const pr=$r.dirname(St);return{compjson:rr,isCompHub:cr,compPath:pr,pathHash:Wn.digest.getStringHash(pr)}}));const cr=await Promise.all(rr);return cr.filter((St=>St.isCompHub&&St.compjson[$i.KEYS.COMP_FIELD_COMP_ID]))}async getCompDir(St){const{srcPath:Dt}=this.configService.comphubConfig();const rr=$r.join(St.replace($i.KEYS.FILE_MANAGER_DIRNAME,`${Dt}${$r.sep}`));const{tree:cr,files:pr}=await Wn.fileTree.generateTree(rr,{sortBy:"type"});const _handleTree=St=>{const Dt={name:St.name,path:St.absolutePath,type:St.type};if(St.children&&St.children.length>0){Dt.children=St.children.map((St=>_handleTree(St)))}return Dt};return{tree:_handleTree(cr),files:pr.map((St=>St.absolutePath))}}async getCompFile(St){const Dt=await Er.promises.readFile(St,"utf-8");return Dt}async checkCompConfig(St,Dt=$i.KEYS.COMP_FRAMEWORK_VUE){const rr=$r.basename(St);const cr=this.getCompFullPath(St);let pr;try{const St=this.checkCompEntryIndex(cr,Dt);pr=$r.join(rr,St)}catch(St){this.ctx.logger.error("检查组件入口文件失败",St);return{errorMsg:St.message}}try{this.checkCompJson(St)}catch(St){this.ctx.logger.error("检查组件配置文件comp.json失败",St);return{entryIndexPath:pr,errorMsg:St.message}}const mr=$r.join(rr,$i.KEYS.COMP_CONFIG_FILENAME);try{const Dt=$r.join(this.getCompFullPath(St),$i.KEYS.COMP_CONFIG_FILENAME);const rr=await this.getCompFile(Dt);const cr=this.checkCompJsonFormat(JSON.parse(rr));if(!cr){return{entryIndexPath:pr,compJsonPath:mr,errorMsg:this.i18nService.translate("local.comp.check.configJsonFormatError")}}}catch(St){this.ctx.logger.error("读取组件配置文件comp.json失败",St);return{entryIndexPath:pr,compJsonPath:mr,errorMsg:this.i18nService.translate("local.comp.check.configJsonReadError")}}return{entryIndexPath:pr,compJsonPath:mr,errorMsg:""}}async updateCompVersion(St,Dt){const rr=ki.versionKit.validateVersion(Dt);if(!rr){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidVersionFormat"))}const cr=this.getCompFullPath(St);const pr=$r.join(cr,$i.KEYS.COMP_CONFIG_FILENAME);const mr=await this.getCompFile(pr);const gr=JSON.parse(mr);gr.version=Dt;const yr=JSON.stringify(gr,null,2);await Er.promises.writeFile(pr,yr)}async generateCompJson(St){const Dt=this.getCompFullPath(St);const rr=$r.basename(Dt);const cr=this.initCompJson();cr.name=rr;await Er.promises.writeFile($r.join(Dt,$i.KEYS.COMP_CONFIG_FILENAME),JSON.stringify(cr,null,4))}async getCompDep(St){const{cwd:Dt}=this.configService.comphubConfig();const rr=this.getCompFullPath(St);const cr=await this.depsService.getModuleEntry(rr,Dt);return cr}async getCompFileHash(St){const{compPath:Dt}=St;const rr=this.getCompFullPath(Dt);const cr=await this.getCompFeatures(rr);return{compHash:cr.compHash}}async checkCompRepeat(St){const{compPath:Dt,teamId:rr}=St;const cr=this.getCompFullPath(Dt);const pr=await this.getCompFeatures(cr);const mr=await Ni.remoteApi.v1Comp.compcontrollerCheckcompexistbyhash(pr,{headers:{"team-id":rr}});return mr.data}async submitComp(St){let Dt="";let rr={};try{const{compPath:cr,dep:pr,previewConfigs:mr,desc:gr,bgColor:yr,name:Sr,teamId:$r,tags:Er,framework:Ir}=St;rr={"team-id":$r};this.checkCompJson(cr);const Or=this.getCompFullPath(cr);const Hr=await this.getCompFeatures(Or);this.checkCompEntryIndex(Or,Ir);const Gr=await this.readCompVersion(Or);const Tn=await this.getCompFileList(Or);const Wn=Tn.reduce(((St,Dt)=>St+Dt.size),0);this.checkCompFileNum(Tn.length);this.checkCompFileSize(Wn);this.checkCompSingleFileSize(Tn);const Gn={name:Sr,dep:pr,previewConfigs:mr,desc:gr,version:Gr,size:Wn,files:Tn,bgColor:yr,compFeatures:Hr,tags:Er};const mi=await Ni.remoteApi.v1Comp.compcontrollerUpload(Gn,{headers:rr});const ki=mi.data._id;Dt=ki;await this.updateCompJson(cr,(St=>({...St,name:Sr,[$i.KEYS.COMP_FIELD_COMP_ID]:ki})));const{data:{componentDir:Ri}}=await Ni.remoteApi.v1Oss.osscontrollerCompossdir();const Vi=await Ni.remoteApi.v1Oss.osscontrollerPutpolicy({type:Ri});const ji={compFullPath:Or,version:Gr,ossData:Vi.data};await this.uploadCompFolderToOss(ji);const{key:Ui}=Vi.data;const zi={compId:ki,objectId:`${Ri}${Ui}`};await Ni.remoteApi.v1Comp.compcontrollerUpdateobjectid(zi)}catch(St){if(Dt){await Ni.remoteApi.v1Comp.compcontrollerDeletefailedcomp({compId:Dt},{headers:rr})}if(St instanceof Sr.httpError.BadRequestError){throw new Sr.httpError.BadRequestError(St)}throw new Error(St.message)}}async updateComp(St){const{compId:Dt,compPath:rr,dep:cr,previewConfigs:pr,desc:mr,bgColor:gr,name:yr,upgradeDesc:Sr,teamId:Ir,tags:Or,framework:Hr}=St;const Gr=this.getCompFullPath(rr);const Tn=await this.getCompFeatures(Gr);this.checkCompEntryIndex(Gr,Hr);const Wn=await Ni.remoteApi.v1Comp.compcontrollerCompdetail({compId:Dt});const{objectId:Gn,version:mi}=Wn.data;const ki=await this.readCompVersion(Gr);const Ri=await this.getCompFileList(Gr);const Vi=Ri.reduce(((St,Dt)=>St+Dt.size),0);this.checkCompFileNum(Ri.length);this.checkCompFileSize(Vi);this.checkCompSingleFileSize(Ri);const ji={compId:Dt,name:yr,dep:cr,previewConfigs:pr,desc:mr,version:ki,size:Vi,files:Ri,bgColor:gr,compFeatures:Tn,upgradeDesc:Sr,tags:Or};const Ui=await Ni.remoteApi.v1Comp.compcontrollerUpdate(ji,{headers:{"team-id":Ir}});const{isFileChange:zi}=Ui.data;if(!zi&&mi===ki){const St=$r.join(Gr,$i.KEYS.COMP_SCREENSHOT_MINI_FILENAME);if(Er.existsSync(St)){const Dt=await Ni.remoteApi.v1Oss.osscontrollerCompossdir();const rr=await Ni.remoteApi.v1Oss.osscontrollerPutpolicy({type:Dt.data.componentDir});const cr=Gn.replace(rr.data.dir,"");const pr=$r.join(cr,ki,$i.KEYS.COMP_SCREENSHOT_MINI_FILENAME).replace(/\\/g,"/");const mr=Er.createReadStream(St);const gr={...rr.data,key:pr};await this.ossService.uploadFileToOss(gr,mr,true)}return}const Ki=await Ni.remoteApi.v1Oss.osscontrollerCompossdir();const{componentDir:Xi}=Ki.data;const Yi=await Ni.remoteApi.v1Oss.osscontrollerPutpolicy({type:Xi});const xa=Gn.replace(Yi.data.dir,"");const Ta={...Yi.data,key:xa};const wa={compFullPath:Gr,version:ki,ossData:Ta};await this.uploadCompFolderToOss(wa);await this.updateCompJson(rr,(St=>({...St,name:yr,[$i.KEYS.COMP_FIELD_COMP_ID]:Dt})))}async downloadComp(St){const{compId:Dt,savePath:rr,isCover:cr,compName:pr,version:mr}=St;const{srcPath:gr}=this.configService.comphubConfig();const yr=$i.KEYS.FILE_MANAGER_DIRNAME;const Ir=rr.replace(yr,"").replace(/[/\\]/g,$r.sep);const Or=$r.join(gr,Ir,pr);if(!cr&&Er.existsSync(Or)){return{isRepeat:true}}const Hr=Gr.tmpdir();const Gn=$r.join(Hr,$i.KEYS.COMP_TEMP_DIR);this.ctx.logger.debug("组件下载到临时目录",Gn);const mi=await Ni.remoteApi.v1Comp.compcontrollerCompdetail({compId:Dt,version:mr});if(!mi?.data){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compNotExist"))}const{files:ki,objectId:Ri,name:Vi}=mi.data;let ji=[];const Ui=$r.join(Gn,Ri,mr);if(Er.existsSync(Ui)){const{files:St}=await Wn.fileTree.generateTree(Ui);ji=St}await Ni.remoteApi.v1Comp.compcontrollerUpdatecompdownloadcount({compId:Dt,version:mr});if(ki.length===ji.length){const St=ji.find((({absolutePath:St})=>St.replace(Ui,"").startsWith(`${$r.sep}${$i.KEYS.COMP_CONFIG_FILENAME}`)));if(St){const Dt=await Er.promises.readFile(St.absolutePath,"utf8");const rr=JSON.parse(Dt);const{name:cr}=rr;if(Vi===cr){await Tn.copy(Ui,Or);this.ctx.logger.debug("组件缓存文件和服务器文件一致,直接使用缓存文件");return}}}const zi=ki.map((St=>{const Dt=$r.join(Ri,mr,St.path);return{path:Dt.replace(/[/\\]/g,"/")}}));const Ki=await this.ossService.getDownloadSts();await this.ossService.downloadFileToPath(Ki,zi,Gn);const Xi=$r.join(Gn,Ri,mr);await Tn.copy(Xi,Or)}async getLocalCompsByIds(St){const{srcPath:Dt}=this.configService.comphubConfig();const rr=await this.findCompJsonPath(Dt);this.ctx.logger.debug("组件文件数量:",rr.length);const cr=rr.map((async({absolutePath:St})=>{const Dt=await Er.promises.readFile(St,"utf8");const rr=JSON.parse(Dt);return{...rr,path:$r.dirname(St)}}));const pr=await Promise.all(cr);const mr=pr.filter((Dt=>St.includes(Dt[$i.KEYS.COMP_FIELD_COMP_ID])));if(!mr){return[]}const gr=$i.KEYS.FILE_MANAGER_DIRNAME;const yr=new RegExp(ki.textKit.escapeRegExp($r.sep),"g");const Sr=mr.map((St=>{const rr=St.path.replace(Dt,"").replace(yr,"/").slice(1);return{id:St[$i.KEYS.COMP_FIELD_COMP_ID],path:gr+rr,fullPath:St.path,fullPathHash:Wn.digest.getStringHash(St.path),basename:$r.basename(St.path)}}));return Sr}async getCompFilesOssSignedUrl(St){const{version:Dt,objectId:rr,files:cr}=St;const pr=await this.ossService.getDownloadSts();const mr=cr.map((async St=>{const cr=$r.join(rr,Dt,St);const mr=await this.ossService.getFilePreviewUrl(pr,cr.replace(/[/\\]/g,"/"));return{path:St,signedUrl:mr}}));const gr=await Promise.all(mr);return{signedUrls:gr}}async getPackageJsonContent(){const St=this.configService.comphubConfig();const Dt=$r.join(St.cwd,"package.json");return await Wn.fileSys.readJsonFile(Dt)}async getLocalComps(St){const{page:Dt=1,pageSize:rr=10}=St;const{srcPath:cr}=this.configService.comphubConfig();const pr=await this.getAllLocalCompIds();const mr=pr.map((St=>({id:St.compjson[$i.KEYS.COMP_FIELD_COMP_ID],pathHash:St.pathHash})));mr.sort(((St,Dt)=>St.id.localeCompare(Dt.id)));const gr=[...new Set(mr.map((St=>St.id)))];const yr=await Ni.remoteApi.v1Comp.compcontrollerExistcompsbyids({compIds:gr});const{ids:Er=[]}=yr.data;const Ir=mr.filter((St=>Er.includes(St.id)));const Or=Ir.length;const Hr=Ir.slice((Dt-1)*rr,Dt*rr);const Gr=new Map(pr.map((St=>[`${St.compjson[$i.KEYS.COMP_FIELD_COMP_ID]}_${St.pathHash}`,St])));const Tn=await Ni.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:Hr.map((St=>St.id))});const{rows:Gn=[]}=Tn.data;const mi=new Map(Gn.map((St=>[St._id,St])));const Ri=new RegExp(ki.textKit.escapeRegExp($r.sep),"g");const Vi=$i.KEYS.FILE_MANAGER_DIRNAME;const ji=Hr.map((async({id:St,pathHash:Dt})=>{const rr=Gr.get(`${St}_${Dt}`);const pr=mi.get(St);if(!pr||!rr){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithIdNotExist",{args:[St]}))}const mr=rr.compPath.replace(cr,"").replace(Ri,"/").slice(1);return{_id:Wn.digest.getStringHash(rr.compPath),name:pr.name,compId:St,version:rr.compjson.version,path:Vi+mr,previewConfigs:pr.previewConfigs,bgColor:pr.bgColor,fullPath:rr.compPath}}));const Ui=await Promise.all(ji);return{total:Or,page:Dt,pageSize:rr,rows:Ui}}async getLocalCompDetailByPathHash(St){const{fullPathHash:Dt}=St;const rr=await this.getAllLocalCompIds();const cr=rr.find((St=>St.pathHash===Dt));if(!cr){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithPathNotExist",{args:[Dt]}))}const{srcPath:pr}=this.configService.comphubConfig();const mr=cr.compjson[$i.KEYS.COMP_FIELD_COMP_ID];const{version:gr}=cr.compjson;const yr=await Ni.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:[mr]});const{rows:Er=[]}=yr.data;const Ir=Er[0];const Or=new RegExp(ki.textKit.escapeRegExp($r.sep),"g");const Hr=$i.KEYS.FILE_MANAGER_DIRNAME;const Gr=cr.compPath.replace(pr,"").replace(Or,"/").slice(1);return{_id:Dt,name:Ir.name,compId:mr,version:gr,path:Hr+Gr,previewConfigs:Ir.previewConfigs,bgColor:Ir.bgColor,fullPath:cr.compPath}}async openCompPathInVscode(St){const{folderPath:Dt,relativeFilePath:rr}=St;await this.commandService.revealInVSCode(Dt,rr)}async writeCompFile(St){const{compPath:Dt,filename:rr,content:cr}=St;const pr=this.getCompFullPath(Dt);const mr=$r.join(pr,rr);Er.writeFileSync(mr,Buffer.from(cr,"base64"))}async renameCompDir(St){const{compPath:Dt,newName:rr}=St;if(!ki.textKit.validateCompName(rr)){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidCompName",{args:[rr]}))}const cr=this.getCompFullPath(Dt);const pr=$r.basename(cr);if(pr===rr)return;const mr=$r.dirname(cr);const gr=$r.join(mr,rr);if(Er.existsSync(gr)){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.dirAlreadyExists",{args:[rr]}))}await Er.promises.rename(cr,gr)}};Dt.CompService=Vi;mr([(0,Sr.App)(),yr("design:type",Object)],Vi.prototype,"app",void 0);mr([(0,Sr.Inject)(),yr("design:type",Ir.ConfigService)],Vi.prototype,"configService",void 0);mr([(0,Sr.Inject)(),yr("design:type",Hr.OssService)],Vi.prototype,"ossService",void 0);mr([(0,Sr.Inject)(),yr("design:type",mi.CommandService)],Vi.prototype,"commandService",void 0);mr([(0,Sr.Inject)(),yr("design:type",Or.DepsService)],Vi.prototype,"depsService",void 0);mr([(0,Sr.Inject)(),yr("design:type",Object)],Vi.prototype,"ctx",void 0);mr([(0,Sr.Inject)(),yr("design:type",Ri.MidwayI18nService)],Vi.prototype,"i18nService",void 0);Dt.CompService=Vi=mr([(0,Sr.Provide)()],Vi)},63366:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.ConfigService=void 0;const Sr=rr(46123);const $r=rr(26815);const Er=gr(rr(16928));let Ir=class ConfigService{comphubConfig(){const St=this.app.getAttr($r.KEYS.COMPHUB_CONFIG_KEY);return St}getGlobalConfig(){const St=this.comphubConfig();const{cwd:Dt,srcPath:rr,version:cr,allowDebug:pr,subPort:mr,projectHash:gr}=St;return{cwd:Dt,srcPath:rr,sep:Er.sep,version:cr,allowDebug:pr,subPort:mr,projectHash:gr}}};Dt.ConfigService=Ir;mr([(0,Sr.App)(),yr("design:type",Object)],Ir.prototype,"app",void 0);Dt.ConfigService=Ir=mr([(0,Sr.Provide)()],Ir)},23086:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.DepsService=void 0;const Sr=rr(46123);const $r=gr(rr(16928));const Er=gr(rr(79896));const Ir=rr(64713);const Or=rr(87518);const Hr=rr(18801);const Gr=rr(26815);const Tn=rr(63366);const Wn=rr(58953);let Gn=class DepsService{async getModuleEntry(St,Dt){const rr=await Or.fileSys.readJsonFile($r.join(Dt,"package.json"));if(!rr){this.ctx.logger.error("未找到 package.json 文件");return[]}const cr=Or.resolver.findDependencyVersion(rr,"vue");const pr=Or.resolver.findDependencyVersion(rr,"react");const mr=await Or.depGraph.detectImports(St,{pathAliases:["@"]});if(cr&&pr){throw new Sr.httpError.BadRequestError("组件同时依赖 vue 和 react,无法确定框架类型")}if(cr){mr.vue={version:cr}}if(pr){mr.react={version:pr};const St=Or.resolver.findDependencyVersion(rr,"react-dom");if(St){const Dt=Number(Hr.versionKit.getMajorVersion(pr));if(Dt>=18){mr["react-dom/client"]={version:St}}else{mr["react-dom"]={version:St}}}}const gr={};for(const[St]of Object.entries(mr)){const cr=Or.resolver.findDependencyVersion(rr,St);const pr={version:cr};const mr=await Or.resolver.findOwningPackage(St,Dt);if(mr){pr.version=mr.version;if(!cr){pr.parent={name:mr.name,version:mr.version}}}gr[St]=pr}return Object.entries(gr).map((([St,Dt])=>({name:St,version:Dt.version,...Dt.parent&&{parent:Dt.parent}})))}async buildTemplateCompiler(St,Dt,rr){const cr=$r.join(Dt,"node_modules","vue-template-compiler","package.json");let pr;try{const Dt=JSON.parse(await Er.promises.readFile(cr,"utf-8"));pr=Dt.version;this.ctx.logger.info(`[buildTemplateCompiler] 找到 vue-template-compiler@${pr},Vue 版本: ${St}`)}catch{throw new Error(`未在 node_modules 中找到 vue-template-compiler,请确保项目已安装: npm install vue-template-compiler@${St}`)}const[mr,gr]=St.split(".").map(Number);const[yr,Sr]=(pr||"").split(".").map(Number);if(mr!==yr||gr!==Sr){this.ctx.logger.warn(`[buildTemplateCompiler] 版本不完全匹配: vue@${St} vs vue-template-compiler@${pr},`+`建议安装匹配版本: npm install vue-template-compiler@${St}`)}const Or=`export * from 'vue-template-compiler';`;const Hr=$r.join(rr,"__compiler_entry__.js");await Er.promises.mkdir(rr,{recursive:true});await Er.promises.writeFile(Hr,Or);const Gr=`vue2-template-compiler-${St.replace(/\./g,"_")}.js`;const Tn=$r.join(rr,Gr);try{await(0,Ir.build)({entryPoints:[Hr],bundle:true,format:"iife",globalName:"VueTemplateCompiler",outfile:Tn,platform:"browser",target:"es2015",absWorkingDir:Dt,nodePaths:[$r.join(Dt,"node_modules")],external:[],sourcemap:false,minify:false});this.ctx.logger.info(`[buildTemplateCompiler] esbuild 构建完成: ${Gr}`)}catch(St){await Er.promises.unlink(Hr).catch((()=>{}));throw new Error(`esbuild 构建 vue-template-compiler 失败: ${St.message}`)}await Er.promises.unlink(Hr).catch((()=>{}));return{fileName:Gr}}async precompileModule(St,Dt,rr){const cr=await Or.fileSys.readJsonFile($r.join(rr,"package.json"));if(!cr){this.ctx.logger.error("未找到 package.json 文件");return{entryNameToFile:{}}}const{entryPoints:pr,skippedModules:mr}=(0,Wn.buildEntryPoints)(Dt,cr,rr);const{entryPoints:gr,mergedPackages:yr}=(0,Wn.mergeSubPathEntries)(pr);for(const[,Dt]of Object.entries(yr)){const rr=(0,Wn.generateMergedWrapper)(Dt.subExportMap);const cr=$r.join(St,`${Dt.entryKey}.js`);gr[Dt.entryKey]=cr;await Er.promises.mkdir($r.dirname(cr),{recursive:true});await Er.promises.writeFile(cr,rr)}await Er.promises.mkdir(St,{recursive:true});const Sr={};for(const[St,Dt]of Object.entries(gr)){if(St.startsWith("__merged__")||Or.resolver.isModuleInstalled(St,rr)){Sr[St]=Dt}}const Hr={};for(const St of mr){Hr[St]=St}const Tn=$r.join(St,Gr.KEYS.META_FILE_NAME);const Gn=await Or.fileSys.readJsonFile(Tn);const{filteredEntryPoints:mi,cachedMappings:$i}=(0,Wn.filterCachedModules)(Sr,Gn);for(const[,Dt]of Object.entries(yr)){const rr=Dt.entryKey;if(Gn?.[rr]){const cr=Gn[rr].file;for(const rr of Dt.wrapperSubPaths){const pr=Dt.subExportMap[rr];const mr=`${pr}-w.js`;const gr=$r.join(St,mr);if(!Er.existsSync(gr)){await Er.promises.writeFile(gr,(0,Wn.generateSubWrapper)(pr,cr))}$i[rr]=mr}$i[rr]=cr}}Object.assign(Hr,$i);if(Object.keys(mi).length===0){return{entryNameToFile:Hr}}const ki={entryPoints:mi,bundle:true,format:"esm",splitting:true,outdir:St,entryNames:"[name]-[hash]",chunkNames:"chunk-[hash]",outExtension:{".js":".js"},metafile:true,write:true,target:"esnext",sourcemap:false,external:["vue","react"],absWorkingDir:rr,nodePaths:[$r.join(rr,"node_modules")]};const Ni=await(0,Ir.build)(ki);const{optimized:Ri,entryNameToFile:Vi}=(0,Wn.analyzeBuildOutputs)(Ni,mi,St);for(const[,Dt]of Object.entries(yr)){const rr=Dt.entryKey;if(!(rr in mi))continue;const cr=Vi[rr];if(!cr)continue;for(const rr of Dt.wrapperSubPaths){const pr=Dt.subExportMap[rr];const mr=`${pr}-w.js`;const gr=$r.join(St,mr);await Er.promises.writeFile(gr,(0,Wn.generateSubWrapper)(pr,cr));Vi[rr]=mr}}const ji={...Gn,...Ri};await(0,Wn.saveBuildMetadata)(Tn,ji);return{entryNameToFile:{...Hr,...Vi}}}};Dt.DepsService=Gn;mr([(0,Sr.App)(),yr("design:type",Object)],Gn.prototype,"app",void 0);mr([(0,Sr.Inject)(),yr("design:type",Object)],Gn.prototype,"ctx",void 0);mr([(0,Sr.Inject)(),yr("design:type",Tn.ConfigService)],Gn.prototype,"configService",void 0);Dt.DepsService=Gn=mr([(0,Sr.Provide)()],Gn)},85984:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.ModuleService=void 0;const Sr=rr(46123);const $r=rr(63366);const Er=rr(23086);const Ir=gr(rr(16928));const Or=rr(87518);const Hr=gr(rr(79896));const Gr=rr(26815);let Tn=class ModuleService{async getPreBuildModuleDir(){const{cwd:St}=this.configService.comphubConfig();const Dt=Ir.join(St,Gr.KEYS.PREBUILD_MODULE_DIR);await Hr.promises.mkdir(Dt,{recursive:true});return Dt}async preBuild(St){const Dt=await this.getPreBuildModuleDir();const{cwd:rr}=this.configService.comphubConfig();return await this.depsService.precompileModule(Dt,St,rr)}async buildTemplateCompiler(St){const Dt=await this.getPreBuildModuleDir();const{cwd:rr}=this.configService.comphubConfig();return await this.depsService.buildTemplateCompiler(St,rr,Dt)}async preBuildSize(){const St=await this.getPreBuildModuleDir();return await Or.fileSys.dirSize(St)}async clearPreBuild(){const St=await this.getPreBuildModuleDir();await Hr.promises.rm(St,{recursive:true,force:true})}};Dt.ModuleService=Tn;mr([(0,Sr.Inject)(),yr("design:type",$r.ConfigService)],Tn.prototype,"configService",void 0);mr([(0,Sr.Inject)(),yr("design:type",Er.DepsService)],Tn.prototype,"depsService",void 0);mr([(0,Sr.App)(),yr("design:type",Object)],Tn.prototype,"app",void 0);Dt.ModuleService=Tn=mr([(0,Sr.Provide)()],Tn)},80799:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var Sr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.OssService=void 0;const $r=rr(46123);const Er=Sr(rr(54504));const Ir=Sr(rr(12593));const Or=Sr(rr(18451));const Hr=gr(rr(16928));const Gr=gr(rr(79896));const Tn=rr(96955);const Wn=rr(4990);const Gn=Sr(rr(26506));const mi=Sr(rr(23046));const $i=rr(45853);const ki=rr(26815);const Ni=rr(68255);let Ri=class OssService{createOssClient(St){const Dt={endpoint:ki.KEYS.OSS_CUSTOM_DOMAIN,authorizationV4:true,cname:true,...St};return new Or.default(Dt)}getContentTypeWithCharset(St){const Dt=Hr.extname(St).toLowerCase();const rr={".css":"text/css; charset=utf-8",".js":"application/javascript; charset=utf-8",".mjs":"application/javascript; charset=utf-8",".cjs":"application/javascript; charset=utf-8",".ts":"text/typescript; charset=utf-8",".tsx":"text/typescript; charset=utf-8",".jsx":"text/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".html":"text/html; charset=utf-8",".htm":"text/html; charset=utf-8",".vue":"text/plain; charset=utf-8",".md":"text/markdown; charset=utf-8",".svg":"image/svg+xml; charset=utf-8",".xml":"application/xml; charset=utf-8",".scss":"text/css; charset=utf-8",".sass":"text/css; charset=utf-8",".less":"text/css; charset=utf-8"};return rr[Dt]}createOssFormData(St,Dt,rr=false){const cr=new Er.default;const pr=St.dir+St.key;cr.append("success_action_status","200");cr.append("policy",St.policy);cr.append("x-oss-signature",St.signature);cr.append("x-oss-signature-version",St.x_oss_signature_version);cr.append("x-oss-credential",St.x_oss_credential);cr.append("x-oss-date",St.x_oss_date);cr.append("key",pr);cr.append("x-oss-security-token",St.security_token);cr.append("x-oss-forbid-overwrite",rr?"false":"true");cr.append("Cache-Control","public, max-age=31536000");const mr={};const gr=Dt.path?.toString();if(gr){const St=this.getContentTypeWithCharset(gr);if(St){mr.contentType=St}}cr.append("file",Dt,mr);return{host:St.host,filePath:pr,formData:cr}}async getDownloadSts(){const St=await this.cache.get(ki.KEYS.CACHE_KEY_STS_TOKEN);if(St){return St}const Dt=await Wn.remoteApi.v1Oss.osscontrollerGetsts();const rr=new Date(Dt.data.Expiration).getTime()-1*60*1e3;await this.cache.set(ki.KEYS.CACHE_KEY_STS_EXPIRE_TIME,rr);const cr=rr-Date.now();this.ctx.logger.debug("STS过期时间",(0,mi.default)(rr).format("YYYY-MM-DD HH:mm:ss"));this.cache.set(ki.KEYS.CACHE_KEY_STS_TOKEN,Dt.data,cr);return Dt.data}async uploadFileToOss(St,Dt,rr=false){const{host:cr,formData:pr}=this.createOssFormData(St,Dt,rr);const mr=await Ir.default.post(cr,pr,{headers:{...pr.getHeaders()}}).catch((async St=>{const Dt=St.response.data;const rr=await(0,$i.parseStringPromise)(Dt);if(rr?.Error){throw new $r.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[rr.Error.Message]}))}throw new $r.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[St.message||St]}))}));if(mr.status!==200){throw new $r.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[mr.data]}))}}async downloadFileToPath(St,Dt,rr){const cr=this.createOssClient({region:St.region,accessKeyId:St.AccessKeyId,accessKeySecret:St.AccessKeySecret,stsToken:St.SecurityToken,bucket:St.bucket,refreshSTSToken:async()=>{const St=await this.getDownloadSts();return{accessKeyId:St.AccessKeyId,accessKeySecret:St.AccessKeySecret,stsToken:St.SecurityToken}}});const pr=Dt.map((async St=>{const{path:Dt}=St;const pr=Hr.join(rr,Dt);const mr=Hr.dirname(pr);if(!Gr.existsSync(mr)){Gr.mkdirSync(mr,{recursive:true})}return await cr.get(Dt,pr)}));return await Promise.all(pr)}async getFilePreviewUrl(St,Dt){const rr=(0,Gn.default)(Dt);const cr=await this.cache.get(ki.KEYS.CACHE_KEY_STS_EXPIRE_TIME);const pr=await this.cache.get(rr);const mr=Math.floor((Number(cr)-Date.now())/1e3);this.ctx.logger.debug("文件地址过期时间:",mr,"秒",Math.floor(mr/60),"分钟");if(pr&&mr>0){return pr}const gr=this.createOssClient({region:St.region,accessKeyId:St.AccessKeyId,accessKeySecret:St.AccessKeySecret,stsToken:St.SecurityToken,bucket:St.bucket,refreshSTSToken:async()=>{const St=await this.getDownloadSts();return{accessKeyId:St.AccessKeyId,accessKeySecret:St.AccessKeySecret,stsToken:St.SecurityToken}}});this.ctx.logger.debug("文件地址过期时间:",mr,"秒",Math.floor(mr/60),"分钟");const yr=gr.signatureUrl(Dt,{expires:mr});await this.cache.set(rr,yr,mr*1e3);this.ctx.logger.debug("缓存预览URL",Dt);return yr}};Dt.OssService=Ri;mr([(0,$r.Inject)(),yr("design:type",Object)],Ri.prototype,"ctx",void 0);mr([(0,$r.InjectClient)(Tn.CachingFactory,"default"),yr("design:type",Object)],Ri.prototype,"cache",void 0);mr([(0,$r.Inject)(),yr("design:type",Ni.MidwayI18nService)],Ri.prototype,"i18nService",void 0);Dt.OssService=Ri=mr([(0,$r.Provide)()],Ri)},5578:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.PreprocessingService=void 0;const mr=rr(46123);const gr=rr(34985);const yr=rr(16165);const Sr=pr(rr(86674));let $r=class PreprocessingService{async preprocessCode(St){const{cssCode:Dt,precompilerType:rr}=St;if(rr===gr.PrecompilerEnum.SASS||rr===gr.PrecompilerEnum.SCSS){const St=(0,yr.compileString)(Dt);return St.css}else if(rr===gr.PrecompilerEnum.LESS){const St=await Sr.default.render(Dt);return St.css}return Dt}};Dt.PreprocessingService=$r;Dt.PreprocessingService=$r=cr([(0,mr.Provide)()],$r)},61275:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.QueueService=void 0;const pr=rr(46123);let mr=class QueueService{constructor(){this.queue=[];this.isProcessing=false}async processQueue(){if(this.isProcessing||this.queue.length===0){return}this.isProcessing=true;const St=this.queue.shift();if(St){await St()}this.isProcessing=false;this.processQueue()}async enqueue(St){return new Promise((Dt=>{this.queue.push((async()=>{try{await St()}finally{Dt()}}));this.processQueue()}))}};Dt.QueueService=mr;Dt.QueueService=mr=cr([(0,pr.Provide)(),(0,pr.Scope)(pr.ScopeEnum.Singleton)],mr)},19452:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var Sr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.TerminalService=void 0;const $r=rr(46123);const Er=rr(35317);const Ir=rr(63366);const Or=gr(rr(1999));const Hr=rr(73024);const Gr=rr(51455);const Tn=rr(87518);const Wn=Sr(rr(44644));let Gn=class TerminalService{constructor(){this.subprocess=null;this.cwd="";this.tabIndex=0}getPrompt(){return`${this.cwd}`}smartDecode(St){if(!St||St.length===0)return"";try{new TextDecoder("utf-8",{fatal:true}).decode(St);return Or.decode(St,"utf-8")}catch{return Or.decode(St,"gbk")}}async folderExists(St){try{await(0,Gr.access)(St,Hr.constants.F_OK|Hr.constants.R_OK);return true}catch{return false}}async shutdown(St=5e3){const Dt=this.subprocess;if(!Dt||Dt.killed){this.ctx.emit("output",{cwd:this.getPrompt()});return}return new Promise((rr=>{let cr=false;const done=()=>{if(!cr){cr=true;rr(0)}};Dt.once("exit",done);(0,Wn.default)(Dt.pid,"SIGTERM",(St=>{if(St){this.ctx.emit("output",{err:St.message})}}));const pr=setTimeout((()=>{(0,Wn.default)(Dt.pid,"SIGKILL",(St=>{if(St){this.ctx.emit("output",{err:St.message})}done()}))}),St);Dt.once("exit",(()=>clearTimeout(pr)))}))}async execCmd({cwd:St,oldCwd:Dt,command:rr}){if(!await this.folderExists(St)){this.ctx.emit("output",{err:`${St} 路径不存在`});this.ctx.emit("output",{cwd:Dt});return}this.cwd=St;if(!rr.trim()){this.ctx.emit("output",{cwd:this.getPrompt()});return}if(rr==="^C"){await this.shutdown();return}this.subprocess=(0,Er.spawn)(rr,{shell:true,cwd:St,stdio:["pipe","pipe","pipe"],detached:false,env:{...process.env,FORCE_COLOR:"3",NPM_CONFIG_COLOR:"always",COLORTERM:"truecolor",TERM:"xterm-256color"}});this.subprocess.stdout?.on("data",(St=>{this.ctx.emit("output",{stdout:this.smartDecode(St)})}));this.subprocess.stderr?.on("data",(St=>{this.ctx.emit("output",{stderr:this.smartDecode(St)})}));this.subprocess.on("close",(()=>{this.subprocess=null;this.ctx.emit("output",{cwd:this.getPrompt(),command:rr})}));this.subprocess.on("error",(St=>{this.ctx.emit("output",{err:St.message})}))}async cmdTab({cwd:St,lastWord:Dt}){let rr=await Tn.fileSys.readDirFiles(St);if(Dt){rr=rr.filter((St=>St.name.startsWith(Dt)))}if(rr.length===0){return}this.tabIndex=(this.tabIndex+1)%rr.length;const cr=rr[this.tabIndex];this.ctx.emit("output",{tab:cr.name})}};Dt.TerminalService=Gn;mr([(0,$r.Inject)(),yr("design:type",Ir.ConfigService)],Gn.prototype,"configService",void 0);mr([(0,$r.Inject)(),yr("design:type",Object)],Gn.prototype,"ctx",void 0);Dt.TerminalService=Gn=mr([(0,$r.Provide)()],Gn)},5808:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var gr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();var yr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.VuefinderService=void 0;const Sr=rr(46123);const $r=gr(rr(16928));const Er=gr(rr(79896));const Ir=rr(63366);const Or=gr(rr(93900));const Hr=rr(26815);let Gr=class VuefinderService{async list({path:St}){const Dt=this.configService.comphubConfig();const{srcPath:rr}=Dt;const cr=St?.replace(Hr.KEYS.FILE_MANAGER_DIRNAME,"")||"";let pr=$r.join(rr,cr);const mr=await Er.promises.access(pr).then((()=>true)).catch((()=>false));if(!mr){pr=rr;St=Hr.KEYS.FILE_MANAGER_DIRNAME}const gr=await Er.promises.readdir(pr);const yr=gr.map((async Dt=>{const rr=$r.join(pr,Dt);const cr=await Er.promises.stat(rr);const mr=cr.isDirectory();const gr=St===Hr.KEYS.FILE_MANAGER_DIRNAME?`${St}${Dt}`:`${St}/${Dt}`;return{type:mr?"dir":"file",path:gr,file_size:cr.size,visibility:"public",last_modified:Math.floor(cr.mtimeMs/1e3),basename:Dt,extension:mr?"":$r.extname(Dt).slice(1),mime_type:Or.lookup(Dt)||""}}));const Sr=await Promise.all(yr);Sr.sort(((St,Dt)=>{if(St.type==="dir"&&Dt.type==="file"){return-1}else if(St.type==="file"&&Dt.type==="dir"){return 1}else{return 0}}));return{storages:gr,dirname:St,files:Sr}}};Dt.VuefinderService=Gr;mr([(0,Sr.App)(),yr("design:type",Object)],Gr.prototype,"app",void 0);mr([(0,Sr.Inject)(),yr("design:type",Ir.ConfigService)],Gr.prototype,"configService",void 0);Dt.VuefinderService=Gr=mr([(0,Sr.Provide)()],Gr)},66593:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.TerminalSocketController=void 0;const mr=rr(46123);const gr=rr(19452);let yr=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(St){this.terminalService.execCmd(St)}async onTab(St){this.terminalService.cmdTab(St)}};Dt.TerminalSocketController=yr;cr([(0,mr.Inject)(),pr("design:type",Object)],yr.prototype,"ctx",void 0);cr([(0,mr.Inject)(),pr("design:type",gr.TerminalService)],yr.prototype,"terminalService",void 0);cr([(0,mr.OnWSConnection)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],yr.prototype,"onConnection",null);cr([(0,mr.OnWSDisConnection)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],yr.prototype,"onDisConnection",null);cr([(0,mr.OnWSMessage)("command"),pr("design:type",Function),pr("design:paramtypes",[Object]),pr("design:returntype",Promise)],yr.prototype,"onCommand",null);cr([(0,mr.OnWSMessage)("tab"),pr("design:type",Function),pr("design:paramtypes",[Object]),pr("design:returntype",Promise)],yr.prototype,"onTab",null);Dt.TerminalSocketController=yr=cr([(0,mr.WSController)("/terminal")],yr)},58953:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__setModuleDefault||(Object.create?function(St,Dt){Object.defineProperty(St,"default",{enumerable:true,value:Dt})}:function(St,Dt){St["default"]=Dt});var mr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var Dt=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))Dt[Dt.length]=rr;return Dt};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var Dt={};if(St!=null)for(var rr=ownKeys(St),mr=0;mr<rr.length;mr++)if(rr[mr]!=="default")cr(Dt,St,rr[mr]);pr(Dt,St);return Dt}}();Object.defineProperty(Dt,"__esModule",{value:true});Dt.analyzeBuildOutputs=analyzeBuildOutputs;Dt.saveBuildMetadata=saveBuildMetadata;Dt.filterCachedModules=filterCachedModules;Dt.buildEntryPoints=buildEntryPoints;Dt.mergeSubPathEntries=mergeSubPathEntries;Dt.generateMergedWrapper=generateMergedWrapper;Dt.generateSubWrapper=generateSubWrapper;const gr=mr(rr(16928));const yr=mr(rr(79896));const Sr=rr(87518);const $r=rr(18801);const Er=rr(26815);function resolveModuleEntry(St,Dt){if(St!=="vue")return St;const rr=$r.versionKit.getMajorVersion(Dt);return rr==="3"?Er.KEYS.VUE_ESM_BUNDLER:St}function extractModuleName(St){const Dt=St.slice(0,-12);return gr.basename(Dt)}function matchEntryKey(St,Dt){return St.find((St=>{const rr=St.split("/");const cr=rr.length===1?rr[0]:rr[rr.length-1];return Dt===cr}))}function analyzeBuildOutputs(St,Dt,rr){const cr={};const pr={};const mr=Object.keys(Dt);const $r=St.metafile?.outputs??{};for(const[St,Dt]of Object.entries($r)){if(!Dt.entryPoint)continue;const $r=gr.basename(St);const Er=extractModuleName(St);const Ir=matchEntryKey(mr,Er);if(!Ir)continue;pr[Ir]=$r;const Or=gr.join(rr,$r);const Hr=yr.readFileSync(Or,"utf-8");const Gr=Sr.digest.getStringHash(Hr).slice(0,8);cr[Ir]={src:Dt.entryPoint,file:$r,fileHash:Gr,needsInterop:false}}return{optimized:cr,entryNameToFile:pr}}async function saveBuildMetadata(St,Dt){await yr.promises.writeFile(St,JSON.stringify(Dt,null,2))}function filterCachedModules(St,Dt){if(!Dt){return{filteredEntryPoints:St,cachedMappings:{}}}const rr={};const cr={};for(const[pr,mr]of Object.entries(St)){if(Dt[pr]){cr[pr]=Dt[pr].file}else{rr[pr]=mr}}return{filteredEntryPoints:rr,cachedMappings:cr}}function buildEntryPoints(St,Dt,rr){const cr={};const pr=[];for(const mr of St){if(Sr.resolver.shouldSkipByExtension(mr)){pr.push(mr);continue}const St=Sr.resolver.findDependencyVersion(Dt,mr);if(!St){const St=Sr.resolver.findOwningPackage(mr,rr);if(!St)continue}cr[mr]=resolveModuleEntry(mr,St)}return{entryPoints:cr,skippedModules:pr}}function extractPackageName(St){if(St.startsWith("@")){const Dt=St.split("/");return Dt.slice(0,2).join("/")}return St.split("/")[0]}function toSafeIdentifier(St){return St.replace(/\.js$/,"").replace(/[./]/g,"_")}function mergeSubPathEntries(St){const Dt={};const rr={};for(const[cr,pr]of Object.entries(St)){const St=extractPackageName(cr);if(cr!==St){if(!Dt[St])Dt[St]={};Dt[St][cr]=pr}else{rr[cr]=pr}}const cr={};for(const[St,pr]of Object.entries(Dt)){const Dt=Object.keys(pr);if(Dt.length<=1){Object.assign(rr,pr);continue}if(rr[St]){pr[St]=rr[St];delete rr[St]}const mr=`__merged__${St}`;const gr={};const yr=[];for(const St of Object.keys(pr)){const Dt=toSafeIdentifier(St);gr[St]=Dt;yr.push(St)}rr[mr]=mr;cr[St]={entryKey:mr,subExportMap:gr,wrapperSubPaths:yr}}return{entryPoints:rr,mergedPackages:cr}}function generateMergedWrapper(St){const Dt=[];const rr=[];const cr=[];const pr=new Set;for(const[mr,gr]of Object.entries(St)){if(pr.has(gr))continue;pr.add(gr);const St=`__imp_${gr}`;Dt.push(`import * as ${St} from '${mr}';`);rr.push(`export const ${gr} = ${St}.default || Object.assign({}, ${St});`);cr.push(`export * from '${mr}';`)}return["// Auto-generated by comp-hub: merged entry for esbuild",...Dt,...rr,...cr,""].join("\n")}function generateSubWrapper(St,Dt){return[`// Auto-generated: sub-wrapper for ${St}`,`export { ${St} as default } from './${Dt}';`,`export * from './${Dt}';`,""].join("\n")}},49969:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.getErrorMessage=getErrorMessage;function getErrorMessage(St){if(St instanceof Error)return St.message;if(typeof St==="string")return St;return String(St)}},4145:function(St,Dt,rr){"use strict";var cr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.waitForIpcConfig=waitForIpcConfig;const pr=cr(rr(16928));const mr=rr(26815);function parseCwdArg(St){for(let Dt=0;Dt<St.length;Dt++){if(St[Dt]==="--cwd"&&Dt+1<St.length){return St[Dt+1]}if(St[Dt].startsWith("--cwd=")){return St[Dt].replace("--cwd=","")}}return undefined}function waitForIpcConfig(){const St=parseCwdArg(process.argv);if(St){return Promise.resolve({type:"config",port:0,cwd:pr.default.resolve(St),allowDebug:process.env.MIDWAY_SERVER_ENV===mr.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}if(process.send){return new Promise(((St,Dt)=>{const rr=setTimeout((()=>{Dt(new Error("No IPC config received within 10s. MidwayJS must be started by master via fork."))}),1e4);process.once("message",(Dt=>{if(Dt?.type==="config"){clearTimeout(rr);St(Dt)}}))}))}return Promise.resolve({type:"config",port:0,cwd:process.cwd(),allowDebug:process.env.MIDWAY_SERVER_ENV===mr.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}},10778:function(St,Dt,rr){"use strict";var cr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.remoteInstance=Dt.setHeader=void 0;const pr=rr(42552);const mr=rr(26815);const gr=cr(rr(65692));const yr=(0,pr.initInstance)(mr.KEYS.REMOTE_SERVICE_PREFIX,{timeout:1e4,httpsAgent:new gr.default.Agent({rejectUnauthorized:false})},(St=>St.replace(mr.KEYS.REMOTE_SERVICE_PREFIX,"")));Dt.remoteInstance=yr;let Sr=null;const setHeader=St=>{Sr=St};Dt.setHeader=setHeader;yr.interceptors.request.use((St=>{St.headers[mr.KEYS.AUTHORIZATION_HEADER_NAME]=Sr[mr.KEYS.AUTHORIZATION_HEADER_NAME];St.headers[mr.KEYS.CSRF_TOKEN_HEADER_NAME]=Sr[mr.KEYS.CSRF_TOKEN_HEADER_NAME];St.headers[mr.KEYS.ACCEPT_LANGUAGE_HEADER_NAME]=Sr[mr.KEYS.ACCEPT_LANGUAGE_HEADER_NAME.toLowerCase()];St.headers["cookie"]=Sr.cookie;return St}),(St=>Promise.reject(St)));yr.interceptors.response.use((async St=>{if(St.data.code!==0){throw new Error(JSON.stringify(St.data))}return St.data}),(St=>Promise.reject(St)))},67872:function(St,Dt,rr){"use strict";var cr=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(Dt,"__esModule",{value:true});Dt.createKoaProxy=createKoaProxy;const pr=cr(rr(58611));const mr=rr(31855);const gr=new pr.default.Agent({keepAlive:true,keepAliveMsecs:3e4,maxSockets:50,maxFreeSockets:10});const yr=new Map;function getOrCreateSubProxy(St,Dt){const rr=`${St}|${JSON.stringify(Dt)}`;if(!yr.has(rr)){yr.set(rr,(0,mr.createProxyMiddleware)({target:St,changeOrigin:true,secure:false,agent:gr,pathRewrite:Dt,on:{error:St=>{}}}))}return yr.get(rr)}async function createKoaProxy(St,Dt,rr){const cr=getOrCreateSubProxy(Dt,rr);return new Promise(((Dt,rr)=>{St.res.on("finish",Dt);St.res.on("close",Dt);St.res.on("error",rr);cr(St.req,St.res,(St=>{if(St)rr(St);else Dt()}))}))}},101:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.PackageJsonVO=Dt.LocalCompDetailVO=Dt.LocalCompsVO=Dt.CompFileHashVO=Dt.CompSimilarListVO=Dt.CompFilesOssSignedUrlVO=Dt.DownloadCompVO=Dt.LocalCompsByIdsVO=Dt.ImportScanResultVO=Dt.CompCheckVO=Dt.CompFileContentVO=Dt.CompFileVO=Dt.CompSimilarListItemVO=Dt.FileNode=void 0;const mr=rr(49179);const gr=rr(26815);class FileNode{}Dt.FileNode=FileNode;cr([(0,mr.ApiProperty)({description:"目录/文件名称",example:"index.vue",required:true}),pr("design:type",String)],FileNode.prototype,"name",void 0);cr([(0,mr.ApiProperty)({description:"目录/文件路径",example:"/src/components/MyComp/index.vue",required:true}),pr("design:type",String)],FileNode.prototype,"path",void 0);cr([(0,mr.ApiProperty)({description:"目录/文件类型",example:"file",required:true,enum:gr.ENUM.FileType}),pr("design:type",String)],FileNode.prototype,"type",void 0);cr([(0,mr.ApiProperty)({description:"子节点",type:[FileNode]}),pr("design:type",Array)],FileNode.prototype,"children",void 0);class CompSimilarListItemVO{}Dt.CompSimilarListItemVO=CompSimilarListItemVO;cr([(0,mr.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),pr("design:type",String)],CompSimilarListItemVO.prototype,"_id",void 0);cr([(0,mr.ApiProperty)({example:"组件名称",description:"组件名称",required:true}),pr("design:type",String)],CompSimilarListItemVO.prototype,"name",void 0);class CompFileVO{}Dt.CompFileVO=CompFileVO;cr([(0,mr.ApiProperty)({type:FileNode,description:"组件文件树",required:true}),pr("design:type",FileNode)],CompFileVO.prototype,"tree",void 0);cr([(0,mr.ApiProperty)({type:[String],description:"组件文件列表",required:true}),pr("design:type",Array)],CompFileVO.prototype,"files",void 0);class CompFileContentVO{}Dt.CompFileContentVO=CompFileContentVO;cr([(0,mr.ApiProperty)({description:"组件文件内容",example:"let a=123;",required:true}),pr("design:type",String)],CompFileContentVO.prototype,"content",void 0);class CompCheckVO{}Dt.CompCheckVO=CompCheckVO;cr([(0,mr.ApiProperty)({description:"组件入口文件路径",required:false}),pr("design:type",String)],CompCheckVO.prototype,"entryIndexPath",void 0);cr([(0,mr.ApiProperty)({description:"组件配置文件路径",required:false}),pr("design:type",String)],CompCheckVO.prototype,"compJsonPath",void 0);cr([(0,mr.ApiProperty)({description:"异常结果内容",required:true}),pr("design:type",String)],CompCheckVO.prototype,"errorMsg",void 0);class ParentVO{}cr([(0,mr.ApiProperty)({description:"父库名称",required:true,example:"vue"}),pr("design:type",String)],ParentVO.prototype,"name",void 0);cr([(0,mr.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),pr("design:type",String)],ParentVO.prototype,"version",void 0);class ImportDetailVO{}cr([(0,mr.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),pr("design:type",String)],ImportDetailVO.prototype,"name",void 0);cr([(0,mr.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),pr("design:type",String)],ImportDetailVO.prototype,"version",void 0);cr([(0,mr.ApiProperty)({type:ParentVO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),pr("design:type",ParentVO)],ImportDetailVO.prototype,"parent",void 0);class ImportScanResultVO{}Dt.ImportScanResultVO=ImportScanResultVO;cr([(0,mr.ApiProperty)({type:[ImportDetailVO],required:true,description:"第三方库导入详情"}),pr("design:type",Array)],ImportScanResultVO.prototype,"thirdParty",void 0);class CompInfoVO{}cr([(0,mr.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),pr("design:type",String)],CompInfoVO.prototype,"id",void 0);cr([(0,mr.ApiProperty)({description:"组件文件路径",example:"local:///MyComp/index.vue",required:true}),pr("design:type",String)],CompInfoVO.prototype,"path",void 0);cr([(0,mr.ApiProperty)({description:"组件文件名称",example:"base-table",required:true}),pr("design:type",String)],CompInfoVO.prototype,"basename",void 0);cr([(0,mr.ApiProperty)({description:"组件文件完整路径",example:"/src/components/MyComp/index.vue",required:true}),pr("design:type",String)],CompInfoVO.prototype,"fullPath",void 0);cr([(0,mr.ApiProperty)({description:"组件文件完整路径哈希值",example:"123",required:true}),pr("design:type",String)],CompInfoVO.prototype,"fullPathHash",void 0);class LocalCompsByIdsVO{}Dt.LocalCompsByIdsVO=LocalCompsByIdsVO;cr([(0,mr.ApiProperty)({type:[CompInfoVO],required:true}),pr("design:type",Array)],LocalCompsByIdsVO.prototype,"compInfos",void 0);class DownloadCompVO{}Dt.DownloadCompVO=DownloadCompVO;cr([(0,mr.ApiProperty)({description:"组件是否重复",example:true,required:true}),pr("design:type",Boolean)],DownloadCompVO.prototype,"isRepeat",void 0);class SignedUrlItem{}cr([(0,mr.ApiProperty)({description:"文件路径",example:"/src/components/MyComp/index.vue",required:true}),pr("design:type",String)],SignedUrlItem.prototype,"path",void 0);cr([(0,mr.ApiProperty)({description:"文件oss签名访问地址",example:"https://comp-hub.oss-cn-beijing.aliyuncs.com/src/components/MyComp/index.vue?x-oss-security-token=...",required:true}),pr("design:type",String)],SignedUrlItem.prototype,"signedUrl",void 0);class CompFilesOssSignedUrlVO{}Dt.CompFilesOssSignedUrlVO=CompFilesOssSignedUrlVO;cr([(0,mr.ApiProperty)({description:"文件oss签名访问地址列表",type:[SignedUrlItem],required:true}),pr("design:type",Array)],CompFilesOssSignedUrlVO.prototype,"signedUrls",void 0);class CompSimilarListVO{}Dt.CompSimilarListVO=CompSimilarListVO;cr([(0,mr.ApiProperty)({type:[CompSimilarListItemVO],description:"相似组件列表",required:true}),pr("design:type",Array)],CompSimilarListVO.prototype,"similarList",void 0);class CompFileHashVO{}Dt.CompFileHashVO=CompFileHashVO;cr([(0,mr.ApiProperty)({example:"123",description:"组件哈希值",required:true}),pr("design:type",String)],CompFileHashVO.prototype,"compHash",void 0);class PreviewItem{}cr([(0,mr.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"预览配置项主键ID(自动生成)",required:false}),pr("design:type",String)],PreviewItem.prototype,"_id",void 0);cr([(0,mr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),pr("design:type",Array)],PreviewItem.prototype,"miniPath",void 0);cr([(0,mr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),pr("design:type",Array)],PreviewItem.prototype,"fullPath",void 0);cr([(0,mr.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),pr("design:type",String)],PreviewItem.prototype,"desc",void 0);class LocalCompsVO{}Dt.LocalCompsVO=LocalCompsVO;cr([(0,mr.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"内容id,这里用路径哈希值",required:true}),pr("design:type",String)],LocalCompsVO.prototype,"_id",void 0);cr([(0,mr.ApiProperty)({type:String,example:"qin-table",description:"组件名称",required:true}),pr("design:type",String)],LocalCompsVO.prototype,"name",void 0);cr([(0,mr.ApiProperty)({type:String,example:"123456",description:"组件ID",required:true}),pr("design:type",String)],LocalCompsVO.prototype,"compId",void 0);cr([(0,mr.ApiProperty)({type:String,example:"1.0.0",description:"组件版本",required:true}),pr("design:type",String)],LocalCompsVO.prototype,"version",void 0);cr([(0,mr.ApiProperty)({type:[PreviewItem],required:true}),pr("design:type",Array)],LocalCompsVO.prototype,"previewConfigs",void 0);cr([(0,mr.ApiProperty)({type:String,example:"local://components/QinTable",description:"组件文件路径",required:true}),pr("design:type",String)],LocalCompsVO.prototype,"path",void 0);cr([(0,mr.ApiProperty)({type:String,example:"D:/src/components/QinTable/index.vue",description:"组件文件完整路径",required:true}),pr("design:type",String)],LocalCompsVO.prototype,"fullPath",void 0);cr([(0,mr.ApiProperty)({type:String,example:"#f0f0f0",description:"组件背景颜色",required:false}),pr("design:type",String)],LocalCompsVO.prototype,"bgColor",void 0);class LocalCompDetailVO extends LocalCompsVO{}Dt.LocalCompDetailVO=LocalCompDetailVO;class PackageJsonVO{}Dt.PackageJsonVO=PackageJsonVO;cr([(0,mr.ApiProperty)({type:Object,description:"组件package.json文件内容",required:true}),pr("design:type",Object)],PackageJsonVO.prototype,"packageJson",void 0)},71692:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.BuildTemplateCompilerVO=Dt.PreBuildSizeVO=Dt.PreBuildVO=void 0;const mr=rr(49179);class PreBuildVO{}Dt.PreBuildVO=PreBuildVO;cr([(0,mr.ApiProperty)({description:"预构建模块对应文件",required:true,example:{vue:"vue-hash.js"}}),pr("design:type",Object)],PreBuildVO.prototype,"entryNameToFile",void 0);class PreBuildSizeVO{}Dt.PreBuildSizeVO=PreBuildSizeVO;cr([(0,mr.ApiProperty)({description:"预构建模块文件总大小",required:true,example:1024}),pr("design:type",Number)],PreBuildSizeVO.prototype,"size",void 0);class BuildTemplateCompilerVO{}Dt.BuildTemplateCompilerVO=BuildTemplateCompilerVO;cr([(0,mr.ApiProperty)({description:"vue-template-compiler 浏览器 bundle 文件名,通过 /_module_load_prefix_/ 前缀加载",required:true,example:"vue2-template-compiler-2_6_14.js"}),pr("design:type",String)],BuildTemplateCompilerVO.prototype,"fileName",void 0)},75049:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SignedUrlVO=void 0;const mr=rr(49179);class SignedUrlVO{}Dt.SignedUrlVO=SignedUrlVO;cr([(0,mr.ApiProperty)({example:"xxxx",description:"带签名的访问地址",required:true}),pr("design:type",String)],SignedUrlVO.prototype,"signUrl",void 0)},18922:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.PreprocessedCodeVO=void 0;const mr=rr(49179);class PreprocessedCodeVO{}Dt.PreprocessedCodeVO=PreprocessedCodeVO;cr([(0,mr.ApiProperty)({description:"预处理后的css代码",required:true}),pr("design:type",String)],PreprocessedCodeVO.prototype,"preprocessedCode",void 0)},15798:(St,Dt)=>{"use strict";const rr={suspectRx:/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*\:/};Dt.parse=function(St,...cr){const pr=typeof cr[0]==="object"&&cr[0];const mr=cr.length>1||!pr?cr[0]:undefined;const gr=cr.length>1&&cr[1]||pr||{};const yr=JSON.parse(St,mr);if(gr.protoAction==="ignore"){return yr}if(!yr||typeof yr!=="object"){return yr}if(!St.match(rr.suspectRx)){return yr}Dt.scan(yr,gr);return yr};Dt.scan=function(St,Dt={}){let rr=[St];while(rr.length){const St=rr;rr=[];for(const cr of St){if(Object.prototype.hasOwnProperty.call(cr,"__proto__")){if(Dt.protoAction!=="remove"){throw new SyntaxError("Object contains forbidden prototype property")}delete cr.__proto__}for(const St in cr){const Dt=cr[St];if(Dt&&typeof Dt==="object"){rr.push(cr[St])}}}}};Dt.safeParse=function(St,rr){try{return Dt.parse(St,rr)}catch(St){return null}}},35522:(St,Dt,rr)=>{"use strict";const cr=rr(99583);const pr=rr(43700);const mr=rr(66621);const gr=rr(69322);const yr={};St.exports=function(St,Dt,rr={}){cr(St&&typeof St==="object","Invalid defaults value: must be an object");cr(!Dt||Dt===true||typeof Dt==="object","Invalid source value: must be true, falsy or an object");cr(typeof rr==="object","Invalid options: must be an object");if(!Dt){return null}if(rr.shallow){return yr.applyToDefaultsWithShallow(St,Dt,rr)}const gr=pr(St);if(Dt===true){return gr}const Sr=rr.nullOverride!==undefined?rr.nullOverride:false;return mr(gr,Dt,{nullOverride:Sr,mergeArrays:false})};yr.applyToDefaultsWithShallow=function(St,Dt,rr){const Sr=rr.shallow;cr(Array.isArray(Sr),"Invalid keys");const $r=new Map;const Er=Dt===true?null:new Set;for(let rr of Sr){rr=Array.isArray(rr)?rr:rr.split(".");const cr=gr(St,rr);if(cr&&typeof cr==="object"){$r.set(cr,Er&&gr(Dt,rr)||cr)}else if(Er){Er.add(rr)}}const Ir=pr(St,{},$r);if(!Er){return Ir}for(const St of Er){yr.reachCopy(Ir,Dt,St)}const Or=rr.nullOverride!==undefined?rr.nullOverride:false;return mr(Ir,Dt,{nullOverride:Or,mergeArrays:false})};yr.reachCopy=function(St,Dt,rr){for(const St of rr){if(!(St in Dt)){return}const rr=Dt[St];if(typeof rr!=="object"||rr===null){return}Dt=rr}const cr=Dt;let pr=St;for(let St=0;St<rr.length-1;++St){const Dt=rr[St];if(typeof pr[Dt]!=="object"){pr[Dt]={}}pr=pr[Dt]}pr[rr[rr.length-1]]=cr}},99583:(St,Dt,rr)=>{"use strict";const cr=rr(16443);const pr={};St.exports=function(St,...Dt){if(St){return}if(Dt.length===1&&Dt[0]instanceof Error){throw Dt[0]}throw new cr(Dt)}},43700:(St,Dt,rr)=>{"use strict";const cr=rr(69322);const pr=rr(99704);const mr=rr(87492);const gr={needsProtoHack:new Set([pr.set,pr.map,pr.weakSet,pr.weakMap])};St.exports=gr.clone=function(St,Dt={},rr=null){if(typeof St!=="object"||St===null){return St}let cr=gr.clone;let yr=rr;if(Dt.shallow){if(Dt.shallow!==true){return gr.cloneWithShallow(St,Dt)}cr=St=>St}else if(yr){const Dt=yr.get(St);if(Dt){return Dt}}else{yr=new Map}const Sr=pr.getInternalProto(St);if(Sr===pr.buffer){return Buffer&&Buffer.from(St)}if(Sr===pr.date){return new Date(St.getTime())}if(Sr===pr.regex){return new RegExp(St)}const $r=gr.base(St,Sr,Dt);if($r===St){return St}if(yr){yr.set(St,$r)}if(Sr===pr.set){for(const rr of St){$r.add(cr(rr,Dt,yr))}}else if(Sr===pr.map){for(const[rr,pr]of St){$r.set(rr,cr(pr,Dt,yr))}}const Er=mr.keys(St,Dt);for(const rr of Er){if(rr==="__proto__"){continue}if(Sr===pr.array&&rr==="length"){$r.length=St.length;continue}const mr=Object.getOwnPropertyDescriptor(St,rr);if(mr){if(mr.get||mr.set){Object.defineProperty($r,rr,mr)}else if(mr.enumerable){$r[rr]=cr(St[rr],Dt,yr)}else{Object.defineProperty($r,rr,{enumerable:false,writable:true,configurable:true,value:cr(St[rr],Dt,yr)})}}else{Object.defineProperty($r,rr,{enumerable:true,writable:true,configurable:true,value:cr(St[rr],Dt,yr)})}}return $r};gr.cloneWithShallow=function(St,Dt){const rr=Dt.shallow;Dt=Object.assign({},Dt);Dt.shallow=false;const pr=new Map;for(const Dt of rr){const rr=cr(St,Dt);if(typeof rr==="object"||typeof rr==="function"){pr.set(rr,rr)}}return gr.clone(St,Dt,pr)};gr.base=function(St,Dt,rr){if(rr.prototype===false){if(gr.needsProtoHack.has(Dt)){return new Dt.constructor}return Dt===pr.array?[]:{}}const cr=Object.getPrototypeOf(St);if(cr&&cr.isImmutable){return St}if(Dt===pr.array){const St=[];if(cr!==Dt){Object.setPrototypeOf(St,cr)}return St}if(gr.needsProtoHack.has(Dt)){const St=new cr.constructor;if(cr!==Dt){Object.setPrototypeOf(St,cr)}return St}return Object.create(cr)}},35879:(St,Dt,rr)=>{"use strict";const cr=rr(99704);const pr={mismatched:null};St.exports=function(St,Dt,rr){rr=Object.assign({prototype:true},rr);return!!pr.isDeepEqual(St,Dt,rr,[])};pr.isDeepEqual=function(St,Dt,rr,mr){if(St===Dt){return St!==0||1/St===1/Dt}const gr=typeof St;if(gr!==typeof Dt){return false}if(St===null||Dt===null){return false}if(gr==="function"){if(!rr.deepFunction||St.toString()!==Dt.toString()){return false}}else if(gr!=="object"){return St!==St&&Dt!==Dt}const yr=pr.getSharedType(St,Dt,!!rr.prototype);switch(yr){case cr.buffer:return Buffer&&Buffer.prototype.equals.call(St,Dt);case cr.promise:return St===Dt;case cr.regex:return St.toString()===Dt.toString();case pr.mismatched:return false}for(let rr=mr.length-1;rr>=0;--rr){if(mr[rr].isSame(St,Dt)){return true}}mr.push(new pr.SeenEntry(St,Dt));try{return!!pr.isDeepEqualObj(yr,St,Dt,rr,mr)}finally{mr.pop()}};pr.getSharedType=function(St,Dt,rr){if(rr){if(Object.getPrototypeOf(St)!==Object.getPrototypeOf(Dt)){return pr.mismatched}return cr.getInternalProto(St)}const mr=cr.getInternalProto(St);if(mr!==cr.getInternalProto(Dt)){return pr.mismatched}return mr};pr.valueOf=function(St){const Dt=St.valueOf;if(Dt===undefined){return St}try{return Dt.call(St)}catch(St){return St}};pr.hasOwnEnumerableProperty=function(St,Dt){return Object.prototype.propertyIsEnumerable.call(St,Dt)};pr.isSetSimpleEqual=function(St,Dt){for(const rr of Set.prototype.values.call(St)){if(!Set.prototype.has.call(Dt,rr)){return false}}return true};pr.isDeepEqualObj=function(St,Dt,rr,mr,gr){const{isDeepEqual:yr,valueOf:Sr,hasOwnEnumerableProperty:$r}=pr;const{keys:Er,getOwnPropertySymbols:Ir}=Object;if(St===cr.array){if(mr.part){for(const St of Dt){for(const Dt of rr){if(yr(St,Dt,mr,gr)){return true}}}}else{if(Dt.length!==rr.length){return false}for(let St=0;St<Dt.length;++St){if(!yr(Dt[St],rr[St],mr,gr)){return false}}return true}}else if(St===cr.set){if(Dt.size!==rr.size){return false}if(!pr.isSetSimpleEqual(Dt,rr)){const St=new Set(Set.prototype.values.call(rr));for(const rr of Set.prototype.values.call(Dt)){if(St.delete(rr)){continue}let Dt=false;for(const cr of St){if(yr(rr,cr,mr,gr)){St.delete(cr);Dt=true;break}}if(!Dt){return false}}}}else if(St===cr.map){if(Dt.size!==rr.size){return false}for(const[St,cr]of Map.prototype.entries.call(Dt)){if(cr===undefined&&!Map.prototype.has.call(rr,St)){return false}if(!yr(cr,Map.prototype.get.call(rr,St),mr,gr)){return false}}}else if(St===cr.error){if(Dt.name!==rr.name||Dt.message!==rr.message){return false}}const Or=Sr(Dt);const Hr=Sr(rr);if((Dt!==Or||rr!==Hr)&&!yr(Or,Hr,mr,gr)){return false}const Gr=Er(Dt);if(!mr.part&&Gr.length!==Er(rr).length&&!mr.skip){return false}let Tn=0;for(const St of Gr){if(mr.skip&&mr.skip.includes(St)){if(rr[St]===undefined){++Tn}continue}if(!$r(rr,St)){return false}if(!yr(Dt[St],rr[St],mr,gr)){return false}}if(!mr.part&&Gr.length-Tn!==Er(rr).length){return false}if(mr.symbols!==false){const St=Ir(Dt);const cr=new Set(Ir(rr));for(const pr of St){if(!mr.skip||!mr.skip.includes(pr)){if($r(Dt,pr)){if(!$r(rr,pr)){return false}if(!yr(Dt[pr],rr[pr],mr,gr)){return false}}else if($r(rr,pr)){return false}}cr.delete(pr)}for(const St of cr){if($r(rr,St)){return false}}}return true};pr.SeenEntry=class{constructor(St,Dt){this.obj=St;this.ref=Dt}isSame(St,Dt){return this.obj===St&&this.ref===Dt}}},16443:(St,Dt,rr)=>{"use strict";const cr=rr(72912);const pr={};St.exports=class extends Error{constructor(St){const rr=St.filter((St=>St!=="")).map((St=>typeof St==="string"?St:St instanceof Error?St.message:cr(St)));super(rr.join(" ")||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,Dt.assert)}}}},57391:St=>{"use strict";const Dt={};St.exports=function(St){if(!St){return""}let rr="";for(let cr=0;cr<St.length;++cr){const pr=St.charCodeAt(cr);if(Dt.isSafe(pr)){rr+=St[cr]}else{rr+=Dt.escapeHtmlChar(pr)}}return rr};Dt.escapeHtmlChar=function(St){const rr=Dt.namedHtml.get(St);if(rr){return rr}if(St>=256){return"&#"+St+";"}const cr=St.toString(16).padStart(2,"0");return`&#x${cr};`};Dt.isSafe=function(St){return Dt.safeCharCodes.has(St)};Dt.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]);Dt.safeCharCodes=function(){const St=new Set;for(let Dt=32;Dt<123;++Dt){if(Dt>=97||Dt>=65&&Dt<=90||Dt>=48&&Dt<=57||Dt===32||Dt===46||Dt===44||Dt===45||Dt===58||Dt===95){St.add(Dt)}}return St}()},43935:St=>{"use strict";const Dt={};St.exports=function(St){return St.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},85363:St=>{"use strict";const Dt={};St.exports=function(){}},66621:(St,Dt,rr)=>{"use strict";const cr=rr(99583);const pr=rr(43700);const mr=rr(87492);const gr={};St.exports=gr.merge=function(St,Dt,rr){cr(St&&typeof St==="object","Invalid target value: must be an object");cr(Dt===null||Dt===undefined||typeof Dt==="object","Invalid source value: must be null, undefined, or an object");if(!Dt){return St}rr=Object.assign({nullOverride:true,mergeArrays:true},rr);if(Array.isArray(Dt)){cr(Array.isArray(St),"Cannot merge array onto an object");if(!rr.mergeArrays){St.length=0}for(let cr=0;cr<Dt.length;++cr){St.push(pr(Dt[cr],{symbols:rr.symbols}))}return St}const yr=mr.keys(Dt,rr);for(let cr=0;cr<yr.length;++cr){const mr=yr[cr];if(mr==="__proto__"||!Object.prototype.propertyIsEnumerable.call(Dt,mr)){continue}const Sr=Dt[mr];if(Sr&&typeof Sr==="object"){if(St[mr]===Sr){continue}if(!St[mr]||typeof St[mr]!=="object"||Array.isArray(St[mr])!==Array.isArray(Sr)||Sr instanceof Date||Buffer&&Buffer.isBuffer(Sr)||Sr instanceof RegExp){St[mr]=pr(Sr,{symbols:rr.symbols})}else{gr.merge(St[mr],Sr,rr)}}else{if(Sr!==null&&Sr!==undefined){St[mr]=Sr}else if(rr.nullOverride){St[mr]=Sr}}}return St}},69322:(St,Dt,rr)=>{"use strict";const cr=rr(99583);const pr={};St.exports=function(St,Dt,rr){if(Dt===false||Dt===null||Dt===undefined){return St}rr=rr||{};if(typeof rr==="string"){rr={separator:rr}}const mr=Array.isArray(Dt);cr(!mr||!rr.separator,"Separator option is not valid for array-based chain");const gr=mr?Dt:Dt.split(rr.separator||".");let yr=St;for(let St=0;St<gr.length;++St){let mr=gr[St];const Sr=rr.iterables&&pr.iterables(yr);if(Array.isArray(yr)||Sr==="set"){const St=Number(mr);if(Number.isInteger(St)){mr=St<0?yr.length+St:St}}if(!yr||typeof yr==="function"&&rr.functions===false||!Sr&&yr[mr]===undefined){cr(!rr.strict||St+1===gr.length,"Missing segment",mr,"in reach path ",Dt);cr(typeof yr==="object"||rr.functions===true||typeof yr!=="function","Invalid segment",mr,"in reach path ",Dt);yr=rr.default;break}if(!Sr){yr=yr[mr]}else if(Sr==="set"){yr=[...yr][mr]}else{yr=yr.get(mr)}}return yr};pr.iterables=function(St){if(St instanceof Set){return"set"}if(St instanceof Map){return"map"}}},72912:St=>{"use strict";const Dt={};St.exports=function(...St){try{return JSON.stringify(...St)}catch(St){return"[Cannot display object: "+St.message+"]"}}},99704:(St,Dt)=>{"use strict";const rr={};Dt=St.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};rr.typeMap=new Map([["[object Error]",Dt.error],["[object Map]",Dt.map],["[object Promise]",Dt.promise],["[object Set]",Dt.set],["[object WeakMap]",Dt.weakMap],["[object WeakSet]",Dt.weakSet]]);Dt.getInternalProto=function(St){if(Array.isArray(St)){return Dt.array}if(Buffer&&St instanceof Buffer){return Dt.buffer}if(St instanceof Date){return Dt.date}if(St instanceof RegExp){return Dt.regex}if(St instanceof Error){return Dt.error}const cr=Object.prototype.toString.call(St);return rr.typeMap.get(cr)||Dt.generic}},87492:(St,Dt)=>{"use strict";const rr={};Dt.keys=function(St,Dt={}){return Dt.symbols!==false?Reflect.ownKeys(St):Object.getOwnPropertyNames(St)}},75663:(St,Dt,rr)=>{"use strict";const cr=rr(99583);const pr={};Dt.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(St,Dt){Dt=Dt||{};const rr=[].concat(Dt.before||[]);const pr=[].concat(Dt.after||[]);const mr=Dt.group||"?";const gr=Dt.sort||0;cr(!rr.includes(mr),`Item cannot come before itself: ${mr}`);cr(!rr.includes("?"),"Item cannot come before unassociated items");cr(!pr.includes(mr),`Item cannot come after itself: ${mr}`);cr(!pr.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(St)){St=[St]}for(const Dt of St){const St={seq:this._items.length,sort:gr,before:rr,after:pr,group:mr,node:Dt};this._items.push(St)}if(!Dt.manual){const St=this._sort();cr(St,"item",mr!=="?"?`added into group ${mr}`:"","created a dependencies error")}return this.nodes}merge(St){if(!Array.isArray(St)){St=[St]}for(const Dt of St){if(Dt){for(const St of Dt._items){this._items.push(Object.assign({},St))}}}this._items.sort(pr.mergeSort);for(let St=0;St<this._items.length;++St){this._items[St].seq=St}const Dt=this._sort();cr(Dt,"merge created a dependencies error");return this.nodes}sort(){const St=this._sort();cr(St,"sort created a dependencies error");return this.nodes}_sort(){const St={};const Dt=Object.create(null);const rr=Object.create(null);for(const cr of this._items){const pr=cr.seq;const mr=cr.group;rr[mr]=rr[mr]||[];rr[mr].push(pr);St[pr]=cr.before;for(const St of cr.after){Dt[St]=Dt[St]||[];Dt[St].push(pr)}}for(const Dt in St){const cr=[];for(const pr in St[Dt]){const mr=St[Dt][pr];rr[mr]=rr[mr]||[];cr.push(...rr[mr])}St[Dt]=cr}for(const cr in Dt){if(rr[cr]){for(const pr of rr[cr]){St[pr].push(...Dt[cr])}}}const cr={};for(const Dt in St){const rr=St[Dt];for(const St of rr){cr[St]=cr[St]||[];cr[St].push(Dt)}}const pr={};const mr=[];for(let St=0;St<this._items.length;++St){let Dt=St;if(cr[St]){Dt=null;for(let St=0;St<this._items.length;++St){if(pr[St]===true){continue}if(!cr[St]){cr[St]=[]}const rr=cr[St].length;let mr=0;for(let Dt=0;Dt<rr;++Dt){if(pr[cr[St][Dt]]){++mr}}if(mr===rr){Dt=St;break}}}if(Dt!==null){pr[Dt]=true;mr.push(Dt)}}if(mr.length!==this._items.length){return false}const gr={};for(const St of this._items){gr[St.seq]=St}this._items=[];this.nodes=[];for(const St of mr){const Dt=gr[St];this.nodes.push(Dt.node);this._items.push(Dt)}return true}};pr.mergeSort=(St,Dt)=>St.sort===Dt.sort?0:St.sort<Dt.sort?-1:1},3563:(St,Dt,rr)=>{const{parse:cr,format:pr}=rr(87016);const{pathToRegexp:mr,compile:gr,parse:yr}=rr(44985);St.exports=Layer;function Layer(St,Dt,rr,cr={}){this.opts=cr;this.name=this.opts.name||null;this.methods=[];this.paramNames=[];this.stack=Array.isArray(rr)?rr:[rr];for(const St of Dt){const Dt=this.methods.push(St.toUpperCase());if(this.methods[Dt-1]==="GET")this.methods.unshift("HEAD")}for(let rr=0;rr<this.stack.length;rr++){const cr=this.stack[rr];const pr=typeof cr;if(pr!=="function")throw new Error(`${Dt.toString()} \`${this.opts.name||St}\`: \`middleware\` must be a function, not \`${pr}\``)}this.path=St;this.regexp=mr(St,this.paramNames,this.opts)}Layer.prototype.match=function(St){return this.regexp.test(St)};Layer.prototype.params=function(St,Dt,rr={}){for(let St=Dt.length,cr=0;cr<St;cr++){if(this.paramNames[cr]){const St=Dt[cr];if(St&&St.length>0)rr[this.paramNames[cr].name]=St?safeDecodeURIComponent(St):St}}return rr};Layer.prototype.captures=function(St){return this.opts.ignoreCaptures?[]:St.match(this.regexp).slice(1)};Layer.prototype.url=function(St,Dt){let rr=St;const mr=this.path.replace(/\(\.\*\)/g,"");if(typeof St!=="object"){rr=Array.prototype.slice.call(arguments);if(typeof rr[rr.length-1]==="object"){Dt=rr[rr.length-1];rr=rr.slice(0,-1)}}const Sr=gr(mr,{encode:encodeURIComponent,...Dt});let $r;const Er=yr(mr);let Ir={};if(Array.isArray(rr)){for(let St=Er.length,Dt=0,cr=0;Dt<St;Dt++){if(Er[Dt].name)Ir[Er[Dt].name]=rr[cr++]}}else if(Er.some((St=>St.name))){Ir=St}else if(!Dt){Dt=St}$r=Sr(Ir);if(Dt&&Dt.query){$r=cr($r);if(typeof Dt.query==="string"){$r.search=Dt.query}else{$r.search=undefined;$r.query=Dt.query}return pr($r)}return $r};Layer.prototype.param=function(St,Dt){const{stack:rr}=this;const cr=this.paramNames;const middleware=function(rr,cr){return Dt.call(this,rr.params[St],rr,cr)};middleware.param=St;const pr=cr.map((function(St){return St.name}));const mr=pr.indexOf(St);if(mr>-1){rr.some((function(St,Dt){if(!St.param||pr.indexOf(St.param)>mr){rr.splice(Dt,0,middleware);return true}}))}return this};Layer.prototype.setPrefix=function(St){if(this.path){this.path=this.path!=="/"||this.opts.strict===true?`${St}${this.path}`:St;this.paramNames=[];this.regexp=mr(this.path,this.paramNames,this.opts)}return this};function safeDecodeURIComponent(St){try{return decodeURIComponent(St)}catch{return St}}},53777:(St,Dt,rr)=>{const cr=rr(77246);const pr=rr(58024);const mr=rr(93);const{pathToRegexp:gr}=rr(44985);const yr=rr(3563);const Sr=rr(26675)("koa-router");St.exports=Router;function Router(St={}){if(!(this instanceof Router))return new Router(St);this.opts=St;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 $r of mr){function setMethodVerb(St){Router.prototype[St]=function(Dt,rr,cr){if(typeof rr==="string"||rr instanceof RegExp){cr=Array.prototype.slice.call(arguments,2)}else{cr=Array.prototype.slice.call(arguments,1);rr=Dt;Dt=null}if(typeof rr!=="string"&&!(rr instanceof RegExp)&&(!Array.isArray(rr)||rr.length===0))throw new Error(`You have to provide a path when adding a ${St} handler`);this.register(rr,[St],cr,{name:Dt});return this}}setMethodVerb($r)}Router.prototype.del=Router.prototype["delete"];Router.prototype.use=function(){const St=this;const Dt=Array.prototype.slice.call(arguments);let rr;if(Array.isArray(Dt[0])&&typeof Dt[0][0]==="string"){const pr=Dt[0];for(const mr of pr){St.use.apply(St,[mr].concat(Dt.slice(1)))}return this}const cr=typeof Dt[0]==="string";if(cr)rr=Dt.shift();for(const Sr of Dt){if(Sr.router){const $r=Object.assign(Object.create(Router.prototype),Sr.router,{stack:[...Sr.router.stack]});for(let Er=0;Er<$r.stack.length;Er++){const Ir=$r.stack[Er];const Or=Object.assign(Object.create(yr.prototype),Ir);if(rr)Or.setPrefix(rr);if(St.opts.prefix)Or.setPrefix(St.opts.prefix);St.stack.push(Or);$r.stack[Er]=Or}if(St.params){function setRouterParams(Dt){const rr=Dt;for(const Dt of rr){$r.param(Dt,St.params[Dt])}}setRouterParams(Object.keys(St.params))}}else{const Hr=[];gr(St.opts.prefix||"",Hr);const Gr=St.opts.prefix&&Hr.length;St.register(rr||"([^/]*)",[],Sr,{end:false,ignoreCaptures:!cr&&!Gr})}}return this};Router.prototype.prefix=function(St){St=St.replace(/\/$/,"");this.opts.prefix=St;for(let Dt=0;Dt<this.stack.length;Dt++){const rr=this.stack[Dt];rr.setPrefix(St)}return this};Router.prototype.routes=Router.prototype.middleware=function(){const St=this;const Dt=function dispatch(Dt,rr){Sr("%s %s",Dt.method,Dt.path);const pr=St.matchHost(Dt.host);if(!pr){return rr()}const mr=St.opts.routerPath||Dt.newRouterPath||Dt.path||Dt.routerPath;const gr=St.match(mr,Dt.method);let yr;if(Dt.matched){Dt.matched.push.apply(Dt.matched,gr.path)}else{Dt.matched=gr.path}Dt.router=St;if(!gr.route)return rr();const $r=gr.pathAndMethod;const Er=$r[$r.length-1];Dt._matchedRoute=Er.path;if(Er.name){Dt._matchedRouteName=Er.name}yr=(St.exclusive?[Er]:$r).reduce((function(St,Dt){St.push((function(St,rr){St.captures=Dt.captures(mr,St.captures);St.params=St.request.params=Dt.params(mr,St.captures,St.params);St.routerPath=Dt.path;St.routerName=Dt.name;St._matchedRoute=Dt.path;if(Dt.name){St._matchedRouteName=Dt.name}return rr()}));return St.concat(Dt.stack)}),[]);return cr(yr)(Dt,rr)};Dt.router=this;return Dt};Router.prototype.allowedMethods=function(St={}){const Dt=this.methods;return function allowedMethods(rr,cr){return cr().then((function(){const cr={};if(!rr.status||rr.status===404){for(let St=0;St<rr.matched.length;St++){const Dt=rr.matched[St];for(let St=0;St<Dt.methods.length;St++){const rr=Dt.methods[St];cr[rr]=rr}}const mr=Object.keys(cr);if(!~Dt.indexOf(rr.method)){if(St.throw){const Dt=typeof St.notImplemented==="function"?St.notImplemented():new pr.NotImplemented;throw Dt}else{rr.status=501;rr.set("Allow",mr.join(", "))}}else if(mr.length>0){if(rr.method==="OPTIONS"){rr.status=200;rr.body="";rr.set("Allow",mr.join(", "))}else if(!cr[rr.method]){if(St.throw){const Dt=typeof St.methodNotAllowed==="function"?St.methodNotAllowed():new pr.MethodNotAllowed;throw Dt}else{rr.status=405;rr.set("Allow",mr.join(", "))}}}}}))}};Router.prototype.all=function(St,Dt,rr){if(typeof Dt==="string"){rr=Array.prototype.slice.call(arguments,2)}else{rr=Array.prototype.slice.call(arguments,1);Dt=St;St=null}if(typeof Dt!=="string"&&!(Dt instanceof RegExp)&&(!Array.isArray(Dt)||Dt.length===0))throw new Error("You have to provide a path when adding an all handler");this.register(Dt,mr,rr,{name:St});return this};Router.prototype.redirect=function(St,Dt,rr){if(typeof St==="symbol"||St[0]!=="/"){St=this.url(St);if(St instanceof Error)throw St}if(typeof Dt==="symbol"||Dt[0]!=="/"&&!Dt.includes("://")){Dt=this.url(Dt);if(Dt instanceof Error)throw Dt}return this.all(St,(St=>{St.redirect(Dt);St.status=rr||301}))};Router.prototype.register=function(St,Dt,rr,cr={}){const pr=this;const{stack:mr}=this;if(Array.isArray(St)){for(const mr of St){pr.register.call(pr,mr,Dt,rr,cr)}return this}const gr=new yr(St,Dt,rr,{end:cr.end===false?cr.end:true,name:cr.name,sensitive:cr.sensitive||this.opts.sensitive||false,strict:cr.strict||this.opts.strict||false,prefix:cr.prefix||this.opts.prefix||"",ignoreCaptures:cr.ignoreCaptures});if(this.opts.prefix){gr.setPrefix(this.opts.prefix)}for(let St=0;St<Object.keys(this.params).length;St++){const Dt=Object.keys(this.params)[St];gr.param(Dt,this.params[Dt])}mr.push(gr);Sr("defined route %s %s",gr.methods,gr.path);return gr};Router.prototype.route=function(St){const Dt=this.stack;for(let rr=Dt.length,cr=0;cr<rr;cr++){if(Dt[cr].name&&Dt[cr].name===St)return Dt[cr]}return false};Router.prototype.url=function(St,Dt){const rr=this.route(St);if(rr){const St=Array.prototype.slice.call(arguments,1);return rr.url.apply(rr,St)}return new Error(`No route found for name: ${String(St)}`)};Router.prototype.match=function(St,Dt){const rr=this.stack;let cr;const pr={path:[],pathAndMethod:[],route:false};for(let mr=rr.length,gr=0;gr<mr;gr++){cr=rr[gr];Sr("test %s %s",cr.path,cr.regexp);if(cr.match(St)){pr.path.push(cr);if(cr.methods.length===0||~cr.methods.indexOf(Dt)){pr.pathAndMethod.push(cr);if(cr.methods.length>0)pr.route=true}}}return pr};Router.prototype.matchHost=function(St){const{host:Dt}=this;if(!Dt){return true}if(!St){return false}if(typeof Dt==="string"){return St===Dt}if(typeof Dt==="object"&&Dt instanceof RegExp){return Dt.test(St)}};Router.prototype.param=function(St,Dt){this.params[St]=Dt;for(let rr=0;rr<this.stack.length;rr++){const cr=this.stack[rr];cr.param(St,Dt)}return this};Router.url=function(St){const Dt=Array.prototype.slice.call(arguments,1);return yr.prototype.url.apply({path:St},Dt)}},86979:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.AsyncHooksContextManager=void 0;const cr=rr(46123);const pr=rr(90290);class AsyncHooksContextManager{constructor(){this._contexts=new Map;this._stack=[];this._asyncHook=pr.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 St;return(St=this._stack[this._stack.length-1])!==null&&St!==void 0?St:cr.ASYNC_ROOT_CONTEXT}with(St,Dt,rr,...cr){this._enterContext(St);try{return Dt.call(rr,...cr)}finally{this._exitContext()}}enable(){this._asyncHook.enable();return this}disable(){this._asyncHook.disable();this._contexts.clear();this._stack=[];return this}_init(St,Dt){if(Dt==="TIMERWRAP")return;const rr=this._stack[this._stack.length-1];if(rr!==undefined){this._contexts.set(St,rr)}}_destroy(St){this._contexts.delete(St)}_before(St){const Dt=this._contexts.get(St);if(Dt!==undefined){this._enterContext(Dt)}}_after(){this._exitContext()}_enterContext(St){this._stack.push(St)}_exitContext(){this._stack.pop()}bind(St,Dt){if(typeof Dt==="function"){const rr=this;const contextWrapper=function(...cr){return rr.with(St,(()=>Dt.apply(this,cr)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:Dt.length});return contextWrapper}return Dt}}Dt.AsyncHooksContextManager=AsyncHooksContextManager},63259:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.AsyncLocalStorageContextManager=void 0;const cr=rr(46123);const pr=rr(90290);class AsyncLocalStorageContextManager{constructor(){this._asyncLocalStorage=new pr.AsyncLocalStorage}active(){var St;return(St=this._asyncLocalStorage.getStore())!==null&&St!==void 0?St:cr.ASYNC_ROOT_CONTEXT}with(St,Dt,rr,...cr){const pr=rr==null?Dt:Dt.bind(rr);return this._asyncLocalStorage.run(St,pr,...cr)}enable(){return this}disable(){this._asyncLocalStorage.disable();return this}bind(St,Dt){if(typeof Dt==="function"){const rr=this;const contextWrapper=function(...cr){return rr.with(St,(()=>Dt.apply(this,cr)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:Dt.length});return contextWrapper}return Dt}}Dt.AsyncLocalStorageContextManager=AsyncLocalStorageContextManager},44101:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.createContextManager=Dt.isSemverGreaterThanOrEqualTo=void 0;pr(rr(86979),Dt);pr(rr(63259),Dt);var mr=rr(43349);Object.defineProperty(Dt,"isSemverGreaterThanOrEqualTo",{enumerable:true,get:function(){return mr.isSemverGreaterThanOrEqualTo}});Object.defineProperty(Dt,"createContextManager",{enumerable:true,get:function(){return mr.createContextManager}})},43349:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.createContextManager=Dt.isSemverGreaterThanOrEqualTo=void 0;const cr=rr(63259);const pr=rr(86979);const mr=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z-]+(?:\.[\da-z-]+)*))?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)?)?$/i;function isSemverGreaterThanOrEqualTo(St,Dt){const rr=mr.exec(St);const cr=mr.exec(Dt);if(rr&&cr){if(rr[1]===cr[1]&&rr[2]===cr[2]&&rr[3]===cr[3]&&rr[4]===cr[4]){return true}return gteString(rr[1],cr[1])||rr[1]===cr[1]&&gteString(rr[2],cr[2])||rr[1]===cr[1]&&rr[2]===cr[2]&&gteString(rr[3],cr[3])||rr[1]===cr[1]&&rr[2]===cr[2]&&rr[3]===cr[3]&&gteString(rr[4],cr[4])}return false}Dt.isSemverGreaterThanOrEqualTo=isSemverGreaterThanOrEqualTo;function gteString(St,Dt){const rr=parseInt(St,10);const cr=parseInt(Dt,10);return rr>cr}function createContextManager(){const St=isSemverGreaterThanOrEqualTo(process.version,"14.8.0")?cr.AsyncLocalStorageContextManager:pr.AsyncHooksContextManager;return new St}Dt.createContextManager=createContextManager},26733:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Bootstrap=Dt.BootstrapStarter=void 0;const cr=rr(46123);const pr=rr(16928);const mr=rr(51169);const gr=rr(44101);const yr=rr(5982);const Sr=rr(92364);class BootstrapStarter{constructor(){this.globalOptions={}}configure(St={}){this.globalOptions=St;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 yr.ChildProcessEventBus({isWorker:true})}else if(process.env["MIDWAY_FORK_MODE"]==="thread"){this.eventBus=new yr.ThreadEventBus({isWorker:true})}}if(!this.globalOptions.moduleLoadType){const St=await(0,cr.loadModule)((0,pr.join)(this.appDir,"package.json"),{safeLoad:true,enableCache:false});this.globalOptions.moduleLoadType=(St===null||St===void 0?void 0:St.type)==="module"?"esm":"commonjs"}this.applicationContext=await(0,cr.initializeGlobalApplicationContext)({asyncContextManager:(0,gr.createContextManager)(),loggerFactory:mr.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 St=this.applicationContext.get(cr.MidwayApplicationManager);const Dt=St.getApplication("socketIO");(0,Sr.setupWorker)(Dt)}}const St=this.applicationContext.get(cr.MidwayFrameworkService);if(!St.getMainApp()){throw new cr.MidwayMainFrameworkMissingError}}async stop(){if(this.applicationContext){await(0,cr.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,cr.isTypeScriptEnvironment)()){return(0,pr.join)(this.appDir,"src")}else{return(0,pr.join)(this.appDir,"dist")}}}Dt.BootstrapStarter=BootstrapStarter;class Bootstrap{static configure(St={}){this.configured=true;if(!this.logger&&!St.logger){this.logger=this.bootstrapLoggerFactory.createLogger("bootstrap",{enableError:false,enableFile:false,enableConsole:true});if(St.logger===false){if(this.logger["disableConsole"]){this.logger["disableConsole"]()}else{this.logger["level"]="none"}}St.logger=this.logger}else{this.logger=this.logger||St.logger}if(St.appDir&&St.appDir!==process.cwd()){process.chdir(St.appDir)}this.getStarter().configure(St);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((St=>{this.logger.error(St);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(St){this.logger.info("[midway:bootstrap] receive signal %s, closing",St);try{await this.stop();this.logger.info("[midway:bootstrap] close done, exiting with code:0");process.exit(0)}catch(St){this.logger.error("[midway:bootstrap] close with error: ",St);process.exit(1)}}static onExit(St){this.logger.info("[midway:bootstrap] exit with code:%s",St)}static uncaughtExceptionHandler(St){if(!(St instanceof Error)){St=new Error(String(St))}if(St.name==="Error"){St.name="unhandledExceptionError"}this.logger.error(St)}static unhandledRejectionHandler(St){if(!(St instanceof Error)){const Dt=new Error(String(St));if(St){if(St.name)Dt.name=St.name;if(St.message)Dt.message=St.message;if(St.stack)Dt.stack=St.stack}St=Dt}if(St.name==="Error"){St.name="unhandledRejectionError"}this.logger.error(St)}static getApplicationContext(){return this.getStarter().getApplicationContext()}}Dt.Bootstrap=Bootstrap;Bootstrap.configured=false;Bootstrap.bootstrapLoggerFactory=new mr.MidwayLoggerContainer},84575:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.setupStickyMaster=Dt.AbstractForkManager=Dt.ClusterManager=Dt.BootstrapStarter=Dt.Bootstrap=void 0;pr(rr(82516),Dt);var mr=rr(26733);Object.defineProperty(Dt,"Bootstrap",{enumerable:true,get:function(){return mr.Bootstrap}});Object.defineProperty(Dt,"BootstrapStarter",{enumerable:true,get:function(){return mr.BootstrapStarter}});var gr=rr(93772);Object.defineProperty(Dt,"ClusterManager",{enumerable:true,get:function(){return gr.ClusterManager}});var yr=rr(84338);Object.defineProperty(Dt,"AbstractForkManager",{enumerable:true,get:function(){return yr.AbstractForkManager}});var Sr=rr(92364);Object.defineProperty(Dt,"setupStickyMaster",{enumerable:true,get:function(){return Sr.setupStickyMaster}})},82516:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},84338:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.AbstractForkManager=void 0;const cr=rr(70857);const pr=rr(39023);const mr=rr(53599);const gr=rr(24434);const yr=rr(39023);const Sr=(0,yr.debuglog)("midway:bootstrap");class AbstractForkManager{constructor(St){this.options=St;this.reforks=[];this.disconnectCount=0;this.unexpectedCount=0;this.disconnects={};this.hub=new gr.EventEmitter;this.workers=new Map;this.isClosing=false;St.count=St.count||cr.cpus().length-1;St.refork=St.refork!==false;St.limit=St.limit||60;St.duration=St.duration||6e4;St.logger=St.logger||console;St.workerInitTimeout=St.workerInitTimeout||3e4;this.eventBus=this.createEventBus({initTimeout:St.workerInitTimeout})}async start(){Sr("Start manager with options: %j",this.options);this.bindWorkerDisconnect((St=>{Sr(" - worker(%s): trigger event = disconnect",this.getWorkerId(St));const Dt=this.options.logger[St["disableRefork"]?"info":"error"];this.disconnectCount++;const rr=this.isWorkerDead(St);if(rr){Sr(" - worker(%s): worker is dead",this.getWorkerId(St));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork, because worker:%s exit event emit before disconnect",(0,mr.logDate)(),process.pid,this.getWorkerId(St));return}if(St["disableRefork"]){Sr(" - worker(%s): worker is disableRefork(maybe terminated by master)",this.getWorkerId(St));Dt("[%s] [bootstrap:master:%s] don't fork, because worker:%s will be kill soon",(0,mr.logDate)(),process.pid,this.getWorkerId(St));return}this.disconnects[this.getWorkerId(St)]=(0,mr.logDate)();this.tryToRefork(St)}));this.bindWorkerExit(((St,Dt,rr)=>{Sr(" - worker(%s): trigger event = exit",this.getWorkerId(St));this.workers.delete(this.getWorkerId(St));if(St["disableRefork"]){return}const cr=!!this.disconnects[this.getWorkerId(St)];Sr(" - worker(%s): isExpected=%s",this.getWorkerId(St),cr);if(cr){delete this.disconnects[this.getWorkerId(St)];return}Sr(" - worker(%s): isWorkerDead=%s",this.getWorkerId(St),this.isWorkerDead(St));if(this.isWorkerDead(St)){return}Sr(" - worker(%s): unexpectedCount will add");this.unexpectedCount++;this.tryToRefork(St);this.onUnexpected(St,Dt,rr)}));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 St=0;St<this.options.count;St++){const St=this.createWorker();Sr(" - worker(%s) created",this.getWorkerId(St));this.eventBus.addWorker(St);this.workers.set(this.getWorkerId(St),St)}await this.eventBus.start()}tryToRefork(St){if(this.allowRefork()){Sr(" - worker(%s): allow refork and will fork new",this.getWorkerId(St));const Dt=this.createWorker(St);this.workers.set(this.getWorkerId(Dt),Dt);this.options.logger.info("[%s] [bootstrap:master:%s] new worker:%s fork (state: %s)",(0,mr.logDate)(),process.pid,this.getWorkerId(Dt),Dt["state"]);this.eventBus.addWorker(Dt)}else{Sr(" - worker(%s): forbidden refork and will stop",this.getWorkerId(St));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork new work (refork: %s)",(0,mr.logDate)(),process.pid,this.options.refork)}}allowRefork(){if(!this.options.refork||this.isClosing){return false}const St=this.reforks.push(Date.now());if(St>this.options.limit){this.reforks.shift()}const Dt=this.reforks[this.reforks.length-1]-this.reforks[0];const rr=this.reforks.length<this.options.limit||Dt>this.options.duration;if(!rr){this.hub.emit("reachReforkLimit")}return rr}onerror(St){if(!St){return}this.options.logger.error("[%s] [bootstrap:master:%s] master uncaughtException: %s",(0,mr.logDate)(),process.pid,St.stack);this.options.logger.error(St);this.options.logger.error("(total %d disconnect, %d unexpected exit)",this.disconnectCount,this.unexpectedCount)}onUnexpected(St,Dt,rr){const cr=St.hasOwnProperty("exitedAfterDisconnect")?"exitedAfterDisconnect":"suicide";const gr=new Error(pr.format("worker:%s died unexpected (code: %s, signal: %s, %s: %s, state: %s)",this.getWorkerId(St),Dt,rr,cr,St[cr],St["state"]));gr.name="WorkerDiedUnexpectedError";this.options.logger.error("[%s] [bootstrap:master:%s] (total %d disconnect, %d unexpected exit) %s",(0,mr.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount,gr.stack)}onReachReforkLimit(){this.options.logger.error("[%s] [bootstrap:master:%s] worker died too fast (total %d disconnect, %d unexpected exit)",(0,mr.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount)}async killWorker(St,Dt){await this.closeWorker(St);await Promise.race([(0,gr.once)(St,"exit"),(0,mr.sleep)(Dt)]);if(St.killed)return;(St.process||St).kill("SIGKILL")}async stop(St=2e3){Sr("run close");this.isClosing=true;await this.eventBus.stop();for(const Dt of this.workers.values()){Dt["disableRefork"]=true;await this.killWorker(Dt,St)}if(this.exitListener){await this.exitListener()}}hasWorker(St){return this.workers.has(St)}getWorker(St){return this.workers.get(St)}getWorkerIds(){return Array.from(this.workers.keys())}onStop(St){this.exitListener=St}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(St){if(!this.isClosing){this.options.logger.info("[bootstrap:master] receive signal %s, closing",St);try{await this.stop();this.options.logger.info("[bootstrap:master] close done, exiting with code:0");process.exit(0)}catch(St){this.options.logger.error("[midway:master] close with error: ",St);process.exit(1)}}}onMasterExit(St){this.options.logger.info("[bootstrap:master] exit with code:%s",St)}}Dt.AbstractForkManager=AbstractForkManager},93772:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ClusterManager=void 0;const cr=rr(5982);const pr=rr(84338);const mr=rr(29907);const gr=rr(39023);const yr=rr(46123);const Sr=(0,gr.debuglog)("midway:bootstrap");class ClusterManager extends pr.AbstractForkManager{constructor(St={}){super(St);this.options=St;St.args=St.args||[];St.execArgv=St.execArgv||[];if((0,yr.isTypeScriptEnvironment)()){St.execArgv.push(...["--require","ts-node/register"])}}createWorker(){if(mr["setupPrimary"]){mr["setupPrimary"](this.options)}else if(mr["setupMaster"]){mr["setupMaster"](this.options)}return mr.fork({MIDWAY_FORK_MODE:"cluster",MIDWAY_STICKY_MODE:this.options.sticky?"true":"false",...this.options.env})}bindWorkerDisconnect(St){Sr("Bind cluster.disconnect event");mr.on("disconnect",St)}bindWorkerExit(St){Sr("Bind cluster.exit event");mr.on("exit",St)}getWorkerId(St){return String(St.process.pid)}isWorkerDead(St){return St.isDead()}closeWorker(St){St.kill("SIGTERM")}createEventBus(St){return new cr.ChildProcessEventBus(St)}isPrimary(){return!mr.isWorker}}Dt.ClusterManager=ClusterManager},92364:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.setupWorker=Dt.setupStickyMaster=void 0;const cr=rr(29907);const pr=rr(76982);const randomId=()=>(0,pr.randomBytes)(8).toString("hex");function setupStickyMaster(St,Dt={}){const rr={loadBalancingMethod:"least-connection",...Dt};const pr=new Map;const mr=/sid=([\w-]{20})/;let gr=0;const computeWorkerId=St=>{const Dt=mr.exec(St);if(Dt){const St=Dt[1];const rr=pr.get(St);if(rr&&cr.workers[rr]){return rr}}switch(rr.loadBalancingMethod){case"random":{const St=Object.keys(cr.workers);return St[Math.floor(Math.random()*St.length)]}case"round-robin":{const St=Object.keys(cr.workers);gr++;if(gr>=St.length){gr=0}return St[gr]}case"least-connection":let St;for(const Dt in cr.workers){const rr=cr.workers[Dt];if(St===undefined){St=rr}else{const Dt=rr["clientsCount"]||0;const cr=St["clientsCount"]||0;if(Dt<cr){St=rr}}}return St.id}};St.on("connection",(St=>{let Dt,rr;const sendCallback=Dt=>{if(Dt){St.destroy()}};St.on("data",(pr=>{let mr="utf-8";let gr=pr.toString(mr);if(Dt&&rr){cr.workers[Dt].send({type:"sticky:http-chunk",data:gr,encoding:mr,connectionId:rr},sendCallback);return}Dt=computeWorkerId(gr);const yr=!(gr.startsWith("GET")||gr.substring(0,gr.indexOf("\r\n\r\n")).includes("pgrade: websocket"));if(gr.startsWith("POST")&&gr.includes("multipart/form-data")){mr="base64";gr=pr.toString("base64")}St.pause();if(yr){rr=randomId()}cr.workers[Dt].send({type:"sticky:connection",data:gr,encoding:mr,connectionId:rr},St,{keepOpen:yr},sendCallback)}))}));St.on("request",(St=>{St.on("data",(()=>{}))}));cr.on("message",((St,{type:Dt,data:cr})=>{switch(Dt){case"sticky:connection":pr.set(cr,St.id);if(rr.loadBalancingMethod==="least-connection"){St["clientsCount"]=(St["clientsCount"]||0)+1}break;case"sticky:disconnection":pr.delete(cr);if(rr.loadBalancingMethod==="least-connection"){St["clientsCount"]--}break}}))}Dt.setupStickyMaster=setupStickyMaster;function setupWorker(St){const Dt=new Map;process.on("message",(({type:rr,data:cr,encoding:pr,connectionId:mr},gr)=>{switch(rr){case"sticky:connection":if(!gr){return}St.httpServer.emit("connection",gr);gr.emit("data",Buffer.from(cr,pr));gr.resume();if(mr){Dt.set(mr,gr);gr.on("close",(()=>{Dt.delete(mr)}))}break;case"sticky:http-chunk":{const St=Dt.get(mr);if(St){St.emit("data",Buffer.from(cr,pr))}}}}));const ignoreError=()=>{};St.engine.on("connection",(St=>{process.send({type:"sticky:connection",data:St.id},ignoreError);St.once("close",(()=>{process.send({type:"sticky:disconnection",data:St.id},ignoreError)}))}))}Dt.setupWorker=setupWorker},53599:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.sleep=Dt.logDate=void 0;function logDate(){const St=new Date;let Dt=St.getDate();if(Dt<10){Dt="0"+Dt}let rr=St.getMonth()+1;if(rr<10){rr="0"+rr}let cr=St.getHours();if(cr<10){cr="0"+cr}let pr=St.getMinutes();if(pr<10){pr="0"+pr}let mr=St.getSeconds();if(mr<10){mr="0"+mr}let gr=St.getMilliseconds();if(gr<10){gr="00"+gr}else if(gr<100){gr="0"+gr}return St.getFullYear()+"-"+rr+"-"+Dt+" "+cr+":"+pr+":"+mr+"."+gr}Dt.logDate=logDate;async function sleep(St){return new Promise((Dt=>{setTimeout(Dt,St)}))}Dt.sleep=sleep},64080:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.multiCaching=Dt.createCache=Dt.caching=void 0;const cr=rr(48851);const pr=rr(87932);async function caching(St,Dt){if(St==="memory"){const St=(0,pr.memoryStore)(Dt);return createCache(St,Dt)}if(typeof St==="function"){const rr=await St(Dt);return createCache(rr,Dt)}return createCache(St,Dt)}Dt.caching=caching;function createCache(St,Dt){return{wrap:async(rr,pr,mr)=>(0,cr.coalesceAsync)(rr,(async()=>{const gr=await St.get(rr);if(gr===undefined){const Dt=await pr();const cr=typeof mr==="function"?mr(Dt):mr;await St.set(rr,Dt,cr);return Dt}else if(Dt===null||Dt===void 0?void 0:Dt.refreshThreshold){const yr=typeof mr==="function"?mr(gr):mr;const Sr=await St.ttl(rr);if(Sr!==-1&&Sr<Dt.refreshThreshold){(0,cr.coalesceAsync)(`+++${rr}`,pr).then((Dt=>St.set(rr,Dt,yr)))}}return gr})),store:St,del:Dt=>St.del(Dt),get:Dt=>St.get(Dt),set:(Dt,rr,cr)=>St.set(Dt,rr,cr),reset:()=>St.reset(),methodWrap:async(rr,pr,mr,gr)=>(0,cr.coalesceAsync)(rr,(async()=>{const yr=await St.get(rr);if(yr===undefined){const Dt=await pr(...mr);const cr=typeof gr==="function"?gr(Dt):gr;await St.set(rr,Dt,cr);return Dt}else if(Dt===null||Dt===void 0?void 0:Dt.refreshThreshold){const Sr=typeof gr==="function"?gr(yr):gr;const $r=await St.ttl(rr);if($r!==-1&&$r<Dt.refreshThreshold){(0,cr.coalesceAsync)(`+++${rr}`,(()=>pr(...mr))).then((Dt=>St.set(rr,Dt,Sr)))}}return yr}))}}Dt.createCache=createCache;function multiCaching(St){const get=async Dt=>{for(const rr of St){try{const St=await rr.get(Dt);if(St!==undefined)return St}catch(St){}}};const set=async(Dt,rr,cr)=>{await Promise.all(St.map((St=>St.set(Dt,rr,cr))))};return{get:get,set:set,del:async Dt=>{await Promise.all(St.map((St=>St.del(Dt))))},async wrap(Dt,rr,cr){let pr;let mr=0;for(;mr<St.length;mr++){try{pr=await St[mr].get(Dt);if(pr!==undefined)break}catch(St){}}if(pr===undefined){const St=await rr();const pr=typeof cr==="function"?cr(St):cr;await set(Dt,St,pr);return St}else{const gr=typeof cr==="function"?cr(pr):cr;Promise.all(St.slice(0,mr).map((St=>St.set(Dt,pr,gr)))).then();St[mr].wrap(Dt,rr,cr).then()}return pr},reset:async()=>{await Promise.all(St.map((St=>St.reset())))},mget:async(...Dt)=>{const rr=new Array(Dt.length).fill(undefined);for(const cr of St){if(rr.every((St=>St!==undefined)))break;try{const St=await cr.store.mget(...Dt);St.forEach(((St,Dt)=>{if(rr[Dt]===undefined&&St!==undefined)rr[Dt]=St}))}catch(St){}}return rr},mset:async(Dt,rr)=>{await Promise.all(St.map((St=>St.store.mset(Dt,rr))))},mdel:async(...Dt)=>{await Promise.all(St.map((St=>St.store.mdel(...Dt))))},methodWrap:async(Dt,rr,cr,pr)=>{let mr;let gr=0;for(;gr<St.length;gr++){try{mr=await St[gr].get(Dt);if(mr!==undefined)break}catch(St){}}if(mr===undefined){const St=await rr(...cr);const mr=typeof pr==="function"?pr(St):pr;await set(Dt,St,mr);return St}else{const yr=typeof pr==="function"?pr(mr):pr;Promise.all(St.slice(0,gr).map((St=>St.set(Dt,mr,yr)))).then();St[gr].methodWrap(Dt,rr,cr,pr).then()}return mr}}}Dt.multiCaching=multiCaching},8869:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});pr(rr(64080),Dt);pr(rr(87932),Dt);pr(rr(91724),Dt)},48851:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.coalesceAsync=void 0;const rr=new Map;async function coalesceAsync(St,Dt){if(!hasKey(St)){addKey(St);try{const rr=await Promise.resolve(Dt());coalesce({key:St,result:rr});return rr}catch(Dt){coalesce({key:St,error:Dt});throw Dt}}return enqueue(St)}Dt.coalesceAsync=coalesceAsync;function hasKey(St){return rr.has(St)}function addKey(St){rr.set(St,[])}function removeKey(St){rr.delete(St)}function addCallbackToKey(St,Dt){const cr=getCallbacksByKey(St);cr.push(Dt);rr.set(St,cr)}function getCallbacksByKey(St){var Dt;return(Dt=rr.get(St))!==null&&Dt!==void 0?Dt:[]}function enqueue(St){return new Promise(((Dt,rr)=>{const cr={resolve:Dt,reject:rr};addCallbackToKey(St,cr)}))}function dequeue(St){const Dt=getCallbacksByKey(St);removeKey(St);return Dt}function coalesce(St){const{key:Dt,error:rr,result:cr}=St;dequeue(Dt).forEach((St=>{if(rr){St.reject(rr)}else{St.resolve(cr)}}))}},87932:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.memoryStore=void 0;const cr=rr(57223);const pr=rr(19944);function clone(St){if(typeof St==="object"&&St!==null){return pr(St)}return St}function memoryStore(St){var Dt;const rr=(St===null||St===void 0?void 0:St.shouldCloneBeforeSet)!==false;const pr=(Dt=St===null||St===void 0?void 0:St.isCacheable)!==null&&Dt!==void 0?Dt:St=>St!==undefined;const mr={ttlAutopurge:true,...St,max:(St===null||St===void 0?void 0:St.max)||500,ttl:(St===null||St===void 0?void 0:St.ttl)!==undefined?St.ttl:0};const gr=new cr(mr);return{async del(St){gr.delete(St)},get:async St=>gr.get(St),keys:async()=>[...gr.keys()],mget:async(...St)=>St.map((St=>gr.get(St))),async mset(St,Dt){const cr={ttl:Dt!==undefined?Dt:mr.ttl};for(const[Dt,mr]of St){if(!pr(mr))throw new Error(`no cacheable value ${JSON.stringify(mr)}`);if(rr)gr.set(Dt,clone(mr),cr);else gr.set(Dt,mr,cr)}},async mdel(...St){for(const Dt of St)gr.delete(Dt)},async reset(){gr.clear()},ttl:async St=>gr.getRemainingTTL(St),async set(St,Dt,cr){if(!pr(Dt))throw new Error(`no cacheable value ${JSON.stringify(Dt)}`);if(rr)Dt=clone(Dt);const yr=cr!==undefined?cr:mr.ttl;gr.set(St,Dt,{ttl:yr})},get calculatedSize(){return gr.calculatedSize},get size(){return gr.size},dump:()=>gr.dump(),load:(...St)=>gr.load(...St)}}Dt.memoryStore=memoryStore},91724:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},68805:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.CacheConfiguration=Dt.getClassMethodDefaultCacheKey=void 0;const mr=rr(46123);const gr=rr(42696);const yr=rr(91761);function getClassMethodDefaultCacheKey(St,Dt){return St.name+"-"+(0,mr.getProviderUUId)(St)+"-"+Dt}Dt.getClassMethodDefaultCacheKey=getClassMethodDefaultCacheKey;let Sr=class CacheConfiguration{async onReady(St){this.cacheService=await St.getAsync(yr.CachingFactory);this.decoratorService.registerMethodHandler(gr.CACHE_DECORATOR_KEY,(({target:St,propertyName:Dt,metadata:rr})=>{if(!rr.cacheKey){rr.cacheKey=getClassMethodDefaultCacheKey(St,Dt)}return{around:async St=>{let Dt=rr.cacheKey;const cr=this.cacheService.get(rr.cacheInstanceName);if(typeof Dt==="function"){Dt=await Dt({methodArgs:St.args,ctx:St.target[mr.REQUEST_OBJ_CTX_KEY],target:St.target})}if(typeof Dt==="string"){return cr.methodWrap(Dt,St.proceed,St.args,rr.ttl)}else{return St.proceed(...St.args)}}}}))}};cr([(0,mr.Inject)(),pr("design:type",mr.MidwayDecoratorService)],Sr.prototype,"decoratorService",void 0);Sr=cr([(0,mr.Configuration)({namespace:"cacheManager",importConfigs:[{default:{cacheManager:{}}}]})],Sr);Dt.CacheConfiguration=Sr},42696:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Caching=Dt.CACHE_DECORATOR_KEY=void 0;const cr=rr(46123);Dt.CACHE_DECORATOR_KEY="cache-manager:caching";function Caching(St,rr,pr){if(typeof rr==="number"){pr=rr;rr=undefined}return(0,cr.createCustomMethodDecorator)(Dt.CACHE_DECORATOR_KEY,{cacheInstanceName:St,cacheKey:rr,ttl:pr})}Dt.Caching=Caching},91761:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.CachingFactory=void 0;const mr=rr(46123);const gr=rr(8869);let yr=class CachingFactory extends mr.ServiceFactory{async init(){await this.initClients(this.cacheManagerConfig)}async createClient(St,Dt){if(Array.isArray(St.store)){const rr=[];for(const cr of St.store){if(typeof cr==="string"){if(!this.has(cr)){throw new mr.MidwayCommonError(`cache instance "${cr}" not found in "${Dt}", please check your configuration.`)}rr.push(this.get(cr))}else if(typeof cr==="function"){rr.push(await cr())}else if(cr["wrap"]){rr.push(cr["wrap"])}else if(typeof cr==="object"){if(typeof cr.store==="function"){cr.store=await cr.store(cr["options"]||{},this.applicationContext)}if(!cr.store){throw new mr.MidwayCommonError(`cache instance "${Dt}" store is undefined, please check your configuration.`)}rr.push(await(0,gr.caching)(cr.store,cr["options"]))}else{throw new mr.MidwayCommonError("invalid cache config")}}return await(0,gr.multiCaching)(rr)}else{if(typeof St.store==="function"){St.store=await St.store(St["options"]||{},this.applicationContext)}if(!St.store){throw new mr.MidwayCommonError(`cache instance "${Dt}" store is undefined, please check your configuration.`)}return await(0,gr.caching)(St.store,St["options"])}}getName(){return"cache-manager"}getCaching(St){return this.get(St)}getMultiCaching(St){return this.get(St)}};cr([(0,mr.Config)("cacheManager"),pr("design:type",Object)],yr.prototype,"cacheManagerConfig",void 0);cr([(0,mr.ApplicationContext)(),pr("design:type",Object)],yr.prototype,"applicationContext",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],yr.prototype,"init",null);yr=cr([(0,mr.Provide)(),(0,mr.Scope)(mr.ScopeEnum.Singleton)],yr);Dt.CachingFactory=yr},96955:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.CacheManager=Dt.getClassMethodDefaultCacheKey=Dt.Configuration=void 0;var mr=rr(68805);Object.defineProperty(Dt,"Configuration",{enumerable:true,get:function(){return mr.CacheConfiguration}});Object.defineProperty(Dt,"getClassMethodDefaultCacheKey",{enumerable:true,get:function(){return mr.getClassMethodDefaultCacheKey}});pr(rr(43488),Dt);pr(rr(91761),Dt);pr(rr(42696),Dt);Dt.CacheManager=rr(8869);pr(rr(93730),Dt)},43488:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},93730:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.createRedisStore=void 0;const cr=rr(46123);const getVal=St=>JSON.stringify(St)||'"undefined"';function createRedisStore(St){return async(Dt,rr)=>{const{RedisServiceFactory:pr}=(0,cr.safeRequire)("@midwayjs/redis");const mr=await rr.getAsync(pr);const gr=mr.get(St);return createStore(gr,Dt)}}Dt.createRedisStore=createRedisStore;function createStore(St,Dt){const rr=(Dt===null||Dt===void 0?void 0:Dt.isCacheable)||(St=>St!==undefined&&St!==null);const keys=Dt=>St.keys(Dt);return{async get(Dt){const rr=await St.get(Dt);if(rr===undefined||rr===null)return undefined;else{try{return JSON.parse(rr)}catch(St){return rr}}},async set(pr,mr,gr){if(!rr(mr))throw new cr.MidwayCommonError(`"${mr}" is not a cacheable value`);const yr=gr===undefined?Dt===null||Dt===void 0?void 0:Dt.ttl:gr;if(yr!==undefined&&yr!==0)await St.set(pr,getVal(mr),"PX",yr);else await St.set(pr,getVal(mr))},async mset(pr,mr){const gr=mr===undefined?Dt===null||Dt===void 0?void 0:Dt.ttl:mr;if(gr!==undefined&&gr!==0){const Dt=St.multi();for(const[St,mr]of pr){if(!rr(mr))throw new cr.MidwayCommonError(`"${getVal(mr)}" is not a cacheable value`);Dt.set(St,getVal(mr),"PX",gr)}await Dt.exec()}else await St.mset(pr.flatMap((([St,Dt])=>{if(!rr(Dt))throw new Error(`"${getVal(Dt)}" is not a cacheable value`);return[St,getVal(Dt)]})))},mget:(...Dt)=>St.mget(Dt).then((St=>St.map((St=>{if(St===null||St===undefined){return undefined}else{try{return JSON.parse(St)}catch(Dt){return St}}})))),async mdel(...Dt){await St.del(Dt)},async del(Dt){await St.del(Dt)},ttl:async Dt=>St.pttl(Dt),keys:(St="*")=>keys(St),reset:()=>{throw new cr.MidwayCommonError("flushdb() is too dangerous, if necessary, please use redisServiceFactory.get(client) to get the instance and call it manually.")},isCacheable:rr}}},4074:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Cookie=void 0;const cr=rr(42613);const pr=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;const mr=/^(?:none|lax|strict)$/i;class Cookie{constructor(St,Dt,rr){cr(pr.test(St),"argument name is invalid");cr(!Dt||pr.test(Dt),"argument value is invalid");this.name=St;this.value=Dt||"";this.attrs=mergeDefaultAttrs(rr);cr(!this.attrs.path||pr.test(this.attrs.path),"argument option path is invalid");cr(!this.attrs.domain||pr.test(this.attrs.domain),"argument option domain is invalid");cr(!this.attrs.sameSite||this.attrs.sameSite===true||mr.test(this.attrs.sameSite),"argument option sameSite is invalid");if(!Dt){this.attrs.expires=new Date(0);this.attrs.maxAge=null}}toString(){return this.name+"="+this.value}toHeader(){let St=this.toString();const Dt=this.attrs;if(Dt.path)St+="; path="+Dt.path;const rr=typeof Dt.maxAge==="string"?parseInt(Dt.maxAge,10):Dt.maxAge;if(rr){St+="; max-age="+Math.round(rr/1e3);Dt.expires=new Date(Date.now()+rr)}if(Dt.expires)St+="; expires="+Dt.expires.toUTCString();if(Dt.domain)St+="; domain="+Dt.domain;if(Dt.sameSite)St+="; samesite="+(Dt.sameSite===true?"strict":Dt.sameSite.toLowerCase());if(Dt.secure)St+="; secure";if(Dt.httpOnly)St+="; httponly";if(Dt.priority)St+="; priority="+Dt.priority;if(Dt.partitioned)St+="; partitioned";return St}}Dt.Cookie=Cookie;const gr=["path","expires","domain","httpOnly","secure","partitioned","maxAge","overwrite","sameSite","priority"];function mergeDefaultAttrs(St){const Dt={path:"/",httpOnly:true,secure:false,overwrite:false,sameSite:false,partitioned:false};if(!St)return Dt;for(let rr=0;rr<gr.length;rr++){const cr=gr[rr];if(cr in St)Dt[cr]=St[cr]}return Dt}},11033:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.urlSafeDecode=Dt.urlSafeEncode=Dt.Cookies=void 0;const cr=rr(42613);const pr=rr(4074);const mr=rr(5693);const gr=rr(86054);const yr=Symbol("midwayCookies:keysArray");const Sr=Symbol("midwayCookies:keys");const $r=new Map;class Cookies{constructor(St,Dt,rr,cr){var pr;this[yr]=Dt?[].concat(Dt):Dt;this._defaultCookieOptions=rr;this._defaultGetCookieOptions=cr;this.ctx=St;this.secure=(pr=rr===null||rr===void 0?void 0:rr.secure)!==null&&pr!==void 0?pr:this.ctx.secure;this.app=St.app}get keys(){if(!this[Sr]){const St=this[yr];cr(Array.isArray(St),".keys required for encrypt/sign cookies");const Dt=$r.get(St);if(Dt){this[Sr]=Dt}else{this[Sr]=new mr.Keygrip(this[yr]);$r.set(St,this[Sr])}}return this[Sr]}get(St,Dt){Dt=Object.assign({},this._defaultGetCookieOptions||{},Dt);const rr=computeSigned(Dt);const cr=this.ctx.get("cookie");if(!cr)return;const pr=cr.match(getPattern(St));if(!pr)return;let mr=pr[1];if(!Dt.encrypt&&!rr)return mr;if(rr){const Dt=St+".sig";const rr=this.get(Dt,{signed:false});if(!rr)return;const cr=St+"="+mr;const pr=this.keys.verify(cr,rr);if(pr<0){this.set(Dt,null,{path:"/",signed:false});return}if(pr>0){this.set(Dt,this.keys.sign(cr),{signed:false})}return mr}mr=urlSafeDecode(mr);const gr=this.keys.decrypt(mr);if(gr===null||gr===void 0?void 0:gr.value){return gr.value.toString()}return undefined}set(St,Dt,rr){if(!rr&&typeof Dt!=="string"){rr=Dt;Dt=""}rr=Object.assign({},this._defaultCookieOptions,rr);const cr=computeSigned(rr);Dt=Dt||"";if(!this.secure&&rr.secure){throw new Error("Cannot send secure cookie over unencrypted connection")}let mr=this.ctx.response.get("set-cookie")||[];if(!Array.isArray(mr))mr=[mr];if(rr.encrypt){Dt=Dt&&urlSafeEncode(this.keys.encrypt(Dt))}if(Dt.length>4093){this.app.emit("cookieLimitExceed",{name:St,value:Dt,ctx:this.ctx})}const gr=this.ctx.get("user-agent");if(rr.sameSite&&typeof rr.sameSite==="string"&&rr.sameSite.toLowerCase()==="none"){if(!this.secure||gr&&!this.isSameSiteNoneCompatible(gr)){rr.sameSite=false}}if(rr.partitioned){if(!this.secure||!gr||gr&&!this.isPartitionedCompatible(gr)){rr.partitioned=false}}if(rr.partitioned&&rr.removeUnpartitioned){const Dt=rr.overwrite;if(Dt){rr.overwrite=false;mr=ignoreCookiesByName(mr,St)}const gr=Object.assign({},rr,{partitioned:false});const yr=new pr.Cookie(St,"",gr);if(rr.secure===undefined)yr.attrs.secure=this.secure;mr=pushCookie(mr,yr);if(cr){yr.name+=".sig";mr=ignoreCookiesByName(mr,yr.name);mr=pushCookie(mr,yr)}}if(rr.priority){if(!gr||gr&&!this.isPriorityCompatible(gr)){rr.priority=undefined}}const yr=new pr.Cookie(St,Dt,rr);if(rr.secure===undefined)yr.attrs.secure=this.secure;mr=pushCookie(mr,yr);if(cr){yr.value=Dt&&this.keys.sign(yr.toString());yr.name+=".sig";mr=pushCookie(mr,yr)}this.ctx.set("set-cookie",mr);return this}isSameSiteNoneCompatible(St){const Dt=this.parseChromiumAndMajorVersion(St);if(Dt.chromium&&Dt.majorVersion){return Dt.majorVersion>=80}return(0,gr.isSameSiteNoneCompatible)(St)}isPartitionedCompatible(St){const Dt=this.parseChromiumAndMajorVersion(St);if(Dt.chromium&&Dt.majorVersion){return Dt.majorVersion>=114}return false}parseChromiumAndMajorVersion(St){if(!this.uaParseResult){const Dt=/Chrom[^ /]+\/(\d+)[.\d]* /.exec(St);if(!Dt)return{chromium:false,majorVersion:undefined};this.uaParseResult={chromium:true,majorVersion:parseInt(Dt[1])}}return this.uaParseResult}isPriorityCompatible(St){const Dt=this.parseChromiumAndMajorVersion(St);if(Dt.chromium&&Dt.majorVersion){return Dt.majorVersion>=81}return false}}Dt.Cookies=Cookies;const Er=new Map;function getPattern(St){const Dt=Er.get(St);if(Dt)return Dt;const rr=new RegExp("(?:^|;) *"+St.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)");Er.set(St,rr);return rr}function computeSigned(St){if(St.encrypt)return false;return St.signed!==false}function pushCookie(St,Dt){if(Dt.attrs.overwrite){St=ignoreCookiesByName(St,Dt.name)}St.push(Dt.toHeader());return St}function ignoreCookiesByName(St,Dt){const rr=`${Dt}=`;return St.filter((St=>!St.startsWith(rr)))}function urlSafeEncode(St){return St.replace(/\+/g,"-").replace(/\//g,"_")}Dt.urlSafeEncode=urlSafeEncode;function urlSafeDecode(St){return St.replace(/-/g,"+").replace(/_/g,"/")}Dt.urlSafeDecode=urlSafeDecode},60990:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});pr(rr(33249),Dt);pr(rr(11033),Dt)},33249:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},5693:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Keygrip=void 0;const cr=rr(42613);const pr=rr(39023);const mr=rr(76982);const gr=rr(48978);const yr=(0,pr.debuglog)("midway:cookies");const Sr={"/":"_","+":"-","=":""};class Keygrip{constructor(St){cr(Array.isArray(St)&&St.length,"keys must be provided and should be an array");this.keys=St;this.hash="sha256"}encrypt(St,Dt){Dt=Dt||this.keys[0];try{St=String(St);const rr=getAlgorithm();const cr=(0,mr.randomBytes)(64);const pr=(0,mr.randomBytes)(16);const gr=Math.floor(Math.random()*(99999-1e4+1))+1e4;const yr=deriveKeyFromPassword(Dt,cr,Math.floor(gr*.47+1337));const Sr=(0,mr.createCipheriv)(rr,yr,pr);const $r=Buffer.concat([Sr.update(St,"utf8"),Sr.final()]);const Er=Sr.getAuthTag();const Ir=Buffer.concat([cr,pr,Er,Buffer.from(gr.toString()),$r]).toString("hex");return getEncryptedPrefix()+Ir}catch(St){yr("crypt error",St.stack);return undefined}}decrypt(St,Dt){if(!Dt){const Dt=this.keys;for(let rr=0;rr<Dt.length;rr++){const cr=this.decrypt(St,Dt[rr]);if(cr!==false)return{value:cr,index:rr}}return false}try{const rr=getAlgorithm();const cr=St.split(getEncryptedPrefix());if(cr.length!==2){return void 0}else{St=cr[1]}const pr=Buffer.from(St,"hex");const gr=pr.slice(0,64);const yr=pr.slice(64,80);const Sr=pr.slice(80,96);const $r=parseInt(pr.slice(96,101).toString("utf-8"),10);const Er=pr.slice(101);const Ir=deriveKeyFromPassword(Dt,gr,Math.floor($r*.47+1337));const Or=(0,mr.createDecipheriv)(rr,Ir,yr);Or.setAuthTag(Sr);return Or.update(Er,"binary","utf-8")+Or.final("utf-8")}catch(St){yr("crypt error",St.stack);return false}}sign(St,Dt){Dt=Dt||this.keys[0];return(0,mr.createHmac)(this.hash,Dt).update(St).digest("base64").replace(/\/|\+|=/g,(St=>Sr[St]))}verify(St,Dt){const rr=this.keys;for(let cr=0;cr<rr.length;cr++){if(gr(Buffer.from(Dt),Buffer.from(this.sign(St,rr[cr])))){yr("data %s match key %s",St,rr[cr]);return cr}}return-1}}Dt.Keygrip=Keygrip;function getAlgorithm(){return"aes-256-gcm"}function getEncryptedPrefix(){return"enc::"}function deriveKeyFromPassword(St,Dt,rr){return(0,mr.pbkdf2Sync)(St,Dt,rr,32,"sha512")}},83872:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.BaseFramework=void 0;const mr=rr(6192);const gr=rr(2222);const yr=rr(49757);const Sr=rr(97983);const $r=rr(70275);const Er=rr(78842);const Ir=rr(37482);const Or=rr(34888);const Hr=rr(12738);const Gr=rr(68220);const Tn=rr(39408);const Wn=rr(77306);const Gn=rr(39023);const mi=rr(75351);const $i=rr(40581);const ki=Gn.debuglog("midway:debug");class BaseFramework{constructor(St){this.applicationContext=St;this.defaultContext={};this.middlewareManager=this.createMiddlewareManager();this.filterManager=this.createFilterManager();this.guardManager=this.createGuardManager();this.composeMiddleware=null}async init(){var St,Dt;this.configurationOptions=(St=this.configure())!==null&&St!==void 0?St:{};this.contextLoggerApplyLogger=(Dt=this.configurationOptions.contextLoggerApplyLogger)!==null&&Dt!==void 0?Dt:"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(St){this.bootstrapOptions=St;await this.beforeContainerInitialize(St);await this.containerInitialize(St);await this.afterContainerInitialize(St);await this.containerDirectoryLoad(St);await this.afterContainerDirectoryLoad(St);await this.applicationInitialize(St);await this.containerReady(St);await this.afterContainerReady(St);await this.mockService.runSimulatorAppSetup(this.app)}async containerInitialize(St){}async containerDirectoryLoad(St){}async containerReady(St){if(!this.app.getApplicationContext){this.defineApplicationProperties()}}getApplicationContext(){return this.applicationContext}getConfiguration(St){return this.configService.getConfiguration(St)}getCurrentEnvironment(){return this.environmentService.getCurrentEnvironment()}getApplication(){return this.app}createContextLogger(St,Dt){if(Dt&&Dt!=="appLogger"){const rr=this.getLogger(Dt);let cr=St.getAttr(gr.REQUEST_CTX_LOGGER_CACHE_KEY);if(!cr){cr=new Map;St.setAttr(gr.REQUEST_CTX_LOGGER_CACHE_KEY,cr)}if(cr.has(Dt)){return cr.get(Dt)}const pr=this.loggerService.createContextLogger(St,rr);cr.set(Dt,pr);return pr}else{const rr=this.getLogger(Dt!==null&&Dt!==void 0?Dt:this.contextLoggerApplyLogger);if(St["_logger"]){return St["_logger"]}St["_logger"]=this.loggerService.createContextLogger(St,rr,{contextFormat:this.contextLoggerFormat});return St["_logger"]}}async stop(){await this.mockService.runSimulatorAppTearDown(this.app);await this.beforeStop()}getAppDir(){return this.informationService.getAppDir()}getBaseDir(){return this.informationService.getBaseDir()}defineApplicationProperties(St={},Dt=[]){const rr={getBaseDir:()=>this.getBaseDir(),getAppDir:()=>this.getAppDir(),getEnv:()=>this.getCurrentEnvironment(),getApplicationContext:()=>this.getApplicationContext(),getConfig:St=>this.getConfiguration(St),getFrameworkType:()=>{if(this["getFrameworkType"]){return this["getFrameworkType"]()}},getProcessType:()=>mr.MidwayProcessTypeEnum.APPLICATION,getCoreLogger:()=>this.getCoreLogger(),getLogger:St=>this.getLogger(St),createLogger:(St,Dt={})=>this.createLogger(St,Dt),getFramework:()=>this,getProjectName:()=>this.getProjectName(),createAnonymousContext:St=>{const Dt=St||Object.create(this.defaultContext);if(!Dt.startTime){Dt.startTime=Date.now()}if(!Dt.logger){Dt.logger=this.createContextLogger(Dt)}if(!Dt.requestContext){Dt.requestContext=new Sr.MidwayRequestContainer(Dt,this.getApplicationContext());Dt.requestContext.ready()}if(!Dt.getLogger){Dt.getLogger=St=>this.createContextLogger(Dt,St)}Dt.setAttr=(St,rr)=>{Dt.requestContext.setAttr(St,rr)};Dt.getAttr=St=>Dt.requestContext.getAttr(St);Dt.getApp=()=>this.getApplication();return Dt},addConfigObject:St=>{this.configService.addObject(St)},setAttr:(St,Dt)=>{this.getApplicationContext().setAttr(St,Dt)},getAttr:St=>this.getApplicationContext().getAttr(St),useMiddleware:St=>this.useMiddleware(St),getMiddleware:()=>this.getMiddleware(),useFilter:St=>this.useFilter(St),useGuard:St=>this.useGuard(St),getNamespace:()=>this.getNamespace()};for(const St of Dt){delete rr[St]}Object.assign(this.app,rr,St)}async beforeStop(){}async beforeContainerInitialize(St){}async afterContainerInitialize(St){}async afterContainerDirectoryLoad(St){}async afterContainerReady(St){}async applyMiddleware(St){var Dt;if(!this.composeMiddleware){if(!this.applicationContext.hasObject(gr.ASYNC_CONTEXT_MANAGER_KEY)){const St=this.configService.getConfiguration("asyncContextManager.enable")||false;const rr=St?((Dt=this.bootstrapOptions)===null||Dt===void 0?void 0:Dt.asyncContextManager)||new mi.NoopContextManager:new mi.NoopContextManager;if(St){rr.enable()}this.applicationContext.registerObject(gr.ASYNC_CONTEXT_MANAGER_KEY,rr)}this.middlewareManager.insertFirst((async(St,Dt)=>{const rr=mi.ASYNC_ROOT_CONTEXT.setValue(gr.ASYNC_CONTEXT_KEY,St);const cr=this.applicationContext.get(gr.ASYNC_CONTEXT_MANAGER_KEY);return await cr.with(rr,(async()=>{await this.mockService.runSimulatorContextSetup(St,this.app);this.mockService.applyContextMocks(this.app,St);let rr=undefined;try{const cr=await Dt();rr=await this.filterManager.runResultFilter(cr,St)}catch(Dt){rr=await this.filterManager.runErrorFilter(Dt,St)}finally{await this.mockService.runSimulatorContextTearDown(St,this.app)}if(rr.error){throw rr.error}return rr.result}))}));ki(`[core]: Compose middleware = [${this.middlewareManager.getNames()}]`);this.composeMiddleware=await this.middlewareService.compose(this.middlewareManager,this.app);await this.filterManager.init(this.applicationContext)}if(St){St=Array.isArray(St)?St:[St];return await this.middlewareService.compose([this.composeMiddleware,...St],this.app)}return this.composeMiddleware}getLogger(St){var Dt;return(Dt=this.loggerService.getLogger(St))!==null&&Dt!==void 0?Dt:this.appLogger}getCoreLogger(){return this.logger}createLogger(St,Dt={}){return this.loggerService.createLogger(St,Dt)}getProjectName(){return this.informationService.getProjectName()}getFrameworkName(){return this.constructor.name}useMiddleware(St){this.middlewareManager.insertLast(St)}getMiddleware(){return this.middlewareManager}useFilter(St){return this.filterManager.useFilter(St)}useGuard(St){return this.guardManager.addGlobalGuard(St)}async runGuard(St,Dt,rr){return this.guardManager.runGuard(St,Dt,rr)}createMiddlewareManager(){return new Hr.ContextMiddlewareManager}createFilterManager(){return new Tn.FilterManager}createGuardManager(){return new $i.GuardManager}setNamespace(St){this.namespace=St}getNamespace(){return this.namespace}}cr([(0,yr.Inject)(),pr("design:type",Or.MidwayLoggerService)],BaseFramework.prototype,"loggerService",void 0);cr([(0,yr.Inject)(),pr("design:type",$r.MidwayEnvironmentService)],BaseFramework.prototype,"environmentService",void 0);cr([(0,yr.Inject)(),pr("design:type",Er.MidwayConfigService)],BaseFramework.prototype,"configService",void 0);cr([(0,yr.Inject)(),pr("design:type",Ir.MidwayInformationService)],BaseFramework.prototype,"informationService",void 0);cr([(0,yr.Inject)(),pr("design:type",Gr.MidwayMiddlewareService)],BaseFramework.prototype,"middlewareService",void 0);cr([(0,yr.Inject)(),pr("design:type",Wn.MidwayMockService)],BaseFramework.prototype,"mockService",void 0);cr([(0,yr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],BaseFramework.prototype,"init",null);Dt.BaseFramework=BaseFramework},43436:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayApplicationManager=void 0;const pr=rr(6192);const mr=rr(49757);let gr=class MidwayApplicationManager{constructor(){this.globalFrameworkMap=new Map;this.globalFrameworkTypeMap=new WeakMap}addFramework(St,Dt){this.globalFrameworkMap.set(St,Dt);if(Dt["getFrameworkType"]){this.globalFrameworkTypeMap.set(Dt["getFrameworkType"](),Dt)}}getFramework(St){if(typeof St==="string"){if(this.globalFrameworkMap.has(St)){return this.globalFrameworkMap.get(St)}}else{if(this.globalFrameworkTypeMap.has(St)){return this.globalFrameworkTypeMap.get(St)}}}getApplication(St){if(typeof St==="string"){if(this.globalFrameworkMap.has(St)){return this.globalFrameworkMap.get(St).getApplication()}}else{if(this.globalFrameworkTypeMap.has(St)){return this.globalFrameworkTypeMap.get(St).getApplication()}}}getApplications(St){if(!St){return Array.from(this.globalFrameworkMap.values()).map((St=>St.getApplication())).filter((St=>!!St))}else{return St.map((St=>this.getApplication(St))).filter((St=>!!St))}}};gr=cr([(0,mr.Provide)(),(0,mr.Scope)(pr.ScopeEnum.Singleton)],gr);Dt.MidwayApplicationManager=gr},75351:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.NoopContextManager=Dt.ASYNC_ROOT_CONTEXT=void 0;class AsyncBaseContext{constructor(St){const Dt=this;Dt._currentContext=St?new Map(St):new Map;Dt.getValue=St=>Dt._currentContext.get(St);Dt.setValue=(St,rr)=>{const cr=new AsyncBaseContext(Dt._currentContext);cr._currentContext.set(St,rr);return cr};Dt.deleteValue=St=>{const rr=new AsyncBaseContext(Dt._currentContext);rr._currentContext.delete(St);return rr}}}Dt.ASYNC_ROOT_CONTEXT=new AsyncBaseContext;class NoopContextManager{active(){return Dt.ASYNC_ROOT_CONTEXT}with(St,Dt,rr,...cr){return Dt.call(rr,...cr)}bind(St,Dt){return Dt}enable(){return this}disable(){return this}}Dt.NoopContextManager=NoopContextManager},46673:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.DataListener=void 0;const mr=rr(49757);class DataListener{async init(){this.innerData=await this.initData();await this.onData(this.setData.bind(this))}setData(St){this.innerData=St}getData(){return this.innerData}async stop(){await this.destroyListener()}async destroyListener(){}}cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],DataListener.prototype,"init",null);cr([(0,mr.Destroy)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],DataListener.prototype,"stop",null);Dt.DataListener=DataListener},12849:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.globModels=Dt.formatGlobString=Dt.DataSourceManager=void 0;const mr=rr(83486);const gr=rr(86314);const yr=rr(62525);const Sr=rr(16928);const $r=rr(63289);const Er=rr(2222);const Ir=rr(39023);const Or=rr(65308);const Hr=rr(49757);const Gr=rr(70275);const Tn=rr(78842);const Wn=rr(67934);const Gn=(0,Ir.debuglog)("midway:debug");class DataSourceManager{constructor(){this.dataSource=new Map;this.options={};this.modelMapping=new WeakMap;this.dataSourcePriority={}}async initDataSource(St,Dt){var rr,cr;this.options=St;if(!this.options.dataSource){throw new gr.MidwayParameterError("[DataSourceManager] must set options.dataSource.")}if(typeof Dt==="string"){Dt={baseDir:Dt,entitiesConfigKey:"entities"}}const pr=Dt;const mr=(cr=(rr=this.configService)===null||rr===void 0?void 0:rr.getConfiguration("core.concurrentDataSourceInitialization"))!==null&&cr!==void 0?cr:false;const processDataSource=async Dt=>{var rr;const cr=St.dataSource[Dt];const mr=cr[pr.entitiesConfigKey];if(mr){const St=new Set;for(const cr of mr){if(typeof cr==="string"){const mr=await globModels(cr,pr.baseDir,(rr=this.environmentService)===null||rr===void 0?void 0:rr.getModuleLoadType());for(const rr of mr){St.add(rr);this.modelMapping.set(rr,Dt)}}else{St.add(cr);this.modelMapping.set(cr,Dt)}}cr[pr.entitiesConfigKey]=Array.from(St);Gn(`[core]: DataManager load ${cr[pr.entitiesConfigKey].length} models from ${Dt}.`)}const gr={cacheInstance:St.cacheInstance,validateConnection:St.validateConnection};await this.createInstance(cr,Dt,gr)};const yr=Object.keys(St.dataSource);if(mr){await Promise.all(yr.map(processDataSource))}else{for(const St of yr){await processDataSource(St)}}}getDataSource(St){return this.dataSource.get(St)}hasDataSource(St){return this.dataSource.has(St)}getDataSourceNames(){return Array.from(this.dataSource.keys())}getAllDataSources(){return this.dataSource}async isConnected(St){const Dt=this.getDataSource(St);return Dt?this.checkConnected(Dt):false}async createInstance(St,Dt,rr){const cr=rr&&typeof rr.cacheInstance==="boolean"?rr.cacheInstance:true;const pr=rr&&rr.validateConnection||false;const yr=(0,mr.extend)(true,{},this.options["default"],St);const Sr=await this.createDataSource(yr,Dt);if(cr&&Dt&&Sr){this.dataSource.set(Dt,Sr)}if(pr){if(!Sr){throw new gr.MidwayCommonError(`[DataSourceManager] ${Dt} initialization failed.`)}const St=await this.checkConnected(Sr);if(!St){throw new gr.MidwayCommonError(`[DataSourceManager] ${Dt} is not connected.`)}}return Sr}getDataSourceNameByModel(St){return this.modelMapping.get(St)}async stop(){const St=Array.from(this.dataSource.values());await Promise.all(St.map((St=>this.destroyDataSource(St))));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(St){return this.priorityManager.getPriority(this.dataSourcePriority[St])}isHighPriority(St){return this.priorityManager.isHighPriority(this.dataSourcePriority[St])}isMediumPriority(St){return this.priorityManager.isMediumPriority(this.dataSourcePriority[St])}isLowPriority(St){return this.priorityManager.isLowPriority(this.dataSourcePriority[St])}}cr([(0,Hr.Inject)(),pr("design:type",String)],DataSourceManager.prototype,"appDir",void 0);cr([(0,Hr.Inject)(),pr("design:type",Gr.MidwayEnvironmentService)],DataSourceManager.prototype,"environmentService",void 0);cr([(0,Hr.Inject)(),pr("design:type",Tn.MidwayConfigService)],DataSourceManager.prototype,"configService",void 0);cr([(0,Hr.Inject)(),pr("design:type",Wn.MidwayPriorityManager)],DataSourceManager.prototype,"priorityManager",void 0);Dt.DataSourceManager=DataSourceManager;function formatGlobString(St){let Dt;if(!/^\*/.test(St)){St="/"+St}const rr=(0,Sr.parse)(St);if(rr.base&&(/\*/.test(rr.base)||rr.ext)){Dt=[St]}else{Dt=[...Er.DEFAULT_PATTERN.map((Dt=>(0,Sr.join)(St,Dt)))]}return Dt}Dt.formatGlobString=formatGlobString;async function globModels(St,Dt,rr){const cr=formatGlobString(St);const pr=[];const mr=(0,yr.run)(cr,{cwd:Dt,ignore:Er.IGNORE_PATTERN});for(const St of mr){const Dt=await(0,Or.loadModule)(St,{loadMode:rr});if($r.Types.isClass(Dt)){pr.push(Dt)}else{for(const St in Dt){const rr=Dt[St];if($r.Types.isClass(rr)){pr.push(rr)}}}}return pr}Dt.globModels=globModels},1845:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.CustomModuleDetector=Dt.ESModuleFileDetector=Dt.CommonJSFileDetector=Dt.AbstractFileDetector=void 0;const cr=rr(63289);const pr=rr(62525);const mr=rr(86314);const gr=rr(2222);const yr=rr(49757);const Sr=rr(65308);class AbstractFileDetector{constructor(St){this.options=St;this.extraDetectorOptions={}}setExtraDetectorOptions(St){this.extraDetectorOptions=St}}Dt.AbstractFileDetector=AbstractFileDetector;const $r=["**/**.tsx"].concat(gr.DEFAULT_PATTERN);const Er=["**/logs/**","**/run/**","**/public/**","**/app/view/**","**/app/views/**","**/app/extend/**","**/node_modules/**","**/**.test.ts","**/**.test.js","**/__test__/**"].concat(gr.IGNORE_PATTERN);class CommonJSFileDetector extends AbstractFileDetector{constructor(){super(...arguments);this.duplicateModuleCheckSet=new Map}run(St){if(this.getType()==="commonjs"){return this.loadSync(St)}else{return this.loadAsync(St)}}loadSync(St){var Dt;this.options=this.options||{};const rr=[].concat((Dt=this.options.loadDir)!==null&&Dt!==void 0?Dt:St.get("baseDir"));for(const Dt of rr){const rr=(0,pr.run)($r.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:Dt,ignore:Er.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(St,Dt)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&cr.Types.isClass(St)){const rr=(0,yr.getProviderName)(St);if(rr){if(this.duplicateModuleCheckSet.has(rr)){throw new mr.MidwayDuplicateClassNameError(rr,Dt.srcPath,this.duplicateModuleCheckSet.get(rr))}else{this.duplicateModuleCheckSet.set(rr,Dt.srcPath)}}}};for(const Dt of rr){const rr=require(Dt);St.bindClass(rr,{namespace:this.options.namespace,srcPath:Dt,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}async loadAsync(St){var Dt;this.options=this.options||{};const rr=[].concat((Dt=this.options.loadDir)!==null&&Dt!==void 0?Dt:St.get("baseDir"));for(const Dt of rr){const rr=(0,pr.run)($r.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:Dt,ignore:Er.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(St,Dt)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&cr.Types.isClass(St)){const rr=(0,yr.getProviderName)(St);if(rr){if(this.duplicateModuleCheckSet.has(rr)){throw new mr.MidwayDuplicateClassNameError(rr,Dt.srcPath,this.duplicateModuleCheckSet.get(rr))}else{this.duplicateModuleCheckSet.set(rr,Dt.srcPath)}}}};for(const Dt of rr){const rr=await(0,Sr.loadModule)(Dt,{loadMode:"esm"});St.bindClass(rr,{namespace:this.options.namespace,srcPath:Dt,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}getType(){return"commonjs"}}Dt.CommonJSFileDetector=CommonJSFileDetector;class ESModuleFileDetector extends CommonJSFileDetector{getType(){return"module"}}Dt.ESModuleFileDetector=ESModuleFileDetector;class CustomModuleDetector extends AbstractFileDetector{async run(St){for(const Dt of this.options.modules){St.bindClass(Dt,{namespace:this.options.namespace,createFrom:"module"})}}}Dt.CustomModuleDetector=CustomModuleDetector},39408:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.FilterManager=void 0;const cr=rr(49757);const pr=rr(65308);class FilterManager{constructor(){this.errFilterList=[];this.successFilterList=[];this.exceptionMap=new WeakMap;this.defaultErrFilter=undefined;this.matchFnList=[];this.protoMatchList=[]}useFilter(St){if(!Array.isArray(St)){St=[St]}for(const Dt of St){if((0,cr.getClassMetadata)(cr.CATCH_KEY,Dt)){this.errFilterList.push(Dt)}if((0,cr.getClassMetadata)(cr.MATCH_KEY,Dt)){this.successFilterList.push(Dt)}}}async init(St){for(const Dt of this.errFilterList){const rr=await St.getAsync(Dt);const pr=(0,cr.getClassMetadata)(cr.CATCH_KEY,Dt);if(pr&&pr.catchTargets){pr.catchOptions=pr.catchOptions||{};for(const St of pr.catchTargets){this.exceptionMap.set(St,{filter:rr,catchOptions:pr.catchOptions});if(pr.catchOptions["matchPrototype"]){this.protoMatchList.push((Dt=>{if(Dt instanceof St){return St}else{return false}}))}}}else{this.defaultErrFilter=rr}}for(const Dt of this.successFilterList){const rr=await St.getAsync(Dt);const mr=(0,cr.getClassMetadata)(cr.MATCH_KEY,Dt);if(mr&&mr.matchPattern){this.matchFnList.push({matchFn:(0,pr.toPathMatch)(mr.matchPattern),target:rr})}}}async runErrorFilter(St,Dt,rr,cr){let pr,mr;let gr=false;if(St&&this.exceptionMap.has(St.constructor)){gr=true;const mr=this.exceptionMap.get(St.constructor);pr=await mr.filter.catch(St,Dt,rr,cr)}if(!gr&&this.protoMatchList.length){let mr;for(const Dt of this.protoMatchList){mr=Dt(St);if(mr){break}}if(mr){gr=true;const yr=this.exceptionMap.get(mr);pr=await yr.filter.catch(St,Dt,rr,cr)}}if(!gr&&this.defaultErrFilter){gr=true;pr=await this.defaultErrFilter.catch(St,Dt,rr,cr)}if(!gr){mr=St}return{result:pr,error:mr}}async runResultFilter(St,Dt,rr,cr){let pr=St;for(const St of this.matchFnList){if(St.matchFn(Dt,rr)){pr=await St.target.match(pr,Dt,rr,cr)}}return{result:pr,error:undefined}}}Dt.FilterManager=FilterManager},40581:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.GuardManager=void 0;const cr=rr(49757);class GuardManager extends Array{addGlobalGuard(St){if(!Array.isArray(St)){this.push(St)}else{this.push(...St)}}async runGuard(St,Dt,rr){for(const cr of this){const pr=await St.requestContext.getAsync(cr);const mr=await pr.canActivate(St,Dt,rr);if(!mr){return false}}const pr=(0,cr.getClassMetadata)(cr.GUARD_KEY,Dt);if(pr){for(const cr of pr){const pr=await St.requestContext.getAsync(cr);const mr=await pr.canActivate(St,Dt,rr);if(!mr){return false}}}const mr=(0,cr.getPropertyMetadata)(cr.GUARD_KEY,Dt,rr);if(mr){for(const cr of mr){const pr=await St.requestContext.getAsync(cr);const mr=await pr.canActivate(St,Dt,rr);if(!mr){return false}}}return true}}Dt.GuardManager=GuardManager},82535:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.DefaultConsoleLoggerFactory=Dt.LoggerFactory=void 0;class LoggerFactory{}Dt.LoggerFactory=LoggerFactory;class DefaultConsoleLoggerFactory{constructor(){this.instance=new Map}createLogger(St,Dt){this.instance.set(St,console);return console}getLogger(St){return this.instance.get(St)}close(St){}removeLogger(St){}getDefaultMidwayLoggerConfig(){return{midwayLogger:{default:{},clients:{coreLogger:{},appLogger:{}}}}}createContextLogger(St,Dt,rr){return Dt}getClients(){return this.instance}getClientKeys(){return Array.from(this.instance.keys())}}Dt.DefaultConsoleLoggerFactory=DefaultConsoleLoggerFactory},12738:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.createMiddleware=Dt.ContextMiddlewareManager=void 0;class ContextMiddlewareManager extends Array{insertFirst(St){if(Array.isArray(St)){this.unshift(...St)}else{this.unshift(St)}}insertLast(St){if(Array.isArray(St)){this.push(...St)}else{this.push(St)}}insertBefore(St,Dt){if(typeof Dt!=="number"){Dt=this.findItemIndex(Dt)}if(Array.isArray(St)){this.splice(Dt,0,...St)}else{this.splice(Dt,0,St)}}insertAfter(St,Dt){if(typeof Dt!=="number"){Dt=this.findItemIndex(Dt)}if(Array.isArray(St)){this.splice(Dt+1,0,...St)}else{this.splice(Dt+1,0,St)}}findAndInsertAfter(St,Dt){St=this.findItem(St);Dt=this.findItem(Dt);if(!St||!Dt||St===Dt){return}if(Dt){const rr=this.remove(St);if(rr){this.insertAfter(rr,Dt)}}}findAndInsertBefore(St,Dt){St=this.findItem(St);Dt=this.findItem(Dt);if(!St||!Dt||St===Dt){return}if(Dt){const rr=this.remove(St);if(rr){this.insertBefore(rr,Dt)}}}findAndInsertFirst(St){const Dt=this.remove(St);if(Dt){this.insertFirst(Dt)}}findAndInsertLast(St){const Dt=this.remove(St);if(Dt){this.insertLast(Dt)}}findItemIndex(St){if(typeof St==="number"){return St}else if(typeof St==="string"){return this.findIndex((Dt=>this.getMiddlewareName(Dt)===St))}else{return this.findIndex((Dt=>Dt===St))}}findItem(St){if(typeof St==="number"){if(St>=0&&St<=this.length-1){return this[St]}}else if(typeof St==="string"){return this.find((Dt=>this.getMiddlewareName(Dt)===St))}else{return St}}getMiddlewareName(St){var Dt,rr,cr;if(St["middleware"]){return(Dt=St.name)!==null&&Dt!==void 0?Dt:this.getMiddlewareName(St["middleware"])}return(cr=(rr=St.getName&&St.getName())!==null&&rr!==void 0?rr:St._name)!==null&&cr!==void 0?cr:St.name}remove(St){if(typeof St==="number"&&St!==-1){return this.splice(St,1)[0]}else{const Dt=this.findItemIndex(St);if(Dt!==-1){return this.splice(Dt,1)[0]}}}push(...St){St.forEach((St=>{if(typeof St!=="string"&&!this.getMiddlewareName(St)){St._name="anonymous"}}));return super.push(...St)}unshift(...St){St.forEach((St=>{if(typeof St!=="string"&&!this.getMiddlewareName(St)){St._name="anonymous"}}));return super.unshift(...St)}getNames(){return this.map((St=>this.getMiddlewareName(St)))}}Dt.ContextMiddlewareManager=ContextMiddlewareManager;function createMiddleware(St,Dt,rr){return{middleware:St,options:Dt,name:rr}}Dt.createMiddleware=createMiddleware},70032:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayInitializerPerformanceManager=Dt.MidwayPerformanceManager=void 0;const cr=rr(82987);class MidwayPerformanceManager{constructor(St){this.group=St;this.observer=null;this.marks=new Set;this.measures=new Set}static getInstance(St){if(!this.instances.has(St)){this.instances.set(St,new MidwayPerformanceManager(St))}return this.instances.get(St)}formatKey(St,Dt){return`${this.group}:${St}-${Dt}`}markStart(St){const Dt=this.formatKey(St,"start");cr.performance.mark(Dt);this.marks.add(Dt)}markEnd(St){const Dt=this.formatKey(St,"start");const rr=this.formatKey(St,"end");const pr=`${this.group}:${St}`;cr.performance.mark(rr);this.marks.add(rr);cr.performance.measure(pr,Dt,rr);this.measures.add(pr)}observeMeasure(St){if(this.observer){return}this.observer=new cr.PerformanceObserver((Dt=>{const rr=Dt.getEntries().filter((St=>St.name.startsWith(`${this.group}:`)));if(rr.length>0){St({getEntries:()=>rr})}}));this.observer.observe({entryTypes:["measure"]});return this.observer}disconnect(){if(this.observer){this.observer.disconnect();this.observer=null}}clean(){this.marks.forEach((St=>{try{cr.performance.clearMarks(St)}catch(Dt){console.warn(`Failed to clear mark ${St}: ${Dt}`)}}));this.marks.clear();this.measures.forEach((St=>{try{cr.performance.clearMeasures(St)}catch(Dt){console.warn(`Failed to clear measure ${St}: ${Dt}`)}}));this.measures.clear();this.disconnect()}static cleanAll(){this.instances.forEach((St=>St.clean()));this.instances.clear()}static getInitialPerformanceEntries(){const St=[];cr.performance===null||cr.performance===void 0?void 0:cr.performance.getEntries().forEach((Dt=>{if(Dt.name.startsWith(this.DEFAULT_GROUP.INITIALIZE)){St.push(Dt.toJSON())}}));return St}}Dt.MidwayPerformanceManager=MidwayPerformanceManager;MidwayPerformanceManager.instances=new Map;MidwayPerformanceManager.DEFAULT_GROUP={INITIALIZE:"MidwayInitialize"};class MidwayInitializerPerformanceManager{static markStart(St){const Dt=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);Dt.markStart(St)}static markEnd(St){const Dt=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);Dt.markEnd(St)}static frameworkInitializeStart(St){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${St}`)}static frameworkInitializeEnd(St){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${St}`)}static frameworkRunStart(St){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${St}`)}static frameworkRunEnd(St){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${St}`)}static lifecycleStart(St,Dt){this.markStart(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${St}:${Dt}`)}static lifecycleEnd(St,Dt){this.markEnd(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${St}:${Dt}`)}}Dt.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"}},67934:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayPriorityManager=Dt.DEFAULT_PRIORITY=void 0;const pr=rr(49757);const mr=rr(6192);Dt.DEFAULT_PRIORITY={L1:"High",L2:"Medium",L3:"Low"};let gr=class MidwayPriorityManager{constructor(){this.priorityList=Dt.DEFAULT_PRIORITY;this.defaultPriority=Dt.DEFAULT_PRIORITY.L2}getCurrentPriorityList(){return this.priorityList}getDefaultPriority(){return this.defaultPriority}isHighPriority(St=Dt.DEFAULT_PRIORITY.L2){return St===Dt.DEFAULT_PRIORITY.L1}isMediumPriority(St=Dt.DEFAULT_PRIORITY.L2){return St===Dt.DEFAULT_PRIORITY.L2}isLowPriority(St=Dt.DEFAULT_PRIORITY.L2){return St===Dt.DEFAULT_PRIORITY.L3}getPriority(St){return St||this.getDefaultPriority()}};gr=cr([(0,pr.Provide)(),(0,pr.Scope)(mr.ScopeEnum.Singleton)],gr);Dt.MidwayPriorityManager=gr},64842:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.ServiceFactory=void 0;const mr=rr(83486);const gr=rr(67934);const yr=rr(49757);class ServiceFactory{constructor(){this.clients=new Map;this.options={}}async initClients(St={}){this.options=St;if(St.client){St.clients=St.clients||{};St.clients["default"]=St.clients["default"]||{};(0,mr.extend)(true,St.clients["default"],St.client)}if(St.clients){for(const Dt of Object.keys(St.clients)){await this.createInstance(St.clients[Dt],Dt)}}this.clientPriority=St.priority||{}}get(St="default"){return this.clients.get(St)}has(St){return this.clients.has(St)}async createInstance(St,Dt){St=(0,mr.extend)(true,{},this.options["default"],St);const rr=await this.createClient(St,Dt);if(rr){if(Dt){this.clients.set(Dt,rr)}return rr}}async destroyClient(St,Dt){}async stop(){for(const[St,Dt]of this.clients.entries()){await this.destroyClient(Dt,St)}}getDefaultClientName(){return this.options["defaultClientName"]}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}getClientPriority(St){return this.priorityManager.getPriority(this.clientPriority[St])}isHighPriority(St){return this.priorityManager.isHighPriority(this.clientPriority[St])}isMediumPriority(St){return this.priorityManager.isMediumPriority(this.clientPriority[St])}isLowPriority(St){return this.priorityManager.isLowPriority(this.clientPriority[St])}}cr([(0,yr.Inject)(),pr("design:type",gr.MidwayPriorityManager)],ServiceFactory.prototype,"priorityManager",void 0);Dt.ServiceFactory=ServiceFactory},11330:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.TypedResourceManager=void 0;class TypedResourceManager{constructor(St){this.typedResourceInitializerOptions=St;this.resourceMap=new Map;this.resourceBindingMap=new Map}async createResource(St,Dt){const rr=await this.typedResourceInitializerOptions.resourceInitialize(Dt,St);this.resourceMap.set(St,rr);return rr}async init(){for(const St of Object.keys(this.typedResourceInitializerOptions.initializeValue)){const Dt=this.typedResourceInitializerOptions.initializeValue[St];const rr=this.typedResourceInitializerOptions.initializeClzProvider[St];const cr=await this.createResource(St,Dt);const pr=await this.typedResourceInitializerOptions.resourceBinding(rr,Dt,cr,St);if(pr){this.resourceBindingMap.set(St,pr)}}}async startParallel(){const St=[];for(const[Dt,rr]of this.resourceMap.entries()){St.push(this.typedResourceInitializerOptions.resourceStart(rr,this.typedResourceInitializerOptions.initializeValue[Dt],this.resourceBindingMap.get(Dt)))}await Promise.all(St)}async start(){for(const[St,Dt]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceStart(Dt,this.typedResourceInitializerOptions.initializeValue[St],this.resourceBindingMap.get(St))}}async destroyParallel(){const St=[];for(const[Dt,rr]of this.resourceMap.entries()){St.push(this.typedResourceInitializerOptions.resourceDestroy(rr,this.typedResourceInitializerOptions.initializeValue[Dt]))}await Promise.all(St)}async destroy(){for(const[St,Dt]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceDestroy(Dt,this.typedResourceInitializerOptions.initializeValue[St])}this.resourceMap.clear();this.resourceBindingMap.clear()}getResource(St){return this.resourceMap.get(St)}}Dt.TypedResourceManager=TypedResourceManager},11026:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.WebControllerGenerator=void 0;const cr=rr(49757);const pr=rr(39023);const mr=rr(6192);const gr=rr(86314);const yr=rr(68220);const Sr=pr.debuglog("midway:debug");class WebControllerGenerator{constructor(St,Dt){this.app=St;this.midwayWebRouterService=Dt}generateKoaController(St){return async(Dt,rr)=>{if(St.controllerClz&&typeof St.method==="string"){const rr=await this.app.getFramework().runGuard(Dt,St.controllerClz,St.method);if(!rr){throw new gr.httpError.ForbiddenError}}const pr=[Dt,rr];let mr;if(typeof St.method!=="string"){mr=await St.method(Dt,rr)}else{const rr=await Dt.requestContext.getAsync(St.id);mr=await rr[St.method].apply(rr,pr)}if(mr!==undefined){if(mr===null){Dt.response._body=null;Dt.response._midwayControllerNullBody=true}else{Dt.body=mr}}if(Array.isArray(St.responseMetadata)&&St.responseMetadata.length){for(const rr of St.responseMetadata){switch(rr.type){case cr.WEB_RESPONSE_HTTP_CODE:Dt.status=rr.code;break;case cr.WEB_RESPONSE_HEADER:for(const St in(rr===null||rr===void 0?void 0:rr.setHeaders)||{}){Dt.set(St,rr.setHeaders[St])}break;case cr.WEB_RESPONSE_CONTENT_TYPE:Dt.type=rr.contentType;break;case cr.WEB_RESPONSE_REDIRECT:Dt.status=rr.code;Dt.redirect(rr.url);return}}}}}async loadMidwayController(St){var Dt,rr;const cr=await this.midwayWebRouterService.getRouterTable();const pr=await this.midwayWebRouterService.getRoutePriorityList();const gr=this.app.getApplicationContext();const $r=this.app.getCoreLogger();const Er=gr.get(yr.MidwayMiddlewareService);for(const yr of pr){gr.bindClass(yr.routerModule);$r.debug(`Load Controller "${yr.controllerId}", prefix=${yr.prefix}`);Sr(`[core]: Load Controller "${yr.controllerId}", prefix=${yr.prefix}`);const pr=this.createRouter({prefix:yr.prefix,...yr.routerOptions});yr.middleware=(Dt=yr.middleware)!==null&&Dt!==void 0?Dt:[];if(yr.middleware.length){const St=await Er.compose(yr.middleware,this.app);pr.use(St)}const Ir=cr.get(yr.prefix);for(const St of Ir){const Dt=[];St.middleware=(rr=St.middleware)!==null&&rr!==void 0?rr:[];if(St.middleware.length){const rr=await Er.compose(St.middleware,this.app);Dt.push(rr)}if(this.app.getFrameworkType()===mr.MidwayFrameworkType.WEB_KOA){if(typeof St.url==="string"&&/\*$/.test(St.url)){St.url=St.url.replace("*","(.*)")}}const cr=[St.routerName,St.url,...Dt,this.generateController(St)];$r.debug(`Load Router "${St.requestMethod.toUpperCase()} ${St.url}"`);Sr(`[core]: Load Router "${St.requestMethod.toUpperCase()} ${St.url}"`);pr[St.requestMethod.toLowerCase()].apply(pr,cr)}St&&St(pr)}}}Dt.WebControllerGenerator=WebControllerGenerator},42193:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});const cr=rr(65308);Dt["default"]=St=>{const Dt=(0,cr.isDevelopmentEnvironment)((0,cr.getCurrentEnvironment)());return{core:{healthCheckTimeout:1e3,concurrentDataSourceInitialization:false},asyncContextManager:{enable:false},midwayLogger:{default:{level:"info"},clients:{coreLogger:{level:Dt?"info":"warn"},appLogger:{aliasName:"logger"}}},debug:{recordConfigMergeOrder:Dt}}}},2222:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.SINGLETON_CONTAINER_CTX=Dt.IGNORE_PATTERN=Dt.DEFAULT_PATTERN=Dt.ASYNC_CONTEXT_MANAGER_KEY=Dt.ASYNC_CONTEXT_KEY=Dt.REQUEST_CTX_LOGGER_CACHE_KEY=Dt.HTTP_SERVER_KEY=Dt.CONTAINER_OBJ_SCOPE=Dt.REQUEST_OBJ_CTX_KEY=Dt.REQUEST_CTX_KEY=Dt.MIDWAY_LOGGER_WRITEABLE_DIR=Dt.FUNCTION_INJECT_KEY=Dt.KEYS=void 0;Dt.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"};Dt.FUNCTION_INJECT_KEY="midway:function_inject_key";Dt.MIDWAY_LOGGER_WRITEABLE_DIR="MIDWAY_LOGGER_WRITEABLE_DIR";Dt.REQUEST_CTX_KEY="ctx";Dt.REQUEST_OBJ_CTX_KEY="_req_ctx";Dt.CONTAINER_OBJ_SCOPE="_obj_scope";Dt.HTTP_SERVER_KEY="_midway_http_server";Dt.REQUEST_CTX_LOGGER_CACHE_KEY="_midway_ctx_logger_cache";Dt.ASYNC_CONTEXT_KEY=Symbol("ASYNC_CONTEXT_KEY");Dt.ASYNC_CONTEXT_MANAGER_KEY="MIDWAY_ASYNC_CONTEXT_MANAGER_KEY";Dt.DEFAULT_PATTERN=["**/**.ts","**/**.js","**/**.mts","**/**.mjs","**/**.cts","**/**.cjs"];Dt.IGNORE_PATTERN=["**/**.d.ts","**/**.d.mts","**/**.d.cts"];Dt.SINGLETON_CONTAINER_CTX={_MAIN_CTX_:true}},9288:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayContainer=void 0;const cr=rr(49757);const pr=rr(24451);const mr=rr(39023);const gr=rr(20873);const yr=rr(6192);const Sr=rr(2222);const $r=rr(47698);const Er=rr(34881);const Ir=rr(80932);const Or=rr(70275);const Hr=rr(78842);const Gr=rr(24434);const Tn=rr(86314);const Wn=rr(63289);const Gn=rr(65308);const mi=mr.debuglog("midway:debug");const $i=mr.debuglog("midway:bind");const ki=9;class ContainerConfiguration{constructor(St){this.container=St;this.loadedMap=new WeakMap;this.namespaceList=[];this.configurationOptionsList=[]}load(St){let Dt=cr.MAIN_MODULE_KEY;const rr=this.getConfigurationExport(St);if(!rr.length)return;for(let St=0;St<rr.length;St++){const mr=rr[St];if(this.loadedMap.get(mr)){continue}let gr;if(mr instanceof pr.FunctionalConfiguration){gr=mr.getConfigurationOptions()}else{gr=(0,cr.getClassMetadata)(cr.CONFIGURATION_KEY,mr)}this.loadedMap.set(mr,true);if(gr){if(gr.namespace!==undefined){Dt=gr.namespace;this.namespaceList.push(Dt)}this.configurationOptionsList.push(gr);mi(`[core]: load configuration in namespace="${Dt}"`);this.addImports(gr.imports);this.addImportObjects(gr.importObjects);this.addImportConfigs(gr.importConfigs);this.addImportConfigFilter(gr.importConfigFilter);this.bindConfigurationClass(mr,Dt)}}this.container.bindClass(St,{namespace:Dt})}addImportConfigs(St){if(St){if(Array.isArray(St)){this.container.get(Hr.MidwayConfigService).add(St)}else{this.container.get(Hr.MidwayConfigService).addObject(St)}}}addImportConfigFilter(St){if(St){this.container.get(Hr.MidwayConfigService).addFilter(St)}}addImports(St=[]){var Dt;for(let rr of St){if(!rr)continue;if(typeof rr==="string"){rr=require(rr)}if("Configuration"in rr){this.load(rr)}else if("component"in rr){if(rr===null||rr===void 0?void 0:rr.enabledEnvironment){if((Dt=rr===null||rr===void 0?void 0:rr.enabledEnvironment)===null||Dt===void 0?void 0:Dt.includes(this.container.get(Or.MidwayEnvironmentService).getCurrentEnvironment())){this.load(rr.component)}}else{this.load(rr.component)}}else{this.load(rr)}}}addImportObjects(St){if(St){const Dt=Object.keys(St);for(const rr of Dt){if(typeof St[rr]!==undefined){this.container.registerObject(rr,St[rr])}}}}bindConfigurationClass(St,Dt){if(St instanceof pr.FunctionalConfiguration){}else{(0,cr.saveProviderId)(undefined,St);const rr=(0,cr.getProviderUUId)(St);this.container.bind(rr,St,{namespace:Dt,scope:yr.ScopeEnum.Singleton})}const rr=(0,cr.listModule)(cr.CONFIGURATION_KEY);const mr=rr.find((Dt=>Dt.target===St));if(!mr){(0,cr.saveModule)(cr.CONFIGURATION_KEY,{target:St,namespace:Dt})}}getConfigurationExport(St){const Dt=[];if(Wn.Types.isClass(St)||Wn.Types.isFunction(St)||St instanceof pr.FunctionalConfiguration){Dt.push(St)}else{for(const rr in St){const cr=St[rr];if(Wn.Types.isClass(cr)||Wn.Types.isFunction(cr)||cr instanceof pr.FunctionalConfiguration){Dt.push(cr)}}}return Dt}getNamespaceList(){return this.namespaceList}getConfigurationOptionsList(){return this.configurationOptionsList}}class MidwayContainer{constructor(St){this._resolverFactory=null;this._registry=null;this._identifierMapping=null;this.moduleMap=null;this.parent=null;this.ctx=Sr.SINGLETON_CONTAINER_CTX;this.attrMap=new Map;this._namespaceSet=null;this.parent=St;this.init()}init(){this.registerObject(Sr.REQUEST_CTX_KEY,this.ctx)}get objectCreateEventTarget(){if(!this._objectCreateEventTarget){this._objectCreateEventTarget=new Gr}return this._objectCreateEventTarget}get registry(){if(!this._registry){this._registry=new gr.ObjectDefinitionRegistry}return this._registry}set registry(St){this._registry=St}get managedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new Ir.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(St){var Dt,rr,cr;if(!Array.isArray(St)){St=[St]}const pr=new ContainerConfiguration(this);for(const Dt of St){if(Dt){pr.load(Dt)}}for(const St of pr.getNamespaceList()){this.namespaceSet.add(St);mi(`[core]: load configuration in namespace="${St}" complete`)}const mr=(Dt=pr.getConfigurationOptionsList())!==null&&Dt!==void 0?Dt:[];const gr=(rr=mr.find((St=>!St.namespace)))!==null&&rr!==void 0?rr:{};this.fileDetector=(cr=gr.detector)!==null&&cr!==void 0?cr:this.fileDetector;if(this.fileDetector){this.fileDetector.setExtraDetectorOptions({conflictCheck:gr.conflictCheck,...gr.detectorOptions})}}loadDefinitions(){if(this.fileDetector){return this.fileDetector.run(this)}}bindClass(St,Dt){if(Wn.Types.isClass(St)||Wn.Types.isFunction(St)){this.bindModule(St,Dt)}else{for(const rr in St){const cr=St[rr];if(Wn.Types.isClass(cr)||Wn.Types.isFunction(cr)){this.bindModule(cr,Dt)}}}}bind(St,Dt,rr){var pr;if(Wn.Types.isClass(St)||Wn.Types.isFunction(St)){return this.bindModule(St,Dt)}if(this.registry.hasDefinition(St)){return}if(rr===null||rr===void 0?void 0:rr.bindHook){rr.bindHook(Dt,rr)}let mr;if(Wn.Types.isClass(Dt)){mr=new $r.ObjectDefinition;mr.name=(0,cr.getProviderName)(Dt)}else{mr=new Er.FunctionDefinition;if(!Wn.Types.isAsyncFunction(Dt)){mr.asynchronous=false}mr.name=mr.id}mr.path=Dt;mr.id=St;mr.srcPath=(rr===null||rr===void 0?void 0:rr.srcPath)||null;mr.namespace=(rr===null||rr===void 0?void 0:rr.namespace)||"";mr.scope=(rr===null||rr===void 0?void 0:rr.scope)||yr.ScopeEnum.Request;mr.createFrom=rr===null||rr===void 0?void 0:rr.createFrom;if(mr.srcPath){mi(`[core]: bind id "${mr.name} (${mr.srcPath}) ${St}"`)}else{mi(`[core]: bind id "${mr.name}" ${St}`)}const gr=(0,cr.getPropertyInject)(Dt);for(const St in gr){const Dt=gr[St];$i(`${" ".repeat(ki)}inject properties => [${JSON.stringify(Dt)}]`);const rr=new Ir.ManagedReference;rr.args=Dt.args;rr.name=Dt.value;rr.injectMode=Dt["injectMode"];mr.properties.set(Dt["targetKey"],rr)}const Sr=(0,cr.getClassExtendedMetadata)(cr.INJECT_CUSTOM_PROPERTY,Dt);for(const St in Sr){const Dt=Sr[St];mr.handlerProps.push(Dt)}const Or=(pr=(0,cr.getObjectDefinition)(Dt))!==null&&pr!==void 0?pr:{};if(Or.initMethod){$i(`${" ".repeat(ki)}register initMethod = ${Or.initMethod}`);mr.initMethod=Or.initMethod}if(Or.destroyMethod){$i(`${" ".repeat(ki)}register destroyMethod = ${Or.destroyMethod}`);mr.destroyMethod=Or.destroyMethod}if(Or.scope){$i(`${" ".repeat(ki)}register scope = ${Or.scope}`);mr.scope=Or.scope}if(Or.allowDowngrade){$i(`${" ".repeat(ki)}register allowDowngrade = ${Or.allowDowngrade}`);mr.allowDowngrade=Or.allowDowngrade}this.objectCreateEventTarget.emit(yr.ObjectLifeCycleEvent.BEFORE_BIND,Dt,{context:this,definition:mr,replaceCallback:St=>{mr=St}});if(mr){this.registry.registerDefinition(mr.id,mr)}}bindModule(St,Dt){if(Wn.Types.isClass(St)){const rr=(0,cr.getProviderUUId)(St);if(rr){this.identifierMapping.saveClassRelation(St,Dt===null||Dt===void 0?void 0:Dt.namespace);this.bind(rr,St,Dt)}else{}}else{const rr=St[Sr.FUNCTION_INJECT_KEY];if(rr&&rr.id){if(!rr.scope){rr.scope=yr.ScopeEnum.Request}const cr=Gn.Utils.generateRandomId();this.identifierMapping.saveFunctionRelation(rr.id,cr);this.bind(cr,St,{scope:rr.scope,namespace:Dt.namespace,srcPath:Dt.srcPath,createFrom:Dt.createFrom})}}}setFileDetector(St){this.fileDetector=St}createChild(){return new MidwayContainer(this)}setAttr(St,Dt){this.attrMap.set(St,Dt)}getAttr(St){return this.attrMap.get(St)}getIdentifier(St){return(0,cr.getProviderUUId)(St)}getManagedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new Ir.ManagedResolverFactory(this)}return this._resolverFactory}async stop(){await this.getManagedResolverFactory().destroyCache();this.registry.clearAll()}ready(){return this.loadDefinitions()}get(St,Dt,rr){var cr;Dt=Dt!==null&&Dt!==void 0?Dt:[];rr=rr!==null&&rr!==void 0?rr:{originName:St};if(typeof St!=="string"){rr.originName=St.name;St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const pr=this.registry.getDefinition(St);if(!pr&&this.parent){return this.parent.get(St,Dt)}if(!pr){throw new Tn.MidwayDefinitionNotFoundError((cr=rr===null||rr===void 0?void 0:rr.originName)!==null&&cr!==void 0?cr:St)}return this.getManagedResolverFactory().create({definition:pr,args:Dt})}async getAsync(St,Dt,rr){var cr;Dt=Dt!==null&&Dt!==void 0?Dt:[];rr=rr!==null&&rr!==void 0?rr:{originName:St};if(typeof St!=="string"){rr.originName=St.name;St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const pr=this.registry.getDefinition(St);if(!pr&&this.parent){return this.parent.getAsync(St,Dt)}if(!pr){throw new Tn.MidwayDefinitionNotFoundError((cr=rr===null||rr===void 0?void 0:rr.originName)!==null&&cr!==void 0?cr:St)}return this.getManagedResolverFactory().createAsync({definition:pr,args:Dt})}registerObject(St,Dt){this.registry.registerObject(St,Dt)}onBeforeBind(St){this.objectCreateEventTarget.on(yr.ObjectLifeCycleEvent.BEFORE_BIND,St)}onBeforeObjectCreated(St){this.objectCreateEventTarget.on(yr.ObjectLifeCycleEvent.BEFORE_CREATED,St)}onObjectCreated(St){this.objectCreateEventTarget.on(yr.ObjectLifeCycleEvent.AFTER_CREATED,St)}onObjectInit(St){this.objectCreateEventTarget.on(yr.ObjectLifeCycleEvent.AFTER_INIT,St)}onBeforeObjectDestroy(St){this.objectCreateEventTarget.on(yr.ObjectLifeCycleEvent.BEFORE_DESTROY,St)}saveModule(St,Dt){if(!this.moduleMap.has(St)){this.moduleMap.set(St,new Set)}this.moduleMap.get(St).add(Dt)}listModule(St){return Array.from(this.moduleMap.get(St)||{})}transformModule(St){this.moduleMap=new Map(St)}hasNamespace(St){return this.namespaceSet.has(St)}getNamespaceList(){return Array.from(this.namespaceSet)}hasDefinition(St){return this.registry.hasDefinition(St)}hasObject(St){return this.registry.hasObject(St)}getInstanceScope(St){if(St[Sr.CONTAINER_OBJ_SCOPE]){return St[Sr.CONTAINER_OBJ_SCOPE]}return undefined}}Dt.MidwayContainer=MidwayContainer},20873:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ObjectDefinitionRegistry=void 0;const cr=rr(49757);const pr="_id_default_";class LegacyIdentifierRelation extends Map{saveClassRelation(St,Dt){const rr=(0,cr.getProviderUUId)(St);this.set(rr,rr);if(rr){const pr=(0,cr.getProviderId)(St);if(pr){this.set(pr,rr)}this.set((0,cr.getProviderName)(St),rr);if(Dt){this.set(Dt+":"+(0,cr.getProviderName)(St),rr)}}}saveFunctionRelation(St,Dt){this.set(Dt,Dt);this.set(St,Dt)}hasRelation(St){return this.has(St)}getRelation(St){return this.get(St)}}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(St){this._identifierRelation=St}get identifiers(){const St=[];for(const Dt of this.keys()){if(Dt.indexOf(pr)===-1){St.push(Dt)}}return St}get count(){return this.size}getSingletonDefinitionIds(){return this.singletonIds}getDefinitionByName(St){const Dt=[];for(const rr of this.values()){const cr=rr;if(cr.name===St){Dt.push(cr)}}return Dt}registerDefinition(St,Dt){if(Dt.isSingletonScope()){this.singletonIds.push(St)}this.set(St,Dt)}getDefinition(St){var Dt;St=(Dt=this.identifierRelation.getRelation(St))!==null&&Dt!==void 0?Dt:St;return this.get(St)}removeDefinition(St){this.delete(St)}hasDefinition(St){var Dt;St=(Dt=this.identifierRelation.getRelation(St))!==null&&Dt!==void 0?Dt:St;return this.has(St)}clearAll(){this.singletonIds=[];this.clear()}hasObject(St){var Dt;St=(Dt=this.identifierRelation.getRelation(St))!==null&&Dt!==void 0?Dt:St;return this.has(pr+St)}registerObject(St,Dt){this.set(pr+St,Dt)}getObject(St){var Dt;St=(Dt=this.identifierRelation.getRelation(St))!==null&&Dt!==void 0?Dt:St;return this.get(pr+St)}getIdentifierRelation(){return this.identifierRelation}setIdentifierRelation(St){this.identifierRelation=St}}Dt.ObjectDefinitionRegistry=ObjectDefinitionRegistry},80932:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ManagedResolverFactory=Dt.ManagedReference=void 0;const cr=rr(2222);const pr=rr(6192);const mr=rr(39023);const gr=rr(86314);const yr=mr.debuglog("midway:managedresolver");const Sr=mr.debuglog("midway:debug");class ManagedReference{constructor(){this.type=cr.KEYS.REF_ELEMENT}}Dt.ManagedReference=ManagedReference;class RefResolver{constructor(St){this.factory=St}get type(){return cr.KEYS.REF_ELEMENT}resolve(St,Dt){var rr;const cr=St;if(cr.injectMode===pr.InjectModeEnum.Class&&!((rr=this.factory.context.parent)!==null&&rr!==void 0?rr:this.factory.context).hasDefinition(cr.name)){if(Dt==="loggerService"){throw new gr.MidwayInconsistentVersionError}else{throw new gr.MidwayMissingImportComponentError(Dt)}}return this.factory.context.get(cr.name,cr.args,{originName:Dt})}async resolveAsync(St,Dt){var rr;const cr=St;if(cr.injectMode===pr.InjectModeEnum.Class&&!((rr=this.factory.context.parent)!==null&&rr!==void 0?rr:this.factory.context).hasDefinition(cr.name)){if(Dt==="loggerService"){throw new gr.MidwayInconsistentVersionError}else{throw new gr.MidwayMissingImportComponentError(Dt)}}return this.factory.context.getAsync(cr.name,cr.args,{originName:Dt})}}class ManagedResolverFactory{constructor(St){this.resolvers={};this.creating=new Map;this.singletonCache=new Map;this.context=St;this.resolvers={ref:new RefResolver(this)}}registerResolver(St){this.resolvers[St.type]=St}resolveManaged(St,Dt){const rr=this.resolvers[St.type];if(!rr||rr.type!==St.type){throw new gr.MidwayResolverMissingError(St.type)}return rr.resolve(St,Dt)}async resolveManagedAsync(St,Dt){const rr=this.resolvers[St.type];if(!rr||rr.type!==St.type){throw new gr.MidwayResolverMissingError(St.type)}return rr.resolveAsync(St,Dt)}create(St){const{definition:Dt,args:rr}=St;if(Dt.isSingletonScope()&&this.singletonCache.has(Dt.id)){return this.singletonCache.get(Dt.id)}let mr=this.createProxyReference(Dt);if(mr){return mr}this.compareAndSetCreateStatus(Dt);if(Dt.hasDependsOn()){for(const St of Dt.dependsOn){this.context.get(St,rr)}}Sr(`[core]: Create id = "${Dt.name}" ${Dt.id}.`);const yr=Dt.creator.load();let $r=[];if(rr&&Array.isArray(rr)&&rr.length>0){$r=rr}this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.BEFORE_CREATED,yr,{constructorArgs:$r,definition:Dt,context:this.context});mr=Dt.creator.doConstruct(yr,$r,this.context);if(Dt.isRequestScope()&&Dt.constructor.name==="ObjectDefinition"){Object.defineProperty(mr,cr.REQUEST_OBJ_CTX_KEY,{value:this.context.get(cr.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(Dt.properties){const St=Dt.properties.propertyKeys();for(const rr of St){this.checkSingletonInvokeRequest(Dt,rr);try{mr[rr]=this.resolveManaged(Dt.properties.get(rr),rr)}catch(St){if(gr.MidwayDefinitionNotFoundError.isClosePrototypeOf(St)){const rr=Dt.path.name;St.updateErrorMsg(rr)}this.removeCreateStatus(Dt,true);throw St}}}this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.AFTER_CREATED,mr,{context:this.context,definition:Dt,replaceCallback:St=>{mr=St}});Dt.creator.doInit(mr);this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.AFTER_INIT,mr,{context:this.context,definition:Dt});if(Dt.id){if(Dt.isSingletonScope()){this.singletonCache.set(Dt.id,mr);this.setInstanceScope(mr,pr.ScopeEnum.Singleton)}else if(Dt.isRequestScope()){this.context.registerObject(Dt.id,mr);this.setInstanceScope(mr,pr.ScopeEnum.Request)}else{this.setInstanceScope(mr,pr.ScopeEnum.Prototype)}}this.removeCreateStatus(Dt,true);return mr}async createAsync(St){const{definition:Dt,args:rr}=St;if(Dt.isSingletonScope()&&this.singletonCache.has(Dt.id)){yr(`id = ${Dt.id}(${Dt.name}) get from singleton cache.`);return this.singletonCache.get(Dt.id)}let mr=this.createProxyReference(Dt);if(mr){yr(`id = ${Dt.id}(${Dt.name}) from proxy reference.`);return mr}this.compareAndSetCreateStatus(Dt);if(Dt.hasDependsOn()){for(const St of Dt.dependsOn){yr("id = %s init depend %s.",Dt.id,St);await this.context.getAsync(St,rr)}}Sr(`[core]: Create id = "${Dt.name}" ${Dt.id}.`);const $r=Dt.creator.load();let Er=[];if(rr&&Array.isArray(rr)&&rr.length>0){Er=rr}this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.BEFORE_CREATED,$r,{constructorArgs:Er,context:this.context});mr=await Dt.creator.doConstructAsync($r,Er,this.context);if(!mr){this.removeCreateStatus(Dt,false);throw new gr.MidwayCommonError(`${Dt.id} construct return undefined`)}if(Dt.isRequestScope()&&Dt.constructor.name==="ObjectDefinition"){yr("id = %s inject ctx",Dt.id);Object.defineProperty(mr,cr.REQUEST_OBJ_CTX_KEY,{value:this.context.get(cr.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(Dt.properties){const St=Dt.properties.propertyKeys();for(const rr of St){this.checkSingletonInvokeRequest(Dt,rr);try{mr[rr]=await this.resolveManagedAsync(Dt.properties.get(rr),rr)}catch(St){if(gr.MidwayDefinitionNotFoundError.isClosePrototypeOf(St)){const rr=Dt.path.name;St.updateErrorMsg(rr)}this.removeCreateStatus(Dt,false);throw St}}}this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.AFTER_CREATED,mr,{context:this.context,definition:Dt,replaceCallback:St=>{mr=St}});await Dt.creator.doInitAsync(mr);this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.AFTER_INIT,mr,{context:this.context,definition:Dt});if(Dt.id){if(Dt.isSingletonScope()){yr(`id = ${Dt.id}(${Dt.name}) set to singleton cache`);this.singletonCache.set(Dt.id,mr);this.setInstanceScope(mr,pr.ScopeEnum.Singleton)}else if(Dt.isRequestScope()){yr(`id = ${Dt.id}(${Dt.name}) set to register object`);this.context.registerObject(Dt.id,mr);this.setInstanceScope(mr,pr.ScopeEnum.Request)}else{this.setInstanceScope(mr,pr.ScopeEnum.Prototype)}}this.removeCreateStatus(Dt,true);return mr}async destroyCache(){for(const St of this.singletonCache.keys()){const Dt=this.context.registry.getDefinition(St);if(Dt.creator){const rr=this.singletonCache.get(St);this.getObjectEventTarget().emit(pr.ObjectLifeCycleEvent.BEFORE_DESTROY,rr,{context:this.context,definition:Dt});await Dt.creator.doDestroyAsync(rr)}}this.singletonCache.clear();this.creating.clear()}removeCreateStatus(St,Dt){if(this.creating.has(St.id)){this.creating.set(St.id,false)}return true}isCreating(St){return this.creating.has(St.id)&&this.creating.get(St.id)}compareAndSetCreateStatus(St){if(!this.creating.has(St.id)||!this.creating.get(St.id)){this.creating.set(St.id,true)}}createProxyReference(St){if(this.isCreating(St)){yr("create proxy for %s.",St.id);if(!this.depthFirstSearch(St.id,St)){yr("id = %s after dfs return null",St.id);return null}return new Proxy({__is_proxy__:true,__target_id__:St.id},{get:(Dt,rr)=>{let cr;if(St.isRequestScope()){cr=this.context.registry.getObject(St.id)}else if(St.isSingletonScope()){cr=this.singletonCache.get(St.id)}else{cr=this.context.get(St.id)}if(cr){if(typeof cr[rr]==="function"){return cr[rr].bind(cr)}return cr[rr]}return undefined}})}return null}depthFirstSearch(St,Dt,rr){var cr;if(Dt){yr("dfs for %s == %s start.",St,Dt.id);if(Dt.properties){const pr=Dt.properties.propertyKeys();if(pr.indexOf(St)>-1){yr("dfs exist in properties %s == %s.",St,Dt.id);return true}for(const mr of pr){if(!Array.isArray(rr)){rr=[St]}let pr=mr;const gr=Dt.properties.get(mr);if(gr&&gr.name){pr=(cr=this.context.identifierMapping.getRelation(gr.name))!==null&&cr!==void 0?cr:gr.name}if(pr===St){yr("dfs exist in properties key %s == %s.",St,Dt.id);return true}if(rr.indexOf(pr)>-1){yr("dfs depth circular %s == %s, %s, %j.",St,Dt.id,pr,rr);continue}else{rr.push(pr);yr("dfs depth push %s == %s, %j.",St,pr,rr)}let Sr=this.context.registry.getDefinition(pr);if(!Sr&&this.context.parent){Sr=this.context.parent.registry.getDefinition(pr)}if(this.depthFirstSearch(St,Sr,rr)){yr("dfs exist in sub tree %s == %s subId = %s.",St,Dt.id,Sr.id);return true}}}yr("dfs for %s == %s end.",St,Dt.id)}return false}getObjectEventTarget(){if(this.context.parent){return this.context.parent.objectCreateEventTarget}return this.context.objectCreateEventTarget}checkSingletonInvokeRequest(St,Dt){if(St.isSingletonScope()){const rr=St.properties.get(Dt);if(this.context.hasDefinition(rr===null||rr===void 0?void 0:rr.name)){const Dt=this.context.registry.getDefinition(rr.name);if(Dt.isRequestScope()&&!Dt.allowDowngrade){throw new gr.MidwaySingletonInjectRequestError(St.path.name,Dt.path.name)}}}return true}setInstanceScope(St,Dt){if(typeof St==="object"){if(Dt===pr.ScopeEnum.Request&&St[cr.REQUEST_OBJ_CTX_KEY]===cr.SINGLETON_CONTAINER_CTX){Dt=pr.ScopeEnum.Singleton}Object.defineProperty(St,cr.CONTAINER_OBJ_SCOPE,{value:Dt,writable:false,enumerable:false,configurable:false})}}}Dt.ManagedResolverFactory=ManagedResolverFactory},28695:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.providerWrapper=void 0;const cr=rr(2222);function providerWrapper(St){for(const Dt of St){Object.defineProperty(Dt.provider,cr.FUNCTION_INJECT_KEY,{value:Dt,writable:false})}}Dt.providerWrapper=providerWrapper},97983:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayRequestContainer=void 0;const cr=rr(9288);const pr=rr(49757);const mr=rr(2222);class MidwayRequestContainer extends cr.MidwayContainer{constructor(St,Dt){super(Dt);this.applicationContext=Dt;this.registry.setIdentifierRelation(this.applicationContext.registry.getIdentifierRelation());this.ctx=St;this.registerObject(mr.REQUEST_CTX_KEY,St);this.registerObject("res",{});if(St.logger){this.registerObject("logger",St.logger)}}init(){}get(St,Dt){if(typeof St!=="string"){St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const rr=this.applicationContext.registry.getDefinition(St);if(rr){if(rr.isRequestScope()||rr.id===pr.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().create({definition:rr,args:Dt})}}if(this.parent){return this.parent.get(St,Dt)}}async getAsync(St,Dt){if(typeof St!=="string"){St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const rr=this.applicationContext.registry.getDefinition(St);if(rr){if(rr.isRequestScope()||rr.id===pr.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().createAsync({definition:rr,args:Dt})}}if(this.parent){return this.parent.getAsync(St,Dt)}}async ready(){}getContext(){return this.ctx}}Dt.MidwayRequestContainer=MidwayRequestContainer},76271:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Aspect=void 0;const cr=rr(49757);const pr=rr(18025);const mr=rr(6192);function Aspect(St,Dt,rr){return function(gr){(0,cr.saveModule)(cr.ASPECT_KEY,gr);const yr=[].concat(St);for(const St of yr){(0,cr.attachClassMetadata)(cr.ASPECT_KEY,{aspectTarget:St,match:Dt,priority:rr},gr)}(0,pr.Scope)(mr.ScopeEnum.Singleton)(gr);(0,cr.Provide)()(gr)}}Dt.Aspect=Aspect},2940:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Autoload=void 0;const cr=rr(45317);const pr=rr(39990);function Autoload(){return function(St){(0,cr.savePreloadModule)(St);(0,pr.Provide)()(St)}}Dt.Autoload=Autoload},73821:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Configuration=void 0;const cr=rr(49757);function Configuration(St={}){return Dt=>{(0,cr.saveClassMetadata)(cr.CONFIGURATION_KEY,St,Dt)}}Dt.Configuration=Configuration},41573:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Match=Dt.Catch=void 0;const cr=rr(45317);const pr=rr(75105);const mr=rr(18025);const gr=rr(39990);const yr=rr(6192);function Catch(St,Dt={}){return function(rr){const Sr=St?[].concat(St):undefined;(0,cr.saveClassMetadata)(pr.CATCH_KEY,{catchTargets:Sr,catchOptions:Dt},rr);(0,mr.Scope)(yr.ScopeEnum.Singleton)(rr);(0,gr.Provide)()(rr)}}Dt.Catch=Catch;function Match(St=true){return function(Dt){(0,cr.saveClassMetadata)(pr.MATCH_KEY,{matchPattern:St},Dt);(0,mr.Scope)(yr.ScopeEnum.Singleton)(Dt);(0,gr.Provide)()(Dt)}}Dt.Match=Match},1623:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApplicationContext=Dt.Logger=Dt.App=Dt.Config=Dt.Plugin=Dt.Framework=void 0;const cr=rr(49757);const pr=rr(6192);function Framework(){return St=>{(0,cr.saveModule)(cr.FRAMEWORK_KEY,St);(0,cr.Scope)(pr.ScopeEnum.Singleton)(St);(0,cr.Provide)()(St)}}Dt.Framework=Framework;function Plugin(St){return(0,cr.createCustomPropertyDecorator)(cr.PLUGIN_KEY,{identifier:St})}Dt.Plugin=Plugin;function Config(St){return(0,cr.createCustomPropertyDecorator)(cr.CONFIG_KEY,{identifier:St})}Dt.Config=Config;function App(St){return(0,cr.createCustomPropertyDecorator)(cr.APPLICATION_KEY,{type:St})}Dt.App=App;function Logger(St){return(0,cr.createCustomPropertyDecorator)(cr.LOGGER_KEY,{identifier:St})}Dt.Logger=Logger;function ApplicationContext(){return(0,cr.createCustomPropertyDecorator)(cr.APPLICATION_CONTEXT_KEY,{})}Dt.ApplicationContext=ApplicationContext},41958:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Guard=Dt.UseGuard=void 0;const cr=rr(45317);const pr=rr(6192);const mr=rr(75105);const gr=rr(39990);const yr=rr(18025);function UseGuard(St){return(Dt,rr,pr)=>{if(!Array.isArray(St)){St=[St]}if(rr){(0,cr.savePropertyMetadata)(mr.GUARD_KEY,St,Dt,rr)}else{(0,cr.saveClassMetadata)(mr.GUARD_KEY,St,Dt)}}}Dt.UseGuard=UseGuard;function Guard(){return St=>{(0,gr.Provide)()(St);(0,yr.Scope)(pr.ScopeEnum.Singleton)(St)}}Dt.Guard=Guard},92922:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.InjectClient=Dt.Inject=void 0;const cr=rr(45317);const pr=rr(75105);function Inject(St){return function(Dt,rr){(0,cr.savePropertyInject)({target:Dt,targetKey:rr,identifier:St})}}Dt.Inject=Inject;function InjectClient(St,Dt){return(0,cr.createCustomPropertyDecorator)(pr.FACTORY_SERVICE_CLIENT_KEY,{serviceFactoryClz:St,clientName:Dt})}Dt.InjectClient=InjectClient},17511:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Middleware=void 0;const cr=rr(49757);const pr=rr(6192);function Middleware(){return St=>{(0,cr.Scope)(pr.ScopeEnum.Singleton)(St);(0,cr.Provide)()(St)}}Dt.Middleware=Middleware},56329:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Mock=void 0;const cr=rr(49757);const pr=rr(6192);function Mock(){return St=>{(0,cr.saveModule)(cr.MOCK_KEY,St);(0,cr.Scope)(pr.ScopeEnum.Singleton)(St);(0,cr.Provide)()(St)}}Dt.Mock=Mock},18025:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Singleton=Dt.Scope=Dt.Destroy=Dt.Init=void 0;const cr=rr(45317);const pr=rr(39990);const mr=rr(6192);function Init(){return function(St,Dt){(0,cr.saveObjectDefinition)(St,{initMethod:Dt})}}Dt.Init=Init;function Destroy(){return function(St,Dt){(0,cr.saveObjectDefinition)(St,{destroyMethod:Dt})}}Dt.Destroy=Destroy;function Scope(St,Dt){return function(rr){(0,cr.saveObjectDefinition)(rr,{scope:St,...Dt})}}Dt.Scope=Scope;function Singleton(){return function(St){Scope(mr.ScopeEnum.Singleton)(St);(0,pr.Provide)()(St)}}Dt.Singleton=Singleton},64331:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Pipe=void 0;const cr=rr(49757);const pr=rr(6192);function Pipe(){return St=>{(0,cr.Scope)(pr.ScopeEnum.Singleton)(St);(0,cr.Provide)()(St)}}Dt.Pipe=Pipe},52953:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Pipeline=void 0;const cr=rr(45317);const pr=rr(75105);function Pipeline(St){return(0,cr.createCustomPropertyDecorator)(pr.PIPELINE_IDENTIFIER,{valves:St})}Dt.Pipeline=Pipeline},39990:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Provide=void 0;const cr=rr(45317);function Provide(St){return function(Dt){return(0,cr.saveProviderId)(St,Dt)}}Dt.Provide=Provide},75105:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.TAGGED_CLS=Dt.INJECT_CUSTOM_PARAM=Dt.INJECT_CUSTOM_METHOD=Dt.INJECT_CUSTOM_PROPERTY=Dt.INJECT_TAG=Dt.NAMED_TAG=Dt.CLASS_KEY_CONSTRUCTOR=Dt.APPLICATION_CONTEXT_KEY=Dt.APPLICATION_KEY=Dt.LOGGER_KEY=Dt.PLUGIN_KEY=Dt.CONFIG_KEY=Dt.MS_HSF_METHOD_KEY=Dt.MS_DUBBO_METHOD_KEY=Dt.MS_GRPC_METHOD_KEY=Dt.MS_PROVIDER_KEY=Dt.MS_PRODUCER_KEY=Dt.MS_CONSUMER_KEY=Dt.RPC_DUBBO_KEY=Dt.RPC_GRPC_KEY=Dt.HSF_KEY=Dt.WS_EVENT_KEY=Dt.WS_CONTROLLER_KEY=Dt.MODULE_TASK_QUEUE_OPTIONS=Dt.MODULE_TASK_QUEUE_KEY=Dt.MODULE_TASK_TASK_LOCAL_OPTIONS=Dt.MODULE_TASK_TASK_LOCAL_KEY=Dt.MODULE_TASK_METADATA=Dt.MODULE_TASK_KEY=Dt.WEB_RESPONSE_RENDER=Dt.WEB_RESPONSE_CONTENT_TYPE=Dt.WEB_RESPONSE_HEADER=Dt.WEB_RESPONSE_REDIRECT=Dt.WEB_RESPONSE_HTTP_CODE=Dt.WEB_RESPONSE_KEY=Dt.WEB_ROUTER_PARAM_KEY=Dt.WEB_ROUTER_KEY=Dt.CONTROLLER_KEY=Dt.SERVERLESS_FUNC_KEY=Dt.FUNC_KEY=Dt.FACTORY_SERVICE_CLIENT_KEY=Dt.MOCK_KEY=Dt.GUARD_KEY=Dt.MATCH_KEY=Dt.CATCH_KEY=Dt.ASPECT_KEY=Dt.FRAMEWORK_KEY=Dt.CONFIGURATION_KEY=Dt.SCHEDULE_KEY=Dt.ALL=void 0;Dt.PRIVATE_META_DATA_KEY=Dt.MAIN_MODULE_KEY=Dt.LIFECYCLE_IDENTIFIER_PREFIX=Dt.PIPELINE_IDENTIFIER=Dt.OBJ_DEF_CLS=Dt.TAGGED_FUN=void 0;Dt.ALL="common:all_value_key";Dt.SCHEDULE_KEY="common:schedule";Dt.CONFIGURATION_KEY="common:configuration";Dt.FRAMEWORK_KEY="common:framework";Dt.ASPECT_KEY="common:aspect";Dt.CATCH_KEY="common:catch";Dt.MATCH_KEY="common:match";Dt.GUARD_KEY="common:guard";Dt.MOCK_KEY="common:mock";Dt.FACTORY_SERVICE_CLIENT_KEY="common:service_factory:client";Dt.FUNC_KEY="faas:func";Dt.SERVERLESS_FUNC_KEY="faas:serverless:function";Dt.CONTROLLER_KEY="web:controller";Dt.WEB_ROUTER_KEY="web:router";Dt.WEB_ROUTER_PARAM_KEY="web:router_param";Dt.WEB_RESPONSE_KEY="web:response";Dt.WEB_RESPONSE_HTTP_CODE="web:response_http_code";Dt.WEB_RESPONSE_REDIRECT="web:response_redirect";Dt.WEB_RESPONSE_HEADER="web:response_header";Dt.WEB_RESPONSE_CONTENT_TYPE="web:response_content_type";Dt.WEB_RESPONSE_RENDER="web:response_render";Dt.MODULE_TASK_KEY="task:task";Dt.MODULE_TASK_METADATA="task:task:options";Dt.MODULE_TASK_TASK_LOCAL_KEY="task:task:task_local";Dt.MODULE_TASK_TASK_LOCAL_OPTIONS="task:task:task_local:options";Dt.MODULE_TASK_QUEUE_KEY="task:task:queue";Dt.MODULE_TASK_QUEUE_OPTIONS="task:task:queue:options";Dt.WS_CONTROLLER_KEY="ws:controller";Dt.WS_EVENT_KEY="ws:event";Dt.HSF_KEY="rpc:hsf";Dt.RPC_GRPC_KEY="rpc:grpc";Dt.RPC_DUBBO_KEY="rpc:dubbo";Dt.MS_CONSUMER_KEY="ms:consumer";Dt.MS_PRODUCER_KEY="ms:producer";Dt.MS_PROVIDER_KEY="ms:provider";Dt.MS_GRPC_METHOD_KEY="ms:grpc:method";Dt.MS_DUBBO_METHOD_KEY="ms:dubbo:method";Dt.MS_HSF_METHOD_KEY="ms:hsf:method";Dt.CONFIG_KEY="config";Dt.PLUGIN_KEY="plugin";Dt.LOGGER_KEY="logger";Dt.APPLICATION_KEY="__midway_framework_app__";Dt.APPLICATION_CONTEXT_KEY="__midway_application_context__";Dt.CLASS_KEY_CONSTRUCTOR="midway:class_key_constructor";Dt.NAMED_TAG="named";Dt.INJECT_TAG="inject";Dt.INJECT_CUSTOM_PROPERTY="inject_custom_property";Dt.INJECT_CUSTOM_METHOD="inject_custom_method";Dt.INJECT_CUSTOM_PARAM="inject_custom_param";Dt.TAGGED_CLS="injection:tagged_class";Dt.TAGGED_FUN="injection:tagged_function";Dt.OBJ_DEF_CLS="injection:object_definition_class";Dt.PIPELINE_IDENTIFIER="__pipeline_identifier__";Dt.LIFECYCLE_IDENTIFIER_PREFIX="__lifecycle__";Dt.MAIN_MODULE_KEY="__main__";Dt.PRIVATE_META_DATA_KEY="__midway_private_meta_data__"},45317:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.createCustomParamDecorator=Dt.createCustomMethodDecorator=Dt.createCustomPropertyDecorator=Dt.getMethodReturnTypes=Dt.getPropertyType=Dt.getMethodParamTypes=Dt.BaseType=Dt.isProvide=Dt.getProviderUUId=Dt.getProviderName=Dt.getProviderId=Dt.saveProviderId=Dt.getObjectDefinition=Dt.saveObjectDefinition=Dt.getPropertyInject=Dt.savePropertyInject=Dt.transformTypeFromTSDesign=Dt.clearAllModule=Dt.resetModule=Dt.listModule=Dt.clearBindContainer=Dt.bindContainer=Dt.saveModule=Dt.listPreloadModule=Dt.savePreloadModule=Dt.getPropertyMetadata=Dt.attachPropertyMetadata=Dt.savePropertyMetadata=Dt.listPropertyDataFromClass=Dt.getPropertyDataFromClass=Dt.attachPropertyDataToClass=Dt.savePropertyDataToClass=Dt.getClassMetadata=Dt.getClassExtendedMetadata=Dt.attachClassMetadata=Dt.saveClassMetadata=Dt.DecoratorManager=Dt.INJECT_CLASS_KEY_PREFIX=Dt.PRELOAD_MODULE_KEY=void 0;rr(37159);const cr=rr(6192);const pr=rr(75105);const mr=rr(63289);const gr=rr(90406);const yr=rr(65308);const Sr=rr(61327);const $r=rr(39023).debuglog("midway:core");Dt.PRELOAD_MODULE_KEY="INJECTION_PRELOAD_MODULE_KEY";Dt.INJECT_CLASS_KEY_PREFIX="INJECTION_CLASS_META_DATA";class DecoratorManager extends Map{constructor(){super(...arguments);this.injectClassKeyPrefix=Dt.INJECT_CLASS_KEY_PREFIX;this.injectClassMethodKeyPrefix="INJECTION_CLASS_METHOD_META_DATA";this.injectMethodKeyPrefix="INJECTION_METHOD_META_DATA"}saveModule(St,Dt){if(this.container){return this.container.saveModule(St,Dt)}if(!this.has(St)){this.set(St,new Set)}this.get(St).add(Dt)}listModule(St){if(this.container){return this.container.listModule(St)}return Array.from(this.get(St)||{})}resetModule(St){this.set(St,new Set)}bindContainer(St){this.container=St;this.container.transformModule(this)}static getDecoratorClassKey(St){return St.toString()+"_CLS"}static removeDecoratorClassKeySuffix(St){return St.toString().replace("_CLS","")}static getDecoratorMethodKey(St){return St.toString()+"_METHOD"}static getDecoratorClsExtendedKey(St){return St.toString()+"_EXT"}static getDecoratorClsMethodPrefix(St){return St.toString()+"_CLS_METHOD"}static getDecoratorClsMethodKey(St,Dt){return DecoratorManager.getDecoratorClsMethodPrefix(St)+":"+Dt.toString()}static getDecoratorMethod(St,Dt){return DecoratorManager.getDecoratorMethodKey(St)+"_"+Dt.toString()}static saveMetadata(St,Dt,rr,cr){if(typeof Dt==="object"&&Dt.constructor){Dt=Dt.constructor}let pr;if(Reflect.hasOwnMetadata(St,Dt)){pr=Reflect.getMetadata(St,Dt)}else{pr=new Map}pr.set(rr,cr);Reflect.defineMetadata(St,pr,Dt)}static attachMetadata(St,Dt,rr,cr,pr,mr="one"){if(typeof Dt==="object"&&Dt.constructor){Dt=Dt.constructor}let gr;if(Reflect.hasOwnMetadata(St,Dt)){gr=Reflect.getMetadata(St,Dt)}else{gr=new Map}if(!gr.has(rr)){if(pr){gr.set(rr,{})}else{gr.set(rr,[])}}if(pr){if(mr==="one"){gr.get(rr)[pr]=cr}else{if(gr.get(rr)[pr]){gr.get(rr)[pr].push(cr)}else{gr.get(rr)[pr]=[cr]}}}else{gr.get(rr).push(cr)}Reflect.defineMetadata(St,gr,Dt)}static getMetadata(St,Dt,rr){if(typeof Dt==="object"&&Dt.constructor){Dt=Dt.constructor}let cr;if(!Reflect.hasOwnMetadata(St,Dt)){cr=new Map;Reflect.defineMetadata(St,cr,Dt)}else{cr=Reflect.getMetadata(St,Dt)}if(!rr){return cr}return cr.get(rr)}saveMetadata(St,Dt,rr,cr){if(cr){const pr=DecoratorManager.getDecoratorMethod(St,cr);DecoratorManager.saveMetadata(this.injectMethodKeyPrefix,rr,pr,Dt)}else{const cr=DecoratorManager.getDecoratorClassKey(St);DecoratorManager.saveMetadata(this.injectClassKeyPrefix,rr,cr,Dt)}}attachMetadata(St,Dt,rr,cr,pr,mr){if(cr){const gr=DecoratorManager.getDecoratorMethod(St,cr);DecoratorManager.attachMetadata(this.injectMethodKeyPrefix,rr,gr,Dt,pr,mr)}else{const cr=DecoratorManager.getDecoratorClassKey(St);DecoratorManager.attachMetadata(this.injectClassKeyPrefix,rr,cr,Dt,pr,mr)}}getMetadata(St,Dt,rr){if(rr){const cr=DecoratorManager.getDecoratorMethod(St,rr);return DecoratorManager.getMetadata(this.injectMethodKeyPrefix,Dt,cr)}else{const rr=`${DecoratorManager.getDecoratorClassKey(St)}`;return DecoratorManager.getMetadata(this.injectClassKeyPrefix,Dt,rr)}}savePropertyDataToClass(St,Dt,rr,cr){const pr=DecoratorManager.getDecoratorClsMethodKey(St,cr);DecoratorManager.saveMetadata(this.injectClassMethodKeyPrefix,rr,pr,Dt)}attachPropertyDataToClass(St,Dt,rr,cr,pr){const mr=DecoratorManager.getDecoratorClsMethodKey(St,cr);DecoratorManager.attachMetadata(this.injectClassMethodKeyPrefix,rr,mr,Dt,pr)}getPropertyDataFromClass(St,Dt,rr){const cr=DecoratorManager.getDecoratorClsMethodKey(St,rr);return DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,Dt,cr)}listPropertyDataFromClass(St,Dt){const rr=DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,Dt);const cr=[];for(const[Dt,pr]of rr){if(Dt.indexOf(DecoratorManager.getDecoratorClsMethodPrefix(St))!==-1){cr.push(pr)}}return cr}}Dt.DecoratorManager=DecoratorManager;let Er=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 St=(0,Sr.getModuleRequirePathList)("@midwayjs/core");if(St.length){console.info("The module may be located in:");St.forEach(((St,Dt)=>{console.info(`${Dt+1}. ${St}`)}))}Er=global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]}else{global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]=Er}}function saveClassMetadata(St,Dt,rr,cr){if(cr&&typeof Dt==="object"){const cr=Er.getMetadata(St,rr);if(!cr){return Er.saveMetadata(St,Dt,rr)}if(Array.isArray(cr)){return Er.saveMetadata(St,cr.concat(Dt),rr)}else{return Er.saveMetadata(St,Object.assign(cr,Dt),rr)}}else{return Er.saveMetadata(St,Dt,rr)}}Dt.saveClassMetadata=saveClassMetadata;function attachClassMetadata(St,Dt,rr,cr,pr){return Er.attachMetadata(St,Dt,rr,undefined,cr,pr)}Dt.attachClassMetadata=attachClassMetadata;function getClassExtendedMetadata(St,Dt,rr,cr){if(cr===undefined){cr=true}const pr=DecoratorManager.getDecoratorClsExtendedKey(St);let mr=Er.getMetadata(pr,Dt,rr);if(cr&&mr!==undefined){return mr}const gr=Reflect.getPrototypeOf(Dt);if(gr&&gr.constructor!==Object){mr=(0,yr.merge)(getClassExtendedMetadata(St,gr,rr,cr),Er.getMetadata(St,Dt,rr))}Er.saveMetadata(pr,mr||null,Dt,rr);return mr}Dt.getClassExtendedMetadata=getClassExtendedMetadata;function getClassMetadata(St,Dt){return Er.getMetadata(St,Dt)}Dt.getClassMetadata=getClassMetadata;function savePropertyDataToClass(St,Dt,rr,cr){return Er.savePropertyDataToClass(St,Dt,rr,cr)}Dt.savePropertyDataToClass=savePropertyDataToClass;function attachPropertyDataToClass(St,Dt,rr,cr,pr){return Er.attachPropertyDataToClass(St,Dt,rr,cr,pr)}Dt.attachPropertyDataToClass=attachPropertyDataToClass;function getPropertyDataFromClass(St,Dt,rr){return Er.getPropertyDataFromClass(St,Dt,rr)}Dt.getPropertyDataFromClass=getPropertyDataFromClass;function listPropertyDataFromClass(St,Dt){return Er.listPropertyDataFromClass(St,Dt)}Dt.listPropertyDataFromClass=listPropertyDataFromClass;function savePropertyMetadata(St,Dt,rr,cr){return Er.saveMetadata(St,Dt,rr,cr)}Dt.savePropertyMetadata=savePropertyMetadata;function attachPropertyMetadata(St,Dt,rr,cr){return Er.attachMetadata(St,Dt,rr,cr)}Dt.attachPropertyMetadata=attachPropertyMetadata;function getPropertyMetadata(St,Dt,rr){return Er.getMetadata(St,Dt,rr)}Dt.getPropertyMetadata=getPropertyMetadata;function savePreloadModule(St){return saveModule(Dt.PRELOAD_MODULE_KEY,St)}Dt.savePreloadModule=savePreloadModule;function listPreloadModule(){return listModule(Dt.PRELOAD_MODULE_KEY)}Dt.listPreloadModule=listPreloadModule;function saveModule(St,Dt){if((0,mr.isClass)(Dt)){saveProviderId(undefined,Dt)}return Er.saveModule(St,Dt)}Dt.saveModule=saveModule;function bindContainer(St){return Er.bindContainer(St)}Dt.bindContainer=bindContainer;function clearBindContainer(){return Er.container=null}Dt.clearBindContainer=clearBindContainer;function listModule(St,Dt){const rr=Er.listModule(St);if(Dt){return rr.filter(Dt)}else{return rr}}Dt.listModule=listModule;function resetModule(St){return Er.resetModule(St)}Dt.resetModule=resetModule;function clearAllModule(){$r("--- clear all module here ---");return Er.clear()}Dt.clearAllModule=clearAllModule;function transformTypeFromTSDesign(St){if((0,mr.isNullOrUndefined)(St)){return{name:"undefined",isBaseType:true,originDesign:St}}switch(St.name){case"String":return{name:"string",isBaseType:true,originDesign:St};case"Number":return{name:"number",isBaseType:true,originDesign:St};case"Boolean":return{name:"boolean",isBaseType:true,originDesign:St};case"Symbol":return{name:"symbol",isBaseType:true,originDesign:St};case"Object":return{name:"object",isBaseType:true,originDesign:St};case"Function":return{name:"function",isBaseType:true,originDesign:St};default:return{name:St.name,isBaseType:false,originDesign:St}}}Dt.transformTypeFromTSDesign=transformTypeFromTSDesign;function savePropertyInject(St){let Dt=St.identifier;let rr=cr.InjectModeEnum.Identifier;if(!Dt){const pr=getPropertyType(St.target,St.targetKey);if(!pr.isBaseType&&(0,mr.isClass)(pr.originDesign)&&isProvide(pr.originDesign)){Dt=getProviderUUId(pr.originDesign);rr=cr.InjectModeEnum.Class}if(!Dt){Dt=St.targetKey;rr=cr.InjectModeEnum.PropertyName}}attachClassMetadata(pr.INJECT_TAG,{targetKey:St.targetKey,value:Dt,args:St.args,injectMode:rr},St.target,St.targetKey)}Dt.savePropertyInject=savePropertyInject;function getPropertyInject(St,Dt){return getClassExtendedMetadata(pr.INJECT_TAG,St,undefined,Dt)}Dt.getPropertyInject=getPropertyInject;function saveObjectDefinition(St,Dt={}){saveClassMetadata(pr.OBJ_DEF_CLS,Dt,St,true);return St}Dt.saveObjectDefinition=saveObjectDefinition;function getObjectDefinition(St){return getClassExtendedMetadata(pr.OBJ_DEF_CLS,St)}Dt.getObjectDefinition=getObjectDefinition;function saveProviderId(St,Dt){if(isProvide(Dt)){if(St){const rr=getClassMetadata(pr.TAGGED_CLS,Dt);if(rr.id!==St){rr.id=St;saveClassMetadata(pr.TAGGED_CLS,rr,Dt);$r(`update provide: ${Dt.name} -> ${rr.uuid}`)}}}else{const rr=(0,yr.generateRandomId)();saveClassMetadata(pr.TAGGED_CLS,{id:St,originName:Dt.name,uuid:rr,name:(0,gr.camelCase)(Dt.name)},Dt);$r(`save provide: ${Dt.name} -> ${rr}`)}return Dt}Dt.saveProviderId=saveProviderId;function getProviderId(St){const Dt=getClassMetadata(pr.TAGGED_CLS,St);if(Dt&&Dt.id){return Dt.id}}Dt.getProviderId=getProviderId;function getProviderName(St){const Dt=getClassMetadata(pr.TAGGED_CLS,St);if(Dt&&Dt.name){return Dt.name}}Dt.getProviderName=getProviderName;function getProviderUUId(St){const Dt=getClassMetadata(pr.TAGGED_CLS,St);if(Dt&&Dt.uuid){return Dt.uuid}}Dt.getProviderUUId=getProviderUUId;function isProvide(St){return!!getClassMetadata(pr.TAGGED_CLS,St)}Dt.isProvide=isProvide;var Ir;(function(St){St["Boolean"]="boolean";St["Number"]="number";St["String"]="string"})(Ir=Dt.BaseType||(Dt.BaseType={}));function getMethodParamTypes(St,Dt){if((0,mr.isClass)(St)){St=St.prototype}return Reflect.getMetadata("design:paramtypes",St,Dt)}Dt.getMethodParamTypes=getMethodParamTypes;function getPropertyType(St,Dt){return transformTypeFromTSDesign(Reflect.getMetadata("design:type",St,Dt))}Dt.getPropertyType=getPropertyType;function getMethodReturnTypes(St,Dt){if((0,mr.isClass)(St)){St=St.prototype}return Reflect.getMetadata("design:returntype",St,Dt)}Dt.getMethodReturnTypes=getMethodReturnTypes;function createCustomPropertyDecorator(St,Dt,rr=true){return function(cr,mr){attachClassMetadata(pr.INJECT_CUSTOM_PROPERTY,{propertyName:mr,key:St,metadata:Dt,impl:rr},cr,mr)}}Dt.createCustomPropertyDecorator=createCustomPropertyDecorator;function createCustomMethodDecorator(St,Dt,rr={impl:true}){if(typeof rr==="boolean"){rr={impl:rr}}if(rr.impl===undefined){rr.impl=true}return function(cr,mr,gr){attachClassMetadata(pr.INJECT_CUSTOM_METHOD,{propertyName:mr,key:St,metadata:Dt,options:rr},cr)}}Dt.createCustomMethodDecorator=createCustomMethodDecorator;function createCustomParamDecorator(St,Dt,rr={impl:true}){if(typeof rr==="boolean"){rr={impl:rr}}if(rr.impl===undefined){rr.impl=true}return function(cr,mr,gr){attachClassMetadata(pr.INJECT_CUSTOM_PARAM,{key:St,parameterIndex:gr,propertyName:mr,metadata:Dt,options:rr},cr,mr,"multi")}}Dt.createCustomParamDecorator=createCustomParamDecorator},69193:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ServerlessTrigger=Dt.ServerlessFunction=void 0;const cr=rr(49757);const pr=rr(6192);function ServerlessFunction(St){return(Dt,rr,pr)=>{(0,cr.savePropertyMetadata)(cr.SERVERLESS_FUNC_KEY,St,Dt,rr)}}Dt.ServerlessFunction=ServerlessFunction;function ServerlessTrigger(St,Dt={}){return(rr,mr,gr)=>{var yr;if(St===pr.ServerlessTriggerType.HTTP||St===pr.ServerlessTriggerType.API_GATEWAY){Dt["method"]=(yr=Dt["method"])!==null&&yr!==void 0?yr:"get"}(0,cr.saveModule)(cr.FUNC_KEY,rr.constructor);Dt=Dt||{};(0,cr.attachClassMetadata)(cr.FUNC_KEY,{type:St,methodName:mr,metadata:Dt},rr)}}Dt.ServerlessTrigger=ServerlessTrigger},49757:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});pr(rr(39990),Dt);pr(rr(92922),Dt);pr(rr(52953),Dt);pr(rr(76271),Dt);pr(rr(2940),Dt);pr(rr(73821),Dt);pr(rr(18025),Dt);pr(rr(1623),Dt);pr(rr(41573),Dt);pr(rr(17511),Dt);pr(rr(41958),Dt);pr(rr(64331),Dt);pr(rr(56329),Dt);pr(rr(69193),Dt);pr(rr(86690),Dt);pr(rr(58843),Dt);pr(rr(29619),Dt);pr(rr(92233),Dt);pr(rr(75105),Dt);pr(rr(45317),Dt);pr(rr(573),Dt);pr(rr(4132),Dt);pr(rr(76543),Dt);pr(rr(64767),Dt);pr(rr(41684),Dt);pr(rr(17640),Dt);pr(rr(81970),Dt);pr(rr(52963),Dt);pr(rr(57706),Dt);pr(rr(67999),Dt);pr(rr(20551),Dt)},573:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Consumer=void 0;const cr=rr(49757);const pr=rr(6192);function Consumer(St,Dt={}){return rr=>{(0,cr.saveModule)(cr.MS_CONSUMER_KEY,rr);(0,cr.saveClassMetadata)(cr.MS_CONSUMER_KEY,{type:St,metadata:Dt},rr);(0,cr.Scope)(pr.ScopeEnum.Request)(rr);(0,cr.Provide)()(rr)}}Dt.Consumer=Consumer},64767:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.KafkaListener=void 0;const cr=rr(49757);function KafkaListener(St,Dt={}){return(rr,pr)=>{Dt.topic=St;Dt.propertyKey=pr;(0,cr.attachPropertyDataToClass)(cr.MS_CONSUMER_KEY,Dt,rr,pr)}}Dt.KafkaListener=KafkaListener},4132:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.DubboMethod=Dt.GrpcMethod=Dt.GrpcStreamTypeEnum=Dt.Provider=void 0;const cr=rr(49757);const pr=rr(6192);function Provider(St,Dt={}){return rr=>{(0,cr.saveModule)(cr.MS_PROVIDER_KEY,rr);(0,cr.saveClassMetadata)(cr.MS_PROVIDER_KEY,{type:St,metadata:Dt},rr);(0,cr.Scope)(pr.ScopeEnum.Request)(rr);(0,cr.Provide)()(rr)}}Dt.Provider=Provider;var mr;(function(St){St["BASE"]="base";St["DUPLEX"]="ServerDuplexStream";St["READABLE"]="ServerReadableStream";St["WRITEABLE"]="ServerWritableStream"})(mr=Dt.GrpcStreamTypeEnum||(Dt.GrpcStreamTypeEnum={}));function GrpcMethod(St={}){return(Dt,rr,pr)=>{if(!St.type){St.type=mr.BASE}(0,cr.savePropertyMetadata)(cr.MS_GRPC_METHOD_KEY,{methodName:St.methodName||rr,type:St.type,onEnd:St.onEnd},Dt,rr);return pr}}Dt.GrpcMethod=GrpcMethod;function DubboMethod(St){return(Dt,rr,pr)=>{(0,cr.attachClassMetadata)(cr.MS_DUBBO_METHOD_KEY,{methodName:St||rr},Dt);return pr}}Dt.DubboMethod=DubboMethod},76543:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.RabbitMQListener=void 0;const cr=rr(49757);function RabbitMQListener(St,Dt={}){return(rr,pr)=>{Dt.queueName=St;Dt.propertyKey=pr;(0,cr.attachPropertyDataToClass)(cr.MS_CONSUMER_KEY,Dt,rr,pr)}}Dt.RabbitMQListener=RabbitMQListener},41684:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.HSF=void 0;const cr=rr(49757);const pr=rr(6192);function HSF(St={}){return Dt=>{(0,cr.saveModule)(cr.HSF_KEY,Dt);(0,cr.saveClassMetadata)(cr.HSF_KEY,St,Dt);(0,cr.Scope)(pr.ScopeEnum.Request)(Dt);(0,cr.Provide)()(Dt)}}Dt.HSF=HSF},17640:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Queue=void 0;const cr=rr(49757);const pr=rr(75105);function Queue(St){return function(Dt){(0,cr.saveModule)(pr.MODULE_TASK_QUEUE_KEY,Dt);(0,cr.saveClassMetadata)(pr.MODULE_TASK_QUEUE_OPTIONS,{options:St,name:Dt.name},Dt);(0,cr.Provide)()(Dt)}}Dt.Queue=Queue},57706:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Schedule=void 0;const cr=rr(49757);const pr=rr(6192);function Schedule(St){return function(Dt){(0,cr.saveModule)(cr.SCHEDULE_KEY,Dt);(0,cr.saveClassMetadata)(cr.SCHEDULE_KEY,St,Dt);(0,cr.Scope)(pr.ScopeEnum.Request)(Dt);(0,cr.Provide)()(Dt)}}Dt.Schedule=Schedule},81970:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Task=void 0;const cr=rr(49757);const pr=rr(75105);function Task(St){return function(Dt,rr,mr){(0,cr.saveModule)(pr.MODULE_TASK_KEY,Dt.constructor);(0,cr.attachClassMetadata)(pr.MODULE_TASK_METADATA,{options:St,propertyKey:rr,value:mr.value,name:Dt.constructor.name},Dt)}}Dt.Task=Task},52963:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.TaskLocal=void 0;const cr=rr(49757);const pr=rr(75105);function TaskLocal(St){return function(Dt,rr,mr){(0,cr.saveModule)(pr.MODULE_TASK_TASK_LOCAL_KEY,Dt.constructor);(0,cr.attachClassMetadata)(pr.MODULE_TASK_TASK_LOCAL_OPTIONS,{options:St,propertyKey:rr,value:mr.value},Dt)}}Dt.TaskLocal=TaskLocal},86690:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Controller=void 0;const cr=rr(49757);const pr=rr(6192);function Controller(St="/",Dt={middleware:[],sensitive:true}){return rr=>{(0,cr.saveModule)(cr.CONTROLLER_KEY,rr);if(St)(0,cr.saveClassMetadata)(cr.CONTROLLER_KEY,{prefix:St,routerOptions:Dt},rr);(0,cr.Scope)(pr.ScopeEnum.Request)(rr);(0,cr.Provide)()(rr)}}Dt.Controller=Controller},58843:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Fields=Dt.Queries=Dt.RequestIP=Dt.RequestPath=Dt.Files=Dt.File=Dt.Headers=Dt.Param=Dt.Query=Dt.Body=Dt.Session=Dt.createRequestParamDecorator=Dt.RouteParamTypes=void 0;const cr=rr(49757);var pr;(function(St){St["QUERY"]="query";St["BODY"]="body";St["PARAM"]="param";St["HEADERS"]="headers";St["SESSION"]="session";St["FILESTREAM"]="file_stream";St["FILESSTREAM"]="files_stream";St["NEXT"]="next";St["REQUEST_PATH"]="request_path";St["REQUEST_IP"]="request_ip";St["QUERIES"]="queries";St["FIELDS"]="fields";St["CUSTOM"]="custom"})(pr=Dt.RouteParamTypes||(Dt.RouteParamTypes={}));const createParamMapping=function(St){return(Dt,rr={})=>{let pr=Dt;if(Array.isArray(Dt)&&rr.pipes===undefined){rr.pipes=Dt;pr=undefined}return(0,cr.createCustomParamDecorator)(cr.WEB_ROUTER_PARAM_KEY,{type:St,propertyData:pr},rr)}};const createRequestParamDecorator=function(St,Dt){Dt=Dt||{};if(Array.isArray(Dt)){Dt={pipes:Dt}}return createParamMapping(pr.CUSTOM)(St,Dt)};Dt.createRequestParamDecorator=createRequestParamDecorator;const Session=(St,Dt)=>createParamMapping(pr.SESSION)(St,{pipes:Dt});Dt.Session=Session;const Body=(St,Dt)=>createParamMapping(pr.BODY)(St,{pipes:Dt});Dt.Body=Body;const Query=(St,Dt)=>createParamMapping(pr.QUERY)(St,{pipes:Dt});Dt.Query=Query;const Param=(St,Dt)=>createParamMapping(pr.PARAM)(St,{pipes:Dt});Dt.Param=Param;const Headers=(St,Dt)=>createParamMapping(pr.HEADERS)(St,{pipes:Dt});Dt.Headers=Headers;const File=(St,Dt)=>createParamMapping(pr.FILESTREAM)(St,{pipes:Dt});Dt.File=File;const Files=(St,Dt)=>createParamMapping(pr.FILESSTREAM)(St,{pipes:Dt});Dt.Files=Files;const RequestPath=St=>createParamMapping(pr.REQUEST_PATH)(undefined,{pipes:St});Dt.RequestPath=RequestPath;const RequestIP=St=>createParamMapping(pr.REQUEST_IP)(undefined,{pipes:St});Dt.RequestIP=RequestIP;const Queries=(St,Dt)=>createParamMapping(pr.QUERIES)(St,{pipes:Dt});Dt.Queries=Queries;const Fields=(St,Dt)=>createParamMapping(pr.FIELDS)(St,{pipes:Dt});Dt.Fields=Fields},29619:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.All=Dt.Head=Dt.Options=Dt.Patch=Dt.Put=Dt.Del=Dt.Get=Dt.Post=Dt.RequestMapping=Dt.RequestMethod=void 0;const cr=rr(49757);Dt.RequestMethod={GET:"get",POST:"post",PUT:"put",DELETE:"delete",PATCH:"patch",ALL:"all",OPTIONS:"options",HEAD:"head"};const pr={path:"/",requestMethod:Dt.RequestMethod.GET,routerName:null,middleware:[]};const RequestMapping=(St=pr)=>{const rr=St.path||"/";const mr=St.requestMethod||Dt.RequestMethod.GET;const gr=St.routerName;const yr=St.middleware;return(Dt,pr,Sr)=>{var $r;(0,cr.attachClassMetadata)(cr.WEB_ROUTER_KEY,{path:rr,requestMethod:mr,routerName:gr,method:pr,middleware:yr,summary:(St===null||St===void 0?void 0:St.summary)||"",description:(St===null||St===void 0?void 0:St.description)||"",ignoreGlobalPrefix:($r=St===null||St===void 0?void 0:St.ignoreGlobalPrefix)!==null&&$r!==void 0?$r:false},Dt);return Sr}};Dt.RequestMapping=RequestMapping;const createMappingDecorator=St=>(rr,cr={middleware:[]})=>(0,Dt.RequestMapping)(Object.assign(cr,{requestMethod:St,path:rr}));Dt.Post=createMappingDecorator(Dt.RequestMethod.POST);Dt.Get=createMappingDecorator(Dt.RequestMethod.GET);Dt.Del=createMappingDecorator(Dt.RequestMethod.DELETE);Dt.Put=createMappingDecorator(Dt.RequestMethod.PUT);Dt.Patch=createMappingDecorator(Dt.RequestMethod.PATCH);Dt.Options=createMappingDecorator(Dt.RequestMethod.OPTIONS);Dt.Head=createMappingDecorator(Dt.RequestMethod.HEAD);Dt.All=createMappingDecorator(Dt.RequestMethod.ALL)},92233:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.createRender=Dt.ContentType=Dt.SetHeader=Dt.HttpCode=Dt.Redirect=void 0;const cr=rr(49757);function Redirect(St,Dt=302){return(rr,pr,mr)=>{(0,cr.attachPropertyMetadata)(cr.WEB_RESPONSE_KEY,{type:cr.WEB_RESPONSE_REDIRECT,url:St,code:Dt},rr,pr);return mr}}Dt.Redirect=Redirect;function HttpCode(St){return(Dt,rr,pr)=>{(0,cr.attachPropertyMetadata)(cr.WEB_RESPONSE_KEY,{type:cr.WEB_RESPONSE_HTTP_CODE,code:St},Dt,rr);return pr}}Dt.HttpCode=HttpCode;function SetHeader(St,Dt){return(rr,pr,mr)=>{let gr={};if(Dt){gr[St]=Dt}else{gr=St}(0,cr.attachPropertyMetadata)(cr.WEB_RESPONSE_KEY,{type:cr.WEB_RESPONSE_HEADER,setHeaders:gr},rr,pr);return mr}}Dt.SetHeader=SetHeader;function ContentType(St){return(Dt,rr,pr)=>{(0,cr.attachPropertyMetadata)(cr.WEB_RESPONSE_KEY,{type:cr.WEB_RESPONSE_CONTENT_TYPE,contentType:St},Dt,rr);return pr}}Dt.ContentType=ContentType;function createRender(St){return St=>(Dt,rr,pr)=>{(0,cr.attachPropertyMetadata)(cr.WEB_RESPONSE_KEY,{type:cr.WEB_RESPONSE_RENDER,templateName:St},Dt,rr);return pr}}Dt.createRender=createRender},67999:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.WSController=void 0;const cr=rr(49757);const pr=rr(6192);function WSController(St="/",Dt={middleware:[],connectionMiddleware:[]}){return rr=>{(0,cr.saveModule)(cr.WS_CONTROLLER_KEY,rr);(0,cr.saveClassMetadata)(cr.WS_CONTROLLER_KEY,{namespace:St,routerOptions:Dt},rr);(0,cr.Scope)(pr.ScopeEnum.Request)(rr);(0,cr.Provide)()(rr)}}Dt.WSController=WSController},20551:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.OnConnection=Dt.OnDisConnection=Dt.Emit=Dt.OnMessage=Dt.WSBroadCast=Dt.WSEmit=Dt.OnWSMessage=Dt.OnWSDisConnection=Dt.OnWSConnection=Dt.WSEventTypeEnum=void 0;const cr=rr(49757);var pr;(function(St){St["ON_CONNECTION"]="ws:onConnection";St["ON_DISCONNECTION"]="ws:onDisconnection";St["ON_MESSAGE"]="ws:onMessage";St["ON_SOCKET_ERROR"]="ws:onSocketError";St["EMIT"]="ws:Emit";St["BROADCAST"]="ws:broadcast"})(pr=Dt.WSEventTypeEnum||(Dt.WSEventTypeEnum={}));function OnWSConnection(St={}){return(Dt,rr,mr)=>{(0,cr.attachClassMetadata)(cr.WS_EVENT_KEY,{eventType:pr.ON_CONNECTION,propertyName:rr,eventOptions:St,descriptor:mr},Dt.constructor)}}Dt.OnWSConnection=OnWSConnection;function OnWSDisConnection(){return(St,Dt,rr)=>{(0,cr.attachClassMetadata)(cr.WS_EVENT_KEY,{eventType:pr.ON_DISCONNECTION,propertyName:Dt,descriptor:rr},St.constructor)}}Dt.OnWSDisConnection=OnWSDisConnection;function OnWSMessage(St,Dt={}){return(rr,mr,gr)=>{(0,cr.attachClassMetadata)(cr.WS_EVENT_KEY,{eventType:pr.ON_MESSAGE,messageEventName:St,propertyName:mr,eventOptions:Dt,descriptor:gr},rr.constructor)}}Dt.OnWSMessage=OnWSMessage;function WSEmit(St,Dt=[]){return(rr,mr,gr)=>{(0,cr.attachClassMetadata)(cr.WS_EVENT_KEY,{eventType:pr.EMIT,propertyName:mr,messageEventName:St,roomName:[].concat(Dt),descriptor:gr},rr.constructor)}}Dt.WSEmit=WSEmit;function WSBroadCast(St="",Dt=[]){return(rr,mr,gr)=>{(0,cr.attachClassMetadata)(cr.WS_EVENT_KEY,{eventType:pr.BROADCAST,propertyName:mr,messageEventName:St,roomName:[].concat(Dt),descriptor:gr},rr.constructor)}}Dt.WSBroadCast=WSBroadCast;Dt.OnMessage=OnWSMessage;Dt.Emit=WSEmit;Dt.OnDisConnection=OnWSDisConnection;Dt.OnConnection=OnWSConnection},34881:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.FunctionDefinition=void 0;const cr=rr(6192);const pr=rr(59327);class FunctionWrapperCreator extends pr.ObjectCreator{doConstruct(St,Dt,rr){if(!St){return null}return St(rr,Dt)}async doConstructAsync(St,Dt,rr){if(!St){return null}return St(rr,Dt)}}class FunctionDefinition{constructor(){this.constructorArgs=[];this.namespace="";this.asynchronous=true;this.handlerProps=[];this.allowDowngrade=false;this.innerAutowire=false;this.innerScope=cr.ScopeEnum.Singleton;this.creator=new FunctionWrapperCreator(this)}getAttr(St){}hasAttr(St){return false}hasConstructorArgs(){return false}hasDependsOn(){return false}isAsync(){return this.asynchronous}isDirect(){return false}isExternal(){return false}set scope(St){this.innerScope=St}isSingletonScope(){return this.innerScope===cr.ScopeEnum.Singleton}isRequestScope(){return this.innerScope===cr.ScopeEnum.Request}setAttr(St,Dt){}}Dt.FunctionDefinition=FunctionDefinition},59327:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ObjectCreator=void 0;const cr=rr(86314);const pr=rr(63289);class ObjectCreator{constructor(St){this.definition=St}load(){let St=null;if(typeof this.definition.path==="string"){if(!this.definition.path){return St}const Dt=this.definition.path;if(this.definition.export){St=require(Dt)[this.definition.export]}else{St=require(Dt)}}else{St=this.definition.path}return St}doConstruct(St,Dt){if(!St){return Object.create(null)}let rr;if(this.definition.constructMethod){rr=St[this.definition.constructMethod].apply(St,Dt)}else{rr=Reflect.construct(St,Dt)}return rr}async doConstructAsync(St,Dt){if(!St){return Object.create(null)}let rr;if(this.definition.constructMethod){const cr=St[this.definition.constructMethod];if(pr.Types.isAsyncFunction(cr)){rr=await cr.apply(St,Dt)}else{rr=cr.apply(St,Dt)}}else{rr=Reflect.construct(St,Dt)}return rr}doInit(St){const Dt=St;if(this.definition.initMethod&&Dt[this.definition.initMethod]){if(pr.Types.isGeneratorFunction(Dt[this.definition.initMethod])||pr.Types.isAsyncFunction(Dt[this.definition.initMethod])){throw new cr.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}else{const St=Dt[this.definition.initMethod].call(Dt);if(pr.Types.isPromise(St)){throw new cr.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}}}}async doInitAsync(St){const Dt=St;if(this.definition.initMethod&&Dt[this.definition.initMethod]){const St=Dt[this.definition.initMethod];if(pr.Types.isAsyncFunction(St)){await St.call(Dt)}else{if(St.length===1){await new Promise((rr=>{St.call(Dt,rr)}))}else{St.call(Dt)}}}}doDestroy(St){if(this.definition.destroyMethod&&St[this.definition.destroyMethod]){St[this.definition.destroyMethod].call(St)}}async doDestroyAsync(St){if(this.definition.destroyMethod&&St[this.definition.destroyMethod]){const Dt=St[this.definition.destroyMethod];if(pr.Types.isAsyncFunction(Dt)){await Dt.call(St)}else{if(Dt.length===1){await new Promise((rr=>{Dt.call(St,rr)}))}else{Dt.call(St)}}}}}Dt.ObjectCreator=ObjectCreator},47698:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ObjectDefinition=void 0;const cr=rr(6192);const pr=rr(74701);const mr=rr(59327);class ObjectDefinition{constructor(){this._attrs=new Map;this._asynchronous=false;this.scope=cr.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 pr.ObjectProperties;this.namespace="";this.handlerProps=[];this.allowDowngrade=false;this.creator=new mr.ObjectCreator(this)}set asynchronous(St){this._asynchronous=St}isAsync(){return this._asynchronous}isSingletonScope(){return this.scope===cr.ScopeEnum.Singleton}isRequestScope(){return this.scope===cr.ScopeEnum.Request}hasDependsOn(){return this.dependsOn.length>0}hasConstructorArgs(){return this.constructorArgs.length>0}getAttr(St){return this._attrs.get(St)}hasAttr(St){return this._attrs.has(St)}setAttr(St,Dt){this._attrs.set(St,Dt)}}Dt.ObjectDefinition=ObjectDefinition},74701:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ObjectProperties=void 0;class ObjectProperties extends Map{propertyKeys(){return Array.from(this.keys())}getProperty(St,Dt){if(this.has(St)){return this.get(St)}return Dt}setProperty(St,Dt){return this.set(St,Dt)}}Dt.ObjectProperties=ObjectProperties},21769:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayHttpError=Dt.MidwayError=Dt.registerErrorCode=void 0;const cr=rr(58611);const pr=new Set;function registerErrorCode(St,Dt){if(pr.has(St)){throw new MidwayError(`Error group ${St} is duplicated, please check before adding.`)}else{pr.add(St)}const rr={};for(const cr in Dt){rr[cr]=St.toUpperCase()+"_"+String(Dt[cr]).toUpperCase()}return rr}Dt.registerErrorCode=registerErrorCode;class MidwayError extends Error{constructor(St,Dt,rr){super(St);if(!Dt||typeof Dt==="object"){rr=Dt;Dt="MIDWAY_10000"}this.name=this.constructor.name;this.code=Dt;this.cause=rr===null||rr===void 0?void 0:rr.cause}}Dt.MidwayError=MidwayError;class MidwayHttpError extends MidwayError{constructor(St,Dt,rr,pr){super(St?typeof St==="string"?St:St.message:cr.STATUS_CODES[Dt],rr!==null&&rr!==void 0?rr:String(Dt),pr);if(St&&St["stack"]){this.stack=St["stack"]}this.status=Dt}}Dt.MidwayHttpError=MidwayHttpError},37198:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayEmptyValueError=Dt.MidwayInvalidConfigPropertyError=Dt.MidwayMainFrameworkMissingError=Dt.MidwayCodeInvokeTimeoutError=Dt.MidwayInvokeForbiddenError=Dt.MidwayRetryExceededMaxTimesError=Dt.MidwayDuplicateControllerOptionsError=Dt.MidwayDuplicateClassNameError=Dt.MidwayInconsistentVersionError=Dt.MidwayUtilHttpClientTimeoutError=Dt.MidwayMissingImportComponentError=Dt.MidwaySingletonInjectRequestError=Dt.MidwayUseWrongMethodError=Dt.MidwayDuplicateRouteError=Dt.MidwayResolverMissingError=Dt.MidwayInvalidConfigError=Dt.MidwayConfigMissingError=Dt.MidwayFeatureNotImplementedError=Dt.MidwayFeatureNoLongerSupportedError=Dt.MidwayDefinitionNotFoundError=Dt.MidwayParameterError=Dt.MidwayCommonError=Dt.FrameworkErrorEnum=void 0;const cr=rr(21769);Dt.FrameworkErrorEnum=(0,cr.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 cr.MidwayError{constructor(St){super(St,Dt.FrameworkErrorEnum.COMMON)}}Dt.MidwayCommonError=MidwayCommonError;class MidwayParameterError extends cr.MidwayError{constructor(St){super(St!==null&&St!==void 0?St:"Parameter type not match",Dt.FrameworkErrorEnum.PARAM_TYPE)}}Dt.MidwayParameterError=MidwayParameterError;class MidwayDefinitionNotFoundError extends cr.MidwayError{static isClosePrototypeOf(St){return St?St[MidwayDefinitionNotFoundError.type]===MidwayDefinitionNotFoundError.type:false}constructor(St){super(`${St} is not valid in current context`,Dt.FrameworkErrorEnum.DEFINITION_NOT_FOUND);this[MidwayDefinitionNotFoundError.type]=MidwayDefinitionNotFoundError.type}updateErrorMsg(St){const Dt=this.message.split(" is not valid in current context")[0];this.message=`${Dt} in class ${St} is not valid in current context`}}Dt.MidwayDefinitionNotFoundError=MidwayDefinitionNotFoundError;MidwayDefinitionNotFoundError.type=Symbol.for("#NotFoundError");class MidwayFeatureNoLongerSupportedError extends cr.MidwayError{constructor(St){super("This feature no longer supported \n"+St,Dt.FrameworkErrorEnum.FEATURE_NO_LONGER_SUPPORTED)}}Dt.MidwayFeatureNoLongerSupportedError=MidwayFeatureNoLongerSupportedError;class MidwayFeatureNotImplementedError extends cr.MidwayError{constructor(St){super("This feature not implemented \n"+St,Dt.FrameworkErrorEnum.FEATURE_NOT_IMPLEMENTED)}}Dt.MidwayFeatureNotImplementedError=MidwayFeatureNotImplementedError;class MidwayConfigMissingError extends cr.MidwayError{constructor(St){super(`Can't found config key "${St}" in your config, please set it first`,Dt.FrameworkErrorEnum.MISSING_CONFIG)}}Dt.MidwayConfigMissingError=MidwayConfigMissingError;class MidwayInvalidConfigError extends cr.MidwayError{constructor(St){super("Invalid config file \n"+St,Dt.FrameworkErrorEnum.INVALID_CONFIG)}}Dt.MidwayInvalidConfigError=MidwayInvalidConfigError;class MidwayResolverMissingError extends cr.MidwayError{constructor(St){super(`Resolver "${St}" is missing.`,Dt.FrameworkErrorEnum.MISSING_RESOLVER)}}Dt.MidwayResolverMissingError=MidwayResolverMissingError;class MidwayDuplicateRouteError extends cr.MidwayError{constructor(St,rr,cr){super(`Duplicate router "${St}" at "${rr}" and "${cr}"`,Dt.FrameworkErrorEnum.DUPLICATE_ROUTER)}}Dt.MidwayDuplicateRouteError=MidwayDuplicateRouteError;class MidwayUseWrongMethodError extends cr.MidwayError{constructor(St,rr,cr){const pr=cr?`${cr} not valid by ${St}, Use ${rr} instead!`:`You should not invoked by ${St}, Use ${rr} instead!`;super(pr,Dt.FrameworkErrorEnum.USE_WRONG_METHOD)}}Dt.MidwayUseWrongMethodError=MidwayUseWrongMethodError;class MidwaySingletonInjectRequestError extends cr.MidwayError{constructor(St,rr){const cr=`${St} with singleton scope can't implicitly inject ${rr} with request scope directly, please add "@Scope(ScopeEnum.Request, { allowDowngrade: true })" in ${rr} or use "ctx.requestContext.getAsync(${rr})".`;super(cr,Dt.FrameworkErrorEnum.SINGLETON_INJECT_REQUEST)}}Dt.MidwaySingletonInjectRequestError=MidwaySingletonInjectRequestError;class MidwayMissingImportComponentError extends cr.MidwayError{constructor(St){const rr=`"${St}" can't inject and maybe forgot add "{imports: [***]}" in @Configuration.`;super(rr,Dt.FrameworkErrorEnum.MISSING_IMPORTS)}}Dt.MidwayMissingImportComponentError=MidwayMissingImportComponentError;class MidwayUtilHttpClientTimeoutError extends cr.MidwayError{constructor(St){super(St,Dt.FrameworkErrorEnum.UTIL_HTTP_TIMEOUT)}}Dt.MidwayUtilHttpClientTimeoutError=MidwayUtilHttpClientTimeoutError;class MidwayInconsistentVersionError extends cr.MidwayError{constructor(){const St='We find a latest dependency package installed, please remove the lock file and use "npm update" to upgrade all dependencies first.';super(St,Dt.FrameworkErrorEnum.INCONSISTENT_VERSION)}}Dt.MidwayInconsistentVersionError=MidwayInconsistentVersionError;class MidwayDuplicateClassNameError extends cr.MidwayError{constructor(St,rr,cr){super(`"${St}" duplicated between "${rr}" and "${cr}"`,Dt.FrameworkErrorEnum.DUPLICATE_CLASS_NAME)}}Dt.MidwayDuplicateClassNameError=MidwayDuplicateClassNameError;class MidwayDuplicateControllerOptionsError extends cr.MidwayError{constructor(St,rr,cr){super(`"Prefix ${St}" with duplicated controller options between "${rr}" and "${cr}"`,Dt.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS)}}Dt.MidwayDuplicateControllerOptionsError=MidwayDuplicateControllerOptionsError;class MidwayRetryExceededMaxTimesError extends cr.MidwayError{constructor(St,rr,cr){super(`Invoke "${St}" retries exceeded the maximum number of times(${rr}), error: ${cr.message}`,Dt.FrameworkErrorEnum.RETRY_OVER_MAX_TIME,{cause:cr})}}Dt.MidwayRetryExceededMaxTimesError=MidwayRetryExceededMaxTimesError;class MidwayInvokeForbiddenError extends cr.MidwayError{constructor(St,rr){super(`Invoke "${rr?rr.name:"unknown"}.${St}" is forbidden.`,Dt.FrameworkErrorEnum.INVOKE_METHOD_FORBIDDEN)}}Dt.MidwayInvokeForbiddenError=MidwayInvokeForbiddenError;class MidwayCodeInvokeTimeoutError extends cr.MidwayError{constructor(St,rr){super(`Invoke "${St}" running timeout(${rr}ms)`,Dt.FrameworkErrorEnum.CODE_INVOKE_TIMEOUT)}}Dt.MidwayCodeInvokeTimeoutError=MidwayCodeInvokeTimeoutError;class MidwayMainFrameworkMissingError extends cr.MidwayError{constructor(){super("Main framework missing, please check your configuration.",Dt.FrameworkErrorEnum.MAIN_FRAMEWORK_MISSING)}}Dt.MidwayMainFrameworkMissingError=MidwayMainFrameworkMissingError;class MidwayInvalidConfigPropertyError extends cr.MidwayError{constructor(St,rr){super(`Invalid config property "${St}", ${rr?`only ${rr.join(",")} can be set`:"please check your configuration"}.`,Dt.FrameworkErrorEnum.INVALID_CONFIG_PROPERTY)}}Dt.MidwayInvalidConfigPropertyError=MidwayInvalidConfigPropertyError;class MidwayEmptyValueError extends cr.MidwayError{constructor(St){super(St!==null&&St!==void 0?St:"There is an empty value got and it is not allowed.",Dt.FrameworkErrorEnum.EMPTY_VALUE)}}Dt.MidwayEmptyValueError=MidwayEmptyValueError},9504:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.httpError=Dt.GatewayTimeoutError=Dt.ServiceUnavailableError=Dt.BadGatewayError=Dt.NotImplementedError=Dt.InternalServerErrorError=Dt.TooManyRequestsError=Dt.UnprocessableEntityError=Dt.UnsupportedMediaTypeError=Dt.PayloadTooLargeError=Dt.GoneError=Dt.ConflictError=Dt.RequestTimeoutError=Dt.NotAcceptableError=Dt.ForbiddenError=Dt.NotFoundError=Dt.UnauthorizedError=Dt.BadRequestError=Dt.HttpStatus=void 0;const cr=rr(21769);var pr;(function(St){St[St["CONTINUE"]=100]="CONTINUE";St[St["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";St[St["PROCESSING"]=102]="PROCESSING";St[St["EARLYHINTS"]=103]="EARLYHINTS";St[St["OK"]=200]="OK";St[St["CREATED"]=201]="CREATED";St[St["ACCEPTED"]=202]="ACCEPTED";St[St["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";St[St["NO_CONTENT"]=204]="NO_CONTENT";St[St["RESET_CONTENT"]=205]="RESET_CONTENT";St[St["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";St[St["AMBIGUOUS"]=300]="AMBIGUOUS";St[St["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";St[St["FOUND"]=302]="FOUND";St[St["SEE_OTHER"]=303]="SEE_OTHER";St[St["NOT_MODIFIED"]=304]="NOT_MODIFIED";St[St["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";St[St["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";St[St["BAD_REQUEST"]=400]="BAD_REQUEST";St[St["UNAUTHORIZED"]=401]="UNAUTHORIZED";St[St["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";St[St["FORBIDDEN"]=403]="FORBIDDEN";St[St["NOT_FOUND"]=404]="NOT_FOUND";St[St["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";St[St["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";St[St["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";St[St["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";St[St["CONFLICT"]=409]="CONFLICT";St[St["GONE"]=410]="GONE";St[St["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";St[St["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";St[St["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";St[St["URI_TOO_LONG"]=414]="URI_TOO_LONG";St[St["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";St[St["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";St[St["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";St[St["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";St[St["MISDIRECTED"]=421]="MISDIRECTED";St[St["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";St[St["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";St[St["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";St[St["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";St[St["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";St[St["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";St[St["BAD_GATEWAY"]=502]="BAD_GATEWAY";St[St["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";St[St["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";St[St["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(pr=Dt.HttpStatus||(Dt.HttpStatus={}));class BadRequestError extends cr.MidwayHttpError{constructor(St){super(St,pr.BAD_REQUEST)}}Dt.BadRequestError=BadRequestError;class UnauthorizedError extends cr.MidwayHttpError{constructor(St){super(St,pr.UNAUTHORIZED)}}Dt.UnauthorizedError=UnauthorizedError;class NotFoundError extends cr.MidwayHttpError{constructor(St){super(St,pr.NOT_FOUND)}}Dt.NotFoundError=NotFoundError;class ForbiddenError extends cr.MidwayHttpError{constructor(St){super(St,pr.FORBIDDEN)}}Dt.ForbiddenError=ForbiddenError;class NotAcceptableError extends cr.MidwayHttpError{constructor(St){super(St,pr.NOT_ACCEPTABLE)}}Dt.NotAcceptableError=NotAcceptableError;class RequestTimeoutError extends cr.MidwayHttpError{constructor(St){super(St,pr.REQUEST_TIMEOUT)}}Dt.RequestTimeoutError=RequestTimeoutError;class ConflictError extends cr.MidwayHttpError{constructor(St){super(St,pr.CONFLICT)}}Dt.ConflictError=ConflictError;class GoneError extends cr.MidwayHttpError{constructor(St){super(St,pr.GONE)}}Dt.GoneError=GoneError;class PayloadTooLargeError extends cr.MidwayHttpError{constructor(St){super(St,pr.PAYLOAD_TOO_LARGE)}}Dt.PayloadTooLargeError=PayloadTooLargeError;class UnsupportedMediaTypeError extends cr.MidwayHttpError{constructor(St){super(St,pr.UNSUPPORTED_MEDIA_TYPE)}}Dt.UnsupportedMediaTypeError=UnsupportedMediaTypeError;class UnprocessableEntityError extends cr.MidwayHttpError{constructor(St){super(St,pr.UNPROCESSABLE_ENTITY)}}Dt.UnprocessableEntityError=UnprocessableEntityError;class TooManyRequestsError extends cr.MidwayHttpError{constructor(St){super(St,pr.TOO_MANY_REQUESTS)}}Dt.TooManyRequestsError=TooManyRequestsError;class InternalServerErrorError extends cr.MidwayHttpError{constructor(St){super(St,pr.INTERNAL_SERVER_ERROR)}}Dt.InternalServerErrorError=InternalServerErrorError;class NotImplementedError extends cr.MidwayHttpError{constructor(St){super(St,pr.NOT_IMPLEMENTED)}}Dt.NotImplementedError=NotImplementedError;class BadGatewayError extends cr.MidwayHttpError{constructor(St){super(St,pr.BAD_GATEWAY)}}Dt.BadGatewayError=BadGatewayError;class ServiceUnavailableError extends cr.MidwayHttpError{constructor(St){super(St,pr.SERVICE_UNAVAILABLE)}}Dt.ServiceUnavailableError=ServiceUnavailableError;class GatewayTimeoutError extends cr.MidwayHttpError{constructor(St){super(St,pr.GATEWAY_TIMEOUT)}}Dt.GatewayTimeoutError=GatewayTimeoutError;Dt.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}},86314:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.httpError=Dt.HttpStatus=void 0;pr(rr(21769),Dt);var mr=rr(9504);Object.defineProperty(Dt,"HttpStatus",{enumerable:true,get:function(){return mr.HttpStatus}});Object.defineProperty(Dt,"httpError",{enumerable:true,get:function(){return mr.httpError}});pr(rr(37198),Dt)},24451:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.createConfiguration=Dt.FunctionalConfiguration=void 0;class FunctionalConfiguration{constructor(St){this.options=St;this.readyHandler=()=>{};this.stopHandler=()=>{};this.configLoadHandler=()=>{};this.serverReadyHandler=()=>{}}onConfigLoad(St,Dt){if(typeof St==="function"){this.configLoadHandler=St}else{return this.configLoadHandler(St,Dt)}return this}onReady(St,Dt){if(typeof St==="function"){this.readyHandler=St}else{return this.readyHandler(St,Dt)}return this}onServerReady(St,Dt){if(typeof St==="function"){this.serverReadyHandler=St}else{return this.serverReadyHandler(St,Dt)}return this}onStop(St,Dt){if(typeof St==="function"){this.stopHandler=St}else{return this.stopHandler(St,Dt)}return this}getConfigurationOptions(){return this.options}}Dt.FunctionalConfiguration=FunctionalConfiguration;const createConfiguration=St=>new FunctionalConfiguration(St);Dt.createConfiguration=createConfiguration},46123:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayPerformanceManager=Dt.TypedResourceManager=Dt.HttpServerResponse=Dt.ServerResponse=Dt.FORMAT=Dt.FileUtils=Dt.PathFileUtil=Dt.Types=Dt.retryWith=Dt.retryWithAsync=Dt.extend=Dt.Utils=Dt.sleep=Dt.isTypeScriptEnvironment=Dt.wrapAsync=Dt.wrapMiddleware=Dt.pathMatching=Dt.transformRequestObjectByType=Dt.deprecatedOutput=Dt.delegateTargetAllPrototypeMethod=Dt.delegateTargetProperties=Dt.delegateTargetMethod=Dt.delegateTargetPrototypeMethod=Dt.loadModule=Dt.safeRequire=Dt.safelyGet=Dt.ASYNC_ROOT_CONTEXT=Dt.MidwayPriorityManager=Dt.DEFAULT_PRIORITY=Dt.DataSourceManager=Dt.WebRouterCollector=Dt.MidwayServerlessFunctionService=Dt.MidwayWebRouterService=Dt.MidwayHealthService=Dt.MidwayMockService=Dt.MidwayDecoratorService=Dt.MidwayMiddlewareService=Dt.MidwayLifeCycleService=Dt.MidwayAspectService=Dt.MidwayFrameworkService=Dt.MidwayLoggerService=Dt.MidwayInformationService=Dt.MidwayEnvironmentService=Dt.MidwayConfigService=Dt.FunctionalConfiguration=Dt.createConfiguration=Dt.BaseFramework=Dt.MidwayRequestContainer=void 0;pr(rr(6192),Dt);pr(rr(9288),Dt);var mr=rr(97983);Object.defineProperty(Dt,"MidwayRequestContainer",{enumerable:true,get:function(){return mr.MidwayRequestContainer}});var gr=rr(83872);Object.defineProperty(Dt,"BaseFramework",{enumerable:true,get:function(){return gr.BaseFramework}});pr(rr(28695),Dt);pr(rr(2222),Dt);var yr=rr(24451);Object.defineProperty(Dt,"createConfiguration",{enumerable:true,get:function(){return yr.createConfiguration}});Object.defineProperty(Dt,"FunctionalConfiguration",{enumerable:true,get:function(){return yr.FunctionalConfiguration}});var Sr=rr(78842);Object.defineProperty(Dt,"MidwayConfigService",{enumerable:true,get:function(){return Sr.MidwayConfigService}});var $r=rr(70275);Object.defineProperty(Dt,"MidwayEnvironmentService",{enumerable:true,get:function(){return $r.MidwayEnvironmentService}});var Er=rr(37482);Object.defineProperty(Dt,"MidwayInformationService",{enumerable:true,get:function(){return Er.MidwayInformationService}});var Ir=rr(34888);Object.defineProperty(Dt,"MidwayLoggerService",{enumerable:true,get:function(){return Ir.MidwayLoggerService}});var Or=rr(33332);Object.defineProperty(Dt,"MidwayFrameworkService",{enumerable:true,get:function(){return Or.MidwayFrameworkService}});var Hr=rr(70812);Object.defineProperty(Dt,"MidwayAspectService",{enumerable:true,get:function(){return Hr.MidwayAspectService}});var Gr=rr(13328);Object.defineProperty(Dt,"MidwayLifeCycleService",{enumerable:true,get:function(){return Gr.MidwayLifeCycleService}});var Tn=rr(68220);Object.defineProperty(Dt,"MidwayMiddlewareService",{enumerable:true,get:function(){return Tn.MidwayMiddlewareService}});var Wn=rr(96367);Object.defineProperty(Dt,"MidwayDecoratorService",{enumerable:true,get:function(){return Wn.MidwayDecoratorService}});var Gn=rr(77306);Object.defineProperty(Dt,"MidwayMockService",{enumerable:true,get:function(){return Gn.MidwayMockService}});var mi=rr(658);Object.defineProperty(Dt,"MidwayHealthService",{enumerable:true,get:function(){return mi.MidwayHealthService}});var $i=rr(19985);Object.defineProperty(Dt,"MidwayWebRouterService",{enumerable:true,get:function(){return $i.MidwayWebRouterService}});var ki=rr(42592);Object.defineProperty(Dt,"MidwayServerlessFunctionService",{enumerable:true,get:function(){return ki.MidwayServerlessFunctionService}});Object.defineProperty(Dt,"WebRouterCollector",{enumerable:true,get:function(){return ki.WebRouterCollector}});var Ni=rr(12849);Object.defineProperty(Dt,"DataSourceManager",{enumerable:true,get:function(){return Ni.DataSourceManager}});var Ri=rr(67934);Object.defineProperty(Dt,"DEFAULT_PRIORITY",{enumerable:true,get:function(){return Ri.DEFAULT_PRIORITY}});Object.defineProperty(Dt,"MidwayPriorityManager",{enumerable:true,get:function(){return Ri.MidwayPriorityManager}});pr(rr(28602),Dt);pr(rr(82535),Dt);pr(rr(64842),Dt);pr(rr(46673),Dt);pr(rr(1845),Dt);pr(rr(11026),Dt);pr(rr(12738),Dt);pr(rr(39408),Dt);pr(rr(43436),Dt);pr(rr(29222),Dt);pr(rr(86314),Dt);var Vi=rr(75351);Object.defineProperty(Dt,"ASYNC_ROOT_CONTEXT",{enumerable:true,get:function(){return Vi.ASYNC_ROOT_CONTEXT}});pr(rr(49757),Dt);pr(rr(45317),Dt);pr(rr(75105),Dt);var ji=rr(65308);Object.defineProperty(Dt,"safelyGet",{enumerable:true,get:function(){return ji.safelyGet}});Object.defineProperty(Dt,"safeRequire",{enumerable:true,get:function(){return ji.safeRequire}});Object.defineProperty(Dt,"loadModule",{enumerable:true,get:function(){return ji.loadModule}});Object.defineProperty(Dt,"delegateTargetPrototypeMethod",{enumerable:true,get:function(){return ji.delegateTargetPrototypeMethod}});Object.defineProperty(Dt,"delegateTargetMethod",{enumerable:true,get:function(){return ji.delegateTargetMethod}});Object.defineProperty(Dt,"delegateTargetProperties",{enumerable:true,get:function(){return ji.delegateTargetProperties}});Object.defineProperty(Dt,"delegateTargetAllPrototypeMethod",{enumerable:true,get:function(){return ji.delegateTargetAllPrototypeMethod}});Object.defineProperty(Dt,"deprecatedOutput",{enumerable:true,get:function(){return ji.deprecatedOutput}});Object.defineProperty(Dt,"transformRequestObjectByType",{enumerable:true,get:function(){return ji.transformRequestObjectByType}});Object.defineProperty(Dt,"pathMatching",{enumerable:true,get:function(){return ji.pathMatching}});Object.defineProperty(Dt,"wrapMiddleware",{enumerable:true,get:function(){return ji.wrapMiddleware}});Object.defineProperty(Dt,"wrapAsync",{enumerable:true,get:function(){return ji.wrapAsync}});Object.defineProperty(Dt,"isTypeScriptEnvironment",{enumerable:true,get:function(){return ji.isTypeScriptEnvironment}});Object.defineProperty(Dt,"sleep",{enumerable:true,get:function(){return ji.sleep}});Object.defineProperty(Dt,"Utils",{enumerable:true,get:function(){return ji.Utils}});var Ui=rr(83486);Object.defineProperty(Dt,"extend",{enumerable:true,get:function(){return Ui.extend}});pr(rr(46422),Dt);pr(rr(50539),Dt);pr(rr(73861),Dt);pr(rr(87653),Dt);var zi=rr(25198);Object.defineProperty(Dt,"retryWithAsync",{enumerable:true,get:function(){return zi.retryWithAsync}});Object.defineProperty(Dt,"retryWith",{enumerable:true,get:function(){return zi.retryWith}});var Ki=rr(63289);Object.defineProperty(Dt,"Types",{enumerable:true,get:function(){return Ki.Types}});var Xi=rr(61327);Object.defineProperty(Dt,"PathFileUtil",{enumerable:true,get:function(){return Xi.PathFileUtil}});var Yi=rr(7589);Object.defineProperty(Dt,"FileUtils",{enumerable:true,get:function(){return Yi.FileUtils}});var xa=rr(30001);Object.defineProperty(Dt,"FORMAT",{enumerable:true,get:function(){return xa.FORMAT}});var Ta=rr(89995);Object.defineProperty(Dt,"ServerResponse",{enumerable:true,get:function(){return Ta.ServerResponse}});Object.defineProperty(Dt,"HttpServerResponse",{enumerable:true,get:function(){return Ta.HttpServerResponse}});var wa=rr(11330);Object.defineProperty(Dt,"TypedResourceManager",{enumerable:true,get:function(){return wa.TypedResourceManager}});var Ia=rr(70032);Object.defineProperty(Dt,"MidwayPerformanceManager",{enumerable:true,get:function(){return Ia.MidwayPerformanceManager}})},6192:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayProcessTypeEnum=Dt.ObjectLifeCycleEvent=Dt.ServerlessTriggerType=Dt.MidwayFrameworkType=Dt.FrameworkType=Dt.MSListenerType=Dt.MSProviderType=Dt.InjectModeEnum=Dt.ScopeEnum=void 0;var rr;(function(St){St["Singleton"]="Singleton";St["Request"]="Request";St["Prototype"]="Prototype"})(rr=Dt.ScopeEnum||(Dt.ScopeEnum={}));var cr;(function(St){St["Identifier"]="Identifier";St["Class"]="Class";St["PropertyName"]="PropertyName"})(cr=Dt.InjectModeEnum||(Dt.InjectModeEnum={}));var pr;(function(St){St["DUBBO"]="dubbo";St["GRPC"]="gRPC"})(pr=Dt.MSProviderType||(Dt.MSProviderType={}));var mr;(function(St){St["RABBITMQ"]="rabbitmq";St["MQTT"]="mqtt";St["KAFKA"]="kafka";St["REDIS"]="redis"})(mr=Dt.MSListenerType||(Dt.MSListenerType={}));class FrameworkType{}Dt.FrameworkType=FrameworkType;class MidwayFrameworkType extends FrameworkType{constructor(St){super();this.name=St}}Dt.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 gr;(function(St){St["EVENT"]="event";St["HTTP"]="http";St["API_GATEWAY"]="apigw";St["OS"]="os";St["CDN"]="cdn";St["LOG"]="log";St["TIMER"]="timer";St["MQ"]="mq";St["KAFKA"]="kafka";St["HSF"]="hsf";St["MTOP"]="mtop";St["SSR"]="ssr"})(gr=Dt.ServerlessTriggerType||(Dt.ServerlessTriggerType={}));var yr;(function(St){St["BEFORE_BIND"]="beforeBind";St["BEFORE_CREATED"]="beforeObjectCreated";St["AFTER_CREATED"]="afterObjectCreated";St["AFTER_INIT"]="afterObjectInit";St["BEFORE_DESTROY"]="beforeObjectDestroy"})(yr=Dt.ObjectLifeCycleEvent||(Dt.ObjectLifeCycleEvent={}));var Sr;(function(St){St["APPLICATION"]="APPLICATION";St["AGENT"]="AGENT"})(Sr=Dt.MidwayProcessTypeEnum||(Dt.MidwayProcessTypeEnum={}))},72838:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ServerResponse=void 0;class ServerResponse{constructor(St){this.isSuccess=true;this.ctx=St}json(St){return Object.getPrototypeOf(this).constructor.JSON_TPL(St,this.isSuccess,this.ctx)}text(St){return Object.getPrototypeOf(this).constructor.TEXT_TPL(St,this.isSuccess,this.ctx)}blob(St){return Object.getPrototypeOf(this).constructor.BLOB_TPL(St,this.isSuccess,this.ctx)}success(){this.isSuccess=true;return this}fail(){this.isSuccess=false;return this}}Dt.ServerResponse=ServerResponse;ServerResponse.TEXT_TPL=(St,Dt,rr)=>St;ServerResponse.JSON_TPL=(St,Dt,rr)=>{if(Dt){return{success:"true",data:St}}else{return{success:"false",message:St||"fail"}}};ServerResponse.BLOB_TPL=(St,Dt,rr)=>St},91959:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.HttpServerResponse=void 0;const cr=rr(79896);const pr=rr(72838);const mr=rr(82738);const gr=rr(37407);const yr=rr(16928);class HttpServerResponse extends pr.ServerResponse{constructor(St){super(St)}status(St){this.ctx.res.statusCode=St;return this}header(St,Dt){this.ctx.res.setHeader(St,Dt);return this}headers(St){if(this.ctx.res.setHeaders){this.ctx.res.setHeaders(new Map(Object.entries(St)))}else{for(const Dt in St){this.header(Dt,St[Dt])}}return this}json(St){this.header("Content-Type","application/json");return Object.getPrototypeOf(this).constructor.JSON_TPL(St,this.isSuccess,this.ctx)}text(St){this.header("Content-Type","text/plain");return Object.getPrototypeOf(this).constructor.TEXT_TPL(St,this.isSuccess,this.ctx)}file(St,Dt){this.header("Content-Type",Dt||"application/octet-stream");this.header("Content-Disposition",`attachment; filename=${(0,yr.basename)(St)}`);return Object.getPrototypeOf(this).constructor.FILE_TPL(typeof St==="string"?(0,cr.createReadStream)(St):St,this.isSuccess,this.ctx)}blob(St,Dt){this.header("Content-Type",Dt||"application/octet-stream");return Object.getPrototypeOf(this).constructor.BLOB_TPL(St,this.isSuccess,this.ctx)}html(St){this.header("Content-Type","text/html");return Object.getPrototypeOf(this).constructor.HTML_TPL(St,this.isSuccess,this.ctx)}redirect(St,Dt=302){this.status(Dt);if(this.ctx.redirect){return this.ctx.redirect(St)}else if(this.ctx.res.redirect){return this.ctx.res.redirect(St)}else{this.header("Location",St)}}sse(St={}){return new mr.ServerSendEventStream(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.SSE_TPL,...St})}stream(St={}){return new gr.HttpStreamResponse(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.STREAM_TPL,...St})}}Dt.HttpServerResponse=HttpServerResponse;HttpServerResponse.FILE_TPL=(St,Dt,rr)=>St;HttpServerResponse.SSE_TPL=(St,Dt)=>St;HttpServerResponse.STREAM_TPL=(St,Dt)=>St;HttpServerResponse.HTML_TPL=(St,Dt,rr)=>St},89995:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.HttpServerResponse=Dt.ServerResponse=void 0;var cr=rr(72838);Object.defineProperty(Dt,"ServerResponse",{enumerable:true,get:function(){return cr.ServerResponse}});var pr=rr(91959);Object.defineProperty(Dt,"HttpServerResponse",{enumerable:true,get:function(){return pr.HttpServerResponse}})},82738:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ServerSendEventStream=void 0;const cr=rr(2203);class ServerSendEventStream extends cr.Transform{constructor(St,Dt={}){super({objectMode:true,...Dt});this.isActive=false;this.ctx=St;this.closeEvent=Dt.closeEvent||"close";this.options=Dt;this.ctx.req.on("close",this.handleClose.bind(this))}_transform(St,Dt,rr){try{let Dt,cr="data: ";const pr=/^\s*:\s*/;const mr=[];if(!this.isActive){this.isActive=true;const St={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(const Dt in St){this.ctx.res.setHeader(Dt,St[Dt])}this.ctx.req.socket.setTimeout(0);this.ctx.req.socket.setNoDelay(true);this.ctx.req.socket.setKeepAlive(true);mr.push(": ok")}const gr=St;if(gr.event)mr.push("event: "+gr.event);if(gr.retry)mr.push("retry: "+gr.retry);if(gr.id)mr.push("id: "+gr.id);if(typeof gr.data==="object"){Dt=JSON.stringify(gr.data);mr.push(cr+Dt)}else if(typeof gr.data==="undefined"){mr.push(cr)}else{gr.data=String(gr.data);if(gr.data.search(pr)!==-1){gr.data=gr.data.replace(pr,"");cr=": "}gr.data=gr.data.replace(/(\r\n|\r|\n)/g,"\n");Dt=gr.data.split(/\n/);for(let St=0,rr=Dt.length;St<rr;++St){const pr=Dt[St];if(St+1===rr){mr.push(cr+pr)}else{mr.push(cr+pr)}}}this.push(mr.join("\n")+"\n\n");rr()}catch(St){this.ctx.logger.error(St);this.sendError(St);this.end();rr(St)}}sendError(St){this.send({event:"error",data:St.message||"An error occurred"})}sendEnd(St){St.event=this.closeEvent;this.send(St)}send(St){super.write(this.options.tpl(St,this.ctx))}handleClose(){this.end()}}Dt.ServerSendEventStream=ServerSendEventStream},37407:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.HttpStreamResponse=void 0;const cr=rr(2203);class HttpStreamResponse extends cr.Transform{constructor(St,Dt={}){super({objectMode:true,...Dt});this.isActive=false;this.ctx=St;this.options=Dt}_transform(St,Dt,rr){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 St==="string"){this.ctx.res.write(St)}else{this.ctx.res.write(JSON.stringify(St))}rr()}catch(St){this.ctx.logger.error(St);this.end();this.ctx.res.end();rr(St)}}send(St){if(!this.writable){return}this.write(this.options.tpl(St,this.ctx))}sendError(St){this.ctx.logger.error(St);this.end();this.ctx.res.end()}_flush(St){this.ctx.res.end();St()}}Dt.HttpStreamResponse=HttpStreamResponse},70812:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayAspectService=void 0;const mr=rr(65675);const gr=rr(6192);const yr=rr(49757);const Sr=rr(63289);let $r=class MidwayAspectService{constructor(St){this.applicationContext=St}async loadAspect(){const St=(0,yr.listModule)(yr.ASPECT_KEY);let Dt=[];for(const rr of St){const St=(0,yr.getClassMetadata)(yr.ASPECT_KEY,rr);Dt=Dt.concat(St.map((St=>{St.aspectModule=rr;return St})))}Dt.sort(((St,Dt)=>(Dt.priority||0)-(St.priority||0)));for(const St of Dt){const Dt=await this.applicationContext.getAsync(St.aspectModule);await this.addAspect(Dt,St)}}async addAspect(St,Dt){const rr=Dt.aspectTarget;const cr=Object.getOwnPropertyNames(rr.prototype);const pr=Dt.match?mr(Dt.match):()=>true;for(const Dt of cr){if(Dt==="constructor"||!pr(Dt)){continue}const cr=Object.getOwnPropertyDescriptor(rr.prototype,Dt);if(!cr||cr.writable===false){continue}this.interceptPrototypeMethod(rr,Dt,St)}}interceptPrototypeMethod(St,Dt,rr){const cr=St.prototype[Dt];if(Sr.Types.isAsyncFunction(St.prototype[Dt])){St.prototype[Dt]=async function(...St){var pr,mr,gr;let yr,Sr;const newProceed=(...St)=>cr.apply(this,St);const $r={methodName:Dt,target:this,args:St,proceed:newProceed,proceedIsAsyncFunction:true};if(typeof rr==="function"){rr=rr()}try{await((pr=rr.before)===null||pr===void 0?void 0:pr.call(rr,$r));if(rr.around){Sr=await rr.around($r)}else{Sr=await cr.call(this,...$r.args)}$r.proceed=undefined;const St=await((mr=rr.afterReturn)===null||mr===void 0?void 0:mr.call(rr,$r,Sr));Sr=typeof St==="undefined"?Sr:St;return Sr}catch(St){$r.proceed=undefined;yr=St;if(rr.afterThrow){await rr.afterThrow($r,yr)}else{throw St}}finally{await((gr=rr.after)===null||gr===void 0?void 0:gr.call(rr,$r,Sr,yr))}}}else{St.prototype[Dt]=function(...St){var pr,mr,gr;let yr,Sr;const newProceed=(...St)=>cr.apply(this,St);const $r={methodName:Dt,target:this,args:St,proceed:newProceed,proceedIsAsyncFunction:false};if(typeof rr==="function"){rr=rr()}try{(pr=rr.before)===null||pr===void 0?void 0:pr.call(rr,$r);if(rr.around){Sr=rr.around($r)}else{Sr=cr.call(this,...$r.args)}$r.proceed=undefined;const St=(mr=rr.afterReturn)===null||mr===void 0?void 0:mr.call(rr,$r,Sr);Sr=typeof St==="undefined"?Sr:St;return Sr}catch(St){$r.proceed=undefined;yr=St;if(rr.afterThrow){rr.afterThrow($r,yr)}else{throw St}}finally{(gr=rr.after)===null||gr===void 0?void 0:gr.call(rr,$r,Sr,yr)}}}}};$r=cr([(0,yr.Provide)(),(0,yr.Scope)(gr.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],$r);Dt.MidwayAspectService=$r},78842:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayConfigService=void 0;const mr=rr(16928);const gr=rr(6192);const yr=rr(65308);const Sr=rr(79896);const $r=rr(39023);const Er=rr(70275);const Ir=rr(37482);const Or=rr(83486);const Hr=rr(86314);const Gr=rr(49757);const Tn=rr(63289);const Wn=$r.debuglog("midway:debug");let Gn=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(St){for(const Dt of St){if(typeof Dt==="string"){if(/\.\w+$/.test(Dt)){const St=this.getConfigEnv(Dt);const rr=this.getEnvSet(St);rr.add(Dt);if(this.aliasMap[St]){this.getEnvSet(this.aliasMap[St]).add(Dt)}}else{const St=(0,Sr.statSync)(Dt);if(St.isDirectory()){const St=(0,Sr.readdirSync)(Dt);this.add(St.map((St=>(0,mr.join)(Dt,St))))}}}else{for(const St in Dt){this.getEnvSet(St).add(Dt[St]);if(this.aliasMap[St]){this.getEnvSet(this.aliasMap[St]).add(Dt[St])}}}}}addObject(St,Dt=false){if(this.isReady){St=this.runWithFilter(St);if(!St){Wn("[config]: Filter config and got undefined will be drop it");return}this.configMergeOrder.push({env:"default",extraPath:"",value:St});if(Dt){this.configuration=(0,Or.extend)(true,St,this.configuration)}else{(0,Or.extend)(true,this.configuration,St)}}else{this.externalObject.push(St)}}getEnvSet(St){if(!this.envDirMap.has(St)){this.envDirMap.set(St,new Set)}return this.envDirMap.get(St)}getConfigEnv(St){const Dt=(0,mr.basename)(St);const rr=Dt.split(".");const cr=rr.pop();if(cr!=="js"&&cr!=="ts"){return cr}return rr.pop()}load(){if(this.isReady)return;const St=this.getEnvSet("default");const Dt=this.getEnvSet(this.environmentService.getCurrentEnvironment());const rr={};const cr=St.size;for(const[pr,mr]of[...St,...Dt].entries()){let St=this.loadConfig(mr);if(Tn.Types.isFunction(St)){St=St.apply(null,[this.appInfo,rr])}if(!St){continue}St=this.runWithFilter(St);if(!St){Wn("[config]: Filter config and got undefined will be drop it");continue}if(typeof mr==="string"){Wn("[config]: Loaded config %s, %j",mr,St)}else{Wn("[config]: Loaded config %j",St)}this.configMergeOrder.push({env:pr<cr?"default":this.environmentService.getCurrentEnvironment(),extraPath:mr,value:St});(0,Or.extend)(true,rr,St)}if(this.externalObject.length){for(let St of this.externalObject){if(St){St=this.runWithFilter(St);if(!St){Wn("[config]: Filter config and got undefined will be drop it");continue}Wn("[config]: Loaded external object %j",St);(0,Or.extend)(true,rr,St);this.configMergeOrder.push({env:"default",extraPath:"",value:St})}}}this.configuration=rr;this.isReady=true}getConfiguration(St){if(St){return(0,yr.safelyGet)(St,this.configuration)}return this.configuration}getConfigMergeOrder(){return this.configMergeOrder}loadConfig(St){let Dt=typeof St==="string"?require(St):St;if(Dt&&Dt.__esModule){if(Dt&&Dt.default){if(Object.keys(Dt).length>1){throw new Hr.MidwayInvalidConfigError(`${St} should not have both a default export and named export`)}Dt=Dt.default}}return Dt}clearAllConfig(){this.configuration={}}clearConfigMergeOrder(){this.configMergeOrder.length=0}addFilter(St){this.configFilterList.push(St)}runWithFilter(St){for(const Dt of this.configFilterList){Wn(`[config]: Filter config by filter = "${Dt.name||"anonymous filter"}"`);St=Dt(St);Wn("[config]: Filter config result = %j",St)}return St}getAppInfo(){return this.appInfo}};cr([(0,Gr.Inject)(),pr("design:type",Er.MidwayEnvironmentService)],Gn.prototype,"environmentService",void 0);cr([(0,Gr.Inject)(),pr("design:type",Ir.MidwayInformationService)],Gn.prototype,"informationService",void 0);cr([(0,Gr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",void 0)],Gn.prototype,"init",null);Gn=cr([(0,Gr.Provide)(),(0,Gr.Scope)(gr.ScopeEnum.Singleton)],Gn);Dt.MidwayConfigService=Gn},96367:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayDecoratorService=void 0;const mr=rr(49757);const gr=rr(6192);const yr=rr(70812);const Sr=rr(86314);const $r=rr(39023);const Er=rr(63289);const Ir=$r.debuglog("midway:debug");let Or=class MidwayDecoratorService{constructor(St){this.applicationContext=St;this.propertyHandlerMap=new Map;this.methodDecoratorMap=new Map;this.parameterDecoratorMap=new Map;this.parameterDecoratorPipes=new Map}init(){this.applicationContext.onBeforeBind((St=>{const Dt=(0,mr.getClassMetadata)(mr.INJECT_CUSTOM_METHOD,St);if(Dt){for(const rr of Dt){const{propertyName:Dt,key:cr,metadata:pr,options:mr}=rr;if(!mr||!mr.impl){continue}this.aspectService.interceptPrototypeMethod(St,Dt,(()=>{const rr=this.methodDecoratorMap.get(cr);if(!rr){throw new Sr.MidwayCommonError(`Method Decorator "${cr}" handler not found, please register first.`)}return rr({target:St,propertyName:Dt,metadata:pr})}))}}const rr=(0,mr.getClassMetadata)(mr.INJECT_CUSTOM_PARAM,St);if(rr){for(const Dt of Object.keys(rr)){this.aspectService.interceptPrototypeMethod(St,Dt,(()=>({before:async cr=>{const pr=[...cr.args];for(const gr of rr[Dt]){const{propertyName:Dt,key:rr,metadata:yr,parameterIndex:$r,options:Or}=gr;let Hr;if(Or&&Or.impl){Hr=this.parameterDecoratorMap.get(rr);if(!Hr){throw new Sr.MidwayCommonError(`Parameter Decorator "${rr}" handler not found, please register first.`)}}else{Hr=async({parameterIndex:St,originArgs:Dt})=>Dt[St]}const Gr=(0,mr.getMethodParamTypes)(St,Dt);let Tn=false;try{pr[$r]=await Hr({metadata:yr,propertyName:Dt,parameterIndex:$r,target:St,originArgs:pr,originParamType:Gr[$r],instance:cr.target})}catch(St){Tn=true;if((Or===null||Or===void 0?void 0:Or.throwError)===true){throw St}else{Ir(`[core]: Parameter decorator throw error and use origin args, ${St.stack}`)}}if(Tn){continue}const Wn=[...this.parameterDecoratorPipes.get(rr)||[],...(Or===null||Or===void 0?void 0:Or.pipes)||[]];for(const St of Wn){let Dt;if("transform"in St){Dt=St["transform"].bind(St)}else if((0,Er.isClass)(St)){const rr=await this.applicationContext.getAsync(St);Dt=rr.transform.bind(rr)}else if(typeof St==="function"){Dt=St}else{throw new Sr.MidwayParameterError("Pipe must be a function or implement PipeTransform interface")}pr[$r]=await Dt(pr[$r],{metaType:(0,mr.transformTypeFromTSDesign)(Gr[$r]),metadata:yr,target:cr.target,methodName:cr.methodName})}}cr.args=pr}})))}}}));this.applicationContext.onObjectCreated(((St,Dt)=>{if(this.propertyHandlerMap.size>0&&Array.isArray(Dt.definition.handlerProps)){for(const rr of Dt.definition.handlerProps){this.defineGetterPropertyValue(rr,St,this.getHandler(rr.key))}}}));this.registerPropertyHandler(mr.APPLICATION_CONTEXT_KEY,((St,Dt)=>this.applicationContext))}registerPropertyHandler(St,Dt){Ir(`[core]: Register property decorator key="${St}"`);this.propertyHandlerMap.set(St,Dt)}registerMethodHandler(St,Dt){Ir(`[core]: Register method decorator key="${St}"`);this.methodDecoratorMap.set(St,Dt)}registerParameterHandler(St,Dt){Ir(`[core]: Register parameter decorator key="${St}"`);this.parameterDecoratorMap.set(St,Dt)}registerParameterPipes(St,Dt){if(!this.parameterDecoratorPipes.has(St)){this.parameterDecoratorPipes.set(St,[])}this.parameterDecoratorPipes.set(St,this.parameterDecoratorPipes.get(St).concat(Dt))}defineGetterPropertyValue(St,Dt,rr){if(St&&rr){if(St.propertyName){Object.defineProperty(Dt,St.propertyName,{get:()=>{var cr;return rr(St.propertyName,(cr=St.metadata)!==null&&cr!==void 0?cr:{},Dt)},configurable:true,enumerable:true})}}}getHandler(St){if(this.propertyHandlerMap.has(St)){return this.propertyHandlerMap.get(St)}}};cr([(0,mr.Inject)(),pr("design:type",yr.MidwayAspectService)],Or.prototype,"aspectService",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",void 0)],Or.prototype,"init",null);Or=cr([(0,mr.Provide)(),(0,mr.Scope)(gr.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],Or);Dt.MidwayDecoratorService=Or},70275:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayEnvironmentService=void 0;const pr=rr(6192);const mr=rr(65308);const gr=rr(49757);let yr=class MidwayEnvironmentService{constructor(){this.moduleLoadType="commonjs"}getCurrentEnvironment(){if(!this.environment){this.environment=(0,mr.getCurrentEnvironment)()}return this.environment}setCurrentEnvironment(St){this.environment=St}isDevelopmentEnvironment(){return(0,mr.isDevelopmentEnvironment)(this.environment)}setModuleLoadType(St){this.moduleLoadType=St}getModuleLoadType(){return this.moduleLoadType}isPkgEnvironment(){return typeof process["pkg"]!=="undefined"}};yr=cr([(0,gr.Provide)(),(0,gr.Scope)(pr.ScopeEnum.Singleton)],yr);Dt.MidwayEnvironmentService=yr},33332:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayFrameworkService=void 0;const mr=rr(49757);const gr=rr(6192);const yr=rr(78842);const Sr=rr(34888);const $r=rr(83872);const Er=rr(28602);const Ir=rr(96367);const Or=rr(70812);const Hr=rr(43436);const Gr=rr(39023);const Tn=rr(86314);const Wn=rr(2222);const Gn=rr(70032);const mi=Gr.debuglog("midway:debug");let $i=class MidwayFrameworkService{constructor(St,Dt){this.applicationContext=St;this.globalOptions=Dt;this.globalFrameworkList=[]}async init(){var St,Dt;this.decoratorService.registerPropertyHandler(mr.CONFIG_KEY,((St,Dt)=>{var rr;if(Dt.identifier===mr.ALL){return this.configService.getConfiguration()}else{return this.configService.getConfiguration((rr=Dt.identifier)!==null&&rr!==void 0?rr:St)}}));this.decoratorService.registerPropertyHandler(mr.LOGGER_KEY,((St,Dt)=>{var rr;return this.loggerService.getLogger((rr=Dt.identifier)!==null&&rr!==void 0?rr:St)}));this.decoratorService.registerPropertyHandler(mr.PIPELINE_IDENTIFIER,((St,Dt,rr)=>{var cr,pr;return new Er.MidwayPipelineService((pr=(cr=rr[Wn.REQUEST_OBJ_CTX_KEY])===null||cr===void 0?void 0:cr.requestContext)!==null&&pr!==void 0?pr:this.applicationContext,Dt.valves)}));this.decoratorService.registerPropertyHandler(mr.APPLICATION_KEY,((St,Dt)=>{if(Dt.type){const St=this.applicationManager.getApplication(Dt.type);if(!St){throw new Tn.MidwayCommonError(`Framework ${Dt.type} not Found`)}return St}else{return this.getMainApp()}}));this.decoratorService.registerPropertyHandler(mr.PLUGIN_KEY,((St,Dt)=>{var rr;return this.getMainApp()[(rr=Dt.identifier)!==null&&rr!==void 0?rr:St]}));this.decoratorService.registerPropertyHandler(mr.FACTORY_SERVICE_CLIENT_KEY,((St,Dt)=>{const rr=this.applicationContext.get(Dt.serviceFactoryClz);const cr=Dt.clientName||rr.getDefaultClientName();if(cr&&rr.has(cr)){return rr.get(cr)}else{if(!cr){throw new Tn.MidwayParameterError(`Please set clientName or options.defaultClientName for ${Dt.serviceFactoryClz.name}).`)}else{throw new Tn.MidwayParameterError(`ClientName(${cr} not found in ${Dt.serviceFactoryClz.name}).`)}}}));let rr=(0,mr.listModule)(mr.FRAMEWORK_KEY);rr=filterProtoFramework(rr);mi(`[core]: Found Framework length = ${rr.length}`);if(rr.length){for(const Dt of rr){if(!this.applicationContext.hasDefinition((0,mr.getProviderUUId)(Dt))){mi(`[core]: Found Framework "${Dt.name}" but missing definition, skip initialize.`);continue}const rr=await this.applicationContext.getAsync(Dt,[this.applicationContext]);if(rr.isEnable()){Gn.MidwayInitializerPerformanceManager.frameworkInitializeStart(rr.getFrameworkName());await rr.initialize({applicationContext:this.applicationContext,namespace:rr.getNamespace(),...this.globalOptions});Gn.MidwayInitializerPerformanceManager.frameworkInitializeEnd(rr.getFrameworkName());mi(`[core]: Found Framework "${rr.getFrameworkName()}" and initialize.`)}else{mi(`[core]: Found Framework "${rr.getFrameworkName()}" and delay initialize.`)}const cr=this.applicationContext.registry.getDefinition((0,mr.getProviderUUId)(Dt));rr.setNamespace(cr===null||cr===void 0?void 0:cr.namespace);this.applicationManager.addFramework((St=cr===null||cr===void 0?void 0:cr.namespace)!==null&&St!==void 0?St:rr.getFrameworkName(),rr);this.globalFrameworkList.push(rr)}let cr;const pr=this.applicationContext.getNamespaceList();for(const St of pr){const Dt=this.applicationManager.getApplication(St);if(Dt){cr=St;break}}global["MIDWAY_MAIN_FRAMEWORK"]=this.mainFramework=(Dt=this.applicationManager.getFramework(cr))!==null&&Dt!==void 0?Dt:this.globalFrameworkList[0];mi(`[core]: Current main Framework is "${cr}".`)}await this.aspectService.loadAspect()}getMainApp(){var St;return(St=this.mainFramework)===null||St===void 0?void 0:St.getApplication()}getMainFramework(){return this.mainFramework}getFramework(St){return this.applicationManager.getFramework(St)}async runFramework(){const St=this.applicationContext.getNamespaceList();this.globalFrameworkList=this.globalFrameworkList.sort(((Dt,rr)=>St.indexOf(Dt.getNamespace())-St.indexOf(rr.getNamespace())));for(const St of this.globalFrameworkList){if(St.isEnable()){Gn.MidwayInitializerPerformanceManager.frameworkRunStart(St.getFrameworkName());await St.run();mi(`[core]: Found Framework "${St.getFrameworkName()}" and run.`);Gn.MidwayInitializerPerformanceManager.frameworkRunEnd(St.getFrameworkName())}}}async stopFramework(){await Promise.all(Array.from(this.globalFrameworkList).map((St=>St.stop())))}};cr([(0,mr.Inject)(),pr("design:type",yr.MidwayConfigService)],$i.prototype,"configService",void 0);cr([(0,mr.Inject)(),pr("design:type",Sr.MidwayLoggerService)],$i.prototype,"loggerService",void 0);cr([(0,mr.Inject)(),pr("design:type",Or.MidwayAspectService)],$i.prototype,"aspectService",void 0);cr([(0,mr.Inject)(),pr("design:type",Ir.MidwayDecoratorService)],$i.prototype,"decoratorService",void 0);cr([(0,mr.Inject)(),pr("design:type",Hr.MidwayApplicationManager)],$i.prototype,"applicationManager",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],$i.prototype,"init",null);$i=cr([(0,mr.Provide)(),(0,mr.Scope)(gr.ScopeEnum.Singleton),pr("design:paramtypes",[Object,Object])],$i);Dt.MidwayFrameworkService=$i;function filterProtoFramework(St){const Dt=[];for(const rr of St){let St=Object.getPrototypeOf(rr);while(St.name&&St.name!==$r.BaseFramework.name){Dt.push(St);St=Object.getPrototypeOf(St)}}return St.filter((St=>!Dt.includes(St)))}},658:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayHealthService=void 0;const mr=rr(49757);const gr=rr(6192);const yr=rr(78842);const Sr=rr(65308);let $r=class MidwayHealthService{constructor(){this.healthCheckTimeout=1e3;this.healthCheckMethods=[]}async init(St){const Dt=this.configService.getConfiguration("core.healthCheckTimeout")||1e3;this.setCheckTimeout(Dt);for(const Dt of St){if(Dt.instance&&Dt.instance["onHealthCheck"]){this.healthCheckMethods.push({item:Dt.instance["onHealthCheck"].bind(Dt.instance),meta:{namespace:Dt.namespace}})}}}async getStatus(){const St=await(0,Sr.createPromiseTimeoutInvokeChain)({promiseItems:this.healthCheckMethods.map((St=>({item:St.item(this.applicationContext),meta:St.meta}))),timeout:this.healthCheckTimeout,methodName:"configuration.onHealthCheck",onSuccess:(St,Dt)=>{if(St["status"]!==undefined){return{namespace:Dt.namespace,...St}}else{return{status:false,namespace:Dt.namespace,reason:"configuration.onHealthCheck return value must be object and contain status field"}}},onFail:(St,Dt)=>({status:false,namespace:Dt.namespace,reason:St.message})});const Dt=St.find((St=>!St.status));return{status:!Dt,namespace:Dt===null||Dt===void 0?void 0:Dt.namespace,reason:Dt===null||Dt===void 0?void 0:Dt.reason,results:St}}setCheckTimeout(St){this.healthCheckTimeout=St}};cr([(0,mr.Inject)(),pr("design:type",yr.MidwayConfigService)],$r.prototype,"configService",void 0);cr([(0,mr.ApplicationContext)(),pr("design:type",Object)],$r.prototype,"applicationContext",void 0);$r=cr([(0,mr.Provide)(),(0,mr.Scope)(gr.ScopeEnum.Singleton)],$r);Dt.MidwayHealthService=$r},37482:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayInformationService=void 0;const mr=rr(6192);const gr=rr(65308);const yr=rr(16928);const Sr=rr(49757);const $r=rr(79896);let Er=class MidwayInformationService{init(){if(this.baseDir){if(!this.appDir){this.appDir=(0,yr.dirname)(this.baseDir)}const St=(0,yr.join)(this.appDir,"package.json");if((0,$r.existsSync)(St)){const Dt=(0,$r.readFileSync)(St,{encoding:"utf-8"});this.pkg=JSON.parse(Dt)}else{this.pkg={}}}else{this.pkg={}}}getAppDir(){return this.appDir}getBaseDir(){return this.baseDir}getHome(){return(0,gr.getUserHome)()}getPkg(){return this.pkg}getProjectName(){var St;return((St=this.pkg)===null||St===void 0?void 0:St["name"])||""}getRoot(){const St=(0,gr.isDevelopmentEnvironment)((0,gr.getCurrentEnvironment)());return St?this.getAppDir():this.getHome()}};cr([(0,Sr.Inject)(),pr("design:type",String)],Er.prototype,"appDir",void 0);cr([(0,Sr.Inject)(),pr("design:type",String)],Er.prototype,"baseDir",void 0);cr([(0,Sr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",void 0)],Er.prototype,"init",null);Er=cr([(0,Sr.Provide)(),(0,Sr.Scope)(mr.ScopeEnum.Singleton)],Er);Dt.MidwayInformationService=Er},13328:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayLifeCycleService=void 0;const mr=rr(6192);const gr=rr(49757);const yr=rr(24451);const Sr=rr(33332);const $r=rr(78842);const Er=rr(39023);const Ir=rr(77306);const Or=rr(658);const Hr=rr(70032);const Gr=(0,Er.debuglog)("midway:debug");let Tn=class MidwayLifeCycleService{constructor(St){this.applicationContext=St;this.lifecycleInstanceList=[]}async init(){await this.mockService.initSimulation();const St=(0,gr.listModule)(gr.CONFIGURATION_KEY);Gr(`[core]: Found Configuration length = ${St.length}`);for(const Dt of St){if(Dt.target instanceof yr.FunctionalConfiguration){Dt.instance=Dt.target}else{Gr(`[core]: Lifecycle run ${Dt.namespace} init`);Dt.instance=await this.applicationContext.getAsync(Dt.target)}Dt.instance&&this.lifecycleInstanceList.push(Dt)}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",(St=>{if(St){this.configService.addObject(St)}}));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 St=(0,gr.listModule)(gr.CONFIGURATION_KEY)||[];for(const Dt of St.reverse()){let St;if(Dt.target instanceof yr.FunctionalConfiguration){St=Dt.target}else{St=await this.applicationContext.getAsync(Dt.target)}await this.runContainerLifeCycle(St,"onStop")}await this.frameworkService.stopFramework()}async runContainerLifeCycle(St,Dt,rr){if(Array.isArray(St)){for(const cr of St){if(typeof cr.instance[Dt]==="function"){Gr(`[core]: Lifecycle run ${cr.instance.constructor.name} ${Dt}`);Hr.MidwayInitializerPerformanceManager.lifecycleStart(cr.namespace,Dt);const St=await cr.instance[Dt](this.applicationContext,this.frameworkService.getMainApp());if(rr){rr(St)}Hr.MidwayInitializerPerformanceManager.lifecycleEnd(cr.namespace,Dt)}}}else{if(typeof St[Dt]==="function"){const cr=St.constructor.name;Gr(`[core]: Lifecycle run ${cr} ${Dt}`);Hr.MidwayInitializerPerformanceManager.lifecycleStart(cr,Dt);const pr=await St[Dt](this.applicationContext,this.frameworkService.getMainApp());if(rr){rr(pr)}Hr.MidwayInitializerPerformanceManager.lifecycleEnd(cr,Dt)}}}async runObjectLifeCycle(St,Dt){for(const rr of St){if(typeof rr.instance[Dt]==="function"){Gr(`[core]: Lifecycle run ${rr.instance.constructor.name} ${Dt}`);return await this.applicationContext[Dt](rr.instance[Dt].bind(rr.instance))}}}getLifecycleInstanceList(){return this.lifecycleInstanceList}};cr([(0,gr.Inject)(),pr("design:type",Sr.MidwayFrameworkService)],Tn.prototype,"frameworkService",void 0);cr([(0,gr.Inject)(),pr("design:type",$r.MidwayConfigService)],Tn.prototype,"configService",void 0);cr([(0,gr.Inject)(),pr("design:type",Ir.MidwayMockService)],Tn.prototype,"mockService",void 0);cr([(0,gr.Inject)(),pr("design:type",Or.MidwayHealthService)],Tn.prototype,"healthService",void 0);cr([(0,gr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Tn.prototype,"init",null);Tn=cr([(0,gr.Provide)(),(0,gr.Scope)(mr.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],Tn);Dt.MidwayLifeCycleService=Tn},34888:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayLoggerService=void 0;const mr=rr(49757);const gr=rr(78842);const yr=rr(64842);const Sr=rr(6192);const $r=rr(82535);const Er=rr(86314);let Ir=class MidwayLoggerService extends yr.ServiceFactory{constructor(St,Dt={}){super();this.applicationContext=St;this.globalOptions=Dt;this.lazyLoggerConfigMap=new Map;this.aliasLoggerMap=new Map}init(){var St;const Dt=this.configService.getConfiguration("loggerFactory");this.loggerFactory=Dt||this.globalOptions["loggerFactory"]||new $r.DefaultConsoleLoggerFactory;if(!this.loggerFactory.getDefaultMidwayLoggerConfig){throw new Er.MidwayFeatureNoLongerSupportedError("please upgrade your @midwayjs/logger to latest version")}const rr=this.loggerFactory.getDefaultMidwayLoggerConfig(this.configService.getAppInfo());this.configService.addObject(rr,true);this.initClients(this.configService.getConfiguration("midwayLogger"));(St=this.applicationContext)===null||St===void 0?void 0:St.registerObject("logger",this.getLogger("appLogger"))}createClient(St,Dt){if(St.aliasName){this.aliasLoggerMap.set(St.aliasName,Dt)}if(!St.lazyLoad){this.loggerFactory.createLogger(Dt,St)}else{delete St["lazyLoad"];this.lazyLoggerConfigMap.set(Dt,St)}}getName(){return"logger"}createLogger(St,Dt){delete Dt["aliasName"];return this.loggerFactory.createLogger(St,Dt)}getLogger(St){if(this.aliasLoggerMap.has(St)){St=this.aliasLoggerMap.get(St)}const Dt=this.loggerFactory.getLogger(St);if(Dt){return Dt}if(this.lazyLoggerConfigMap.has(St)){this.createClient(this.lazyLoggerConfigMap.get(St),St);this.lazyLoggerConfigMap.delete(St)}return this.loggerFactory.getLogger(St)}getCurrentLoggerFactory(){return this.loggerFactory}createContextLogger(St,Dt,rr){return this.loggerFactory.createContextLogger(St,Dt,rr)}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}};cr([(0,mr.Inject)(),pr("design:type",gr.MidwayConfigService)],Ir.prototype,"configService",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",void 0)],Ir.prototype,"init",null);Ir=cr([(0,mr.Provide)(),(0,mr.Scope)(Sr.ScopeEnum.Singleton),pr("design:paramtypes",[Object,Object])],Ir);Dt.MidwayLoggerService=Ir},68220:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayMiddlewareService=void 0;const mr=rr(49757);const gr=rr(6192);const yr=rr(86314);const Sr=rr(65308);const $r=rr(63289);const Er=rr(39023);const Ir=(0,Er.debuglog)("midway:debug");let Or=class MidwayMiddlewareService{constructor(St){this.applicationContext=St}async compose(St,Dt,rr){var cr;if(!Array.isArray(St)){throw new yr.MidwayParameterError("Middleware stack must be an array")}const pr=[];for(let rr of St){if($r.Types.isClass(rr)||typeof rr==="string"||(rr===null||rr===void 0?void 0:rr["middleware"])){let St=(cr=rr===null||rr===void 0?void 0:rr["middleware"])!==null&&cr!==void 0?cr:rr;const mr=rr===null||rr===void 0?void 0:rr["options"];let gr=rr===null||rr===void 0?void 0:rr["name"];if(typeof St==="string"&&!this.applicationContext.hasDefinition(St)){throw new yr.MidwayCommonError(`Middleware definition of "${St}" not found in midway container`)}const $r=await this.applicationContext.getAsync(St);if($r){gr=gr!==null&&gr!==void 0?gr:$r.constructor.name;St=await $r.resolve(Dt,mr);if(!St){continue}if(!$r.match&&!$r.ignore){if(!St.name){St._name=gr}pr.push(St)}else{const Dt=(0,Sr.pathMatching)({match:$r.match,ignore:$r.ignore,thisResolver:$r});rr=(rr,cr,pr)=>{if(!Dt(rr))return cr();return St(rr,cr,pr)};rr._name=gr;pr.push(rr)}}else{throw new yr.MidwayCommonError("Middleware must have resolve method!")}}else{pr.push(rr)}}const composeFn=(St,Dt)=>{const cr=(0,Sr.isIncludeProperty)(St,"body");let mr=-1;return dispatch(0);function dispatch(gr){if(gr<=mr)return Promise.reject(new yr.MidwayCommonError("next() called multiple times"));mr=gr;let Sr=pr[gr];if(gr===pr.length)Sr=Dt;if(!Sr)return Promise.resolve();const $r=`${rr?`${rr}.`:""}${mr} ${Sr._name||Sr.name||"anonymous"}`;const Er=Date.now();Ir(`[middleware]: in ${$r} +0`);try{if(cr){return Promise.resolve(Sr(St,dispatch.bind(null,gr+1),{index:mr})).then((Dt=>{if(Dt!==undefined&&Dt!==St["body"]){St["body"]=Dt}else if(St["body"]!==undefined){Dt=St["body"]}Ir(`[middleware]: out ${$r} +${Date.now()-Er} with body`);return Dt}))}else{return Promise.resolve(Sr(St,dispatch.bind(null,gr+1),{index:mr})).then((St=>{Ir(`[middleware]: out ${$r} +${Date.now()-Er}`);return St}))}}catch(St){Ir(`[middleware]: out ${$r} +${Date.now()-Er} with err ${St.message}`);return Promise.reject(St)}}};if(rr){composeFn._name=rr}return composeFn}};Or=cr([(0,mr.Provide)(),(0,mr.Scope)(gr.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],Or);Dt.MidwayMiddlewareService=Or},77306:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};var mr;Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayMockService=void 0;const gr=rr(6192);const yr=rr(49757);const Sr=rr(63289);let $r=mr=class MidwayMockService{constructor(St){this.applicationContext=St;this.mocks=new Map;this.contextMocks=new Map;this.cache=new Map;this.simulatorList=[]}async init(){if(mr.prepareMocks.length>0){for(const St of mr.prepareMocks){this.mockProperty(St.obj,St.key,St.value,St.group)}mr.prepareMocks=[]}}static mockClassProperty(St,Dt,rr,cr="default"){this.mockProperty(St.prototype,Dt,rr,cr)}static mockProperty(St,Dt,rr,cr="default"){this.prepareMocks.push({obj:St,key:Dt,value:rr,group:cr})}mockClassProperty(St,Dt,rr,cr="default"){return this.mockProperty(St.prototype,Dt,rr,cr)}mockProperty(St,Dt,rr,cr="default"){const pr=St.hasOwnProperty(Dt);const mr={obj:St,key:Dt,descriptor:Object.getOwnPropertyDescriptor(St,Dt),hasOwnProperty:pr};if(!this.mocks.has(cr)){this.mocks.set(cr,[])}this.mocks.get(cr).push(mr);if(pr){delete St[Dt]}let gr=this.cache.get(cr);if(!gr){gr=new Map;this.cache.set(cr,gr)}let yr=gr.get(St);if(!yr){yr=new Set;gr.set(St,yr)}yr.add(Dt);const Sr=this.overridePropertyDescriptor(rr);Object.defineProperty(St,Dt,Sr)}mockContext(St,Dt,rr,cr="default"){if(!this.contextMocks.has(cr)){this.contextMocks.set(cr,[])}this.contextMocks.get(cr).push({app:St,key:Dt,value:rr})}restore(St="default"){this.restoreGroup(St)}restoreAll(){const St=new Set([...this.mocks.keys(),...this.contextMocks.keys(),...this.cache.keys()]);for(const Dt of St){this.restoreGroup(Dt)}this.simulatorList=[]}restoreGroup(St){const Dt=this.mocks.get(St)||[];for(let St=Dt.length-1;St>=0;St--){const rr=Dt[St];if(!rr.hasOwnProperty){delete rr.obj[rr.key]}else{Object.defineProperty(rr.obj,rr.key,rr.descriptor)}}this.mocks.delete(St);this.contextMocks.delete(St);this.cache.delete(St);this.simulatorList=this.simulatorList.filter((Dt=>Dt["group"]!==St))}isMocked(St,Dt,rr="default"){if((0,Sr.isClass)(St)){St=St.prototype}const cr=this.cache.get(rr);const pr=cr?cr.get(St):undefined;return pr?pr.has(Dt):false}applyContextMocks(St,Dt){for(const[,rr]of this.contextMocks){for(const cr of rr){if(cr.app===St){const St=this.overridePropertyDescriptor(cr.value);if(typeof cr.key==="string"){Object.defineProperty(Dt,cr.key,St)}else{cr.key(Dt)}}}}}getContextMocksSize(){return Array.from(this.contextMocks.values()).reduce(((St,Dt)=>St+Dt.length),0)}overridePropertyDescriptor(St){const Dt={configurable:true,enumerable:true};if(St&&(St.get||St.set)){Dt.get=St.get;Dt.set=St.set}else{Dt.value=St;Dt.writable=true}return Dt}async initSimulation(St="default"){const Dt=(0,yr.listModule)(yr.MOCK_KEY);for(const rr of Dt){const Dt=await this.applicationContext.getAsync(rr);if(await Dt.enableCondition()){Dt["group"]=St;this.simulatorList.push(Dt)}}}async runSimulatorSetup(){var St;for(const Dt of this.simulatorList){await((St=Dt.setup)===null||St===void 0?void 0:St.call(Dt))}}async runSimulatorTearDown(){var St;for(let Dt=this.simulatorList.length-1;Dt>=0;Dt--){const rr=this.simulatorList[Dt];await((St=rr.tearDown)===null||St===void 0?void 0:St.call(rr))}}async runSimulatorAppSetup(St){var Dt;for(const rr of this.simulatorList){await((Dt=rr.appSetup)===null||Dt===void 0?void 0:Dt.call(rr,St))}}async runSimulatorAppTearDown(St){var Dt;for(let rr=this.simulatorList.length-1;rr>=0;rr--){const cr=this.simulatorList[rr];await((Dt=cr.appTearDown)===null||Dt===void 0?void 0:Dt.call(cr,St))}}async runSimulatorContextSetup(St,Dt){var rr;for(const cr of this.simulatorList){await((rr=cr.contextSetup)===null||rr===void 0?void 0:rr.call(cr,St,Dt))}}async runSimulatorContextTearDown(St,Dt){var rr;for(let cr=this.simulatorList.length-1;cr>=0;cr--){const pr=this.simulatorList[cr];await((rr=pr===null||pr===void 0?void 0:pr.contextTearDown)===null||rr===void 0?void 0:rr.call(pr,St,Dt))}}};$r.prepareMocks=[];cr([(0,yr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],$r.prototype,"init",null);cr([(0,yr.Destroy)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",void 0)],$r.prototype,"restoreAll",null);$r=mr=cr([(0,yr.Provide)(),(0,yr.Scope)(gr.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],$r);Dt.MidwayMockService=$r},28602:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayPipelineService=Dt.PipelineContext=void 0;const cr=rr(49757);class PipelineContext{constructor(St){this.info={current:null,currentName:null};this.data=new Map;this.args=St}get(St){return this.data.get(St)}set(St,Dt){this.data.set(St,Dt)}keys(){const St=[];const Dt=this.data.keys();for(const rr of Dt){St.push(rr)}return St}}Dt.PipelineContext=PipelineContext;class MidwayPipelineService{constructor(St,Dt){this.applicationContext=St;this.valves=Dt}async parallel(St){const Dt=this.prepareParallelValves(St);const rr=await Promise.all(Dt);return this.packResult(rr,false)}async concat(St){const Dt=this.prepareParallelValves(St);const rr=await Promise.all(Dt);return this.packResult(rr,true)}async series(St){const Dt=this.mergeValves(St.valves);const rr=new PipelineContext(St.args);const cr={success:true,result:null};const pr={};const mr={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let gr=1;for(const St of Dt){mr.prev=mr.current;mr.prevName=getName(mr.prev);mr.current=St;mr.currentName=getName(mr.current);if(gr<Dt.length){mr.next=Dt[gr];mr.nextName=getName(mr.next)}else{mr.next=undefined;mr.nextName=undefined}gr+=1;rr.info=mr;try{const Dt=await this.applicationContext.getAsync(St);const cr=await Dt.invoke(rr);let gr=St;if(Dt.alias){gr=Dt.alias}pr[gr]=cr;mr.prevValue=cr}catch(Dt){cr.success=false;cr.error={valveName:typeof St==="string"?St:St.name,message:Dt.message,error:Dt};return cr}}cr.result=pr;return cr}async concatSeries(St){const Dt=this.mergeValves(St.valves);const rr=new PipelineContext(St.args);const cr={success:true,result:null};const pr=[];const mr={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let gr=1;for(const St of Dt){mr.prev=mr.current;mr.prevName=getName(mr.prev);mr.current=St;mr.currentName=getName(mr.current);if(gr<Dt.length){mr.next=Dt[gr];mr.nextName=getName(mr.next)}else{mr.next=undefined;mr.nextName=undefined}gr+=1;rr.info=mr;try{const Dt=await this.applicationContext.getAsync(St);const cr=await Dt.invoke(rr);pr.push(cr);mr.prevValue=cr}catch(Dt){cr.success=false;cr.error={valveName:typeof St==="string"?St:St.name,message:Dt.message,error:Dt};return cr}}cr.result=pr;return cr}async waterfall(St){const Dt=await this.concatSeries(St);if(Dt.success){const St=Dt.result;Dt.result=St[St.length-1]}return Dt}mergeValves(St){let Dt=[];if(this.valves&&this.valves.length>0){Dt=this.valves}let rr=[];if(St){for(const cr of St){if(Dt.includes(cr)){rr.push(cr)}}}else{rr=Dt}return rr}prepareParallelValves(St){const Dt=this.mergeValves(St.valves);const rr=new PipelineContext(St.args);return Dt.map((async St=>{const Dt={valveName:St,dataKey:St,data:null};try{const cr=await this.applicationContext.getAsync(St);if(cr.alias){Dt.dataKey=cr.alias}Dt.data=await cr.invoke(rr)}catch(St){Dt.error=St}return Dt}))}packResult(St,Dt=false){const rr={success:true,result:null};let cr;if(Dt){cr=[]}else{cr={}}for(const pr of St){if(pr.error){rr.success=false;rr.error={valveName:typeof pr.valveName==="string"?pr.valveName:pr.valveName.name,message:pr.error.message,error:pr.error};return rr}else{if(Dt){cr.push(pr.data)}else{cr[pr.dataKey]=pr.data}}}rr.result=cr;return rr}}Dt.MidwayPipelineService=MidwayPipelineService;function getName(St){if(St){if(typeof St==="string"){return St}else{return(0,cr.getProviderName)(St)}}return null}},42592:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.WebRouterCollector=Dt.MidwayServerlessFunctionService=void 0;const mr=rr(49757);const gr=rr(19985);const yr=rr(9288);const Sr=rr(1845);const $r=rr(50539);const Er=rr(6192);let Ir=class MidwayServerlessFunctionService extends gr.MidwayWebRouterService{constructor(St={}){super(Object.assign({},St,{includeFunctionRouter:true}));this.options=St}async analyze(){this.analyzeController();this.analyzeFunction();this.sortPrefixAndRouter();for(const St of this.routes.values()){for(const Dt of St){if(Dt.requestMethod==="all"){Dt.functionTriggerMetadata=Dt.functionTriggerMetadata||{};Dt.functionTriggerMetadata.method=["get","post","put","delete","head","patch","options"]}}}}analyzeFunction(){const St=(0,mr.listModule)(mr.FUNC_KEY);for(const Dt of St){this.collectFunctionRoute(Dt)}}collectFunctionRoute(St){var Dt,rr,cr,pr,gr,yr,Sr,$r,Er,Ir,Or,Hr,Gr,Tn,Wn,Gn,mi;const $i=(0,mr.getClassMetadata)(mr.FUNC_KEY,St);const ki=(0,mr.getProviderName)(St);const Ni=(0,mr.getProviderUUId)(St);const Ri="/";if(!this.routes.has(Ri)){this.routes.set(Ri,[]);this.routesPriority.push({prefix:Ri,priority:-999,middleware:[],routerOptions:{},controllerId:ki,routerModule:St})}for(const Vi of $i){if((Dt=Vi["metadata"])===null||Dt===void 0?void 0:Dt["path"]){const Dt=(0,mr.getPropertyDataFromClass)(mr.WEB_ROUTER_PARAM_KEY,St,Vi["methodName"])||[];const Or=(0,mr.getPropertyMetadata)(mr.WEB_RESPONSE_KEY,St,Vi["methodName"])||[];const Hr={id:Ni,prefix:Ri,routerName:"",url:Vi["metadata"]["path"],requestMethod:(cr=(rr=Vi["metadata"])===null||rr===void 0?void 0:rr["method"])!==null&&cr!==void 0?cr:"get",method:Vi["methodName"],description:"",summary:"",handlerName:`${ki}.${Vi["methodName"]}`,funcHandlerName:`${ki}.${Vi["methodName"]}`,controllerId:ki,middleware:((pr=Vi["metadata"])===null||pr===void 0?void 0:pr["middleware"])||[],controllerMiddleware:[],requestMetadata:Dt,responseMetadata:Or};const Gr=(0,mr.getPropertyMetadata)(mr.SERVERLESS_FUNC_KEY,St,Vi["methodName"])||{};const Tn=(Sr=(gr=Gr["functionName"])!==null&&gr!==void 0?gr:(yr=Vi===null||Vi===void 0?void 0:Vi["metadata"])===null||yr===void 0?void 0:yr["functionName"])!==null&&Sr!==void 0?Sr:createFunctionName(St,Vi["methodName"]);const Wn=(Ir=($r=Gr["handlerName"])!==null&&$r!==void 0?$r:(Er=Vi===null||Vi===void 0?void 0:Vi["metadata"])===null||Er===void 0?void 0:Er["handlerName"])!==null&&Ir!==void 0?Ir:Hr.funcHandlerName;Hr.functionName=Tn;Hr.funcHandlerName=Wn;Hr.functionTriggerName=Vi["type"];Hr.functionTriggerMetadata=Vi["metadata"];Hr.functionMetadata={functionName:Tn,...Gr};this.checkDuplicateAndPush(Ri,Hr)}else{const Dt=(0,mr.getPropertyMetadata)(mr.SERVERLESS_FUNC_KEY,St,Vi["methodName"])||{};const rr=(Gr=(Or=Dt["functionName"])!==null&&Or!==void 0?Or:(Hr=Vi===null||Vi===void 0?void 0:Vi["metadata"])===null||Hr===void 0?void 0:Hr["functionName"])!==null&&Gr!==void 0?Gr:createFunctionName(St,Vi["methodName"]);const cr=(Gn=(Tn=Dt["handlerName"])!==null&&Tn!==void 0?Tn:(Wn=Vi===null||Vi===void 0?void 0:Vi["metadata"])===null||Wn===void 0?void 0:Wn["handlerName"])!==null&&Gn!==void 0?Gn:`${ki}.${Vi["methodName"]}`;this.checkDuplicateAndPush(Ri,{id:Ni,prefix:Ri,routerName:"",url:"",requestMethod:"",method:Vi["methodName"],description:"",summary:"",handlerName:`${ki}.${Vi["methodName"]}`,funcHandlerName:cr,controllerId:ki,middleware:((mi=Vi["metadata"])===null||mi===void 0?void 0:mi["middleware"])||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:rr,functionTriggerName:Vi["type"],functionTriggerMetadata:Vi["metadata"],functionMetadata:{functionName:rr,...Dt}})}}}async getFunctionList(){return this.getFlattenRouterTable({compileUrlPattern:true})}addServerlessFunction(St,Dt,rr={}){var cr,pr;const mr="";if(!this.routes.has(mr)){this.routes.set(mr,[]);this.routesPriority.push({prefix:mr,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}const gr=(cr=Dt.functionName)!==null&&cr!==void 0?cr:rr.functionName;this.checkDuplicateAndPush(mr,{id:null,method:St,url:Dt.metadata["path"]||"",requestMethod:Dt.metadata["method"]||"",description:"",summary:"",handlerName:"",funcHandlerName:Dt.handlerName||rr.handlerName,controllerId:"",middleware:((pr=Dt.metadata)===null||pr===void 0?void 0:pr.middleware)||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:gr,functionTriggerName:Dt.metadata.name,functionTriggerMetadata:Dt.metadata,functionMetadata:{functionName:gr,...rr}})}};Ir=cr([(0,mr.Provide)(),(0,mr.Scope)(Er.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],Ir);Dt.MidwayServerlessFunctionService=Ir;function createFunctionName(St,Dt){return(0,mr.getProviderName)(St).replace(/[:#]/g,"-")+"-"+Dt}class WebRouterCollector{constructor(St="",Dt={}){this.baseDir=St;this.options=Dt}async init(){if(!this.proxy){if(this.baseDir){const St=new yr.MidwayContainer;(0,mr.bindContainer)(St);St.setFileDetector(new Sr.CommonJSFileDetector({loadDir:this.baseDir}));await St.ready()}if(this.options.includeFunctionRouter){if((0,$r.getCurrentMainFramework)()){this.proxy=await(0,$r.getCurrentMainFramework)().getApplicationContext().getAsync(Ir,[this.options])}else{this.proxy=new Ir(this.options)}}else{if((0,$r.getCurrentMainFramework)()){this.proxy=await(0,$r.getCurrentMainFramework)().getApplicationContext().getAsync(gr.MidwayWebRouterService,[this.options])}else{this.proxy=new gr.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()}}Dt.WebRouterCollector=WebRouterCollector},19985:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayWebRouterService=void 0;const mr=rr(49757);const gr=rr(65308);const yr=rr(86314);const Sr=rr(39023);const $r=rr(73861);const Er=rr(63289);const Ir=rr(6192);const Or=Sr.debuglog("midway:debug");let Hr=class MidwayWebRouterService{constructor(St={}){this.options=St;this.isReady=false;this.routes=new Map;this.routesPriority=[]}async analyze(){this.analyzeController();this.sortPrefixAndRouter()}analyzeController(){const St=(0,mr.listModule)(mr.CONTROLLER_KEY);for(const Dt of St){const St=(0,mr.getClassMetadata)(mr.CONTROLLER_KEY,Dt);this.addController(Dt,St,this.options.includeFunctionRouter)}}sortPrefixAndRouter(){this.routesPriority=this.routesPriority.filter((St=>{const Dt=this.routes.get(St.prefix);if(Dt.length>0){return true}else{this.routes.delete(St.prefix);return false}}));for(const St of this.routes.keys()){const Dt=this.routes.get(St);this.routes.set(St,this.sortRouter(Dt))}this.routesPriority=this.routesPriority.sort(((St,Dt)=>Dt.prefix.length-St.prefix.length))}addController(St,Dt,rr={},cr=false){var pr;if(rr&&typeof rr==="boolean"){cr=rr;rr=undefined}if(!rr){rr={}}const Sr=(0,mr.getProviderName)(St);Or(`[core]: Found Controller ${Sr}.`);const $r=(0,mr.getProviderUUId)(St);Dt.routerOptions=Dt.routerOptions||{};let Er;const Hr=Dt.routerOptions.middleware;const Gr=!!((pr=Dt.routerOptions)===null||pr===void 0?void 0:pr.ignoreGlobalPrefix);let Tn=(0,gr.joinURLPath)(this.options.globalPrefix,Dt.prefix||"/");const Wn=Dt.prefix||"/";if(Gr){Tn=Wn}if(/\*/.test(Tn)){throw new yr.MidwayCommonError(`Router prefix ${Tn} can't set string with *`)}if(!this.routes.has(Tn)){this.routes.set(Tn,[]);this.routesPriority.push({prefix:Tn,priority:Tn==="/"&&Er===undefined?-999:0,middleware:Hr,routerOptions:Dt.routerOptions,controllerId:Sr,routerModule:St})}else{if(Hr&&Hr.length>0){const St=this.routesPriority.filter((St=>St.prefix===Tn))[0];throw new yr.MidwayDuplicateControllerOptionsError(Tn,Sr,St.controllerId)}}if(!this.routes.has(Wn)){this.routes.set(Wn,[]);this.routesPriority.push({prefix:Wn,priority:Wn==="/"&&Er===undefined?-999:0,middleware:Hr,routerOptions:Dt.routerOptions,controllerId:Sr,routerModule:St})}const Gn=(0,mr.getClassMetadata)(mr.WEB_ROUTER_KEY,St);if(Gn&&typeof Gn[Symbol.iterator]==="function"){for(const Dt of Gn){const pr=(0,mr.getPropertyDataFromClass)(mr.WEB_ROUTER_PARAM_KEY,St,Dt.method)||[];const yr=(0,mr.getPropertyMetadata)(mr.WEB_RESPONSE_KEY,St,Dt.method)||[];const Er={id:$r,prefix:Dt.ignoreGlobalPrefix?Wn:Tn,routerName:Dt.routerName||"",url:Dt.path,requestMethod:Dt.requestMethod,method:Dt.method,description:Dt.description||"",summary:Dt.summary||"",handlerName:`${Sr}.${Dt.method}`,funcHandlerName:`${Sr}.${Dt.method}`,controllerId:Sr,controllerClz:St,middleware:Dt.middleware||[],controllerMiddleware:Hr||[],requestMetadata:pr,responseMetadata:yr};if(cr){Er.functionName=Sr+"-"+Dt.method;Er.functionTriggerName=Ir.ServerlessTriggerType.HTTP;Er.functionTriggerMetadata={path:(0,gr.joinURLPath)(Tn,Dt.path.toString()),method:Dt.requestMethod};Er.functionMetadata={functionName:Er.functionName}}if(rr.resourceFilter&&!rr.resourceFilter(Er)){continue}this.checkDuplicateAndPush(Er.prefix,Er)}}}addRouter(St,Dt){const rr=Dt.prefix||"";Dt.requestMethod=(Dt.requestMethod||"GET").toUpperCase();if(!this.routes.has(rr)){this.routes.set(rr,[]);this.routesPriority.push({prefix:rr,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}this.checkDuplicateAndPush(rr,Object.assign(Dt,{method:St}));this.sortPrefixAndRouter()}sortRouter(St){return St.map((St=>{const Dt=St.url.toString();const rr=Er.Types.isRegExp(St.url)?Dt.split("\\/"):Dt.split("/");let cr=0;for(const St of rr){if(St===""||St.includes(":")||St.includes("*")){cr+=0}else{cr+=1}}let pr=2;const mr=Dt.includes(":")?Dt.replace(/:.+$/,""):"";if(mr){pr=1}if(Dt.includes("*")){pr=0}return{...St,_pureRouter:Dt.replace(/\**$/,"").replace(/:\w+/,"123"),_level:Dt.split("/").length-1,_paramString:mr,_category:pr,_weight:cr}})).sort(((St,Dt)=>{if(St._category!==Dt._category){return Dt._category-St._category}if(St._weight!==Dt._weight){return Dt._weight-St._weight}if(St._level===Dt._level){if(Dt._pureRouter===St._pureRouter){return St.url.toString().length-Dt.url.toString().length}return Dt._pureRouter.length-St._pureRouter.length}return Dt._level-St._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(St={}){if(!this.isReady){await this.analyze();this.isReady=true}let Dt=[];for(const St of this.routesPriority){Dt=Dt.concat(this.routes.get(St.prefix))}if(St.compileUrlPattern){for(const St of Dt){if(St.fullUrlFlattenString){St.fullUrlCompiledRegexp=$r.PathToRegexpUtil.toRegexp(St.fullUrlFlattenString)}}}return Dt}async getMatchedRouterInfo(St,Dt){const rr=await this.getFlattenRouterTable({compileUrlPattern:true});let cr;for(const pr of rr){if(pr.fullUrlCompiledRegexp){const rr=pr["requestMethod"].toUpperCase();if(("ALL"===rr||Dt.toUpperCase()===rr)&&pr.fullUrlCompiledRegexp.test(St)){cr=pr;break}}}return cr}checkDuplicateAndPush(St,Dt){const rr=this.routes.get(St);const cr=rr.filter((St=>Dt.url&&Dt.requestMethod&&St.url===Dt.url&&St.requestMethod===Dt.requestMethod));if(cr&&cr.length){throw new yr.MidwayDuplicateRouteError(`${Dt.requestMethod} ${Dt.url}`,`${cr[0].handlerName}`,`${Dt.handlerName}`)}if(!Dt.fullUrlFlattenString&&Dt.url&&typeof Dt.url==="string"){Dt.fullUrl=(0,gr.joinURLPath)(St,Dt.url);if(/\*$/.test(Dt.fullUrl)){Dt.fullUrlFlattenString=Dt.fullUrl.replace("*","(.*)")}else{Dt.fullUrlFlattenString=Dt.fullUrl}}rr.push(Dt)}};Hr=cr([(0,mr.Provide)(),(0,mr.Scope)(Ir.ScopeEnum.Singleton),pr("design:paramtypes",[Object])],Hr);Dt.MidwayWebRouterService=Hr},29222:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.prepareGlobalApplicationContext=Dt.prepareGlobalApplicationContextAsync=Dt.destroyGlobalApplicationContext=Dt.initializeGlobalApplicationContext=void 0;const cr=rr(46123);const pr=rr(42193);const mr=rr(49757);const gr=rr(39023);const yr=rr(42592);const Sr=rr(16928);const $r=rr(658);const Er=rr(70032);const Ir=gr.debuglog("midway:debug");let Or=1;function printStepDebugInfo(St){Ir(`\n\nStep ${Or++}: ${St}\n`)}async function initializeGlobalApplicationContext(St){Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);const Dt=await prepareGlobalApplicationContextAsync(St);printStepDebugInfo("Init logger");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);const rr=await Dt.getAsync(cr.MidwayLoggerService,[Dt,St]);if(rr.getLogger("appLogger")){Dt.registerObject("logger",rr.getLogger("appLogger"))}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);printStepDebugInfo("Init MidwayMockService");await Dt.getAsync(cr.MidwayMockService,[Dt]);printStepDebugInfo("Init framework");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);await Dt.getAsync(cr.MidwayFrameworkService,[Dt,St]);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);printStepDebugInfo("Init lifecycle");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);await Dt.getAsync(cr.MidwayLifeCycleService,[Dt]);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);printStepDebugInfo("Init preload modules");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);const pr=(0,mr.listPreloadModule)();for(const St of pr){await Dt.getAsync(St)}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);printStepDebugInfo("End of initialize and start");Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);return Dt}Dt.initializeGlobalApplicationContext=initializeGlobalApplicationContext;async function destroyGlobalApplicationContext(St){const Dt=await St.getAsync(cr.MidwayLoggerService);const rr=Dt.getCurrentLoggerFactory();const pr=await St.getAsync(cr.MidwayLifeCycleService);await pr.stop();await St.stop();(0,mr.clearBindContainer)();rr.close();Er.MidwayPerformanceManager.cleanAll();global["MIDWAY_APPLICATION_CONTEXT"]=undefined;global["MIDWAY_MAIN_FRAMEWORK"]=undefined}Dt.destroyGlobalApplicationContext=destroyGlobalApplicationContext;async function prepareGlobalApplicationContextAsync(St){var Dt,rr,Or,Hr,Gr;printStepDebugInfo("Ready to create applicationContext");Ir('[core]: start "initializeGlobalApplicationContext"');Ir(`[core]: bootstrap options = ${gr.inspect(St)}`);const Tn=(Dt=St.appDir)!==null&&Dt!==void 0?Dt:"";const Wn=(rr=St.baseDir)!==null&&rr!==void 0?rr:"";Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const Gn=(Or=St.applicationContext)!==null&&Or!==void 0?Or:new cr.MidwayContainer;Ir("[core]: delegate module map from decoratorManager");(0,mr.bindContainer)(Gn);global["MIDWAY_APPLICATION_CONTEXT"]=Gn;Gn.registerObject("baseDir",Wn);Gn.registerObject("appDir",Tn);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);Ir("[core]: set default file detector");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Ready module detector");if(!St.moduleLoadType){St.moduleLoadType="commonjs"}if(St.moduleDetector!==false){Ir("[core]: set module load type = %s",St.moduleLoadType);if(!St.imports){St.imports=[await(0,cr.loadModule)((0,Sr.join)(Wn,`configuration${(0,cr.isTypeScriptEnvironment)()?".ts":".js"}`),{loadMode:St.moduleLoadType,safeLoad:true})]}if(St.moduleDetector===undefined){if(St.moduleLoadType==="esm"){Gn.setFileDetector(new cr.ESModuleFileDetector({loadDir:Wn,ignore:(Hr=St.ignore)!==null&&Hr!==void 0?Hr:[]}));St.moduleLoadType="esm"}else{Gn.setFileDetector(new cr.CommonJSFileDetector({loadDir:Wn,ignore:(Gr=St.ignore)!==null&&Gr!==void 0?Gr:[]}))}}}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");Gn.bindClass(cr.MidwayEnvironmentService);Gn.bindClass(cr.MidwayInformationService);Gn.bindClass(cr.MidwayAspectService);Gn.bindClass(cr.MidwayDecoratorService);Gn.bindClass(cr.MidwayConfigService);Gn.bindClass(cr.MidwayLoggerService);Gn.bindClass(cr.MidwayApplicationManager);Gn.bindClass(cr.MidwayFrameworkService);Gn.bindClass(cr.MidwayMiddlewareService);Gn.bindClass(cr.MidwayLifeCycleService);Gn.bindClass(cr.MidwayMockService);Gn.bindClass(cr.MidwayWebRouterService);Gn.bindClass(yr.MidwayServerlessFunctionService);Gn.bindClass($r.MidwayHealthService);Gn.bindClass(cr.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(St.preloadModules&&St.preloadModules.length){for(const Dt of St.preloadModules){Gn.bindClass(Dt)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const mi=Gn.get(cr.MidwayEnvironmentService);mi.setModuleLoadType(St.moduleLoadType);const $i=Gn.get(cr.MidwayConfigService);$i.add([{default:pr.default}]);Gn.get(cr.MidwayAspectService,[Gn]);Gn.get(cr.MidwayDecoratorService,[Gn]);printStepDebugInfo("Load imports(component) and user code configuration module");Gn.load([].concat(St.imports).concat(St.configurationModule));printStepDebugInfo("Run applicationContext ready method");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);await Gn.ready();Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(St.globalConfig){if(Array.isArray(St.globalConfig)){$i.add(St.globalConfig)}else{$i.addObject(St.globalConfig)}}printStepDebugInfo("Load config file");$i.load();Ir("[core]: Current config = %j",$i.getConfiguration());Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);Gn.get(cr.MidwayMiddlewareService,[Gn]);return Gn}Dt.prepareGlobalApplicationContextAsync=prepareGlobalApplicationContextAsync;function prepareGlobalApplicationContext(St){var Dt,rr,Or,Hr;printStepDebugInfo("Ready to create applicationContext");Ir('[core]: start "initializeGlobalApplicationContext"');Ir(`[core]: bootstrap options = ${gr.inspect(St)}`);const Gr=(Dt=St.appDir)!==null&&Dt!==void 0?Dt:"";const Tn=(rr=St.baseDir)!==null&&rr!==void 0?rr:"";Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const Wn=(Or=St.applicationContext)!==null&&Or!==void 0?Or:new cr.MidwayContainer;Ir("[core]: delegate module map from decoratorManager");(0,mr.bindContainer)(Wn);global["MIDWAY_APPLICATION_CONTEXT"]=Wn;Wn.registerObject("baseDir",Tn);Wn.registerObject("appDir",Gr);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);printStepDebugInfo("Ready module detector");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);if(!St.moduleLoadType){St.moduleLoadType="commonjs"}if(St.moduleDetector!==false){if(St.moduleDetector===undefined){Wn.setFileDetector(new cr.CommonJSFileDetector({ignore:(Hr=St.ignore)!==null&&Hr!==void 0?Hr:[]}))}else if(St.moduleDetector){Wn.setFileDetector(St.moduleDetector)}}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");Wn.bindClass(cr.MidwayEnvironmentService);Wn.bindClass(cr.MidwayInformationService);Wn.bindClass(cr.MidwayAspectService);Wn.bindClass(cr.MidwayDecoratorService);Wn.bindClass(cr.MidwayConfigService);Wn.bindClass(cr.MidwayLoggerService);Wn.bindClass(cr.MidwayApplicationManager);Wn.bindClass(cr.MidwayFrameworkService);Wn.bindClass(cr.MidwayMiddlewareService);Wn.bindClass(cr.MidwayLifeCycleService);Wn.bindClass(cr.MidwayMockService);Wn.bindClass(cr.MidwayWebRouterService);Wn.bindClass(yr.MidwayServerlessFunctionService);Wn.bindClass($r.MidwayHealthService);Wn.bindClass(cr.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(St.preloadModules&&St.preloadModules.length){for(const Dt of St.preloadModules){Wn.bindClass(Dt)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const Gn=Wn.get(cr.MidwayEnvironmentService);Gn.setModuleLoadType(St.moduleLoadType);const mi=Wn.get(cr.MidwayConfigService);mi.add([{default:pr.default}]);Wn.get(cr.MidwayAspectService,[Wn]);Wn.get(cr.MidwayDecoratorService,[Wn]);printStepDebugInfo("Load imports(component) and user code configuration module");if(!St.imports){St.imports=[(0,cr.safeRequire)((0,Sr.join)(St.baseDir,"configuration"))]}Wn.load([].concat(St.imports).concat(St.configurationModule));printStepDebugInfo("Run applicationContext ready method");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Wn.ready();Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(St.globalConfig){if(Array.isArray(St.globalConfig)){mi.add(St.globalConfig)}else{mi.addObject(St.globalConfig)}}printStepDebugInfo("Load config file");mi.load();Ir("[core]: Current config = %j",mi.getConfiguration());Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);Wn.get(cr.MidwayMiddlewareService,[Wn]);return Wn}Dt.prepareGlobalApplicationContext=prepareGlobalApplicationContext},90406:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.pascalCase=Dt.camelCase=void 0;const rr=/[\p{Lu}]/u;const cr=/[\p{Ll}]/u;const pr=/([\p{Alpha}\p{N}_]|$)/u;const mr=/[_.\- ]+/;const gr=new RegExp("^"+mr.source);const yr=new RegExp(mr.source+pr.source,"gu");const Sr=new RegExp("\\d+"+pr.source,"gu");const preserveCamelCase=(St,Dt,pr)=>{let mr=false;let gr=false;let yr=false;for(let Sr=0;Sr<St.length;Sr++){const $r=St[Sr];if(mr&&rr.test($r)){St=St.slice(0,Sr)+"-"+St.slice(Sr);mr=false;yr=gr;gr=true;Sr++}else if(gr&&yr&&cr.test($r)){St=St.slice(0,Sr-1)+"-"+St.slice(Sr-1);yr=gr;gr=false;mr=true}else{mr=Dt($r)===$r&&pr($r)!==$r;yr=gr;gr=pr($r)===$r&&Dt($r)!==$r}}return St};const postProcess=(St,Dt)=>{yr.lastIndex=0;Sr.lastIndex=0;return St.replace(yr,((St,rr)=>Dt(rr))).replace(Sr,(St=>Dt(St)))};function camelCaseOrigin(St,Dt){Dt={pascalCase:false,...Dt};St=St.trim();if(St.length===0){return""}const toLowerCase=St=>St.toLowerCase();const toUpperCase=St=>St.toUpperCase();if(St.length===1){if(mr.test(St)){return""}return Dt.pascalCase?toUpperCase(St):toLowerCase(St)}const rr=St!==toLowerCase(St);if(rr){St=preserveCamelCase(St,toLowerCase,toUpperCase)}St=St.replace(gr,"");St=toLowerCase(St);if(Dt.pascalCase){St=toUpperCase(St.charAt(0))+St.slice(1)}return postProcess(St,toUpperCase)}function camelCase(St){return camelCaseOrigin(St,{pascalCase:false})}Dt.camelCase=camelCase;function pascalCase(St){return camelCaseOrigin(St,{pascalCase:true})}Dt.pascalCase=pascalCase},50539:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.getCurrentAsyncContextManager=Dt.getCurrentMainApp=Dt.getCurrentMainFramework=Dt.getCurrentApplicationContext=void 0;const cr=rr(2222);const getCurrentApplicationContext=()=>global["MIDWAY_APPLICATION_CONTEXT"];Dt.getCurrentApplicationContext=getCurrentApplicationContext;const getCurrentMainFramework=()=>global["MIDWAY_MAIN_FRAMEWORK"];Dt.getCurrentMainFramework=getCurrentMainFramework;const getCurrentMainApp=()=>{const St=(0,Dt.getCurrentMainFramework)();if(St){return St.getApplication()}return undefined};Dt.getCurrentMainApp=getCurrentMainApp;const getCurrentAsyncContextManager=()=>(0,Dt.getCurrentApplicationContext)().get(cr.ASYNC_CONTEXT_MANAGER_KEY);Dt.getCurrentAsyncContextManager=getCurrentAsyncContextManager},83486:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.extend=void 0;const cr=rr(63289);function extend(...St){let Dt,rr,pr,mr,gr;let yr=St[0];let Sr=1;const $r=St.length;let Er=false;if(typeof yr==="boolean"){Er=yr;yr=St[1]||{};Sr=2}else if(typeof yr!=="object"&&typeof yr!=="function"||yr==null){yr={}}for(;Sr<$r;++Sr){Dt=St[Sr];if(Dt==null)continue;for(rr in Dt){if(rr==="__proto__")continue;pr=yr[rr];mr=Dt[rr];if(yr===mr)continue;if(Er&&mr&&cr.Types.isPlainObject(mr)){gr=pr&&cr.Types.isPlainObject(pr)?pr:{};yr[rr]=extend(Er,gr,mr)}else if(typeof mr!=="undefined"){yr[rr]=mr}}}return yr}Dt.extend=extend},2764:(St,Dt)=>{"use strict";
2
2
  /*! (c) 2020 Andrea Giammarchi */Object.defineProperty(Dt,"__esModule",{value:true});Dt.safeStringify=Dt.safeParse=void 0;const{parse:rr,stringify:cr}=JSON;const{keys:pr}=Object;const mr=String;const gr="string";const yr={};const Sr="object";const noop=(St,Dt)=>Dt;const primitives=St=>St instanceof mr?mr(St):St;const Primitives=(St,Dt)=>typeof Dt===gr?new mr(Dt):Dt;const revive=(St,Dt,rr,cr)=>{const gr=[];for(let $r=pr(rr),{length:Er}=$r,Ir=0;Ir<Er;Ir++){const pr=$r[Ir];const Er=rr[pr];if(Er instanceof mr){const mr=St[Er];if(typeof mr===Sr&&!Dt.has(mr)){Dt.add(mr);rr[pr]=yr;gr.push({k:pr,a:[St,Dt,mr,cr]})}else rr[pr]=cr.call(rr,pr,mr)}else if(rr[pr]!==yr)rr[pr]=cr.call(rr,pr,Er)}for(let{length:St}=gr,Dt=0;Dt<St;Dt++){const{k:St,a:pr}=gr[Dt];rr[St]=cr.call(rr,St,revive.apply(null,pr))}return rr};const set=(St,Dt,rr)=>{const cr=mr(Dt.push(rr)-1);St.set(rr,cr);return cr};function safeParse(St,Dt){const cr=rr(St,Primitives).map(primitives);const pr=cr[0];const mr=Dt||noop;const gr=typeof pr===Sr&&pr?revive(cr,new Set,pr,mr):pr;return mr.call({"":gr},"",gr)}Dt.safeParse=safeParse;function safeStringify(St,Dt,rr){const pr=Dt&&typeof Dt===Sr?(St,rr)=>St===""||-1<Dt.indexOf(St)?rr:void 0:Dt||noop;const mr=new Map;const yr=[];const $r=[];let Er=+set(mr,yr,pr.call({"":St},"",St));let Ir=!Er;while(Er<yr.length){Ir=true;$r[Er]=cr(yr[Er++],replace,rr)}return"["+$r.join(",")+"]";function replace(St,Dt){if(Ir){Ir=!Ir;return Dt}const rr=pr.call(this,St,Dt);switch(typeof rr){case Sr:if(rr===null)return rr;case gr:return mr.get(rr)||set(mr,yr,rr)}return rr}}Dt.safeStringify=safeStringify},30001:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.FORMAT=void 0;const rr=1e3;const cr=rr*60;const pr=cr*60;const mr=pr*24;const gr=mr*7;const yr=mr*365.25;const Sr={ONE_SECOND:rr,ONE_MINUTE:cr,ONE_HOUR:pr,ONE_DAY:mr,ONE_WEEK:gr,ONE_YEAR:yr};const $r={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 * * * *"};Dt.FORMAT={MS:Sr,CRONTAB:$r}},7589:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.FileUtils=Dt.exists=void 0;const cr=rr(79896);async function exists(St){return cr.promises.access(St,cr.constants.F_OK).then((()=>true)).catch((()=>false))}Dt.exists=exists;Dt.FileUtils={exists:exists}},87653:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.HttpClient=Dt.makeHttpRequest=void 0;const cr=rr(58611);const pr=rr(65692);const mr=rr(87016);const gr=rr(39023);const yr=rr(86314);const Sr=(0,gr.debuglog)("request-client");const $r=mr.URL;const Er={text:"application/text",json:"application/json",octet:"application/octet-stream"};function isHeaderExists(St,Dt){return St[Dt]||St[Dt.toLowerCase()]||St[Dt.toUpperCase()]}async function makeHttpRequest(St,Dt={}){Sr(`request '${St}'`);const rr=new $r(St);const mr=rr.protocol==="https:"?pr:cr;Dt.method=(Dt.method||"GET").toUpperCase();const{contentType:gr,dataType:Ir,method:Or,timeout:Hr=5e3,headers:Gr,...Tn}=Dt;const Wn={Accept:Er[Ir]||Er.octet,...Gr};let Gn;if(Or==="GET"&&Dt.data){for(const St of Object.keys(Dt.data)){rr.searchParams.set(St,Dt.data[St])}Wn["Content-Length"]=0}else if(Dt.data){Gn=Buffer.from(JSON.stringify(Dt.data));if(!isHeaderExists(Wn,"Content-Type")){Wn["Content-Type"]=Er[gr]||Er.octet}if(!isHeaderExists(Wn,"Content-Length")){Wn["Content-Length"]=Gn.byteLength}}return new Promise(((Dt,cr)=>{const pr=mr.request(rr.toString(),{method:Or,headers:Wn,...Tn},(rr=>{rr.setTimeout(Hr,(()=>{rr.destroy(new Error("Response Timeout"))}));rr.on("error",(St=>{cr(St)}));const pr=[];rr.on("data",(St=>{pr.push(St)}));rr.on("end",(()=>{let mr=Buffer.concat(pr);if(Ir==="text"||Ir==="json"){mr=mr.toString("utf8")}if(Ir==="json"){try{mr=JSON.parse(mr)}catch(St){return cr(new Error("[httpclient] Unable to parse response data"))}}Object.assign(rr,{status:rr.statusCode,data:mr});Sr(`request '${St}' resolved with status ${rr.statusCode}`);Dt(rr)}))}));pr.setTimeout(Hr,(()=>{pr.destroy(new yr.MidwayUtilHttpClientTimeoutError("Request Timeout"))}));pr.on("error",(St=>{cr(St)}));if(Or!=="GET"){pr.end(Gn)}else{pr.end()}}))}Dt.makeHttpRequest=makeHttpRequest;class HttpClient{constructor(St={}){this.defaultOptions=St}async request(St,Dt){return makeHttpRequest(St,Object.assign({},this.defaultOptions,Dt))}}Dt.HttpClient=HttpClient},65308:(St,Dt,rr)=>{"use strict";St=rr.nmd(St);Object.defineProperty(Dt,"__esModule",{value:true});Dt.Utils=Dt.createPromiseTimeoutInvokeChain=Dt.isTypeScriptEnvironment=Dt.toAsyncFunction=Dt.merge=Dt.generateRandomId=Dt.getParamNames=Dt.sleep=Dt.wrapAsync=Dt.isIncludeProperty=Dt.wrapMiddleware=Dt.pathMatching=Dt.toPathMatch=Dt.transformRequestObjectByType=Dt.deprecatedOutput=Dt.getCurrentDateString=Dt.delegateTargetProperties=Dt.delegateTargetMethod=Dt.delegateTargetAllPrototypeMethod=Dt.delegateTargetPrototypeMethod=Dt.joinURLPath=Dt.getUserHome=Dt.parsePrefix=Dt.safelyGet=Dt.loadModule=Dt.safeRequire=Dt.getCurrentEnvironment=Dt.isDevelopmentEnvironment=void 0;const cr=rr(16928);const pr=rr(79896);const mr=rr(39023);const gr=rr(14142);const yr=rr(73861);const Sr=rr(86314);const $r=rr(90406);const Er=rr(2897);const Ir=rr(2764);const Or=rr(76982);const Hr=rr(63289);const Gr=rr(87016);const Tn=(0,mr.debuglog)("midway:debug");const isDevelopmentEnvironment=St=>["local","test","unittest"].includes(St);Dt.isDevelopmentEnvironment=isDevelopmentEnvironment;const getCurrentEnvironment=()=>process.env["MIDWAY_SERVER_ENV"]||process.env["NODE_ENV"]||"prod";Dt.getCurrentEnvironment=getCurrentEnvironment;const safeRequire=(Dt,rr=true)=>{if(Dt.startsWith(`.${cr.sep}`)||Dt.startsWith(`..${cr.sep}`)){Dt=(0,cr.resolve)((0,cr.dirname)(St.parent.filename),Dt)}try{if(rr){return require(Dt)}else{const St=(0,pr.readFileSync)(Dt,{encoding:"utf-8"});return JSON.parse(St)}}catch(St){Tn(`[core]: SafeRequire Warning\n\n${St.message}\n`);return undefined}};Dt.safeRequire=safeRequire;const Wn={};const loadModule=async(Dt,mr={})=>{var gr,yr,Sr;mr.enableCache=(gr=mr.enableCache)!==null&&gr!==void 0?gr:true;mr.safeLoad=(yr=mr.safeLoad)!==null&&yr!==void 0?yr:false;mr.loadMode=(Sr=mr.loadMode)!==null&&Sr!==void 0?Sr:"commonjs";if(Dt.startsWith(`.${cr.sep}`)||Dt.startsWith(`..${cr.sep}`)){Dt=(0,cr.resolve)((0,cr.dirname)(St.parent.filename),Dt)}Tn(`[core]: load module ${Dt}, cache: ${mr.enableCache}, mode: ${mr.loadMode}, safeLoad: ${mr.safeLoad}`);try{if(mr.enableCache){if(mr.loadMode==="commonjs"){return require(Dt)}else{if(Dt.endsWith(".json")){if(!Wn[Dt]){const St=(0,pr.readFileSync)(Dt,{encoding:"utf-8"});Wn[Dt]=JSON.parse(St)}return Wn[Dt]}else{return await rr(53196)((0,Gr.pathToFileURL)(Dt).href)}}}else{const St=(0,pr.readFileSync)(Dt,{encoding:"utf-8"});return JSON.parse(St)}}catch(St){if(!mr.safeLoad){throw St}else{Tn(`[core]: SafeLoadModule Warning\n\n${St.message}\n`);return undefined}}};Dt.loadModule=loadModule;function safelyGet(St,Dt){if(arguments.length===1){return Dt=>safelyGet(St,Dt)}if(typeof Dt==="undefined"||typeof Dt!=="object"||Dt===null){return void 0}const rr=typeof St==="string"?St.split("."):St;let cr=Dt;for(const St of rr){if(typeof cr==="undefined"||cr===null){return void 0}else if(typeof cr!=="object"){return void 0}cr=cr[St]}return cr}Dt.safelyGet=safelyGet;function parsePrefix(St){if(St.includes("@")){return St.slice(1)}return St}Dt.parsePrefix=parsePrefix;function getUserHome(){return process.env[process.platform==="win32"?"USERPROFILE":"HOME"]}Dt.getUserHome=getUserHome;function joinURLPath(...St){St=St.filter((St=>!!St));if(St.length===0){return""}let Dt=cr.posix.join(...St);Dt=Dt.replace(/\/+$/,"");if(!/^\//.test(Dt)){Dt="/"+Dt}return Dt}Dt.joinURLPath=joinURLPath;function delegateTargetPrototypeMethod(St,Dt,rr){Dt.forEach((Dt=>{if(Dt.prototype){Object.getOwnPropertyNames(Dt.prototype).forEach((Dt=>{if(Dt!=="constructor"&&!/^_/.test(Dt)&&!St.prototype[Dt]){St.prototype[Dt]=function(...St){return this.instance[Dt](...St)}}}))}}));if(rr){delegateTargetMethod(St,rr)}}Dt.delegateTargetPrototypeMethod=delegateTargetPrototypeMethod;function delegateTargetAllPrototypeMethod(St,Dt){do{delegateTargetPrototypeMethod(St,[Dt]);Dt=Object.getPrototypeOf(Dt)}while(Dt)}Dt.delegateTargetAllPrototypeMethod=delegateTargetAllPrototypeMethod;function delegateTargetMethod(St,Dt){Dt.forEach((Dt=>{St.prototype[Dt]=function(...St){return this.instance[Dt](...St)}}))}Dt.delegateTargetMethod=delegateTargetMethod;function delegateTargetProperties(St,Dt){Dt.forEach((Dt=>{Object.defineProperty(St.prototype,Dt,{get(){return this.instance[Dt]}})}))}Dt.delegateTargetProperties=delegateTargetProperties;const getCurrentDateString=(St=Date.now())=>{const Dt=new Date(St);return`${Dt.getFullYear()}-${(Dt.getMonth()+1).toString().padStart(2,"0")}-${Dt.getDate().toString().padStart(2,"0")}`};Dt.getCurrentDateString=getCurrentDateString;const deprecatedOutput=St=>{console.warn("DeprecationWarning: "+St)};Dt.deprecatedOutput=deprecatedOutput;const transformRequestObjectByType=(St,Dt)=>{if(Dt===undefined||Dt===null||Dt===Object||typeof St==="undefined"){return St}switch(Dt){case Number:return Number(St);case String:return String(St);case Boolean:if(St==="0"||St==="false"){return false}return Boolean(St);default:if(St instanceof Dt){return St}else{const rr=gr["plainToClass"]||gr["plainToInstance"];return rr(Dt,St)}}};Dt.transformRequestObjectByType=transformRequestObjectByType;function toPathMatch(St){if(typeof St==="boolean"){return Dt=>St}if(typeof St==="string"){const Dt=yr.PathToRegexpUtil.toRegexp(St.replace("*","(.*)"));if(Dt.global)Dt.lastIndex=0;return St=>Dt.test(St.path)}if(St instanceof RegExp){return Dt=>{if(St.global)St.lastIndex=0;return St.test(Dt.path)}}if(typeof St==="function")return St;if(Array.isArray(St)){const Dt=St.map((St=>toPathMatch(St)));return St=>Dt.some((Dt=>Dt(St)))}throw new Sr.MidwayCommonError("match/ignore pattern must be RegExp, Array or String, but got "+St)}Dt.toPathMatch=toPathMatch;function pathMatching(St){St=St||{};if(St.match&&St.ignore)throw new Sr.MidwayCommonError("options.match and options.ignore can not both present");if(!St.match&&!St.ignore)return()=>true;if(St.match&&!Array.isArray(St.match)){St.match=[St.match]}if(St.ignore&&!Array.isArray(St.ignore)){St.ignore=[St.ignore]}const createMatch=Dt=>{const rr=Dt.map((Dt=>{if(St.thisResolver){return toPathMatch(Dt).bind(St.thisResolver)}return toPathMatch(Dt)}));return St=>{for(let Dt=0;Dt<rr.length;Dt++){const cr=rr[Dt](St);if(cr){return true}}return false}};const Dt=St.match?createMatch(St.match):createMatch(St.ignore);return function pathMatch(rr){const cr=Dt(rr);return St.match?cr:!cr}}Dt.pathMatching=pathMatching;function wrapMiddleware(St,Dt){if(Dt.enable===false)return null;if(!Dt.match&&!Dt.ignore)return St;const rr=pathMatching(Dt);const fn=(Dt,cr)=>{if(!rr(Dt))return cr();return St(Dt,cr)};fn._name=St._name+"middlewareWrapper";return fn}Dt.wrapMiddleware=wrapMiddleware;function isOwnPropertyWritable(St,Dt){if(St==null)return false;const rr=typeof St;if(rr!=="object"&&rr!=="function")return false;return!!Object.getOwnPropertyDescriptor(St,Dt)}function isIncludeProperty(St,Dt){while(St){if(isOwnPropertyWritable(St,Dt))return true;St=Object.getPrototypeOf(St)}return false}Dt.isIncludeProperty=isIncludeProperty;function wrapAsync(St){return(...Dt)=>{if(typeof Dt[Dt.length-1]==="function"){const rr=Dt.pop();if(St.constructor.name!=="AsyncFunction"){const St=new TypeError("Must be an AsyncFunction");return rr(St)}return St.apply(St,Dt).then((St=>{rr(null,St)}),(St=>{rr(St)}))}else{return St.apply(St,Dt)}}}Dt.wrapAsync=wrapAsync;function sleep(St=1e3){return new Promise((Dt=>{setTimeout((()=>{Dt()}),St)}))}Dt.sleep=sleep;const Gn=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function getParamNames(St){const Dt=St.toString().replace(Gn,"");let rr=Dt.slice(Dt.indexOf("(")+1,Dt.indexOf(")")).split(",").map((St=>St.trim().replace(/\s?=.*$/,"")));if(rr.length===1&&rr[0]===""){rr=[]}return rr}Dt.getParamNames=getParamNames;function generateRandomId(){return Or.randomBytes(16).toString("hex")}Dt.generateRandomId=generateRandomId;function merge(St,Dt){if(!St){St=Dt;Dt=null}if(!St){return null}if(Array.isArray(St)){return St.concat(Dt||[])}if(typeof St==="object"){return Object.assign({},St,Dt)}throw new Error("can not merge meta that type of "+typeof St)}Dt.merge=merge;function toAsyncFunction(St){if(Hr.Types.isAsyncFunction(St)){return St}else{return async function(...Dt){return Promise.resolve(St.call(this,...Dt))}}}Dt.toAsyncFunction=toAsyncFunction;function isTypeScriptEnvironment(){const St=process.env.MIDWAY_TS_MODE;if("false"===St){return false}return St==="true"||!!require.extensions[".ts"]}Dt.isTypeScriptEnvironment=isTypeScriptEnvironment;async function createPromiseTimeoutInvokeChain(St){var Dt;if(!St.onSuccess){St.onSuccess=async St=>St}St.isConcurrent=(Dt=St.isConcurrent)!==null&&Dt!==void 0?Dt:true;St.promiseItems=St.promiseItems.map((St=>{if(St instanceof Promise){return{item:St}}else{return St}}));St.promiseItems=St.promiseItems.filter((St=>St["item"]instanceof Promise));if(St.isConcurrent){const Dt=St.promiseItems.map((Dt=>{const rr=new Promise(((rr,cr)=>{var pr;setTimeout((()=>{var rr;return cr(new Sr.MidwayCodeInvokeTimeoutError(St.methodName,(rr=Dt["timeout"])!==null&&rr!==void 0?rr:St.timeout))}),(pr=Dt["timeout"])!==null&&pr!==void 0?pr:St.timeout)}));return Promise.race([Dt["item"],rr]).then((rr=>St.onSuccess(rr,Dt["meta"]))).catch((rr=>St.onFail(rr,Dt["meta"])))}));return Promise.all(Dt)}else{const Dt=[];for(const rr of St.promiseItems){const cr=new Promise(((Dt,cr)=>{var pr;setTimeout((()=>{var Dt;return cr(new Sr.MidwayCodeInvokeTimeoutError(St.methodName,(Dt=rr["timeout"])!==null&&Dt!==void 0?Dt:St.timeout))}),(pr=rr["timeout"])!==null&&pr!==void 0?pr:St.timeout)}));try{const pr=await Promise.race([rr["item"],cr]).then((Dt=>St.onSuccess(Dt,rr["meta"])));Dt.push(pr)}catch(cr){Dt.push(St.onFail(cr,rr["meta"]));break}}return Dt}}Dt.createPromiseTimeoutInvokeChain=createPromiseTimeoutInvokeChain;Dt.Utils={sleep:sleep,getParamNames:getParamNames,camelCase:$r.camelCase,pascalCase:$r.pascalCase,randomUUID:Er.randomUUID,generateRandomId:generateRandomId,toAsyncFunction:toAsyncFunction,safeStringify:Ir.safeStringify,safeParse:Ir.safeParse,isTypeScriptEnvironment:isTypeScriptEnvironment}},61327:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.getModuleRequirePathList=Dt.PathFileUtil=Dt.getFileContentSync=Dt.isPathEqual=Dt.isPath=void 0;const cr=rr(16928);const pr=rr(79896);function isPath(St){if(/(^[\.\/])|:|\\/.test(St)){return true}return false}Dt.isPath=isPath;function isPathEqual(St,Dt){if(!St||!Dt){return false}const rr=(0,cr.extname)(St);return St.replace(rr,"")===Dt}Dt.isPathEqual=isPathEqual;function getFileContentSync(St,Dt){return typeof St==="string"?(0,pr.readFileSync)(St,{encoding:Dt}):St}Dt.getFileContentSync=getFileContentSync;Dt.PathFileUtil={isPath:isPath,isPathEqual:isPathEqual,getFileContentSync:getFileContentSync};function getModuleRequirePathList(St){const Dt=[St,St.replace(/\//g,"_")];let rr={};const cr=[];Object.keys(require.cache||{}).forEach((St=>{let pr=-1;for(const St of Dt){const Dt=St.indexOf(St);if(Dt!==-1){pr=Dt;break}}if(pr===-1){return}const mr=St.slice(0,pr);if(rr[mr]){return}rr[mr]=true;cr.push(mr)}));rr=undefined;return cr}Dt.getModuleRequirePathList=getModuleRequirePathList},73861:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.PathToRegexpUtil=void 0;function lexer(St){const Dt=[];let rr=0;while(rr<St.length){const cr=St[rr];if(cr==="*"||cr==="+"||cr==="?"){Dt.push({type:"MODIFIER",index:rr,value:St[rr++]});continue}if(cr==="\\"){Dt.push({type:"ESCAPED_CHAR",index:rr++,value:St[rr++]});continue}if(cr==="{"){Dt.push({type:"OPEN",index:rr,value:St[rr++]});continue}if(cr==="}"){Dt.push({type:"CLOSE",index:rr,value:St[rr++]});continue}if(cr===":"){let cr="";let pr=rr+1;while(pr<St.length){const Dt=St.charCodeAt(pr);if(Dt>=48&&Dt<=57||Dt>=65&&Dt<=90||Dt>=97&&Dt<=122||Dt===95){cr+=St[pr++];continue}break}if(!cr)throw new TypeError(`Missing parameter name at ${rr}`);Dt.push({type:"NAME",index:rr,value:cr});rr=pr;continue}if(cr==="("){let cr=1;let pr="";let mr=rr+1;if(St[mr]==="?"){throw new TypeError(`Pattern cannot start with "?" at ${mr}`)}while(mr<St.length){if(St[mr]==="\\"){pr+=St[mr++]+St[mr++];continue}if(St[mr]===")"){cr--;if(cr===0){mr++;break}}else if(St[mr]==="("){cr++;if(St[mr+1]!=="?"){throw new TypeError(`Capturing groups are not allowed at ${mr}`)}}pr+=St[mr++]}if(cr)throw new TypeError(`Unbalanced pattern at ${rr}`);if(!pr)throw new TypeError(`Missing pattern at ${rr}`);Dt.push({type:"PATTERN",index:rr,value:pr});rr=mr;continue}Dt.push({type:"CHAR",index:rr,value:St[rr++]})}Dt.push({type:"END",index:rr,value:""});return Dt}function parse(St,Dt={}){const rr=lexer(St);const{prefixes:cr="./"}=Dt;const pr=`[^${escapeString(Dt.delimiter||"/#?")}]+?`;const mr=[];let gr=0;let yr=0;let Sr="";const tryConsume=St=>{if(yr<rr.length&&rr[yr].type===St)return rr[yr++].value};const mustConsume=St=>{const Dt=tryConsume(St);if(Dt!==undefined)return Dt;const{type:cr,index:pr}=rr[yr];throw new TypeError(`Unexpected ${cr} at ${pr}, expected ${St}`)};const consumeText=()=>{let St="";let Dt;while(Dt=tryConsume("CHAR")||tryConsume("ESCAPED_CHAR")){St+=Dt}return St};while(yr<rr.length){const St=tryConsume("CHAR");const Dt=tryConsume("NAME");const rr=tryConsume("PATTERN");if(Dt||rr){let yr=St||"";if(cr.indexOf(yr)===-1){Sr+=yr;yr=""}if(Sr){mr.push(Sr);Sr=""}mr.push({name:Dt||gr++,prefix:yr,suffix:"",pattern:rr||pr,modifier:tryConsume("MODIFIER")||""});continue}const yr=St||tryConsume("ESCAPED_CHAR");if(yr){Sr+=yr;continue}if(Sr){mr.push(Sr);Sr=""}const $r=tryConsume("OPEN");if($r){const St=consumeText();const Dt=tryConsume("NAME")||"";const rr=tryConsume("PATTERN")||"";const cr=consumeText();mustConsume("CLOSE");mr.push({name:Dt||(rr?gr++:""),pattern:Dt&&!rr?pr:rr,prefix:St,suffix:cr,modifier:tryConsume("MODIFIER")||""});continue}mustConsume("END")}return mr}function compile(St,Dt){return tokensToFunction(parse(St,Dt),Dt)}function tokensToFunction(St,Dt={}){const rr=flags(Dt);const{encode:cr=St=>St,validate:pr=true}=Dt;const mr=St.map((St=>{if(typeof St==="object"){return new RegExp(`^(?:${St.pattern})$`,rr)}}));return Dt=>{let rr="";for(let gr=0;gr<St.length;gr++){const yr=St[gr];if(typeof yr==="string"){rr+=yr;continue}const Sr=Dt?Dt[yr.name]:undefined;const $r=yr.modifier==="?"||yr.modifier==="*";const Er=yr.modifier==="*"||yr.modifier==="+";if(Array.isArray(Sr)){if(!Er){throw new TypeError(`Expected "${yr.name}" to not repeat, but got an array`)}if(Sr.length===0){if($r)continue;throw new TypeError(`Expected "${yr.name}" to not be empty`)}for(let St=0;St<Sr.length;St++){const Dt=cr(Sr[St],yr);if(pr&&!mr[gr].test(Dt)){throw new TypeError(`Expected all "${yr.name}" to match "${yr.pattern}", but got "${Dt}"`)}rr+=yr.prefix+Dt+yr.suffix}continue}if(typeof Sr==="string"||typeof Sr==="number"){const St=cr(String(Sr),yr);if(pr&&!mr[gr].test(St)){throw new TypeError(`Expected "${yr.name}" to match "${yr.pattern}", but got "${St}"`)}rr+=yr.prefix+St+yr.suffix;continue}if($r)continue;const Ir=Er?"an array":"a string";throw new TypeError(`Expected "${yr.name}" to be ${Ir}`)}return rr}}function match(St,Dt){const rr=[];const cr=toRegexp(St,rr,Dt);return regexpToFunction(cr,rr,Dt)}function regexpToFunction(St,Dt,rr={}){const{decode:cr=St=>St}=rr;return function(rr){const pr=St.exec(rr);if(!pr)return false;const{0:mr,index:gr}=pr;const yr=Object.create(null);for(let St=1;St<pr.length;St++){if(pr[St]===undefined)continue;const rr=Dt[St-1];if(rr.modifier==="*"||rr.modifier==="+"){yr[rr.name]=pr[St].split(rr.prefix+rr.suffix).map((St=>cr(St,rr)))}else{yr[rr.name]=cr(pr[St],rr)}}return{path:mr,index:gr,params:yr}}}function escapeString(St){return St.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function flags(St){return St&&St.sensitive?"":"i"}function regexpToRegexp(St,Dt){if(!Dt)return St;const rr=/\((?:\?<(.*?)>)?(?!\?)/g;let cr=0;let pr=rr.exec(St.source);while(pr){Dt.push({name:pr[1]||cr++,prefix:"",suffix:"",modifier:"",pattern:""});pr=rr.exec(St.source)}return St}function arrayToRegexp(St,Dt,rr){const cr=St.map((St=>toRegexp(St,Dt,rr).source));return new RegExp(`(?:${cr.join("|")})`,flags(rr))}function stringToRegexp(St,Dt,rr){return tokensToRegexp(parse(St,rr),Dt,rr)}function tokensToRegexp(St,Dt,rr={}){const{strict:cr=false,start:pr=true,end:mr=true,encode:gr=St=>St,delimiter:yr="/#?",endsWith:Sr=""}=rr;const $r=`[${escapeString(Sr)}]|$`;const Er=`[${escapeString(yr)}]`;let Ir=pr?"^":"";for(const rr of St){if(typeof rr==="string"){Ir+=escapeString(gr(rr))}else{const St=escapeString(gr(rr.prefix));const cr=escapeString(gr(rr.suffix));if(rr.pattern){if(Dt)Dt.push(rr);if(St||cr){if(rr.modifier==="+"||rr.modifier==="*"){const Dt=rr.modifier==="*"?"?":"";Ir+=`(?:${St}((?:${rr.pattern})(?:${cr}${St}(?:${rr.pattern}))*)${cr})${Dt}`}else{Ir+=`(?:${St}(${rr.pattern})${cr})${rr.modifier}`}}else{if(rr.modifier==="+"||rr.modifier==="*"){Ir+=`((?:${rr.pattern})${rr.modifier})`}else{Ir+=`(${rr.pattern})${rr.modifier}`}}}else{Ir+=`(?:${St}${cr})${rr.modifier}`}}}if(mr){if(!cr)Ir+=`${Er}?`;Ir+=!rr.endsWith?"$":`(?=${$r})`}else{const Dt=St[St.length-1];const rr=typeof Dt==="string"?Er.indexOf(Dt[Dt.length-1])>-1:Dt===undefined;if(!cr){Ir+=`(?:${Er}(?=${$r}))?`}if(!rr){Ir+=`(?=${Er}|${$r})`}}return new RegExp(Ir,flags(rr))}function toRegexp(St,Dt,rr){if(St instanceof RegExp)return regexpToRegexp(St,Dt);if(Array.isArray(St))return arrayToRegexp(St,Dt,rr);return stringToRegexp(St,Dt,rr)}Dt.PathToRegexpUtil={toRegexp:toRegexp,compile:compile,parse:parse,match:match}},25198:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.retryWith=Dt.retryWithAsync=void 0;const cr=rr(65308);const pr=rr(86314);function retryWithAsync(St,Dt=1,rr={}){let mr=Dt;let gr;return async(...yr)=>{do{try{return await St.bind(rr.receiver||this)(...yr)}catch(St){gr=St}if(rr.retryInterval>=0){await(0,cr.sleep)(rr.retryInterval)}}while(mr-- >0);if(rr.throwOriginError){throw gr}else{throw new pr.MidwayRetryExceededMaxTimesError(St.name||"anonymous",Dt,gr)}}}Dt.retryWithAsync=retryWithAsync;function retryWith(St,Dt=1,rr={}){let cr=Dt;let mr;return(...gr)=>{do{try{return St.bind(rr.receiver||this)(...gr)}catch(St){mr=St}}while(cr-- >0);if(rr.throwOriginError){throw mr}else{throw new pr.MidwayRetryExceededMaxTimesError(St.name||"anonymous",Dt,mr)}}}Dt.retryWith=retryWith},63289:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Types=Dt.isNullOrUndefined=Dt.isNull=Dt.isUndefined=Dt.isRegExp=Dt.isSet=Dt.isMap=Dt.isProxy=Dt.isNumber=Dt.isPlainObject=Dt.isObject=Dt.isFunction=Dt.isPromise=Dt.isGeneratorFunction=Dt.isAsyncFunction=Dt.isClass=Dt.isString=void 0;const cr=rr(39023);const pr=Function.prototype.toString;const mr=Object.prototype.hasOwnProperty;const gr=Object.prototype.toString;function isString(St){return typeof St==="string"}Dt.isString=isString;function isClass(St){if(typeof St!=="function"){return false}if(/^class[\s{]/.test(pr.call(St))){return true}}Dt.isClass=isClass;function isAsyncFunction(St){return cr.types.isAsyncFunction(St)}Dt.isAsyncFunction=isAsyncFunction;function isGeneratorFunction(St){return cr.types.isGeneratorFunction(St)}Dt.isGeneratorFunction=isGeneratorFunction;function isPromise(St){return cr.types.isPromise(St)}Dt.isPromise=isPromise;function isFunction(St){return typeof St==="function"}Dt.isFunction=isFunction;function isObject(St){return St!==null&&typeof St==="object"}Dt.isObject=isObject;function isPlainObject(St){if(!St||gr.call(St)!=="[object Object]"){return false}const Dt=mr.call(St,"constructor");const rr=St.constructor&&St.constructor.prototype&&mr.call(St.constructor.prototype,"isPrototypeOf");if(St.constructor&&!Dt&&!rr){return false}let cr;for(cr in St){}return typeof cr==="undefined"||mr.call(St,cr)}Dt.isPlainObject=isPlainObject;function isNumber(St){return typeof St==="number"}Dt.isNumber=isNumber;function isProxy(St){return cr.types.isProxy(St)}Dt.isProxy=isProxy;function isMap(St){return cr.types.isMap(St)}Dt.isMap=isMap;function isSet(St){return cr.types.isSet(St)}Dt.isSet=isSet;function isRegExp(St){return cr.types.isRegExp(St)}Dt.isRegExp=isRegExp;function isUndefined(St){return St===undefined}Dt.isUndefined=isUndefined;function isNull(St){return St===null}Dt.isNull=isNull;function isNullOrUndefined(St){return isUndefined(St)||isNull(St)}Dt.isNullOrUndefined=isNullOrUndefined;Dt.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}},2897:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.randomUUID=void 0;const cr=rr(76982);const pr=new Uint8Array(256);let mr=pr.length;function rng(){if(mr>pr.length-16){cr.randomFillSync(pr);mr=0}return pr.slice(mr,mr+=16)}const gr=[];for(let St=0;St<256;++St){gr.push((St+256).toString(16).slice(1))}function unsafeStringify(St,Dt=0){return(gr[St[Dt+0]]+gr[St[Dt+1]]+gr[St[Dt+2]]+gr[St[Dt+3]]+"-"+gr[St[Dt+4]]+gr[St[Dt+5]]+"-"+gr[St[Dt+6]]+gr[St[Dt+7]]+"-"+gr[St[Dt+8]]+gr[St[Dt+9]]+"-"+gr[St[Dt+10]]+gr[St[Dt+11]]+gr[St[Dt+12]]+gr[St[Dt+13]]+gr[St[Dt+14]]+gr[St[Dt+15]]).toLowerCase()}function randomUUID(St){if(!St&&cr["randomUUID"]){return cr["randomUUID"]()}const Dt=rng();Dt[6]=Dt[6]&15|64;Dt[8]=Dt[8]&63|128;return unsafeStringify(Dt)}Dt.randomUUID=randomUUID},46422:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.extractExpressLikeValue=Dt.extractKoaLikeValue=void 0;const cr=rr(49757);const pr=rr(65308);const extractKoaLikeValue=(St,Dt,rr)=>{if(cr.ALL===Dt){Dt=undefined}return function(mr,gr){switch(St){case cr.RouteParamTypes.NEXT:return gr;case cr.RouteParamTypes.BODY:return(0,pr.transformRequestObjectByType)(Dt&&mr.request.body?mr.request.body[Dt]:mr.request.body,rr);case cr.RouteParamTypes.PARAM:return(0,pr.transformRequestObjectByType)(Dt?mr.params[Dt]:mr.params,rr);case cr.RouteParamTypes.QUERY:return(0,pr.transformRequestObjectByType)(Dt?mr.query[Dt]:mr.query,rr);case cr.RouteParamTypes.HEADERS:return(0,pr.transformRequestObjectByType)(Dt?mr.get(Dt):mr.headers,rr);case cr.RouteParamTypes.SESSION:return(0,pr.transformRequestObjectByType)(Dt?mr.session[Dt]:mr.session,rr);case cr.RouteParamTypes.FILESTREAM:if(mr.getFileStream){return mr.getFileStream(Dt)}else if(mr.files){if(Array.isArray(mr.files)){return mr.files[0]}else{return mr.files}}else{return undefined}case cr.RouteParamTypes.FILESSTREAM:if(mr.multipart){return mr.multipart(Dt)}else if(mr.files){return mr.files}else{return undefined}case cr.RouteParamTypes.REQUEST_PATH:return mr["path"];case cr.RouteParamTypes.REQUEST_IP:return mr["ip"];case cr.RouteParamTypes.QUERIES:if(mr.queries){return(0,pr.transformRequestObjectByType)(Dt?mr.queries[Dt]:mr.queries,rr)}else{return(0,pr.transformRequestObjectByType)(Dt?mr.query[Dt]:mr.query,rr)}case cr.RouteParamTypes.FIELDS:return Dt?mr.fields[Dt]:mr.fields;case cr.RouteParamTypes.CUSTOM:return Dt?Dt(mr):undefined;default:return null}}};Dt.extractKoaLikeValue=extractKoaLikeValue;const extractExpressLikeValue=(St,Dt,rr)=>{if(cr.ALL===Dt){Dt=undefined}return function(mr,gr,yr){switch(St){case cr.RouteParamTypes.NEXT:return yr;case cr.RouteParamTypes.BODY:return(0,pr.transformRequestObjectByType)(Dt&&mr.body?mr.body[Dt]:mr.body,rr);case cr.RouteParamTypes.PARAM:return(0,pr.transformRequestObjectByType)(Dt?mr.params[Dt]:mr.params,rr);case cr.RouteParamTypes.QUERY:return(0,pr.transformRequestObjectByType)(Dt?mr.query[Dt]:mr.query,rr);case cr.RouteParamTypes.HEADERS:return(0,pr.transformRequestObjectByType)(Dt?mr.get(Dt):mr.headers,rr);case cr.RouteParamTypes.SESSION:return(0,pr.transformRequestObjectByType)(Dt?mr.session[Dt]:mr.session,rr);case cr.RouteParamTypes.FILESTREAM:return mr.files?mr.files[0]:undefined;case cr.RouteParamTypes.FILESSTREAM:return mr.files;case cr.RouteParamTypes.REQUEST_PATH:return mr["baseUrl"];case cr.RouteParamTypes.REQUEST_IP:return mr["ip"];case cr.RouteParamTypes.QUERIES:if(mr.queries){return(0,pr.transformRequestObjectByType)(Dt?mr.queries[Dt]:mr.queries,rr)}else{return(0,pr.transformRequestObjectByType)(Dt?mr.query[Dt]:mr.query,rr)}case cr.RouteParamTypes.FIELDS:return Dt?mr.fields[Dt]:mr.fields;case cr.RouteParamTypes.CUSTOM:return Dt?Dt(mr,gr):undefined;default:return null}}};Dt.extractExpressLikeValue=extractExpressLikeValue},73317:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.AbstractEventBus=Dt.AckResponder=Dt.createWaitHandler=void 0;const cr=rr(48001);const pr=rr(39023);const mr=rr(68108);const gr="_default_";const yr=null;function revertError(St){const Dt=new Error;Dt.name=St.name;Dt.message=St.message;Dt.stack=St.stack;return Dt}class MessageLimitSet extends Set{constructor(St){super();this.limit=St}add(St){if(this.size<this.limit){return super.add(St)}}}async function createWaitHandler(St,Dt={}){await new Promise(((rr,cr)=>{const pr=setTimeout((()=>{clearInterval(gr);clearTimeout(pr);cr(new mr.EventBusTimeoutError)}),Dt.timeout||5e3);const gr=setInterval((()=>{if(St()){clearInterval(gr);clearTimeout(pr);rr(true)}}),Dt.timeoutCheckInterval||500)}))}Dt.createWaitHandler=createWaitHandler;class ChunkIterator{constructor(St){this.debugLogger=St;this.buffer=[]}publish(St){this.buffer.push(St);if(this.waitingPromiseDeferred){const St=this.waitingPromiseDeferred;this.waitingPromiseDeferred=null;St.resolve(this.buffer.shift())}}error(St){if(this.waitingPromiseDeferred){const Dt=this.waitingPromiseDeferred;this.waitingPromiseDeferred=null;Dt.reject(St)}else{this.errorRisen=St}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 St={};St.promise=new Promise(((Dt,rr)=>{St.resolve=Dt;St.reject=rr}));this.waitingPromiseDeferred=St;return St.promise}}async next(){this.debugLogger("1 ChunkIterator run next and wait data");const{data:St,isEnd:Dt}=await this.tryToGetNextData();this.debugLogger("2 ChunkIterator get data",St,Dt);if(Dt){this.clear();return{value:undefined,done:true}}else{return{value:St,done:false}}}clear(){this.buffer.length=0}}class AckResponder{constructor(){this.isEndFlag=false}onData(St){this.dataHandler=St}onError(St){this.errorHandler=St}end(St){if(!this.isEndFlag){this.isEndFlag=true;if(St){this.sendData(St)}this.sendData(yr)}}sendData(St){if(this.dataHandler){this.dataHandler(St)}}send(St){if(!this.isEndFlag){this.sendData(St)}}error(St){if(!this.isEndFlag){if(this.errorHandler){this.errorHandler(St)}}}isEnd(){return this.isEndFlag}}Dt.AckResponder=AckResponder;class AbstractEventBus{constructor(St={}){this.options=St;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(cr.ListenerType.Error,(St=>{console.error(St)}));this.listener=(St,Dt)=>{var rr,pr;const mr=this.topicListener.get(((rr=St.messageOptions)===null||rr===void 0?void 0:rr.topic)||gr);if(mr){for(const rr of mr){if(rr["_subscribeOnce"]){mr.delete(rr)}new Promise((async(cr,pr)=>{try{await cr(rr(St,Dt))}catch(St){pr(St)}})).catch((St=>{if(Dt){Dt.error(St)}else{this.eventListenerMap.get(cr.ListenerType.Error)(St)}}))}}else{const rr=((pr=St.messageOptions)===null||pr===void 0?void 0:pr.topic)||gr;if(!this.topicMessageCache.has(rr)){this.topicMessageCache.set(rr,new MessageLimitSet(10))}this.topicMessageCache.get(rr).add({message:St,responder:Dt})}};this.setupEventBind()}createDebugger(){return(0,pr.debuglog)(`midway:event-bus:${this.isWorker()?"worker":"main "}`)}debugDataflow(St){if(St.messageCategory===cr.MessageCategory.IN){if(this.isMain()){return`${St.message.type}|${St.messageCategory}: worker => main(△)`}else{return`${St.message.type}|${St.messageCategory}: main => worker(△)`}}else{if(this.isMain()){return`${St.message.type}|${St.messageCategory}: main(△) => worker`}else{return`${St.message.type}|${St.messageCategory}: worker(△) => main`}}}async start(St){this.isInited=true;if(this.isMain()){await createWaitHandler((()=>this.isAllWorkerReady()),{timeout:this.options.initTimeout,timeoutCheckInterval:this.options.initTimeoutCheckInterval})}else{this.workerSubscribeMessage((St=>{this.transit({messageCategory:cr.MessageCategory.IN,message:St})}));this.transit({messageCategory:cr.MessageCategory.OUT,message:{messageId:this.generateMessageId(),workerId:this.getWorkerId(),type:cr.MessageType.Inited,body:this.isInited,error:St?{name:St.name,message:St.message,stack:St.stack}:undefined}})}}addWorker(St){this.debugLogger(`Add worker(${this.getWorkerId(St)})`);if(!this.workerReady.has(this.getWorkerId(St))){this.debugLogger(`Init worker(${this.getWorkerId(St)}) status = false`);this.workerReady.set(this.getWorkerId(St),{worker:St,ready:false})}else{this.debugLogger(`Skip init worker(${this.getWorkerId(St)}) status`)}St===null||St===void 0?void 0:St["on"]("exit",(async Dt=>{if(!this.stopping){this.workerReady.delete(this.getWorkerId(St));const Dt=this.workers.findIndex((Dt=>this.getWorkerId(Dt)===this.getWorkerId(St)));this.workers.splice(Dt,1)}}));this.workerListenMessage(St,(St=>{this.transit({messageCategory:cr.MessageCategory.IN,message:St})}));this.workers.push(St)}isAllWorkerReady(){for(const[St,Dt]of this.workerReady){if(!Dt||!Dt.ready){this.debugLogger(`Worker(${St}) not ready.`);return false}}if(this.workerReady.size>0){this.debugLogger(`All worker(size=${this.workerReady.size}) is ready.`)}return true}setupEventBind(){this.messageReceiver=St=>{var Dt,rr,pr,mr,gr,Sr,$r,Er,Ir,Or,Hr,Gr,Tn,Wn,Gn;if(!St.message||!St.message.messageId){return}this.debugLogger("EventCenter(%s) message = %j",this.debugDataflow(St),St);const mi=St.message;if(St.messageCategory===cr.MessageCategory.OUT){if(mi.type===cr.MessageType.Invoke||mi.type===cr.MessageType.Request||mi.type===cr.MessageType.Response||mi.type===cr.MessageType.Broadcast){this.postMessage(mi);(Dt=this.eventListenerMap.get(cr.ListenerType.Request))===null||Dt===void 0?void 0:Dt(mi)}else if(mi.type===cr.MessageType.Inited){this.postMessage(mi);(rr=this.eventListenerMap.get(cr.ListenerType.Inited))===null||rr===void 0?void 0:rr(mi)}}else if(St.messageCategory===cr.MessageCategory.IN){if(mi.type===cr.MessageType.Invoke){const St=((pr=mi.messageOptions)===null||pr===void 0?void 0:pr["isChunk"])===true;const Dt=new AckResponder;Dt.onData((rr=>{var pr;this.transit({messageCategory:cr.MessageCategory.OUT,message:{messageId:this.generateMessageId(),workerId:this.getWorkerId(),type:cr.MessageType.Response,body:rr,messageOptions:{relatedMessageId:mi.messageId,isChunk:St,topic:(pr=mi.messageOptions)===null||pr===void 0?void 0:pr.topic}}});if(!St){Dt.end()}}));Dt.onError((rr=>{this.publish(rr,{relatedMessageId:mi.messageId,isChunk:St});Dt.end()}));(mr=this.listener)===null||mr===void 0?void 0:mr.call(this,mi,Dt);(gr=this.eventListenerMap.get(cr.ListenerType.Subscribe))===null||gr===void 0?void 0:gr(mi)}else if(mi.type===cr.MessageType.Request){(Sr=this.listener)===null||Sr===void 0?void 0:Sr.call(this,mi);($r=this.eventListenerMap.get(cr.ListenerType.Subscribe))===null||$r===void 0?void 0:$r(mi)}else if(mi.type===cr.MessageType.Broadcast){if(this.isMain()){if(mi.messageOptions["includeMainFromWorker"]===true){(Er=this.listener)===null||Er===void 0?void 0:Er.call(this,mi);(Ir=this.eventListenerMap.get(cr.ListenerType.Subscribe))===null||Ir===void 0?void 0:Ir(mi)}this.broadcast(mi.body,{...mi.messageOptions,relatedMessageId:mi.messageId,relatedWorkerId:mi.workerId})}else{(Or=this.listener)===null||Or===void 0?void 0:Or.call(this,mi);(Hr=this.eventListenerMap.get(cr.ListenerType.Subscribe))===null||Hr===void 0?void 0:Hr(mi)}}else if(mi.type===cr.MessageType.Response){if((Gr=mi.messageOptions)===null||Gr===void 0?void 0:Gr.relatedMessageId){const St=this.asyncMessageMap.get(mi.messageOptions.relatedMessageId);const Dt=mi.messageOptions["isChunk"]===true;if(St){if(!Dt||Dt&&mi.body===yr){this.asyncMessageMap.delete(mi.messageOptions.relatedMessageId)}St(mi.error?revertError(mi.error):undefined,mi.body,Dt?mi.body===yr:true)}else{}}else{(Tn=this.listener)===null||Tn===void 0?void 0:Tn.call(this,mi);(Wn=this.eventListenerMap.get(cr.ListenerType.Subscribe))===null||Wn===void 0?void 0:Wn(mi)}}else if(mi.type===cr.MessageType.Inited){if(this.isMain()){if(mi.error){this.debugLogger(`got worker ${mi.workerId} ready failed`);this.eventListenerMap.get(cr.ListenerType.Error)(revertError(mi.error))}else{(Gn=this.eventListenerMap.get(cr.ListenerType.Inited))===null||Gn===void 0?void 0:Gn(mi);this.workerReady.get(mi.workerId).ready=true;this.debugLogger(`got worker ${mi.workerId} ready`)}}else{}}}}}transit(St){this.messageReceiver(St)}subscribe(St,Dt={}){const rr=Dt.topic||gr;if(!this.topicListener.has(rr)){this.topicListener.set(rr,new Set)}if(Dt.subscribeOnce){St["_subscribeOnce"]=true}this.topicListener.get(rr).add(St);St["_abortController"]={abort:()=>{this.topicListener.get(rr).delete(St)}};if(this.topicMessageCache.has(rr)&&this.topicMessageCache.get(rr).size>0){for(const St of this.topicMessageCache.get(rr)){this.listener(St.message,St.responder);if(Dt.subscribeOnce){break}}this.topicMessageCache.get(rr).clear()}return St["_abortController"]}subscribeOnce(St,Dt={}){Dt.subscribeOnce=true;return this.subscribe(St,Dt)}publish(St,Dt={}){if(St instanceof Error){this.transit({messageCategory:cr.MessageCategory.OUT,message:{messageId:Dt.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:this.isMain()?cr.MessageType.Request:cr.MessageType.Response,body:undefined,error:{name:St.name,message:St.message,stack:St.stack},messageOptions:Dt}})}else{this.transit({messageCategory:cr.MessageCategory.OUT,message:{messageId:Dt.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:this.isMain()?cr.MessageType.Request:cr.MessageType.Response,body:St,messageOptions:Dt}})}}publishAsync(St,Dt={}){return new Promise(((rr,pr)=>{const mr=Dt.relatedMessageId||this.generateMessageId();this.useTimeout(mr,Dt.timeout,rr,pr);this.transit({messageCategory:cr.MessageCategory.OUT,message:{messageId:mr,workerId:this.getWorkerId(),type:cr.MessageType.Invoke,body:St,messageOptions:{topic:Dt.topic,dispatchToken:Dt.dispatchToken}}})}))}publishChunk(St,Dt={}){const rr=Dt.relatedMessageId||this.generateMessageId();const pr=new ChunkIterator(this.debugLogger);this.useTimeout(rr,Dt.timeout,((St,Dt)=>{pr.publish({data:St,isEnd:Dt})}),(St=>{pr.error(St)}));this.transit({messageCategory:cr.MessageCategory.OUT,message:{messageId:rr,workerId:this.getWorkerId(),type:this.isMain()?cr.MessageType.Invoke:cr.MessageType.Response,body:St,messageOptions:{isChunk:true,topic:Dt.topic}}});return pr}useTimeout(St,Dt=5e3,rr,cr){const pr=setTimeout((()=>{clearTimeout(pr);this.asyncMessageMap.delete(St);cr(new mr.EventBusPublishTimeoutError(St))}),Dt);this.asyncMessageMap.set(St,((St,Dt,mr)=>{if(mr||St){clearTimeout(pr)}if(St){cr(St)}else{rr(Dt,mr)}}))}broadcast(St,Dt={}){if(this.isWorker()){Dt={includeMainFromWorker:false,includeSelfFromWorker:false,...Dt}}this.transit({messageCategory:cr.MessageCategory.OUT,message:{messageId:Dt.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:cr.MessageType.Broadcast,body:St,messageOptions:Dt}})}postMessage(St){var Dt,rr,pr,gr,yr,Sr,$r,Er;if(this.isMain()){if(this.workers.length>0){if(St.type===cr.MessageType.Broadcast){if(St.messageOptions&&St.messageOptions["relatedWorkerId"]){this.workers.forEach((Dt=>{if(St.messageOptions["includeSelfFromWorker"]===false&&this.getWorkerId(Dt)===St.messageOptions["relatedWorkerId"]){return}else{this.mainSendMessage(Dt,St)}}))}else{this.workers.forEach((Dt=>this.mainSendMessage(Dt,St)))}}else if((Dt=St.messageOptions)===null||Dt===void 0?void 0:Dt["targetWorkerId"]){const Dt=(pr=this.workerReady.get((rr=St.messageOptions)===null||rr===void 0?void 0:rr["targetWorkerId"]))===null||pr===void 0?void 0:pr.worker;if(!Dt){throw new mr.EventBusPublishSpecifyWorkerError((gr=St.messageOptions)===null||gr===void 0?void 0:gr["targetWorkerId"])}this.mainSendMessage(Dt,St)}else{if(this.options.dispatchStrategy){const Dt=this.options.dispatchStrategy(this.workers,(yr=St.messageOptions)===null||yr===void 0?void 0:yr.dispatchToken);if(Dt){try{this.mainSendMessage(Dt,St)}catch(Dt){(Sr=this.eventListenerMap.get(cr.ListenerType.Error))===null||Sr===void 0?void 0:Sr(new mr.EventBusMainPostError(St,Dt))}}else{throw new mr.EventBusDispatchStrategyError}}else{const[Dt,...rr]=this.workers;try{this.mainSendMessage(Dt,St)}catch(Dt){($r=this.eventListenerMap.get(cr.ListenerType.Error))===null||$r===void 0?void 0:$r(new mr.EventBusMainPostError(St,Dt))}this.workers=[...rr,Dt]}}}}else{try{this.workerSendMessage(St)}catch(Dt){(Er=this.eventListenerMap.get(cr.ListenerType.Error))===null||Er===void 0?void 0:Er(new mr.EventBusWorkerPostError(St,Dt))}}}onInited(St){this.eventListenerMap.set(cr.ListenerType.Inited,St)}onPublish(St){this.eventListenerMap.set(cr.ListenerType.Request,St)}onSubscribe(St){this.eventListenerMap.set(cr.ListenerType.Subscribe,St)}onError(St){this.eventListenerMap.set(cr.ListenerType.Error,St)}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)}}Dt.AbstractEventBus=AbstractEventBus},4779:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ChildProcessEventBus=void 0;const cr=rr(73317);const pr=rr(29907);const mr=rr(932);class ChildProcessEventBus extends cr.AbstractEventBus{workerSubscribeMessage(St){mr.on("message",St)}workerListenMessage(St,Dt){St.on("message",Dt)}workerSendMessage(St){mr.send(St)}mainSendMessage(St,Dt){St.send(Dt)}isMain(){return!this.isWorker()}isWorker(){var St;return(St=this.options.isWorker)!==null&&St!==void 0?St:pr.isWorker}getWorkerId(St){var Dt;return String(St?(Dt=St.pid)!==null&&Dt!==void 0?Dt:St===null||St===void 0?void 0:St["process"].pid:mr.pid)}}Dt.ChildProcessEventBus=ChildProcessEventBus},68108:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.EventBusDispatchStrategyError=Dt.EventBusPublishSpecifyWorkerError=Dt.EventBusWorkerPostError=Dt.EventBusMainPostError=Dt.EventBusTimeoutError=Dt.EventBusPublishTimeoutError=void 0;const cr=rr(39023);class EventBusPublishTimeoutError extends Error{constructor(St){super(`Message(${St}) publish timeout.`);this.name="EventBusPublishTimeoutError"}}Dt.EventBusPublishTimeoutError=EventBusPublishTimeoutError;class EventBusTimeoutError extends Error{constructor(){super("Waiting for ready timeout throws this error.");this.name="EventBusTimeoutError"}}Dt.EventBusTimeoutError=EventBusTimeoutError;class EventBusMainPostError extends Error{constructor(St,Dt){super((0,cr.format)("Main thread post message [%j] error => %s.",St,Dt.stack));this.name="EventBusMainPostError"}}Dt.EventBusMainPostError=EventBusMainPostError;class EventBusWorkerPostError extends Error{constructor(St,Dt){super((0,cr.format)("Worker post message [%j] error => %j.",St,Dt.stack));this.name="EventBusWorkerPostError"}}Dt.EventBusWorkerPostError=EventBusWorkerPostError;class EventBusPublishSpecifyWorkerError extends Error{constructor(St){super((0,cr.format)("Worker(%s) not find in ready map, maybe it is a wrong pid.",St));this.name="EventBusPublishSpecifyWorkerError"}}Dt.EventBusPublishSpecifyWorkerError=EventBusPublishSpecifyWorkerError;class EventBusDispatchStrategyError extends Error{constructor(){super("Dispatch strategy not found a worker and stop post.");this.name="EventBusDispatchStrategyError"}}Dt.EventBusDispatchStrategyError=EventBusDispatchStrategyError},5982:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});pr(rr(41836),Dt);pr(rr(4779),Dt);pr(rr(97633),Dt);pr(rr(68108),Dt);pr(rr(48001),Dt)},48001:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MessageCategory=Dt.ListenerType=Dt.MessageType=void 0;var rr;(function(St){St["Inited"]="inited";St["Request"]="request";St["Response"]="response";St["Invoke"]="invoke";St["Broadcast"]="broadcast"})(rr=Dt.MessageType||(Dt.MessageType={}));var cr;(function(St){St["Inited"]="inited";St["Request"]="request";St["Subscribe"]="Subscribe";St["WorkerChanged"]="worker_changed";St["Error"]="error"})(cr=Dt.ListenerType||(Dt.ListenerType={}));var pr;(function(St){St["IN"]="in";St["OUT"]="out"})(pr=Dt.MessageCategory||(Dt.MessageCategory={}))},97633:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.LocalEventBus=void 0;const cr=rr(73317);class LocalDispatcher{constructor(){this.pidIdx=0;this.initMessageQueue=[]}clear(){this.mainWorker=null;this.childWorker=null;this.pidIdx=0}generatePid(){return this.pidIdx++}}const pr=new LocalDispatcher;class LocalWorker{constructor(St){this.pid=St}onMessage(St){this.handler=St}on(){}getWorkerId(){return this.pid}terminate(){}}class LocalEventBus extends cr.AbstractEventBus{constructor(St={}){super(St);this.worker=new LocalWorker(pr.generatePid());if(this.isMain()){this.debugLogger(`Main id=${this.worker.getWorkerId()}`);pr.mainWorker=this.worker}else{this.debugLogger(`Child id=${this.worker.getWorkerId()}`);pr.childWorker=this.worker}}workerSubscribeMessage(St){if(this.isWorker()){pr.childWorker.onMessage(St)}}workerListenMessage(St,Dt){if(this.isMain()){pr.mainWorker.onMessage(Dt)}}workerSendMessage(St){if(pr.mainWorker.handler){pr.mainWorker.handler(St)}else{pr.initMessageQueue.push({to:"main",message:St})}}mainSendMessage(St,Dt){if(pr.childWorker.handler){pr.childWorker.handler(Dt)}else{pr.initMessageQueue.push({to:"worker",message:Dt})}}getWorkerId(St){return String((St||this.worker).getWorkerId())}isMain(){return!this.isWorker()}isWorker(){return this.options.isWorker}async start(St){if(this.isMain()){await(0,cr.createWaitHandler)((()=>pr.childWorker!=null),{timeout:this.options.waitWorkerTimeout,timeoutCheckInterval:this.options.waitWorkerCheckInterval||200});this.addWorker(pr.childWorker);if(pr.initMessageQueue.length){pr.initMessageQueue.forEach((({to:St,message:Dt})=>{if(St==="worker"){this.mainSendMessage(pr.childWorker,Dt)}else{this.workerSendMessage(Dt)}}));pr.initMessageQueue=[]}}await super.start(St)}async stop(){pr.clear();await super.stop()}}Dt.LocalEventBus=LocalEventBus},41836:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ThreadEventBus=void 0;const cr=rr(28167);const pr=rr(73317);class ThreadEventBus extends pr.AbstractEventBus{constructor(St={}){super(St);if(!this.options.encoder){this.options.encoder=St=>St}if(!this.options.decoder){this.options.decoder=St=>St}}workerSubscribeMessage(St){cr.parentPort.on("message",(Dt=>{St(this.options.decoder(Dt))}))}workerListenMessage(St,Dt){St.on("message",(St=>{Dt(this.options.decoder(St))}))}workerSendMessage(St){cr.parentPort.postMessage(this.options.encoder(St))}mainSendMessage(St,Dt){St.postMessage(this.options.encoder(Dt))}isMain(){return!this.isWorker()}isWorker(){var St;return(St=this.options.isWorker)!==null&&St!==void 0?St:!cr.isMainThread}getWorkerId(St){return String(St?St.threadId:cr.threadId)}}Dt.ThreadEventBus=ThreadEventBus},62525:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.run=void 0;const cr=rr(79896);const pr=rr(16928);const mr=rr(63268);const gr=rr(39023);const yr=rr(70857);const Sr=(0,gr.debuglog)("midway:glob");function formatWindowsPath(St){if(yr.platform()==="win32"&&St){return St.map((St=>St.split(pr.sep).join(pr.posix.sep)))}return St}const run=(St,Dt={cwd:process.cwd(),ignore:[]})=>{Sr(`midway glob pattern = ${St}, options = ${JSON.stringify(Dt)}`);const rr=Date.now();const gr=Dt.cwd;St=formatWindowsPath(St)||[];Sr(`after format pattern = ${St}`);const yr=mr(St,{ignore:formatWindowsPath(Dt.ignore)||[]});const $r=mr("**",{ignore:formatWindowsPath(Dt.ignore)||[]});function globDirectory(St,Dt,rr,mr){if(!(0,cr.existsSync)(St)){return[]}const yr=(0,cr.readdirSync)(St);const $r=[];for(let Er of yr){const yr=(0,pr.resolve)(St,Er);Sr(`resolvePath = ${yr}`);const Ir=(0,cr.statSync)(yr);if(Ir.isDirectory()&&rr(yr.replace(gr,""))){const St=globDirectory(yr,Dt,rr,mr);$r.push(...St)}else if(Ir.isFile()&&Dt(yr.replace(gr,""))){$r.push(yr)}}return $r}const Er=globDirectory(gr,yr,$r,Dt);Sr(`midway glob timing ${Date.now()-rr}ms`);return Er};Dt.run=run},18309:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.httpProxy=void 0;Dt.httpProxy={enable:true}},94713:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.HttpProxyConfiguration=void 0;const mr=rr(46123);const gr=rr(18309);const yr=rr(25747);let Sr=class HttpProxyConfiguration{async onReady(){if(this.httpProxy.enable){this.applicationManager.getApplications(["koa","faas","express","egg"]).forEach((St=>{St.useMiddleware(yr.HttpProxyMiddleware)}))}}};cr([(0,mr.Inject)(),pr("design:type",mr.MidwayApplicationManager)],Sr.prototype,"applicationManager",void 0);cr([(0,mr.Config)("httpProxy"),pr("design:type",Object)],Sr.prototype,"httpProxy",void 0);Sr=cr([(0,mr.Configuration)({namespace:"http-proxy",importConfigs:[{default:gr}]})],Sr);Dt.HttpProxyConfiguration=Sr},62487:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.Configuration=void 0;var mr=rr(94713);Object.defineProperty(Dt,"Configuration",{enumerable:true,get:function(){return mr.HttpProxyConfiguration}});pr(rr(93468),Dt);pr(rr(25747),Dt)},93468:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},25747:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.HttpProxyMiddleware=void 0;const mr=rr(46123);const gr=rr(12593);let yr=class HttpProxyMiddleware{resolve(St){if(St.getNamespace()==="express"){return async(St,Dt,rr)=>this.execProxy(St,St,Dt,rr,false)}else{const Dt=St.getNamespace()==="faas";return async(St,rr)=>{var cr;const pr=((cr=St.request)===null||cr===void 0?void 0:cr.req)||St.request;return this.execProxy(St,pr,St,rr,Dt)}}}async execProxy(St,Dt,rr,cr,pr){var mr,yr,Sr;const $r=this.getProxyList(St.url);if(!$r){return cr()}const{proxy:Er,url:Ir}=$r;const Or={};for(const rr of Object.keys(Dt.headers)){if(((mr=Er.ignoreHeaders)===null||mr===void 0?void 0:mr[rr])||St.header[rr]===undefined){continue}Or[rr.toLowerCase()]=St.header[rr]}const Hr=Dt.headers["x-forwarded-for"];Or["x-forwarded-for"]=Hr?`${Hr}, ${St.ip}`:St.ip;Or["host"]=Ir.host;delete Or["content-length"];const Gr=Dt.method.toUpperCase();const Tn=rr.res||rr;const Wn=!pr&&Tn.on&&Tn.writable;const Gn={method:Gr,url:Ir.href,headers:Or,responseType:Wn?"stream":"arrayBuffer",timeout:this.httpProxy.proxyTimeout||0};if(Gr==="POST"||Gr==="PUT"){Gn.data=(yr=Dt.body)!==null&&yr!==void 0?yr:(Sr=St.request)===null||Sr===void 0?void 0:Sr.body;if(Dt.headers["content-type"]==="application/x-www-form-urlencoded"&&typeof Gn.data!=="string"){Gn.data=Object.keys(Gn.data).map((St=>`${encodeURIComponent(St)}=${encodeURIComponent(Gn.data[St])}`)).join("&")}}const mi=await gr(Gn).catch((St=>{if(!St||!St.response){throw St||new Error("proxy unknown error")}return St.response}));rr.type=mi.headers["content-type"];const $i={"transfer-encoding":true};if(Wn){$i["content-length"]=true}Object.keys(mi.headers).forEach((St=>{if($i[St.toLowerCase()]){return}rr.set(St,mi.headers[St])}));rr.status=mi.status;if(Wn){await new Promise((St=>{Tn.on("finish",(()=>{if(Tn.end){Tn.end()}St(void 0)}));mi.data.pipe(Tn)}))}else{rr.body=mi.data}}getProxyList(St){if(!this.httpProxy){return}this.httpProxy.default=this.httpProxy.default||{};const Dt=this.httpProxy.match?[this.httpProxy]:this.httpProxy.strategy?Object.values(this.httpProxy.strategy).map((St=>Object.assign({},this.httpProxy.default,St))):[];for(const rr of Dt){if(!rr.match){continue}if(!rr.match.test(St)){continue}if(rr.host){if(St[0]==="/"){St=rr.host+St}const Dt=new URL(St);return{proxy:rr,url:Dt}}else if(rr.target){const Dt=St.replace(rr.match,rr.target);return{proxy:rr,url:new URL(Dt)}}}}static getName(){return"http-proxy"}};cr([(0,mr.Config)("httpProxy"),pr("design:type",Object)],yr.prototype,"httpProxy",void 0);cr([(0,mr.Logger)(),pr("design:type",Object)],yr.prototype,"logger",void 0);yr=cr([(0,mr.Middleware)()],yr);Dt.HttpProxyMiddleware=yr},84845:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.i18n=void 0;const cr=rr(46123);Dt.i18n={defaultLocale:"en_US",localeTable:{en_US:{}},fallbacks:{},writeCookie:true,resolver:{queryField:"locale",cookieField:{fieldName:"locale",cookieDomain:"",cookieMaxAge:cr.FORMAT.MS.ONE_YEAR}},localsField:"i18n",missingKeyHandler:St=>St}},30673:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.I18nConfiguration=void 0;const mr=rr(46123);const gr=rr(84845);const yr=rr(82027);let Sr=class I18nConfiguration{async onReady(){this.applicationManager.getApplications(["koa","egg","faas","express"]).forEach((St=>{St.useMiddleware(yr.I18nMiddleware)}))}};cr([(0,mr.Inject)(),pr("design:type",mr.MidwayApplicationManager)],Sr.prototype,"applicationManager",void 0);Sr=cr([(0,mr.Configuration)({namespace:"i18n",importConfigs:[{default:gr}]})],Sr);Dt.I18nConfiguration=Sr},35632:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayI18nService=Dt.MidwayI18nServiceSingleton=void 0;const mr=rr(46123);const gr=rr(77460);const yr=rr(65675);const Sr=rr(15578);let $r=class MidwayI18nServiceSingleton{constructor(){this.localeTextMap=new Map;this.fallbackMatch=[];this.localeMatchCache={}}async init(){this.defaultLocale=(0,Sr.formatLocale)(this.i18nConfig.defaultLocale);for(const St in this.i18nConfig.localeTable){this.addLocale(St,getES6Object(this.i18nConfig.localeTable[St]))}for(const St in this.i18nConfig.fallbacks){this.fallbackMatch.push({pattern:yr((0,Sr.formatLocale)(St)),locale:(0,Sr.formatLocale)(this.i18nConfig.fallbacks[St])})}}addLocale(St,Dt){const rr=getMap(this.localeTextMap,St,true);for(const St in Dt){if(typeof Dt[St]==="string"){getMap(rr,"default").set(St,Dt[St])}else{for(const cr in Dt[St]){getMap(rr,St).set(cr,Dt[St][cr])}}}}translate(St,Dt={}){var rr,cr,pr;const mr=(0,Sr.formatLocale)((rr=Dt.locale)!==null&&rr!==void 0?rr:this.defaultLocale);const gr=(cr=Dt.args)!==null&&cr!==void 0?cr:[];const yr=(pr=Dt.group)!==null&&pr!==void 0?pr:"default";let $r=this.getLocaleMappingText(mr,St,yr,gr);if(!$r&&mr!==this.defaultLocale){if(this.fallbackMatch.length){const Dt=this.fallbackMatch.find((St=>{if(St.pattern(mr)){return true}}));if(Dt){$r=this.getLocaleMappingText(Dt.locale,St,yr,gr)}}if(!$r){$r=this.getLocaleMappingText(this.defaultLocale,St,yr,gr)}}if(!$r&&this.i18nConfig.missingKeyHandler){$r=this.i18nConfig.missingKeyHandler(St,Dt)}return $r}getAvailableLocale(St,Dt="default"){St=(0,Sr.formatLocale)(St);if(this.localeMatchCache[St+"_"+Dt]){return this.localeMatchCache[St+"_"+Dt]}if(this.localeTextMap.has(St)&&this.localeTextMap.get(St).has(Dt)){this.localeMatchCache[St+"_"+Dt]=St;return St}if(this.fallbackMatch.length){const rr=this.fallbackMatch.find((rr=>{if(rr.pattern(St)){if(this.localeTextMap.has(rr.locale)&&this.localeTextMap.get(rr.locale).has(Dt)){this.localeMatchCache[St+"_"+Dt]=rr.locale;return true}}}));if(rr){return rr.locale}}this.localeMatchCache[St+"_"+Dt]=this.defaultLocale;return this.defaultLocale}hasAvailableLocale(St){St=(0,Sr.formatLocale)(St);if(this.localeTextMap.has(St)){return true}if(this.fallbackMatch.length){const Dt=this.fallbackMatch.find((Dt=>{if(Dt.pattern(St)){if(this.localeTextMap.has(Dt.locale)){return true}}}));if(Dt){return true}}return false}getLocaleMapping(St,Dt="default"){St=(0,Sr.formatLocale)(St);const rr=this.localeTextMap.get(St);if(rr){return rr.get(Dt)}}getDefaultLocale(){return this.defaultLocale}getLocaleMappingText(St,Dt,rr,cr){const pr=this.localeTextMap.get(St);if(pr){const St=pr.get(rr);if(St){const rr=St.get(Dt);if(rr){return formatText(rr,cr)}}}}};cr([(0,mr.Config)("i18n"),pr("design:type",Object)],$r.prototype,"i18nConfig",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],$r.prototype,"init",null);$r=cr([(0,mr.Provide)(),(0,mr.Scope)(mr.ScopeEnum.Singleton)],$r);Dt.MidwayI18nServiceSingleton=$r;let Er=class MidwayI18nService{translate(St,Dt={}){if(!Dt.locale){Dt.locale=this.ctx.getAttr&&this.ctx.getAttr(gr.I18N_ATTR_KEY)}return this.i18nServiceSingleton.translate(St,Dt)}addLocale(St,Dt){this.i18nServiceSingleton.addLocale(St,Dt)}getLocaleMapping(St,Dt="default"){return this.i18nServiceSingleton.getLocaleMapping(St,Dt)}getDefaultLocale(){return this.i18nServiceSingleton.getDefaultLocale()}saveRequestLocale(St){var Dt,rr;if(St){(Dt=this.ctx)===null||Dt===void 0?void 0:Dt.setAttr(gr.I18N_ATTR_KEY,(0,Sr.formatLocale)(St))}else{(rr=this.ctx)===null||rr===void 0?void 0:rr.setAttr(gr.I18N_ATTR_KEY,(0,Sr.formatLocale)(this.getDefaultLocale()))}}getAvailableLocale(St,Dt="default"){return this.i18nServiceSingleton.getAvailableLocale(St,Dt)}hasAvailableLocale(St){return this.i18nServiceSingleton.hasAvailableLocale(St)}};cr([(0,mr.Inject)(),pr("design:type",$r)],Er.prototype,"i18nServiceSingleton",void 0);cr([(0,mr.Inject)(),pr("design:type",Object)],Er.prototype,"ctx",void 0);Er=cr([(0,mr.Provide)()],Er);Dt.MidwayI18nService=Er;function formatText(St,Dt){if(Array.isArray(Dt)){return(0,Sr.formatWithArray)(St,Dt)}else{return(0,Sr.formatWithObject)(St,Dt)}}function getES6Object(St){for(const Dt in St){if(St[Dt]["default"]&&Object.keys(St[Dt]).length===1){St[Dt]=St[Dt].default}}return St}function getMap(St,Dt,rr=false){Dt=rr?(0,Sr.formatLocale)(Dt):Dt;if(!St.has(Dt)){St.set(Dt,new Map)}return St.get(Dt)}},68255:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.formatLocale=Dt.Configuration=void 0;var mr=rr(30673);Object.defineProperty(Dt,"Configuration",{enumerable:true,get:function(){return mr.I18nConfiguration}});pr(rr(35632),Dt);pr(rr(82027),Dt);pr(rr(77460),Dt);var gr=rr(15578);Object.defineProperty(Dt,"formatLocale",{enumerable:true,get:function(){return gr.formatLocale}})},77460:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.I18N_ATTR_KEY=void 0;Dt.I18N_ATTR_KEY="i18n:locale"},82027:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.I18nMiddleware=Dt.I18nFilter=void 0;const mr=rr(46123);const gr=rr(77460);const yr=rr(35632);const Sr=rr(15578);let $r=class I18nFilter{match(St,Dt,rr){const cr=Dt.getAttr(gr.I18N_ATTR_KEY);if(this.resolverConfig){if(this.i18nConfig.writeCookie&&cr&&this.resolverConfig.cookieField){const St={httpOnly:false,maxAge:this.resolverConfig.cookieField.cookieMaxAge,signed:false,domain:this.resolverConfig.cookieField.cookieDomain};rr.cookie(this.resolverConfig.cookieField.fieldName,cr,St)}}return St}};cr([(0,mr.Config)("i18n.resolver"),pr("design:type",Object)],$r.prototype,"resolverConfig",void 0);cr([(0,mr.Config)("i18n"),pr("design:type",Object)],$r.prototype,"i18nConfig",void 0);$r=cr([(0,mr.Match)()],$r);Dt.I18nFilter=$r;let Er=class I18nMiddleware{resolve(St){if(St.getFrameworkType()===mr.MidwayFrameworkType.WEB_EXPRESS){St.useFilter($r);return async(St,Dt,rr)=>{const cr=await St.requestContext.getAsync(yr.MidwayI18nService);let pr;if(this.resolverConfig){pr=St.query[this.resolverConfig.queryField]||St.cookies[this.resolverConfig.cookieField.fieldName];if(!pr){let Dt=St.acceptsLanguages();if(Dt){if(Array.isArray(Dt)){if(Dt[0]==="*"){Dt=Dt.slice(1)}if(Dt.length>0){for(let St=0;St<Dt.length;St++){const rr=(0,Sr.formatLocale)(Dt[St]);if(cr.hasAvailableLocale(rr)){pr=rr;break}}}}else{pr=Dt}}}}if(pr){cr.saveRequestLocale(pr)}else{cr.saveRequestLocale()}Dt.locals[this.i18nConfig.localsField]=(St,Dt)=>cr.translate(St,{args:Dt});return rr()}}else{return async(St,Dt)=>{if(this.resolverConfig){let Dt=St.query[this.resolverConfig.queryField]||St.cookies.get(this.resolverConfig.cookieField.fieldName,{signed:false});const rr=await St.requestContext.getAsync(yr.MidwayI18nService);if(!Dt){let cr=St.acceptsLanguages();if(cr){if(Array.isArray(cr)){if(cr[0]==="*"){cr=cr.slice(1)}if(cr.length>0){for(let St=0;St<cr.length;St++){const pr=(0,Sr.formatLocale)(cr[St]);if(rr.hasAvailableLocale(pr)){Dt=pr;break}}}}else{Dt=cr}}}if(Dt){rr.saveRequestLocale(Dt)}else{rr.saveRequestLocale()}if(St.locals){St.locals[this.i18nConfig.localsField]=(St,Dt)=>rr.translate(St,{args:Dt})}}await Dt();const rr=St.getAttr(gr.I18N_ATTR_KEY);if(this.resolverConfig){if(this.i18nConfig.writeCookie&&rr&&this.resolverConfig.cookieField){const Dt={httpOnly:false,maxAge:this.resolverConfig.cookieField.cookieMaxAge,signed:false,domain:this.resolverConfig.cookieField.cookieDomain,overwrite:true};St.cookies.set(this.resolverConfig.cookieField.fieldName,rr,Dt)}}}}}static getName(){return"i18n"}};cr([(0,mr.Config)("i18n.resolver"),pr("design:type",Object)],Er.prototype,"resolverConfig",void 0);cr([(0,mr.Config)("i18n"),pr("design:type",Object)],Er.prototype,"i18nConfig",void 0);Er=cr([(0,mr.Middleware)()],Er);Dt.I18nMiddleware=Er},15578:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.formatLocale=Dt.formatWithObject=Dt.formatWithArray=void 0;const rr=/\{(\d+)\}/g;function formatWithArray(St,Dt){return St.replace(rr,((St,rr)=>{const cr=parseInt(rr);if(cr<Dt.length){return Dt[cr]}return St}))}Dt.formatWithArray=formatWithArray;const cr=/\{(.+?)\}/g;function formatWithObject(St,Dt){return St.replace(cr,((St,rr)=>{const cr=Dt[rr];if(cr){return cr}return St}))}Dt.formatWithObject=formatWithObject;function formatLocale(St){return St.replace("_","-").toLowerCase()}Dt.formatLocale=formatLocale},87370:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.info=void 0;const cr=rr(772);Dt.info={title:"Midway Info",infoPath:"/_info",hiddenKey:cr.DefaultHiddenKey,ignoreKey:[]}},47265:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.InfoConfiguration=void 0;const mr=rr(46123);const gr=rr(82934);const yr=rr(87370);let Sr=class InfoConfiguration{async onReady(){this.applicationManager.getApplications(["koa","faas","express","egg"]).forEach((St=>{St.useMiddleware(gr.InfoMiddleware)}))}};cr([(0,mr.Inject)(),pr("design:type",mr.MidwayApplicationManager)],Sr.prototype,"applicationManager",void 0);Sr=cr([(0,mr.Configuration)({namespace:"info",importConfigs:[{default:yr}]})],Sr);Dt.InfoConfiguration=Sr},65295:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.Configuration=void 0;var mr=rr(47265);Object.defineProperty(Dt,"Configuration",{enumerable:true,get:function(){return mr.InfoConfiguration}});pr(rr(44120),Dt);pr(rr(82934),Dt);pr(rr(772),Dt)},44120:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.InfoService=void 0;const mr=rr(46123);const gr=rr(46123);const yr=rr(772);const Sr=rr(6730);const $r=rr(70857);const Er=rr(16928);const Ir=rr(65675);let Or=class InfoService{async init(){this.secretMatchList=Array.from(new Set(this.defaultHiddenKey)).map((St=>Ir(St)))}info(St){const Dt=[];Dt.push(this.projectInfo());Dt.push(this.systemInfo());Dt.push(this.resourceOccupationInfo());Dt.push(this.softwareInfo());Dt.push(this.midwayConfig());Dt.push(this.midwayService());Dt.push(this.timeInfo());Dt.push(this.envInfo());Dt.push(this.dependenciesInfo());Dt.push(this.networkInfo());const rr=Dt.map((({type:St,info:Dt})=>{const rr=Object.keys(Dt);const cr=rr.filter((St=>!this.ignoreKey.includes(St)));const pr={};for(const St of cr){pr[St]=Dt[St]}return{type:St,info:pr}}));if(St==="html"){return(0,Sr.renderToHtml)(rr,this.titleConfig)}return rr}projectInfo(){return{type:yr.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 St=process.platform;return{type:yr.InfoType.SYSTEM,info:{Platform:St==="win32"?"Windows":St,Node:process.versions.node,V8:process.versions.v8,ProcessId:process.pid,Arch:process.arch,Hostname:(0,$r.hostname)(),HomeDir:(0,$r.homedir)(),CWD:process.cwd(),ExecCommand:[].concat(process.argv,process.execArgv).join(" ")}}}resourceOccupationInfo(){const St=process.memoryUsage();const Dt=(0,$r.cpus)();return{type:yr.InfoType.MEMORY_CPU,info:{"Memory Total Occupy":(0,Sr.bitToMB)(St.rss),"Heap Total Occupy":(0,Sr.bitToMB)(St.heapTotal),"Heap Used":(0,Sr.bitToMB)(St.heapUsed),"V8 C++ Object Memory":(0,Sr.bitToMB)(St.external),"System Total Memory":(0,Sr.bitToMB)((0,$r.totalmem)()),CPU:`${Dt[0]?`${Dt[0].model} ${Dt[0].speed}MHz`:""} ${Dt.length} core `,"CPU Usage":Dt.map((St=>{const Dt=St.times;return((1-Dt.idle/(Dt.idle+Dt.user+Dt.nice+Dt.sys+Dt.irq))*100).toFixed(2)+"%"})).join(" / ")}}}softwareInfo(){const St=["@midwayjs/core","@midwayjs/decorator","@midwayjs/faas"];const Dt={};for(const rr of St){const St=this.midwayInformationService.getPkg();if(St){Dt[rr]=St.version}}return{type:yr.InfoType.SOFTWARE,info:Dt}}envInfo(){const St={};Object.keys(process.env).forEach((Dt=>{St[Dt]=this.filterSecretContent(Dt,process.env[Dt])}));return{type:yr.InfoType.ENVIRONMENT_VARIABLE,info:St}}timeInfo(){const St=(new Date).toString().split(" ");return{type:yr.InfoType.TIME,info:{Current:Date.now(),Uptime:(0,$r.uptime)(),Timezone:St.length>=7?St[5]:"",TimezoneName:St.length>=7?St.slice(6).join(" ").replace(/\(/g,"").replace(/\)/g,""):""}}}networkInfo(){const St=(0,$r.networkInterfaces)();const Dt={};Object.keys(St).forEach((rr=>{const cr=St[rr];let pr=rr;if(rr[rr.length-1]==="0"){pr=rr.slice(0,-1)}if(pr==="lo"){return}Dt[pr]=cr.sort((St=>{if(St.family==="IPv4"){return-1}return 1})).map((St=>`${St.family} ${St.address}`)).join(" / ")}));return{type:yr.InfoType.NETWORK,info:Dt}}dependenciesInfo(){const St=this.midwayInformationService.getPkg();const Dt=St.dependencies||{};const rr={};Object.keys(Dt).forEach((St=>{const cr=(0,Sr.safeRequire)((0,Er.join)(St,"package.json"),{});rr[St]=`${cr.version||"Not Found"}(${Dt[St]})`}));return{type:yr.InfoType.DEPENDENCIES,info:rr}}midwayService(){var St;const Dt={};if((St=this.container)===null||St===void 0?void 0:St.registry){for(const St of this.container.registry){const[rr,cr]=St;const pr=cr?(cr===null||cr===void 0?void 0:cr.name)||cr:typeof cr;Dt[rr]=`${(cr===null||cr===void 0?void 0:cr.namespace)?`${cr===null||cr===void 0?void 0:cr.namespace}:`:""}${pr}${(cr===null||cr===void 0?void 0:cr.scope)?` [${cr===null||cr===void 0?void 0:cr.scope}]`:""}`}}return{type:yr.InfoType.MIDWAY_SERVICE,info:Dt}}midwayConfig(){const St={};const Dt=this.configService.getConfiguration()||{};Object.keys(Dt).forEach((rr=>{St[rr]=this.safeJson(this.filterSecretContent(rr,Dt[rr]))}));return{type:yr.InfoType.MIDWAY_CONFIG,info:St}}filterSecretContent(St,Dt){if(typeof Dt==="string"){const rr=this.secretMatchList.some((Dt=>Dt(St.toLowerCase())));if(rr){return(0,Sr.safeContent)(Dt)}}else if(Array.isArray(Dt)){return Dt.map((Dt=>this.filterSecretContent(St,Dt)))}return Dt}safeJson(St){switch(typeof St){case"string":return`"${St}"`;case"number":return`${St}`;case"boolean":return String(St);case"object":if(!St){return"null"}if(Array.isArray(St)){return`[${St.map((St=>this.safeJson(St))).join(",")}]`}if(St instanceof RegExp){return`"${St.toString()}"`}const Dt=[];for(const rr in St){Dt.push(`"${rr}":${this.safeJson(this.filterSecretContent(rr,St[rr]))}`)}return`{${Dt.join(",")}}`;case"function":return`function ${St.name}(${St.length} args)`}return""}};cr([(0,mr.Inject)(),pr("design:type",gr.MidwayInformationService)],Or.prototype,"midwayInformationService",void 0);cr([(0,mr.Inject)(),pr("design:type",gr.MidwayConfigService)],Or.prototype,"configService",void 0);cr([(0,mr.Inject)(),pr("design:type",gr.MidwayEnvironmentService)],Or.prototype,"environment",void 0);cr([(0,mr.Config)("info.title"),pr("design:type",String)],Or.prototype,"titleConfig",void 0);cr([(0,mr.Config)("info.hiddenKey"),pr("design:type",Array)],Or.prototype,"defaultHiddenKey",void 0);cr([(0,mr.Config)("info.ignoreKey"),pr("design:type",Array)],Or.prototype,"ignoreKey",void 0);cr([(0,mr.ApplicationContext)(),pr("design:type",Object)],Or.prototype,"container",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Or.prototype,"init",null);Or=cr([(0,mr.Provide)(),(0,mr.Scope)(mr.ScopeEnum.Singleton)],Or);Dt.InfoService=Or},772:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.InfoType=Dt.DefaultHiddenKey=void 0;Dt.DefaultHiddenKey=["keys","*key","*token","*secret*","pass*"];var rr;(function(St){St["PROJECT"]="Project";St["SYSTEM"]="System";St["MEMORY_CPU"]="Memory & CPU";St["SOFTWARE"]="Software";St["ENVIRONMENT_VARIABLE"]="Environment Variable";St["TIME"]="Time";St["NETWORK"]="Network";St["RESOURCE"]="Resource";St["DEPENDENCIES"]="Dependencies";St["MIDWAY_SERVICE"]="Midway Service";St["MIDWAY_CONFIG"]="Midway Config"})(rr=Dt.InfoType||(Dt.InfoType={}))},82934:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.InfoMiddleware=void 0;const mr=rr(46123);const gr=rr(44120);let yr=class InfoMiddleware{resolve(St){if(St.getFrameworkType()===mr.MidwayFrameworkType.WEB_EXPRESS){return async(St,Dt,rr)=>{if(St.path===this.infoPath){Dt.type("html");Dt.send(this.infoService.info("html"))}else{rr()}}}else{return async(St,Dt)=>{if(St.path===this.infoPath){return this.infoService.info("html")}return await Dt()}}}static getName(){return"info"}};cr([(0,mr.Config)("info.infoPath"),pr("design:type",String)],yr.prototype,"infoPath",void 0);cr([(0,mr.Inject)(),pr("design:type",gr.InfoService)],yr.prototype,"infoService",void 0);yr=cr([(0,mr.Middleware)()],yr);Dt.InfoMiddleware=yr},6730:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.safeContent=Dt.renderToHtml=Dt.bitToMB=Dt.safeRequire=void 0;const cr=rr(79896);function safeRequire(St,Dt){try{if(!(0,cr.existsSync)(St)){return Dt}return JSON.parse((0,cr.readFileSync)(St,"utf8"))}catch(St){return Dt}}Dt.safeRequire=safeRequire;function bitToMB(St){return Number((St||0)/1024/1024).toFixed(2)+" MB"}Dt.bitToMB=bitToMB;function renderToHtml(St,Dt){let rr=`<div style="padding: 24px; font-size: 36px;background: #9999cb;font-weight: bold;">${Dt}</div>`;rr+=St.map((St=>{const Dt=Object.keys(St.info||{});return`<div class="infoType">${St.type}</div>\n <table style="border-collapse: collapse;width: 100%;">${Dt.map((Dt=>`<tr style="border: 1px solid #666;"><td class="infoName">${Dt}</td><td class="infoValue">${St.info[Dt]}</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;">${rr}</div>`}Dt.renderToHtml=renderToHtml;function safeContent(St=""){if(St.length<3){return"*".repeat(St.length)}else if(St.length<6){return St[0]+"*".repeat(St.length-1)}else if(St.length<10){return St[0]+"*".repeat(St.length-2)+St[St.length-1]}else if(St.length<15){return St.slice(0,2)+"*".repeat(St.length-4)+St.slice(-2)}else{return St.slice(0,3)+"*".repeat(St.length-6)+St.slice(-3)}}Dt.safeContent=safeContent},89619:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.siteFile=Dt.bodyParser=Dt.onerror=Dt.cookiesExtra=Dt.cookies=Dt.keys=Dt.koa=void 0;Dt.koa={contextLoggerFormat:St=>{var Dt,rr,cr;const pr=St.ctx;const mr=pr.userId||"-";const gr=(cr=(Dt=pr.traceId)!==null&&Dt!==void 0?Dt:(rr=pr.tracer)===null||rr===void 0?void 0:rr.traceId)!==null&&cr!==void 0?cr:"-";const yr=Date.now()-pr.startTime;const Sr=mr+"/"+pr.ip+"/"+gr+"/"+yr+"ms "+pr.method+" "+pr.url;return`${St.timestamp} ${St.LEVEL} ${St.pid} [${Sr}] ${St.message}`},serverTimeout:2*60*1e3};Dt.keys="";Dt.cookies={};Dt.cookiesExtra={defaultGetOptions:{}};Dt.onerror={};Dt.bodyParser={enable:true,encoding:"utf8",formLimit:"1mb",jsonLimit:"1mb",textLimit:"1mb",strict:true,queryString:{arrayLimit:100,depth:5,parameterLimit:1e3},onerror(St){St.message+=", check bodyParser config";throw St}};Dt.siteFile={enable:true,favicon:undefined}},9867:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.KoaConfiguration=void 0;const mr=rr(46123);const gr=rr(65579);const yr=rr(62229);const Sr=rr(89619);const $r=rr(18713);const Er=rr(67241);let Ir=class KoaConfiguration{init(){this.decoratorService.registerParameterHandler(mr.WEB_ROUTER_PARAM_KEY,(St=>(0,mr.extractKoaLikeValue)(St.metadata.type,St.metadata.propertyData,St.originParamType)(St.originArgs[0],St.originArgs[1])))}async onReady(){this.koaFramework.useMiddleware([Er.SiteFileMiddleware,$r.BodyParserMiddleware])}};cr([(0,mr.Inject)(),pr("design:type",mr.MidwayDecoratorService)],Ir.prototype,"decoratorService",void 0);cr([(0,mr.Inject)(),pr("design:type",yr.MidwayKoaFramework)],Ir.prototype,"koaFramework",void 0);cr([(0,mr.Inject)(),pr("design:type",mr.MidwayConfigService)],Ir.prototype,"configService",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",void 0)],Ir.prototype,"init",null);Ir=cr([(0,mr.Configuration)({namespace:"koa",imports:[gr],importConfigs:[{default:Sr}]})],Ir);Dt.KoaConfiguration=Ir},62229:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayKoaFramework=void 0;const pr=rr(46123);const mr=rr(60990);const gr=rr(53777);const yr=rr(10800);const Sr=rr(81236);const $r=rr(69502);const Er=rr(83480);const Ir=rr(72040);const Or=Symbol("context#cookies");class KoaControllerGenerator extends pr.WebControllerGenerator{constructor(St,Dt){super(St,Dt);this.app=St;this.webRouterService=Dt}createRouter(St){const Dt=new gr(St);Dt.prefix(St.prefix);return Dt}generateController(St){return this.generateKoaController(St)}}let Hr=class MidwayKoaFramework extends pr.BaseFramework{configure(){return this.configService.getConfiguration("koa")}async applicationInitialize(St){const Dt=this.configService.getConfiguration("keys")||this.configurationOptions["keys"];if(!Dt){throw new pr.MidwayConfigMissingError("config.keys")}const rr=this.configService.getConfiguration("cookies");const cr=this.configService.getConfiguration("cookiesExtra.defaultGetOptions");this.app=new yr({keys:[].concat(Dt),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[Or]){this[Or]=new mr.Cookies(this,this.app.keys,rr,cr)}return this[Or]},enumerable:true});Object.defineProperty(this.app.context,"locals",{get(){return this.state},set(St){this.state=St}});Object.defineProperty(this.app.context,"forward",{get(){return async function(St){const Dt=this.requestContext.get(pr.MidwayWebRouterService);const rr=await Dt.getMatchedRouterInfo(St,this.method);if(rr){if(rr.controllerClz){const St=await this.requestContext.getAsync(rr.controllerClz);return St[rr.method](this)}else if(typeof rr.method==="function"){return rr.method(this)}}else{throw new pr.httpError.NotFoundError(`Forward url ${St} Not Found`)}}}});const gr=this.configurationOptions.queryParseMode==="strict"?function(St){return!Array.isArray(St)?[St]:St}:this.configurationOptions.queryParseMode==="first"?function(St){return Array.isArray(St)?St[0]:St}:undefined;const Ir=this;Object.defineProperty(this.app.request,"query",{get(){const St=this.querystring;const Dt=this._querycache=this._querycache||{};if(Dt[St])return Dt[St];if(Ir.configurationOptions.queryParseMode){Dt[St]=$r.parse(St,Ir.configurationOptions.queryParseOptions||{})}else{Dt[St]=Er.parse(St)}if(gr){for(const rr in Dt[St]){Dt[St][rr]=gr(Dt[St][rr])}}return Dt[St]},set(St){this._querycache=this._querycache||{};this._querycache[this.querystring]=St}});const Hr=this.configService.getConfiguration("onerror");(0,Sr.setupOnError)(this.app,Hr,this.logger);const notFound=async(St,Dt)=>{await Dt();if(!St._matchedRoute&&St.body===undefined){throw new pr.httpError.NotFoundError(`${St.path} Not Found`)}};const midwayRootMiddleware=async(St,Dt)=>{this.app.createAnonymousContext(St);await(await this.applyMiddleware(notFound))(St,Dt);if(St.body===undefined&&!St.response._explicitStatus&&St._matchedRoute){St.body=undefined}};this.app.use(midwayRootMiddleware);this.webRouterService=await this.applicationContext.getAsync(pr.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((St=>{var Dt;const rr=St.middleware();rr._name=`midwayController(${((Dt=St===null||St===void 0?void 0:St.opts)===null||Dt===void 0?void 0:Dt.prefix)||"/"})`;this.app.use(rr)}))}generateController(St){return this.generator.generateKoaController(St)}async generateMiddleware(St){const Dt=await this.getApplicationContext().getAsync(St);return Dt.resolve()}async run(){await this.loadMidwayController();this.app.use=this.app.originUse;const St={...this.configurationOptions,...this.configurationOptions.serverOptions};if(St.key&&St.cert){St.key=pr.PathFileUtil.getFileContentSync(St.key);St.cert=pr.PathFileUtil.getFileContentSync(St.cert);St.ca=pr.PathFileUtil.getFileContentSync(St.ca);process.env.MIDWAY_HTTP_SSL="true";if(St.http2){this.server=rr(85675).createSecureServer(St,this.app.callback())}else{this.server=rr(65692).createServer(St,this.app.callback())}}else{if(St.http2){this.server=rr(85675).createServer(St,this.app.callback())}else{this.server=rr(58611).createServer(St,this.app.callback())}}this.applicationContext.registerObject(pr.HTTP_SERVER_KEY,this.server);if(pr.Types.isNumber(this.configurationOptions.serverTimeout)){this.server.setTimeout(this.configurationOptions.serverTimeout)}this.configurationOptions.listenOptions={port:this.configurationOptions.port,host:this.configurationOptions.hostname,...this.configurationOptions.listenOptions};let Dt=process.env.MIDWAY_HTTP_PORT||this.configurationOptions.listenOptions.port;if(Dt===0||Dt==="0"){Dt=await(0,Ir.getFreePort)();this.logger.info(`Midway koa is listening on port ${Dt} (auto assigned)`)}this.configurationOptions.listenOptions.port=Number(Dt);if(this.configurationOptions.listenOptions.port){new Promise((St=>{this.server.listen(this.configurationOptions.listenOptions,(()=>{St()}));process.env.MIDWAY_HTTP_PORT=String(this.configurationOptions.listenOptions.port)}))}}async beforeStop(){if(this.server){new Promise((St=>{this.server.close(St);process.env.MIDWAY_HTTP_PORT=""}))}}getFrameworkType(){return pr.MidwayFrameworkType.WEB_KOA}getFrameworkName(){return"web:koa"}getServer(){return this.server}getPort(){return process.env.MIDWAY_HTTP_PORT}useMiddleware(St){this.middlewareManager.insertLast(St)}useFilter(St){this.filterManager.useFilter(St)}};Hr=cr([(0,pr.Framework)()],Hr);Dt.MidwayKoaFramework=Hr},47453:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.Configuration=Dt.Framework=void 0;var mr=rr(62229);Object.defineProperty(Dt,"Framework",{enumerable:true,get:function(){return mr.MidwayKoaFramework}});pr(rr(77678),Dt);var gr=rr(9867);Object.defineProperty(Dt,"Configuration",{enumerable:true,get:function(){return gr.KoaConfiguration}});pr(rr(67241),Dt);pr(rr(18713),Dt)},77678:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},18713:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.BodyParserMiddleware=void 0;const mr=rr(36952);const gr=rr(46123);let yr=class BodyParserMiddleware{resolve(){if(this.bodyparserConfig.enable){return mr(this.bodyparserConfig)}}static getName(){return"bodyParser"}};cr([(0,gr.Config)("bodyParser"),pr("design:type",Object)],yr.prototype,"bodyparserConfig",void 0);yr=cr([(0,gr.Middleware)()],yr);Dt.BodyParserMiddleware=yr},67241:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SiteFileMiddleware=void 0;const mr=rr(46123);const gr=rr(16928);const yr="public, max-age=2592000";let Sr=class SiteFileMiddleware{resolve(){if(this.siteFileConfig.enable){return async(St,Dt)=>{if(St.method!=="HEAD"&&St.method!=="GET")return Dt();if(St.path[0]!=="/")return Dt();if(St.path!=="/favicon.ico"){return Dt()}let rr=this.siteFileConfig["favicon"];if(rr===undefined){rr=Buffer.from("")}if(!rr)return Dt();if(typeof rr==="string")return St.redirect(rr);if(Buffer.isBuffer(rr)){St.set("cache-control",yr);St.body=rr;St.type=gr.extname(St.path);return}return Dt()}}}static getName(){return"siteFile"}};cr([(0,mr.Config)("siteFile"),pr("design:type",Object)],Sr.prototype,"siteFileConfig",void 0);Sr=cr([(0,mr.Middleware)()],Sr);Dt.SiteFileMiddleware=Sr},81236:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.setupOnError=void 0;const cr=rr(58611);const pr=rr(72040);const mr=rr(46123);function setupOnError(St,Dt,rr){const gr=Object.assign({accepts(){const St=Dt.accepts||pr.accepts;return St(this)},text(Dt,rr){rr.res._headers={};rr.set(Dt.headers);if((0,pr.isProduction)(St)){rr.body=cr.STATUS_CODES[rr.status]}else{rr.body=Dt.message}},html(Dt,rr){const mr=(0,pr.detectStatus)(Dt);if((0,pr.isProduction)(St)){if(mr>=500){rr.status=500;rr.body=`<h2>Internal Server Error, real status: ${mr}</h2>`;return}else{rr.status=mr;rr.body=`<h2>${mr} ${cr.STATUS_CODES[mr]}</h2>`;return}}if(St.getEnv()==="unittest"||St.getEnv()==="test"){rr.status=mr;rr.body=`${Dt.name}: ${Dt.message}\n${Dt.stack}`;return}rr.body=pr.tpl.replace("{{status}}",(0,pr.escapeHtml)(Dt.status)).replace("{{errorCode}}",(0,pr.escapeHtml)(Dt.code)).replace("{{stack}}",(0,pr.escapeHtml)(Dt.stack));rr.type="html"},json(Dt,rr){const mr=(0,pr.detectStatus)(Dt);const gr=Dt.code||Dt.type;if((0,pr.isProduction)(St)){if(mr>=500){rr.body={code:gr,message:cr.STATUS_CODES[mr]}}else{rr.body={code:gr,message:Dt.message}}}else{rr.body={code:gr,message:Dt.message,stack:Dt.stack}}}},Dt);St.on("error",((Dt,cr)=>{cr=cr||St.createAnonymousContext();const mr=(0,pr.detectStatus)(Dt);if(mr>=500){try{cr.logger.error(Dt)}catch(St){rr.error(Dt);rr.error(St)}return}try{cr.logger.warn(Dt)}catch(St){rr.warn(Dt);rr.error(St)}}));St.context.onerror=function(Dt){if(Dt==null)return;if(this.req)(0,pr.sendToWormhole)(this.req);if(!(Dt instanceof Error)){let St=Dt;if(typeof Dt==="object"){try{St=mr.Utils.safeStringify(Dt)}catch(St){}}const rr=new Error("non-error thrown: "+St);if(Dt){if(Dt.name)rr.name=Dt.name;if(Dt.message)rr.message=Dt.message;if(Dt.stack)rr.stack=Dt.stack;if(Dt.status)rr["status"]=Dt.status;if(Dt.headers)rr["headers"]=Dt.headers}Dt=rr}const rr=this.headerSent||!this.writable;if(rr)Dt.headerSent=true;St.emit("error",Dt,this);if(rr)return;if(Dt.code==="ENOENT")Dt.status=404;if(typeof Dt.status!=="number"||!cr.STATUS_CODES[Dt.status]){Dt.status=500}this.status=Dt.status;this.set(Dt.headers);let yr="text";if(gr.accepts){yr=gr.accepts.call(this,"html","text","json")}else{yr=this.accepts("html","text","json")}yr=yr||"text";if(gr.all){gr.all.call(this,Dt,this)}else{if(gr.redirect&&yr!=="json"){this.redirect(gr.redirect)}else{gr[yr].call(this,Dt,this);this.type=yr}}if(yr==="json"){this.body=JSON.stringify(this.body)}this.res.end(this.body)}}Dt.setupOnError=setupOnError},72040:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.getFreePort=Dt.escapeHtml=Dt.tpl=Dt.isProduction=Dt.sendToWormhole=Dt.accepts=Dt.detectStatus=void 0;const cr=rr(69278);function detectStatus(St){let Dt=St.status||500;if(Dt<200){Dt=500}return Dt}Dt.detectStatus=detectStatus;function accepts(St){if(acceptJSON(St))return"json";return"html"}Dt.accepts=accepts;function acceptJSON(St){if(St.path.endsWith(".json"))return true;if(St.response.type&&St.response.type.indexOf("json")>=0)return true;if(St.accepts("html","text","json")==="json")return true;return false}function sendToWormhole(St){return new Promise((Dt=>{if(typeof St.resume!=="function"){return Dt()}St.unpipe&&St.unpipe();St.resume();if(St._readableState&&St._readableState.ended){return Dt()}if(!St.readable||St.destroyed){return Dt()}function cleanup(){St.removeListener("end",onEnd);St.removeListener("close",onEnd);St.removeListener("error",onError)}function onEnd(){cleanup();Dt()}function onError(){cleanup();Dt()}St.on("end",onEnd);St.on("close",onEnd);St.on("error",onError)}))}Dt.sendToWormhole=sendToWormhole;function isProduction(St){return St.getEnv()!=="local"&&St.getEnv()!=="unittest"}Dt.isProduction=isProduction;Dt.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 pr=/["'&<>]/;function escapeHtml(St){const Dt=""+St;const rr=pr.exec(Dt);if(!rr){return Dt}let cr;let mr="";let gr=0;let yr=0;for(gr=rr.index;gr<Dt.length;gr++){switch(Dt.charCodeAt(gr)){case 34:cr="&quot;";break;case 38:cr="&amp;";break;case 39:cr="&#39;";break;case 60:cr="&lt;";break;case 62:cr="&gt;";break;default:continue}if(yr!==gr){mr+=Dt.substring(yr,gr)}yr=gr+1;mr+=cr}return yr!==gr?mr+Dt.substring(yr,gr):mr}Dt.escapeHtml=escapeHtml;async function getFreePort(){return new Promise(((St,Dt)=>{const rr=(0,cr.createServer)();rr.listen(0,(()=>{try{const Dt=rr.address().port;rr.close();St(Dt)}catch(St){Dt(St)}}))}))}Dt.getFreePort=getFreePort},28520:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.LEVEL=Dt.DefaultLogLevels=void 0;Dt.DefaultLogLevels={none:0,error:1,trace:2,warn:3,info:4,verbose:5,debug:6,silly:7,all:8};Dt.LEVEL={none:"NONE",error:"ERROR",trace:"TRACE",warn:"WARN",info:"INFO",verbose:"VERBOSE",debug:"DEBUG",silly:"SILLY",all:"ALL"}},62379:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.LoggerFactory=void 0;const cr=rr(8481);const pr=rr(39023);const mr=rr(16928);const gr=rr(4002);const yr=pr.debuglog("midway:debug");class LoggerFactory extends Map{constructor(St={}){super();this.factoryOptions=St}createLogger(St,Dt){if(!this.has(St)){yr('[logger]: Create logger "%s" with options %j',St,Dt);const rr=new cr.MidwayLogger(Object.assign(Dt,this.factoryOptions));this.addLogger(St,rr);return rr}return this.getLogger(St)}addLogger(St,Dt,rr=true){if(!rr||!this.has(St)){if(this.get(St)!==Dt){if(Dt["onClose"]){Dt["onClose"]((()=>{this.delete(St)}))}if(Dt["on"]){Dt.on("close",(()=>this.delete(St)))}this.set(St,Dt)}}else{throw new Error(`logger id ${St} has duplicate`)}return this.get(St)}getLogger(St){return this.get(St)}removeLogger(St){const Dt=this.get(St);Dt===null||Dt===void 0?void 0:Dt["close"]();this.delete(St)}get(St){return super.get(St)}close(St){if(St){return this.removeLogger(St)}Array.from(this.keys()).forEach((St=>this.removeLogger(St)))}getDefaultMidwayLoggerConfig(St){var Dt;const rr=(0,gr.isDevelopmentEnvironment)(St.env);const cr=(Dt=process.env["MIDWAY_LOGGER_WRITEABLE_DIR"])!==null&&Dt!==void 0?Dt:St.root;if(!cr){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,mr.join)(cr,"logs",St.name),auditFileDir:".audit",transports:{console:rr?{autoColors:rr}:false,file:{bufferWrite:!rr},error:{bufferWrite:!rr}}},clients:{coreLogger:{fileLogName:"midway-core.log"},appLogger:{}}}}}createContextLogger(St,Dt,rr={}){return Dt.createContextLogger(St,rr)}}Dt.LoggerFactory=LoggerFactory},51169:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayBaseLogger=Dt.MidwayLoggerContainer=Dt.createConsoleLogger=Dt.createFileLogger=Dt.createLogger=Dt.clearAllLoggers=Dt.loggers=void 0;const mr=rr(62379);const gr=rr(8481);pr(rr(51314),Dt);pr(rr(8481),Dt);pr(rr(19870),Dt);pr(rr(3993),Dt);pr(rr(96242),Dt);pr(rr(53828),Dt);pr(rr(62379),Dt);pr(rr(4002),Dt);Dt.loggers=new mr.LoggerFactory;const clearAllLoggers=()=>{Dt.loggers.close()};Dt.clearAllLoggers=clearAllLoggers;const createLogger=(St,rr={})=>Dt.loggers.createLogger(St,rr);Dt.createLogger=createLogger;const createFileLogger=(St,rr)=>Dt.loggers.createLogger(St,{transports:{file:{dir:__dirname,fileLogName:"custom-logger.log",...rr}}});Dt.createFileLogger=createFileLogger;const createConsoleLogger=(St,rr={})=>Dt.loggers.createLogger(St,{transports:{console:rr}});Dt.createConsoleLogger=createConsoleLogger;Dt.MidwayLoggerContainer=mr.LoggerFactory;Dt.MidwayBaseLogger=gr.MidwayLogger},51314:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},8481:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayChildLogger=Dt.MidwayContextLogger=Dt.MidwayLogger=Dt.TransportManager=void 0;const cr=rr(4002);const pr=rr(70857);const mr=rr(19870);const gr=rr(96242);const yr=rr(3993);Dt.TransportManager=new Map;Dt.TransportManager.set("console",gr.ConsoleTransport);Dt.TransportManager.set("file",yr.FileTransport);Dt.TransportManager.set("error",yr.ErrorTransport);Dt.TransportManager.set("json",yr.JSONTransport);class MidwayLogger{constructor(St={}){this.transports=new Map;this.closeHandlers=[];St=(0,cr.formatLegacyLoggerOptions)(St);this.options=St;this.options.level=this.options.level||"silly";this.options.eol=this.options.eol||pr.EOL;if(this.options.transports){for(const St in this.options.transports){this.add(St,this.options.transports[St])}}}get level(){return this.options.level}set level(St){this.options.level=St}log(St,...Dt){this.transit(St,{},...Dt)}debug(...St){this.transit("debug",{},...St)}info(...St){this.transit("info",{},...St)}warn(...St){this.transit("warn",{},...St)}error(...St){this.transit("error",{},...St)}verbose(...St){this.transit("verbose",{},...St)}write(...St){this.transit(false,{},...St)}silly(...St){this.transit("silly",{},...St)}add(St,rr){if(rr){let cr;if(!(rr instanceof mr.Transport)){if(!Dt.TransportManager.has(St)){throw new Error(`Transport ${St} is not supported`)}else{cr=new(Dt.TransportManager.get(St))(rr)}}else{cr=rr}cr.setLoggerOptions(this.options);this.transports.set(St,cr)}}get(St){return this.transports.get(St)}remove(St,Dt={}){if(this.transports.has(St)){if(Dt.close===undefined||Dt.close){this.transports.get(St).close()}this.transports.delete(St)}}close(){for(const St of this.transports.keys()){this.remove(St,{close:true})}for(const St of this.closeHandlers){St()}}onClose(St){this.closeHandlers.push(St)}createContextLogger(St,Dt={}){return new MidwayContextLogger(St,this,Dt)}transit(St,Dt={},...rr){if(St!==false&&!(0,cr.isEnableLevel)(St,this.level)){return}for(const cr of this.transports.values()){cr.log(St,Dt,...rr)}}getChild(St={}){return new MidwayChildLogger(this,St)}}Dt.MidwayLogger=MidwayLogger;class MidwayContextLogger{constructor(St,Dt,rr={}){this.ctx=St;this.parentLogger=Dt;this.options=rr}debug(...St){this.transit("debug",...St)}info(...St){this.transit("info",...St)}warn(...St){this.transit("warn",...St)}error(...St){this.transit("error",...St)}verbose(...St){this.transit("verbose",...St)}write(...St){this.transit(false,...St)}transit(St,...Dt){this.parentLogger.transit(St,{ctx:this.ctx,contextFormat:this.options.contextFormat},...Dt)}getContext(){return this.ctx}}Dt.MidwayContextLogger=MidwayContextLogger;class MidwayChildLogger{constructor(St,Dt={}){this.parentLogger=St;this.meta=Dt}debug(...St){this.transit("debug",...St)}info(...St){this.transit("info",...St)}warn(...St){this.transit("warn",...St)}error(...St){this.transit("error",...St)}verbose(...St){this.transit("verbose",...St)}write(...St){this.transit(false,...St)}transit(St,...Dt){this.parentLogger.transit(St,this.meta,...Dt)}}Dt.MidwayChildLogger=MidwayChildLogger},96242:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ConsoleTransport=void 0;const cr=rr(19870);const pr=rr(4002);const mr=rr(78997);const gr=mr.supportsColor.stdout;class ConsoleTransport extends cr.Transport{log(St,Dt,...rr){if(!(0,pr.isEnableLevel)(St,this.options.level)){return}let cr=this.format(St,Dt,rr);if(process.env.FORCE_ENABLE_COLOR||this.options.autoColors&&gr){const Dt=this.getColor(St);cr=(0,mr.colorizeAll)(cr,Dt)}cr+=this.options.eol;if(St==="error"){process.stderr.write(cr)}else{process.stdout.write(cr)}}getColor(St){switch(St){case"debug":return mr.Color.blue;case"info":return mr.Color.green;case"warn":return mr.Color.yellow;case"error":return mr.Color.red;default:return mr.Color.white}}close(){}}Dt.ConsoleTransport=ConsoleTransport},3993:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.JSONTransport=Dt.ErrorTransport=Dt.FileTransport=void 0;const cr=rr(19870);const pr=rr(53828);const mr=rr(16928);const gr=rr(43106);const yr=rr(79896);const Sr=rr(4002);const $r=rr(61256);const Er=rr(74450);class FileTransport extends cr.Transport{constructor(St={}){super(St);this.options=St;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,Sr.isValidFileName)(this.options.fileLogName)||!(0,Sr.isValidDirName)(this.options.dir)){throw new Error("Your path or filename contain an invalid character.")}const Dt={frequency:"custom",dateFormat:"YYYY-MM-DD",endStream:true,fileOptions:{flags:"a"},utc:false,extension:"",createSymlink:!(0,Sr.isWin32)(),maxFiles:"7d",zippedArchive:false};if(!this.options.auditFileDir){St.auditFileDir=this.options.dir}if(!mr.isAbsolute(this.options.auditFileDir)){St.auditFileDir=mr.join(this.options.dir,St.auditFileDir)}this.logStream=pr.FileStreamRotatorManager.getStream({...Dt,filename:mr.join(this.options.dir,this.options.fileLogName),size:(0,Sr.getMaxSize)(this.options.maxSize||"200m"),symlinkName:this.options.fileLogName,auditFile:mr.join(St.auditFileDir,"."+(0,$r.hash)(this.options)+"-audit.json"),...St});this.logStream.on("logRemoved",(Dt=>{if(St.zippedArchive){const St=Dt.name+".gz";if(yr.existsSync(St)){try{yr.unlinkSync(St)}catch(St){console.error(St)}return}}}));if(St.zippedArchive){this.logStream.on("rotate",(St=>{const Dt=yr.existsSync(St);const rr=yr.existsSync(St+".gz");if(!Dt||rr){return}const cr=gr.createGzip();const pr=yr.createReadStream(St);const mr=yr.createWriteStream(St+".gz");pr.pipe(cr).pipe(mr).on("finish",(()=>{if(yr.existsSync(St)){yr.unlinkSync(St)}}))}))}}log(St,Dt,...rr){if(!(0,Sr.isEnableLevel)(St,this.options.level)){return}let cr=this.format(St,Dt,rr);cr+=this.options.eol;if(this.options.bufferWrite){this.bufSize+=cr.length;this.buf.push(cr);if(this.buf.length>this.options.bufferMaxLength){this.flush()}}else{this.logStream.write(cr)}}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){pr.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()}}Dt.FileTransport=FileTransport;class ErrorTransport extends FileTransport{constructor(St){St.level="error";super(St)}}Dt.ErrorTransport=ErrorTransport;class JSONTransport extends FileTransport{log(St,Dt,...rr){if(!(0,Sr.isEnableLevel)(St,this.options.level)){return}let cr=this.format(St,Dt,rr);if(typeof cr==="string"||Buffer.isBuffer(cr)){cr=(0,Er.stringify)({message:cr.toString()})}else{cr=(0,Er.stringify)(cr)}cr+=this.options.eol;if(this.options.bufferWrite){this.bufSize+=cr.length;this.buf.push(cr);if(this.buf.length>this.options.bufferMaxLength){this.flush()}}else{this.logStream.write(cr)}}}Dt.JSONTransport=JSONTransport},53828:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.FileStreamRotatorManager=Dt.FileStreamRotator=void 0;const cr=rr(79896);const pr=rr(16928);const mr=rr(76982);const gr=rr(24434);const yr=rr(39023);const Sr=rr(23046);const $r=rr(15419);const Er=rr(42613);const Ir=rr(4002);const Or=(0,yr.debuglog)("midway-logger");const Hr=["daily","test","s","m","h","custom"];const Gr="YYYYMMDDHHmm";Sr.extend($r);class FileStreamRotator{getFrequency(St){const Dt=St.toLowerCase().match(/^(\d+)([smh])$/);if(Dt){return(0,Ir.checkNumAndType)(Dt[2],parseInt(Dt[1]))}const rr=(0,Ir.checkDailyAndTest)(St);if(rr){return rr}return false}parseFileSize(St){if(St&&typeof St==="string"){const Dt=St.toLowerCase().match(/^((?:0\.)?\d+)([kmg])$/);if(Dt){switch(Dt[2]){case"k":return Dt[1]*1024;case"m":return Dt[1]*1024*1024;case"g":return Dt[1]*1024*1024*1024}}}return null}getDate(St,Dt,rr){Dt=Dt||Gr;const cr=rr?Sr.utc():Sr().local();if(St&&Hr.indexOf(St.type)!==-1){switch(St.type){case"s":const rr=Math.floor(cr.second()/St.digit)*St.digit;return cr.second(rr).format(Dt);case"m":const pr=Math.floor(cr.minute()/St.digit)*St.digit;return cr.minute(pr).format(Dt);case"h":const mr=Math.floor(cr.hour()/St.digit)*St.digit;return cr.hour(mr).format(Dt);case"daily":case"custom":case"test":return cr.format(Dt)}}return cr.format(Dt)}setAuditLog(St,Dt,rr){let mr=null;if(St){const gr=St.toString().substr(-1);const yr=St.toString().match(/^(\d+)/);if(Number(yr[1])>0){const St=pr.dirname(rr.replace(/%DATE%.+/,"_filename"));try{if(Dt){const St=pr.resolve(Dt);mr=JSON.parse(cr.readFileSync(St,{encoding:"utf-8"}))}else{const Dt=pr.resolve(St+"/"+".audit.json");mr=JSON.parse(cr.readFileSync(Dt,{encoding:"utf-8"}))}}catch(rr){if(rr.code!=="ENOENT"){return null}mr={keep:{days:false,amount:Number(yr[1])},auditLog:Dt||St+"/"+".audit.json",files:[]}}mr.keep={days:gr==="d",amount:Number(yr[1])}}}return mr}writeAuditLog(St){try{(0,Ir.mkDirForFile)(St.auditLog);cr.writeFileSync(St.auditLog,JSON.stringify(St,null,2))}catch(Dt){Or((new Date).toLocaleString(),"[FileStreamRotator] Failed to store log audit at:",St.auditLog,"Error:",Dt)}}addLogToAudit(St,Dt,rr){if(Dt&&Dt.files){const cr=Dt.files.findIndex((Dt=>Dt.name===St));if(cr!==-1){return Dt}const pr=Date.now();Dt.files.push({date:pr,name:St,hash:mr.createHash(Dt.hashType).update(St+"LOG_FILE"+pr).digest("hex")});if(Dt.keep.days){const St=Sr().subtract(Dt.keep.amount,"days").valueOf();Dt.files=Dt.files.filter((cr=>{if(cr.date>St){return true}cr.hashType=Dt.hashType;(0,Ir.removeFile)(cr);rr.emit("logRemoved",cr);return false}))}else{const St=Dt.files.splice(-Dt.keep.amount);if(Dt.files.length>0){Dt.files.filter((St=>{St.hashType=Dt.hashType;(0,Ir.removeFile)(St);rr.emit("logRemoved",St);return false}))}Dt.files=St}this.writeAuditLog(Dt)}return Dt}getStream(St){let Dt=null;let rr=null;Er(St.filename,"options.filename must be supplied");if(St.frequency){Dt=this.getFrequency(St.frequency)}const pr=this.setAuditLog(St.maxFiles,St.auditFile,St.filename);if(pr!=null){pr.hashType=St.auditHashType!==undefined?St.auditHashType:"md5"}let mr=null;let $r=0;let Tn=0;if(St.size){mr=this.parseFileSize(St.size)}let Wn=St.dateFormat||Gr;if(Dt&&Dt.type==="daily"){if(!St.dateFormat){Wn="YYYY-MM-DD"}if(Sr().format(Wn)!==Sr().endOf("day").format(Wn)||Sr().format(Wn)===Sr().add(1,"day").format(Wn)){Or((new Date).toLocaleString(),"[FileStreamRotator] Changing type to custom as date format changes more often than once a day or not every day");Dt.type="custom"}}if(Dt){rr=St.frequency?this.getDate(Dt,Wn,St.utc):""}St.createSymlink=St.createSymlink||false;St.extension=St.extension||"";const Gn=St.filename;let mi=null;let $i=Gn+(rr?"."+rr:"");if(Gn.match(/%DATE%/)){$i=Gn.replace(/%DATE%/g,rr?rr:this.getDate(null,Wn,St.utc))}if(mr){let Dt=null;let rr=$i;if(pr&&pr.files&&pr.files instanceof Array&&pr.files.length>0){const St=pr.files[pr.files.length-1].name;if(St.match(rr)){const Dt=St.match(rr+"\\.(\\d+)");if(Dt){rr=St;$r=Dt[1]}}}if($r===0&&rr===$i){rr+=St.extension}while(cr.existsSync(rr)){Dt=rr;$r++;rr=$i+"."+$r+St.extension}if(Dt){const St=cr.statSync(Dt);if(St.size<mr){rr=Dt;$r--;Tn=St.size}}$i=rr}else{$i+=St.extension}Or((new Date).toLocaleString(),"[FileStreamRotator] Logging to: ",$i);(0,Ir.mkDirForFile)($i);const ki=St.fileOptions||{flags:"a"};let Ni=cr.createWriteStream($i,ki);if(rr&&Dt&&Hr.indexOf(Dt.type)>-1||mr>0){Or((new Date).toLocaleString(),"[FileStreamRotator] Rotating file: ",Dt?Dt.type:"",mr?"size: "+mr:"");const Sr=new gr;Sr.auditLog=pr;Sr.filename=St.filename;Sr.end=(...St)=>{Ni.end(...St);Er.clear()};Sr.canWrite=()=>!Ni.closed&&Ni.writable&&!Ni.destroyed;(0,Ir.BubbleEvents)(Ni,Sr);Sr.on("new",(Dt=>{Sr.auditLog=this.addLogToAudit(Dt,Sr.auditLog,Sr);if(St.createSymlink){(0,Ir.createCurrentSymLink)(Dt,St.symlinkName)}}));const Er=(0,Ir.debounce)((()=>{let St=false;try{const St=cr.statSync($i);if(St.size>Tn){Tn=St.size}}catch(Dt){St=true}return St}),1e3);Sr.write=(pr,gr)=>{const Hr=Er();const Gr=Dt?this.getDate(Dt,Wn,St.utc):rr;if(Hr||rr&&Gr!==rr||mr&&Tn>mr){let pr=Gn+(rr&&Dt?"."+Gr:"");if(Gn.match(/%DATE%/)&&rr){pr=Gn.replace(/%DATE%/g,Gr)}if(mr&&Tn>mr){$r++;pr+="."+$r+St.extension}else{$r=0;pr+=St.extension}Tn=0;Or((new Date).toLocaleString(),(0,yr.format)("[FileStreamRotator] Changing logs from %s to %s",$i,pr));rr=Gr;mi=$i;$i=pr;if(St.endStream===true){Ni.end()}else{Ni.destroy()}(0,Ir.mkDirForFile)($i);Ni=cr.createWriteStream(pr,ki);Sr.emit("new",pr);Sr.emit("rotate",mi,pr);(0,Ir.BubbleEvents)(Ni,Sr)}Ni.write(pr,gr);Tn+=Buffer.byteLength(pr,gr)};process.nextTick((()=>{Sr.emit("new",$i)}));Sr.emit("new",$i);return Sr}else{Or((new Date).toLocaleString(),"[FileStreamRotator] File won't be rotated: ",St.frequency,St.size);process.nextTick((()=>{Ni.emit("new",$i)}));return Ni}}}Dt.FileStreamRotator=FileStreamRotator;class FileStreamRotatorManager{static getStream(St){let Dt;if(this.enabled){if(!this.streamPool.has(St.filename)){const Dt=(new FileStreamRotator).getStream(St);this.streamPool.set(St.filename,Dt);this.loggerRef.set(Dt,0)}Dt=this.streamPool.get(St.filename);let rr=this.loggerRef.get(Dt);this.loggerRef.set(Dt,rr++)}else{Dt=(new FileStreamRotator).getStream(St)}return Dt}static close(St){if(this.enabled){if(this.loggerRef.has(St)){let Dt=this.loggerRef.get(St);Dt--;if(Dt===0){St.end();this.streamPool.delete(St.filename);this.loggerRef.delete(St)}else if(Dt>0){this.loggerRef.set(St,Dt)}else{}}}else{St.end()}}static clear(){for(const St of this.streamPool.values()){St.end();if(this.loggerRef.has(St)){this.loggerRef.delete(St)}}this.streamPool.clear();this.loggerRef=new WeakMap}}Dt.FileStreamRotatorManager=FileStreamRotatorManager;FileStreamRotatorManager.streamPool=new Map;FileStreamRotatorManager.loggerRef=new WeakMap;FileStreamRotatorManager.enabled=true},19870:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.EmptyTransport=Dt.Transport=void 0;const cr=rr(39023);const pr=rr(4002);const mr=rr(28520);class Transport{constructor(St={}){this.options=St;this.pid=process.pid}setLoggerOptions(St){this.loggerOptions=St;this.options.level=this.options.level||St.level;this.options.format=this.options.format||St.format;this.options.contextFormat=this.options.contextFormat||St.contextFormat;this.options.eol=this.options.eol||St.eol}format(St,Dt,rr){const pr=this.getLoggerInfo(St,Dt,rr);if(Buffer.isBuffer(pr.args[0])){return pr.args[0]}if(St===false){return(0,cr.format)(pr.message)}const mr=Dt.contextFormat||this.options.contextFormat;if(Dt.ctx&&mr){return mr(pr)}const gr=Dt.format||this.options.format;if(gr){return gr(pr)}if(St){return(0,cr.format)("%s %s %s %s",pr.timestamp,pr.LEVEL,pr.pid,pr.message)}else{return(0,cr.format)(pr.message)}}getLoggerInfo(St,Dt,rr){const gr=St||"";const yr={level:gr,pid:this.pid};Object.defineProperties(yr,{timestamp:{get(){return(0,pr.getFormatDate)(new Date)},enumerable:false},LEVEL:{get(){return mr.LEVEL[gr]||""},enumerable:false},args:{get(){return rr},enumerable:false},originArgs:{get(){return rr},enumerable:false},message:{get(){return(0,cr.format)(...rr)},enumerable:false},ctx:{get(){return Dt.ctx},enumerable:false},originError:{get(){return rr.find((St=>St instanceof Error))},enumerable:false},meta:{get(){return Dt},enumerable:false}});return yr}get level(){return this.options.level}set level(St){this.options.level=St}}Dt.Transport=Transport;class EmptyTransport extends Transport{log(St,...Dt){}close(){}}Dt.EmptyTransport=EmptyTransport},78997:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.supportsColor=Dt.colorizeAll=Dt.colorize=Dt.Color=void 0;const cr=rr(932);const pr=rr(70857);const mr=rr(52018);Dt.Color={red:St=>`${St}`,green:St=>`${St}`,yellow:St=>`${St}`,blue:St=>`${St}`,magenta:St=>`${St}`,cyan:St=>`${St}`,white:St=>`${St}`,gray:St=>`${St}`,grey:St=>`${St}`,black:St=>`${St}`,bgRed:St=>`${St}`,bgGreen:St=>`${St}`,bgYellow:St=>`${St}`,bgBlue:St=>`${St}`,bgMagenta:St=>`${St}`,bgCyan:St=>`${St}`,bgWhite:St=>`${St}`,bgBlack:St=>`${St}`,bold:St=>`${St}`,dim:St=>`${St}`,italic:St=>`${St}`,underline:St=>`${St}`,inverse:St=>`${St}`,hidden:St=>`${St}`,strikethrough:St=>`${St}`};const colorize=(St,rr)=>{if(typeof rr==="function"){return rr(St)}else{return Dt.Color[rr](St)}};Dt.colorize=colorize;const colorizeAll=(St,rr)=>St.replace(/([^\s]+)/g,(St=>(0,Dt.colorize)(St,rr)));Dt.colorizeAll=colorizeAll;function hasFlag(St,Dt=process.argv){const rr=St.startsWith("-")?"":St.length===1?"-":"--";const cr=Dt.indexOf(rr+St);const pr=Dt.indexOf("--");return cr!==-1&&(pr===-1||cr<pr)}let gr;if(hasFlag("no-color")||hasFlag("no-colors")||hasFlag("color=false")||hasFlag("color=never")){gr=0}else if(hasFlag("color")||hasFlag("colors")||hasFlag("color=true")||hasFlag("color=always")){gr=1}function envForceColor(){if("FORCE_COLOR"in cr.env){if(cr.env.FORCE_COLOR==="true"){return 1}if(cr.env.FORCE_COLOR==="false"){return 0}return cr.env.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(cr.env.FORCE_COLOR,10),3)}}function translateLevel(St){if(St===0){return false}return{level:St,hasBasic:true,has256:St>=2,has16m:St>=3}}function _supportsColor(St,Dt){const rr=Dt.streamIsTTY;const mr=true;const yr=envForceColor();if(yr!==undefined){gr=yr}const Sr=mr?gr:yr;if(Sr===0){return 0}if(mr){if(hasFlag("color=16m")||hasFlag("color=full")||hasFlag("color=truecolor")){return 3}if(hasFlag("color=256")){return 2}}if("TF_BUILD"in cr.env&&"AGENT_NAME"in cr.env){return 1}if(St&&!rr&&Sr===undefined){return 0}const $r=Sr||0;if(cr.env.TERM==="dumb"){return $r}if(cr.platform==="win32"){const St=pr.release().split(".");if(Number(St[0])>=10&&Number(St[2])>=10586){return Number(St[2])>=14931?3:2}return 1}if("CI"in cr.env){if("GITHUB_ACTIONS"in cr.env||"GITEA_ACTIONS"in cr.env){return 3}if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((St=>St in cr.env))||cr.env.CI_NAME==="codeship"){return 1}return $r}if("TEAMCITY_VERSION"in cr.env){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(cr.env.TEAMCITY_VERSION)?1:0}if(cr.env.COLORTERM==="truecolor"){return 3}if(cr.env.TERM==="xterm-kitty"){return 3}if("TERM_PROGRAM"in cr.env){const St=Number.parseInt((cr.env.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(cr.env.TERM_PROGRAM){case"iTerm.app":{return St>=3?3:2}case"Apple_Terminal":{return 2}}}if(/-256(color)?$/i.test(cr.env.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(cr.env.TERM)){return 1}if("COLORTERM"in cr.env){return 1}return $r}function createSupportsColor(St){const Dt=_supportsColor(true,{streamIsTTY:St.isTTY});return translateLevel(Dt)}Dt.supportsColor={stdout:createSupportsColor({isTTY:mr.isatty(1)}),stderr:createSupportsColor({isTTY:mr.isatty(2)})}},61256:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.hash=void 0;const cr=rr(76982);const pr=rr(2203);function hash(St){const Dt={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 rr=cr.createHash(Dt.algorithm);const pr=typeHasher(Dt,rr);pr.dispatch(St);if(!rr.update){rr.end("")}return rr.digest(Dt.encoding)}Dt.hash=hash;function typeHasher(St,Dt,rr){rr=rr||[];const write=function(St){if(Dt.update){return Dt.update(St,"utf8")}else{return Dt.write(St,"utf8")}};return{dispatch:function(Dt){if(St.replacer){Dt=St.replacer(Dt)}let rr=typeof Dt;if(Dt===null){rr="null"}return this["_"+rr](Dt)},_object:function(Dt){const cr=/\[object (.*)\]/i;const pr=Object.prototype.toString.call(Dt);let mr=cr.exec(pr);if(!mr){mr="unknown:["+pr+"]"}else{mr=mr[1]}mr=mr.toLowerCase();let gr=null;if((gr=rr.indexOf(Dt))>=0){return this.dispatch("[CIRCULAR:"+gr+"]")}else{rr.push(Dt)}if(typeof Buffer!=="undefined"&&Buffer.isBuffer&&Buffer.isBuffer(Dt)){write("buffer:");return write(Dt)}if(mr!=="object"&&mr!=="function"&&mr!=="asyncfunction"){if(this["_"+mr]){this["_"+mr](Dt)}else if(St.ignoreUnknown){return write("["+mr+"]")}else{throw new Error('Unknown object type "'+mr+'"')}}else{let rr=Object.keys(Dt);if(St.unorderedObjects){rr=rr.sort()}if(St.respectType!==false&&!isNativeFunction(Dt)){rr.splice(0,0,"prototype","__proto__","constructor")}if(St.excludeKeys){rr=rr.filter((Dt=>!St.excludeKeys(Dt)))}write("object:"+rr.length+":");const cr=this;return rr.forEach((rr=>{cr.dispatch(rr);write(":");if(!St.excludeValues){cr.dispatch(Dt[rr])}write(",")}))}},_array:function(Dt,cr){cr=typeof cr!=="undefined"?cr:St.unorderedArrays!==false;const mr=this;write("array:"+Dt.length+":");if(!cr||Dt.length<=1){return Dt.forEach((St=>mr.dispatch(St)))}let gr=[];const yr=Dt.map((Dt=>{const cr=new pr.PassThrough;const mr=rr.slice();const yr=typeHasher(St,cr,mr);yr.dispatch(Dt);gr=gr.concat(mr.slice(rr.length));return cr.read().toString()}));rr=rr.concat(gr);yr.sort();return this._array(yr,false)},_date:function(St){return write("date:"+St.toJSON())},_symbol:function(St){return write("symbol:"+St.toString())},_error:function(St){return write("error:"+St.toString())},_boolean:function(St){return write("bool:"+St.toString())},_string:function(St){write("string:"+St.length+":");write(St.toString())},_function:function(Dt){write("fn:");if(isNativeFunction(Dt)){this.dispatch("[native]")}else{this.dispatch(Dt.toString())}if(St.respectFunctionNames!==false){this.dispatch("function-name:"+String(Dt.name))}if(St.respectFunctionProperties){this._object(Dt)}},_number:function(St){return write("number:"+St.toString())},_xml:function(St){return write("xml:"+St.toString())},_null:function(){return write("Null")},_undefined:function(){return write("Undefined")},_regexp:function(St){return write("regex:"+St.toString())},_uint8array:function(St){write("uint8array:");return this.dispatch(Array.prototype.slice.call(St))},_uint8clampedarray:function(St){write("uint8clampedarray:");return this.dispatch(Array.prototype.slice.call(St))},_int8array:function(St){write("int8array:");return this.dispatch(Array.prototype.slice.call(St))},_uint16array:function(St){write("uint16array:");return this.dispatch(Array.prototype.slice.call(St))},_int16array:function(St){write("int16array:");return this.dispatch(Array.prototype.slice.call(St))},_uint32array:function(St){write("uint32array:");return this.dispatch(Array.prototype.slice.call(St))},_int32array:function(St){write("int32array:");return this.dispatch(Array.prototype.slice.call(St))},_float32array:function(St){write("float32array:");return this.dispatch(Array.prototype.slice.call(St))},_float64array:function(St){write("float64array:");return this.dispatch(Array.prototype.slice.call(St))},_arraybuffer:function(St){write("arraybuffer:");return this.dispatch(new Uint8Array(St))},_url:function(St){return write("url:"+St.toString())},_map:function(Dt){write("map:");const rr=Array.from(Dt);return this._array(rr,St.unorderedSets!==false)},_set:function(Dt){write("set:");const rr=Array.from(Dt);return this._array(rr,St.unorderedSets!==false)},_file:function(St){write("file:");return this.dispatch([St.name,St.size,St.type,St.lastModfied])},_blob:function(){if(St.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(St){return write("bigint:"+St.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(St){if(typeof St!=="function"){return false}const Dt=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;return Dt.exec(Function.prototype.toString.call(St))!=null}},4002:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.getFormatDate=Dt.isWin32=Dt.BubbleEvents=Dt.formatLegacyLoggerOptions=Dt.formatLoggerOptions=Dt.isDevelopmentEnvironment=Dt.debounce=Dt.throwIf=Dt.getMaxSize=Dt.isValidDirName=Dt.isValidFileName=Dt.removeFile=Dt.createCurrentSymLink=Dt.mkDirForFile=Dt.checkDailyAndTest=Dt.checkNumAndType=Dt.isEnableLevel=void 0;const cr=rr(28520);const pr=rr(79896);const mr=rr(16928);const gr=rr(76982);const yr=rr(16928);const Sr=rr(70857);const $r=rr(19870);function isEnableLevel(St,Dt){if(!St||!Dt){return true}return cr.DefaultLogLevels[St]<=cr.DefaultLogLevels[Dt]}Dt.isEnableLevel=isEnableLevel;function checkNumAndType(St,Dt){if(typeof Dt==="number"){switch(St){case"s":case"m":if(Dt<0||Dt>60){return false}break;case"h":if(Dt<0||Dt>24){return false}break}return{type:St,digit:Dt}}}Dt.checkNumAndType=checkNumAndType;function checkDailyAndTest(St){switch(St){case"custom":case"daily":return{type:St,digit:undefined};case"test":return{type:St,digit:0}}return false}Dt.checkDailyAndTest=checkDailyAndTest;function mkDirForFile(St){const Dt=yr.dirname(St);Dt.split(yr.sep).reduce(((St,Dt)=>{St+=Dt+yr.sep;if(!pr.existsSync(St)){try{pr.mkdirSync(St)}catch(St){if(St.code!=="EEXIST"){throw St}}}return St}),"")}Dt.mkDirForFile=mkDirForFile;function createCurrentSymLink(St,Dt){const rr=Dt||"current.log";const cr=(0,mr.dirname)(St);const gr=(0,mr.basename)(St);const yr=cr+"/"+rr;try{const St=pr.lstatSync(yr);if(St.isSymbolicLink()){pr.unlinkSync(yr);pr.symlinkSync(gr,yr)}}catch(St){if(St&&St.code==="ENOENT"){try{pr.symlinkSync(gr,yr)}catch(St){console.error((new Date).toLocaleString(),"[FileStreamRotator] Could not create symlink file: ",yr," -> ",gr)}}}}Dt.createCurrentSymLink=createCurrentSymLink;function removeFile(St){if(St.hash===gr.createHash(St.hashType).update(St.name+"LOG_FILE"+St.date).digest("hex")){try{if(pr.existsSync(St.name)){pr.unlinkSync(St.name)}}catch(Dt){console.error((new Date).toLocaleString(),"[FileStreamRotator] Could not remove old log file: ",St.name)}}}Dt.removeFile=removeFile;function isValidFileName(St){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(St)}Dt.isValidFileName=isValidFileName;function isValidDirName(St){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(St)}Dt.isValidDirName=isValidDirName;function getMaxSize(St){if(St&&typeof St==="string"){const Dt=St.toLowerCase().match(/^((?:0\.)?\d+)([k|m|g])$/);if(Dt){return St}}else if(St&&Number.isInteger(St)){const Dt=Math.round(St/1024);return Dt===0?"1k":Dt+"k"}return null}Dt.getMaxSize=getMaxSize;function throwIf(St,...Dt){Array.prototype.slice.call(Dt,1).forEach((rr=>{if(St[rr]){throw new Error("Cannot set "+rr+" and "+Dt[0]+" together")}}))}Dt.throwIf=throwIf;function debounce(St,Dt,rr){let cr,pr,mr,gr,yr;if(null==Dt)Dt=100;function later(){const Sr=Date.now()-gr;if(Sr<Dt&&Sr>=0){cr=setTimeout(later,Dt-Sr)}else{cr=null;if(!rr){yr=St.apply(mr,pr);mr=pr=null}}}const debounced=(...pr)=>{mr=this;gr=Date.now();const Sr=rr&&!cr;if(!cr)cr=setTimeout(later,Dt);if(Sr){yr=St.apply(mr,pr);mr=pr=null}return yr};debounced.clear=()=>{if(cr){clearTimeout(cr);cr=null}};debounced.flush=()=>{if(cr){yr=St.apply(mr,pr);mr=pr=null;clearTimeout(cr);cr=null}};return debounced}Dt.debounce=debounce;const isDevelopmentEnvironment=St=>["local","test","unittest"].includes(St);Dt.isDevelopmentEnvironment=isDevelopmentEnvironment;const Er={enableConsole:true,disableConsole:true,enableFile:true,enableError:true,enableJSON:true,disableFile:true,disableError:true};function formatLoggerOptions(St){if(Object.keys(St).some((St=>Er[St]))){const Dt={transports:{}};for(const rr of Object.keys(St)){if(!Er[rr]){Dt[rr]=St[rr]}}if(Dt.transports["console"]&&(St["enableConsole"]===false||St["disableConsole"]===true)){Dt.transports["console"]=false}if(Dt.transports["file"]&&(St["enableFile"]===false||St["disableFile"]===true)){Dt.transports["file"]=false}if(Dt.transports["error"]&&(St["enableError"]===false||St["disableError"]===true)){Dt.transports["error"]=false}if(Dt.transports["json"]&&St["enableJSON"]===false){Dt.transports["json"]=false}return Dt}return St}Dt.formatLoggerOptions=formatLoggerOptions;const Ir={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 Or=Object.prototype.hasOwnProperty;const Hr=Object.prototype.toString;function formatLegacyLoggerOptions(St){var Dt,rr,cr,pr,mr,gr;function isPlainObject(St){if(!St||Hr.call(St)!=="[object Object]"){return false}const Dt=Or.call(St,"constructor");const rr=St.constructor&&St.constructor.prototype&&Or.call(St.constructor.prototype,"isPrototypeOf");if(St.constructor&&!Dt&&!rr){return false}let cr;for(cr in St){}return typeof cr==="undefined"||Or.call(St,cr)}function deepMerge(St,Dt){if(!St){return Dt}if(Dt&&!isPlainObject(Dt)){return Dt}for(const rr of Object.keys(Dt)){if(Dt[rr]instanceof Object){Object.assign(Dt[rr],deepMerge(St[rr],Dt[rr]))}}Object.assign(St||{},Dt);return St}function setTransportOptions(Dt,rr,cr,pr=false){var mr,gr;if(!Dt.transports[cr]){Dt.transports[cr]={}}const yr=(mr=Ir[rr].mappingKey)!==null&&mr!==void 0?mr:rr;if(pr){Dt.transports[cr][yr]=St[rr]}else{Dt.transports[cr][yr]=(gr=Dt.transports[cr][yr])!==null&&gr!==void 0?gr:St[rr]}}function isValidTransport(St){return St&&(St instanceof $r.Transport||typeof St==="object"&&St["dir"]&&St["fileLogName"])}if(Object.keys(St).some((St=>{var Dt;return(Dt=Ir[St])===null||Dt===void 0?void 0:Dt.isOld}))){const yr={transports:{}};for(const rr of Object.keys(St)){if(!Ir[rr]){continue}else{if(Ir[rr].ignore){continue}Ir[rr].category=[].concat(Ir[rr].category);for(const cr of Ir[rr].category){if(cr==="all"){for(const St of Object.keys(yr.transports)){setTransportOptions(yr,rr,St,Ir[rr].overwriteIfExists)}}else if(cr==="top"){yr[rr]=(Dt=yr[rr])!==null&&Dt!==void 0?Dt:St[Ir[rr].mappingKey]}else{setTransportOptions(yr,rr,cr,Ir[rr].overwriteIfExists)}}}}for(const Dt of Object.keys(St)){if(!Ir[Dt]){deepMerge(yr[Dt],St[Dt])}}if(St["enableConsole"]===false||St["disableConsole"]===true){yr.transports["console"]=false}else{yr.transports["console"]=(rr=yr.transports["console"])!==null&&rr!==void 0?rr:{}}if(St["enableFile"]===false||St["disableFile"]===true){yr.transports["file"]=false}else{yr.transports["file"]=(cr=yr.transports["file"])!==null&&cr!==void 0?cr:{}}if(St["enableError"]===false||St["disableError"]===true){yr.transports["error"]=false}else{yr.transports["error"]=(pr=yr.transports["error"])!==null&&pr!==void 0?pr:{}}if(((mr=St===null||St===void 0?void 0:St.transports)===null||mr===void 0?void 0:mr["json"])===undefined&&(St["enableJSON"]===undefined||St["enableJSON"]===false)){yr.transports["json"]=false}else{}for(const St of["file","error","json"]){if((gr=yr===null||yr===void 0?void 0:yr.transports)===null||gr===void 0?void 0:gr[St]){if(!isValidTransport(yr.transports[St])){delete yr.transports[St]}}}return yr}return St}Dt.formatLegacyLoggerOptions=formatLegacyLoggerOptions;function BubbleEvents(St,Dt){St.on("close",(()=>{Dt.emit("close")}));St.on("finish",(()=>{Dt.emit("finish")}));St.on("error",(St=>{Dt.emit("error",St)}));St.on("open",(St=>{Dt.emit("open",St)}))}Dt.BubbleEvents=BubbleEvents;function isWin32(){return Sr.platform()==="win32"}Dt.isWin32=isWin32;function getFormatDate(St){function pad(St,Dt=2){const rr=St+"";return rr.padStart(Dt,"0")}const Dt=St.getFullYear();const rr=St.getMonth()+1;const cr=St.getDate();const pr=St.getHours();const mr=St.getMinutes();const gr=St.getSeconds();const yr=St.getMilliseconds();return`${Dt}-${pad(rr)}-${pad(cr)} ${pad(pr)}:${pad(mr)}:${pad(gr)}.${pad(yr,3)}`}Dt.getFormatDate=getFormatDate},74129:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.session=void 0;Dt.session={enable:true,maxAge:24*3600*1e3,key:"MW_SESS",httpOnly:true,logValue:true}},16885:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SessionConfiguration=void 0;const mr=rr(46123);const gr=rr(74129);const yr=rr(97628);let Sr=class SessionConfiguration{async onReady(){if(this.sessionConfig.enable){this.applicationManager.getApplications(["koa","faas"]).forEach((St=>{if(St.on){St.on("session:missed",(({ctx:St,key:Dt})=>{this.logger.warn("[session][missed] key(%s)",Dt)}));St.on("session:expired",(({ctx:St,key:Dt,value:rr})=>{this.logger.warn("[session][expired] key(%s) value(%j)",Dt,this.sessionConfig.logValue?rr:"")}));St.on("session:invalid",(({ctx:St,key:Dt,value:rr})=>{this.logger.warn("[session][invalid] key(%s) value(%j)",Dt,this.sessionConfig.logValue?rr:"")}))}St.useMiddleware(yr.SessionMiddleware)}))}}};cr([(0,mr.Inject)(),pr("design:type",mr.MidwayApplicationManager)],Sr.prototype,"applicationManager",void 0);cr([(0,mr.Logger)("coreLogger"),pr("design:type",Object)],Sr.prototype,"logger",void 0);cr([(0,mr.Config)("session"),pr("design:type",Object)],Sr.prototype,"sessionConfig",void 0);Sr=cr([(0,mr.Configuration)({namespace:"session",importConfigs:[{default:gr}]})],Sr);Dt.SessionConfiguration=Sr},65579:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.Configuration=void 0;pr(rr(58864),Dt);var mr=rr(16885);Object.defineProperty(Dt,"Configuration",{enumerable:true,get:function(){return mr.SessionConfiguration}});pr(rr(97628),Dt);pr(rr(11586),Dt)},58864:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.SessionStore=void 0;class SessionStore{}Dt.SessionStore=SessionStore},56720:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ContextSession=void 0;const cr=rr(39023);const pr=rr(92355);const mr=rr(16859);const gr=(0,cr.debuglog)("session:context");class ContextSession{constructor(St,Dt){this.ctx=St;this.app=St.app;this.opts=Object.assign({},Dt);this.store=this.opts.ContextStore?new this.opts.ContextStore(St):this.opts.store}get(){const St=this.session;if(St)return St;if(St===false)return null;this.store?this.create():this.initFromCookie();return this.session}set(St){if(St===null){this.session=false;return}if(typeof St==="object"){this.create(St,this.externalKey);return}throw new Error("this.session can only be set as null or an object.")}async initFromExternal(){gr("init from external");const St=this.ctx;const Dt=this.opts;let rr;if(Dt.externalKey){rr=Dt.externalKey.get(St);gr("get external key from custom %s",rr)}else{rr=St.cookies.get(Dt.key,Dt);gr("get external key from cookie %s",rr)}if(!rr){this.create();return}const cr=await this.store.get(rr,Dt.maxAge,{ctx:St,rolling:Dt.rolling});if(!this.valid(cr,rr)){this.create();return}this.create(cr,rr);this.prevHash=(0,pr.hash)(this.session.toJSON())}initFromCookie(){gr("init from cookie");const St=this.ctx;const Dt=this.opts;const rr=St.cookies.get(Dt.key,Dt);if(!rr){this.create();return}let cr;gr("parse %s",rr);try{cr=Dt.decode(rr)}catch(cr){gr("decode %j error: %s",rr,cr);if(!(cr instanceof SyntaxError)){St.cookies.set(Dt.key,"",Dt);cr.headers={"set-cookie":St.response.get("set-cookie")};throw cr}this.create();return}gr("parsed %j",cr);if(!this.valid(cr)){this.create();return}this.create(cr);this.prevHash=(0,pr.hash)(this.session.toJSON())}valid(St,Dt){const rr=this.ctx;if(!St){this.emit("missed",{key:Dt,value:St,ctx:rr});return false}if(St._expire&&St._expire<Date.now()){gr("expired session");this.emit("expired",{key:Dt,value:St,ctx:rr});return false}const cr=this.opts.valid;if(typeof cr==="function"&&!cr(rr,St)){gr("invalid session");this.emit("invalid",{key:Dt,value:St,ctx:rr});return false}return true}emit(St,Dt){setImmediate((()=>{this.app.emit(`session:${St}`,Dt)}))}create(St,Dt){gr("create session with val: %j externalKey: %s",St,Dt);if(this.store){this.externalKey=Dt||this.opts.genid&&this.opts.genid(this.ctx)}this.session=new mr.Session(this,St,this.externalKey)}async commit({save:St=false,regenerate:Dt=false}={}){const rr=this.session;const cr=this.opts;const pr=this.ctx;if(undefined===rr)return;if(rr===false){await this.remove();return}if(Dt){await this.remove();if(this.store)this.externalKey=cr.genid&&cr.genid(pr)}const mr=St||Dt||rr._requireSave?"force":this._shouldSaveSession();gr("should save session: %s",mr);if(!mr)return;if(typeof cr.beforeSave==="function"){gr("before save");cr.beforeSave(pr,rr)}const yr=mr==="changed";await this.save(yr)}_shouldSaveSession(){const St=this.prevHash;const Dt=this.session;const rr=Dt.toJSON();if(!St&&!Object.keys(rr).length)return"";const cr=St!==(0,pr.hash)(rr);if(cr)return"changed";if(this.opts.rolling)return"rolling";if(this.opts.renew){const St=Dt._expire;const rr=Dt.maxAge;if(St&&rr&&St-Date.now()<rr/2)return"renew"}return""}async remove(){const St=Object.assign({},this.opts,{expires:pr.COOKIE_EXP_DATE,maxAge:false});const Dt=this.ctx;const rr=St.key;const cr=this.externalKey;if(cr){await this.store.destroy(cr,{ctx:Dt})}Dt.cookies.set(rr,"",St)}async save(St){const Dt=this.opts;const rr=Dt.key;const cr=this.externalKey;let mr=this.session.toJSON();let yr=Dt.maxAge?Dt.maxAge:pr.ONE_DAY;if(yr==="session"){Dt.maxAge=undefined;mr._session=true}else{mr._expire=yr+Date.now();mr._maxAge=yr}if(cr){gr("save %j to external key %s",mr,cr);if(typeof yr==="number"){yr+=1e4}await this.store.set(cr,mr,yr,{changed:St,ctx:this.ctx,rolling:Dt.rolling});if(Dt.externalKey){Dt.externalKey.set(this.ctx,cr)}else{this.ctx.cookies.set(rr,cr,Dt)}return}gr("save %j to cookie",mr);mr=Dt.encode(mr);gr("save %s",mr);this.ctx.cookies.set(rr,mr,Dt)}}Dt.ContextSession=ContextSession},81361:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.crc32=void 0;const rr=[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(St,Dt=false){let cr=~0;for(let Dt=0,pr=St.length;Dt<pr;Dt++){cr=cr>>>8^rr[(cr^St.charCodeAt(Dt))&255]}cr=Math.abs(cr^-1);return Dt?cr.toString(16):cr}Dt.crc32=crc32},16859:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Session=void 0;class Session{constructor(St,Dt,rr){this.isNew=true;this._sessCtx=St;this._ctx=St.ctx;this._externalKey=rr;if(!Dt){this.isNew=true}else{for(const St in Dt){if(St==="_maxAge")this._ctx.sessionOptions.maxAge=Dt._maxAge;else if(St==="_session")this._ctx.sessionOptions.maxAge="session";else this[St]=Dt[St]}}}toJSON(){const St={};Object.keys(this).forEach((Dt=>{if(Dt==="isNew")return;if(Dt[0]==="_")return;St[Dt]=this[Dt]}));return St}get length(){return Object.keys(this.toJSON()).length}get populated(){return!!this.length}get maxAge(){return this._ctx.sessionOptions.maxAge}set maxAge(St){this._ctx.sessionOptions.maxAge=St;this._requireSave=true}get externalKey(){return this._externalKey}save(St){return this.commit({save:true},St)}regenerate(St){return this.commit({regenerate:true},St)}manuallyCommit(){return this.commit()}commit(St,Dt){if(typeof St==="function"){Dt=St;St={}}const rr=this._sessCtx.commit(St);if(Dt){rr.then((()=>Dt()),Dt)}else{return rr}}}Dt.Session=Session},11586:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SessionStoreManager=void 0;const pr=rr(46123);let mr=class SessionStoreManager{setSessionStore(St){this.sessionStore=St}getSessionStore(){return this.sessionStore}};mr=cr([(0,pr.Provide)(),(0,pr.Scope)(pr.ScopeEnum.Singleton)],mr);Dt.SessionStoreManager=mr},92355:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ONE_DAY=Dt.COOKIE_EXP_DATE=Dt.hash=Dt.encode=Dt.decode=void 0;const cr=rr(81361);function decode(St){const Dt=Buffer.from(St,"base64").toString("utf8");return JSON.parse(Dt)}Dt.decode=decode;function encode(St){St=JSON.stringify(St);return Buffer.from(St).toString("base64")}Dt.encode=encode;function hash(St){return(0,cr.crc32)(JSON.stringify(St))}Dt.hash=hash;Dt.COOKIE_EXP_DATE=new Date("Thu, 01 Jan 1970 00:00:00 GMT");Dt.ONE_DAY=24*60*60*1e3},97628:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SessionMiddleware=void 0;const mr=rr(46123);const gr=rr(11586);const yr=rr(92355);const Sr=rr(42613);const $r=rr(56720);const Er=Symbol("context#contextSession");const Ir=Symbol("context#_contextSession");function formatOpts(St){St=St||{};St.key=St.key||"koa.sess";if(!("maxAge"in St))St.maxAge=St.maxage;if(St.overwrite==null)St.overwrite=true;if(St.httpOnly==null)St.httpOnly=true;if(St.sameSite==null)delete St.sameSite;if(St.signed==null)St.signed=true;if(St.autoCommit==null)St.autoCommit=true;if(typeof St.encode!=="function"){St.encode=yr.encode}if(typeof St.decode!=="function"){St.decode=yr.decode}const Dt=St.store;if(Dt){Sr(mr.Types.isFunction(Dt.get),"store.get must be function");Sr(mr.Types.isFunction(Dt.set),"store.set must be function");Sr(mr.Types.isFunction(Dt.destroy),"store.destroy must be function")}const rr=St.externalKey;if(rr){Sr(mr.Types.isFunction(rr.get),"externalKey.get must be function");Sr(mr.Types.isFunction(rr.set),"externalKey.set must be function")}const cr=St.ContextStore;if(cr){Sr(mr.Types.isClass(cr),"ContextStore must be a class");Sr(mr.Types.isFunction(cr.prototype.get),"ContextStore.prototype.get must be function");Sr(mr.Types.isFunction(cr.prototype.set),"ContextStore.prototype.set must be function");Sr(mr.Types.isFunction(cr.prototype.destroy),"ContextStore.prototype.destroy must be function")}if(!St.genid){if(St.prefix){St.genid=()=>`${St.prefix}${mr.Utils.randomUUID()}`}else{St.genid=mr.Utils.randomUUID}}return St}function extendContext(St,Dt){if(St.hasOwnProperty(Er)){return}Object.defineProperties(St,{[Er]:{get(){if(this[Ir]){return this[Ir]}this[Ir]=new $r.ContextSession(this,Dt);return this[Ir]}},session:{get(){return this[Er].get()},set(St){this[Er].set(St)},configurable:true},sessionOptions:{get(){return this[Er].opts}}})}let Or=class SessionMiddleware{resolve(St){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 Dt=this.sessionStoreManager.getSessionStore();if(Dt){this.sessionConfig.store=Dt}const rr=formatOpts(this.sessionConfig);extendContext(St.context,rr);return async function session(St,Dt){const cr=St[Er];if(cr.store){await cr.initFromExternal()}try{await Dt()}finally{if(rr.autoCommit){await cr.commit()}}}}static getName(){return"session"}};cr([(0,mr.Config)("session"),pr("design:type",Object)],Or.prototype,"sessionConfig",void 0);cr([(0,mr.Logger)(),pr("design:type",Object)],Or.prototype,"logger",void 0);cr([(0,mr.Inject)(),pr("design:type",gr.SessionStoreManager)],Or.prototype,"sessionStoreManager",void 0);Or=cr([(0,mr.Middleware)()],Or);Dt.SessionMiddleware=Or},96313:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SocketIOConfiguration=void 0;const pr=rr(46123);let mr=class SocketIOConfiguration{};mr=cr([(0,pr.Configuration)({namespace:"socketIO"})],mr);Dt.SocketIOConfiguration=mr},53739:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwaySocketIOFramework=void 0;const pr=rr(46123);const mr=rr(39023);const gr=(0,mr.debuglog)("midway:socket.io");const yr=rr(46966);const Sr=rr(46123);let $r=class MidwaySocketIOFramework extends pr.BaseFramework{constructor(){super(...arguments);this.namespaceList=[];this.connectionMiddlewareManager=this.createMiddlewareManager()}configure(){return this.configService.getConfiguration("socketIO")}applicationInitialize(){this.app=new yr.Server(this.configurationOptions);this.defineApplicationProperties({useConnectionMiddleware:St=>this.useConnectionMiddleware(St),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(pr.HTTP_SERVER_KEY)){this.app.attach(this.applicationContext.get(pr.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((St=>{this.app.close((()=>{setTimeout((()=>{St()}),1e3)}))}))}getFrameworkType(){return pr.MidwayFrameworkType.WS_IO}async loadMidwayController(){const St=(0,Sr.listModule)(Sr.WS_CONTROLLER_KEY);for(const Dt of St){await this.addNamespace(Dt)}}async addNamespace(St){var Dt,rr;const cr=(0,Sr.getClassMetadata)(Sr.WS_CONTROLLER_KEY,St);const mr=this.app.of(cr.namespace);this.namespaceList.push(cr.namespace);const yr=(Dt=cr.routerOptions.middleware)!==null&&Dt!==void 0?Dt:[];const $r=(rr=cr.routerOptions.connectionMiddleware)!==null&&rr!==void 0?rr:[];mr.use(((St,Dt)=>{this.app.createAnonymousContext(St);St.requestContext.registerObject("socket",St);St.app=this.app;Dt()}));mr.on("connect",(Dt=>{let rr=this.middlewareService.compose([...this.connectionMiddlewareManager,...$r],this.app).then((St=>St(Dt)));const cr=(0,Sr.getClassMetadata)(Sr.WS_EVENT_KEY,St);const mr={};const Er=cr.filter((St=>St.eventType===Sr.WSEventTypeEnum.ON_CONNECTION));if(Er.length){rr=rr.then((()=>Promise.all(Er.map((async rr=>{var cr;mr[rr.propertyName]=mr[rr.propertyName]||{responseEvents:[]};const pr=await Dt.requestContext.getAsync(St);try{const St=await this.middlewareService.compose([...((cr=rr===null||rr===void 0?void 0:rr.eventOptions)===null||cr===void 0?void 0:cr.middleware)||[],async(St,cr)=>pr[rr.propertyName].apply(pr,[Dt])],this.app);const gr=await St(Dt);await this.bindSocketResponse(gr,Dt,rr.propertyName,mr)}catch(St){this.logger.error(St)}})))))}const Ir=cr.filter((St=>St.eventType!==Sr.WSEventTypeEnum.ON_CONNECTION));if(Ir.length){for(const cr of Ir){mr[cr.propertyName]=mr[cr.propertyName]||{responseEvents:[]};if(cr.eventType===Sr.WSEventTypeEnum.ON_MESSAGE){Dt.on(cr.messageEventName,(async(...Sr)=>{await rr;const $r=await Dt.requestContext.getAsync(St);gr("got message",cr.messageEventName,Sr);try{const rr=await(await this.applyMiddleware((async(Dt,rr)=>{var mr;const gr=await this.middlewareService.compose([...yr,...((mr=cr===null||cr===void 0?void 0:cr.eventOptions)===null||mr===void 0?void 0:mr.middleware)||[],async(Dt,rr)=>{const mr=await this.app.getFramework().runGuard(Dt,St,cr.propertyName);if(!mr){throw new pr.MidwayInvokeForbiddenError(cr.propertyName,St)}return $r[cr.propertyName].apply($r,Sr)}],this.app);return await gr(Dt,rr)})))(Dt);if(typeof Sr[Sr.length-1]==="function"){Sr[Sr.length-1](rr)}else{await this.bindSocketResponse(rr,Dt,cr.propertyName,mr)}}catch(St){this.logger.error(St)}}))}else if(cr.eventType===Sr.WSEventTypeEnum.ON_DISCONNECTION){Dt.on("disconnect",(async rr=>{const pr=await Dt.requestContext.getAsync(St);try{const St=await pr[cr.propertyName].apply(pr,[rr]);await this.bindSocketResponse(St,Dt,cr.propertyName,mr)}catch(St){this.logger.error(St)}}))}else{mr[cr.propertyName].responseEvents.push(cr)}}}}));if(mr.adapter&&mr.adapter.on){mr.adapter.on("error",(St=>{this.logger.error(St)}))}mr.on("error",(St=>{this.logger.error(St)}))}async bindSocketResponse(St,Dt,rr,cr){if(St&&cr[rr]){for(const pr of cr[rr].responseEvents){if(pr.eventType===Sr.WSEventTypeEnum.EMIT){if(pr.roomName.length){Dt=pr.roomName.reduce(((St,Dt)=>St.to(Dt)),Dt)}Dt.emit.apply(Dt,[pr.messageEventName].concat(St))}else if(pr.eventType===Sr.WSEventTypeEnum.BROADCAST){Dt.nsp.emit.apply(Dt.nsp,[].concat(St))}}}}getFrameworkName(){return"midway:socketIO"}useConnectionMiddleware(St){this.connectionMiddlewareManager.insertLast(St)}getConnectionMiddleware(){return this.connectionMiddlewareManager}};$r=cr([(0,Sr.Framework)()],$r);Dt.MidwaySocketIOFramework=$r},87735:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.Configuration=Dt.createRedisAdapter=Dt.Framework=void 0;var mr=rr(53739);Object.defineProperty(Dt,"Framework",{enumerable:true,get:function(){return mr.MidwaySocketIOFramework}});var gr=rr(47191);Object.defineProperty(Dt,"createRedisAdapter",{enumerable:true,get:function(){return gr.createRedisAdapter}});pr(rr(94460),Dt);var yr=rr(96313);Object.defineProperty(Dt,"Configuration",{enumerable:true,get:function(){return yr.SocketIOConfiguration}})},94460:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},47191:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.createRedisAdapter=void 0;const cr=rr(56748);function createRedisAdapter(St){if(St.host&&St.port){return(0,cr.createAdapter)("redis://"+St.host+":"+St.port,St)}if(St.pubClient&&St.subClient){return(0,cr.createAdapter)(St)}throw new Error("error socket adapter options")}Dt.createRedisAdapter=createRedisAdapter},95567:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});const cr=rr(16928);Dt["default"]=St=>({staticFile:{dirs:{default:{prefix:"/public",dir:(0,cr.join)(St.appDir,"public")}},dynamic:true,preload:false,buffer:false,maxFiles:1e3}})},40647:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.StaticFileConfiguration=void 0;const mr=rr(46123);const gr=rr(88218);const yr=rr(95567);let Sr=class StaticFileConfiguration{async onConfigLoad(){if(this.applicationManager.getApplication("faas")){return{staticFile:{buffer:true}}}}async onReady(St){this.applicationManager.getApplications(["koa","faas","egg"]).forEach((Dt=>{if(St.hasNamespace("cross-domain")){Dt.getMiddleware().insertAfter(gr.StaticMiddleware,"cors")}else{Dt.getMiddleware().insertFirst(gr.StaticMiddleware)}}))}};cr([(0,mr.Inject)(),pr("design:type",mr.MidwayApplicationManager)],Sr.prototype,"applicationManager",void 0);Sr=cr([(0,mr.Configuration)({namespace:"static-file",importConfigs:[{default:yr}]})],Sr);Dt.StaticFileConfiguration=Sr},44803:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.DirectoryNotFoundError=Dt.StaticFileErrorEnum=void 0;const cr=rr(46123);Dt.StaticFileErrorEnum=(0,cr.registerErrorCode)("static_file",{DIRECTORY_NOT_EXISTS:1e4});class DirectoryNotFoundError extends cr.MidwayError{constructor(St){super(`Path ${St} not exist, please check it.`,Dt.StaticFileErrorEnum.DIRECTORY_NOT_EXISTS)}}Dt.DirectoryNotFoundError=DirectoryNotFoundError},2865:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.Configuration=void 0;var mr=rr(40647);Object.defineProperty(Dt,"Configuration",{enumerable:true,get:function(){return mr.StaticFileConfiguration}});pr(rr(88218),Dt);pr(rr(20066),Dt);pr(rr(44803),Dt)},20066:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},88218:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.StaticMiddleware=void 0;const mr=rr(46123);const gr=rr(42613);const yr=rr(4239);const Sr=rr(91404);const $r=rr(93546);const Er=rr(44803);const Ir=rr(79896);let Or=class StaticMiddleware{async resolve(St){const Dt=Object.values(this.staticFileConfig.dirs);if(this.staticFileConfig.dir){Dt.push(this.staticFileConfig.dir)}const rr=[];function rangeMiddleware(St,Dt){const cr=rr.some((Dt=>St.path.startsWith(Dt)));if(cr){return $r(St,Dt)}return Dt()}const cr=[rangeMiddleware];for(const St of Dt){gr(mr.Types.isObject(St)||mr.Types.isString(St),"`config.static.dir` must be `string | Array<string|object>`.");const Dt=Object.assign({},this.staticFileConfig,St);if(Dt.dynamic&&!Dt.files){Dt.files=new Sr(Dt.maxFiles)}if(Dt.prefix){rr.push(Dt.prefix)}if(this.environmentService.isPkgEnvironment()){if(!Ir.existsSync(Dt.dir)){throw new Er.DirectoryNotFoundError(Dt.dir)}}else{if(!await mr.FileUtils.exists(Dt.dir)){throw new Er.DirectoryNotFoundError(Dt.dir)}}this.logger.info("[midway:static] starting static serve %s -> %s",Dt.prefix,Dt.dir);cr.push(yr(Dt))}return await this.middlewareService.compose(cr,St,"staticFile")}static getName(){return"staticFile"}};cr([(0,mr.Config)("staticFile"),pr("design:type",Object)],Or.prototype,"staticFileConfig",void 0);cr([(0,mr.Inject)(),pr("design:type",mr.MidwayMiddlewareService)],Or.prototype,"middlewareService",void 0);cr([(0,mr.Inject)(),pr("design:type",mr.MidwayEnvironmentService)],Or.prototype,"environmentService",void 0);cr([(0,mr.Logger)("coreLogger"),pr("design:type",Object)],Or.prototype,"logger",void 0);Or=cr([(0,mr.Middleware)()],Or);Dt.StaticMiddleware=Or},73455:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.isEnumMetadata=Dt.isEnumDefined=Dt.isEnumArray=Dt.addEnumSchema=Dt.addEnumArraySchema=Dt.getEnumType=Dt.getEnumValues=void 0;function getEnumValues(St){if(Array.isArray(St)){return St}if(typeof St!=="object"){return[]}const Dt=Object.keys(St).filter((St=>isNaN(Number(St)))).map((Dt=>St[Dt]));return Array.from(new Set(Dt))}Dt.getEnumValues=getEnumValues;function getEnumType(St){const Dt=St.filter((St=>typeof St==="string")).length>0;return Dt?"string":"number"}Dt.getEnumType=getEnumType;function addEnumArraySchema(St,Dt){const rr=St.schema||{};St.schema=rr;rr.type="array";delete St.isArray;const cr=getEnumValues(Dt.enum);rr.items={type:getEnumType(cr),enum:cr};if(Dt.enumName){St.enumName=Dt.enumName}}Dt.addEnumArraySchema=addEnumArraySchema;function addEnumSchema(St,Dt){const rr=St.schema||{};const cr=getEnumValues(Dt.enum);St.schema=rr;rr.enum=cr;rr.type=getEnumType(cr);if(Dt.enumName){St.enumName=Dt.enumName}}Dt.addEnumSchema=addEnumSchema;const isEnumArray=St=>St.isArray&&St.enum;Dt.isEnumArray=isEnumArray;const isEnumDefined=St=>St.enum;Dt.isEnumDefined=isEnumDefined;const isEnumMetadata=St=>{var Dt;return St.enum||St.isArray&&((Dt=St.items)===null||Dt===void 0?void 0:Dt["enum"])};Dt.isEnumMetadata=isEnumMetadata},80163:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.HttpStatus=void 0;var rr;(function(St){St[St["CONTINUE"]=100]="CONTINUE";St[St["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";St[St["PROCESSING"]=102]="PROCESSING";St[St["EARLYHINTS"]=103]="EARLYHINTS";St[St["OK"]=200]="OK";St[St["CREATED"]=201]="CREATED";St[St["ACCEPTED"]=202]="ACCEPTED";St[St["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";St[St["NO_CONTENT"]=204]="NO_CONTENT";St[St["RESET_CONTENT"]=205]="RESET_CONTENT";St[St["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";St[St["AMBIGUOUS"]=300]="AMBIGUOUS";St[St["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";St[St["FOUND"]=302]="FOUND";St[St["SEE_OTHER"]=303]="SEE_OTHER";St[St["NOT_MODIFIED"]=304]="NOT_MODIFIED";St[St["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";St[St["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";St[St["BAD_REQUEST"]=400]="BAD_REQUEST";St[St["UNAUTHORIZED"]=401]="UNAUTHORIZED";St[St["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";St[St["FORBIDDEN"]=403]="FORBIDDEN";St[St["NOT_FOUND"]=404]="NOT_FOUND";St[St["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";St[St["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";St[St["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";St[St["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";St[St["CONFLICT"]=409]="CONFLICT";St[St["GONE"]=410]="GONE";St[St["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";St[St["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";St[St["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";St[St["URI_TOO_LONG"]=414]="URI_TOO_LONG";St[St["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";St[St["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";St[St["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";St[St["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";St[St["MISDIRECTED"]=421]="MISDIRECTED";St[St["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";St[St["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";St[St["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";St[St["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";St[St["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";St[St["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";St[St["BAD_GATEWAY"]=502]="BAD_GATEWAY";St[St["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";St[St["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";St[St["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(rr=Dt.HttpStatus||(Dt.HttpStatus={}))},68641:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.swagger=void 0;const cr=rr(3376);const pr=rr(46123);const mr=(0,pr.safeRequire)("swagger-ui-dist");Dt.swagger={title:"My Project",description:"This is a swagger-ui for midwayjs project",version:"1.0.0",swaggerPath:"/swagger-ui",swaggerUIRender:mr&&mr.getAbsoluteFSPath?cr.renderSwaggerUIDist:cr.renderSwaggerUIRemote,swaggerUIRenderOptions:{},isGenerateTagForController:true}},9317:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SwaggerConfiguration=void 0;const mr=rr(46123);const gr=rr(49179);const yr=rr(68641);let Sr=class SwaggerConfiguration{async onReady(St){const Dt=this.applicationManager.getApplications(["express","koa","egg","faas"]);if(Dt.length){const rr=await St.getAsync(gr.SwaggerExplorer);rr.scanApp();let cr=this.configService.getConfiguration("globalPrefix")||this.configService.getConfiguration("koa.globalPrefix")||this.configService.getConfiguration("express.globalPrefix")||this.configService.getConfiguration("egg.globalPrefix");if(cr){if(!/^\//.test(cr)){cr="/"+cr}rr.addGlobalPrefix(cr)}Dt.forEach((St=>{St.useMiddleware(gr.SwaggerMiddleware)}))}}};cr([(0,mr.Inject)(),pr("design:type",mr.MidwayApplicationManager)],Sr.prototype,"applicationManager",void 0);cr([(0,mr.Inject)(),pr("design:type",mr.MidwayConfigService)],Sr.prototype,"configService",void 0);Sr=cr([(0,mr.Configuration)({importConfigs:[{default:yr}],namespace:"swagger"})],Sr);Dt.SwaggerConfiguration=Sr},48574:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.DECORATORS=Dt.DECORATORS_METHOD_METADATA=Dt.DECORATORS_CLASS_METADATA=Dt.DECORATORS_PREFIX=void 0;Dt.DECORATORS_PREFIX="swagger";Dt.DECORATORS_CLASS_METADATA="swagger:class_metadata";Dt.DECORATORS_METHOD_METADATA="swagger:method_metadata";Dt.DECORATORS={API_OPERATION:`${Dt.DECORATORS_PREFIX}/apiOperation`,API_RESPONSE:`${Dt.DECORATORS_PREFIX}/apiResponse`,API_TAGS:`${Dt.DECORATORS_PREFIX}/apiUseTags`,API_PARAMETERS:`${Dt.DECORATORS_PREFIX}/apiParameters`,API_HEADERS:`${Dt.DECORATORS_PREFIX}/apiHeaders`,API_MODEL_PROPERTIES:`${Dt.DECORATORS_PREFIX}/apiModelProperties`,API_EXTRA_MODEL:`${Dt.DECORATORS_PREFIX}/apiExtraModel`,API_MODEL_PROPERTIES_ARRAY:`${Dt.DECORATORS_PREFIX}/apiModelPropertiesArray`,API_SECURITY:`${Dt.DECORATORS_PREFIX}/apiSecurity`,API_EXCLUDE_SECURITY:`${Dt.DECORATORS_PREFIX}/apiExcludeSecurity`,API_EXCLUDE_ENDPOINT:`${Dt.DECORATORS_PREFIX}/apiExcludeEndpoint`,API_EXCLUDE_CONTROLLER:`${Dt.DECORATORS_PREFIX}/apiExcludeController`,API_EXTENSION:`${Dt.DECORATORS_PREFIX}/apiExtension`}},51102:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiBasicAuth=void 0;const cr=rr(55118);function ApiBasicAuth(St="basic"){return(0,cr.ApiSecurity)(St)}Dt.ApiBasicAuth=ApiBasicAuth},21873:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiBearerAuth=void 0;const cr=rr(55118);function ApiBearerAuth(St="bearer"){return(0,cr.ApiSecurity)(St)}Dt.ApiBearerAuth=ApiBearerAuth},65288:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiBody=Dt.BodyContentType=void 0;const cr=rr(73455);const pr=rr(15071);var mr;(function(St){St["FormUrlEncoded"]="application/x-www-form-urlencoded";St["JSON"]="application/json";St["Multipart"]="multipart/form-data";St["MultipartMixed"]="multipart/mixed";St["OctetStream"]="application/octet-stream"})(mr=Dt.BodyContentType||(Dt.BodyContentType={}));const gr={type:String,required:true};function ApiBody(St){const[Dt,rr]=(0,pr.getTypeIsArrayTuple)(St.type,St.isArray);const mr={in:"body",...St,type:Dt,isArray:rr};if((0,cr.isEnumArray)(St)){(0,cr.addEnumArraySchema)(mr,St)}else if((0,cr.isEnumDefined)(St)){(0,cr.addEnumSchema)(mr,St)}return(0,pr.createParamDecorator)(mr,gr)}Dt.ApiBody=ApiBody},80222:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiCookieAuth=void 0;const cr=rr(55118);function ApiCookieAuth(St="cookie"){return(0,cr.ApiSecurity)(St)}Dt.ApiCookieAuth=ApiCookieAuth},44097:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiExcludeController=void 0;const cr=rr(46123);const pr=rr(48574);function ApiExcludeController(St=true){return Dt=>{(0,cr.saveClassMetadata)(pr.DECORATORS.API_EXCLUDE_CONTROLLER,{disable:St},Dt)}}Dt.ApiExcludeController=ApiExcludeController},61944:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiExcludeEndpoint=void 0;const cr=rr(48574);const pr=rr(15071);function ApiExcludeEndpoint(St=true){return(0,pr.createMixedDecorator)(cr.DECORATORS.API_EXCLUDE_ENDPOINT,true)}Dt.ApiExcludeEndpoint=ApiExcludeEndpoint},70821:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiExtension=void 0;const cr=rr(48574);const pr=rr(15071);function ApiExtension(St,Dt){if(!St.startsWith("x-")){throw new Error("Extension key is not prefixed. Please ensure you prefix it with `x-`.")}const rr={[St]:JSON.parse(JSON.stringify(Dt))};return(0,pr.createMixedDecorator)(cr.DECORATORS.API_EXTENSION,rr)}Dt.ApiExtension=ApiExtension},91582:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiExtraModel=void 0;const cr=rr(48574);const pr=rr(15071);function ApiExtraModel(St){return(0,pr.createMixedDecorator)(cr.DECORATORS.API_EXTRA_MODEL,St)}Dt.ApiExtraModel=ApiExtraModel},40301:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiHeaders=Dt.ApiHeader=void 0;const cr=rr(48574);const pr=rr(73455);const mr=rr(15071);const gr={name:""};function ApiHeader(St){const Dt={name:!St.name?gr.name:St.name,in:"header",description:St.description,required:St.required,schema:{...St.schema||{},type:"string"}};if(St.enum){const rr=(0,pr.getEnumValues)(St.enum);Dt.schema={enum:rr,type:(0,pr.getEnumType)(rr)}}return(St,rr,pr)=>{if(pr){return(0,mr.createMixedDecorator)(cr.DECORATORS.API_HEADERS,Dt)(St,rr,pr)}return(0,mr.createMixedDecorator)(cr.DECORATORS.API_HEADERS,Dt)(St,undefined,undefined)}}Dt.ApiHeader=ApiHeader;const ApiHeaders=St=>(Dt,rr,cr)=>{St.forEach((St=>ApiHeader(St)(Dt,rr,cr)))};Dt.ApiHeaders=ApiHeaders},10555:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiOAuth2=void 0;const cr=rr(55118);function ApiOAuth2(St,Dt="oauth2"){return(0,cr.ApiSecurity)(Dt,St)}Dt.ApiOAuth2=ApiOAuth2},39025:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiOperation=void 0;const cr=rr(48574);const pr=rr(15071);const mr={summary:""};function ApiOperation(St){return(0,pr.createMixedDecorator)(cr.DECORATORS.API_OPERATION,{...mr,...St})}Dt.ApiOperation=ApiOperation},58729:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiParam=void 0;const cr=rr(15071);const pr=rr(73455);const mr={name:"",required:true};function ApiParam(St){const Dt={name:!St.name?mr.name:St.name,in:"path",...St};const rr=St;if(rr.enum){Dt.schema=Dt.schema||{};const St=Dt.schema;const cr=(0,pr.getEnumValues)(rr.enum);St.type=(0,pr.getEnumType)(cr);St.enum=cr;if(rr.enumName){Dt.enumName=rr.enumName}}return(0,cr.createParamDecorator)(Dt,mr)}Dt.ApiParam=ApiParam},13529:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiResponseProperty=Dt.ApiPropertyOptional=Dt.createApiPropertyDecorator=Dt.ApiProperty=void 0;const cr=rr(48574);const pr=rr(73455);const mr=rr(15071);const isEnumArray=St=>St.isArray&&!!St.enum;function ApiProperty(St={}){return createApiPropertyDecorator(St)}Dt.ApiProperty=ApiProperty;function createApiPropertyDecorator(St={}){const[Dt,rr]=(0,mr.getTypeIsArrayTuple)(St.type,St.isArray);St={...St,type:Dt};if(isEnumArray(St)){St.type="array";const Dt=(0,pr.getEnumValues)(St.enum);St.items={type:(0,pr.getEnumType)(Dt),enum:Dt};delete St.enum}else if(St.enum){const Dt=(0,pr.getEnumValues)(St.enum);St.enum=Dt;St.type=(0,pr.getEnumType)(Dt)}if(rr){St.type="array";St.items={type:Dt}}return(0,mr.createPropertyDecorator)(cr.DECORATORS.API_MODEL_PROPERTIES,St)}Dt.createApiPropertyDecorator=createApiPropertyDecorator;function ApiPropertyOptional(St={}){return ApiProperty({...St,required:false})}Dt.ApiPropertyOptional=ApiPropertyOptional;function ApiResponseProperty(St={}){return ApiProperty({readOnly:true,...St})}Dt.ApiResponseProperty=ApiResponseProperty},60360:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiQuery=void 0;const cr=rr(73455);const pr=rr(15071);const mr={name:"",required:true};function ApiQuery(St){const Dt=St;const[rr,gr]=(0,pr.getTypeIsArrayTuple)(Dt.type,Dt.isArray);const yr={name:!St.name?mr.name:St.name,in:"query",...St,type:rr};if((0,cr.isEnumArray)(St)){(0,cr.addEnumArraySchema)(yr,St)}else if((0,cr.isEnumDefined)(St)){(0,cr.addEnumSchema)(yr,St)}if(gr){yr.isArray=gr}return(0,pr.createParamDecorator)(yr,mr)}Dt.ApiQuery=ApiQuery},95555:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiDefaultResponse=Dt.ApiUnsupportedMediaTypeResponse=Dt.ApiUnprocessableEntityResponse=Dt.ApiServiceUnavailableResponse=Dt.ApiRequestTimeoutResponse=Dt.ApiPayloadTooLargeResponse=Dt.ApiPreconditionFailedResponse=Dt.ApiNotImplementedResponse=Dt.ApiNotAcceptableResponse=Dt.ApiMethodNotAllowedResponse=Dt.ApiGoneResponse=Dt.ApiGatewayTimeoutResponse=Dt.ApiForbiddenResponse=Dt.ApiConflictResponse=Dt.ApiBadGatewayResponse=Dt.ApiInternalServerErrorResponse=Dt.ApiNotFoundResponse=Dt.ApiTooManyRequestsResponse=Dt.ApiUnauthorizedResponse=Dt.ApiBadRequestResponse=Dt.ApiFoundResponse=Dt.ApiMovedPermanentlyResponse=Dt.ApiNoContentResponse=Dt.ApiAcceptedResponse=Dt.ApiCreatedResponse=Dt.ApiOkResponse=Dt.ApiResponse=void 0;const cr=rr(48574);const pr=rr(15071);const mr=rr(80163);function ApiResponse(St){const[Dt,rr]=(0,pr.getTypeIsArrayTuple)(St.type,St.isArray);St.type=Dt;St.isArray=rr;St.description=St.description?St.description:"";const mr={[St.status||"default"]:St};return(0,pr.createMixedDecorator)(cr.DECORATORS.API_RESPONSE,mr)}Dt.ApiResponse=ApiResponse;const ApiOkResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.OK});Dt.ApiOkResponse=ApiOkResponse;const ApiCreatedResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.CREATED});Dt.ApiCreatedResponse=ApiCreatedResponse;const ApiAcceptedResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.ACCEPTED});Dt.ApiAcceptedResponse=ApiAcceptedResponse;const ApiNoContentResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.NO_CONTENT});Dt.ApiNoContentResponse=ApiNoContentResponse;const ApiMovedPermanentlyResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.MOVED_PERMANENTLY});Dt.ApiMovedPermanentlyResponse=ApiMovedPermanentlyResponse;const ApiFoundResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.FOUND});Dt.ApiFoundResponse=ApiFoundResponse;const ApiBadRequestResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.BAD_REQUEST});Dt.ApiBadRequestResponse=ApiBadRequestResponse;const ApiUnauthorizedResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.UNAUTHORIZED});Dt.ApiUnauthorizedResponse=ApiUnauthorizedResponse;const ApiTooManyRequestsResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.TOO_MANY_REQUESTS});Dt.ApiTooManyRequestsResponse=ApiTooManyRequestsResponse;const ApiNotFoundResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.NOT_FOUND});Dt.ApiNotFoundResponse=ApiNotFoundResponse;const ApiInternalServerErrorResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.INTERNAL_SERVER_ERROR});Dt.ApiInternalServerErrorResponse=ApiInternalServerErrorResponse;const ApiBadGatewayResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.BAD_GATEWAY});Dt.ApiBadGatewayResponse=ApiBadGatewayResponse;const ApiConflictResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.CONFLICT});Dt.ApiConflictResponse=ApiConflictResponse;const ApiForbiddenResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.FORBIDDEN});Dt.ApiForbiddenResponse=ApiForbiddenResponse;const ApiGatewayTimeoutResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.GATEWAY_TIMEOUT});Dt.ApiGatewayTimeoutResponse=ApiGatewayTimeoutResponse;const ApiGoneResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.GONE});Dt.ApiGoneResponse=ApiGoneResponse;const ApiMethodNotAllowedResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.METHOD_NOT_ALLOWED});Dt.ApiMethodNotAllowedResponse=ApiMethodNotAllowedResponse;const ApiNotAcceptableResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.NOT_ACCEPTABLE});Dt.ApiNotAcceptableResponse=ApiNotAcceptableResponse;const ApiNotImplementedResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.NOT_IMPLEMENTED});Dt.ApiNotImplementedResponse=ApiNotImplementedResponse;const ApiPreconditionFailedResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.PRECONDITION_FAILED});Dt.ApiPreconditionFailedResponse=ApiPreconditionFailedResponse;const ApiPayloadTooLargeResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.PAYLOAD_TOO_LARGE});Dt.ApiPayloadTooLargeResponse=ApiPayloadTooLargeResponse;const ApiRequestTimeoutResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.REQUEST_TIMEOUT});Dt.ApiRequestTimeoutResponse=ApiRequestTimeoutResponse;const ApiServiceUnavailableResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.SERVICE_UNAVAILABLE});Dt.ApiServiceUnavailableResponse=ApiServiceUnavailableResponse;const ApiUnprocessableEntityResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.UNPROCESSABLE_ENTITY});Dt.ApiUnprocessableEntityResponse=ApiUnprocessableEntityResponse;const ApiUnsupportedMediaTypeResponse=(St={})=>ApiResponse({...St,status:mr.HttpStatus.UNSUPPORTED_MEDIA_TYPE});Dt.ApiUnsupportedMediaTypeResponse=ApiUnsupportedMediaTypeResponse;const ApiDefaultResponse=(St={})=>ApiResponse({...St,status:"default"});Dt.ApiDefaultResponse=ApiDefaultResponse},55118:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiExcludeSecurity=Dt.ApiSecurity=void 0;const cr=rr(48574);const pr=rr(15071);function ApiSecurity(St,Dt=[]){let rr;if(typeof St==="string"){rr={[St]:Dt||[]}}else{rr=St}return(0,pr.createMixedDecorator)(cr.DECORATORS.API_SECURITY,rr)}Dt.ApiSecurity=ApiSecurity;function ApiExcludeSecurity(){return(0,pr.createMixedDecorator)(cr.DECORATORS.API_EXCLUDE_SECURITY,true)}Dt.ApiExcludeSecurity=ApiExcludeSecurity},37505:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.ApiTags=void 0;const cr=rr(48574);const pr=rr(15071);function ApiTags(St){return(0,pr.createMixedDecorator)(cr.DECORATORS.API_TAGS,St)}Dt.ApiTags=ApiTags},15071:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.getSchemaPath=Dt.getTypeIsArrayTuple=Dt.createParamDecorator=Dt.createMixedDecorator=Dt.createPropertyDecorator=void 0;const cr=rr(46123);const pr=rr(48574);function createPropertyDecorator(St,Dt){return(0,cr.createCustomPropertyDecorator)(St,Dt,false)}Dt.createPropertyDecorator=createPropertyDecorator;function createMixedDecorator(St,Dt){return(rr,mr)=>{if(mr){(0,cr.attachPropertyDataToClass)(pr.DECORATORS_METHOD_METADATA,{key:St,propertyName:mr,metadata:Dt},rr,mr)}else{(0,cr.attachClassMetadata)(pr.DECORATORS_CLASS_METADATA,{key:St,metadata:Dt},rr)}}}Dt.createMixedDecorator=createMixedDecorator;function createParamDecorator(St,Dt){return createMixedDecorator(pr.DECORATORS.API_PARAMETERS,{...Dt,...St})}Dt.createParamDecorator=createParamDecorator;function getTypeIsArrayTuple(St,Dt){if(!St){return[St,Dt]}if(Dt){return[St,Dt]}const rr=Array.isArray(St);const cr=rr?St[0]:St;return[cr,rr]}Dt.getTypeIsArrayTuple=getTypeIsArrayTuple;function getSchemaPath(St){let Dt=St;if(typeof St!=="string"){Dt=St?St.name:St}return`#/components/schemas/${Dt}`}Dt.getSchemaPath=getSchemaPath},74398:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.getSchemaPath=Dt.ApiResponseProperty=Dt.ApiPropertyOptional=Dt.ApiProperty=void 0;pr(rr(65288),Dt);pr(rr(61944),Dt);pr(rr(44097),Dt);pr(rr(40301),Dt);pr(rr(39025),Dt);pr(rr(58729),Dt);var mr=rr(13529);Object.defineProperty(Dt,"ApiProperty",{enumerable:true,get:function(){return mr.ApiProperty}});Object.defineProperty(Dt,"ApiPropertyOptional",{enumerable:true,get:function(){return mr.ApiPropertyOptional}});Object.defineProperty(Dt,"ApiResponseProperty",{enumerable:true,get:function(){return mr.ApiResponseProperty}});pr(rr(60360),Dt);pr(rr(95555),Dt);pr(rr(37505),Dt);pr(rr(70821),Dt);pr(rr(51102),Dt);pr(rr(21873),Dt);pr(rr(80222),Dt);pr(rr(10555),Dt);pr(rr(55118),Dt);pr(rr(91582),Dt);var gr=rr(15071);Object.defineProperty(Dt,"getSchemaPath",{enumerable:true,get:function(){return gr.getSchemaPath}})},2171:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.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(St){this.document.info.title=St;return this}setDescription(St){this.document.info.description=St;return this}setVersion(St){this.document.info.version=St;return this}setTermsOfService(St){this.document.info.termsOfService=St;return this}setContact(St,Dt,rr){this.document.info.contact={name:St,url:Dt,email:rr};return this}setLicense(St,Dt){this.document.info.license={name:St,url:Dt};return this}addServer(St,Dt,rr){this.document.servers.push({url:St,description:Dt,variables:rr});return this}setExternalDoc(St,Dt){this.document.externalDocs={description:St,url:Dt};return this}addPaths(St){Object.assign(this.document.paths,St);return this}getPaths(){return this.document.paths}setPaths(St){this.document.paths=St;return this}addSchema(St){if(!this.document.components.schemas){this.document.components.schemas={}}Object.assign(this.document.components.schemas,St);return this}getSchema(St){var Dt,rr;if((Dt=this.document.components)===null||Dt===void 0?void 0:Dt.schemas){return(rr=this.document.components)===null||rr===void 0?void 0:rr.schemas[St]}return undefined}addTag(St,Dt="",rr){const cr=this.document.tags||[];if(Array.isArray(St)){const Dt=St;for(const rr of Dt){if(!cr.find((Dt=>Dt.name===St))){cr.push({name:rr,description:""})}}return this}if(!cr.find((Dt=>Dt.name===St))){cr.push({name:St,description:Dt,externalDocs:rr})}else{cr.forEach((cr=>{if(cr.name===St){if(Dt){cr.description=Dt}if(rr){cr.externalDocs=rr}}}))}this.document.tags=cr;return this}addSecurity(St,Dt){this.document.components.securitySchemes={...this.document.components.securitySchemes||{},[St]:Dt};return this}addSecurityRequirements(St,Dt=[]){let rr;if(typeof St==="string"){rr={[St]:Dt}}else{rr=St}this.document.security=(this.document.security||[]).concat({...rr});return this}addBearerAuth(St={type:"http"},Dt="bearer"){this.addSecurity(Dt,{type:"http",scheme:"bearer",bearerFormat:"JWT",...St});return this}addOAuth2(St={type:"oauth2"},Dt="oauth2"){if(!Dt){Dt="oauth2"}this.addSecurity(Dt,{type:"oauth2",flows:{...St===null||St===void 0?void 0:St.flows}});return this}addApiKey(St={type:"apiKey"},Dt="api_key"){if(!Dt){Dt="api_key"}this.addSecurity(Dt,{type:"apiKey",in:"header",name:Dt,...St});return this}addBasicAuth(St={type:"http"},Dt="basic"){if(!Dt){Dt="basic"}this.addSecurity(Dt,{type:"http",scheme:"basic",...St});return this}addCookieAuth(St="connect.sid",Dt={type:"apiKey"},rr="cookie"){if(!St){St="connect.sid"}if(!rr){rr="cookie"}this.addSecurity(rr,{type:"apiKey",in:"cookie",name:St,...Dt});return this}sortTags(){const St=this.document.tags;this.document.tags=St.sort(((St,Dt)=>{const rr=St.name;const cr=Dt.name;const pr=rr.length>cr.length?cr.length:rr.length;for(let St=0;St<pr;St++){if(rr.charCodeAt(St)>cr.charCodeAt(St)){return 1}else if(rr.charCodeAt(St)<cr.charCodeAt(St)){return-1}}return 0}))}build(){return this.document}}Dt.DocumentBuilder=DocumentBuilder},49179:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.renderJSON=Dt.renderSwaggerUIDist=Dt.renderSwaggerUIRemote=Dt.SwaggerMiddleware=Dt.SwaggerExplorer=Dt.Configuration=void 0;pr(rr(74398),Dt);pr(rr(87448),Dt);var mr=rr(9317);Object.defineProperty(Dt,"Configuration",{enumerable:true,get:function(){return mr.SwaggerConfiguration}});var gr=rr(33984);Object.defineProperty(Dt,"SwaggerExplorer",{enumerable:true,get:function(){return gr.SwaggerExplorer}});var yr=rr(64811);Object.defineProperty(Dt,"SwaggerMiddleware",{enumerable:true,get:function(){return yr.SwaggerMiddleware}});var Sr=rr(3376);Object.defineProperty(Dt,"renderSwaggerUIRemote",{enumerable:true,get:function(){return Sr.renderSwaggerUIRemote}});Object.defineProperty(Dt,"renderSwaggerUIDist",{enumerable:true,get:function(){return Sr.renderSwaggerUIDist}});Object.defineProperty(Dt,"renderJSON",{enumerable:true,get:function(){return Sr.renderJSON}});pr(rr(48574),Dt)},87448:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true})},33984:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SwaggerExplorer=void 0;const mr=rr(46123);const gr=rr(48574);const yr=rr(2171);const Sr=rr(49179);const $r=rr(73455);let Er=class SwaggerExplorer{constructor(){this.swaggerConfig={};this.documentBuilder=new yr.DocumentBuilder;this.operationIdFactory=(St,Dt)=>`${St.toLowerCase()}_${Dt.method.toLocaleLowerCase()}`}async init(){var St,Dt,rr,cr,pr,mr,gr,yr,Sr,$r,Er,Ir,Or,Hr,Gr,Tn,Wn,Gn,mi,$i,ki,Ni,Ri,Vi,ji,Ui,zi,Ki,Xi,Yi,xa;this.documentBuilder.setTitle(this.swaggerConfig.title);this.documentBuilder.setVersion(this.swaggerConfig.version);this.documentBuilder.setDescription(this.swaggerConfig.description);if(((St=this.swaggerConfig)===null||St===void 0?void 0:St.contact)&&typeof((Dt=this.swaggerConfig)===null||Dt===void 0?void 0:Dt.contact)==="object"){this.documentBuilder.setContact((cr=(rr=this.swaggerConfig)===null||rr===void 0?void 0:rr.contact)===null||cr===void 0?void 0:cr.name,(mr=(pr=this.swaggerConfig)===null||pr===void 0?void 0:pr.contact)===null||mr===void 0?void 0:mr.url,(yr=(gr=this.swaggerConfig)===null||gr===void 0?void 0:gr.contact)===null||yr===void 0?void 0:yr.email)}if(((Sr=this.swaggerConfig)===null||Sr===void 0?void 0:Sr.license)&&typeof(($r=this.swaggerConfig)===null||$r===void 0?void 0:$r.license)==="object"){this.documentBuilder.setLicense((Ir=(Er=this.swaggerConfig)===null||Er===void 0?void 0:Er.license)===null||Ir===void 0?void 0:Ir.name,(Hr=(Or=this.swaggerConfig)===null||Or===void 0?void 0:Or.license)===null||Hr===void 0?void 0:Hr.url)}if(this.swaggerConfig.termsOfService){this.documentBuilder.setTermsOfService(this.swaggerConfig.termsOfService)}if(((Gr=this.swaggerConfig)===null||Gr===void 0?void 0:Gr.externalDocs)&&typeof((Tn=this.swaggerConfig)===null||Tn===void 0?void 0:Tn.externalDocs)==="object"){this.documentBuilder.setExternalDoc((Gn=(Wn=this.swaggerConfig)===null||Wn===void 0?void 0:Wn.externalDocs)===null||Gn===void 0?void 0:Gn.description,($i=(mi=this.swaggerConfig)===null||mi===void 0?void 0:mi.externalDocs)===null||$i===void 0?void 0:$i.url)}if(((ki=this.swaggerConfig)===null||ki===void 0?void 0:ki.servers)&&Array.isArray((Ni=this.swaggerConfig)===null||Ni===void 0?void 0:Ni.servers)){for(const St of(Ri=this.swaggerConfig)===null||Ri===void 0?void 0:Ri.servers){this.documentBuilder.addServer(St===null||St===void 0?void 0:St.url,St===null||St===void 0?void 0:St.description,St===null||St===void 0?void 0:St.variables)}}if(((Vi=this.swaggerConfig)===null||Vi===void 0?void 0:Vi.tags)&&Array.isArray((ji=this.swaggerConfig)===null||ji===void 0?void 0:ji.tags)){for(const St of(Ui=this.swaggerConfig)===null||Ui===void 0?void 0:Ui.tags){this.documentBuilder.addTag(St.name,St.description,St.externalDocs)}}if((Ki=(zi=this.swaggerConfig)===null||zi===void 0?void 0:zi.documentOptions)===null||Ki===void 0?void 0:Ki.operationIdFactory){this.operationIdFactory=this.swaggerConfig.documentOptions.operationIdFactory}if(Array.isArray((Xi=this.swaggerConfig)===null||Xi===void 0?void 0:Xi.auth)){for(const St of(Yi=this.swaggerConfig)===null||Yi===void 0?void 0:Yi.auth){this.setAuth(St)}}else{this.setAuth((xa=this.swaggerConfig)===null||xa===void 0?void 0:xa.auth)}}addGlobalPrefix(St){if(!St){return}const Dt=this.documentBuilder.getPaths();const rr={};for(const[cr,pr]of Object.entries(Dt)){if(!/^\//.test(cr)){rr[`${St}/${cr}`]=pr}else{rr[`${St}${cr}`]=pr}}this.documentBuilder.setPaths(rr)}scanApp(){var St;const Dt=(0,mr.listModule)(mr.CONTROLLER_KEY);for(const St of Dt){this.generatePath(St)}if((St=this.swaggerConfig)===null||St===void 0?void 0:St.tagSortable){this.documentBuilder.sortTags()}}getData(){return this.documentBuilder.build()}getDocumentBuilder(){return this.documentBuilder}generatePath(St){var Dt;const rr=(0,mr.getClassMetadata)(gr.DECORATORS.API_EXCLUDE_CONTROLLER,St);if(rr&&rr.disable){return}const cr=(Dt=this.swaggerConfig.isGenerateTagForController)!==null&&Dt!==void 0?Dt:true;this.parseExtraModel(St);const pr=(0,mr.getClassMetadata)(gr.DECORATORS_CLASS_METADATA,St)||[];const yr=(0,mr.getClassMetadata)(mr.INJECT_CUSTOM_PARAM,St)||[];const Sr=(0,mr.getClassMetadata)(mr.CONTROLLER_KEY,St);const $r=Sr.prefix;const Er=pr.filter((St=>St.key===gr.DECORATORS.API_TAGS));let Ir=[];const Or=[];if(Er.length>0){Ir=parseTags(Er);Ir.forEach((St=>{addTag(St,Or)}))}else{if(cr){const St={name:"",description:""};if($r!=="/"){St.name=(Sr===null||Sr===void 0?void 0:Sr.routerOptions.tagName)||(/^\//.test($r)?$r.split("/")[1]:$r);St.description=(Sr===null||Sr===void 0?void 0:Sr.routerOptions.description)||St.name}else{St.name=Sr===null||Sr===void 0?void 0:Sr.routerOptions.tagName;St.description=(Sr===null||Sr===void 0?void 0:Sr.routerOptions.description)||St.name}if(St.name){Ir.push(St.name);addTag([St.name,St.description],Or)}}else{}}const Hr=(0,mr.getClassMetadata)(mr.WEB_ROUTER_KEY,St);let Gr=pr.filter((St=>St.key===gr.DECORATORS.API_HEADERS));if(Gr.length>0){Gr=Gr.map((St=>St.metadata))}const Tn=pr.filter((St=>St.key===gr.DECORATORS.API_SECURITY));const Wn={};if(Hr&&typeof Hr[Symbol.iterator]==="function"){for(const Dt of Hr){let rr=($r+Dt.path).replace("//","/");rr=replaceUrl(rr,parseParamsInPath(rr));const cr=(0,mr.getPropertyDataFromClass)(gr.DECORATORS_METHOD_METADATA,St,Dt.method)||[];const Sr=cr.filter((St=>St.key===gr.DECORATORS.API_SECURITY));const Er=cr.filter((St=>St.key===gr.DECORATORS.API_EXCLUDE_ENDPOINT&&St.propertyName===Dt.method));if(Er[0]){continue}if(this.swaggerConfig.routerFilter){const St=this.swaggerConfig.routerFilter(rr,Dt);if(St){continue}}const Hr=yr[Dt.method]||[];const Gn=Hr.filter((St=>{var Dt;return St.key===mr.WEB_ROUTER_PARAM_KEY&&((Dt=St===null||St===void 0?void 0:St.metadata)===null||Dt===void 0?void 0:Dt.type)===mr.RouteParamTypes.BODY}));if(Gn.length>1){continue}this.generateRouteMethod(rr,Dt,Wn,cr,Hr,Gr,St);if(Wn[rr][Dt.requestMethod].tags.length===0){Wn[rr][Dt.requestMethod].tags=Ir}else{Wn[rr][Dt.requestMethod].tags.forEach((St=>{addTag(St,Or)}))}const mi=cr.filter((St=>St.key===gr.DECORATORS.API_EXTENSION&&St.propertyName===Dt.method));for(const St of mi){if(St.metadata){Object.assign(Wn[rr][Dt.requestMethod],St.metadata)}}const $i=cr.find((St=>St.key===gr.DECORATORS.API_EXCLUDE_SECURITY));const ki=Sr.length>0;const Ni=pr.find((St=>St.key===gr.DECORATORS.API_EXCLUDE_SECURITY));const Ri=Tn.length>0;if($i){Wn[rr][Dt.requestMethod].security=[]}else if(ki){Wn[rr][Dt.requestMethod].security=Sr.map((St=>St.metadata)).filter(Boolean)}else if(Ni){Wn[rr][Dt.requestMethod].security=[]}else if(Ri){Wn[rr][Dt.requestMethod].security=Tn.map((St=>St.metadata)).filter(Boolean)}}}this.documentBuilder.addPaths(Wn);if(Object.keys(Wn).length>0){Or.forEach((St=>{if(Array.isArray(St)){this.documentBuilder.addTag(St[0],St[1])}else{this.documentBuilder.addTag(St)}}))}}generateRouteMethod(St,Dt,rr,cr,pr,yr,$r){var Er,Ir,Or,Hr,Gr,Tn,Wn,Gn,mi,$i,ki,Ni,Ri,Vi,ji,Ui,zi,Ki,Xi;const Yi=cr.filter((St=>St.key===gr.DECORATORS.API_OPERATION&&St.propertyName===Dt.method))[0];const xa=cr.filter((St=>St.key===gr.DECORATORS.API_TAGS&&St.propertyName===Dt.method));const Ta=parseTags(xa);let wa=rr[St];if(!wa){wa={}}const Ia=[];wa[Dt.requestMethod]={summary:getNotEmptyValue((Er=Yi===null||Yi===void 0?void 0:Yi.metadata)===null||Er===void 0?void 0:Er.summary,Dt.summary),description:getNotEmptyValue((Ir=Yi===null||Yi===void 0?void 0:Yi.metadata)===null||Ir===void 0?void 0:Ir.description,Dt.description),operationId:((Or=Yi===null||Yi===void 0?void 0:Yi.metadata)===null||Or===void 0?void 0:Or.operationId)||this.getOperationId($r.name,Dt),tags:Ta.length?Ta:(Gr=(Hr=Yi===null||Yi===void 0?void 0:Yi.metadata)===null||Hr===void 0?void 0:Hr.tags)!==null&&Gr!==void 0?Gr:[]};if(((Tn=Yi===null||Yi===void 0?void 0:Yi.metadata)===null||Tn===void 0?void 0:Tn.deprecated)!=null){wa[Dt.requestMethod].deprecated=!!((Wn=Yi===null||Yi===void 0?void 0:Yi.metadata)===null||Wn===void 0?void 0:Wn.deprecated)}const Oa=pr.filter((St=>{var Dt;return St.key===mr.WEB_ROUTER_PARAM_KEY&&((Dt=St===null||St===void 0?void 0:St.metadata)===null||Dt===void 0?void 0:Dt.type)!==mr.RouteParamTypes.CUSTOM}));const Ra=(0,mr.getMethodParamTypes)($r,Dt.method);const La=cr.filter((St=>St.key===gr.DECORATORS.API_PARAMETERS&&St.propertyName===Dt.method));for(const St of La){if(St.metadata.schema===undefined){St.metadata.schema={};if(St.metadata.type){St.metadata.schema["type"]=St.metadata.type;delete St.metadata.type}if(St.metadata.isArray){St.metadata.schema["items"]={type:St.metadata.schema["type"]};St.metadata.schema["type"]="array";delete St.metadata.isArray}if(St.metadata.enum!==undefined){St.metadata.schema.enum=St.metadata.enum;delete St.metadata.enum}}else{delete St.metadata.type;delete St.metadata.isArray;delete St.metadata.enum}const rr=St.metadata;rr.schema=this.formatType(St.metadata.schema);if(rr.in==="query"||rr.in==="path"||rr.in==="header"){Ia.push(rr)}else if(rr.in==="body"){rr.content=(Gn=rr.content)!==null&&Gn!==void 0?Gn:{};if(Object.keys(rr.content).length===0){rr.content[rr.contentType||"application/json"]=(mi=rr.content[rr.contentType||"application/json"])!==null&&mi!==void 0?mi:{schema:rr.schema}}for(const St in rr.content){rr.content[St].schema=this.formatType(rr.content[St].schema)}wa[Dt.requestMethod].requestBody=($i=wa[Dt.requestMethod].requestBody)!==null&&$i!==void 0?$i:{};wa[Dt.requestMethod].requestBody.description=(ki=wa[Dt.requestMethod].requestBody.description)!==null&&ki!==void 0?ki:rr.description;wa[Dt.requestMethod].requestBody.content=(Ni=wa[Dt.requestMethod].requestBody.content)!==null&&Ni!==void 0?Ni:rr.content;wa[Dt.requestMethod].requestBody.required=(Ri=wa[Dt.requestMethod].requestBody.required)!==null&&Ri!==void 0?Ri:rr.required}}for(const rr of Oa){const cr=Ra[rr.parameterIndex];const pr={name:(Vi=rr===null||rr===void 0?void 0:rr.metadata)===null||Vi===void 0?void 0:Vi.propertyData,in:convertTypeToString((ji=rr.metadata)===null||ji===void 0?void 0:ji.type),required:false};const gr=Ia.find((St=>{var Dt;return St.name===((Dt=rr===null||rr===void 0?void 0:rr.metadata)===null||Dt===void 0?void 0:Dt.propertyData)&&St.in===pr.in}));if(gr){continue}if(pr.in==="path"){pr.required=true;if(St.indexOf("{"+pr.name+"}")===-1){continue}}if(mr.Types.isClass(cr)){this.parseClzz(cr)}if(pr.in==="query"||pr.in==="path"){if(mr.Types.isClass(cr)){const St=this.documentBuilder.getSchema(cr.name);Object.keys(St.properties).forEach((Dt=>{var rr,cr;const mr={name:Dt,in:pr.in,description:(rr=St.properties[Dt])===null||rr===void 0?void 0:rr.description,schema:St.properties[Dt],required:((cr=St.required)===null||cr===void 0?void 0:cr.includes(Dt))||false};Ia.push(mr)}));continue}else{if(!pr.name){continue}pr.schema={type:convertSchemaType((Ui=cr===null||cr===void 0?void 0:cr.name)!==null&&Ui!==void 0?Ui:cr)}}}else if(pr.in==="body"){if(Dt.requestMethod===mr.RequestMethod.GET){continue}if(wa[Dt.requestMethod].requestBody){continue}if(((zi=rr.metadata)===null||zi===void 0?void 0:zi.type)===mr.RouteParamTypes.FILESSTREAM){pr.content={};pr.content[Sr.BodyContentType.Multipart]={schema:{type:"object",properties:{files:{type:"array",items:{type:"string",format:"binary"},description:pr.description}}}}}else if(((Ki=rr.metadata)===null||Ki===void 0?void 0:Ki.type)===mr.RouteParamTypes.FILESTREAM){pr.content={};pr.content[Sr.BodyContentType.Multipart]={schema:{type:"object",properties:{file:{type:"string",format:"binary",description:pr.description}}}}}else{if(mr.Types.isClass(cr)){pr.content={"application/json":{schema:{$ref:"#/components/schemas/"+cr.name}}}}else{pr.content={"text/plain":{schema:{type:convertSchemaType((Xi=cr===null||cr===void 0?void 0:cr.name)!==null&&Xi!==void 0?Xi:cr)}}}}}wa[Dt.requestMethod].requestBody={required:true,description:pr.description||pr.name,content:pr.content};continue}Ia.push(pr)}if(yr&&yr.length){yr.forEach((St=>Ia.unshift(St)))}const Ba=cr.filter((St=>St.key===gr.DECORATORS.API_HEADERS));if(Ba.length>0){Ba.forEach((St=>Ia.unshift(St.metadata)))}wa[Dt.requestMethod].parameters=Ia;const Ua=cr.filter((St=>St.key===gr.DECORATORS.API_RESPONSE&&St.propertyName===Dt.method));const Ja={};for(const St of Ua){const Dt=St.metadata;const rr=Object.keys(Dt);for(const St of rr){const rr=Dt[St];if(rr.schema){rr.content={"application/json":{schema:this.formatType(rr.schema)}};delete rr.schema}else if(rr.type){if(mr.Types.isClass(rr.type)){this.parseClzz(rr.type);if(rr.isArray){rr.content={"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/"+rr.type.name}}}}}else{rr.content={"application/json":{schema:{$ref:"#/components/schemas/"+rr.type.name}}}}}else{rr.content={"text/plain":{schema:{type:convertSchemaType(rr.type)}}}}}delete rr.status;delete rr.type;delete rr.isArray;delete rr.format}Object.assign(Ja,Dt)}if(Object.keys(Ja).length>0){wa[Dt.requestMethod].responses=Ja}else{wa[Dt.requestMethod].responses={200:{description:"OK"}}}rr[St]=wa}getOperationId(St,Dt){return this.operationIdFactory(St,Dt)}parseExtraModel(St){const Dt=(0,mr.getClassMetadata)(gr.DECORATORS_CLASS_METADATA,St)||[];const rr=Dt.filter((St=>St.key===gr.DECORATORS.API_EXTRA_MODEL));for(const St of rr){if(Array.isArray(St.metadata)){for(const Dt of St.metadata){this.parseClzz(Dt)}}else{this.parseClzz(St.metadata)}}}parseSubPropertyType(St){var Dt,rr,cr;let pr;if(St===null||St===void 0?void 0:St.enum){pr={type:St===null||St===void 0?void 0:St.type,enum:St===null||St===void 0?void 0:St.enum,default:St===null||St===void 0?void 0:St.default};if(St===null||St===void 0?void 0:St.description){pr.description=St===null||St===void 0?void 0:St.description}return pr}if((Dt=St===null||St===void 0?void 0:St.items)===null||Dt===void 0?void 0:Dt.enum){pr={type:St===null||St===void 0?void 0:St.type,items:St===null||St===void 0?void 0:St.items,default:St===null||St===void 0?void 0:St.default};if(St===null||St===void 0?void 0:St.description){pr.description=St===null||St===void 0?void 0:St.description}return pr}let gr=false;let yr=parseTypeSchema(St===null||St===void 0?void 0:St.type);St===null||St===void 0?true:delete St.type;if(yr==="array"){gr=true;yr=parseTypeSchema((rr=St===null||St===void 0?void 0:St.items)===null||rr===void 0?void 0:rr.type);St===null||St===void 0?true:delete St.items.type}if(St===null||St===void 0?void 0:St.oneOf){pr={oneOf:[]};St===null||St===void 0?void 0:St.oneOf.forEach((St=>{pr.push(this.parseSubPropertyType(St))}));St===null||St===void 0?true:delete St.oneOf}if(mr.Types.isClass(yr)){this.parseClzz(yr);if(gr){pr={type:"array",items:{$ref:"#/components/schemas/"+(yr===null||yr===void 0?void 0:yr.name)}}}else{pr={$ref:"#/components/schemas/"+(yr===null||yr===void 0?void 0:yr.name)}}delete St.items}else{if(gr){if(!yr){if((cr=St===null||St===void 0?void 0:St.items)===null||cr===void 0?void 0:cr["$ref"]){St.items["$ref"]=parseTypeSchema(St.items["$ref"])}pr={type:"array",items:St===null||St===void 0?void 0:St.items}}else{pr={type:"array",items:{type:convertSchemaType((yr===null||yr===void 0?void 0:yr.name)||yr)}}}delete St.items}else{pr={type:yr,format:St===null||St===void 0?void 0:St.format};if(pr.type==="Date"){pr.type="string";if(!pr.format){pr.format="date"}}delete St.format}}return Object.assign(pr,St)}formatType(St){if(St===null){return null}if(St.enum){if(Array.isArray(St.enum)){St.enum.map((St=>this.formatType(St)))}else{St.enum=(0,$r.getEnumValues)(St.enum)}}if(St.not){St.not=this.formatType(St.not)}if(St["$ref"]&&typeof St["$ref"]==="function"){St["$ref"]=St["$ref"]()}if(St.oneOf){St.oneOf=St.oneOf.map((St=>this.formatType(St)))}else if(St.anyOf){St.anyOf=St.anyOf.map((St=>this.formatType(St)))}else if(St.allOf){St.allOf=St.allOf.map((St=>this.formatType(St)))}["not","$ref","oneOf","anyOf","allOf"].forEach((Dt=>{if(St[Dt]){delete St["type"]}}));if(St.properties){const Dt={};for(const rr in St.properties){Dt[rr]=this.formatType(St.properties[rr])}St.properties=Dt}if(St.additionalProperties){St.additionalProperties=this.formatType(St.additionalProperties)}if(["string","number","boolean","integer"].includes(St.type)){}else if(St.type===Number){St.type="number"}else if(St.type===String){St.type="string"}else if(St.type===Boolean){St.type="boolean"}else if(St.type==="date"||St.type==="Date"||St.type===Date){St.type="string";St.format="date-time"}else if(St.type===Array||St.type==="array"){St.type="array";if(St.items){St.items=this.formatType(St.items)}}else if(Array.isArray(St.type)){St.items=this.formatType({type:St.type[0]});St.type="array"}else if(St.type===Object||St.type==="object"){St.type="object"}else if(mr.Types.isClass(St.type)){this.parseClzz(St.type);St["$ref"]="#/components/schemas/"+St.type.name;delete St["type"]}else if(St.type instanceof Function){St.type=St.type();this.formatType(St)}return St}parseClzz(St){if(this.documentBuilder.getSchema(St.name)){return this.documentBuilder.getSchema(St.name)}this.parseExtraModel(St);const Dt=(0,mr.getClassExtendedMetadata)(mr.INJECT_CUSTOM_PROPERTY,St);const rr={type:"object",properties:{}};this.documentBuilder.addSchema({[St.name]:rr});if(Dt){for(const cr of Object.keys(Dt)){const pr=Dt[cr].metadata||{};if(!pr.type){pr.type=(0,mr.getPropertyType)(St.prototype,cr).name}rr.properties[cr]=rr.properties[cr]||{};for(const St in pr){if(St==="required"&&pr["required"]){if(!rr.required){rr.required=[]}rr.required.push(cr)}else if(["oneOf","anyOf","allOf"].includes(St)){rr.properties[cr][St]=[];pr[St].forEach((Dt=>{rr.properties[cr][St].push(this.formatType(Dt))}))}else if(St==="not"){rr.properties[cr][St]=this.formatType(pr[St])}else if(St==="type"){this.formatType(pr);if(pr.type){rr.properties[cr].type=pr.type}if(pr["$ref"]){rr.properties[cr].$ref=pr["$ref"]}if(pr.items){rr.properties[cr].items=pr.items}if(pr.format){rr.properties[cr].format=pr.format}if(pr.pattern){rr.properties[cr].pattern=pr.pattern}if(pr.enum){rr.properties[cr].enum=pr.enum}}else if(St==="items"||St==="pattern"||St==="format"||St==="enum"||St==="$ref"){}else{rr.properties[cr][St]=pr[St]}}}}return rr}setAuth(St){if(!St){return}const{authType:Dt,name:rr="",addSecurityRequirements:cr=false,...pr}=St;if(!Dt){return}switch(Dt){case"basic":{this.documentBuilder.addBasicAuth(pr,rr);break}case"bearer":{this.documentBuilder.addBearerAuth(pr,rr);break}case"cookie":{const{cookieName:St,securityName:Dt,...rr}=pr;this.documentBuilder.addCookieAuth(St,rr,Dt);break}case"oauth2":{this.documentBuilder.addOAuth2(pr,rr);break}case"apikey":{this.documentBuilder.addApiKey(pr,rr);break}case"custom":{this.documentBuilder.addSecurity(rr,pr);break}}if(cr){this.documentBuilder.addSecurityRequirements(rr)}}};cr([(0,mr.Config)("swagger"),pr("design:type",Object)],Er.prototype,"swaggerConfig",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Er.prototype,"init",null);Er=cr([(0,mr.Provide)(),(0,mr.Scope)(mr.ScopeEnum.Singleton)],Er);Dt.SwaggerExplorer=Er;function parseParamsInPath(St){const Dt=[];St.split("/").forEach((St=>{if(St.startsWith(":")){const rr=St.slice(1);Dt.push(rr)}}));return Dt}function replaceUrl(St,Dt){Dt.forEach((Dt=>{St=St.replace(`:${Dt}`,`{${Dt}}`)}));return St}function convertTypeToString(St){switch(St){case mr.RouteParamTypes.HEADERS:return"header";case mr.RouteParamTypes.QUERY:return"query";case mr.RouteParamTypes.PARAM:return"path";case mr.RouteParamTypes.BODY:case mr.RouteParamTypes.FIELDS:case mr.RouteParamTypes.FILESSTREAM:case mr.RouteParamTypes.FILESTREAM:return"body";default:return"header"}}function convertSchemaType(St){switch(St){case"Object":return"object";case"Boolean":return"boolean";case"Number":return"number";case"String":return"string";default:return"object"}}function getNotEmptyValue(...St){for(const Dt of St){if(Dt){return Dt}}}function parseTypeSchema(St){switch(St){case String:return"string";case Number:return"number";case Boolean:return"boolean";default:if(typeof St==="function"&&!mr.Types.isClass(St)){St=St()}return St}}function parseTags(St){let Dt=[];if(St.length>0){for(const rr of St){Dt=Dt.concat(rr.metadata)}}return Dt}function addTag(St,Dt=[]){if(Dt.find((Dt=>{if(Array.isArray(St)){return Dt===St[0]}else{return Dt===St}}))){}else{Dt.push(St)}}},64811:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.SwaggerMiddleware=void 0;const mr=rr(46123);const gr=rr(33984);let yr=class SwaggerMiddleware{async init(){if(typeof this.swaggerConfig.swaggerUIRender!=="function"){throw new mr.MidwayInvalidConfigPropertyError("swagger.swaggerRender")}this.swaggerRender=this.swaggerConfig.swaggerUIRender(this.swaggerConfig,this.swaggerExplorer)}resolve(St){if(St.getNamespace()==="express"){return async(St,Dt,rr)=>{const cr=St.path;const pr=await this.swaggerRender(cr);if(pr){const{ext:St,content:rr}=pr;if(St===".js"){Dt.type("application/javascript")}else if(St===".map"){Dt.type("application/json")}else if(St===".css"){Dt.type("text/css")}else if(St===".png"){Dt.type("image/png")}Dt.send(rr)}else{return rr()}}}else{return async(St,Dt)=>{const rr=St.path;const cr=await this.swaggerRender(rr);if(cr){const{ext:Dt,content:rr}=cr;if(Dt===".js"){St.set("Content-Type","application/javascript")}else if(Dt===".map"){St.set("Content-Type","application/json")}else if(Dt===".css"){St.set("Content-Type","text/css")}else if(Dt===".png"){St.set("Content-Type","image/png")}St.body=rr}else{return Dt()}}}}static getName(){return"swagger"}};cr([(0,mr.Config)("swagger"),pr("design:type",Object)],yr.prototype,"swaggerConfig",void 0);cr([(0,mr.Inject)(),pr("design:type",gr.SwaggerExplorer)],yr.prototype,"swaggerExplorer",void 0);cr([(0,mr.Inject)(),pr("design:type",mr.MidwayEnvironmentService)],yr.prototype,"environmentService",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],yr.prototype,"init",null);yr=cr([(0,mr.Provide)(),(0,mr.Scope)(mr.ScopeEnum.Singleton)],yr);Dt.SwaggerMiddleware=yr},3376:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.renderSwaggerUIRemote=Dt.renderJSON=Dt.renderSwaggerUIDist=void 0;const cr=rr(46123);const pr=rr(79896);const mr=rr(16928);function renderSwaggerUIDist(St,Dt){const{getAbsoluteFSPath:rr}=(0,cr.safeRequire)("swagger-ui-dist");if(!rr){throw new cr.MidwayCommonError("swagger-ui-dist is not installed")}const gr=St.swaggerUIRenderOptions||{};if(gr.customInitializer){if((0,mr.isAbsolute)(gr.customInitializer)){gr.customInitializer=(0,pr.readFileSync)(gr.customInitializer)}else{throw new cr.MidwayInvalidConfigPropertyError("swagger.swaggerRenderOptions.customInitializer",["Buffer","String"])}}function replaceInfo(Dt){let rr=`location.href.replace('${St.swaggerPath}/index.html', '${St.swaggerPath}/index.json'),\n validatorUrl: null,`;if(St.displayOptions){Object.entries(St.displayOptions).forEach((([St,Dt])=>{const cr=typeof Dt==="string"?`'${Dt}'`:Dt;rr+=`\n${St}: ${cr},`}))}return Dt.replace('"https://petstore.swagger.io/v2/swagger.json",',rr)}const yr=rr();return async rr=>{if(!yr||rr.indexOf(St.swaggerPath)===-1){return}const cr=rr.split("/");let Sr=cr.pop();if(Sr==="index.json"){return{ext:"json",content:Dt.getData()}}if(!Sr){Sr="index.html"}let $r=(0,pr.readFileSync)((0,mr.join)(yr,Sr));if(Sr==="swagger-initializer.js"&&(gr===null||gr===void 0?void 0:gr.customInitializer)){return{ext:"js",content:gr.customInitializer}}if(Sr==="index.html"||Sr==="swagger-initializer.js"){$r=$r.toString("utf8");$r=replaceInfo($r)}const Er=(0,mr.extname)(Sr);return{ext:Er,content:$r}}}Dt.renderSwaggerUIDist=renderSwaggerUIDist;function renderJSON(St,Dt){return async rr=>{if(rr.indexOf(St.swaggerPath)===-1){return}const cr=rr.split("/");const pr=cr.pop();if(pr==="index.json"){return{ext:"json",content:Dt.getData()}}return}}Dt.renderJSON=renderJSON;function renderSwaggerUIRemote(St,Dt){const rr=St.swaggerUIRenderOptions||{};const cr=(rr===null||rr===void 0?void 0:rr.indexPagePath)||(0,mr.join)(__dirname,"../../index.html");return async rr=>{if(rr.indexOf(St.swaggerPath)===-1){return}const mr=rr.split("/");let gr=mr.pop();if(gr==="index.json"){return{ext:"json",content:Dt.getData()}}if(!gr){gr="index.html"}if(gr==="index.html"){const St=(0,pr.readFileSync)(cr,"utf8");return{ext:"html",content:St}}return}}Dt.renderSwaggerUIRemote=renderSwaggerUIRemote},77053:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.i18n=Dt.validate=void 0;Dt.validate={validationOptions:{},errorStatus:422};Dt.i18n={localeTable:{en_US:{validate:rr(98044)},zh_CN:{validate:rr(62462)}}}},41601:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.ValidateConfiguration=void 0;const mr=rr(46123);const gr=rr(77053);const yr=rr(75284);const Sr=rr(68255);const $r=rr(47215);const Er=rr(6482);let Ir=class ValidateConfiguration{async init(){this.decoratorService.registerParameterHandler(Er.VALID_KEY,(({parameterIndex:St,originParamType:Dt,originArgs:rr,metadata:cr})=>{if(!cr.schema){cr.schema=this.validateService.getSchema(Dt)}return rr[St]}))}async onReady(St){await St.getAsync($r.ValidationPipe);await St.getAsync($r.ParseIntPipe);await St.getAsync($r.ParseBoolPipe);await St.getAsync($r.ParseFloatPipe);await St.getAsync($r.DecoratorValidPipe);this.decoratorService.registerParameterPipes(mr.WEB_ROUTER_PARAM_KEY,[$r.ValidationPipe])}};cr([(0,mr.Inject)(),pr("design:type",mr.MidwayDecoratorService)],Ir.prototype,"decoratorService",void 0);cr([(0,mr.Inject)(),pr("design:type",yr.ValidateService)],Ir.prototype,"validateService",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Ir.prototype,"init",null);Ir=cr([(0,mr.Configuration)({namespace:"validate",imports:[Sr],importConfigs:[{default:gr}]})],Ir);Dt.ValidateConfiguration=Ir},6482:(St,Dt)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.VALID_KEY=Dt.VALIDATE_KEY=Dt.RULES_CLASS_KEY=Dt.RULES_KEY=void 0;Dt.RULES_KEY="common:rules";Dt.RULES_CLASS_KEY="common:class_rules";Dt.VALIDATE_KEY="common:validate";Dt.VALID_KEY="validate:valid"},61171:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.RuleType=Dt.Rule=void 0;const cr=rr(15192);Dt.RuleType=cr;const pr=rr(46123);const mr=rr(6482);function Rule(St,Dt={required:true}){return function(rr,gr){if(gr){if(!cr.isSchema(St)){St=cr.object((0,pr.getClassMetadata)(mr.RULES_KEY,St)).meta({id:St.name});if((0,pr.getPropertyType)(rr,gr).name==="Array"){St=cr.array().items(St);if(Dt.min){St=St.min(Dt.min)}if(Dt.max){St=St.max(Dt.max)}}if(Dt.required){St=St.required()}}(0,pr.attachClassMetadata)(mr.RULES_KEY,St,rr,gr)}else{if(cr.isSchema(St)){}}}}Dt.Rule=Rule},99419:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Valid=void 0;const cr=rr(46123);const pr=rr(6482);const mr=rr(47215);function Valid(St,Dt){if(Array.isArray(St)){Dt=St;St=undefined}else{Dt=Dt||[]}return(0,cr.createCustomParamDecorator)(pr.VALID_KEY,{schema:St},{pipes:[mr.DecoratorValidPipe,...Dt]})}Dt.Valid=Valid},75995:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.Validate=void 0;const cr=rr(46123);const pr=rr(6482);function Validate(St={}){return(Dt,rr,mr)=>{(0,cr.savePropertyMetadata)(pr.VALIDATE_KEY,St,Dt,rr)}}Dt.Validate=Validate},48698:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.OmitDto=Dt.PickDto=void 0;const cr=rr(46123);const pr=rr(6482);function PickDto(St,Dt){const pickedDto=function(){};pickedDto.prototype=St.prototype;const rr=(0,cr.getClassExtendedMetadata)(pr.RULES_KEY,St);const mr={};for(const St of Dt){if(rr[St]){mr[St]=rr[St]}}(0,cr.saveClassMetadata)(pr.RULES_KEY,mr,pickedDto);return pickedDto}Dt.PickDto=PickDto;function OmitDto(St,Dt){const pickedDto=function(){};pickedDto.prototype=St.prototype;const rr=(0,cr.getClassExtendedMetadata)(pr.RULES_KEY,St);const mr=Object.assign({},rr);for(const St of Dt){delete mr[St]}(0,cr.saveClassMetadata)(pr.RULES_KEY,mr,pickedDto);return pickedDto}Dt.OmitDto=OmitDto},42429:(St,Dt,rr)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:true});Dt.MidwayValidationError=void 0;const cr=rr(46123);const pr=(0,cr.registerErrorCode)("validate",{VALIDATE_FAIL:1e4});class MidwayValidationError extends cr.MidwayHttpError{constructor(St,Dt,rr){super(St,Dt,pr.VALIDATE_FAIL,{cause:rr})}}Dt.MidwayValidationError=MidwayValidationError},99375:function(St,Dt,rr){"use strict";var cr=this&&this.__createBinding||(Object.create?function(St,Dt,rr,cr){if(cr===undefined)cr=rr;var pr=Object.getOwnPropertyDescriptor(Dt,rr);if(!pr||("get"in pr?!Dt.__esModule:pr.writable||pr.configurable)){pr={enumerable:true,get:function(){return Dt[rr]}}}Object.defineProperty(St,cr,pr)}:function(St,Dt,rr,cr){if(cr===undefined)cr=rr;St[cr]=Dt[rr]});var pr=this&&this.__exportStar||function(St,Dt){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(Dt,rr))cr(Dt,St,rr)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.Configuration=void 0;var mr=rr(41601);Object.defineProperty(Dt,"Configuration",{enumerable:true,get:function(){return mr.ValidateConfiguration}});pr(rr(61171),Dt);pr(rr(75995),Dt);pr(rr(99419),Dt);pr(rr(48698),Dt);pr(rr(75284),Dt);pr(rr(42429),Dt);pr(rr(47215),Dt)},47215:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.DefaultValuePipe=Dt.ParseFloatPipe=Dt.ParseBoolPipe=Dt.ParseIntPipe=Dt.DecoratorValidPipe=Dt.ParsePipe=Dt.ValidationPipe=Dt.AbstractValidationPipe=void 0;const mr=rr(46123);const gr=rr(75284);const yr=rr(68255);const Sr=rr(6482);const $r=rr(15192);class AbstractValidationPipe{validateWithSchema(St,Dt,rr){const cr=this.parseValidationOptions(Dt);const pr=this.validateService.validateWithSchema(rr,St,cr);if(pr&&pr.value!==undefined){return pr.value}return St}validate(St,Dt){const rr=this.parseValidationOptions(Dt);if(Dt.metaType.isBaseType){return St}const cr=this.validateService.validate(Dt.metaType.originDesign,St,rr);if(cr&&cr.value){return cr.value}return St}parseValidationOptions(St){const Dt=(0,mr.getPropertyMetadata)(Sr.VALIDATE_KEY,St.target,St.methodName)||{};if(!Dt.locale){const rr=St.target[mr.REQUEST_OBJ_CTX_KEY];if(rr&&rr.getAttr){Dt.locale=rr.getAttr(yr.I18N_ATTR_KEY)}}return Dt}getSchema(){return undefined}}cr([(0,mr.Inject)(),pr("design:type",gr.ValidateService)],AbstractValidationPipe.prototype,"validateService",void 0);Dt.AbstractValidationPipe=AbstractValidationPipe;let Er=class ValidationPipe extends AbstractValidationPipe{transform(St,Dt){return this.validate(St,Dt)}};Er=cr([(0,mr.Pipe)()],Er);Dt.ValidationPipe=Er;class ParsePipe extends AbstractValidationPipe{transform(St,Dt){return this.validateWithSchema(St,Dt,Dt.metadata["schema"]||this.getSchema())}}Dt.ParsePipe=ParsePipe;let Ir=class DecoratorValidPipe extends ParsePipe{};Ir=cr([(0,mr.Pipe)()],Ir);Dt.DecoratorValidPipe=Ir;let Or=class ParseIntPipe extends ParsePipe{getSchema(){return $r.number().integer().required()}};Or=cr([(0,mr.Pipe)()],Or);Dt.ParseIntPipe=Or;let Hr=class ParseBoolPipe extends ParsePipe{getSchema(){return $r.boolean().required()}};Hr=cr([(0,mr.Pipe)()],Hr);Dt.ParseBoolPipe=Hr;let Gr=class ParseFloatPipe extends ParsePipe{getSchema(){return $r.number().required()}};Gr=cr([(0,mr.Pipe)()],Gr);Dt.ParseFloatPipe=Gr;class DefaultValuePipe{constructor(St){this.defaultValue=St}transform(St,Dt){if(St===undefined||St===null||typeof St==="number"&&isNaN(St)){return this.defaultValue}return St}}Dt.DefaultValuePipe=DefaultValuePipe},75284:function(St,Dt,rr){"use strict";var cr=this&&this.__decorate||function(St,Dt,rr,cr){var pr=arguments.length,mr=pr<3?Dt:cr===null?cr=Object.getOwnPropertyDescriptor(Dt,rr):cr,gr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")mr=Reflect.decorate(St,Dt,rr,cr);else for(var yr=St.length-1;yr>=0;yr--)if(gr=St[yr])mr=(pr<3?gr(mr):pr>3?gr(Dt,rr,mr):gr(Dt,rr))||mr;return pr>3&&mr&&Object.defineProperty(Dt,rr,mr),mr};var pr=this&&this.__metadata||function(St,Dt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,Dt)};Object.defineProperty(Dt,"__esModule",{value:true});Dt.getSchema=Dt.ValidateService=void 0;const mr=rr(46123);const gr=rr(77053);const yr=rr(6482);const Sr=rr(15192);const $r=rr(68255);const Er=rr(42429);let Ir=class ValidateService{constructor(){this.messages={}}async init(){const St=Object.keys(gr.i18n.localeTable);St.forEach((St=>{this.messages[(0,$r.formatLocale)(St)]=Object.fromEntries(this.i18nService.getLocaleMapping(St,"validate"))}))}validate(St,Dt,rr={}){const cr=this.getSchema(St);return this.validateWithSchema(cr,Dt,rr)}validateWithSchema(St,Dt,rr={}){var cr,pr,mr;if(!St){return undefined}rr.validationOptions=rr.validationOptions||{};rr.validationOptions.errors=rr.validationOptions.errors||{};rr.validationOptions.errors.language=(0,$r.formatLocale)(this.i18nService.getAvailableLocale(rr.validationOptions.errors.language||rr.locale||this.i18nConfig.defaultLocale,"validate"));const gr=St.validate(Dt,Object.assign({},(cr=this.validateConfig.validationOptions)!==null&&cr!==void 0?cr:{},{messages:this.messages},(pr=rr.validationOptions)!==null&&pr!==void 0?pr:{}));if(gr.error){throw new Er.MidwayValidationError(gr.error.message,(mr=rr===null||rr===void 0?void 0:rr.errorStatus)!==null&&mr!==void 0?mr:this.validateConfig.errorStatus,gr.error)}else{return gr}}getSchema(St){return getSchema(St)}};cr([(0,mr.Config)("validate"),pr("design:type",Object)],Ir.prototype,"validateConfig",void 0);cr([(0,mr.Config)("i18n"),pr("design:type",Object)],Ir.prototype,"i18nConfig",void 0);cr([(0,mr.Inject)(),pr("design:type",$r.MidwayI18nServiceSingleton)],Ir.prototype,"i18nService",void 0);cr([(0,mr.Init)(),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Ir.prototype,"init",null);Ir=cr([(0,mr.Provide)(),(0,mr.Scope)(mr.ScopeEnum.Singleton)],Ir);Dt.ValidateService=Ir;function getSchema(St){const Dt=(0,mr.getClassExtendedMetadata)(yr.RULES_KEY,St);if(Dt){return Sr.object(Dt)}}Dt.getSchema=getSchema},6647:(St,Dt,rr)=>{"use strict";const cr=rr(87016);const pr=rr(16480);const mr={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:cr.URL||URL};Dt.analyze=function(St,Dt={}){if(!St){return pr.code("DOMAIN_NON_EMPTY_STRING")}if(typeof St!=="string"){throw new Error("Invalid input: domain must be a string")}if(St.length>256){return pr.code("DOMAIN_TOO_LONG")}const rr=!mr.nonAsciiRx.test(St);if(!rr){if(Dt.allowUnicode===false){return pr.code("DOMAIN_INVALID_UNICODE_CHARS")}St=St.normalize("NFC")}if(mr.domainControlRx.test(St)){return pr.code("DOMAIN_INVALID_CHARS")}St=mr.punycode(St);if(Dt.allowFullyQualified&&St[St.length-1]==="."){St=St.slice(0,-1)}const cr=Dt.minDomainSegments||mr.minDomainSegments;const gr=St.split(".");if(gr.length<cr){return pr.code("DOMAIN_SEGMENTS_COUNT")}if(Dt.maxDomainSegments){if(gr.length>Dt.maxDomainSegments){return pr.code("DOMAIN_SEGMENTS_COUNT_MAX")}}const yr=Dt.tlds;if(yr){const St=gr[gr.length-1].toLowerCase();if(yr.deny&&yr.deny.has(St)||yr.allow&&!yr.allow.has(St)){return pr.code("DOMAIN_FORBIDDEN_TLDS")}}for(let St=0;St<gr.length;++St){const Dt=gr[St];if(!Dt.length){return pr.code("DOMAIN_EMPTY_SEGMENT")}if(Dt.length>63){return pr.code("DOMAIN_LONG_SEGMENT")}if(St<gr.length-1){if(!mr.domainSegmentRx.test(Dt)){return pr.code("DOMAIN_INVALID_CHARS")}}else{if(!mr.tldSegmentRx.test(Dt)){return pr.code("DOMAIN_INVALID_TLDS_CHARS")}}}return null};Dt.isValid=function(St,rr){return!Dt.analyze(St,rr)};mr.punycode=function(St){if(St.includes("%")){St=St.replace(/%/g,"%25")}try{return new mr.URL(`http://${St}`).host}catch(Dt){return St}}},71099:(St,Dt,rr)=>{"use strict";const cr=rr(39023);const pr=rr(6647);const mr=rr(16480);const gr={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(cr.TextEncoder||TextEncoder)};Dt.analyze=function(St,Dt){return gr.email(St,Dt)};Dt.isValid=function(St,Dt){return!gr.email(St,Dt)};gr.email=function(St,Dt={}){if(typeof St!=="string"){throw new Error("Invalid input: email must be a string")}if(!St){return mr.code("EMPTY_STRING")}const rr=!gr.nonAsciiRx.test(St);if(!rr){if(Dt.allowUnicode===false){return mr.code("FORBIDDEN_UNICODE")}St=St.normalize("NFC")}const cr=St.split("@");if(cr.length!==2){return cr.length>2?mr.code("MULTIPLE_AT_CHAR"):mr.code("MISSING_AT_CHAR")}const[yr,Sr]=cr;if(!yr){return mr.code("EMPTY_LOCAL")}if(!Dt.ignoreLength){if(St.length>254){return mr.code("ADDRESS_TOO_LONG")}if(gr.encoder.encode(yr).length>64){return mr.code("LOCAL_TOO_LONG")}}return gr.local(yr,rr)||pr.analyze(Sr,Dt)};gr.local=function(St,Dt){const rr=St.split(".");for(const St of rr){if(!St.length){return mr.code("EMPTY_LOCAL_SEGMENT")}if(Dt){if(!gr.atextRx.test(St)){return mr.code("INVALID_LOCAL_CHARS")}continue}for(const Dt of St){if(gr.atextRx.test(Dt)){continue}const St=gr.binary(Dt);if(!gr.atomRx.test(St)){return mr.code("INVALID_LOCAL_CHARS")}}}};gr.binary=function(St){return Array.from(gr.encoder.encode(St)).map((St=>String.fromCharCode(St))).join("")};gr.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/;gr.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("|"))},16480:(St,Dt)=>{"use strict";Dt.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"};Dt.code=function(St){return{code:St,error:Dt.codes[St]}}},54990:(St,Dt,rr)=>{"use strict";const cr=rr(99583);const pr=rr(63377);const mr={};Dt.regex=function(St={}){cr(St.cidr===undefined||typeof St.cidr==="string","options.cidr must be a string");const Dt=St.cidr?St.cidr.toLowerCase():"optional";cr(["required","optional","forbidden"].includes(Dt),"options.cidr must be one of required, optional, forbidden");cr(St.version===undefined||typeof St.version==="string"||Array.isArray(St.version),"options.version must be a string or an array of string");let rr=St.version||["ipv4","ipv6","ipvfuture"];if(!Array.isArray(rr)){rr=[rr]}cr(rr.length>=1,"options.version must have at least 1 version specified");for(let St=0;St<rr.length;++St){cr(typeof rr[St]==="string","options.version must only contain strings");rr[St]=rr[St].toLowerCase();cr(["ipv4","ipv6","ipvfuture"].includes(rr[St]),"options.version contains unknown version "+rr[St]+" - must be one of ipv4, ipv6, ipvfuture")}rr=Array.from(new Set(rr));const mr=rr.map((St=>{if(Dt==="forbidden"){return pr.ip[St]}const rr=`\\/${St==="ipv4"?pr.ip.v4Cidr:pr.ip.v6Cidr}`;if(Dt==="required"){return`${pr.ip[St]}${rr}`}return`${pr.ip[St]}(?:${rr})?`}));const gr=`(?:${mr.join("|")})`;const yr=new RegExp(`^${gr}$`);return{cidr:Dt,versions:rr,regex:yr,raw:gr}}},33618:St=>{"use strict";const Dt={};Dt.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"];St.exports=new Set(Dt.tlds.map((St=>St.toLowerCase())))},63377:(St,Dt,rr)=>{"use strict";const cr=rr(99583);const pr=rr(43935);const mr={};mr.generate=function(){const St={};const Dt="\\dA-Fa-f";const rr="["+Dt+"]";const cr="\\w-\\.~";const pr="!\\$&'\\(\\)\\*\\+,;=";const mr="%"+Dt;const gr=cr+mr+pr+":@";const yr="["+gr+"]";const Sr="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";St.ipv4address="(?:"+Sr+"\\.){3}"+Sr;const $r=rr+"{1,4}";const Er="(?:"+$r+":"+$r+"|"+St.ipv4address+")";const Ir="(?:"+$r+":){6}"+Er;const Or="::(?:"+$r+":){5}"+Er;const Hr="(?:"+$r+")?::(?:"+$r+":){4}"+Er;const Gr="(?:(?:"+$r+":){0,1}"+$r+")?::(?:"+$r+":){3}"+Er;const Tn="(?:(?:"+$r+":){0,2}"+$r+")?::(?:"+$r+":){2}"+Er;const Wn="(?:(?:"+$r+":){0,3}"+$r+")?::"+$r+":"+Er;const Gn="(?:(?:"+$r+":){0,4}"+$r+")?::"+Er;const mi="(?:(?:"+$r+":){0,5}"+$r+")?::"+$r;const $i="(?:(?:"+$r+":){0,6}"+$r+")?::";St.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])";St.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])";St.ipv6address="(?:"+Ir+"|"+Or+"|"+Hr+"|"+Gr+"|"+Tn+"|"+Wn+"|"+Gn+"|"+mi+"|"+$i+")";St.ipvFuture="v"+rr+"+\\.["+cr+pr+":]+";St.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*";St.schemeRegex=new RegExp(St.scheme);const ki="["+cr+mr+pr+":]*";const Ni="\\[(?:"+St.ipv6address+"|"+St.ipvFuture+")\\]";const Ri="["+cr+mr+pr+"]{1,255}";const Vi="(?:"+Ni+"|"+St.ipv4address+"|"+Ri+")";const ji="\\d*";const Ui="(?:"+ki+"@)?"+Vi+"(?::"+ji+")?";const zi="(?:"+ki+"@)?("+Vi+")(?::"+ji+")?";const Ki=yr+"*";const Xi=yr+"+";const Yi="["+cr+mr+pr+"@"+"]+";const xa="";const Ta="(?:\\/"+Ki+")*";const wa="\\/(?:"+Xi+Ta+")?";const Ia=Xi+Ta;const Oa=Yi+Ta;const Ra="(?:\\/\\/\\/"+Ki+Ta+")";St.hierPart="(?:"+"(?:\\/\\/"+Ui+Ta+")"+"|"+wa+"|"+Ia+"|"+Ra+")";St.hierPartCapture="(?:"+"(?:\\/\\/"+zi+Ta+")"+"|"+wa+"|"+Ia+")";St.relativeRef="(?:"+"(?:\\/\\/"+Ui+Ta+")"+"|"+wa+"|"+Oa+"|"+xa+")";St.relativeRefCapture="(?:"+"(?:\\/\\/"+zi+Ta+")"+"|"+wa+"|"+Oa+"|"+xa+")";St.query="["+gr+"\\/\\?]*(?=#|$)";St.queryWithSquareBrackets="["+gr+"\\[\\]\\/\\?]*(?=#|$)";St.fragment="["+gr+"\\/\\?]*";return St};mr.rfc3986=mr.generate();Dt.ip={v4Cidr:mr.rfc3986.ipv4Cidr,v6Cidr:mr.rfc3986.ipv6Cidr,ipv4:mr.rfc3986.ipv4address,ipv6:mr.rfc3986.ipv6address,ipvfuture:mr.rfc3986.ipvFuture};mr.createRegex=function(St){const Dt=mr.rfc3986;const rr=St.allowQuerySquareBrackets?Dt.queryWithSquareBrackets:Dt.query;const gr="(?:\\?"+rr+")?"+"(?:#"+Dt.fragment+")?";const yr=St.domain?Dt.relativeRefCapture:Dt.relativeRef;if(St.relativeOnly){return mr.wrap(yr+gr)}let Sr="";if(St.scheme){cr(St.scheme instanceof RegExp||typeof St.scheme==="string"||Array.isArray(St.scheme),"scheme must be a RegExp, String, or Array");const rr=[].concat(St.scheme);cr(rr.length>=1,"scheme must have at least 1 scheme specified");const mr=[];for(let St=0;St<rr.length;++St){const gr=rr[St];cr(gr instanceof RegExp||typeof gr==="string","scheme at position "+St+" must be a RegExp or String");if(gr instanceof RegExp){mr.push(gr.source.toString())}else{cr(Dt.schemeRegex.test(gr),"scheme at position "+St+" must be a valid scheme");mr.push(pr(gr))}}Sr=mr.join("|")}const $r=Sr?"(?:"+Sr+")":Dt.scheme;const Er="(?:"+$r+":"+(St.domain?Dt.hierPartCapture:Dt.hierPart)+")";const Ir=St.allowRelative?"(?:"+Er+"|"+yr+")":Er;return mr.wrap(Ir+gr,Sr)};mr.wrap=function(St,Dt){St=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${St}`;return{raw:St,regex:new RegExp(`^${St}$`),scheme:Dt}};mr.uriRegex=mr.createRegex({});Dt.regex=function(St={}){if(St.scheme||St.allowRelative||St.relativeOnly||St.allowQuerySquareBrackets||St.domain){return mr.createRegex(St)}return mr.uriRegex}},25673:(St,Dt)=>{"use strict";const rr={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};Dt.Parser=class{constructor(St,Dt={}){if(!Dt[rr.settings]&&Dt.constants){for(const St in Dt.constants){const rr=Dt.constants[St];if(rr!==null&&!["boolean","number","string"].includes(typeof rr)){throw new Error(`Formula constant ${St} contains invalid ${typeof rr} value type`)}}}this.settings=Dt[rr.settings]?Dt:Object.assign({[rr.settings]:true,constants:{},functions:{}},Dt);this.single=null;this._parts=null;this._parse(St)}_parse(St){let cr=[];let pr="";let mr=0;let gr=false;const flush=St=>{if(mr){throw new Error("Formula missing closing parenthesis")}const yr=cr.length?cr[cr.length-1]:null;if(!gr&&!pr&&!St){return}if(yr&&yr.type==="reference"&&St===")"){yr.type="function";yr.value=this._subFormula(pr,yr.value);pr="";return}if(St===")"){const St=new Dt.Parser(pr,this.settings);cr.push({type:"segment",value:St})}else if(gr){if(gr==="]"){cr.push({type:"reference",value:pr});pr="";return}cr.push({type:"literal",value:pr})}else if(rr.operatorCharacters.includes(pr)){if(yr&&yr.type==="operator"&&rr.operators.includes(yr.value+pr)){yr.value+=pr}else{cr.push({type:"operator",value:pr})}}else if(pr.match(rr.numberRx)){cr.push({type:"constant",value:parseFloat(pr)})}else if(this.settings.constants[pr]!==undefined){cr.push({type:"constant",value:this.settings.constants[pr]})}else{if(!pr.match(rr.tokenRx)){throw new Error(`Formula contains invalid token: ${pr}`)}cr.push({type:"reference",value:pr})}pr=""};for(const Dt of St){if(gr){if(Dt===gr){flush();gr=false}else{pr+=Dt}}else if(mr){if(Dt==="("){pr+=Dt;++mr}else if(Dt===")"){--mr;if(!mr){flush(Dt)}else{pr+=Dt}}else{pr+=Dt}}else if(Dt in rr.literals){gr=rr.literals[Dt]}else if(Dt==="("){flush();++mr}else if(rr.operatorCharacters.includes(Dt)){flush();pr=Dt;flush()}else if(Dt!==" "){pr+=Dt}else{flush()}}flush();cr=cr.map(((St,Dt)=>{if(St.type!=="operator"||St.value!=="-"||Dt&&cr[Dt-1].type!=="operator"){return St}return{type:"operator",value:"n"}}));let yr=false;for(const St of cr){if(St.type==="operator"){if(rr.operatorsPrefix.includes(St.value)){continue}if(!yr){throw new Error("Formula contains an operator in invalid position")}if(!rr.operators.includes(St.value)){throw new Error(`Formula contains an unknown operator ${St.value}`)}}else if(yr){throw new Error("Formula missing expected operator")}yr=!yr}if(!yr){throw new Error("Formula contains invalid trailing operator")}if(cr.length===1&&["reference","literal","constant"].includes(cr[0].type)){this.single={type:cr[0].type==="reference"?"reference":"value",value:cr[0].value}}this._parts=cr.map((St=>{if(St.type==="operator"){return rr.operatorsPrefix.includes(St.value)?St:St.value}if(St.type!=="reference"){return St.value}if(this.settings.tokenRx&&!this.settings.tokenRx.test(St.value)){throw new Error(`Formula contains invalid reference ${St.value}`)}if(this.settings.reference){return this.settings.reference(St.value)}return rr.reference(St.value)}))}_subFormula(St,cr){const pr=this.settings.functions[cr];if(typeof pr!=="function"){throw new Error(`Formula contains unknown function ${cr}`)}let mr=[];if(St){let Dt="";let pr=0;let gr=false;const flush=()=>{if(!Dt){throw new Error(`Formula contains function ${cr} with invalid arguments ${St}`)}mr.push(Dt);Dt=""};for(let cr=0;cr<St.length;++cr){const mr=St[cr];if(gr){Dt+=mr;if(mr===gr){gr=false}}else if(mr in rr.literals&&!pr){Dt+=mr;gr=rr.literals[mr]}else if(mr===","&&!pr){flush()}else{Dt+=mr;if(mr==="("){++pr}else if(mr===")"){--pr}}}flush()}mr=mr.map((St=>new Dt.Parser(St,this.settings)));return function(St){const Dt=[];for(const rr of mr){Dt.push(rr.evaluate(St))}return pr.call(St,...Dt)}}evaluate(St){const Dt=this._parts.slice();for(let cr=Dt.length-2;cr>=0;--cr){const pr=Dt[cr];if(pr&&pr.type==="operator"){const mr=Dt[cr+1];Dt.splice(cr+1,1);const gr=rr.evaluate(mr,St);Dt[cr]=rr.single(pr.value,gr)}}rr.operatorsOrder.forEach((cr=>{for(let pr=1;pr<Dt.length-1;){if(cr.includes(Dt[pr])){const cr=Dt[pr];const mr=rr.evaluate(Dt[pr-1],St);const gr=rr.evaluate(Dt[pr+1],St);Dt.splice(pr,2);const yr=rr.calculate(cr,mr,gr);Dt[pr-1]=yr===0?0:yr}else{pr+=2}}}));return rr.evaluate(Dt[0],St)}};Dt.Parser.prototype[rr.symbol]=true;rr.reference=function(St){return function(Dt){return Dt&&Dt[St]!==undefined?Dt[St]:null}};rr.evaluate=function(St,Dt){if(St===null){return null}if(typeof St==="function"){return St(Dt)}if(St[rr.symbol]){return St.evaluate(Dt)}return St};rr.single=function(St,Dt){if(St==="!"){return Dt?false:true}const rr=-Dt;if(rr===0){return 0}return rr};rr.calculate=function(St,Dt,cr){if(St==="??"){return rr.exists(Dt)?Dt:cr}if(typeof Dt==="string"||typeof cr==="string"){if(St==="+"){Dt=rr.exists(Dt)?Dt:"";cr=rr.exists(cr)?cr:"";return Dt+cr}}else{switch(St){case"^":return Math.pow(Dt,cr);case"*":return Dt*cr;case"/":return Dt/cr;case"%":return Dt%cr;case"+":return Dt+cr;case"-":return Dt-cr}}switch(St){case"<":return Dt<cr;case"<=":return Dt<=cr;case">":return Dt>cr;case">=":return Dt>=cr;case"==":return Dt===cr;case"!=":return Dt!==cr;case"&&":return Dt&&cr;case"||":return Dt||cr}return null};rr.exists=function(St){return St!==null&&St!==undefined}},533:(St,Dt)=>{"use strict";const rr={};Dt.location=function(St=0){const Dt=Error.prepareStackTrace;Error.prepareStackTrace=(St,Dt)=>Dt;const rr={};Error.captureStackTrace(rr,this);const cr=rr.stack[St+1];Error.prepareStackTrace=Dt;return{filename:cr.getFileName(),line:cr.getLineNumber()}}},90167:(St,Dt,rr)=>{"use strict";
3
3
  /*!
4
4
  * accepts