comp-hub 0.27.18 → 0.27.19
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/bin/cli.js +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var __webpack_modules__={34286:Z=>{function webpackEmptyAsyncContext(Z){return Promise.resolve().then((()=>{var ct=new Error("Cannot find module '"+Z+"'");ct.code="MODULE_NOT_FOUND";throw ct}))}webpackEmptyAsyncContext.keys=()=>[];webpackEmptyAsyncContext.resolve=webpackEmptyAsyncContext;webpackEmptyAsyncContext.id=34286;Z.exports=webpackEmptyAsyncContext},61242:Z=>{function webpackEmptyContext(Z){var ct=new Error("Cannot find module '"+Z+"'");ct.code="MODULE_NOT_FOUND";throw ct}webpackEmptyContext.keys=()=>[];webpackEmptyContext.resolve=webpackEmptyContext;webpackEmptyContext.id=61242;Z.exports=webpackEmptyContext},38818:(Z,ct,ut)=>{const{Bootstrap:pt}=ut(48797);pt.configure({imports:ut(15545),moduleDetector:false}).run()},14071:function(Z,ct,ut){"use strict";var pt=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});const dt=pt(ut(22078));const ft=ut(28234);const{logLevel:_t=""}=(0,dt.default)(process.argv.slice(2));ct["default"]={keys:"1755564797722_8890",koa:{globalPrefix:"/api"},midwayLogger:{default:{transports:{console:{level:"all"}}},clients:{appLogger:{level:_t||"info"},coreLogger:{level:_t||"info"}}},cacheManager:{clients:{default:{store:"memory"}}},i18n:{defaultLocale:"zh",localeTable:{en:{default:ft.backendMessages.en},zh:{default:ft.backendMessages.zh}},writeCookie:false}}},91921:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct["default"]={}},12799:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ht=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});ct.MainConfiguration=void 0;const yt=ut(31049);const vt=_t(ut(58647));const St=_t(ut(18649));const bt=_t(ut(66909));const xt=_t(ut(25027));const $t=_t(ut(90381));const Et=_t(ut(98085));const Ct=_t(ut(14013));const Tt=_t(ut(59537));const wt=_t(ut(16928));const At=_t(ut(79896));const kt=ut(79896);const It=ut(24434);const Nt=ht(ut(10274));const Pt=ht(ut(44400));const Ot=ht(ut(22078));const Dt=ht(ut(77036));const Ft=ut(76289);const Mt=ut(60449);const Lt=ut(54633);const Rt=ut(59416);const Bt=ut(61142);const Vt=ut(64754);const jt=ut(10778);const Ut=_t(ut(14071));const Jt=_t(ut(91921));const zt=ut(74952);const Wt=ut(44120);const qt=_t(ut(67213));const Ht={DEFAULT_PORT:Number(zt.uri.getUrlPort(Mt.KEYS.LOCAL_SERVICE_URL_DEV)),DEFAULT_LOG_LEVEL:"info",MAX_SUB_PORT_RETRIES:20};function getErrorMessage(Z){if(Z instanceof Error)return Z.message;if(typeof Z==="string")return Z;return String(Z)}const Kt=(0,Ot.default)(process.argv.slice(2));const Gt={p:"port",port:"port",d:"dir",dir:"dir",l:"log",log:"log",api:"api","allow-debug":"allowDebug",cwd:"cwd"};function mergeConfigWithArgs(Z){const ct={...Z};for(const[Z,ut]of Object.entries(Gt)){const pt=Kt[Z];if(pt!==undefined){ct[ut]=pt}}return ct}async function loadComphubConfig(Z,ct){const ut=wt.join(Z,".comphub.json");const pt=wt.join(Z,".comphub.js");const dt=await zt.fileSys.readJsonFile(ut);if(dt){return dt}ct.info("未找到 .comphub.json,尝试加载 .comphub.js");try{const Z=await Promise.resolve(`${pt}`).then((Z=>_t(require(Z))));const ut=Z.default||Z;if(Object.keys(ut).length===0){ct.warn(".comphub.js 为空,使用默认配置")}return ut}catch(Z){ct.info(".comphub.js 加载失败:",getErrorMessage(Z));return{}}}let Xt=class MainConfiguration{constructor(){this.appConfig=null;this.subServer=null;this._websitePath=null}get websitePath(){if(!this._websitePath){const Z=this.app.getEnv();this._websitePath=wt.resolve(__dirname,Z===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL?"../../../website":"./website")}return this._websitePath}get apiUrl(){const Z=this.app.getEnv();return Z===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL?Mt.KEYS.REMOTE_SERVICE_URL_DEV:Mt.KEYS.REMOTE_SERVICE_URL_PROD}getVersion(){const Z=this.app.getEnv();if(Z===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const Z=wt.join(__dirname,"../../cli/package.json");const ct=JSON.parse((0,kt.readFileSync)(Z,"utf8"));return ct.version}return process.env.COMP_HUB_VERSION||"unknown"}createProxyConfig(Z){const ct=new It.EventEmitter;const ut={...Z,on:{...Z.on,error:Z=>{this.logger.error("Proxy Error:",Z.message);ct.emit("error",Z)},proxyRes:()=>ct.emit("proxyRes"),proxyReq:Z=>{const ut=`${Z.protocol}//${Z.host}${Z.path}`;this.logger.debug("[Proxy] →",ut);ct.emit("proxyReq",Z)},proxyReqWs:(...Z)=>ct.emit("proxyReqWs",...Z)}};const pt=Z.pathRewrite;const dt=Object.keys(pt??{});if(dt.length>0){const[Z]=dt;ut.pathRewrite=ct=>{let ut=ct.replace(Mt.KEYS.PROXY_PATH_PREFIX,"");ut=ut.replace(new RegExp(Z),pt[Z]);return ut}}else{ut.pathRewrite=Z=>Z.replace(Mt.KEYS.PROXY_PATH_PREFIX,"")}return{proxy:(0,Ft.createProxyMiddleware)(ut),opt:ut,event:ct}}createProxyMap(Z){const ct={};for(const[ut,pt]of Object.entries(Z)){ct[ut]=this.createProxyConfig(pt)}return ct}setupProxy(){const Z=this.app.getAttr(Mt.KEYS.COMPHUB_CONFIG_KEY);if(Vt.ProxyController.proxys){for(const Z of Object.values(Vt.ProxyController.proxys)){Z.event.removeAllListeners()}}Vt.ProxyController.proxys={};if(!Z.proxy)return;Vt.ProxyController.proxys=this.createProxyMap(Z.proxy)}async buildConfig(){const Z=this.app.getEnv();let ct=Kt["cwd"];if(ct){if(!wt.isAbsolute(ct)){ct=wt.resolve(process.cwd(),ct)}try{await At.promises.access(ct)}catch(Z){throw new Error(getErrorMessage(Z))}}const ut=ct||process.cwd();this.logger.info("cwd:",ut);this.logger.info("env:",Z);const pt=await loadComphubConfig(ut,this.logger);const dt={port:Ht.DEFAULT_PORT,log:Ht.DEFAULT_LOG_LEVEL,allowDebug:false,api:this.apiUrl};const ft=mergeConfigWithArgs({...dt,...pt});const _t=wt.join(this.websitePath,Mt.KEYS.WEBSITE_PATH_MAIN);const mt=wt.join(ut,ft.dir||"");const ht=wt.join(ut,Mt.KEYS.PREBUILD_MODULE_DIR);const yt=wt.join(ut,"node_modules");await At.promises.mkdir(ht,{recursive:true});const vt={websitePath:_t,prebuildModulePath:ht,cwd:ut,port:ft.port,srcPath:mt,remoteServer:ft.api,logLevel:ft.log,version:this.getVersion(),allowDebug:ft.allowDebug,proxy:ft.proxy};jt.remoteInstance.defaults.baseURL=vt.remoteServer;if(Z===Mt.KEYS.LOCAL_MIDWAY_ENV_PROD){vt.port=await(0,Dt.default)({port:Dt.default.makeRange(vt.port,vt.port+100)})}this.appConfig=vt;const St={dirs:{default:{prefix:`/${Mt.KEYS.WEBSITE_PATH_MAIN}`,dir:_t},[Mt.KEYS.MODULE_LOAD_PREFIX]:{prefix:Mt.KEYS.MODULE_LOAD_PREFIX,dir:ht,maxAge:0},[Mt.KEYS.NODE_MODULES_LOAD_PREFIX]:{prefix:Mt.KEYS.NODE_MODULES_LOAD_PREFIX,dir:yt,maxAge:0},[Mt.KEYS.COMP_PREVIEW_PREFIX_LOCAL]:{prefix:Mt.KEYS.COMP_PREVIEW_PREFIX_LOCAL,dir:vt.srcPath,maxAge:0}}};try{await At.promises.access(_t,At.constants.F_OK)}catch(Z){this.logger.warn("websitePathMain 不存在:请先构建前端项目",getErrorMessage(Z));await At.promises.mkdir(_t,{recursive:true})}if(Z===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await At.promises.writeFile(wt.join(__dirname,".comphubConfig.json"),JSON.stringify(vt,null,2))}return{koa:{port:vt.port},staticFile:St,httpProxy:{strategy:{[Mt.KEYS.REMOTE_SERVICE_PREFIX]:{match:new RegExp(`^/${Mt.KEYS.REMOTE_SERVICE_PREFIX}/(.*)$`),target:`${vt.remoteServer}/$1`}}}}}async createKoaProxy(Z,ct,ut){return new Promise(((pt,dt)=>{const ft=(0,Ft.createProxyMiddleware)({target:ct,changeOrigin:true,secure:false,pathRewrite:ut,on:{proxyReq:(Z,ct,ut,pt)=>{const dt=pt.target.href;this.logger.debug("[Proxy] →",`${dt}${Z.path.slice(1)}`)},error:dt}});Z.res.on("finish",pt);Z.res.on("error",dt);ft(Z.req,Z.res,(Z=>{if(Z instanceof Error){dt(Z)}}))}))}async startSubPort(){const Z=this.app.getEnv();const ct=this.app.getAttr(Mt.KEYS.COMPHUB_CONFIG_KEY);const{port:ut,remoteServer:pt}=ct;let dt=await(0,Dt.default)({port:Dt.default.makeRange(ut,ut+100)});if(Z===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){dt=Number(zt.uri.getUrlPort(Mt.KEYS.LOCAL_SERVICE_URL_DEV_SUB))}const ft=new Nt.default;ft.use((async(Z,dt)=>{if(Z.path.startsWith(Mt.KEYS.COMP_PREVIEW_PREFIX_LOCAL)){const{srcPath:ut}=ct;const pt=Z.path[0];const dt=Z.path.replace(Mt.KEYS.COMP_PREVIEW_PREFIX_LOCAL,"");const ft=await zt.locate.resolveBuildPath(dt,{baseDir:ut});if(ft){const ct=ft.replace(ut,"");const _t=Wt.textKit.replaceSlashWithSpecifiedSeparator(ct,pt);if(dt!==_t){const ct=_t.replace(dt,"");Z.redirect(Z.path+ct);return}}}const ft=[{prefix:`/${Mt.KEYS.REMOTE_SERVICE_PREFIX}`,target:pt,rewrite:{[`^/${Mt.KEYS.REMOTE_SERVICE_PREFIX}`]:""}},{prefix:`/${Mt.KEYS.LOCAL_SERVICE_PREFIX}`,target:`${Mt.KEYS.IFRAME_HOST}:${ut}`,rewrite:{[`^/${Mt.KEYS.LOCAL_SERVICE_PREFIX}`]:""}},{prefix:Mt.KEYS.MODULE_LOAD_PREFIX,target:`${Mt.KEYS.IFRAME_HOST}:${ut}`,rewrite:{}},{prefix:Mt.KEYS.NODE_MODULES_LOAD_PREFIX,target:`${Mt.KEYS.IFRAME_HOST}:${ut}`,rewrite:{}},{prefix:Mt.KEYS.COMP_PREVIEW_PREFIX_LOCAL,target:`${Mt.KEYS.IFRAME_HOST}:${ut}`,rewrite:{}}];for(const ct of ft){if(Z.path.startsWith(ct.prefix)){await this.createKoaProxy(Z,ct.target,ct.rewrite);return}}await dt()}));ft.use((0,Pt.default)(this.websitePath,{index:false}));ft.use((async Z=>{try{const ct=(()=>{if(Z.path.startsWith(`${Mt.KEYS.IFRAME_ITEM_WEBSITE_PATH}/`)){return Mt.KEYS.IFRAME_ITEM_WEBSITE_PATH}if(Z.path.startsWith(`${Mt.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}/`)){return Mt.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}return""})();const ut=wt.join(this.websitePath,ct,"index.html");const pt=await At.promises.readFile(ut,"utf-8");const ft=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify({subPort:dt})};<\/script>`;const _t=pt.replace("\x3c!--GLOBAL_CONFIG--\x3e",ft);Z.type="text/html; charset=utf-8";Z.status=200;Z.body=_t}catch(ct){this.logger.error("读取 index.html 失败:",ct);Z.status=500;Z.body="服务器内部错误"}}));await new Promise(((ut,pt)=>{let _t=0;const mt=ft.listen(dt,(()=>{this.subServer=mt;this.app.setAttr(Mt.KEYS.COMPHUB_CONFIG_KEY,{...ct,subPort:dt});if(Z===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){this.logger.info(`子端口 ${dt} 已启动`)}ut()}));mt.on("error",(Z=>{if(Z.code==="EADDRINUSE"&&_t<Ht.MAX_SUB_PORT_RETRIES){_t++;this.logger.error(`子端口 ${dt} 被占用,正在尝试端口 ${++dt}`);mt.close();mt.listen(dt)}else{pt(Z)}}))}))}async printAccessInfo(Z){const ct=await Z.getAsync(vt.Framework);const ut=ct.getServer();const pt=ut.address();const dt=this.app.getEnv();if(pt&&typeof pt!=="string"){const Z=zt.network.getLocalIPv4();const ct=pt.port;this.logger.info("Local Address:",`[34mhttp://localhost:${ct}[0m`);if(Z){this.logger.info("Network Address:",`[34mhttp://${Z}:${ct}[0m`)}if(dt===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){this.logger.info("Swagger UI:",`[34mhttp://localhost:${ct}/swagger-ui/index.html[0m`)}}}async onConfigLoad(){const Z=await this.buildConfig();const ct=this.app.getEnv();if(ct===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await At.promises.writeFile(wt.join(__dirname,".start.json"),JSON.stringify(Z,null,2))}return Z}async onReady(){this.app.setAttr(Mt.KEYS.COMPHUB_CONFIG_KEY,this.appConfig);this.app.useMiddleware([Bt.ReportMiddleware]);this.app.useFilter([Rt.BadRequestErrorFilter,Lt.DefaultErrorFilter])}async onServerReady(Z){this.setupProxy();await this.startSubPort();await this.printAccessInfo(Z)}async onStop(){if(this.subServer){await new Promise((Z=>{this.subServer.close((()=>Z()))}));this.logger.info("子服务已关闭")}}};ct.MainConfiguration=Xt;ft([(0,yt.Logger)("coreLogger"),mt("design:type",Object)],Xt.prototype,"logger",void 0);ft([(0,yt.MainApp)(),mt("design:type",Object)],Xt.prototype,"app",void 0);ct.MainConfiguration=Xt=ft([(0,yt.Configuration)({detector:new yt.CommonJSFileDetector,imports:[vt,St,xt,Et,Ct,Tt,qt,{component:bt,enabledEnvironment:[Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL]},{component:$t,enabledEnvironment:[Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL]}],importConfigs:[{default:Ut,local:Jt}]})],Xt)},64754:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft;Object.defineProperty(ct,"__esModule",{value:true});ct.ProxyController=void 0;const _t=ut(31049);const mt=ut(60449);const ht=mt.KEYS.PROXY_PATH_PREFIX;let yt=ft=class ProxyController{async proxy(){const Z=this.ctx.path.replace(ht,"");let ct=null;for(const[ut,pt]of Object.entries(ft.proxys)){const dt=new RegExp(ut);if(dt.test(Z)||Z.startsWith(ut)){ct=pt;break}}if(!ct){this.ctx.status=404;this.ctx.body={message:"Proxy not found"};return}const{proxy:ut,event:pt}=ct;await new Promise(((Z,ct)=>{ut(this.ctx.req,this.ctx.res);pt.on("error",ct);pt.on("proxyRes",Z)}))}};ct.ProxyController=yt;pt([(0,_t.Inject)(),dt("design:type",Object)],yt.prototype,"ctx",void 0);pt([(0,_t.All)("/*"),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],yt.prototype,"proxy",null);ct.ProxyController=yt=ft=pt([(0,_t.Controller)(ht,{ignoreGlobalPrefix:true})],yt)},17076:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.SpaController=void 0;const ht=ut(31049);const yt=_t(ut(79896));const vt=ut(16928);const St=ut(90381);const bt=ut(63366);const xt=ut(60449);let $t=class SpaController{async index(){this.ctx.redirect(`/${xt.KEYS.WEBSITE_PATH_MAIN}/`)}async spa(){const Z=this.configService.comphubConfig();const{websitePath:ct}=Z;const ut=(0,vt.resolve)(ct,"index.html");let pt=await yt.promises.readFile(ut,"utf-8");const dt=this.configService.getGlobalConfig();const ft=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify(dt)};<\/script>`;pt=pt.replace("\x3c!--GLOBAL_CONFIG--\x3e",ft);return pt}async getGlobalConfig(){return this.configService.getGlobalConfig()}};ct.SpaController=$t;ft([(0,ht.Inject)(),mt("design:type",Object)],$t.prototype,"ctx",void 0);ft([(0,ht.MainApp)(),mt("design:type",Object)],$t.prototype,"app",void 0);ft([(0,ht.Inject)(),mt("design:type",bt.ConfigService)],$t.prototype,"configService",void 0);ft([(0,ht.Get)("/"),mt("design:type",Function),mt("design:paramtypes",[]),mt("design:returntype",Promise)],$t.prototype,"index",null);ft([(0,ht.Get)(`/${xt.KEYS.WEBSITE_PATH_MAIN}/*`),mt("design:type",Function),mt("design:paramtypes",[]),mt("design:returntype",Promise)],$t.prototype,"spa",null);ft([(0,ht.Get)(xt.KEYS.GLOBAL_CONFIG_PATH),mt("design:type",Function),mt("design:paramtypes",[]),mt("design:returntype",Promise)],$t.prototype,"getGlobalConfig",null);ct.SpaController=$t=ft([(0,St.ApiExcludeController)(),(0,ht.Controller)("/",{ignoreGlobalPrefix:true})],$t)},78805:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft=this&&this.__param||function(Z,ct){return function(ut,pt){ct(ut,pt,Z)}};Object.defineProperty(ct,"__esModule",{value:true});ct.CompController=void 0;const _t=ut(31049);const mt=ut(48795);const ht=ut(63366);const yt=ut(90381);const vt=ut(8131);const St=ut(101);const bt=ut(19465);const xt=ut(93597);const $t=ut(6586);let Et=class CompController{async dir(Z){const ct=await this.compService.getCompDir(Z.compPath);return xt.resUtil.success(ct)}async file(Z){const{filePath:ct}=Z;const ut=await this.compService.getCompFile(ct);return xt.resUtil.success({content:ut})}async check(Z){const ct=await this.compService.checkCompConfig(Z.compPath);return xt.resUtil.success(ct)}async updateVersion(Z){const{compPath:ct,version:ut}=Z;await this.compService.updateCompVersion(ct,ut);return xt.resUtil.noData()}async generateCompJson(Z){const{compPath:ct}=Z;await this.compService.generateCompJson(ct);return xt.resUtil.noData()}async dep(Z){const{compPath:ct}=Z;const ut=await this.compService.getCompDep(ct);return xt.resUtil.success({thirdParty:ut})}async checkCompRepeat(Z){await $t.remoteApi.v1Token.tokencontrollerApproachexpire();const ct=await this.compService.checkCompRepeat(Z);return xt.resUtil.success(ct)}async submit(Z){await $t.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.submitComp(Z);return xt.resUtil.noData()}async update(Z){await $t.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.updateComp(Z);return xt.resUtil.noData()}async download(Z){const ct=await this.compService.downloadComp(Z);if(ct?.isRepeat){return xt.resUtil.success({isRepeat:true})}return xt.resUtil.success({isRepeat:false})}async localCompsByIds(Z){const{compIds:ct}=Z;const ut=await this.compService.getLocalCompsByIds(ct);return xt.resUtil.success({compInfos:ut})}async compFilesOssSignedUrl(Z){const ct=await this.compService.getCompFilesOssSignedUrl(Z);return xt.resUtil.success(ct)}async packageJson(){const Z=await this.compService.getPackageJsonContent();return xt.resUtil.success({packageJson:Z})}async compFileHash(Z){const ct=await this.compService.getCompFileHash(Z);return xt.resUtil.success(ct)}async localComps(Z){const ct=await this.compService.getLocalComps(Z);return xt.resUtil.success(ct)}async openCompPathInVscode(Z){await this.compService.openCompPathInVscode(Z);return xt.resUtil.noData()}async localCompDetailByPathHash(Z){const ct=await this.compService.getLocalCompDetailByPathHash(Z);return xt.resUtil.success(ct)}};ct.CompController=Et;pt([(0,_t.MainApp)(),dt("design:type",Object)],Et.prototype,"app",void 0);pt([(0,_t.Inject)(),dt("design:type",mt.CompService)],Et.prototype,"compService",void 0);pt([(0,_t.Inject)(),dt("design:type",ht.ConfigService)],Et.prototype,"configService",void 0);pt([(0,yt.ApiOperation)({summary:"获取组件目录"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.CompFileVO)}),(0,_t.Post)("/dir"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.CompDirDTO]),dt("design:returntype",Promise)],Et.prototype,"dir",null);pt([(0,yt.ApiOperation)({summary:"获取组件目录内指定文件的内容"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.CompFileContentVO)}),(0,_t.Post)("/file"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.CompFileDTO]),dt("design:returntype",Promise)],Et.prototype,"file",null);pt([(0,yt.ApiOperation)({summary:"检查组件配置是否符合规范"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.CompCheckVO)}),(0,_t.Post)("/check"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.CompCheckDTO]),dt("design:returntype",Promise)],Et.prototype,"check",null);pt([(0,yt.ApiOperation)({summary:"更新组件版本号"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:xt.NoData}),(0,_t.Post)("/updateVersion"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.UpdateVersionDTO]),dt("design:returntype",Promise)],Et.prototype,"updateVersion",null);pt([(0,yt.ApiOperation)({summary:"生成组件指纹文件"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:xt.NoData}),(0,_t.Post)("/generateCompJson"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.GenerateCompJsonDTO]),dt("design:returntype",Promise)],Et.prototype,"generateCompJson",null);pt([(0,yt.ApiOperation)({summary:"获取组件依赖关系"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.ImportScanResultVO)}),(0,_t.Post)("/dep"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.DepDTO]),dt("design:returntype",Promise)],Et.prototype,"dep",null);pt([(0,yt.ApiOperation)({summary:"检查组件是否重复"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.CompSimilarListVO)}),(0,_t.Post)("/checkCompRepeat",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.CheckCompRepeatDTO]),dt("design:returntype",Promise)],Et.prototype,"checkCompRepeat",null);pt([(0,yt.ApiOperation)({summary:"提交组件"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:xt.NoData}),(0,_t.Post)("/submit",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.SubmitCompDTO]),dt("design:returntype",Promise)],Et.prototype,"submit",null);pt([(0,yt.ApiOperation)({summary:"更新组件"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:xt.NoData}),(0,_t.Post)("/update",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.UpdateCompDTO]),dt("design:returntype",Promise)],Et.prototype,"update",null);pt([(0,yt.ApiOperation)({summary:"下载组件"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.DownloadCompVO)}),(0,_t.Post)("/download",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.DownloadCompDTO]),dt("design:returntype",Promise)],Et.prototype,"download",null);pt([(0,yt.ApiOperation)({summary:"通过ids在本地查询组件"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.LocalCompsByIdsVO)}),(0,_t.Post)("/localCompsByIds"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.LocalCompsByIdsDTO]),dt("design:returntype",Promise)],Et.prototype,"localCompsByIds",null);pt([(0,yt.ApiOperation)({summary:"获取组件文件夹下所有文件的oss签名访问地址"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.CompFilesOssSignedUrlVO)}),(0,_t.Post)("/compFilesOssSignedUrl",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.CompFilesOssSignedUrlDTO]),dt("design:returntype",Promise)],Et.prototype,"compFilesOssSignedUrl",null);pt([(0,yt.ApiOperation)({summary:"获取package.json"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.PackageJsonVO)}),(0,_t.Post)("/packageJson"),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],Et.prototype,"packageJson",null);pt([(0,yt.ApiOperation)({summary:"获取组件文件hash"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.CompFileHashVO)}),(0,_t.Post)("/compFileHash"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.CompFileHashDTO]),dt("design:returntype",Promise)],Et.prototype,"compFileHash",null);pt([(0,yt.ApiOperation)({summary:"获取本地组件列表,分页查询"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)((0,xt.createListWrapper)(St.LocalCompsVO))}),(0,_t.Post)("/localComps",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.LocalCompsDTO]),dt("design:returntype",Promise)],Et.prototype,"localComps",null);pt([(0,yt.ApiOperation)({summary:"通过组件路径打开在vscode中打开所在文件夹"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:xt.NoData}),(0,_t.Post)("/openCompPathInVscode"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.OpenCompPathInVscodeDTO]),dt("design:returntype",Promise)],Et.prototype,"openCompPathInVscode",null);pt([(0,yt.ApiOperation)({summary:"通过组件完整文件路径hash获取组件信息"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.LocalCompDetailVO)}),(0,_t.Post)("/localCompDetailByPathHash"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.LocalCompDetailByPathHashDTO]),dt("design:returntype",Promise)],Et.prototype,"localCompDetailByPathHash",null);ct.CompController=Et=pt([(0,yt.ApiTags)(["v1-comp"]),(0,_t.Controller)("/v1/comp")],Et)},91308:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft=this&&this.__param||function(Z,ct){return function(ut,pt){ct(ut,pt,Z)}};Object.defineProperty(ct,"__esModule",{value:true});ct.ModuleController=void 0;const _t=ut(31049);const mt=ut(90381);const ht=ut(85984);const yt=ut(19428);const vt=ut(71692);const St=ut(61275);const bt=ut(93597);let xt=class ModuleController{async preBuild(Z){const{deps:ct}=Z;let ut=null;await this.queueService.enqueue((async()=>{ut=await this.moduleService.preBuild(ct)}));return bt.resUtil.success(ut)}async preBuildSize(){const Z=await this.moduleService.preBuildSize();return bt.resUtil.success({size:Z})}async clearPreBuild(){await this.moduleService.clearPreBuild();return bt.resUtil.noData()}};ct.ModuleController=xt;pt([(0,_t.Inject)(),dt("design:type",ht.ModuleService)],xt.prototype,"moduleService",void 0);pt([(0,_t.Inject)(),dt("design:type",St.QueueService)],xt.prototype,"queueService",void 0);pt([(0,mt.ApiOperation)({summary:"模块预构建"}),(0,mt.ApiResponse)({status:200,description:"返回结果",type:(0,bt.createSuccessWrapper)(vt.PreBuildVO)}),(0,_t.Post)("/preBuild"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[yt.PreBuildDTO]),dt("design:returntype",Promise)],xt.prototype,"preBuild",null);pt([(0,mt.ApiOperation)({summary:"获取预构建模块文件总大小"}),(0,mt.ApiResponse)({status:200,description:"返回结果",type:(0,bt.createSuccessWrapper)(vt.PreBuildSizeVO)}),(0,_t.Post)("/preBuildSize"),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],xt.prototype,"preBuildSize",null);pt([(0,mt.ApiOperation)({summary:"清除预构建模块文件"}),(0,mt.ApiResponse)({status:200,description:"返回结果",type:bt.NoData}),(0,_t.Post)("/clearPreBuild"),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],xt.prototype,"clearPreBuild",null);ct.ModuleController=xt=pt([(0,mt.ApiTags)(["v1-module"]),(0,_t.Controller)("/v1/module")],xt)},5387:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft=this&&this.__param||function(Z,ct){return function(ut,pt){ct(ut,pt,Z)}};Object.defineProperty(ct,"__esModule",{value:true});ct.OssController=void 0;const _t=ut(31049);const mt=ut(90381);const ht=ut(93597);const yt=ut(56415);const vt=ut(75049);const St=ut(80799);const bt=ut(19465);let xt=class OssController{async fileSignUrl(Z){const{objectId:ct}=Z;const ut=await this.ossService.getDownloadSts();const pt=await this.ossService.getFilePreviewUrl(ut,ct);return ht.resUtil.success({signUrl:pt})}};ct.OssController=xt;pt([(0,_t.MainApp)(),dt("design:type",Object)],xt.prototype,"app",void 0);pt([(0,_t.Inject)(),dt("design:type",St.OssService)],xt.prototype,"ossService",void 0);pt([(0,mt.ApiOperation)({summary:"获取文件访问地址",description:"获取文件访问地址"}),(0,mt.ApiResponse)({status:200,description:"返回结果",type:(0,ht.createSuccessWrapper)(vt.SignedUrlVO)}),(0,_t.Post)("/fileSignUrl",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[yt.SignedUrlDTO]),dt("design:returntype",Promise)],xt.prototype,"fileSignUrl",null);ct.OssController=xt=pt([(0,mt.ApiTags)(["v1-oss"]),(0,_t.Controller)("/v1/oss")],xt)},6444:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft=this&&this.__param||function(Z,ct){return function(ut,pt){ct(ut,pt,Z)}};Object.defineProperty(ct,"__esModule",{value:true});ct.PreprocessingController=void 0;const _t=ut(90381);const mt=ut(31049);const ht=ut(90218);const yt=ut(18922);const vt=ut(5578);const St=ut(93597);let bt=class PreprocessingController{async preprocess(Z){const ct=await this.preprocessingService.preprocessCode(Z);return St.resUtil.success({preprocessedCode:ct})}};ct.PreprocessingController=bt;pt([(0,mt.Inject)(),dt("design:type",vt.PreprocessingService)],bt.prototype,"preprocessingService",void 0);pt([(0,_t.ApiOperation)({summary:"css预处理",description:"预处理css代码"}),(0,_t.ApiResponse)({status:200,description:"返回结果",type:(0,St.createSuccessWrapper)(yt.PreprocessedCodeVO)}),(0,mt.Post)("/preprocess"),ft(0,(0,mt.Body)()),dt("design:type",Function),dt("design:paramtypes",[ht.PreprocessingDTO]),dt("design:returntype",Promise)],bt.prototype,"preprocess",null);ct.PreprocessingController=bt=pt([(0,_t.ApiTags)(["v1-preprocessing"]),(0,mt.Controller)("/v1/preprocessing")],bt)},20346:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft=this&&this.__param||function(Z,ct){return function(ut,pt){ct(ut,pt,Z)}};Object.defineProperty(ct,"__esModule",{value:true});ct.VuefinderController=void 0;const _t=ut(31049);const mt=ut(5808);const ht=ut(90381);const yt=ut(23444);let vt=class VuefinderController{async list(Z){const ct=await this.vuefinderService.list(Z);return ct}};ct.VuefinderController=vt;pt([(0,_t.MainApp)(),dt("design:type",Object)],vt.prototype,"app",void 0);pt([(0,_t.Inject)(),dt("design:type",mt.VuefinderService)],vt.prototype,"vuefinderService",void 0);pt([(0,ht.ApiOperation)({summary:"list"}),(0,_t.Get)("/list"),ft(0,(0,_t.Query)()),dt("design:type",Function),dt("design:paramtypes",[yt.VueFinderIndexDTO]),dt("design:returntype",Promise)],vt.prototype,"list",null);ct.VuefinderController=vt=pt([(0,ht.ApiTags)(["v1-vuefinder"]),(0,_t.Controller)("/v1/vuefinder")],vt)},60149:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.BasePageDTO=void 0;const ft=ut(90381);const _t=ut(18649);class BasePageDTO{}ct.BasePageDTO=BasePageDTO;pt([(0,ft.ApiProperty)({example:1,description:"当前页码",required:false}),(0,_t.Rule)(_t.RuleType.number().min(1)),dt("design:type",Number)],BasePageDTO.prototype,"page",void 0);pt([(0,ft.ApiProperty)({example:10,description:"每页数量",required:false}),(0,_t.Rule)(_t.RuleType.number().min(1).max(50)),dt("design:type",Number)],BasePageDTO.prototype,"pageSize",void 0);pt([(0,_t.Rule)(_t.RuleType.string().allow("").max(50).pattern(/\{\s*\$\w+:/i,{invert:true}).trim()),(0,ft.ApiProperty)({example:"小明",description:"关键词",required:false}),dt("design:type",String)],BasePageDTO.prototype,"keyword",void 0)},8131:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.LocalCompDetailByPathHashDTO=ct.OpenCompPathInVscodeDTO=ct.LocalCompsDTO=ct.CompFilesOssSignedUrlDTO=ct.DownloadCompDTO=ct.UpdateCompDTO=ct.SubmitCompDTO=ct.CompFileDTO=ct.UpdateVersionDTO=ct.CompFileHashDTO=ct.CheckCompRepeatDTO=ct.LocalCompsByIdsDTO=ct.DepDTO=ct.GenerateCompJsonDTO=ct.CompCheckDTO=ct.CompDirDTO=void 0;const ft=ut(90381);const _t=ut(18649);const mt=ut(60149);class CompPathDTO{}pt([(0,ft.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],CompPathDTO.prototype,"compPath",void 0);class CompIdDTO{}pt([(0,ft.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],CompIdDTO.prototype,"compId",void 0);class CompDirDTO extends CompPathDTO{}ct.CompDirDTO=CompDirDTO;class CompCheckDTO extends CompPathDTO{}ct.CompCheckDTO=CompCheckDTO;class GenerateCompJsonDTO extends CompPathDTO{}ct.GenerateCompJsonDTO=GenerateCompJsonDTO;class DepDTO extends CompPathDTO{}ct.DepDTO=DepDTO;class LocalCompsByIdsDTO{}ct.LocalCompsByIdsDTO=LocalCompsByIdsDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件id列表",example:["123","456"]}),(0,_t.Rule)(_t.RuleType.array().required().items(_t.RuleType.string())),dt("design:type",Array)],LocalCompsByIdsDTO.prototype,"compIds",void 0);class CheckCompRepeatDTO extends CompPathDTO{}ct.CheckCompRepeatDTO=CheckCompRepeatDTO;pt([(0,ft.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,_t.Rule)(_t.RuleType.string()),dt("design:type",String)],CheckCompRepeatDTO.prototype,"teamId",void 0);class CompFileHashDTO extends CompPathDTO{}ct.CompFileHashDTO=CompFileHashDTO;class UpdateVersionDTO extends CompPathDTO{}ct.UpdateVersionDTO=UpdateVersionDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件版本号",example:"1.0.0"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],UpdateVersionDTO.prototype,"version",void 0);class CompFileDTO{}ct.CompFileDTO=CompFileDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件文件路径",example:"/src/components/MyComp/index.vue"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],CompFileDTO.prototype,"filePath",void 0);class PreviewItemDTO{}pt([(0,ft.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),(0,_t.Rule)(_t.RuleType.array().required().items(_t.RuleType.string())),dt("design:type",Array)],PreviewItemDTO.prototype,"miniPath",void 0);pt([(0,ft.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),(0,_t.Rule)(_t.RuleType.array().optional().items(_t.RuleType.string())),dt("design:type",Array)],PreviewItemDTO.prototype,"fullPath",void 0);pt([(0,ft.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),(0,_t.Rule)(_t.RuleType.string()),dt("design:type",String)],PreviewItemDTO.prototype,"desc",void 0);class ParentDTO{}pt([(0,ft.ApiProperty)({description:"父库名称",required:true,example:"vue"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],ParentDTO.prototype,"name",void 0);pt([(0,ft.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],ParentDTO.prototype,"version",void 0);class DepItemDTO{}pt([(0,ft.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],DepItemDTO.prototype,"name",void 0);pt([(0,ft.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],DepItemDTO.prototype,"version",void 0);pt([(0,ft.ApiProperty)({type:ParentDTO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),(0,_t.Rule)(_t.RuleType.object().optional()),dt("design:type",ParentDTO)],DepItemDTO.prototype,"parent",void 0);class SubmitCompDTO{}ct.SubmitCompDTO=SubmitCompDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],SubmitCompDTO.prototype,"name",void 0);pt([(0,ft.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],SubmitCompDTO.prototype,"compPath",void 0);pt([(0,ft.ApiProperty)({type:[DepItemDTO],required:true,description:"组件依赖"}),(0,_t.Rule)(_t.RuleType.array().required()),dt("design:type",Array)],SubmitCompDTO.prototype,"dep",void 0);pt([(0,ft.ApiProperty)({type:[PreviewItemDTO],required:true,description:"组件预览数据"}),(0,_t.Rule)(_t.RuleType.array().required()),dt("design:type",Array)],SubmitCompDTO.prototype,"previewConfigs",void 0);pt([(0,ft.ApiProperty)({required:true,description:"组件描述",example:"这是一个组件"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],SubmitCompDTO.prototype,"desc",void 0);pt([(0,ft.ApiProperty)({required:false,description:"组件背景颜色",example:"#f0f0f0"}),(0,_t.Rule)(_t.RuleType.string().empty("").default("")),dt("design:type",String)],SubmitCompDTO.prototype,"bgColor",void 0);pt([(0,ft.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,_t.Rule)(_t.RuleType.string()),dt("design:type",String)],SubmitCompDTO.prototype,"teamId",void 0);class UpdateCompDTO extends SubmitCompDTO{}ct.UpdateCompDTO=UpdateCompDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],UpdateCompDTO.prototype,"compId",void 0);pt([(0,ft.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,_t.Rule)(_t.RuleType.string()),dt("design:type",String)],UpdateCompDTO.prototype,"teamId",void 0);pt([(0,ft.ApiProperty)({required:false,description:"组件升级描述",example:"升级组件描述"}),(0,_t.Rule)(_t.RuleType.string().allow("").max(200)),dt("design:type",String)],UpdateCompDTO.prototype,"upgradeDesc",void 0);class DownloadCompDTO extends CompIdDTO{}ct.DownloadCompDTO=DownloadCompDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件下载路径",example:"/src/components/MyComp"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],DownloadCompDTO.prototype,"savePath",void 0);pt([(0,ft.ApiProperty)({required:false,description:"是否覆盖",example:true}),(0,_t.Rule)(_t.RuleType.boolean().default(false)),dt("design:type",Boolean)],DownloadCompDTO.prototype,"isCover",void 0);pt([(0,ft.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],DownloadCompDTO.prototype,"compName",void 0);pt([(0,ft.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],DownloadCompDTO.prototype,"version",void 0);class CompFilesOssSignedUrlDTO{}ct.CompFilesOssSignedUrlDTO=CompFilesOssSignedUrlDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"version",void 0);pt([(0,ft.ApiProperty)({required:true,description:"对象存储id",example:"123"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"objectId",void 0);pt([(0,ft.ApiProperty)({required:true,description:"组件文件路径",example:"MyComp/index.vue"}),(0,_t.Rule)(_t.RuleType.array().required().items(_t.RuleType.string())),dt("design:type",Array)],CompFilesOssSignedUrlDTO.prototype,"files",void 0);class LocalCompsDTO extends mt.BasePageDTO{}ct.LocalCompsDTO=LocalCompsDTO;class OpenCompPathInVscodeDTO{}ct.OpenCompPathInVscodeDTO=OpenCompPathInVscodeDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],OpenCompPathInVscodeDTO.prototype,"folderPath",void 0);pt([(0,ft.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],OpenCompPathInVscodeDTO.prototype,"relativeFilePath",void 0);class LocalCompDetailByPathHashDTO{}ct.LocalCompDetailByPathHashDTO=LocalCompDetailByPathHashDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件完整文件路径hash",example:"1234567890"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],LocalCompDetailByPathHashDTO.prototype,"fullPathHash",void 0)},19428:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.PreBuildDTO=void 0;const ft=ut(90381);const _t=ut(18649);class PreBuildDTO{}ct.PreBuildDTO=PreBuildDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件依赖",example:["axios","md5"]}),(0,_t.Rule)(_t.RuleType.array().required().items(_t.RuleType.string())),dt("design:type",Array)],PreBuildDTO.prototype,"deps",void 0)},56415:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.SignedUrlDTO=void 0;const ft=ut(90381);const _t=ut(18649);class SignedUrlDTO{}ct.SignedUrlDTO=SignedUrlDTO;pt([(0,_t.Rule)(_t.RuleType.string().required().error(new Error("对象id不能为空"))),(0,ft.ApiProperty)({example:"xcxcxdas",description:"对象id",required:true}),dt("design:type",String)],SignedUrlDTO.prototype,"objectId",void 0)},90218:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.PreprocessingDTO=void 0;const ft=ut(90381);const _t=ut(18649);const mt=ut(34985);class PreprocessingDTO{}ct.PreprocessingDTO=PreprocessingDTO;pt([(0,ft.ApiProperty)({description:"css代码"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],PreprocessingDTO.prototype,"cssCode",void 0);pt([(0,ft.ApiProperty)({enum:mt.PrecompilerEnum,example:mt.PrecompilerEnum.SASS,description:"预编译器类型",required:false}),(0,_t.Rule)(_t.RuleType.string().valid(...Object.values(mt.PrecompilerEnum))),dt("design:type",String)],PreprocessingDTO.prototype,"precompilerType",void 0)},23444:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.VueFinderIndexDTO=void 0;const ft=ut(90381);const _t=ut(18649);class VueFinderIndexDTO{}ct.VueFinderIndexDTO=VueFinderIndexDTO;pt([(0,ft.ApiProperty)({required:false,description:"文件路径"}),(0,_t.Rule)(_t.RuleType.string()),dt("design:type",String)],VueFinderIndexDTO.prototype,"path",void 0)},59416:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.BadRequestErrorFilter=void 0;const dt=ut(31049);const ft=ut(93597);const _t=ut(60449);let mt=class BadRequestErrorFilter{async catch(Z,ct){const ut=ct.app.getEnv();if(ut===_t.KEYS.LOCAL_MIDWAY_ENV_LOCAL){ct.logger.error("BadRequestErrorFilter==>",Z)}return ft.resUtil.error(Z.message,Z.status)}};ct.BadRequestErrorFilter=mt;ct.BadRequestErrorFilter=mt=pt([(0,dt.Catch)(dt.httpError.BadRequestError)],mt)},54633:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.DefaultErrorFilter=void 0;const dt=ut(31049);const ft=ut(60449);let _t=class DefaultErrorFilter{async catch(Z,ct){const ut=ct.app.getEnv();try{const ct=JSON.parse(Z.message);return{...ct}}catch(Z){if(ut===ft.KEYS.LOCAL_MIDWAY_ENV_LOCAL){ct.logger.error("解析错误信息失败==>",Z.message,"\n")}}finally{if(ut===ft.KEYS.LOCAL_MIDWAY_ENV_LOCAL){ct.logger.error("原始错误==>",Z)}}ct.status=Z.status??500;return{code:Z.status??500,message:Z.message??"未知错误"}}};ct.DefaultErrorFilter=_t;ct.DefaultErrorFilter=_t=pt([(0,dt.Catch)()],_t)},15545:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.Configuration=void 0;var ft=ut(12799);Object.defineProperty(ct,"Configuration",{enumerable:true,get:function(){return ft.MainConfiguration}});dt(ut(14071),ct);dt(ut(91921),ct);dt(ut(64754),ct);dt(ut(17076),ct);dt(ut(78805),ct);dt(ut(91308),ct);dt(ut(5387),ct);dt(ut(6444),ct);dt(ut(20346),ct);dt(ut(60149),ct);dt(ut(8131),ct);dt(ut(19428),ct);dt(ut(56415),ct);dt(ut(34985),ct);dt(ut(90218),ct);dt(ut(23444),ct);dt(ut(59416),ct);dt(ut(54633),ct);dt(ut(9711),ct);dt(ut(53951),ct);dt(ut(77523),ct);dt(ut(61142),ct);dt(ut(19465),ct);dt(ut(95637),ct);dt(ut(48795),ct);dt(ut(63366),ct);dt(ut(23086),ct);dt(ut(85984),ct);dt(ut(80799),ct);dt(ut(5578),ct);dt(ut(61275),ct);dt(ut(19452),ct);dt(ut(5808),ct);dt(ut(66593),ct);dt(ut(58953),ct);dt(ut(10778),ct);dt(ut(101),ct);dt(ut(71692),ct);dt(ut(75049),ct);dt(ut(18922),ct)},9711:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},53951:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},34985:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.PrecompilerEnum=void 0;var ut;(function(Z){Z["LESS"]="less";Z["SASS"]="sass";Z["SCSS"]="scss"})(ut||(ct.PrecompilerEnum=ut={}))},77523:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},61142:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.ReportMiddleware=void 0;const dt=ut(31049);let ft=class ReportMiddleware{resolve(){return async(Z,ct)=>{const ut=Date.now();const pt=await ct();const dt=Z.url;Z.logger.debug(`请求 ${dt} 耗时 = ${Date.now()-ut}ms`);return pt}}static getName(){return"report"}};ct.ReportMiddleware=ft;ct.ReportMiddleware=ft=pt([(0,dt.Middleware)()],ft)},19465:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.TokenMiddleware=void 0;const dt=ut(31049);const ft=ut(10778);let _t=class TokenMiddleware{resolve(){return async(Z,ct)=>{(0,ft.setHeader)(Z.header);await ct()}}static getName(){return"token"}};ct.TokenMiddleware=_t;ct.TokenMiddleware=_t=pt([(0,dt.Middleware)()],_t)},95637:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});ct.CommandService=void 0;const _t=ut(31049);const mt=ft(ut(79896));const ht=ut(63366);const yt=ut(94798);const vt=ft(ut(16928));const St=ut(67213);let bt=class CommandService{async revealInVSCode(Z,ct,ut=1,pt=1){const{cwd:dt}=this.configService.comphubConfig();if(!Z||!mt.default.existsSync(Z)||!mt.default.statSync(Z).isDirectory()){throw new _t.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist"))}const ft=vt.default.resolve(Z,ct);if(!mt.default.existsSync(ft)||mt.default.statSync(ft).isDirectory()){throw new _t.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist"))}(0,yt.launchIDE)({file:dt});(0,yt.launchIDE)({file:ft,line:ut,column:pt})}};ct.CommandService=bt;pt([(0,_t.Inject)(),dt("design:type",ht.ConfigService)],bt.prototype,"configService",void 0);pt([(0,_t.Inject)(),dt("design:type",Object)],bt.prototype,"ctx",void 0);pt([(0,_t.Inject)(),dt("design:type",St.MidwayI18nService)],bt.prototype,"i18nService",void 0);ct.CommandService=bt=pt([(0,_t.Provide)()],bt)},48795:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.CompService=void 0;const ht=ut(31049);const yt=_t(ut(16928));const vt=_t(ut(79896));const St=ut(63366);const bt=ut(23086);const xt=ut(80799);const $t=_t(ut(70857));const Et=_t(ut(83929));const Ct=ut(74952);const Tt=ut(84464);const wt=ut(95637);const At=ut(60449);const kt=ut(44120);const It=ut(6586);const Nt=ut(67213);let Pt=class CompService{getCompFullPath(Z){const{srcPath:ct}=this.configService.comphubConfig();Z=Z.replace(At.KEYS.FILE_MANAGER_DIRNAME,"");const ut=yt.join(ct,Z);return ut}checkCompEntryIndex(Z){const ct=yt.join(Z,At.KEYS.COMP_USE_ENTRY_FILE);if(!vt.existsSync(ct)){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[At.KEYS.COMP_USE_ENTRY_FILE]}))}}checkCompJson(Z){const ct=this.getCompFullPath(Z);const ut=yt.join(ct,At.KEYS.COMP_CONFIG_FILENAME);if(!vt.existsSync(ut)){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.configFileNotExist"))}}checkCompJsonFormat(Z){const ct=Object.keys(Z);const ut=At.ARRAY.COMP_DEFAULT_FIELD.every((Z=>!Z.required||ct.includes(Z.name)));if(!ut)return false;return kt.versionKit.validateVersion(Z.version)}async updateCompJson(Z,ct){const ut=this.getCompFullPath(Z);const pt=yt.join(ut,At.KEYS.COMP_CONFIG_FILENAME);const dt=await this.getCompFile(pt);const ft=ct(JSON.parse(dt));await vt.promises.writeFile(pt,JSON.stringify(ft,null,4))}async readCompVersion(Z){const ct=yt.join(Z,At.KEYS.COMP_CONFIG_FILENAME);const ut=await this.getCompFile(ct);const pt=JSON.parse(ut);return pt.version}initCompJson(){return At.ARRAY.COMP_DEFAULT_FIELD.reduce(((Z,ct)=>{const ut={};if(ct.required){ut[ct.name]=ct.default}return{...Z,...ut}}),{})}async uploadCompFolderToOss({compFullPath:Z,version:ct,ossData:ut}){const{files:pt}=await Ct.fileTree.generateTree(Z);const dt=pt.map((({absolutePath:ct,size:ut})=>{const pt=ct.replace(Z,"");return{filePath:pt,fileFullPath:ct,size:ut??0}}));dt.sort(((Z,ct)=>ct.size-Z.size));for(let Z=0;Z<dt.length;Z++){const{filePath:pt,fileFullPath:ft}=dt[Z];const _t=yt.join(ut.key,ct,pt);const mt={...ut,key:_t.replace(new RegExp(kt.textKit.escapeRegExp(yt.sep),"g"),"/")};const ht=vt.createReadStream(ft);await this.ossService.uploadFileToOss(mt,ht)}}async getCompHash(Z){const ct=await Ct.digest.getFileHashList(Z);const ut=ct.map((Z=>`${Z.relativePath}-${Z.hash}`)).join(";");return Ct.digest.getStringHash(ut)}async getCompFeatures(Z){const ct=await Ct.digest.getFileHashAndSsdeepList(Z);const ut=ct.map((Z=>{const ct=(0,Tt.omit)(Z,["relativePath"]);return{...ct,path:Z.relativePath}}));const pt=await Ct.digest.getRelativeDirList(Z);const dt=JSON.stringify(pt);const ft=Ct.digest.getStringFuzzyHash(dt);const _t=await this.getCompHash(Z);return{fileHashList:ut,compHash:_t,dirHash:Ct.digest.getStringHash(dt),dirSsdeep:Ct.digest.getSsdeepStruct(ft)}}async getCompFileList(Z){const{files:ct}=await Ct.fileTree.generateTree(Z);const ut=ct.map((({name:ct,size:ut,absolutePath:pt})=>({name:ct,size:ut??0,path:pt.replace(Z,"").replace(new RegExp(kt.textKit.escapeRegExp(yt.sep),"g"),"/")})));return ut}checkCompFileSize(Z){if(Z>At.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSizeExceeded",{args:[Math.floor(At.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE/1024/1024).toString()]}))}}checkCompFileNum(Z){if(Z>At.KEYS.COMP_SUBMIT_MAX_FILE_COUNT){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitFileCountExceeded",{args:[At.KEYS.COMP_SUBMIT_MAX_FILE_COUNT.toString()]}))}}async findCompJsonPath(Z){const{files:ct}=await Ct.fileTree.generateTree(Z,{ignore:["node_modules"]});this.ctx.logger.debug("项目文件数量:",ct.length);const ut=ct.filter((({absolutePath:Z})=>Z.endsWith(At.KEYS.COMP_CONFIG_FILENAME)));return ut}async getAllLocalCompIds(){const{srcPath:Z}=this.configService.comphubConfig();const ct=await this.findCompJsonPath(Z);this.ctx.logger.debug("组件文件数量:",ct.length);const ut=ct.map((async({absolutePath:Z})=>{const ct=await vt.promises.readFile(Z,"utf8");const ut=JSON.parse(ct);const pt=this.checkCompJsonFormat(ut);const dt=yt.dirname(Z);return{compjson:ut,isCompHub:pt,compPath:dt,pathHash:Ct.digest.getStringHash(dt)}}));const pt=await Promise.all(ut);return pt.filter((Z=>Z.isCompHub&&Z.compjson.__id__))}async getCompDir(Z){const{srcPath:ct}=this.configService.comphubConfig();const ut=yt.join(Z.replace(At.KEYS.FILE_MANAGER_DIRNAME,`${ct}${yt.sep}`));const{tree:pt,files:dt}=await Ct.fileTree.generateTree(ut,{sortBy:"type"});const _handleTree=Z=>{const ct={name:Z.name,path:Z.absolutePath,type:Z.type};if(Z.children&&Z.children.length>0){ct.children=Z.children.map((Z=>_handleTree(Z)))}return ct};return{tree:_handleTree(pt),files:dt.map((Z=>Z.absolutePath))}}async getCompFile(Z){const ct=await vt.promises.readFile(Z,"utf-8");return ct}async checkCompConfig(Z){const ct=yt.basename(Z);const ut=this.getCompFullPath(Z);try{this.checkCompEntryIndex(ut)}catch(Z){this.ctx.logger.error("检查组件入口文件index.vue失败",Z);return{errorMsg:"组件入口文件index.vue不存在"}}const pt=yt.join(ct,At.KEYS.COMP_USE_ENTRY_FILE);try{this.checkCompJson(Z)}catch(Z){this.ctx.logger.error("检查组件配置文件comp.json失败",Z);return{entryIndexPath:pt,errorMsg:"组件配置文件comp.json不存在"}}const dt=yt.join(ct,At.KEYS.COMP_CONFIG_FILENAME);try{const ct=yt.join(this.getCompFullPath(Z),At.KEYS.COMP_CONFIG_FILENAME);const ut=await this.getCompFile(ct);const ft=this.checkCompJsonFormat(JSON.parse(ut));if(!ft){return{entryIndexPath:pt,compJsonPath:dt,errorMsg:"comp.json文件格式错误"}}}catch(Z){this.ctx.logger.error("读取组件配置文件comp.json失败",Z);return{entryIndexPath:pt,compJsonPath:dt,errorMsg:"读取comp.json文件失败"}}return{entryIndexPath:pt,compJsonPath:dt,errorMsg:""}}async updateCompVersion(Z,ct){const ut=kt.versionKit.validateVersion(ct);if(!ut){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidVersionFormat"))}const pt=this.getCompFullPath(Z);const dt=yt.join(pt,At.KEYS.COMP_CONFIG_FILENAME);const ft=await this.getCompFile(dt);const _t=JSON.parse(ft);_t.version=ct;const mt=JSON.stringify(_t,null,2);await vt.promises.writeFile(dt,mt)}async generateCompJson(Z){const ct=this.getCompFullPath(Z);const ut=yt.basename(ct);const pt=this.initCompJson();pt.name=ut;await vt.promises.writeFile(yt.join(ct,At.KEYS.COMP_CONFIG_FILENAME),JSON.stringify(pt,null,4))}async getCompDep(Z){const{cwd:ct}=this.configService.comphubConfig();const ut=this.getCompFullPath(Z);const pt=await this.depsService.getModuleEntry(ut,ct);return pt}async getCompFileHash(Z){const{compPath:ct}=Z;const ut=this.getCompFullPath(ct);const pt=await this.getCompFeatures(ut);return{compHash:pt.compHash}}async checkCompRepeat(Z){const{compPath:ct,teamId:ut}=Z;const pt=this.getCompFullPath(ct);const dt=await this.getCompFeatures(pt);const ft=await It.remoteApi.v1Comp.compcontrollerCheckcompexistbyhash(dt,{headers:{"team-id":ut}});return ft.data}async submitComp(Z){let ct="";let ut={};try{const{compPath:pt,dep:dt,previewConfigs:ft,desc:_t,bgColor:mt,name:ht,teamId:yt}=Z;ut={"team-id":yt};this.checkCompJson(pt);const vt=this.getCompFullPath(pt);const St=await this.getCompFeatures(vt);this.checkCompEntryIndex(vt);const bt=await this.readCompVersion(vt);const xt=await this.getCompFileList(vt);const $t=xt.reduce(((Z,ct)=>Z+ct.size),0);this.checkCompFileNum(xt.length);this.checkCompFileSize($t);const Et={name:ht,dep:dt,previewConfigs:ft,desc:_t,version:bt,size:$t,files:xt,bgColor:mt,compFeatures:St};const Ct=await It.remoteApi.v1Comp.compcontrollerUpload(Et,{headers:ut});const Tt=Ct.data._id;ct=Tt;await this.updateCompJson(pt,(Z=>({...Z,name:ht,__id__:Tt})));const{data:{componentDir:wt}}=await It.remoteApi.v1Oss.osscontrollerCompossdir();const At=await It.remoteApi.v1Oss.osscontrollerPutpolicy({type:wt});const kt={compFullPath:vt,version:bt,ossData:At.data};await this.uploadCompFolderToOss(kt);const{key:Nt}=At.data;const Pt={compId:Tt,objectId:`${wt}${Nt}`};await It.remoteApi.v1Comp.compcontrollerUpdateobjectid(Pt)}catch(Z){if(ct){await It.remoteApi.v1Comp.compcontrollerDeletefailedcomp({compId:ct},{headers:ut})}if(Z instanceof ht.httpError.BadRequestError){throw new ht.httpError.BadRequestError(Z)}throw new Error(Z.message)}}async updateComp(Z){const{compId:ct,compPath:ut,dep:pt,previewConfigs:dt,desc:ft,bgColor:_t,name:mt,upgradeDesc:ht,teamId:yt}=Z;const vt=this.getCompFullPath(ut);const St=await this.getCompFeatures(vt);this.checkCompEntryIndex(vt);const bt=await It.remoteApi.v1Comp.compcontrollerCompdetail({compId:ct});const{objectId:xt,version:$t}=bt.data;const Et=await this.readCompVersion(vt);const Ct=await this.getCompFileList(vt);const Tt=Ct.reduce(((Z,ct)=>Z+ct.size),0);this.checkCompFileNum(Ct.length);this.checkCompFileSize(Tt);const wt={compId:ct,name:mt,dep:pt,previewConfigs:dt,desc:ft,version:Et,size:Tt,files:Ct,bgColor:_t,compFeatures:St,upgradeDesc:ht};const At=await It.remoteApi.v1Comp.compcontrollerUpdate(wt,{headers:{"team-id":yt}});const{isFileChange:kt}=At.data;if(!kt&&$t===Et){return}const Nt=await It.remoteApi.v1Oss.osscontrollerCompossdir();const{componentDir:Pt}=Nt.data;const Ot=await It.remoteApi.v1Oss.osscontrollerPutpolicy({type:Pt});const Dt=xt.replace(Ot.data.dir,"");const Ft={...Ot.data,key:Dt};const Mt={compFullPath:vt,version:Et,ossData:Ft};await this.uploadCompFolderToOss(Mt);await this.updateCompJson(ut,(Z=>({...Z,name:mt,__id__:ct})))}async downloadComp(Z){const{compId:ct,savePath:ut,isCover:pt,compName:dt,version:ft}=Z;const{srcPath:_t}=this.configService.comphubConfig();const mt=At.KEYS.FILE_MANAGER_DIRNAME;const St=ut.replace(mt,"").replace(/[/\\]/g,yt.sep);const bt=yt.join(_t,St,dt);if(!pt&&vt.existsSync(bt)){return{isRepeat:true}}const xt=$t.tmpdir();const Tt=yt.join(xt,At.KEYS.COMP_TEMP_DIR);this.ctx.logger.debug("组件下载到临时目录",Tt);const wt=await It.remoteApi.v1Comp.compcontrollerCompdetail({compId:ct,version:ft});if(!wt?.data){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compNotExist"))}const{files:kt,objectId:Nt,name:Pt}=wt.data;let Ot=[];const Dt=yt.join(Tt,Nt,ft);if(vt.existsSync(Dt)){const{files:Z}=await Ct.fileTree.generateTree(Dt);Ot=Z}await It.remoteApi.v1Comp.compcontrollerUpdatecompdownloadcount({compId:ct,version:ft});if(kt.length===Ot.length){const Z=Ot.find((({absolutePath:Z})=>Z.replace(Dt,"").startsWith(`${yt.sep}${At.KEYS.COMP_CONFIG_FILENAME}`)));if(Z){const ct=await vt.promises.readFile(Z.absolutePath,"utf8");const ut=JSON.parse(ct);const{name:pt}=ut;if(Pt===pt){await Et.copy(Dt,bt);this.ctx.logger.debug("组件缓存文件和服务器文件一致,直接使用缓存文件");return}}}const Ft=kt.map((Z=>{const ct=yt.join(Nt,ft,Z.path);return{path:ct.replace(/[/\\]/g,"/")}}));const Mt=await this.ossService.getDownloadSts();await this.ossService.downloadFileToPath(Mt,Ft,Tt);const Lt=yt.join(Tt,Nt,ft);await Et.copy(Lt,bt)}async getLocalCompsByIds(Z){const{srcPath:ct}=this.configService.comphubConfig();const ut=await this.findCompJsonPath(ct);this.ctx.logger.debug("组件文件数量:",ut.length);const pt=ut.map((async({absolutePath:Z})=>{const ct=await vt.promises.readFile(Z,"utf8");const ut=JSON.parse(ct);return{...ut,path:yt.dirname(Z)}}));const dt=await Promise.all(pt);const ft=dt.filter((ct=>Z.includes(ct.__id__)));if(!ft){return[]}const _t=At.KEYS.FILE_MANAGER_DIRNAME;const mt=new RegExp(kt.textKit.escapeRegExp(yt.sep),"g");const ht=ft.map((Z=>{const ut=Z.path.replace(ct,"").replace(mt,"/").slice(1);return{id:Z.__id__,path:_t+ut,fullPath:Z.path,fullPathHash:Ct.digest.getStringHash(Z.path),basename:yt.basename(Z.path)}}));return ht}async getCompFilesOssSignedUrl(Z){const{version:ct,objectId:ut,files:pt}=Z;const dt=await this.ossService.getDownloadSts();const ft=pt.map((async Z=>{const pt=yt.join(ut,ct,Z);const ft=await this.ossService.getFilePreviewUrl(dt,pt.replace(/[/\\]/g,"/"));return{path:Z,signedUrl:ft}}));const _t=await Promise.all(ft);return{signedUrls:_t}}async getPackageJsonContent(){const Z=this.configService.comphubConfig();const ct=yt.join(Z.cwd,"package.json");return await Ct.fileSys.readJsonFile(ct)}async getLocalComps(Z){const{page:ct=1,pageSize:ut=10}=Z;const{srcPath:pt}=this.configService.comphubConfig();const dt=await this.getAllLocalCompIds();const ft=dt.map((Z=>({id:Z.compjson.__id__,pathHash:Z.pathHash})));ft.sort(((Z,ct)=>Z.id.localeCompare(ct.id)));const _t=[...new Set(ft.map((Z=>Z.id)))];const mt=await It.remoteApi.v1Comp.compcontrollerExistcompsbyids({compIds:_t});const{ids:vt=[]}=mt.data;const St=ft.filter((Z=>vt.includes(Z.id)));const bt=St.length;const xt=St.slice((ct-1)*ut,ct*ut);const $t=new Map(dt.map((Z=>[`${Z.compjson.__id__}_${Z.pathHash}`,Z])));const Et=await It.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:xt.map((Z=>Z.id))});const{rows:Tt=[]}=Et.data;const wt=new Map(Tt.map((Z=>[Z._id,Z])));const Nt=new RegExp(kt.textKit.escapeRegExp(yt.sep),"g");const Pt=At.KEYS.FILE_MANAGER_DIRNAME;const Ot=xt.map((async({id:Z,pathHash:ct})=>{const ut=$t.get(`${Z}_${ct}`);const dt=wt.get(Z);if(!dt||!ut){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithIdNotExist",{args:[Z]}))}const ft=ut.compPath.replace(pt,"").replace(Nt,"/").slice(1);return{_id:Ct.digest.getStringHash(ut.compPath),name:dt.name,compId:Z,version:ut.compjson.version,path:Pt+ft,previewConfigs:dt.previewConfigs,bgColor:dt.bgColor,fullPath:ut.compPath}}));const Dt=await Promise.all(Ot);return{total:bt,page:ct,pageSize:ut,rows:Dt}}async getLocalCompDetailByPathHash(Z){const{fullPathHash:ct}=Z;const ut=await this.getAllLocalCompIds();const pt=ut.find((Z=>Z.pathHash===ct));if(!pt){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithPathNotExist",{args:[ct]}))}const{srcPath:dt}=this.configService.comphubConfig();const{__id__:ft,version:_t}=pt.compjson;const mt=await It.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:[ft]});const{rows:vt=[]}=mt.data;const St=vt[0];const bt=new RegExp(kt.textKit.escapeRegExp(yt.sep),"g");const xt=At.KEYS.FILE_MANAGER_DIRNAME;const $t=pt.compPath.replace(dt,"").replace(bt,"/").slice(1);return{_id:ct,name:St.name,compId:ft,version:_t,path:xt+$t,previewConfigs:St.previewConfigs,bgColor:St.bgColor,fullPath:pt.compPath}}async openCompPathInVscode(Z){const{folderPath:ct,relativeFilePath:ut}=Z;await this.commandService.revealInVSCode(ct,ut)}};ct.CompService=Pt;ft([(0,ht.MainApp)(),mt("design:type",Object)],Pt.prototype,"app",void 0);ft([(0,ht.Inject)(),mt("design:type",St.ConfigService)],Pt.prototype,"configService",void 0);ft([(0,ht.Inject)(),mt("design:type",xt.OssService)],Pt.prototype,"ossService",void 0);ft([(0,ht.Inject)(),mt("design:type",wt.CommandService)],Pt.prototype,"commandService",void 0);ft([(0,ht.Inject)(),mt("design:type",bt.DepsService)],Pt.prototype,"depsService",void 0);ft([(0,ht.Inject)(),mt("design:type",Object)],Pt.prototype,"ctx",void 0);ft([(0,ht.Inject)(),mt("design:type",Nt.MidwayI18nService)],Pt.prototype,"i18nService",void 0);ct.CompService=Pt=ft([(0,ht.Provide)()],Pt)},63366:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.ConfigService=void 0;const ht=ut(31049);const yt=ut(60449);const vt=_t(ut(16928));let St=class ConfigService{comphubConfig(){const Z=this.app.getAttr(yt.KEYS.COMPHUB_CONFIG_KEY);return Z}getGlobalConfig(){const Z=this.comphubConfig();const{cwd:ct,srcPath:ut,version:pt,allowDebug:dt,subPort:ft}=Z;return{cwd:ct,srcPath:ut,sep:vt.sep,version:pt,allowDebug:dt,subPort:ft}}};ct.ConfigService=St;ft([(0,ht.MainApp)(),mt("design:type",Object)],St.prototype,"app",void 0);ct.ConfigService=St=ft([(0,ht.Provide)()],St)},23086:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.DepsService=void 0;const ht=ut(31049);const yt=_t(ut(16928));const vt=_t(ut(79896));const St=ut(64713);const bt=ut(74952);const xt=ut(60449);const $t=ut(63366);const Et=ut(58953);let Ct=class DepsService{async getModuleEntry(Z,ct){const ut=await bt.fileSys.readJsonFile(yt.join(ct,"package.json"));if(!ut){console.error("未找到 package.json 文件");return[]}const pt=bt.resolver.findDependencyVersion(ut,"vue");const dt=await bt.depGraph.detectImports(Z,{pathAliases:["@"]});dt.vue={version:pt};const ft={};for(const[Z]of Object.entries(dt)){const pt=bt.resolver.findDependencyVersion(ut,Z);const dt={version:pt};const _t=await bt.resolver.findOwningPackage(Z,ct);if(_t){dt.version=_t.version;if(!pt){dt.parent={name:_t.name,version:_t.version}}}ft[Z]=dt}return Object.entries(ft).map((([Z,ct])=>({name:Z,version:ct.version,...ct.parent&&{parent:ct.parent}})))}async precompileModule(Z,ct,ut){const pt=await bt.fileSys.readJsonFile(yt.join(ut,"package.json"));if(!pt){console.error("未找到 package.json 文件");return{entryNameToFile:{}}}const{entryPoints:dt,skippedModules:ft}=(0,Et.buildEntryPoints)(ct,pt,ut);await vt.promises.mkdir(Z,{recursive:true});const _t={};for(const[Z,ct]of Object.entries(dt)){if(bt.resolver.isModuleInstalled(Z,ut)){_t[Z]=ct}}const mt={};for(const Z of ft){mt[Z]=Z}const ht=yt.join(Z,xt.KEYS.META_FILE_NAME);const $t=await bt.fileSys.readJsonFile(ht);const{filteredEntryPoints:Ct,cachedMappings:Tt}=(0,Et.filterCachedModules)(_t,$t);Object.assign(mt,Tt);if(Object.keys(Ct).length===0){return{entryNameToFile:mt}}const wt={entryPoints:Ct,bundle:true,format:"esm",splitting:true,outdir:Z,entryNames:"[name]-[hash]",chunkNames:"chunk-[hash]",outExtension:{".js":".js"},metafile:true,write:true,target:"esnext",sourcemap:false,external:["vue"],absWorkingDir:ut,nodePaths:[yt.join(ut,"node_modules")]};const At=await(0,St.build)(wt);const{optimized:kt,entryNameToFile:It}=(0,Et.analyzeBuildOutputs)(At,Ct,Z);const Nt={...$t,...kt};await(0,Et.saveBuildMetadata)(ht,Nt);return{entryNameToFile:{...mt,...It}}}};ct.DepsService=Ct;ft([(0,ht.MainApp)(),mt("design:type",Object)],Ct.prototype,"app",void 0);ft([(0,ht.Inject)(),mt("design:type",$t.ConfigService)],Ct.prototype,"configService",void 0);ct.DepsService=Ct=ft([(0,ht.Provide)()],Ct)},85984:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.ModuleService=void 0;const ht=ut(31049);const yt=ut(63366);const vt=ut(23086);const St=_t(ut(16928));const bt=ut(74952);const xt=_t(ut(79896));const $t=ut(60449);let Et=class ModuleService{async getPreBuildModuleDir(){const{cwd:Z}=this.configService.comphubConfig();const ct=St.join(Z,$t.KEYS.PREBUILD_MODULE_DIR);await xt.promises.mkdir(ct,{recursive:true});return ct}async preBuild(Z){const ct=await this.getPreBuildModuleDir();const{cwd:ut}=this.configService.comphubConfig();return await this.depsService.precompileModule(ct,Z,ut)}async preBuildSize(){const Z=await this.getPreBuildModuleDir();return await bt.fileSys.dirSize(Z)}async clearPreBuild(){const Z=await this.getPreBuildModuleDir();await xt.promises.rm(Z,{recursive:true,force:true})}};ct.ModuleService=Et;ft([(0,ht.Inject)(),mt("design:type",yt.ConfigService)],Et.prototype,"configService",void 0);ft([(0,ht.Inject)(),mt("design:type",vt.DepsService)],Et.prototype,"depsService",void 0);ft([(0,ht.MainApp)(),mt("design:type",Object)],Et.prototype,"app",void 0);ct.ModuleService=Et=ft([(0,ht.Provide)()],Et)},80799:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ht=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});ct.OssService=void 0;const yt=ut(31049);const vt=ht(ut(51515));const St=ht(ut(12593));const bt=ht(ut(18451));const xt=_t(ut(16928));const $t=_t(ut(79896));const Et=ut(14013);const Ct=ut(6586);const Tt=ht(ut(26506));const wt=ht(ut(24403));const At=ut(45853);const kt=ut(60449);const It=ut(67213);let Nt=class OssService{createOssClient(Z){const ct={endpoint:kt.KEYS.OSS_CUSTOM_DOMAIN,authorizationV4:true,cname:true,...Z};return new bt.default(ct)}createOssFormData(Z,ct){const ut=new vt.default;const pt=Z.dir+Z.key;ut.append("success_action_status","200");ut.append("policy",Z.policy);ut.append("x-oss-signature",Z.signature);ut.append("x-oss-signature-version",Z.x_oss_signature_version);ut.append("x-oss-credential",Z.x_oss_credential);ut.append("x-oss-date",Z.x_oss_date);ut.append("key",pt);ut.append("x-oss-security-token",Z.security_token);ut.append("x-oss-forbid-overwrite","true");ut.append("Cache-Control","public, max-age=31536000");ut.append("file",ct);return{host:Z.host,filePath:pt,formData:ut}}async getDownloadSts(){const Z=await this.cache.get(kt.KEYS.CACHE_KEY_STS_TOKEN);if(Z){return Z}const ct=await Ct.remoteApi.v1Oss.osscontrollerGetsts();const ut=new Date(ct.data.Expiration).getTime()-1*60*1e3;await this.cache.set(kt.KEYS.CACHE_KEY_STS_EXPIRE_TIME,ut);const pt=ut-Date.now();this.ctx.logger.debug("STS过期时间",(0,wt.default)(ut).format("YYYY-MM-DD HH:mm:ss"));this.cache.set(kt.KEYS.CACHE_KEY_STS_TOKEN,ct.data,pt);return ct.data}async uploadFileToOss(Z,ct){const{host:ut,formData:pt}=this.createOssFormData(Z,ct);const dt=await St.default.post(ut,pt,{headers:{...pt.getHeaders()}}).catch((async Z=>{const ct=Z.response.data;const ut=await(0,At.parseStringPromise)(ct);if(ut?.Error){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.parseXmlFailed",{args:[ut.Error.Message]}))}throw new yt.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[Z.message||Z]}))}));if(dt.status!==200){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[dt.data]}))}}async downloadFileToPath(Z,ct,ut){const pt=this.createOssClient({region:Z.region,accessKeyId:Z.AccessKeyId,accessKeySecret:Z.AccessKeySecret,stsToken:Z.SecurityToken,bucket:Z.bucket,refreshSTSToken:async()=>{const Z=await this.getDownloadSts();return{accessKeyId:Z.AccessKeyId,accessKeySecret:Z.AccessKeySecret,stsToken:Z.SecurityToken}}});const dt=ct.map((async Z=>{const{path:ct}=Z;const dt=xt.join(ut,ct);const ft=xt.dirname(dt);if(!$t.existsSync(ft)){$t.mkdirSync(ft,{recursive:true})}return await pt.get(ct,dt)}));return await Promise.all(dt)}async getFilePreviewUrl(Z,ct){const ut=(0,Tt.default)(ct);const pt=await this.cache.get(kt.KEYS.CACHE_KEY_STS_EXPIRE_TIME);const dt=await this.cache.get(ut);const ft=Math.floor((Number(pt)-Date.now())/1e3);this.ctx.logger.debug("文件地址过期时间:",ft,"秒",Math.floor(ft/60),"分钟");if(dt&&ft>0){return dt}const _t=this.createOssClient({region:Z.region,accessKeyId:Z.AccessKeyId,accessKeySecret:Z.AccessKeySecret,stsToken:Z.SecurityToken,bucket:Z.bucket,refreshSTSToken:async()=>{const Z=await this.getDownloadSts();return{accessKeyId:Z.AccessKeyId,accessKeySecret:Z.AccessKeySecret,stsToken:Z.SecurityToken}}});this.ctx.logger.debug("文件地址过期时间:",ft,"秒",Math.floor(ft/60),"分钟");const mt=_t.signatureUrl(ct,{expires:ft});await this.cache.set(ut,mt,ft*1e3);this.ctx.logger.debug("缓存预览URL",ct);return mt}};ct.OssService=Nt;ft([(0,yt.Inject)(),mt("design:type",Object)],Nt.prototype,"ctx",void 0);ft([(0,yt.InjectClient)(Et.CachingFactory,"default"),mt("design:type",Object)],Nt.prototype,"cache",void 0);ft([(0,yt.Inject)(),mt("design:type",It.MidwayI18nService)],Nt.prototype,"i18nService",void 0);ct.OssService=Nt=ft([(0,yt.Provide)()],Nt)},5578:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});ct.PreprocessingService=void 0;const ft=ut(31049);const _t=ut(34985);const mt=ut(81806);const ht=dt(ut(60505));let yt=class PreprocessingService{async preprocessCode(Z){const{cssCode:ct,precompilerType:ut}=Z;if(ut===_t.PrecompilerEnum.SASS||ut===_t.PrecompilerEnum.SCSS){const Z=(0,mt.compileString)(ct);return Z.css}else if(ut===_t.PrecompilerEnum.LESS){const Z=await ht.default.render(ct);return Z.css}return ct}};ct.PreprocessingService=yt;ct.PreprocessingService=yt=pt([(0,ft.Provide)()],yt)},61275:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.QueueService=void 0;const dt=ut(31049);let ft=class QueueService{constructor(){this.queue=[];this.isProcessing=false}async processQueue(){if(this.isProcessing||this.queue.length===0){return}this.isProcessing=true;const Z=this.queue.shift();if(Z){await Z()}this.isProcessing=false;this.processQueue()}async enqueue(Z){return new Promise((ct=>{this.queue.push((async()=>{try{await Z()}finally{ct()}}));this.processQueue()}))}};ct.QueueService=ft;ct.QueueService=ft=pt([(0,dt.Provide)(),(0,dt.Scope)(dt.ScopeEnum.Singleton)],ft)},19452:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ht=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});ct.TerminalService=void 0;const yt=ut(31049);const vt=ut(35317);const St=ut(63366);const bt=_t(ut(95892));const xt=ut(73024);const $t=ut(51455);const Et=ut(74952);const Ct=ht(ut(44644));let Tt=class TerminalService{constructor(){this.subprocess=null;this.cwd="";this.tabIndex=0}getPrompt(){return`${this.cwd}`}smartDecode(Z){if(!Z||Z.length===0)return"";try{new TextDecoder("utf-8",{fatal:true}).decode(Z);return bt.decode(Z,"utf-8")}catch{return bt.decode(Z,"gbk")}}async folderExists(Z){try{await(0,$t.access)(Z,xt.constants.F_OK|xt.constants.R_OK);return true}catch{return false}}async shutdown(Z=5e3){const ct=this.subprocess;if(!ct||ct.killed){this.ctx.emit("output",{cwd:this.getPrompt()});return}return new Promise((ut=>{let pt=false;const done=()=>{if(!pt){pt=true;ut(0)}};ct.once("exit",done);(0,Ct.default)(ct.pid,"SIGTERM",(Z=>{if(Z){this.ctx.emit("output",{err:Z.message})}}));const dt=setTimeout((()=>{(0,Ct.default)(ct.pid,"SIGKILL",(Z=>{if(Z){this.ctx.emit("output",{err:Z.message})}done()}))}),Z);ct.once("exit",(()=>clearTimeout(dt)))}))}async execCmd({cwd:Z,oldCwd:ct,command:ut}){if(!await this.folderExists(Z)){this.ctx.emit("output",{err:`${Z} 路径不存在`});this.ctx.emit("output",{cwd:ct});return}this.cwd=Z;if(!ut.trim()){this.ctx.emit("output",{cwd:this.getPrompt()});return}if(ut==="^C"){await this.shutdown();return}this.subprocess=(0,vt.spawn)(ut,{shell:true,cwd:Z,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",(Z=>{this.ctx.emit("output",{stdout:this.smartDecode(Z)})}));this.subprocess.stderr?.on("data",(Z=>{this.ctx.emit("output",{stderr:this.smartDecode(Z)})}));this.subprocess.on("close",(()=>{this.subprocess=null;this.ctx.emit("output",{cwd:this.getPrompt(),command:ut})}));this.subprocess.on("error",(Z=>{this.ctx.emit("output",{err:Z.message})}))}async cmdTab({cwd:Z,lastWord:ct}){let ut=await Et.fileSys.readDirFiles(Z);if(ct){ut=ut.filter((Z=>Z.name.startsWith(ct)))}if(ut.length===0){return}this.tabIndex=(this.tabIndex+1)%ut.length;const pt=ut[this.tabIndex];this.ctx.emit("output",{tab:pt.name})}};ct.TerminalService=Tt;ft([(0,yt.Inject)(),mt("design:type",St.ConfigService)],Tt.prototype,"configService",void 0);ft([(0,yt.Inject)(),mt("design:type",Object)],Tt.prototype,"ctx",void 0);ct.TerminalService=Tt=ft([(0,yt.Provide)()],Tt)},5808:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.VuefinderService=void 0;const ht=ut(31049);const yt=_t(ut(16928));const vt=_t(ut(79896));const St=ut(63366);const bt=_t(ut(93900));const xt=ut(60449);let $t=class VuefinderService{async list({path:Z}){const ct=this.configService.comphubConfig();const{srcPath:ut}=ct;const pt=Z?.replace(xt.KEYS.FILE_MANAGER_DIRNAME,"")||"";let dt=yt.join(ut,pt);const ft=await vt.promises.access(dt).then((()=>true)).catch((()=>false));if(!ft){dt=ut;Z=xt.KEYS.FILE_MANAGER_DIRNAME}const _t=await vt.promises.readdir(dt);const mt=_t.map((async ct=>{const ut=yt.join(dt,ct);const pt=await vt.promises.stat(ut);const ft=pt.isDirectory();const _t=Z===xt.KEYS.FILE_MANAGER_DIRNAME?`${Z}${ct}`:`${Z}/${ct}`;return{type:ft?"dir":"file",path:_t,file_size:pt.size,visibility:"public",last_modified:Math.floor(pt.mtimeMs/1e3),basename:ct,extension:ft?"":yt.extname(ct).slice(1),mime_type:bt.lookup(ct)||""}}));const ht=await Promise.all(mt);ht.sort(((Z,ct)=>{if(Z.type==="dir"&&ct.type==="file"){return-1}else if(Z.type==="file"&&ct.type==="dir"){return 1}else{return 0}}));return{storages:_t,dirname:Z,files:ht}}};ct.VuefinderService=$t;ft([(0,ht.MainApp)(),mt("design:type",Object)],$t.prototype,"app",void 0);ft([(0,ht.Inject)(),mt("design:type",St.ConfigService)],$t.prototype,"configService",void 0);ct.VuefinderService=$t=ft([(0,ht.Provide)()],$t)},66593:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.TerminalSocketController=void 0;const ft=ut(31049);const _t=ut(19452);let mt=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(Z){this.terminalService.execCmd(Z)}async onTab(Z){this.terminalService.cmdTab(Z)}};ct.TerminalSocketController=mt;pt([(0,ft.Inject)(),dt("design:type",Object)],mt.prototype,"ctx",void 0);pt([(0,ft.Inject)(),dt("design:type",_t.TerminalService)],mt.prototype,"terminalService",void 0);pt([(0,ft.OnWSConnection)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],mt.prototype,"onConnection",null);pt([(0,ft.OnWSDisConnection)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],mt.prototype,"onDisConnection",null);pt([(0,ft.OnWSMessage)("command"),dt("design:type",Function),dt("design:paramtypes",[Object]),dt("design:returntype",Promise)],mt.prototype,"onCommand",null);pt([(0,ft.OnWSMessage)("tab"),dt("design:type",Function),dt("design:paramtypes",[Object]),dt("design:returntype",Promise)],mt.prototype,"onTab",null);ct.TerminalSocketController=mt=pt([(0,ft.WSController)("/terminal")],mt)},58953:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();Object.defineProperty(ct,"__esModule",{value:true});ct.analyzeBuildOutputs=analyzeBuildOutputs;ct.saveBuildMetadata=saveBuildMetadata;ct.filterCachedModules=filterCachedModules;ct.buildEntryPoints=buildEntryPoints;const _t=ft(ut(16928));const mt=ft(ut(79896));const ht=ut(74952);const yt=ut(44120);const vt=ut(60449);function resolveModuleEntry(Z,ct){if(Z!=="vue")return Z;const ut=yt.versionKit.getMajorVersion(ct);return ut==="3"?vt.KEYS.VUE_ESM_BUNDLER:Z}function extractModuleName(Z){const ct=Z.slice(0,-12);return _t.basename(ct)}function matchEntryKey(Z,ct){return Z.find((Z=>{const ut=Z.split("/");const pt=ut.length===1?ut[0]:ut[ut.length-1];return ct===pt}))}function analyzeBuildOutputs(Z,ct,ut){const pt={};const dt={};const ft=Object.keys(ct);const yt=Z.metafile?.outputs??{};for(const[Z,ct]of Object.entries(yt)){if(!ct.entryPoint)continue;const yt=_t.basename(Z);const vt=extractModuleName(Z);const St=matchEntryKey(ft,vt);if(!St)continue;dt[St]=yt;const bt=_t.join(ut,yt);const xt=mt.readFileSync(bt,"utf-8");const $t=ht.digest.getStringHash(xt).slice(0,8);pt[St]={src:ct.entryPoint,file:yt,fileHash:$t,needsInterop:false}}return{optimized:pt,entryNameToFile:dt}}async function saveBuildMetadata(Z,ct){await mt.promises.writeFile(Z,JSON.stringify(ct,null,2))}function filterCachedModules(Z,ct){if(!ct){return{filteredEntryPoints:Z,cachedMappings:{}}}const ut={};const pt={};for(const[dt,ft]of Object.entries(Z)){if(ct[dt]){pt[dt]=ct[dt].file}else{ut[dt]=ft}}return{filteredEntryPoints:ut,cachedMappings:pt}}function buildEntryPoints(Z,ct,ut){const pt={};const dt=[];for(const ft of Z){if(ht.resolver.shouldSkipByExtension(ft)){dt.push(ft);continue}const Z=ht.resolver.findDependencyVersion(ct,ft);if(!Z){const Z=ht.resolver.findOwningPackage(ft,ut);if(!Z)continue}pt[ft]=resolveModuleEntry(ft,Z)}return{entryPoints:pt,skippedModules:dt}}},10778:function(Z,ct,ut){"use strict";var pt=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});ct.remoteInstance=ct.setHeader=void 0;const dt=ut(63536);const ft=ut(60449);const _t=pt(ut(65692));const mt=(0,dt.initInstance)(ft.KEYS.REMOTE_SERVICE_PREFIX,{timeout:1e4,httpsAgent:new _t.default.Agent({rejectUnauthorized:false})});ct.remoteInstance=mt;let ht=null;const setHeader=Z=>{ht=Z};ct.setHeader=setHeader;mt.interceptors.request.use((Z=>{Z.headers[ft.KEYS.AUTHORIZATION_HEADER_NAME]=ht[ft.KEYS.AUTHORIZATION_HEADER_NAME];Z.headers[ft.KEYS.CSRF_TOKEN_HEADER_NAME]=ht[ft.KEYS.CSRF_TOKEN_HEADER_NAME];Z.headers[ft.KEYS.ACCEPT_LANGUAGE_HEADER_NAME]=ht[ft.KEYS.ACCEPT_LANGUAGE_HEADER_NAME.toLowerCase()];Z.headers["cookie"]=ht.cookie;return Z}),(Z=>Promise.reject(Z)));mt.interceptors.response.use((async Z=>{if(Z.data.code!==0){throw new Error(JSON.stringify(Z.data))}return Z.data}),(Z=>Promise.reject(Z)))},101:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.PackageJsonVO=ct.LocalCompDetailVO=ct.LocalCompsVO=ct.CompFileHashVO=ct.CompSimilarListVO=ct.CompFilesOssSignedUrlVO=ct.DownloadCompVO=ct.LocalCompsByIdsVO=ct.ImportScanResultVO=ct.CompCheckVO=ct.CompFileContentVO=ct.CompFileVO=ct.CompSimilarListItemVO=ct.FileNode=void 0;const ft=ut(90381);const _t=ut(60449);class FileNode{}ct.FileNode=FileNode;pt([(0,ft.ApiProperty)({description:"目录/文件名称",example:"index.vue",required:true}),dt("design:type",String)],FileNode.prototype,"name",void 0);pt([(0,ft.ApiProperty)({description:"目录/文件路径",example:"/src/components/MyComp/index.vue",required:true}),dt("design:type",String)],FileNode.prototype,"path",void 0);pt([(0,ft.ApiProperty)({description:"目录/文件类型",example:"file",required:true,enum:_t.ENUM.FileType}),dt("design:type",String)],FileNode.prototype,"type",void 0);pt([(0,ft.ApiProperty)({description:"子节点",type:[FileNode]}),dt("design:type",Array)],FileNode.prototype,"children",void 0);class CompSimilarListItemVO{}ct.CompSimilarListItemVO=CompSimilarListItemVO;pt([(0,ft.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),dt("design:type",String)],CompSimilarListItemVO.prototype,"_id",void 0);pt([(0,ft.ApiProperty)({example:"组件名称",description:"组件名称",required:true}),dt("design:type",String)],CompSimilarListItemVO.prototype,"name",void 0);class CompFileVO{}ct.CompFileVO=CompFileVO;pt([(0,ft.ApiProperty)({type:FileNode,description:"组件文件树",required:true}),dt("design:type",FileNode)],CompFileVO.prototype,"tree",void 0);pt([(0,ft.ApiProperty)({type:[String],description:"组件文件列表",required:true}),dt("design:type",Array)],CompFileVO.prototype,"files",void 0);class CompFileContentVO{}ct.CompFileContentVO=CompFileContentVO;pt([(0,ft.ApiProperty)({description:"组件文件内容",example:"let a=123;",required:true}),dt("design:type",String)],CompFileContentVO.prototype,"content",void 0);class CompCheckVO{}ct.CompCheckVO=CompCheckVO;pt([(0,ft.ApiProperty)({description:"组件入口文件路径",required:false}),dt("design:type",String)],CompCheckVO.prototype,"entryIndexPath",void 0);pt([(0,ft.ApiProperty)({description:"组件配置文件路径",required:false}),dt("design:type",String)],CompCheckVO.prototype,"compJsonPath",void 0);pt([(0,ft.ApiProperty)({description:"异常结果内容",required:true}),dt("design:type",String)],CompCheckVO.prototype,"errorMsg",void 0);class ParentVO{}pt([(0,ft.ApiProperty)({description:"父库名称",required:true,example:"vue"}),dt("design:type",String)],ParentVO.prototype,"name",void 0);pt([(0,ft.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),dt("design:type",String)],ParentVO.prototype,"version",void 0);class ImportDetailVO{}pt([(0,ft.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),dt("design:type",String)],ImportDetailVO.prototype,"name",void 0);pt([(0,ft.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),dt("design:type",String)],ImportDetailVO.prototype,"version",void 0);pt([(0,ft.ApiProperty)({type:ParentVO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),dt("design:type",ParentVO)],ImportDetailVO.prototype,"parent",void 0);class ImportScanResultVO{}ct.ImportScanResultVO=ImportScanResultVO;pt([(0,ft.ApiProperty)({type:[ImportDetailVO],required:true,description:"第三方库导入详情"}),dt("design:type",Array)],ImportScanResultVO.prototype,"thirdParty",void 0);class CompInfoVO{}pt([(0,ft.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),dt("design:type",String)],CompInfoVO.prototype,"id",void 0);pt([(0,ft.ApiProperty)({description:"组件文件路径",example:"local:///MyComp/index.vue",required:true}),dt("design:type",String)],CompInfoVO.prototype,"path",void 0);pt([(0,ft.ApiProperty)({description:"组件文件名称",example:"base-table",required:true}),dt("design:type",String)],CompInfoVO.prototype,"basename",void 0);pt([(0,ft.ApiProperty)({description:"组件文件完整路径",example:"/src/components/MyComp/index.vue",required:true}),dt("design:type",String)],CompInfoVO.prototype,"fullPath",void 0);pt([(0,ft.ApiProperty)({description:"组件文件完整路径哈希值",example:"123",required:true}),dt("design:type",String)],CompInfoVO.prototype,"fullPathHash",void 0);class LocalCompsByIdsVO{}ct.LocalCompsByIdsVO=LocalCompsByIdsVO;pt([(0,ft.ApiProperty)({type:[CompInfoVO],required:true}),dt("design:type",Array)],LocalCompsByIdsVO.prototype,"compInfos",void 0);class DownloadCompVO{}ct.DownloadCompVO=DownloadCompVO;pt([(0,ft.ApiProperty)({description:"组件是否重复",example:true,required:true}),dt("design:type",Boolean)],DownloadCompVO.prototype,"isRepeat",void 0);class SignedUrlItem{}pt([(0,ft.ApiProperty)({description:"文件路径",example:"/src/components/MyComp/index.vue",required:true}),dt("design:type",String)],SignedUrlItem.prototype,"path",void 0);pt([(0,ft.ApiProperty)({description:"文件oss签名访问地址",example:"https://comp-hub.oss-cn-beijing.aliyuncs.com/src/components/MyComp/index.vue?x-oss-security-token=...",required:true}),dt("design:type",String)],SignedUrlItem.prototype,"signedUrl",void 0);class CompFilesOssSignedUrlVO{}ct.CompFilesOssSignedUrlVO=CompFilesOssSignedUrlVO;pt([(0,ft.ApiProperty)({description:"文件oss签名访问地址列表",type:[SignedUrlItem],required:true}),dt("design:type",Array)],CompFilesOssSignedUrlVO.prototype,"signedUrls",void 0);class CompSimilarListVO{}ct.CompSimilarListVO=CompSimilarListVO;pt([(0,ft.ApiProperty)({type:[CompSimilarListItemVO],description:"相似组件列表",required:true}),dt("design:type",Array)],CompSimilarListVO.prototype,"similarList",void 0);class CompFileHashVO{}ct.CompFileHashVO=CompFileHashVO;pt([(0,ft.ApiProperty)({example:"123",description:"组件哈希值",required:true}),dt("design:type",String)],CompFileHashVO.prototype,"compHash",void 0);class PreviewItem{}pt([(0,ft.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"预览配置项主键ID(自动生成)",required:false}),dt("design:type",String)],PreviewItem.prototype,"_id",void 0);pt([(0,ft.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),dt("design:type",Array)],PreviewItem.prototype,"miniPath",void 0);pt([(0,ft.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),dt("design:type",Array)],PreviewItem.prototype,"fullPath",void 0);pt([(0,ft.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),dt("design:type",String)],PreviewItem.prototype,"desc",void 0);class LocalCompsVO{}ct.LocalCompsVO=LocalCompsVO;pt([(0,ft.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"内容id,这里用路径哈希值",required:true}),dt("design:type",String)],LocalCompsVO.prototype,"_id",void 0);pt([(0,ft.ApiProperty)({type:String,example:"qin-table",description:"组件名称",required:true}),dt("design:type",String)],LocalCompsVO.prototype,"name",void 0);pt([(0,ft.ApiProperty)({type:String,example:"123456",description:"组件ID",required:true}),dt("design:type",String)],LocalCompsVO.prototype,"compId",void 0);pt([(0,ft.ApiProperty)({type:String,example:"1.0.0",description:"组件版本",required:true}),dt("design:type",String)],LocalCompsVO.prototype,"version",void 0);pt([(0,ft.ApiProperty)({type:[PreviewItem],required:true}),dt("design:type",Array)],LocalCompsVO.prototype,"previewConfigs",void 0);pt([(0,ft.ApiProperty)({type:String,example:"local://components/QinTable",description:"组件文件路径",required:true}),dt("design:type",String)],LocalCompsVO.prototype,"path",void 0);pt([(0,ft.ApiProperty)({type:String,example:"D:/src/components/QinTable/index.vue",description:"组件文件完整路径",required:true}),dt("design:type",String)],LocalCompsVO.prototype,"fullPath",void 0);pt([(0,ft.ApiProperty)({type:String,example:"#f0f0f0",description:"组件背景颜色",required:false}),dt("design:type",String)],LocalCompsVO.prototype,"bgColor",void 0);class LocalCompDetailVO extends LocalCompsVO{}ct.LocalCompDetailVO=LocalCompDetailVO;class PackageJsonVO{}ct.PackageJsonVO=PackageJsonVO;pt([(0,ft.ApiProperty)({type:Object,description:"组件package.json文件内容",required:true}),dt("design:type",Object)],PackageJsonVO.prototype,"packageJson",void 0)},71692:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.PreBuildSizeVO=ct.PreBuildVO=void 0;const ft=ut(90381);class PreBuildVO{}ct.PreBuildVO=PreBuildVO;pt([(0,ft.ApiProperty)({description:"预构建模块对应文件",required:true,example:{vue:"vue-hash.js"}}),dt("design:type",Object)],PreBuildVO.prototype,"entryNameToFile",void 0);class PreBuildSizeVO{}ct.PreBuildSizeVO=PreBuildSizeVO;pt([(0,ft.ApiProperty)({description:"预构建模块文件总大小",required:true,example:1024}),dt("design:type",Number)],PreBuildSizeVO.prototype,"size",void 0)},75049:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.SignedUrlVO=void 0;const ft=ut(90381);class SignedUrlVO{}ct.SignedUrlVO=SignedUrlVO;pt([(0,ft.ApiProperty)({example:"xxxx",description:"带签名的访问地址",required:true}),dt("design:type",String)],SignedUrlVO.prototype,"signUrl",void 0)},18922:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.PreprocessedCodeVO=void 0;const ft=ut(90381);class PreprocessedCodeVO{}ct.PreprocessedCodeVO=PreprocessedCodeVO;pt([(0,ft.ApiProperty)({description:"预处理后的css代码",required:true}),dt("design:type",String)],PreprocessedCodeVO.prototype,"preprocessedCode",void 0)},15798:(Z,ct)=>{"use strict";const ut={suspectRx:/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*\:/};ct.parse=function(Z,...pt){const dt=typeof pt[0]==="object"&&pt[0];const ft=pt.length>1||!dt?pt[0]:undefined;const _t=pt.length>1&&pt[1]||dt||{};const mt=JSON.parse(Z,ft);if(_t.protoAction==="ignore"){return mt}if(!mt||typeof mt!=="object"){return mt}if(!Z.match(ut.suspectRx)){return mt}ct.scan(mt,_t);return mt};ct.scan=function(Z,ct={}){let ut=[Z];while(ut.length){const Z=ut;ut=[];for(const pt of Z){if(Object.prototype.hasOwnProperty.call(pt,"__proto__")){if(ct.protoAction!=="remove"){throw new SyntaxError("Object contains forbidden prototype property")}delete pt.__proto__}for(const Z in pt){const ct=pt[Z];if(ct&&typeof ct==="object"){ut.push(pt[Z])}}}}};ct.safeParse=function(Z,ut){try{return ct.parse(Z,ut)}catch(Z){return null}}},35522:(Z,ct,ut)=>{"use strict";const pt=ut(99583);const dt=ut(43700);const ft=ut(66621);const _t=ut(69322);const mt={};Z.exports=function(Z,ct,ut={}){pt(Z&&typeof Z==="object","Invalid defaults value: must be an object");pt(!ct||ct===true||typeof ct==="object","Invalid source value: must be true, falsy or an object");pt(typeof ut==="object","Invalid options: must be an object");if(!ct){return null}if(ut.shallow){return mt.applyToDefaultsWithShallow(Z,ct,ut)}const _t=dt(Z);if(ct===true){return _t}const ht=ut.nullOverride!==undefined?ut.nullOverride:false;return ft(_t,ct,{nullOverride:ht,mergeArrays:false})};mt.applyToDefaultsWithShallow=function(Z,ct,ut){const ht=ut.shallow;pt(Array.isArray(ht),"Invalid keys");const yt=new Map;const vt=ct===true?null:new Set;for(let ut of ht){ut=Array.isArray(ut)?ut:ut.split(".");const pt=_t(Z,ut);if(pt&&typeof pt==="object"){yt.set(pt,vt&&_t(ct,ut)||pt)}else if(vt){vt.add(ut)}}const St=dt(Z,{},yt);if(!vt){return St}for(const Z of vt){mt.reachCopy(St,ct,Z)}const bt=ut.nullOverride!==undefined?ut.nullOverride:false;return ft(St,ct,{nullOverride:bt,mergeArrays:false})};mt.reachCopy=function(Z,ct,ut){for(const Z of ut){if(!(Z in ct)){return}const ut=ct[Z];if(typeof ut!=="object"||ut===null){return}ct=ut}const pt=ct;let dt=Z;for(let Z=0;Z<ut.length-1;++Z){const ct=ut[Z];if(typeof dt[ct]!=="object"){dt[ct]={}}dt=dt[ct]}dt[ut[ut.length-1]]=pt}},99583:(Z,ct,ut)=>{"use strict";const pt=ut(16443);const dt={};Z.exports=function(Z,...ct){if(Z){return}if(ct.length===1&&ct[0]instanceof Error){throw ct[0]}throw new pt(ct)}},43700:(Z,ct,ut)=>{"use strict";const pt=ut(69322);const dt=ut(99704);const ft=ut(87492);const _t={needsProtoHack:new Set([dt.set,dt.map,dt.weakSet,dt.weakMap])};Z.exports=_t.clone=function(Z,ct={},ut=null){if(typeof Z!=="object"||Z===null){return Z}let pt=_t.clone;let mt=ut;if(ct.shallow){if(ct.shallow!==true){return _t.cloneWithShallow(Z,ct)}pt=Z=>Z}else if(mt){const ct=mt.get(Z);if(ct){return ct}}else{mt=new Map}const ht=dt.getInternalProto(Z);if(ht===dt.buffer){return Buffer&&Buffer.from(Z)}if(ht===dt.date){return new Date(Z.getTime())}if(ht===dt.regex){return new RegExp(Z)}const yt=_t.base(Z,ht,ct);if(yt===Z){return Z}if(mt){mt.set(Z,yt)}if(ht===dt.set){for(const ut of Z){yt.add(pt(ut,ct,mt))}}else if(ht===dt.map){for(const[ut,dt]of Z){yt.set(ut,pt(dt,ct,mt))}}const vt=ft.keys(Z,ct);for(const ut of vt){if(ut==="__proto__"){continue}if(ht===dt.array&&ut==="length"){yt.length=Z.length;continue}const ft=Object.getOwnPropertyDescriptor(Z,ut);if(ft){if(ft.get||ft.set){Object.defineProperty(yt,ut,ft)}else if(ft.enumerable){yt[ut]=pt(Z[ut],ct,mt)}else{Object.defineProperty(yt,ut,{enumerable:false,writable:true,configurable:true,value:pt(Z[ut],ct,mt)})}}else{Object.defineProperty(yt,ut,{enumerable:true,writable:true,configurable:true,value:pt(Z[ut],ct,mt)})}}return yt};_t.cloneWithShallow=function(Z,ct){const ut=ct.shallow;ct=Object.assign({},ct);ct.shallow=false;const dt=new Map;for(const ct of ut){const ut=pt(Z,ct);if(typeof ut==="object"||typeof ut==="function"){dt.set(ut,ut)}}return _t.clone(Z,ct,dt)};_t.base=function(Z,ct,ut){if(ut.prototype===false){if(_t.needsProtoHack.has(ct)){return new ct.constructor}return ct===dt.array?[]:{}}const pt=Object.getPrototypeOf(Z);if(pt&&pt.isImmutable){return Z}if(ct===dt.array){const Z=[];if(pt!==ct){Object.setPrototypeOf(Z,pt)}return Z}if(_t.needsProtoHack.has(ct)){const Z=new pt.constructor;if(pt!==ct){Object.setPrototypeOf(Z,pt)}return Z}return Object.create(pt)}},35879:(Z,ct,ut)=>{"use strict";const pt=ut(99704);const dt={mismatched:null};Z.exports=function(Z,ct,ut){ut=Object.assign({prototype:true},ut);return!!dt.isDeepEqual(Z,ct,ut,[])};dt.isDeepEqual=function(Z,ct,ut,ft){if(Z===ct){return Z!==0||1/Z===1/ct}const _t=typeof Z;if(_t!==typeof ct){return false}if(Z===null||ct===null){return false}if(_t==="function"){if(!ut.deepFunction||Z.toString()!==ct.toString()){return false}}else if(_t!=="object"){return Z!==Z&&ct!==ct}const mt=dt.getSharedType(Z,ct,!!ut.prototype);switch(mt){case pt.buffer:return Buffer&&Buffer.prototype.equals.call(Z,ct);case pt.promise:return Z===ct;case pt.regex:return Z.toString()===ct.toString();case dt.mismatched:return false}for(let ut=ft.length-1;ut>=0;--ut){if(ft[ut].isSame(Z,ct)){return true}}ft.push(new dt.SeenEntry(Z,ct));try{return!!dt.isDeepEqualObj(mt,Z,ct,ut,ft)}finally{ft.pop()}};dt.getSharedType=function(Z,ct,ut){if(ut){if(Object.getPrototypeOf(Z)!==Object.getPrototypeOf(ct)){return dt.mismatched}return pt.getInternalProto(Z)}const ft=pt.getInternalProto(Z);if(ft!==pt.getInternalProto(ct)){return dt.mismatched}return ft};dt.valueOf=function(Z){const ct=Z.valueOf;if(ct===undefined){return Z}try{return ct.call(Z)}catch(Z){return Z}};dt.hasOwnEnumerableProperty=function(Z,ct){return Object.prototype.propertyIsEnumerable.call(Z,ct)};dt.isSetSimpleEqual=function(Z,ct){for(const ut of Set.prototype.values.call(Z)){if(!Set.prototype.has.call(ct,ut)){return false}}return true};dt.isDeepEqualObj=function(Z,ct,ut,ft,_t){const{isDeepEqual:mt,valueOf:ht,hasOwnEnumerableProperty:yt}=dt;const{keys:vt,getOwnPropertySymbols:St}=Object;if(Z===pt.array){if(ft.part){for(const Z of ct){for(const ct of ut){if(mt(Z,ct,ft,_t)){return true}}}}else{if(ct.length!==ut.length){return false}for(let Z=0;Z<ct.length;++Z){if(!mt(ct[Z],ut[Z],ft,_t)){return false}}return true}}else if(Z===pt.set){if(ct.size!==ut.size){return false}if(!dt.isSetSimpleEqual(ct,ut)){const Z=new Set(Set.prototype.values.call(ut));for(const ut of Set.prototype.values.call(ct)){if(Z.delete(ut)){continue}let ct=false;for(const pt of Z){if(mt(ut,pt,ft,_t)){Z.delete(pt);ct=true;break}}if(!ct){return false}}}}else if(Z===pt.map){if(ct.size!==ut.size){return false}for(const[Z,pt]of Map.prototype.entries.call(ct)){if(pt===undefined&&!Map.prototype.has.call(ut,Z)){return false}if(!mt(pt,Map.prototype.get.call(ut,Z),ft,_t)){return false}}}else if(Z===pt.error){if(ct.name!==ut.name||ct.message!==ut.message){return false}}const bt=ht(ct);const xt=ht(ut);if((ct!==bt||ut!==xt)&&!mt(bt,xt,ft,_t)){return false}const $t=vt(ct);if(!ft.part&&$t.length!==vt(ut).length&&!ft.skip){return false}let Et=0;for(const Z of $t){if(ft.skip&&ft.skip.includes(Z)){if(ut[Z]===undefined){++Et}continue}if(!yt(ut,Z)){return false}if(!mt(ct[Z],ut[Z],ft,_t)){return false}}if(!ft.part&&$t.length-Et!==vt(ut).length){return false}if(ft.symbols!==false){const Z=St(ct);const pt=new Set(St(ut));for(const dt of Z){if(!ft.skip||!ft.skip.includes(dt)){if(yt(ct,dt)){if(!yt(ut,dt)){return false}if(!mt(ct[dt],ut[dt],ft,_t)){return false}}else if(yt(ut,dt)){return false}}pt.delete(dt)}for(const Z of pt){if(yt(ut,Z)){return false}}}return true};dt.SeenEntry=class{constructor(Z,ct){this.obj=Z;this.ref=ct}isSame(Z,ct){return this.obj===Z&&this.ref===ct}}},16443:(Z,ct,ut)=>{"use strict";const pt=ut(72912);const dt={};Z.exports=class extends Error{constructor(Z){const ut=Z.filter((Z=>Z!=="")).map((Z=>typeof Z==="string"?Z:Z instanceof Error?Z.message:pt(Z)));super(ut.join(" ")||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,ct.assert)}}}},57391:Z=>{"use strict";const ct={};Z.exports=function(Z){if(!Z){return""}let ut="";for(let pt=0;pt<Z.length;++pt){const dt=Z.charCodeAt(pt);if(ct.isSafe(dt)){ut+=Z[pt]}else{ut+=ct.escapeHtmlChar(dt)}}return ut};ct.escapeHtmlChar=function(Z){const ut=ct.namedHtml.get(Z);if(ut){return ut}if(Z>=256){return"&#"+Z+";"}const pt=Z.toString(16).padStart(2,"0");return`&#x${pt};`};ct.isSafe=function(Z){return ct.safeCharCodes.has(Z)};ct.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]);ct.safeCharCodes=function(){const Z=new Set;for(let ct=32;ct<123;++ct){if(ct>=97||ct>=65&&ct<=90||ct>=48&&ct<=57||ct===32||ct===46||ct===44||ct===45||ct===58||ct===95){Z.add(ct)}}return Z}()},43935:Z=>{"use strict";const ct={};Z.exports=function(Z){return Z.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},85363:Z=>{"use strict";const ct={};Z.exports=function(){}},66621:(Z,ct,ut)=>{"use strict";const pt=ut(99583);const dt=ut(43700);const ft=ut(87492);const _t={};Z.exports=_t.merge=function(Z,ct,ut){pt(Z&&typeof Z==="object","Invalid target value: must be an object");pt(ct===null||ct===undefined||typeof ct==="object","Invalid source value: must be null, undefined, or an object");if(!ct){return Z}ut=Object.assign({nullOverride:true,mergeArrays:true},ut);if(Array.isArray(ct)){pt(Array.isArray(Z),"Cannot merge array onto an object");if(!ut.mergeArrays){Z.length=0}for(let pt=0;pt<ct.length;++pt){Z.push(dt(ct[pt],{symbols:ut.symbols}))}return Z}const mt=ft.keys(ct,ut);for(let pt=0;pt<mt.length;++pt){const ft=mt[pt];if(ft==="__proto__"||!Object.prototype.propertyIsEnumerable.call(ct,ft)){continue}const ht=ct[ft];if(ht&&typeof ht==="object"){if(Z[ft]===ht){continue}if(!Z[ft]||typeof Z[ft]!=="object"||Array.isArray(Z[ft])!==Array.isArray(ht)||ht instanceof Date||Buffer&&Buffer.isBuffer(ht)||ht instanceof RegExp){Z[ft]=dt(ht,{symbols:ut.symbols})}else{_t.merge(Z[ft],ht,ut)}}else{if(ht!==null&&ht!==undefined){Z[ft]=ht}else if(ut.nullOverride){Z[ft]=ht}}}return Z}},69322:(Z,ct,ut)=>{"use strict";const pt=ut(99583);const dt={};Z.exports=function(Z,ct,ut){if(ct===false||ct===null||ct===undefined){return Z}ut=ut||{};if(typeof ut==="string"){ut={separator:ut}}const ft=Array.isArray(ct);pt(!ft||!ut.separator,"Separator option is not valid for array-based chain");const _t=ft?ct:ct.split(ut.separator||".");let mt=Z;for(let Z=0;Z<_t.length;++Z){let ft=_t[Z];const ht=ut.iterables&&dt.iterables(mt);if(Array.isArray(mt)||ht==="set"){const Z=Number(ft);if(Number.isInteger(Z)){ft=Z<0?mt.length+Z:Z}}if(!mt||typeof mt==="function"&&ut.functions===false||!ht&&mt[ft]===undefined){pt(!ut.strict||Z+1===_t.length,"Missing segment",ft,"in reach path ",ct);pt(typeof mt==="object"||ut.functions===true||typeof mt!=="function","Invalid segment",ft,"in reach path ",ct);mt=ut.default;break}if(!ht){mt=mt[ft]}else if(ht==="set"){mt=[...mt][ft]}else{mt=mt.get(ft)}}return mt};dt.iterables=function(Z){if(Z instanceof Set){return"set"}if(Z instanceof Map){return"map"}}},72912:Z=>{"use strict";const ct={};Z.exports=function(...Z){try{return JSON.stringify(...Z)}catch(Z){return"[Cannot display object: "+Z.message+"]"}}},99704:(Z,ct)=>{"use strict";const ut={};ct=Z.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};ut.typeMap=new Map([["[object Error]",ct.error],["[object Map]",ct.map],["[object Promise]",ct.promise],["[object Set]",ct.set],["[object WeakMap]",ct.weakMap],["[object WeakSet]",ct.weakSet]]);ct.getInternalProto=function(Z){if(Array.isArray(Z)){return ct.array}if(Buffer&&Z instanceof Buffer){return ct.buffer}if(Z instanceof Date){return ct.date}if(Z instanceof RegExp){return ct.regex}if(Z instanceof Error){return ct.error}const pt=Object.prototype.toString.call(Z);return ut.typeMap.get(pt)||ct.generic}},87492:(Z,ct)=>{"use strict";const ut={};ct.keys=function(Z,ct={}){return ct.symbols!==false?Reflect.ownKeys(Z):Object.getOwnPropertyNames(Z)}},75663:(Z,ct,ut)=>{"use strict";const pt=ut(99583);const dt={};ct.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(Z,ct){ct=ct||{};const ut=[].concat(ct.before||[]);const dt=[].concat(ct.after||[]);const ft=ct.group||"?";const _t=ct.sort||0;pt(!ut.includes(ft),`Item cannot come before itself: ${ft}`);pt(!ut.includes("?"),"Item cannot come before unassociated items");pt(!dt.includes(ft),`Item cannot come after itself: ${ft}`);pt(!dt.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(Z)){Z=[Z]}for(const ct of Z){const Z={seq:this._items.length,sort:_t,before:ut,after:dt,group:ft,node:ct};this._items.push(Z)}if(!ct.manual){const Z=this._sort();pt(Z,"item",ft!=="?"?`added into group ${ft}`:"","created a dependencies error")}return this.nodes}merge(Z){if(!Array.isArray(Z)){Z=[Z]}for(const ct of Z){if(ct){for(const Z of ct._items){this._items.push(Object.assign({},Z))}}}this._items.sort(dt.mergeSort);for(let Z=0;Z<this._items.length;++Z){this._items[Z].seq=Z}const ct=this._sort();pt(ct,"merge created a dependencies error");return this.nodes}sort(){const Z=this._sort();pt(Z,"sort created a dependencies error");return this.nodes}_sort(){const Z={};const ct=Object.create(null);const ut=Object.create(null);for(const pt of this._items){const dt=pt.seq;const ft=pt.group;ut[ft]=ut[ft]||[];ut[ft].push(dt);Z[dt]=pt.before;for(const Z of pt.after){ct[Z]=ct[Z]||[];ct[Z].push(dt)}}for(const ct in Z){const pt=[];for(const dt in Z[ct]){const ft=Z[ct][dt];ut[ft]=ut[ft]||[];pt.push(...ut[ft])}Z[ct]=pt}for(const pt in ct){if(ut[pt]){for(const dt of ut[pt]){Z[dt].push(...ct[pt])}}}const pt={};for(const ct in Z){const ut=Z[ct];for(const Z of ut){pt[Z]=pt[Z]||[];pt[Z].push(ct)}}const dt={};const ft=[];for(let Z=0;Z<this._items.length;++Z){let ct=Z;if(pt[Z]){ct=null;for(let Z=0;Z<this._items.length;++Z){if(dt[Z]===true){continue}if(!pt[Z]){pt[Z]=[]}const ut=pt[Z].length;let ft=0;for(let ct=0;ct<ut;++ct){if(dt[pt[Z][ct]]){++ft}}if(ft===ut){ct=Z;break}}}if(ct!==null){dt[ct]=true;ft.push(ct)}}if(ft.length!==this._items.length){return false}const _t={};for(const Z of this._items){_t[Z.seq]=Z}this._items=[];this.nodes=[];for(const Z of ft){const ct=_t[Z];this.nodes.push(ct.node);this._items.push(ct)}return true}};dt.mergeSort=(Z,ct)=>Z.sort===ct.sort?0:Z.sort<ct.sort?-1:1},46284:function(Z,ct,ut){Z=ut.nmd(Z);(function(ct,pt){if(true){pt(Z,ut(35073),ut(17239));Z.exports=def(Z)}else{}function def(Z){return"default"in Z.exports?Z.exports.default:Z.exports}})(this,(function(Z,ct,ut){"use strict";var pt=Object.create;var dt=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var mt=Object.getPrototypeOf;var ht=Object.prototype.hasOwnProperty;var __commonJS=(Z,ct)=>function __require(){return ct||(0,Z[_t(Z)[0]])((ct={exports:{}}).exports,ct),ct.exports};var __export=(Z,ct)=>{for(var ut in ct)dt(Z,ut,{get:ct[ut],enumerable:true})};var __copyProps=(Z,ct,ut,pt)=>{if(ct&&typeof ct==="object"||typeof ct==="function"){for(let mt of _t(ct))if(!ht.call(Z,mt)&&mt!==ut)dt(Z,mt,{get:()=>ct[mt],enumerable:!(pt=ft(ct,mt))||pt.enumerable})}return Z};var __toESM=(Z,ct,ut)=>(ut=Z!=null?pt(mt(Z)):{},__copyProps(ct||!Z||!Z.__esModule?dt(ut,"default",{value:Z,enumerable:true}):ut,Z));var __toCommonJS=Z=>__copyProps(dt({},"__esModule",{value:true}),Z);var yt=__commonJS({"umd:@jridgewell/sourcemap-codec"(Z,ut){ut.exports=ct}});var vt=__commonJS({"umd:@jridgewell/trace-mapping"(Z,ct){ct.exports=ut}});var St={};__export(St,{GenMapping:()=>It,addMapping:()=>addMapping,addSegment:()=>addSegment,allMappings:()=>allMappings,fromMap:()=>fromMap,maybeAddMapping:()=>maybeAddMapping,maybeAddSegment:()=>maybeAddSegment,setIgnore:()=>setIgnore,setSourceContent:()=>setSourceContent,toDecodedMap:()=>toDecodedMap,toEncodedMap:()=>toEncodedMap});Z.exports=__toCommonJS(St);var bt=class{constructor(){this._indexes={__proto__:null};this.array=[]}};function cast(Z){return Z}function get(Z,ct){return cast(Z)._indexes[ct]}function put(Z,ct){const ut=get(Z,ct);if(ut!==void 0)return ut;const{array:pt,_indexes:dt}=cast(Z);const ft=pt.push(ct);return dt[ct]=ft-1}function remove(Z,ct){const ut=get(Z,ct);if(ut===void 0)return;const{array:pt,_indexes:dt}=cast(Z);for(let Z=ut+1;Z<pt.length;Z++){const ct=pt[Z];pt[Z-1]=ct;dt[ct]--}dt[ct]=void 0;pt.pop()}var xt=__toESM(yt());var $t=__toESM(vt());var Et=0;var Ct=1;var Tt=2;var wt=3;var At=4;var kt=-1;var It=class{constructor({file:Z,sourceRoot:ct}={}){this._names=new bt;this._sources=new bt;this._sourcesContent=[];this._mappings=[];this.file=Z;this.sourceRoot=ct;this._ignoreList=new bt}};function cast2(Z){return Z}function addSegment(Z,ct,ut,pt,dt,ft,_t,mt){return addSegmentInternal(false,Z,ct,ut,pt,dt,ft,_t,mt)}function addMapping(Z,ct){return addMappingInternal(false,Z,ct)}var maybeAddSegment=(Z,ct,ut,pt,dt,ft,_t,mt)=>addSegmentInternal(true,Z,ct,ut,pt,dt,ft,_t,mt);var maybeAddMapping=(Z,ct)=>addMappingInternal(true,Z,ct);function setSourceContent(Z,ct,ut){const{_sources:pt,_sourcesContent:dt}=cast2(Z);const ft=put(pt,ct);dt[ft]=ut}function setIgnore(Z,ct,ut=true){const{_sources:pt,_sourcesContent:dt,_ignoreList:ft}=cast2(Z);const _t=put(pt,ct);if(_t===dt.length)dt[_t]=null;if(ut)put(ft,_t);else remove(ft,_t)}function toDecodedMap(Z){const{_mappings:ct,_sources:ut,_sourcesContent:pt,_names:dt,_ignoreList:ft}=cast2(Z);removeEmptyFinalLines(ct);return{version:3,file:Z.file||void 0,names:dt.array,sourceRoot:Z.sourceRoot||void 0,sources:ut.array,sourcesContent:pt,mappings:ct,ignoreList:ft.array}}function toEncodedMap(Z){const ct=toDecodedMap(Z);return Object.assign({},ct,{mappings:(0,xt.encode)(ct.mappings)})}function fromMap(Z){const ct=new $t.TraceMap(Z);const ut=new It({file:ct.file,sourceRoot:ct.sourceRoot});putAll(cast2(ut)._names,ct.names);putAll(cast2(ut)._sources,ct.sources);cast2(ut)._sourcesContent=ct.sourcesContent||ct.sources.map((()=>null));cast2(ut)._mappings=(0,$t.decodedMappings)(ct);if(ct.ignoreList)putAll(cast2(ut)._ignoreList,ct.ignoreList);return ut}function allMappings(Z){const ct=[];const{_mappings:ut,_sources:pt,_names:dt}=cast2(Z);for(let Z=0;Z<ut.length;Z++){const ft=ut[Z];for(let ut=0;ut<ft.length;ut++){const _t=ft[ut];const mt={line:Z+1,column:_t[Et]};let ht=void 0;let yt=void 0;let vt=void 0;if(_t.length!==1){ht=pt.array[_t[Ct]];yt={line:_t[Tt]+1,column:_t[wt]};if(_t.length===5)vt=dt.array[_t[At]]}ct.push({generated:mt,source:ht,original:yt,name:vt})}}return ct}function addSegmentInternal(Z,ct,ut,pt,dt,ft,_t,mt,ht){const{_mappings:yt,_sources:vt,_sourcesContent:St,_names:bt}=cast2(ct);const xt=getIndex(yt,ut);const $t=getColumnIndex(xt,pt);if(!dt){if(Z&&skipSourceless(xt,$t))return;return insert(xt,$t,[pt])}assert(ft);assert(_t);const Et=put(vt,dt);const Ct=mt?put(bt,mt):kt;if(Et===St.length)St[Et]=ht!=null?ht:null;if(Z&&skipSource(xt,$t,Et,ft,_t,Ct)){return}return insert(xt,$t,mt?[pt,Et,ft,_t,Ct]:[pt,Et,ft,_t])}function assert(Z){}function getIndex(Z,ct){for(let ut=Z.length;ut<=ct;ut++){Z[ut]=[]}return Z[ct]}function getColumnIndex(Z,ct){let ut=Z.length;for(let pt=ut-1;pt>=0;ut=pt--){const ut=Z[pt];if(ct>=ut[Et])break}return ut}function insert(Z,ct,ut){for(let ut=Z.length;ut>ct;ut--){Z[ut]=Z[ut-1]}Z[ct]=ut}function removeEmptyFinalLines(Z){const{length:ct}=Z;let ut=ct;for(let ct=ut-1;ct>=0;ut=ct,ct--){if(Z[ct].length>0)break}if(ut<ct)Z.length=ut}function putAll(Z,ct){for(let ut=0;ut<ct.length;ut++)put(Z,ct[ut])}function skipSourceless(Z,ct){if(ct===0)return true;const ut=Z[ct-1];return ut.length===1}function skipSource(Z,ct,ut,pt,dt,ft){if(ct===0)return false;const _t=Z[ct-1];if(_t.length===1)return false;return ut===_t[Ct]&&pt===_t[Tt]&&dt===_t[wt]&&ft===(_t.length===5?_t[At]:kt)}function addMappingInternal(Z,ct,ut){const{generated:pt,source:dt,original:ft,name:_t,content:mt}=ut;if(!dt){return addSegmentInternal(Z,ct,pt.line-1,pt.column,null,null,null,null,null)}assert(ft);return addSegmentInternal(Z,ct,pt.line-1,pt.column,dt,ft.line-1,ft.column,_t,mt)}}))},6001:function(Z){(function(ct,ut){true?Z.exports=ut():0})(this,(function(){"use strict";const Z=/^[\w+.-]+:\/\//;const ct=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;const ut=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function isAbsoluteUrl(ct){return Z.test(ct)}function isSchemeRelativeUrl(Z){return Z.startsWith("//")}function isAbsolutePath(Z){return Z.startsWith("/")}function isFileUrl(Z){return Z.startsWith("file:")}function isRelative(Z){return/^[.?#]/.test(Z)}function parseAbsoluteUrl(Z){const ut=ct.exec(Z);return makeUrl(ut[1],ut[2]||"",ut[3],ut[4]||"",ut[5]||"/",ut[6]||"",ut[7]||"")}function parseFileUrl(Z){const ct=ut.exec(Z);const pt=ct[2];return makeUrl("file:","",ct[1]||"","",isAbsolutePath(pt)?pt:"/"+pt,ct[3]||"",ct[4]||"")}function makeUrl(Z,ct,ut,pt,dt,ft,_t){return{scheme:Z,user:ct,host:ut,port:pt,path:dt,query:ft,hash:_t,type:7}}function parseUrl(Z){if(isSchemeRelativeUrl(Z)){const ct=parseAbsoluteUrl("http:"+Z);ct.scheme="";ct.type=6;return ct}if(isAbsolutePath(Z)){const ct=parseAbsoluteUrl("http://foo.com"+Z);ct.scheme="";ct.host="";ct.type=5;return ct}if(isFileUrl(Z))return parseFileUrl(Z);if(isAbsoluteUrl(Z))return parseAbsoluteUrl(Z);const ct=parseAbsoluteUrl("http://foo.com/"+Z);ct.scheme="";ct.host="";ct.type=Z?Z.startsWith("?")?3:Z.startsWith("#")?2:4:1;return ct}function stripPathFilename(Z){if(Z.endsWith("/.."))return Z;const ct=Z.lastIndexOf("/");return Z.slice(0,ct+1)}function mergePaths(Z,ct){normalizePath(ct,ct.type);if(Z.path==="/"){Z.path=ct.path}else{Z.path=stripPathFilename(ct.path)+Z.path}}function normalizePath(Z,ct){const ut=ct<=4;const pt=Z.path.split("/");let dt=1;let ft=0;let _t=false;for(let Z=1;Z<pt.length;Z++){const ct=pt[Z];if(!ct){_t=true;continue}_t=false;if(ct===".")continue;if(ct===".."){if(ft){_t=true;ft--;dt--}else if(ut){pt[dt++]=ct}continue}pt[dt++]=ct;ft++}let mt="";for(let Z=1;Z<dt;Z++){mt+="/"+pt[Z]}if(!mt||_t&&!mt.endsWith("/..")){mt+="/"}Z.path=mt}function resolve(Z,ct){if(!Z&&!ct)return"";const ut=parseUrl(Z);let pt=ut.type;if(ct&&pt!==7){const Z=parseUrl(ct);const dt=Z.type;switch(pt){case 1:ut.hash=Z.hash;case 2:ut.query=Z.query;case 3:case 4:mergePaths(ut,Z);case 5:ut.user=Z.user;ut.host=Z.host;ut.port=Z.port;case 6:ut.scheme=Z.scheme}if(dt>pt)pt=dt}normalizePath(ut,pt);const dt=ut.query+ut.hash;switch(pt){case 2:case 3:return dt;case 4:{const pt=ut.path.slice(1);if(!pt)return dt||".";if(isRelative(ct||Z)&&!isRelative(pt)){return"./"+pt+dt}return pt+dt}case 5:return ut.path+dt;default:return ut.scheme+"//"+ut.user+ut.host+ut.port+ut.path+dt}}return resolve}))},35073:function(Z,ct,ut){Z=ut.nmd(Z);(function(ct,ut){if(true){ut(Z);Z.exports=def(Z)}else{}function def(Z){return"default"in Z.exports?Z.exports.default:Z.exports}})(this,(function(Z){"use strict";var ct=Object.defineProperty;var ut=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var dt=Object.prototype.hasOwnProperty;var __export=(Z,ut)=>{for(var pt in ut)ct(Z,pt,{get:ut[pt],enumerable:true})};var __copyProps=(Z,ft,_t,mt)=>{if(ft&&typeof ft==="object"||typeof ft==="function"){for(let ht of pt(ft))if(!dt.call(Z,ht)&&ht!==_t)ct(Z,ht,{get:()=>ft[ht],enumerable:!(mt=ut(ft,ht))||mt.enumerable})}return Z};var __toCommonJS=Z=>__copyProps(ct({},"__esModule",{value:true}),Z);var ft={};__export(ft,{decode:()=>decode,decodeGeneratedRanges:()=>decodeGeneratedRanges,decodeOriginalScopes:()=>decodeOriginalScopes,encode:()=>encode,encodeGeneratedRanges:()=>encodeGeneratedRanges,encodeOriginalScopes:()=>encodeOriginalScopes});Z.exports=__toCommonJS(ft);var _t=",".charCodeAt(0);var mt=";".charCodeAt(0);var ht="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var yt=new Uint8Array(64);var vt=new Uint8Array(128);for(let Z=0;Z<ht.length;Z++){const ct=ht.charCodeAt(Z);yt[Z]=ct;vt[ct]=Z}function decodeInteger(Z,ct){let ut=0;let pt=0;let dt=0;do{const ct=Z.next();dt=vt[ct];ut|=(dt&31)<<pt;pt+=5}while(dt&32);const ft=ut&1;ut>>>=1;if(ft){ut=-2147483648|-ut}return ct+ut}function encodeInteger(Z,ct,ut){let pt=ct-ut;pt=pt<0?-pt<<1|1:pt<<1;do{let ct=pt&31;pt>>>=5;if(pt>0)ct|=32;Z.write(yt[ct])}while(pt>0);return ct}function hasMoreVlq(Z,ct){if(Z.pos>=ct)return false;return Z.peek()!==_t}var St=1024*16;var bt=typeof TextDecoder!=="undefined"?new TextDecoder:typeof Buffer!=="undefined"?{decode(Z){const ct=Buffer.from(Z.buffer,Z.byteOffset,Z.byteLength);return ct.toString()}}:{decode(Z){let ct="";for(let ut=0;ut<Z.length;ut++){ct+=String.fromCharCode(Z[ut])}return ct}};var xt=class{constructor(){this.pos=0;this.out="";this.buffer=new Uint8Array(St)}write(Z){const{buffer:ct}=this;ct[this.pos++]=Z;if(this.pos===St){this.out+=bt.decode(ct);this.pos=0}}flush(){const{buffer:Z,out:ct,pos:ut}=this;return ut>0?ct+bt.decode(Z.subarray(0,ut)):ct}};var $t=class{constructor(Z){this.pos=0;this.buffer=Z}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(Z){const{buffer:ct,pos:ut}=this;const pt=ct.indexOf(Z,ut);return pt===-1?ct.length:pt}};var Et=[];function decodeOriginalScopes(Z){const{length:ct}=Z;const ut=new $t(Z);const pt=[];const dt=[];let ft=0;for(;ut.pos<ct;ut.pos++){ft=decodeInteger(ut,ft);const Z=decodeInteger(ut,0);if(!hasMoreVlq(ut,ct)){const ct=dt.pop();ct[2]=ft;ct[3]=Z;continue}const _t=decodeInteger(ut,0);const mt=decodeInteger(ut,0);const ht=mt&1;const yt=ht?[ft,Z,0,0,_t,decodeInteger(ut,0)]:[ft,Z,0,0,_t];let vt=Et;if(hasMoreVlq(ut,ct)){vt=[];do{const Z=decodeInteger(ut,0);vt.push(Z)}while(hasMoreVlq(ut,ct))}yt.vars=vt;pt.push(yt);dt.push(yt)}return pt}function encodeOriginalScopes(Z){const ct=new xt;for(let ut=0;ut<Z.length;){ut=_encodeOriginalScopes(Z,ut,ct,[0])}return ct.flush()}function _encodeOriginalScopes(Z,ct,ut,pt){const dt=Z[ct];const{0:ft,1:mt,2:ht,3:yt,4:vt,vars:St}=dt;if(ct>0)ut.write(_t);pt[0]=encodeInteger(ut,ft,pt[0]);encodeInteger(ut,mt,0);encodeInteger(ut,vt,0);const bt=dt.length===6?1:0;encodeInteger(ut,bt,0);if(dt.length===6)encodeInteger(ut,dt[5],0);for(const Z of St){encodeInteger(ut,Z,0)}for(ct++;ct<Z.length;){const dt=Z[ct];const{0:ft,1:_t}=dt;if(ft>ht||ft===ht&&_t>=yt){break}ct=_encodeOriginalScopes(Z,ct,ut,pt)}ut.write(_t);pt[0]=encodeInteger(ut,ht,pt[0]);encodeInteger(ut,yt,0);return ct}function decodeGeneratedRanges(Z){const{length:ct}=Z;const ut=new $t(Z);const pt=[];const dt=[];let ft=0;let _t=0;let mt=0;let ht=0;let yt=0;let vt=0;let St=0;let bt=0;do{const Z=ut.indexOf(";");let ct=0;for(;ut.pos<Z;ut.pos++){ct=decodeInteger(ut,ct);if(!hasMoreVlq(ut,Z)){const Z=dt.pop();Z[2]=ft;Z[3]=ct;continue}const xt=decodeInteger(ut,0);const $t=xt&1;const Ct=xt&2;const Tt=xt&4;let wt=null;let At=Et;let kt;if($t){const Z=decodeInteger(ut,_t);mt=decodeInteger(ut,_t===Z?mt:0);_t=Z;kt=[ft,ct,0,0,Z,mt]}else{kt=[ft,ct,0,0]}kt.isScope=!!Tt;if(Ct){const Z=ht;const ct=yt;ht=decodeInteger(ut,ht);const pt=Z===ht;yt=decodeInteger(ut,pt?yt:0);vt=decodeInteger(ut,pt&&ct===yt?vt:0);wt=[ht,yt,vt]}kt.callsite=wt;if(hasMoreVlq(ut,Z)){At=[];do{St=ft;bt=ct;const Z=decodeInteger(ut,0);let pt;if(Z<-1){pt=[[decodeInteger(ut,0)]];for(let ct=-1;ct>Z;ct--){const Z=St;St=decodeInteger(ut,St);bt=decodeInteger(ut,St===Z?bt:0);const ct=decodeInteger(ut,0);pt.push([ct,St,bt])}}else{pt=[[Z]]}At.push(pt)}while(hasMoreVlq(ut,Z))}kt.bindings=At;pt.push(kt);dt.push(kt)}ft++;ut.pos=Z+1}while(ut.pos<ct);return pt}function encodeGeneratedRanges(Z){if(Z.length===0)return"";const ct=new xt;for(let ut=0;ut<Z.length;){ut=_encodeGeneratedRanges(Z,ut,ct,[0,0,0,0,0,0,0])}return ct.flush()}function _encodeGeneratedRanges(Z,ct,ut,pt){const dt=Z[ct];const{0:ft,1:mt,2:ht,3:yt,isScope:vt,callsite:St,bindings:bt}=dt;if(pt[0]<ft){catchupLine(ut,pt[0],ft);pt[0]=ft;pt[1]=0}else if(ct>0){ut.write(_t)}pt[1]=encodeInteger(ut,dt[1],pt[1]);const xt=(dt.length===6?1:0)|(St?2:0)|(vt?4:0);encodeInteger(ut,xt,0);if(dt.length===6){const{4:Z,5:ct}=dt;if(Z!==pt[2]){pt[3]=0}pt[2]=encodeInteger(ut,Z,pt[2]);pt[3]=encodeInteger(ut,ct,pt[3])}if(St){const{0:Z,1:ct,2:ft}=dt.callsite;if(Z!==pt[4]){pt[5]=0;pt[6]=0}else if(ct!==pt[5]){pt[6]=0}pt[4]=encodeInteger(ut,Z,pt[4]);pt[5]=encodeInteger(ut,ct,pt[5]);pt[6]=encodeInteger(ut,ft,pt[6])}if(bt){for(const Z of bt){if(Z.length>1)encodeInteger(ut,-Z.length,0);const ct=Z[0][0];encodeInteger(ut,ct,0);let pt=ft;let dt=mt;for(let ct=1;ct<Z.length;ct++){const ft=Z[ct];pt=encodeInteger(ut,ft[1],pt);dt=encodeInteger(ut,ft[2],dt);encodeInteger(ut,ft[0],0)}}}for(ct++;ct<Z.length;){const dt=Z[ct];const{0:ft,1:_t}=dt;if(ft>ht||ft===ht&&_t>=yt){break}ct=_encodeGeneratedRanges(Z,ct,ut,pt)}if(pt[0]<ht){catchupLine(ut,pt[0],ht);pt[0]=ht;pt[1]=0}else{ut.write(_t)}pt[1]=encodeInteger(ut,yt,pt[1]);return ct}function catchupLine(Z,ct,ut){do{Z.write(mt)}while(++ct<ut)}function decode(Z){const{length:ct}=Z;const ut=new $t(Z);const pt=[];let dt=0;let ft=0;let _t=0;let mt=0;let ht=0;do{const Z=ut.indexOf(";");const ct=[];let yt=true;let vt=0;dt=0;while(ut.pos<Z){let pt;dt=decodeInteger(ut,dt);if(dt<vt)yt=false;vt=dt;if(hasMoreVlq(ut,Z)){ft=decodeInteger(ut,ft);_t=decodeInteger(ut,_t);mt=decodeInteger(ut,mt);if(hasMoreVlq(ut,Z)){ht=decodeInteger(ut,ht);pt=[dt,ft,_t,mt,ht]}else{pt=[dt,ft,_t,mt]}}else{pt=[dt]}ct.push(pt);ut.pos++}if(!yt)sort(ct);pt.push(ct);ut.pos=Z+1}while(ut.pos<=ct);return pt}function sort(Z){Z.sort(sortComparator)}function sortComparator(Z,ct){return Z[0]-ct[0]}function encode(Z){const ct=new xt;let ut=0;let pt=0;let dt=0;let ft=0;for(let ht=0;ht<Z.length;ht++){const yt=Z[ht];if(ht>0)ct.write(mt);if(yt.length===0)continue;let vt=0;for(let Z=0;Z<yt.length;Z++){const mt=yt[Z];if(Z>0)ct.write(_t);vt=encodeInteger(ct,mt[0],vt);if(mt.length===1)continue;ut=encodeInteger(ct,mt[1],ut);pt=encodeInteger(ct,mt[2],pt);dt=encodeInteger(ct,mt[3],dt);if(mt.length===4)continue;ft=encodeInteger(ct,mt[4],ft)}}return ct.flush()}}))},17239:function(Z,ct,ut){Z=ut.nmd(Z);(function(ct,pt){if(true){pt(Z,ut(6001),ut(35073));Z.exports=def(Z)}else{}function def(Z){return"default"in Z.exports?Z.exports.default:Z.exports}})(this,(function(Z,ct,ut){"use strict";var pt=Object.create;var dt=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var mt=Object.getPrototypeOf;var ht=Object.prototype.hasOwnProperty;var __commonJS=(Z,ct)=>function __require(){return ct||(0,Z[_t(Z)[0]])((ct={exports:{}}).exports,ct),ct.exports};var __export=(Z,ct)=>{for(var ut in ct)dt(Z,ut,{get:ct[ut],enumerable:true})};var __copyProps=(Z,ct,ut,pt)=>{if(ct&&typeof ct==="object"||typeof ct==="function"){for(let mt of _t(ct))if(!ht.call(Z,mt)&&mt!==ut)dt(Z,mt,{get:()=>ct[mt],enumerable:!(pt=ft(ct,mt))||pt.enumerable})}return Z};var __toESM=(Z,ct,ut)=>(ut=Z!=null?pt(mt(Z)):{},__copyProps(ct||!Z||!Z.__esModule?dt(ut,"default",{value:Z,enumerable:true}):ut,Z));var __toCommonJS=Z=>__copyProps(dt({},"__esModule",{value:true}),Z);var yt=__commonJS({"umd:@jridgewell/sourcemap-codec"(Z,ct){ct.exports=ut}});var vt=__commonJS({"umd:@jridgewell/resolve-uri"(Z,ut){ut.exports=ct}});var St={};__export(St,{AnyMap:()=>FlattenMap,FlattenMap:()=>FlattenMap,GREATEST_LOWER_BOUND:()=>Dt,LEAST_UPPER_BOUND:()=>Ot,TraceMap:()=>Ft,allGeneratedPositionsFor:()=>allGeneratedPositionsFor,decodedMap:()=>decodedMap,decodedMappings:()=>decodedMappings,eachMapping:()=>eachMapping,encodedMap:()=>encodedMap,encodedMappings:()=>encodedMappings,generatedPositionFor:()=>generatedPositionFor,isIgnored:()=>isIgnored,originalPositionFor:()=>originalPositionFor,presortedDecodedMap:()=>presortedDecodedMap,sourceContentFor:()=>sourceContentFor,traceSegment:()=>traceSegment});Z.exports=__toCommonJS(St);var bt=__toESM(yt());var xt=__toESM(vt());function stripFilename(Z){if(!Z)return"";const ct=Z.lastIndexOf("/");return Z.slice(0,ct+1)}function resolver(Z,ct){const ut=stripFilename(Z);const pt=ct?ct+"/":"";return Z=>(0,xt.default)(pt+(Z||""),ut)}var $t=0;var Et=1;var Ct=2;var Tt=3;var wt=4;var At=1;var kt=2;function maybeSort(Z,ct){const ut=nextUnsortedSegmentLine(Z,0);if(ut===Z.length)return Z;if(!ct)Z=Z.slice();for(let pt=ut;pt<Z.length;pt=nextUnsortedSegmentLine(Z,pt+1)){Z[pt]=sortSegments(Z[pt],ct)}return Z}function nextUnsortedSegmentLine(Z,ct){for(let ut=ct;ut<Z.length;ut++){if(!isSorted(Z[ut]))return ut}return Z.length}function isSorted(Z){for(let ct=1;ct<Z.length;ct++){if(Z[ct][$t]<Z[ct-1][$t]){return false}}return true}function sortSegments(Z,ct){if(!ct)Z=Z.slice();return Z.sort(sortComparator)}function sortComparator(Z,ct){return Z[$t]-ct[$t]}function buildBySources(Z,ct){const ut=ct.map((()=>[]));for(let ct=0;ct<Z.length;ct++){const pt=Z[ct];for(let Z=0;Z<pt.length;Z++){const dt=pt[Z];if(dt.length===1)continue;const ft=dt[Et];const _t=dt[Ct];const mt=dt[Tt];const ht=ut[ft];const yt=ht[_t]||(ht[_t]=[]);yt.push([mt,ct,dt[$t]])}}for(let Z=0;Z<ut.length;Z++){const ct=ut[Z];for(let Z=0;Z<ct.length;Z++){const ut=ct[Z];if(ut)ut.sort(sortComparator)}}return ut}var It=false;function binarySearch(Z,ct,ut,pt){while(ut<=pt){const dt=ut+(pt-ut>>1);const ft=Z[dt][$t]-ct;if(ft===0){It=true;return dt}if(ft<0){ut=dt+1}else{pt=dt-1}}It=false;return ut-1}function upperBound(Z,ct,ut){for(let pt=ut+1;pt<Z.length;ut=pt++){if(Z[pt][$t]!==ct)break}return ut}function lowerBound(Z,ct,ut){for(let pt=ut-1;pt>=0;ut=pt--){if(Z[pt][$t]!==ct)break}return ut}function memoizedState(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function memoizedBinarySearch(Z,ct,ut,pt){const{lastKey:dt,lastNeedle:ft,lastIndex:_t}=ut;let mt=0;let ht=Z.length-1;if(pt===dt){if(ct===ft){It=_t!==-1&&Z[_t][$t]===ct;return _t}if(ct>=ft){mt=_t===-1?0:_t}else{ht=_t}}ut.lastKey=pt;ut.lastNeedle=ct;return ut.lastIndex=binarySearch(Z,ct,mt,ht)}function parse(Z){return typeof Z==="string"?JSON.parse(Z):Z}var FlattenMap=function(Z,ct){const ut=parse(Z);if(!("sections"in ut)){return new Ft(ut,ct)}const pt=[];const dt=[];const ft=[];const _t=[];const mt=[];recurse(ut,ct,pt,dt,ft,_t,mt,0,0,Infinity,Infinity);const ht={version:3,file:ut.file,names:_t,sources:dt,sourcesContent:ft,mappings:pt,ignoreList:mt};return presortedDecodedMap(ht)};function recurse(Z,ct,ut,pt,dt,ft,_t,mt,ht,yt,vt){const{sections:St}=Z;for(let Z=0;Z<St.length;Z++){const{map:bt,offset:xt}=St[Z];let $t=yt;let Et=vt;if(Z+1<St.length){const ct=St[Z+1].offset;$t=Math.min(yt,mt+ct.line);if($t===yt){Et=Math.min(vt,ht+ct.column)}else if($t<yt){Et=ht+ct.column}}addSection(bt,ct,ut,pt,dt,ft,_t,mt+xt.line,ht+xt.column,$t,Et)}}function addSection(Z,ct,ut,pt,dt,ft,_t,mt,ht,yt,vt){const St=parse(Z);if("sections"in St)return recurse(...arguments);const bt=new Ft(St,ct);const xt=pt.length;const At=ft.length;const kt=decodedMappings(bt);const{resolvedSources:It,sourcesContent:Nt,ignoreList:Pt}=bt;append(pt,It);append(ft,bt.names);if(Nt)append(dt,Nt);else for(let Z=0;Z<It.length;Z++)dt.push(null);if(Pt)for(let Z=0;Z<Pt.length;Z++)_t.push(Pt[Z]+xt);for(let Z=0;Z<kt.length;Z++){const ct=mt+Z;if(ct>yt)return;const pt=getLine(ut,ct);const dt=Z===0?ht:0;const ft=kt[Z];for(let Z=0;Z<ft.length;Z++){const ut=ft[Z];const _t=dt+ut[$t];if(ct===yt&&_t>=vt)return;if(ut.length===1){pt.push([_t]);continue}const mt=xt+ut[Et];const ht=ut[Ct];const St=ut[Tt];pt.push(ut.length===4?[_t,mt,ht,St]:[_t,mt,ht,St,At+ut[wt]])}}}function append(Z,ct){for(let ut=0;ut<ct.length;ut++)Z.push(ct[ut])}function getLine(Z,ct){for(let ut=Z.length;ut<=ct;ut++)Z[ut]=[];return Z[ct]}var Nt="`line` must be greater than 0 (lines start at line 1)";var Pt="`column` must be greater than or equal to 0 (columns start at column 0)";var Ot=-1;var Dt=1;var Ft=class{constructor(Z,ct){const ut=typeof Z==="string";if(!ut&&Z._decodedMemo)return Z;const pt=parse(Z);const{version:dt,file:ft,names:_t,sourceRoot:mt,sources:ht,sourcesContent:yt}=pt;this.version=dt;this.file=ft;this.names=_t||[];this.sourceRoot=mt;this.sources=ht;this.sourcesContent=yt;this.ignoreList=pt.ignoreList||pt.x_google_ignoreList||void 0;const vt=resolver(ct,mt);this.resolvedSources=ht.map(vt);const{mappings:St}=pt;if(typeof St==="string"){this._encoded=St;this._decoded=void 0}else if(Array.isArray(St)){this._encoded=void 0;this._decoded=maybeSort(St,ut)}else if(pt.sections){throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`)}else{throw new Error(`invalid source map: ${JSON.stringify(pt)}`)}this._decodedMemo=memoizedState();this._bySources=void 0;this._bySourceMemos=void 0}};function cast(Z){return Z}function encodedMappings(Z){var ct,ut;return(ut=(ct=cast(Z))._encoded)!=null?ut:ct._encoded=(0,bt.encode)(cast(Z)._decoded)}function decodedMappings(Z){var ct;return(ct=cast(Z))._decoded||(ct._decoded=(0,bt.decode)(cast(Z)._encoded))}function traceSegment(Z,ct,ut){const pt=decodedMappings(Z);if(ct>=pt.length)return null;const dt=pt[ct];const ft=traceSegmentInternal(dt,cast(Z)._decodedMemo,ct,ut,Dt);return ft===-1?null:dt[ft]}function originalPositionFor(Z,ct){let{line:ut,column:pt,bias:dt}=ct;ut--;if(ut<0)throw new Error(Nt);if(pt<0)throw new Error(Pt);const ft=decodedMappings(Z);if(ut>=ft.length)return OMapping(null,null,null,null);const _t=ft[ut];const mt=traceSegmentInternal(_t,cast(Z)._decodedMemo,ut,pt,dt||Dt);if(mt===-1)return OMapping(null,null,null,null);const ht=_t[mt];if(ht.length===1)return OMapping(null,null,null,null);const{names:yt,resolvedSources:vt}=Z;return OMapping(vt[ht[Et]],ht[Ct]+1,ht[Tt],ht.length===5?yt[ht[wt]]:null)}function generatedPositionFor(Z,ct){const{source:ut,line:pt,column:dt,bias:ft}=ct;return generatedPosition(Z,ut,pt,dt,ft||Dt,false)}function allGeneratedPositionsFor(Z,ct){const{source:ut,line:pt,column:dt,bias:ft}=ct;return generatedPosition(Z,ut,pt,dt,ft||Ot,true)}function eachMapping(Z,ct){const ut=decodedMappings(Z);const{names:pt,resolvedSources:dt}=Z;for(let Z=0;Z<ut.length;Z++){const ft=ut[Z];for(let ut=0;ut<ft.length;ut++){const _t=ft[ut];const mt=Z+1;const ht=_t[0];let yt=null;let vt=null;let St=null;let bt=null;if(_t.length!==1){yt=dt[_t[1]];vt=_t[2]+1;St=_t[3]}if(_t.length===5)bt=pt[_t[4]];ct({generatedLine:mt,generatedColumn:ht,source:yt,originalLine:vt,originalColumn:St,name:bt})}}}function sourceIndex(Z,ct){const{sources:ut,resolvedSources:pt}=Z;let dt=ut.indexOf(ct);if(dt===-1)dt=pt.indexOf(ct);return dt}function sourceContentFor(Z,ct){const{sourcesContent:ut}=Z;if(ut==null)return null;const pt=sourceIndex(Z,ct);return pt===-1?null:ut[pt]}function isIgnored(Z,ct){const{ignoreList:ut}=Z;if(ut==null)return false;const pt=sourceIndex(Z,ct);return pt===-1?false:ut.includes(pt)}function presortedDecodedMap(Z,ct){const ut=new Ft(clone(Z,[]),ct);cast(ut)._decoded=Z.mappings;return ut}function decodedMap(Z){return clone(Z,decodedMappings(Z))}function encodedMap(Z){return clone(Z,encodedMappings(Z))}function clone(Z,ct){return{version:Z.version,file:Z.file,names:Z.names,sourceRoot:Z.sourceRoot,sources:Z.sources,sourcesContent:Z.sourcesContent,mappings:ct,ignoreList:Z.ignoreList||Z.x_google_ignoreList}}function OMapping(Z,ct,ut,pt){return{source:Z,line:ct,column:ut,name:pt}}function GMapping(Z,ct){return{line:Z,column:ct}}function traceSegmentInternal(Z,ct,ut,pt,dt){let ft=memoizedBinarySearch(Z,pt,ct,ut);if(It){ft=(dt===Ot?upperBound:lowerBound)(Z,pt,ft)}else if(dt===Ot)ft++;if(ft===-1||ft===Z.length)return-1;return ft}function sliceGeneratedPositions(Z,ct,ut,pt,dt){let ft=traceSegmentInternal(Z,ct,ut,pt,Dt);if(!It&&dt===Ot)ft++;if(ft===-1||ft===Z.length)return[];const _t=It?pt:Z[ft][$t];if(!It)ft=lowerBound(Z,_t,ft);const mt=upperBound(Z,_t,ft);const ht=[];for(;ft<=mt;ft++){const ct=Z[ft];ht.push(GMapping(ct[At]+1,ct[kt]))}return ht}function generatedPosition(Z,ct,ut,pt,dt,ft){var _t,mt;ut--;if(ut<0)throw new Error(Nt);if(pt<0)throw new Error(Pt);const{sources:ht,resolvedSources:yt}=Z;let vt=ht.indexOf(ct);if(vt===-1)vt=yt.indexOf(ct);if(vt===-1)return ft?[]:GMapping(null,null);const St=(_t=cast(Z))._bySourceMemos||(_t._bySourceMemos=ht.map(memoizedState));const bt=(mt=cast(Z))._bySources||(mt._bySources=buildBySources(decodedMappings(Z),St));const xt=bt[vt][ut];if(xt==null)return ft?[]:GMapping(null,null);const $t=St[vt];if(ft)return sliceGeneratedPositions(xt,$t,ut,pt,dt);const Et=traceSegmentInternal(xt,$t,ut,pt,dt);if(Et===-1)return GMapping(null,null);const Ct=xt[Et];return GMapping(Ct[At]+1,Ct[kt])}}))},3563:(Z,ct,ut)=>{const{parse:pt,format:dt}=ut(87016);const{pathToRegexp:ft,compile:_t,parse:mt}=ut(44985);Z.exports=Layer;function Layer(Z,ct,ut,pt={}){this.opts=pt;this.name=this.opts.name||null;this.methods=[];this.paramNames=[];this.stack=Array.isArray(ut)?ut:[ut];for(const Z of ct){const ct=this.methods.push(Z.toUpperCase());if(this.methods[ct-1]==="GET")this.methods.unshift("HEAD")}for(let ut=0;ut<this.stack.length;ut++){const pt=this.stack[ut];const dt=typeof pt;if(dt!=="function")throw new Error(`${ct.toString()} \`${this.opts.name||Z}\`: \`middleware\` must be a function, not \`${dt}\``)}this.path=Z;this.regexp=ft(Z,this.paramNames,this.opts)}Layer.prototype.match=function(Z){return this.regexp.test(Z)};Layer.prototype.params=function(Z,ct,ut={}){for(let Z=ct.length,pt=0;pt<Z;pt++){if(this.paramNames[pt]){const Z=ct[pt];if(Z&&Z.length>0)ut[this.paramNames[pt].name]=Z?safeDecodeURIComponent(Z):Z}}return ut};Layer.prototype.captures=function(Z){return this.opts.ignoreCaptures?[]:Z.match(this.regexp).slice(1)};Layer.prototype.url=function(Z,ct){let ut=Z;const ft=this.path.replace(/\(\.\*\)/g,"");if(typeof Z!=="object"){ut=Array.prototype.slice.call(arguments);if(typeof ut[ut.length-1]==="object"){ct=ut[ut.length-1];ut=ut.slice(0,-1)}}const ht=_t(ft,{encode:encodeURIComponent,...ct});let yt;const vt=mt(ft);let St={};if(Array.isArray(ut)){for(let Z=vt.length,ct=0,pt=0;ct<Z;ct++){if(vt[ct].name)St[vt[ct].name]=ut[pt++]}}else if(vt.some((Z=>Z.name))){St=Z}else if(!ct){ct=Z}yt=ht(St);if(ct&&ct.query){yt=pt(yt);if(typeof ct.query==="string"){yt.search=ct.query}else{yt.search=undefined;yt.query=ct.query}return dt(yt)}return yt};Layer.prototype.param=function(Z,ct){const{stack:ut}=this;const pt=this.paramNames;const middleware=function(ut,pt){return ct.call(this,ut.params[Z],ut,pt)};middleware.param=Z;const dt=pt.map((function(Z){return Z.name}));const ft=dt.indexOf(Z);if(ft>-1){ut.some((function(Z,ct){if(!Z.param||dt.indexOf(Z.param)>ft){ut.splice(ct,0,middleware);return true}}))}return this};Layer.prototype.setPrefix=function(Z){if(this.path){this.path=this.path!=="/"||this.opts.strict===true?`${Z}${this.path}`:Z;this.paramNames=[];this.regexp=ft(this.path,this.paramNames,this.opts)}return this};function safeDecodeURIComponent(Z){try{return decodeURIComponent(Z)}catch{return Z}}},53777:(Z,ct,ut)=>{const pt=ut(77246);const dt=ut(58024);const ft=ut(93);const{pathToRegexp:_t}=ut(44985);const mt=ut(3563);const ht=ut(26675)("koa-router");Z.exports=Router;function Router(Z={}){if(!(this instanceof Router))return new Router(Z);this.opts=Z;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 yt of ft){function setMethodVerb(Z){Router.prototype[Z]=function(ct,ut,pt){if(typeof ut==="string"||ut instanceof RegExp){pt=Array.prototype.slice.call(arguments,2)}else{pt=Array.prototype.slice.call(arguments,1);ut=ct;ct=null}if(typeof ut!=="string"&&!(ut instanceof RegExp)&&(!Array.isArray(ut)||ut.length===0))throw new Error(`You have to provide a path when adding a ${Z} handler`);this.register(ut,[Z],pt,{name:ct});return this}}setMethodVerb(yt)}Router.prototype.del=Router.prototype["delete"];Router.prototype.use=function(){const Z=this;const ct=Array.prototype.slice.call(arguments);let ut;if(Array.isArray(ct[0])&&typeof ct[0][0]==="string"){const dt=ct[0];for(const ft of dt){Z.use.apply(Z,[ft].concat(ct.slice(1)))}return this}const pt=typeof ct[0]==="string";if(pt)ut=ct.shift();for(const ht of ct){if(ht.router){const yt=Object.assign(Object.create(Router.prototype),ht.router,{stack:[...ht.router.stack]});for(let vt=0;vt<yt.stack.length;vt++){const St=yt.stack[vt];const bt=Object.assign(Object.create(mt.prototype),St);if(ut)bt.setPrefix(ut);if(Z.opts.prefix)bt.setPrefix(Z.opts.prefix);Z.stack.push(bt);yt.stack[vt]=bt}if(Z.params){function setRouterParams(ct){const ut=ct;for(const ct of ut){yt.param(ct,Z.params[ct])}}setRouterParams(Object.keys(Z.params))}}else{const xt=[];_t(Z.opts.prefix||"",xt);const $t=Z.opts.prefix&&xt.length;Z.register(ut||"([^/]*)",[],ht,{end:false,ignoreCaptures:!pt&&!$t})}}return this};Router.prototype.prefix=function(Z){Z=Z.replace(/\/$/,"");this.opts.prefix=Z;for(let ct=0;ct<this.stack.length;ct++){const ut=this.stack[ct];ut.setPrefix(Z)}return this};Router.prototype.routes=Router.prototype.middleware=function(){const Z=this;const ct=function dispatch(ct,ut){ht("%s %s",ct.method,ct.path);const dt=Z.matchHost(ct.host);if(!dt){return ut()}const ft=Z.opts.routerPath||ct.newRouterPath||ct.path||ct.routerPath;const _t=Z.match(ft,ct.method);let mt;if(ct.matched){ct.matched.push.apply(ct.matched,_t.path)}else{ct.matched=_t.path}ct.router=Z;if(!_t.route)return ut();const yt=_t.pathAndMethod;const vt=yt[yt.length-1];ct._matchedRoute=vt.path;if(vt.name){ct._matchedRouteName=vt.name}mt=(Z.exclusive?[vt]:yt).reduce((function(Z,ct){Z.push((function(Z,ut){Z.captures=ct.captures(ft,Z.captures);Z.params=Z.request.params=ct.params(ft,Z.captures,Z.params);Z.routerPath=ct.path;Z.routerName=ct.name;Z._matchedRoute=ct.path;if(ct.name){Z._matchedRouteName=ct.name}return ut()}));return Z.concat(ct.stack)}),[]);return pt(mt)(ct,ut)};ct.router=this;return ct};Router.prototype.allowedMethods=function(Z={}){const ct=this.methods;return function allowedMethods(ut,pt){return pt().then((function(){const pt={};if(!ut.status||ut.status===404){for(let Z=0;Z<ut.matched.length;Z++){const ct=ut.matched[Z];for(let Z=0;Z<ct.methods.length;Z++){const ut=ct.methods[Z];pt[ut]=ut}}const ft=Object.keys(pt);if(!~ct.indexOf(ut.method)){if(Z.throw){const ct=typeof Z.notImplemented==="function"?Z.notImplemented():new dt.NotImplemented;throw ct}else{ut.status=501;ut.set("Allow",ft.join(", "))}}else if(ft.length>0){if(ut.method==="OPTIONS"){ut.status=200;ut.body="";ut.set("Allow",ft.join(", "))}else if(!pt[ut.method]){if(Z.throw){const ct=typeof Z.methodNotAllowed==="function"?Z.methodNotAllowed():new dt.MethodNotAllowed;throw ct}else{ut.status=405;ut.set("Allow",ft.join(", "))}}}}}))}};Router.prototype.all=function(Z,ct,ut){if(typeof ct==="string"){ut=Array.prototype.slice.call(arguments,2)}else{ut=Array.prototype.slice.call(arguments,1);ct=Z;Z=null}if(typeof ct!=="string"&&!(ct instanceof RegExp)&&(!Array.isArray(ct)||ct.length===0))throw new Error("You have to provide a path when adding an all handler");this.register(ct,ft,ut,{name:Z});return this};Router.prototype.redirect=function(Z,ct,ut){if(typeof Z==="symbol"||Z[0]!=="/"){Z=this.url(Z);if(Z instanceof Error)throw Z}if(typeof ct==="symbol"||ct[0]!=="/"&&!ct.includes("://")){ct=this.url(ct);if(ct instanceof Error)throw ct}return this.all(Z,(Z=>{Z.redirect(ct);Z.status=ut||301}))};Router.prototype.register=function(Z,ct,ut,pt={}){const dt=this;const{stack:ft}=this;if(Array.isArray(Z)){for(const ft of Z){dt.register.call(dt,ft,ct,ut,pt)}return this}const _t=new mt(Z,ct,ut,{end:pt.end===false?pt.end:true,name:pt.name,sensitive:pt.sensitive||this.opts.sensitive||false,strict:pt.strict||this.opts.strict||false,prefix:pt.prefix||this.opts.prefix||"",ignoreCaptures:pt.ignoreCaptures});if(this.opts.prefix){_t.setPrefix(this.opts.prefix)}for(let Z=0;Z<Object.keys(this.params).length;Z++){const ct=Object.keys(this.params)[Z];_t.param(ct,this.params[ct])}ft.push(_t);ht("defined route %s %s",_t.methods,_t.path);return _t};Router.prototype.route=function(Z){const ct=this.stack;for(let ut=ct.length,pt=0;pt<ut;pt++){if(ct[pt].name&&ct[pt].name===Z)return ct[pt]}return false};Router.prototype.url=function(Z,ct){const ut=this.route(Z);if(ut){const Z=Array.prototype.slice.call(arguments,1);return ut.url.apply(ut,Z)}return new Error(`No route found for name: ${String(Z)}`)};Router.prototype.match=function(Z,ct){const ut=this.stack;let pt;const dt={path:[],pathAndMethod:[],route:false};for(let ft=ut.length,_t=0;_t<ft;_t++){pt=ut[_t];ht("test %s %s",pt.path,pt.regexp);if(pt.match(Z)){dt.path.push(pt);if(pt.methods.length===0||~pt.methods.indexOf(ct)){dt.pathAndMethod.push(pt);if(pt.methods.length>0)dt.route=true}}}return dt};Router.prototype.matchHost=function(Z){const{host:ct}=this;if(!ct){return true}if(!Z){return false}if(typeof ct==="string"){return Z===ct}if(typeof ct==="object"&&ct instanceof RegExp){return ct.test(Z)}};Router.prototype.param=function(Z,ct){this.params[Z]=ct;for(let ut=0;ut<this.stack.length;ut++){const pt=this.stack[ut];pt.param(Z,ct)}return this};Router.url=function(Z){const ct=Array.prototype.slice.call(arguments,1);return mt.prototype.url.apply({path:Z},ct)}},88675:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Bootstrap=ct.BootstrapStarter=void 0;const pt=ut(31049);const dt=ut(16928);const ft=ut(51169);const _t=ut(5982);const mt=ut(28014);class BootstrapStarter{appDir;baseDir;globalOptions={};globalConfig;applicationContext;eventBus;configure(Z={}){this.globalOptions=Z;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 _t.ChildProcessEventBus({isWorker:true})}else if(process.env["MIDWAY_FORK_MODE"]==="thread"){this.eventBus=new _t.ThreadEventBus({isWorker:true})}}if(!this.globalOptions.moduleLoadType){const Z=await(0,pt.loadModule)((0,dt.join)(this.appDir,"package.json"),{safeLoad:true,enableCache:false});this.globalOptions.moduleLoadType=Z?.type==="module"?"esm":"commonjs"}this.applicationContext=await(0,pt.initializeGlobalApplicationContext)({loggerFactory:ft.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 Z=this.applicationContext.get(pt.MidwayApplicationManager);const ct=Z.getApplication("socketIO");(0,mt.setupWorker)(ct)}}const Z=this.applicationContext.get(pt.MidwayFrameworkService);if(!Z.getMainApp()){throw new pt.MidwayMainFrameworkMissingError}}async stop(){if(this.applicationContext){await(0,pt.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,pt.isTypeScriptEnvironment)()){return(0,dt.join)(this.appDir,"src")}else{return(0,dt.join)(this.appDir,"dist")}}}ct.BootstrapStarter=BootstrapStarter;class Bootstrap{static starter;static logger;static configured=false;static bootstrapLoggerFactory=new ft.LoggerFactory;static runningPromise=null;static configure(Z={}){this.configured=true;if(!this.logger&&!Z.logger){this.logger=this.bootstrapLoggerFactory.createLogger("bootstrap",{enableError:false,enableFile:false,enableConsole:true});if(Z.logger===false){if(this.logger["disableConsole"]){this.logger["disableConsole"]()}else{this.logger["level"]="none"}}Z.logger=this.logger}else{this.logger=this.logger||Z.logger}if(Z.appDir&&Z.appDir!==process.cwd()){process.chdir(Z.appDir)}this.getStarter().configure(Z);return this}static getStarter(){if(!this.starter){this.starter=new BootstrapStarter}return this.starter}static async run(){if(this.runningPromise){return this.runningPromise}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);this.runningPromise=this.getStarter().run().then((()=>{this.logger.info("[midway:bootstrap] current app started");global["MIDWAY_BOOTSTRAP_APP_READY"]=true;return this.getApplicationContext()})).catch((Z=>{this.logger.error(Z);process.exit(1)}));return this.runningPromise}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.runningPromise=null;this.bootstrapLoggerFactory.close()}static async onSignal(Z){this.logger.info("[midway:bootstrap] receive signal %s, closing",Z);try{await this.stop();this.logger.info("[midway:bootstrap] close done, exiting with code:0");process.exit(0)}catch(Z){this.logger.error("[midway:bootstrap] close with error: ",Z);process.exit(1)}}static onExit(Z){this.logger.info("[midway:bootstrap] exit with code:%s",Z)}static uncaughtExceptionHandler(Z){if(!(Z instanceof Error)){Z=new Error(String(Z))}if(Z.name==="Error"){Z.name="unhandledExceptionError"}this.logger.error(Z)}static unhandledRejectionHandler(Z){if(!(Z instanceof Error)){const ct=new Error(String(Z));if(Z){if(Z.name)ct.name=Z.name;if(Z.message)ct.message=Z.message;if(Z.stack)ct.stack=Z.stack}Z=ct}if(Z.name==="Error"){Z.name="unhandledRejectionError"}this.logger.error(Z)}static getApplicationContext(){return this.getStarter().getApplicationContext()}}ct.Bootstrap=Bootstrap},48797:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.setupStickyMaster=ct.AbstractForkManager=ct.ClusterManager=ct.BootstrapStarter=ct.Bootstrap=void 0;dt(ut(24846),ct);var ft=ut(88675);Object.defineProperty(ct,"Bootstrap",{enumerable:true,get:function(){return ft.Bootstrap}});Object.defineProperty(ct,"BootstrapStarter",{enumerable:true,get:function(){return ft.BootstrapStarter}});var _t=ut(84014);Object.defineProperty(ct,"ClusterManager",{enumerable:true,get:function(){return _t.ClusterManager}});var mt=ut(46776);Object.defineProperty(ct,"AbstractForkManager",{enumerable:true,get:function(){return mt.AbstractForkManager}});var ht=ut(28014);Object.defineProperty(ct,"setupStickyMaster",{enumerable:true,get:function(){return ht.setupStickyMaster}})},24846:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},46776:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.AbstractForkManager=void 0;const pt=ut(70857);const dt=ut(39023);const ft=ut(25901);const _t=ut(24434);const mt=ut(39023);const ht=(0,mt.debuglog)("midway:bootstrap");class AbstractForkManager{options;reforks=[];disconnectCount=0;unexpectedCount=0;disconnects={};hub=new _t.EventEmitter;workers=new Map;eventBus;isClosing=false;exitListener;constructor(Z){this.options=Z;Z.count=Z.count||pt.cpus().length-1;Z.refork=Z.refork!==false;Z.limit=Z.limit||60;Z.duration=Z.duration||6e4;Z.logger=Z.logger||console;Z.workerInitTimeout=Z.workerInitTimeout||3e4;this.eventBus=this.createEventBus({initTimeout:Z.workerInitTimeout})}async start(){ht("Start manager with options: %j",this.options);this.bindWorkerDisconnect((Z=>{ht(" - worker(%s): trigger event = disconnect",this.getWorkerId(Z));const ct=this.options.logger[Z["disableRefork"]?"info":"error"];this.disconnectCount++;const ut=this.isWorkerDead(Z);if(ut){ht(" - worker(%s): worker is dead",this.getWorkerId(Z));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork, because worker:%s exit event emit before disconnect",(0,ft.logDate)(),process.pid,this.getWorkerId(Z));return}if(Z["disableRefork"]){ht(" - worker(%s): worker is disableRefork(maybe terminated by master)",this.getWorkerId(Z));ct("[%s] [bootstrap:master:%s] don't fork, because worker:%s will be kill soon",(0,ft.logDate)(),process.pid,this.getWorkerId(Z));return}this.disconnects[this.getWorkerId(Z)]=(0,ft.logDate)();this.tryToRefork(Z)}));this.bindWorkerExit(((Z,ct,ut)=>{ht(" - worker(%s): trigger event = exit",this.getWorkerId(Z));this.workers.delete(this.getWorkerId(Z));if(Z["disableRefork"]){return}const pt=!!this.disconnects[this.getWorkerId(Z)];ht(" - worker(%s): isExpected=%s",this.getWorkerId(Z),pt);if(pt){delete this.disconnects[this.getWorkerId(Z)];return}ht(" - worker(%s): isWorkerDead=%s",this.getWorkerId(Z),this.isWorkerDead(Z));if(this.isWorkerDead(Z)){return}ht(" - worker(%s): unexpectedCount will add");this.unexpectedCount++;this.tryToRefork(Z);this.onUnexpected(Z,ct,ut)}));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 Z=0;Z<this.options.count;Z++){const Z=this.createWorker();ht(" - worker(%s) created",this.getWorkerId(Z));this.eventBus.addWorker(Z);this.workers.set(this.getWorkerId(Z),Z)}await this.eventBus.start()}tryToRefork(Z){if(this.allowRefork()){ht(" - worker(%s): allow refork and will fork new",this.getWorkerId(Z));const ct=this.createWorker(Z);this.workers.set(this.getWorkerId(ct),ct);this.options.logger.info("[%s] [bootstrap:master:%s] new worker:%s fork (state: %s)",(0,ft.logDate)(),process.pid,this.getWorkerId(ct),ct["state"]);this.eventBus.addWorker(ct)}else{ht(" - worker(%s): forbidden refork and will stop",this.getWorkerId(Z));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork new work (refork: %s)",(0,ft.logDate)(),process.pid,this.options.refork)}}allowRefork(){if(!this.options.refork||this.isClosing){return false}const Z=this.reforks.push(Date.now());if(Z>this.options.limit){this.reforks.shift()}const ct=this.reforks[this.reforks.length-1]-this.reforks[0];const ut=this.reforks.length<this.options.limit||ct>this.options.duration;if(!ut){this.hub.emit("reachReforkLimit")}return ut}onerror(Z){if(!Z){return}this.options.logger.error("[%s] [bootstrap:master:%s] master uncaughtException: %s",(0,ft.logDate)(),process.pid,Z.stack);this.options.logger.error(Z);this.options.logger.error("(total %d disconnect, %d unexpected exit)",this.disconnectCount,this.unexpectedCount)}onUnexpected(Z,ct,ut){const pt=Z.hasOwnProperty("exitedAfterDisconnect")?"exitedAfterDisconnect":"suicide";const _t=new Error(dt.format("worker:%s died unexpected (code: %s, signal: %s, %s: %s, state: %s)",this.getWorkerId(Z),ct,ut,pt,Z[pt],Z["state"]));_t.name="WorkerDiedUnexpectedError";this.options.logger.error("[%s] [bootstrap:master:%s] (total %d disconnect, %d unexpected exit) %s",(0,ft.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount,_t.stack)}onReachReforkLimit(){this.options.logger.error("[%s] [bootstrap:master:%s] worker died too fast (total %d disconnect, %d unexpected exit)",(0,ft.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount)}async killWorker(Z,ct){await this.closeWorker(Z);await Promise.race([(0,_t.once)(Z,"exit"),(0,ft.sleep)(ct)]);if(Z.killed)return;(Z.process||Z).kill("SIGKILL")}async stop(Z=2e3){ht("run close");this.isClosing=true;await this.eventBus.stop();for(const ct of this.workers.values()){ct["disableRefork"]=true;await this.killWorker(ct,Z)}if(this.exitListener){await this.exitListener()}}hasWorker(Z){return this.workers.has(Z)}getWorker(Z){return this.workers.get(Z)}getWorkerIds(){return Array.from(this.workers.keys())}onStop(Z){this.exitListener=Z}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(Z){if(!this.isClosing){this.options.logger.info("[bootstrap:master] receive signal %s, closing",Z);try{await this.stop();this.options.logger.info("[bootstrap:master] close done, exiting with code:0");process.exit(0)}catch(Z){this.options.logger.error("[midway:master] close with error: ",Z);process.exit(1)}}}onMasterExit(Z){this.options.logger.info("[bootstrap:master] exit with code:%s",Z)}}ct.AbstractForkManager=AbstractForkManager},84014:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ClusterManager=void 0;const pt=ut(5982);const dt=ut(46776);const ft=ut(29907);const _t=ut(39023);const mt=ut(31049);const ht=(0,_t.debuglog)("midway:bootstrap");class ClusterManager extends dt.AbstractForkManager{options;constructor(Z={}){super(Z);this.options=Z;Z.args=Z.args||[];Z.execArgv=Z.execArgv||[];if((0,mt.isTypeScriptEnvironment)()){Z.execArgv.push(...["--require","ts-node/register"])}}createWorker(){if(ft["setupPrimary"]){ft["setupPrimary"](this.options)}else if(ft["setupMaster"]){ft["setupMaster"](this.options)}return ft.fork({MIDWAY_FORK_MODE:"cluster",MIDWAY_STICKY_MODE:this.options.sticky?"true":"false",...this.options.env})}bindWorkerDisconnect(Z){ht("Bind cluster.disconnect event");ft.on("disconnect",Z)}bindWorkerExit(Z){ht("Bind cluster.exit event");ft.on("exit",Z)}getWorkerId(Z){return String(Z.process.pid)}isWorkerDead(Z){return Z.isDead()}closeWorker(Z){Z.kill("SIGTERM")}createEventBus(Z){return new pt.ChildProcessEventBus(Z)}isPrimary(){return!ft.isWorker}}ct.ClusterManager=ClusterManager},28014:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.setupStickyMaster=setupStickyMaster;ct.setupWorker=setupWorker;const pt=ut(29907);const dt=ut(76982);const randomId=()=>(0,dt.randomBytes)(8).toString("hex");function setupStickyMaster(Z,ct={}){const ut={loadBalancingMethod:"least-connection",...ct};const dt=new Map;const ft=/sid=([\w-]{20})/;let _t=0;const computeWorkerId=Z=>{const ct=ft.exec(Z);if(ct){const Z=ct[1];const ut=dt.get(Z);if(ut&&pt.workers[ut]){return ut}}switch(ut.loadBalancingMethod){case"random":{const Z=Object.keys(pt.workers);return Z[Math.floor(Math.random()*Z.length)]}case"round-robin":{const Z=Object.keys(pt.workers);_t++;if(_t>=Z.length){_t=0}return Z[_t]}case"least-connection":let Z;for(const ct in pt.workers){const ut=pt.workers[ct];if(Z===undefined){Z=ut}else{const ct=ut["clientsCount"]||0;const pt=Z["clientsCount"]||0;if(ct<pt){Z=ut}}}return Z.id}};Z.on("connection",(Z=>{let ct,ut;const sendCallback=ct=>{if(ct){Z.destroy()}};Z.on("data",(dt=>{let ft="utf-8";let _t=dt.toString(ft);if(ct&&ut){pt.workers[ct].send({type:"sticky:http-chunk",data:_t,encoding:ft,connectionId:ut},sendCallback);return}ct=computeWorkerId(_t);const mt=!(_t.startsWith("GET")||_t.substring(0,_t.indexOf("\r\n\r\n")).includes("pgrade: websocket"));if(_t.startsWith("POST")&&_t.includes("multipart/form-data")){ft="base64";_t=dt.toString("base64")}Z.pause();if(mt){ut=randomId()}pt.workers[ct].send({type:"sticky:connection",data:_t,encoding:ft,connectionId:ut},Z,{keepOpen:mt},sendCallback)}))}));Z.on("request",(Z=>{Z.on("data",(()=>{}))}));pt.on("message",((Z,{type:ct,data:pt})=>{switch(ct){case"sticky:connection":dt.set(pt,Z.id);if(ut.loadBalancingMethod==="least-connection"){Z["clientsCount"]=(Z["clientsCount"]||0)+1}break;case"sticky:disconnection":dt.delete(pt);if(ut.loadBalancingMethod==="least-connection"){Z["clientsCount"]--}break}}))}function setupWorker(Z){const ct=new Map;process.on("message",(({type:ut,data:pt,encoding:dt,connectionId:ft},_t)=>{switch(ut){case"sticky:connection":if(!_t){return}Z.httpServer.emit("connection",_t);_t.emit("data",Buffer.from(pt,dt));_t.resume();if(ft){ct.set(ft,_t);_t.on("close",(()=>{ct.delete(ft)}))}break;case"sticky:http-chunk":{const Z=ct.get(ft);if(Z){Z.emit("data",Buffer.from(pt,dt))}}}}));const ignoreError=()=>{};Z.engine.on("connection",(Z=>{process.send({type:"sticky:connection",data:Z.id},ignoreError);Z.once("close",(()=>{process.send({type:"sticky:disconnection",data:Z.id},ignoreError)}))}))}},25901:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.logDate=logDate;ct.sleep=sleep;function logDate(){const Z=new Date;let ct=Z.getDate();if(ct<10){ct="0"+ct}let ut=Z.getMonth()+1;if(ut<10){ut="0"+ut}let pt=Z.getHours();if(pt<10){pt="0"+pt}let dt=Z.getMinutes();if(dt<10){dt="0"+dt}let ft=Z.getSeconds();if(ft<10){ft="0"+ft}let _t=Z.getMilliseconds();if(_t<10){_t="00"+_t}else if(_t<100){_t="0"+_t}return Z.getFullYear()+"-"+ut+"-"+ct+" "+pt+":"+dt+":"+ft+"."+_t}async function sleep(Z){return new Promise((ct=>{setTimeout(ct,Z)}))}},96294:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.caching=caching;ct.createCache=createCache;ct.multiCaching=multiCaching;const pt=ut(71773);const dt=ut(48998);async function caching(Z,ct){if(Z==="memory"){const Z=(0,dt.memoryStore)(ct);return createCache(Z,ct)}if(typeof Z==="function"){const ut=await Z(ct);return createCache(ut,ct)}return createCache(Z,ct)}function createCache(Z,ct){return{wrap:async(ut,dt,ft)=>(0,pt.coalesceAsync)(ut,(async()=>{const _t=await Z.get(ut);if(_t===undefined){const ct=await dt();const pt=typeof ft==="function"?ft(ct):ft;await Z.set(ut,ct,pt);return ct}else if(ct?.refreshThreshold){const mt=typeof ft==="function"?ft(_t):ft;const ht=await Z.ttl(ut);if(ht!==-1&&ht<ct.refreshThreshold){(0,pt.coalesceAsync)(`+++${ut}`,dt).then((ct=>Z.set(ut,ct,mt)))}}return _t})),store:Z,del:ct=>Z.del(ct),get:ct=>Z.get(ct),set:(ct,ut,pt)=>Z.set(ct,ut,pt),reset:()=>Z.reset(),methodWrap:async(ut,dt,ft,_t)=>(0,pt.coalesceAsync)(ut,(async()=>{const mt=await Z.get(ut);if(mt===undefined){const ct=await dt(...ft);const pt=typeof _t==="function"?_t(ct):_t;await Z.set(ut,ct,pt);return ct}else if(ct?.refreshThreshold){const ht=typeof _t==="function"?_t(mt):_t;const yt=await Z.ttl(ut);if(yt!==-1&&yt<ct.refreshThreshold){(0,pt.coalesceAsync)(`+++${ut}`,(()=>dt(...ft))).then((ct=>Z.set(ut,ct,ht)))}}return mt}))}}function multiCaching(Z){const get=async ct=>{for(const ut of Z){try{const Z=await ut.get(ct);if(Z!==undefined)return Z}catch(Z){}}};const set=async(ct,ut,pt)=>{await Promise.all(Z.map((Z=>Z.set(ct,ut,pt))))};return{get:get,set:set,del:async ct=>{await Promise.all(Z.map((Z=>Z.del(ct))))},async wrap(ct,ut,pt){let dt;let ft=0;for(;ft<Z.length;ft++){try{dt=await Z[ft].get(ct);if(dt!==undefined)break}catch(Z){}}if(dt===undefined){const Z=await ut();const dt=typeof pt==="function"?pt(Z):pt;await set(ct,Z,dt);return Z}else{const _t=typeof pt==="function"?pt(dt):pt;Promise.all(Z.slice(0,ft).map((Z=>Z.set(ct,dt,_t)))).then();Z[ft].wrap(ct,ut,pt).then()}return dt},reset:async()=>{await Promise.all(Z.map((Z=>Z.reset())))},mget:async(...ct)=>{const ut=new Array(ct.length).fill(undefined);for(const pt of Z){if(ut.every((Z=>Z!==undefined)))break;try{const Z=await pt.store.mget(...ct);Z.forEach(((Z,ct)=>{if(ut[ct]===undefined&&Z!==undefined)ut[ct]=Z}))}catch(Z){}}return ut},mset:async(ct,ut)=>{await Promise.all(Z.map((Z=>Z.store.mset(ct,ut))))},mdel:async(...ct)=>{await Promise.all(Z.map((Z=>Z.store.mdel(...ct))))},methodWrap:async(ct,ut,pt,dt)=>{let ft;let _t=0;for(;_t<Z.length;_t++){try{ft=await Z[_t].get(ct);if(ft!==undefined)break}catch(Z){}}if(ft===undefined){const Z=await ut(...pt);const ft=typeof dt==="function"?dt(Z):dt;await set(ct,Z,ft);return Z}else{const mt=typeof dt==="function"?dt(ft):dt;Promise.all(Z.slice(0,_t).map((Z=>Z.set(ct,ft,mt)))).then();Z[_t].methodWrap(ct,ut,pt,dt).then()}return ft}}}},21263:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});dt(ut(96294),ct);dt(ut(48998),ct);dt(ut(85894),ct)},71773:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.coalesceAsync=coalesceAsync;const ut=new Map;async function coalesceAsync(Z,ct){if(!hasKey(Z)){addKey(Z);try{const ut=await Promise.resolve(ct());coalesce({key:Z,result:ut});return ut}catch(ct){coalesce({key:Z,error:ct});throw ct}}return enqueue(Z)}function hasKey(Z){return ut.has(Z)}function addKey(Z){ut.set(Z,[])}function removeKey(Z){ut.delete(Z)}function addCallbackToKey(Z,ct){const pt=getCallbacksByKey(Z);pt.push(ct);ut.set(Z,pt)}function getCallbacksByKey(Z){return ut.get(Z)??[]}function enqueue(Z){return new Promise(((ct,ut)=>{const pt={resolve:ct,reject:ut};addCallbackToKey(Z,pt)}))}function dequeue(Z){const ct=getCallbacksByKey(Z);removeKey(Z);return ct}function coalesce(Z){const{key:ct,error:ut,result:pt}=Z;dequeue(ct).forEach((Z=>{if(ut){Z.reject(ut)}else{Z.resolve(pt)}}))}},48998:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.memoryStore=memoryStore;const pt=ut(57223);const dt=ut(19944);function clone(Z){if(typeof Z==="object"&&Z!==null){return dt(Z)}return Z}function memoryStore(Z){const ct=Z?.shouldCloneBeforeSet!==false;const ut=Z?.isCacheable??(Z=>Z!==undefined);const dt={ttlAutopurge:true,...Z,max:Z?.max||500,ttl:Z?.ttl!==undefined?Z.ttl:0};const ft=new pt(dt);return{async del(Z){ft.delete(Z)},get:async Z=>ft.get(Z),keys:async()=>[...ft.keys()],mget:async(...Z)=>Z.map((Z=>ft.get(Z))),async mset(Z,pt){const _t={ttl:pt!==undefined?pt:dt.ttl};for(const[pt,dt]of Z){if(!ut(dt))throw new Error(`no cacheable value ${JSON.stringify(dt)}`);if(ct)ft.set(pt,clone(dt),_t);else ft.set(pt,dt,_t)}},async mdel(...Z){for(const ct of Z)ft.delete(ct)},async reset(){ft.clear()},ttl:async Z=>ft.getRemainingTTL(Z),async set(Z,pt,_t){if(!ut(pt))throw new Error(`no cacheable value ${JSON.stringify(pt)}`);if(ct)pt=clone(pt);const mt=_t!==undefined?_t:dt.ttl;ft.set(Z,pt,{ttl:mt})},get calculatedSize(){return ft.calculatedSize},get size(){return ft.size},dump:()=>ft.dump(),load:(...Z)=>ft.load(...Z)}}},85894:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},27499:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.CacheConfiguration=void 0;ct.getClassMethodDefaultCacheKey=getClassMethodDefaultCacheKey;const ft=ut(31049);const _t=ut(93310);const mt=ut(63191);function getClassMethodDefaultCacheKey(Z,ct){return Z.name+"-"+ft.DecoratorManager.getProviderUUId(Z)+"-"+ct}let ht=class CacheConfiguration{decoratorService;cacheService;async onReady(Z){this.cacheService=await Z.getAsync(mt.CachingFactory);this.decoratorService.registerMethodHandler(_t.CACHE_DECORATOR_KEY,(({target:Z,propertyName:ct,metadata:ut})=>{if(!ut.cacheKey){ut.cacheKey=getClassMethodDefaultCacheKey(Z,ct)}return{around:async Z=>{let ct=ut.cacheKey;const pt=this.cacheService.get(ut.cacheInstanceName);if(typeof ct==="function"){ct=await ct({methodArgs:Z.args,ctx:Z.target[ft.REQUEST_OBJ_CTX_KEY],target:Z.target})}if(typeof ct==="string"){return pt.methodWrap(ct,Z.proceed,Z.args,ut.ttl)}else{return Z.proceed(...Z.args)}}}}))}};ct.CacheConfiguration=ht;pt([(0,ft.Inject)(),dt("design:type",ft.MidwayDecoratorService)],ht.prototype,"decoratorService",void 0);ct.CacheConfiguration=ht=pt([(0,ft.Configuration)({namespace:"cacheManager",importConfigs:[{default:{cacheManager:{}}}]})],ht)},93310:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.CACHE_DECORATOR_KEY=void 0;ct.Caching=Caching;const pt=ut(31049);ct.CACHE_DECORATOR_KEY="cache-manager:caching";function Caching(Z,ut,dt){if(typeof ut==="number"){dt=ut;ut=undefined}return pt.DecoratorManager.createCustomMethodDecorator(ct.CACHE_DECORATOR_KEY,{cacheInstanceName:Z,cacheKey:ut,ttl:dt})}},63191:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.CachingFactory=void 0;const ft=ut(31049);const _t=ut(21263);let mt=class CachingFactory extends ft.ServiceFactory{cacheManagerConfig;applicationContext;traceService;traceMetaResolver;traceEnabled;traceInjector;async init(){await this.initClients(this.cacheManagerConfig)}async createClient(Z,ct){if(Array.isArray(Z.store)){const ut=[];for(const pt of Z.store){if(typeof pt==="string"){if(!this.has(pt)){throw new ft.MidwayCommonError(`cache instance "${pt}" not found in "${ct}", please check your configuration.`)}ut.push(this.get(pt))}else if(typeof pt==="function"){ut.push(await pt())}else if(pt["wrap"]){ut.push(pt["wrap"])}else if(typeof pt==="object"){if(typeof pt.store==="function"){pt.store=await pt.store(pt["options"]||{},this.applicationContext)}if(!pt.store){throw new ft.MidwayCommonError(`cache instance "${ct}" store is undefined, please check your configuration.`)}ut.push(await(0,_t.caching)(pt.store,pt["options"]))}else{throw new ft.MidwayCommonError("invalid cache config")}}const pt=await(0,_t.multiCaching)(ut);this.bindTraceContext(pt,ct);return pt}else{if(typeof Z.store==="function"){Z.store=await Z.store(Z["options"]||{},this.applicationContext)}if(!Z.store){throw new ft.MidwayCommonError(`cache instance "${ct}" store is undefined, please check your configuration.`)}const ut=await(0,_t.caching)(Z.store,Z["options"]);this.bindTraceContext(ut,ct);return ut}}bindTraceContext(Z,ct){if(!Z||!this.traceService){return}const wrapMethod=(Z,ut)=>{const pt=Z?.[ut];if(typeof pt!=="function"){return}Z[ut]=(...dt)=>{const ft=typeof this.traceInjector==="function"?this.traceInjector({request:dt,custom:{clientName:ct,methodName:ut}}):{};const _t=ft&&typeof ft==="object"?ft:{};return this.traceService.runWithExitSpan(`cache.${ut}`,{enable:this.traceEnabled!==false,carrier:_t,attributes:{"midway.protocol":"cache","midway.cache.client":ct,"midway.cache.method":ut},meta:this.traceMetaResolver,metaArgs:{carrier:_t,request:dt,custom:{clientName:ct,methodName:ut}}},(async()=>pt.apply(Z,dt)))}};["get","set","del","wrap","methodWrap","mget","mset","mdel","reset"].forEach((ct=>wrapMethod(Z,ct)))}getName(){return"cache-manager"}getCaching(Z){return this.get(Z)}getMultiCaching(Z){return this.get(Z)}};ct.CachingFactory=mt;pt([(0,ft.Config)("cacheManager"),dt("design:type",Object)],mt.prototype,"cacheManagerConfig",void 0);pt([(0,ft.ApplicationContext)(),dt("design:type",Object)],mt.prototype,"applicationContext",void 0);pt([(0,ft.Inject)(),dt("design:type",ft.MidwayTraceService)],mt.prototype,"traceService",void 0);pt([(0,ft.Config)("cacheManager.tracing.meta"),dt("design:type",Object)],mt.prototype,"traceMetaResolver",void 0);pt([(0,ft.Config)("cacheManager.tracing.enable"),dt("design:type",Object)],mt.prototype,"traceEnabled",void 0);pt([(0,ft.Config)("cacheManager.tracing.injector"),dt("design:type",Object)],mt.prototype,"traceInjector",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],mt.prototype,"init",null);ct.CachingFactory=mt=pt([(0,ft.Provide)(),(0,ft.Scope)(ft.ScopeEnum.Singleton)],mt)},14013:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.CacheManager=ct.getClassMethodDefaultCacheKey=ct.Configuration=void 0;var ft=ut(27499);Object.defineProperty(ct,"Configuration",{enumerable:true,get:function(){return ft.CacheConfiguration}});Object.defineProperty(ct,"getClassMethodDefaultCacheKey",{enumerable:true,get:function(){return ft.getClassMethodDefaultCacheKey}});dt(ut(58158),ct);dt(ut(63191),ct);dt(ut(93310),ct);ct.CacheManager=ut(21263);dt(ut(81268),ct)},58158:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},81268:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.createRedisStore=createRedisStore;const pt=ut(31049);const getVal=Z=>JSON.stringify(Z)||'"undefined"';function createRedisStore(Z){return async(ct,ut)=>{const{RedisServiceFactory:dt}=(0,pt.safeRequire)("@midwayjs/redis");const ft=await ut.getAsync(dt);const _t=ft.get(Z);return createStore(_t,ct)}}function createStore(Z,ct){const ut=ct?.isCacheable||(Z=>Z!==undefined&&Z!==null);const keys=ct=>Z.keys(ct);return{async get(ct){const ut=await Z.get(ct);if(ut===undefined||ut===null)return undefined;else{try{return JSON.parse(ut)}catch(Z){return ut}}},async set(dt,ft,_t){if(!ut(ft))throw new pt.MidwayCommonError(`"${ft}" is not a cacheable value`);const mt=_t===undefined?ct?.ttl:_t;if(mt!==undefined&&mt!==0)await Z.set(dt,getVal(ft),"PX",mt);else await Z.set(dt,getVal(ft))},async mset(dt,ft){const _t=ft===undefined?ct?.ttl:ft;if(_t!==undefined&&_t!==0){const ct=Z.multi();for(const[Z,ft]of dt){if(!ut(ft))throw new pt.MidwayCommonError(`"${getVal(ft)}" is not a cacheable value`);ct.set(Z,getVal(ft),"PX",_t)}await ct.exec()}else await Z.mset(dt.flatMap((([Z,ct])=>{if(!ut(ct))throw new Error(`"${getVal(ct)}" is not a cacheable value`);return[Z,getVal(ct)]})))},mget:(...ct)=>Z.mget(ct).then((Z=>Z.map((Z=>{if(Z===null||Z===undefined){return undefined}else{try{return JSON.parse(Z)}catch{return Z}}})))),async mdel(...ct){await Z.del(ct)},async del(ct){await Z.del(ct)},ttl:async ct=>Z.pttl(ct),keys:(Z="*")=>keys(Z),reset:()=>{throw new pt.MidwayCommonError("flushdb() is too dangerous, if necessary, please use redisServiceFactory.get(client) to get the instance and call it manually.")},isCacheable:ut}}},4074:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Cookie=void 0;const pt=ut(42613);const dt=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;const ft=/^(?:none|lax|strict)$/i;class Cookie{constructor(Z,ct,ut){pt(dt.test(Z),"argument name is invalid");pt(!ct||dt.test(ct),"argument value is invalid");this.name=Z;this.value=ct||"";this.attrs=mergeDefaultAttrs(ut);pt(!this.attrs.path||dt.test(this.attrs.path),"argument option path is invalid");pt(!this.attrs.domain||dt.test(this.attrs.domain),"argument option domain is invalid");pt(!this.attrs.sameSite||this.attrs.sameSite===true||ft.test(this.attrs.sameSite),"argument option sameSite is invalid");if(!ct){this.attrs.expires=new Date(0);this.attrs.maxAge=null}}toString(){return this.name+"="+this.value}toHeader(){let Z=this.toString();const ct=this.attrs;if(ct.path)Z+="; path="+ct.path;const ut=typeof ct.maxAge==="string"?parseInt(ct.maxAge,10):ct.maxAge;if(ut){Z+="; max-age="+Math.round(ut/1e3);ct.expires=new Date(Date.now()+ut)}if(ct.expires)Z+="; expires="+ct.expires.toUTCString();if(ct.domain)Z+="; domain="+ct.domain;if(ct.sameSite)Z+="; samesite="+(ct.sameSite===true?"strict":ct.sameSite.toLowerCase());if(ct.secure)Z+="; secure";if(ct.httpOnly)Z+="; httponly";if(ct.priority)Z+="; priority="+ct.priority;if(ct.partitioned)Z+="; partitioned";return Z}}ct.Cookie=Cookie;const _t=["path","expires","domain","httpOnly","secure","partitioned","maxAge","overwrite","sameSite","priority"];function mergeDefaultAttrs(Z){const ct={path:"/",httpOnly:true,secure:false,overwrite:false,sameSite:false,partitioned:false};if(!Z)return ct;for(let ut=0;ut<_t.length;ut++){const pt=_t[ut];if(pt in Z)ct[pt]=Z[pt]}return ct}},11033:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.urlSafeDecode=ct.urlSafeEncode=ct.Cookies=void 0;const pt=ut(42613);const dt=ut(4074);const ft=ut(5693);const _t=ut(86054);const mt=Symbol("midwayCookies:keysArray");const ht=Symbol("midwayCookies:keys");const yt=new Map;class Cookies{constructor(Z,ct,ut,pt){var dt;this[mt]=ct?[].concat(ct):ct;this._defaultCookieOptions=ut;this._defaultGetCookieOptions=pt;this.ctx=Z;this.secure=(dt=ut===null||ut===void 0?void 0:ut.secure)!==null&&dt!==void 0?dt:this.ctx.secure;this.app=Z.app}get keys(){if(!this[ht]){const Z=this[mt];pt(Array.isArray(Z),".keys required for encrypt/sign cookies");const ct=yt.get(Z);if(ct){this[ht]=ct}else{this[ht]=new ft.Keygrip(this[mt]);yt.set(Z,this[ht])}}return this[ht]}get(Z,ct){ct=Object.assign({},this._defaultGetCookieOptions||{},ct);const ut=computeSigned(ct);const pt=this.ctx.get("cookie");if(!pt)return;const dt=pt.match(getPattern(Z));if(!dt)return;let ft=dt[1];if(!ct.encrypt&&!ut)return ft;if(ut){const ct=Z+".sig";const ut=this.get(ct,{signed:false});if(!ut)return;const pt=Z+"="+ft;const dt=this.keys.verify(pt,ut);if(dt<0){this.set(ct,null,{path:"/",signed:false});return}if(dt>0){this.set(ct,this.keys.sign(pt),{signed:false})}return ft}ft=urlSafeDecode(ft);const _t=this.keys.decrypt(ft);if(_t===null||_t===void 0?void 0:_t.value){return _t.value.toString()}return undefined}set(Z,ct,ut){if(!ut&&typeof ct!=="string"){ut=ct;ct=""}ut=Object.assign({},this._defaultCookieOptions,ut);const pt=computeSigned(ut);ct=ct||"";if(!this.secure&&ut.secure){throw new Error("Cannot send secure cookie over unencrypted connection")}let ft=this.ctx.response.get("set-cookie")||[];if(!Array.isArray(ft))ft=[ft];if(ut.encrypt){ct=ct&&urlSafeEncode(this.keys.encrypt(ct))}if(ct.length>4093){this.app.emit("cookieLimitExceed",{name:Z,value:ct,ctx:this.ctx})}const _t=this.ctx.get("user-agent");if(ut.sameSite&&typeof ut.sameSite==="string"&&ut.sameSite.toLowerCase()==="none"){if(!this.secure||_t&&!this.isSameSiteNoneCompatible(_t)){ut.sameSite=false}}if(ut.partitioned){if(!this.secure||!_t||_t&&!this.isPartitionedCompatible(_t)){ut.partitioned=false}}if(ut.partitioned&&ut.removeUnpartitioned){const ct=ut.overwrite;if(ct){ut.overwrite=false;ft=ignoreCookiesByName(ft,Z)}const _t=Object.assign({},ut,{partitioned:false});const mt=new dt.Cookie(Z,"",_t);if(ut.secure===undefined)mt.attrs.secure=this.secure;ft=pushCookie(ft,mt);if(pt){mt.name+=".sig";ft=ignoreCookiesByName(ft,mt.name);ft=pushCookie(ft,mt)}}if(ut.priority){if(!_t||_t&&!this.isPriorityCompatible(_t)){ut.priority=undefined}}const mt=new dt.Cookie(Z,ct,ut);if(ut.secure===undefined)mt.attrs.secure=this.secure;ft=pushCookie(ft,mt);if(pt){mt.value=ct&&this.keys.sign(mt.toString());mt.name+=".sig";ft=pushCookie(ft,mt)}this.ctx.set("set-cookie",ft);return this}isSameSiteNoneCompatible(Z){const ct=this.parseChromiumAndMajorVersion(Z);if(ct.chromium&&ct.majorVersion){return ct.majorVersion>=80}return(0,_t.isSameSiteNoneCompatible)(Z)}isPartitionedCompatible(Z){const ct=this.parseChromiumAndMajorVersion(Z);if(ct.chromium&&ct.majorVersion){return ct.majorVersion>=114}return false}parseChromiumAndMajorVersion(Z){if(!this.uaParseResult){const ct=/Chrom[^ /]+\/(\d+)[.\d]* /.exec(Z);if(!ct)return{chromium:false,majorVersion:undefined};this.uaParseResult={chromium:true,majorVersion:parseInt(ct[1])}}return this.uaParseResult}isPriorityCompatible(Z){const ct=this.parseChromiumAndMajorVersion(Z);if(ct.chromium&&ct.majorVersion){return ct.majorVersion>=81}return false}}ct.Cookies=Cookies;const vt=new Map;function getPattern(Z){const ct=vt.get(Z);if(ct)return ct;const ut=new RegExp("(?:^|;) *"+Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)");vt.set(Z,ut);return ut}function computeSigned(Z){if(Z.encrypt)return false;return Z.signed!==false}function pushCookie(Z,ct){if(ct.attrs.overwrite){Z=ignoreCookiesByName(Z,ct.name)}Z.push(ct.toHeader());return Z}function ignoreCookiesByName(Z,ct){const ut=`${ct}=`;return Z.filter((Z=>!Z.startsWith(ut)))}function urlSafeEncode(Z){return Z.replace(/\+/g,"-").replace(/\//g,"_")}ct.urlSafeEncode=urlSafeEncode;function urlSafeDecode(Z){return Z.replace(/-/g,"+").replace(/_/g,"/")}ct.urlSafeDecode=urlSafeDecode},60990:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});dt(ut(33249),ct);dt(ut(11033),ct)},33249:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},5693:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Keygrip=void 0;const pt=ut(42613);const dt=ut(39023);const ft=ut(76982);const _t=ut(48978);const mt=(0,dt.debuglog)("midway:cookies");const ht={"/":"_","+":"-","=":""};class Keygrip{constructor(Z){pt(Array.isArray(Z)&&Z.length,"keys must be provided and should be an array");this.keys=Z;this.hash="sha256"}encrypt(Z,ct){ct=ct||this.keys[0];try{Z=String(Z);const ut=getAlgorithm();const pt=(0,ft.randomBytes)(64);const dt=(0,ft.randomBytes)(16);const _t=Math.floor(Math.random()*(99999-1e4+1))+1e4;const mt=deriveKeyFromPassword(ct,pt,Math.floor(_t*.47+1337));const ht=(0,ft.createCipheriv)(ut,mt,dt);const yt=Buffer.concat([ht.update(Z,"utf8"),ht.final()]);const vt=ht.getAuthTag();const St=Buffer.concat([pt,dt,vt,Buffer.from(_t.toString()),yt]).toString("hex");return getEncryptedPrefix()+St}catch(Z){mt("crypt error",Z.stack);return undefined}}decrypt(Z,ct){if(!ct){const ct=this.keys;for(let ut=0;ut<ct.length;ut++){const pt=this.decrypt(Z,ct[ut]);if(pt!==false)return{value:pt,index:ut}}return false}try{const ut=getAlgorithm();const pt=Z.split(getEncryptedPrefix());if(pt.length!==2){return void 0}else{Z=pt[1]}const dt=Buffer.from(Z,"hex");const _t=dt.slice(0,64);const mt=dt.slice(64,80);const ht=dt.slice(80,96);const yt=parseInt(dt.slice(96,101).toString("utf-8"),10);const vt=dt.slice(101);const St=deriveKeyFromPassword(ct,_t,Math.floor(yt*.47+1337));const bt=(0,ft.createDecipheriv)(ut,St,mt);bt.setAuthTag(ht);return bt.update(vt,"binary","utf-8")+bt.final("utf-8")}catch(Z){mt("crypt error",Z.stack);return false}}sign(Z,ct){ct=ct||this.keys[0];return(0,ft.createHmac)(this.hash,ct).update(Z).digest("base64").replace(/\/|\+|=/g,(Z=>ht[Z]))}verify(Z,ct){const ut=this.keys;for(let pt=0;pt<ut.length;pt++){if(_t(Buffer.from(ct),Buffer.from(this.sign(Z,ut[pt])))){mt("data %s match key %s",Z,ut[pt]);return pt}}return-1}}ct.Keygrip=Keygrip;function getAlgorithm(){return"aes-256-gcm"}function getEncryptedPrefix(){return"enc::"}function deriveKeyFromPassword(Z,ct,ut){return(0,ft.pbkdf2Sync)(Z,ct,ut,32,"sha512")}},82170:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.BaseFramework=void 0;const ft=ut(77866);const _t=ut(81680);const mt=ut(25923);const ht=ut(33569);const yt=ut(1565);const vt=ut(12692);const St=ut(7260);const bt=ut(26966);const xt=ut(45984);const $t=ut(22546);const Et=ut(8470);const Ct=ut(62724);const Tt=ut(48757);const wt=ut(39023);const At=ut(45213);const kt=ut(55319);const It=wt.debuglog("midway:debug");class BaseFramework{applicationContext;app;configurationOptions;logger;frameworkLoggerName="appLogger";defaultContext={};middlewareManager=this.createMiddlewareManager();filterManager=this.createFilterManager();guardManager=this.createGuardManager();composeMiddleware=null;bootstrapOptions;asyncContextManager;namespace;loggerService;environmentService;configService;informationService;middlewareService;mockService;constructor(Z){this.applicationContext=Z}async init(){this.configurationOptions=this.configure()??{};this.logger=this.loggerService.getLogger("coreLogger");return this}isEnable(){return true}async initialize(Z){this.bootstrapOptions=Z;await this.applicationInitialize(Z);if(!this.app.getApplicationContext){this.defineApplicationProperties()}await this.mockService.runSimulatorAppSetup(this.app)}getApplicationContext(){return this.applicationContext}getConfiguration(Z){return this.configService.getConfiguration(Z)}getCurrentEnvironment(){return this.environmentService.getCurrentEnvironment()}getApplication(){return this.app}createContextLogger(Z,ct){if(ct&&ct!==this.frameworkLoggerName){const ut=this.getLogger(ct);let pt=Z.getAttr(_t.REQUEST_CTX_LOGGER_CACHE_KEY);if(!pt){pt=new Map;Z.setAttr(_t.REQUEST_CTX_LOGGER_CACHE_KEY,pt)}if(pt.has(ct)){return pt.get(ct)}const dt=this.loggerService.createContextLogger(Z,ut);pt.set(ct,dt);return dt}else{if(Z["_logger"]){return Z["_logger"]}const ut=this.getLogger(ct);Z["_logger"]=this.loggerService.createContextLogger(Z,ut);return Z["_logger"]}}async stop(){await this.mockService.runSimulatorAppTearDown(this.app);await this.beforeStop()}getAppDir(){return this.informationService.getAppDir()}getBaseDir(){return this.informationService.getBaseDir()}defineApplicationProperties(Z={},ct=[]){const ut={getBaseDir:()=>this.getBaseDir(),getAppDir:()=>this.getAppDir(),getEnv:()=>this.getCurrentEnvironment(),getApplicationContext:()=>this.getApplicationContext(),getConfig:Z=>this.getConfiguration(Z),getProcessType:()=>ft.MidwayProcessTypeEnum.APPLICATION,getCoreLogger:()=>this.getCoreLogger(),getLogger:Z=>this.getLogger(Z),createLogger:(Z,ct={})=>this.createLogger(Z,ct),getFramework:()=>this,getProjectName:()=>this.getProjectName(),createAnonymousContext:Z=>{const ct=Z||Object.create(this.defaultContext);if(!ct.startTime){ct.startTime=Date.now()}if(!ct.logger){ct.logger=this.createContextLogger(ct)}if(!ct.requestContext){ct.requestContext=new ht.MidwayRequestContainer(ct,this.getApplicationContext())}if(!ct.getLogger){ct.getLogger=Z=>this.createContextLogger(ct,Z)}ct.setAttr=(Z,ut)=>{ct.requestContext.setAttr(Z,ut)};ct.getAttr=Z=>ct.requestContext.getAttr(Z);ct.getApp=()=>this.getApplication();if(!Object.getOwnPropertyDescriptor(ct,"traceId")){Object.defineProperty(ct,"traceId",{get:()=>{try{return this.getApplicationContext().get(Tt.MidwayTraceService).getTraceId()}catch{return undefined}},enumerable:true,configurable:true})}return ct},addConfigObject:Z=>{this.configService.addObject(Z)},setAttr:(Z,ct)=>{this.getApplicationContext().setAttr(Z,ct)},getAttr:Z=>this.getApplicationContext().getAttr(Z),useMiddleware:Z=>this.useMiddleware(Z),getMiddleware:()=>this.getMiddleware(),useFilter:Z=>this.useFilter(Z),useGuard:Z=>this.useGuard(Z),getNamespace:()=>this.getNamespace()};for(const Z of ct){delete ut[Z]}Object.assign(this.app,ut,Z)}async beforeStop(){}async applyMiddleware(Z){if(!this.composeMiddleware){if(!this.applicationContext.hasObject(_t.ASYNC_CONTEXT_MANAGER_KEY)){const Z=this.configService.getConfiguration("asyncContextManager.enable")||false;const ct=Z?this.bootstrapOptions?.asyncContextManager||new At.NoopContextManager:new At.NoopContextManager;if(Z){ct.enable()}this.applicationContext.registerObject(_t.ASYNC_CONTEXT_MANAGER_KEY,ct)}this.middlewareManager.insertFirst((async(Z,ct)=>{const ut=At.ASYNC_ROOT_CONTEXT.setValue(_t.ASYNC_CONTEXT_KEY,Z);const pt=this.applicationContext.get(_t.ASYNC_CONTEXT_MANAGER_KEY);return await pt.with(ut,(async()=>{await this.mockService.runSimulatorContextSetup(Z,this.app);this.mockService.applyContextMocks(this.app,Z);let ut;try{const pt=await ct();ut=await this.filterManager.runResultFilter(pt,Z)}catch(ct){ut=await this.filterManager.runErrorFilter(ct,Z)}finally{await this.mockService.runSimulatorContextTearDown(Z,this.app)}if(ut.error){throw ut.error}return ut.result}))}));It(`[core]: Compose middleware = [${this.middlewareManager.getNames()}]`);this.composeMiddleware=await this.middlewareService.compose(this.middlewareManager,this.app);await this.filterManager.init(this.applicationContext)}if(Z){Z=Array.isArray(Z)?Z:[Z];return await this.middlewareService.compose([this.composeMiddleware,...Z],this.app)}return this.composeMiddleware}getLogger(Z){return this.loggerService.getLogger(Z??this.frameworkLoggerName)}getCoreLogger(){return this.logger}createLogger(Z,ct={}){return this.loggerService.createLogger(Z,ct)}getProjectName(){return this.informationService.getProjectName()}getFrameworkName(){return this.constructor.name}useMiddleware(Z){this.middlewareManager.insertLast(Z)}getMiddleware(){return this.middlewareManager}useFilter(Z){return this.filterManager.useFilter(Z)}useGuard(Z){return this.guardManager.addGlobalGuard(Z)}async runGuard(Z,ct,ut){return this.guardManager.runGuard(Z,ct,ut)}createMiddlewareManager(){return new xt.ContextMiddlewareManager}createFilterManager(){return new Et.FilterManager}createGuardManager(){return new kt.GuardManager}setNamespace(Z){this.namespace=Z}getNamespace(){return this.namespace}setFrameworkLoggerName(Z){this.frameworkLoggerName=Z}}ct.BaseFramework=BaseFramework;pt([(0,mt.Inject)(),dt("design:type",bt.MidwayLoggerService)],BaseFramework.prototype,"loggerService",void 0);pt([(0,mt.Inject)(),dt("design:type",yt.MidwayEnvironmentService)],BaseFramework.prototype,"environmentService",void 0);pt([(0,mt.Inject)(),dt("design:type",vt.MidwayConfigService)],BaseFramework.prototype,"configService",void 0);pt([(0,mt.Inject)(),dt("design:type",St.MidwayInformationService)],BaseFramework.prototype,"informationService",void 0);pt([(0,mt.Inject)(),dt("design:type",$t.MidwayMiddlewareService)],BaseFramework.prototype,"middlewareService",void 0);pt([(0,mt.Inject)(),dt("design:type",Ct.MidwayMockService)],BaseFramework.prototype,"mockService",void 0);pt([(0,mt.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],BaseFramework.prototype,"init",null)},89746:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayApplicationManager=void 0;const dt=ut(77866);const ft=ut(25923);let _t=class MidwayApplicationManager{globalFrameworkMap=new Map;addFramework(Z,ct){this.globalFrameworkMap.set(Z,ct)}hasFramework(Z){return this.globalFrameworkMap.has(Z)}getFramework(Z){if(this.globalFrameworkMap.has(Z)){return this.globalFrameworkMap.get(Z)}}getApplication(Z){if(this.globalFrameworkMap.has(Z)){return this.globalFrameworkMap.get(Z).getApplication()}}getApplications(Z){if(!Z){return Array.from(this.globalFrameworkMap.values()).map((Z=>Z.getApplication())).filter((Z=>!!Z))}else{return Z.map((Z=>this.getApplication(Z))).filter((Z=>!!Z))}}};ct.MidwayApplicationManager=_t;ct.MidwayApplicationManager=_t=pt([(0,ft.Provide)(),(0,ft.Scope)(dt.ScopeEnum.Singleton)],_t)},45213:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.AsyncLocalStorageContextManager=ct.NoopContextManager=ct.ASYNC_ROOT_CONTEXT=void 0;const pt=ut(90290);class AsyncBaseContext{_currentContext;constructor(Z){const ct=this;ct._currentContext=Z?new Map(Z):new Map;ct.getValue=Z=>ct._currentContext.get(Z);ct.setValue=(Z,ut)=>{const pt=new AsyncBaseContext(ct._currentContext);pt._currentContext.set(Z,ut);return pt};ct.deleteValue=Z=>{const ut=new AsyncBaseContext(ct._currentContext);ut._currentContext.delete(Z);return ut}}getValue;setValue;deleteValue}ct.ASYNC_ROOT_CONTEXT=new AsyncBaseContext;class NoopContextManager{active(){return ct.ASYNC_ROOT_CONTEXT}with(Z,ct,ut,...pt){return ct.call(ut,...pt)}bind(Z,ct){return ct}enable(){return this}disable(){return this}}ct.NoopContextManager=NoopContextManager;class AsyncLocalStorageContextManager{_asyncLocalStorage;constructor(){this._asyncLocalStorage=new pt.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??ct.ASYNC_ROOT_CONTEXT}with(Z,ct,ut,...pt){const dt=ut==null?ct:ct.bind(ut);return this._asyncLocalStorage.run(Z,dt,...pt)}enable(){return this}disable(){this._asyncLocalStorage.disable();return this}bind(Z,ct){if(typeof ct==="function"){const ut=this;const contextWrapper=function(...pt){return ut.with(Z,(()=>ct.apply(this,pt)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:ct.length});return contextWrapper}return ct}}ct.AsyncLocalStorageContextManager=AsyncLocalStorageContextManager},98771:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.DataListener=void 0;const ft=ut(25923);class DataListener{innerData;isReady=false;async init(){if(!this.isReady){this.innerData=await this.initData();await this.onData(this.setData.bind(this));this.isReady=true}}setData(Z){this.innerData=Z}getData(){return this.transformData(this.innerData)}transformData(Z){return Z}async stop(){await this.destroyListener()}async destroyListener(){}}ct.DataListener=DataListener;pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],DataListener.prototype,"init",null);pt([(0,ft.Destroy)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],DataListener.prototype,"stop",null)},59679:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.DataSourceManager=void 0;const ft=ut(5904);const _t=ut(28068);const mt=ut(62525);const ht=ut(16928);const yt=ut(35175);const vt=ut(81680);const St=ut(39023);const bt=ut(53386);const xt=ut(25923);const $t=ut(1565);const Et=ut(53656);const Ct=(0,St.debuglog)("midway:debug");class DataSourceManager{dataSource=new Map;options={};modelMapping=new WeakMap;innerDefaultDataSourceName;dataSourcePriority={};creatingDataSources=new Map;baseDir;environmentService;priorityManager;async initDataSource(Z,ct){this.options=Z;if(!this.options.dataSource){throw new _t.MidwayParameterError("[DataSourceManager] must set options.dataSource.")}if(typeof ct==="string"){ct={baseDir:ct,entitiesConfigKey:"entities",concurrent:false}}const{baseDir:ut=this.baseDir,entitiesConfigKey:pt="entities",concurrent:dt}=ct;const processDataSource=async(ct,ft)=>{const _t=ft[pt];if(_t){const Z=new Set;const processEntity=async pt=>{if(typeof pt==="string"){const dt=await DataSourceManager.globModels(pt,ut,this.environmentService?.getModuleLoadType());for(const ut of dt){Z.add(ut);this.modelMapping.set(ut,ct)}}else{Z.add(pt);this.modelMapping.set(pt,ct)}};if(dt){await Promise.all(_t.map(processEntity))}else{for(const Z of _t){await processEntity(Z)}}ft[pt]=Array.from(Z);Ct(`[core]: DataManager load ${ft[pt].length} models from ${ct}.`)}const mt={cacheInstance:Z.cacheInstance,validateConnection:Z.validateConnection};return this.createInstance(ft,ct,mt)};const ft=Object.entries(Z.dataSource);if(dt){await Promise.all(ft.map((([Z,ct])=>processDataSource(Z,ct))))}else{for(const[Z,ct]of ft){await processDataSource(Z,ct)}}}getDataSource(Z){return this.dataSource.get(Z)}hasDataSource(Z){return this.dataSource.has(Z)}getDataSourceNames(){return Array.from(this.dataSource.keys())}getAllDataSources(){return this.dataSource}async isConnected(Z){const ct=this.getDataSource(Z);return ct?this.checkConnected(ct):false}async createInstance(Z,ct,ut){if(ct&&typeof ct!=="string"){ut=ct;ct=undefined}if(ct&&ut&&ut.cacheInstance===false){ct=undefined}if(ct){if(this.dataSource.has(ct)){return this.dataSource.get(ct)}if(this.creatingDataSources.has(ct)){return this.creatingDataSources.get(ct)}}const pt=Z.validateConnection??(ut&&ut.validateConnection)??false;const dt=(0,ft.extend)(true,{},this.options["default"],Z);const mt=this.createDataSource(dt,ct);if(mt&&yt.Types.isPromise(mt)){if(ct){this.creatingDataSources.set(ct,mt)}return mt.then((async Z=>{if(ct){this.dataSource.set(ct,Z)}if(pt){if(!Z){throw new _t.MidwayCommonError(`[DataSourceManager] ${ct} initialization failed.`)}const ut=await this.checkConnected(Z);if(!ut){throw new _t.MidwayCommonError(`[DataSourceManager] ${ct} is not connected.`)}}return Z})).finally((()=>{if(ct){this.creatingDataSources.delete(ct)}}))}if(ct){this.dataSource.set(ct,mt)}return mt}getDataSourceNameByModel(Z){return this.modelMapping.get(Z)}async stop(){const Z=Array.from(this.dataSource.values());await Promise.all(Z.map((Z=>this.destroyDataSource(Z))));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(Z){return this.priorityManager.getPriority(this.dataSourcePriority[Z])}isHighPriority(Z){return this.priorityManager.isHighPriority(this.dataSourcePriority[Z])}isMediumPriority(Z){return this.priorityManager.isMediumPriority(this.dataSourcePriority[Z])}isLowPriority(Z){return this.priorityManager.isLowPriority(this.dataSourcePriority[Z])}static formatGlobString(Z){let ct;if(!/^\*/.test(Z)){Z="/"+Z}const ut=(0,ht.parse)(Z);if(ut.base&&(/\*/.test(ut.base)||ut.ext)){ct=[Z]}else{ct=[...vt.DEFAULT_PATTERN.map((ct=>(0,ht.join)(Z,ct)))]}return ct}static async globModels(Z,ct,ut){const pt=this.formatGlobString(Z);const dt=[];const ft=(0,mt.run)(pt,{cwd:ct,ignore:vt.IGNORE_PATTERN});for(const Z of ft){const ct=await(0,bt.loadModule)(Z,{loadMode:ut});if(yt.Types.isClass(ct)){dt.push(ct)}else{for(const Z in ct){const ut=ct[Z];if(yt.Types.isClass(ut)){dt.push(ut)}}}}return dt}}ct.DataSourceManager=DataSourceManager;pt([(0,xt.Inject)(),dt("design:type",String)],DataSourceManager.prototype,"baseDir",void 0);pt([(0,xt.Inject)(),dt("design:type",$t.MidwayEnvironmentService)],DataSourceManager.prototype,"environmentService",void 0);pt([(0,xt.Inject)(),dt("design:type",Et.MidwayPriorityManager)],DataSourceManager.prototype,"priorityManager",void 0)},19835:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.CustomModuleDetector=ct.ESModuleFileDetector=ct.CommonJSFileDetector=ct.AbstractFileDetector=void 0;const pt=ut(35175);const dt=ut(62525);const ft=ut(28068);const _t=ut(81680);const mt=ut(53386);const ht=ut(25923);const yt=ut(39023);const vt=ut(16928);const St=(0,yt.debuglog)("midway:debug");class AbstractFileDetector{options;constructor(Z){this.options=Z}}ct.AbstractFileDetector=AbstractFileDetector;const bt=["**/**.tsx"].concat(_t.DEFAULT_PATTERN);const xt=["**/logs/**","**/run/**","**/public/**","**/app/view/**","**/app/views/**","**/app/extend/**","**/node_modules/**","**/**.test.ts","**/**.test.js","**/__test__/**"].concat(_t.IGNORE_PATTERN);class CommonJSFileDetector extends AbstractFileDetector{duplicateModuleCheckSet=new Map;async run(Z,ct){if(this.getType()==="commonjs"){return this.loadSync(Z,ct)}else{return this.loadAsync(Z,ct)}}loadSync(Z,ct){this.options=this.options||{};const ut=[].concat(this.options.loadDir??Z.get("baseDir"));for(const _t of ut){const ut=(0,dt.run)(bt.concat(this.options.pattern||[]),{cwd:_t,ignore:xt.concat(this.options.ignore||[])});St(`[core]: load file from ${_t}, files: ${ut}`);const checkDuplicatedHandler=(Z,ct)=>{if(this.options.conflictCheck&&pt.Types.isClass(Z)){const ut=ht.DecoratorManager.getProviderName(Z);if(ut){if(this.duplicateModuleCheckSet.has(ut)){throw new ft.MidwayDuplicateClassNameError(ut,ct.srcPath,this.duplicateModuleCheckSet.get(ut))}else{this.duplicateModuleCheckSet.set(ut,ct.srcPath)}}}};for(const pt of ut){const ut=require(pt);Z.bindClass(ut,{namespace:ct,srcPath:pt,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}async loadAsync(Z,ct){this.options=this.options||{};const ut=Z.hasObject(_t.MODULE_LOADER_KEY)?Z.getObject(_t.MODULE_LOADER_KEY):mt.loadModule;const yt=[].concat(this.options.loadDir??Z.get("baseDir"));let $t;const Et=process.env.MIDWAY_HMR_IMPORT_QUERY==="1";const Ct=process.env.MIDWAY_HMR_IMPORT_QUERY_FILE;if(typeof this.options.importQuery==="function"){$t=this.options.importQuery()}else if(typeof this.options.importQuery==="string"){$t=this.options.importQuery}else if(this.options.importQuery){$t=`${Date.now()}_${Math.random()}`}else if(Et&&!Ct){$t=`${Date.now()}_${Math.random()}`}for(const _t of yt){const mt=(0,dt.run)(bt.concat(this.options.pattern||[]),{cwd:_t,ignore:xt.concat(this.options.ignore||[])});St(`[core]: load file from ${_t}, files: ${mt}`);const checkDuplicatedHandler=(Z,ct)=>{if(this.options.conflictCheck&&pt.Types.isClass(Z)){const ut=ht.DecoratorManager.getProviderName(Z);if(ut){if(this.duplicateModuleCheckSet.has(ut)){throw new ft.MidwayDuplicateClassNameError(ut,ct.srcPath,this.duplicateModuleCheckSet.get(ut))}else{this.duplicateModuleCheckSet.set(ut,ct.srcPath)}}}};for(const pt of mt){let dt=$t;if(!this.options.importQuery&&Et&&Ct){dt=(0,vt.resolve)(pt)===(0,vt.resolve)(Ct)?`${Date.now()}_${Math.random()}`:undefined}const ft=await ut(pt,{loadMode:"esm",importQuery:dt});Z.bindClass(ft,{namespace:ct,srcPath:pt,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}getType(){return"commonjs"}runSync(Z,ct){if(this.getType()==="commonjs"){return this.loadSync(Z,ct)}}}ct.CommonJSFileDetector=CommonJSFileDetector;class ESModuleFileDetector extends CommonJSFileDetector{getType(){return"module"}}ct.ESModuleFileDetector=ESModuleFileDetector;class CustomModuleDetector extends AbstractFileDetector{async run(Z){this.runSync(Z,this.options.namespace)}runSync(Z,ct){for(const ct of this.options.modules){Z.bindClass(ct,{namespace:this.options.namespace,createFrom:"module"})}}}ct.CustomModuleDetector=CustomModuleDetector},8470:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.FilterManager=void 0;const pt=ut(25923);const dt=ut(53386);const ft=ut(88067);class FilterManager{errFilterList=[];successFilterList=[];exceptionMap=new WeakMap;defaultErrFilter=undefined;matchFnList=[];protoMatchList=[];useFilter(Z){if(!Array.isArray(Z)){Z=[Z]}for(const ct of Z){if(ft.MetadataManager.getOwnMetadata(pt.CATCH_KEY,ct)){this.errFilterList.push(ct)}if(ft.MetadataManager.getOwnMetadata(pt.MATCH_KEY,ct)){this.successFilterList.push(ct)}}}async init(Z){for(const ct of this.errFilterList){const ut=await Z.getAsync(ct);const dt=ft.MetadataManager.getOwnMetadata(pt.CATCH_KEY,ct);if(dt&&dt.catchTargets){dt.catchOptions=dt.catchOptions||{};for(const Z of dt.catchTargets){this.exceptionMap.set(Z,{filter:ut,catchOptions:dt.catchOptions});if(dt.catchOptions["matchPrototype"]){this.protoMatchList.push((ct=>{if(ct instanceof Z){return Z}else{return false}}))}}}else{this.defaultErrFilter=ut}}for(const ct of this.successFilterList){const ut=await Z.getAsync(ct);const _t=ft.MetadataManager.getOwnMetadata(pt.MATCH_KEY,ct);if(_t&&_t.matchPattern){this.matchFnList.push({matchFn:(0,dt.toPathMatch)(_t.matchPattern),target:ut})}}}async runErrorFilter(Z,ct,ut,pt){let dt,ft;let _t=false;if(this.exceptionMap.has(Z.constructor)){_t=true;const ft=this.exceptionMap.get(Z.constructor);dt=await ft.filter.catch(Z,ct,ut,pt)}if(!_t&&this.protoMatchList.length){let ft;for(const ct of this.protoMatchList){ft=ct(Z);if(ft){break}}if(ft){_t=true;const mt=this.exceptionMap.get(ft);dt=await mt.filter.catch(Z,ct,ut,pt)}}if(!_t&&this.defaultErrFilter){_t=true;dt=await this.defaultErrFilter.catch(Z,ct,ut,pt)}if(!_t){ft=Z}return{result:dt,error:ft}}async runResultFilter(Z,ct,ut,pt){let dt=Z;for(const Z of this.matchFnList){if(Z.matchFn(ct,ut)){dt=await Z.target.match(dt,ct,ut,pt)}}return{result:dt,error:undefined}}}ct.FilterManager=FilterManager},55319:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.GuardManager=void 0;const pt=ut(25923);const dt=ut(88067);class GuardManager extends Array{addGlobalGuard(Z){if(!Array.isArray(Z)){this.push(Z)}else{this.push(...Z)}}async runGuard(Z,ct,ut){for(const pt of this){const dt=await Z.requestContext.getAsync(pt);const ft=await dt.canActivate(Z,ct,ut);if(!ft){return false}}const ft=dt.MetadataManager.getOwnMetadata(pt.GUARD_KEY,ct);if(ft){for(const pt of ft){const dt=await Z.requestContext.getAsync(pt);const ft=await dt.canActivate(Z,ct,ut);if(!ft){return false}}}const _t=dt.MetadataManager.getOwnMetadata(pt.GUARD_KEY,ct,ut);if(_t){for(const pt of _t){const dt=await Z.requestContext.getAsync(pt);const ft=await dt.canActivate(Z,ct,ut);if(!ft){return false}}}return true}}ct.GuardManager=GuardManager},47369:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.DefaultConsoleLoggerFactory=ct.LoggerFactory=void 0;class LoggerFactory{}ct.LoggerFactory=LoggerFactory;class DefaultConsoleLoggerFactory{instance=new Map;createLogger(Z,ct){this.instance.set(Z,console);return console}getLogger(Z){return this.instance.get(Z)}close(Z){}removeLogger(Z){}getDefaultMidwayLoggerConfig(){return{midwayLogger:{default:{},clients:{coreLogger:{},appLogger:{}}}}}createContextLogger(Z,ct,ut){return ct}getClients(){return this.instance}getClientKeys(){return Array.from(this.instance.keys())}}ct.DefaultConsoleLoggerFactory=DefaultConsoleLoggerFactory},45984:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ContextMiddlewareManager=void 0;ct.createMiddleware=createMiddleware;class ContextMiddlewareManager extends Array{insertFirst(Z){if(Array.isArray(Z)){this.unshift(...Z)}else{this.unshift(Z)}}insertLast(Z){if(Array.isArray(Z)){this.push(...Z)}else{this.push(Z)}}insertBefore(Z,ct){if(typeof ct!=="number"){ct=this.findItemIndex(ct)}if(Array.isArray(Z)){this.splice(ct,0,...Z)}else{this.splice(ct,0,Z)}}insertAfter(Z,ct){if(typeof ct!=="number"){ct=this.findItemIndex(ct)}if(Array.isArray(Z)){this.splice(ct+1,0,...Z)}else{this.splice(ct+1,0,Z)}}findAndInsertAfter(Z,ct){Z=this.findItem(Z);ct=this.findItem(ct);if(!Z||!ct||Z===ct){return}if(ct){const ut=this.remove(Z);if(ut){this.insertAfter(ut,ct)}}}findAndInsertBefore(Z,ct){Z=this.findItem(Z);ct=this.findItem(ct);if(!Z||!ct||Z===ct){return}if(ct){const ut=this.remove(Z);if(ut){this.insertBefore(ut,ct)}}}findAndInsertFirst(Z){const ct=this.remove(Z);if(ct){this.insertFirst(ct)}}findAndInsertLast(Z){const ct=this.remove(Z);if(ct){this.insertLast(ct)}}findItemIndex(Z){if(typeof Z==="number"){return Z}else if(typeof Z==="string"){return this.findIndex((ct=>this.getMiddlewareName(ct)===Z))}else{return this.findIndex((ct=>ct===Z))}}findItem(Z){if(typeof Z==="number"){if(Z>=0&&Z<=this.length-1){return this[Z]}}else if(typeof Z==="string"){return this.find((ct=>this.getMiddlewareName(ct)===Z))}else{return Z}}getMiddlewareName(Z){if(Z["middleware"]){return Z.name??this.getMiddlewareName(Z["middleware"])}return(Z.getName&&Z.getName())??Z._name??Z.name}remove(Z){if(typeof Z==="number"&&Z!==-1){return this.splice(Z,1)[0]}else{const ct=this.findItemIndex(Z);if(ct!==-1){return this.splice(ct,1)[0]}}}push(...Z){Z.forEach((Z=>{if(typeof Z!=="string"&&!this.getMiddlewareName(Z)){Z._name="anonymous"}}));return super.push(...Z)}unshift(...Z){Z.forEach((Z=>{if(typeof Z!=="string"&&!this.getMiddlewareName(Z)){Z._name="anonymous"}}));return super.unshift(...Z)}getNames(){return this.map((Z=>this.getMiddlewareName(Z)))}}ct.ContextMiddlewareManager=ContextMiddlewareManager;function createMiddleware(Z,ct,ut){return{middleware:Z,options:ct,name:ut}}},11386:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayInitializerPerformanceManager=ct.MidwayPerformanceManager=void 0;const pt=ut(82987);class MidwayPerformanceManager{group;static instances=new Map;static DEFAULT_GROUP={INITIALIZE:"MidwayInitialize"};observer=null;marks=new Set;measures=new Set;constructor(Z){this.group=Z}static getInstance(Z){if(!this.instances.has(Z)){this.instances.set(Z,new MidwayPerformanceManager(Z))}return this.instances.get(Z)}formatKey(Z,ct){return`${this.group}:${Z}-${ct}`}markStart(Z){const ct=this.formatKey(Z,"start");pt.performance.mark(ct);this.marks.add(ct)}markEnd(Z){const ct=this.formatKey(Z,"start");const ut=this.formatKey(Z,"end");const dt=`${this.group}:${Z}`;pt.performance.mark(ut);this.marks.add(ut);pt.performance.measure(dt,ct,ut);this.measures.add(dt)}observeMeasure(Z){if(this.observer){return}this.observer=new pt.PerformanceObserver((ct=>{const ut=ct.getEntries().filter((Z=>Z.name.startsWith(`${this.group}:`)));if(ut.length>0){Z({getEntries:()=>ut})}}));this.observer.observe({entryTypes:["measure"]});return this.observer}disconnect(){if(this.observer){this.observer.disconnect();this.observer=null}}clean(){this.marks.forEach((Z=>{try{pt.performance.clearMarks(Z)}catch(ct){console.warn(`Failed to clear mark ${Z}: ${ct}`)}}));this.marks.clear();this.measures.forEach((Z=>{try{pt.performance.clearMeasures(Z)}catch(ct){console.warn(`Failed to clear measure ${Z}: ${ct}`)}}));this.measures.clear();this.disconnect()}static cleanAll(){this.instances.forEach((Z=>Z.clean()));this.instances.clear()}static getInitialPerformanceEntries(){const Z=[];pt.performance?.getEntries().forEach((ct=>{if(ct.name.startsWith(this.DEFAULT_GROUP.INITIALIZE)){Z.push(ct.toJSON())}}));return Z}}ct.MidwayPerformanceManager=MidwayPerformanceManager;class MidwayInitializerPerformanceManager{static 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"};static markStart(Z){const ct=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);ct.markStart(Z)}static markEnd(Z){const ct=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);ct.markEnd(Z)}static frameworkInitializeStart(Z){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${Z}`)}static frameworkInitializeEnd(Z){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${Z}`)}static frameworkRunStart(Z){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${Z}`)}static frameworkRunEnd(Z){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${Z}`)}static lifecycleStart(Z,ct){this.markStart(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${Z}:${ct}`)}static lifecycleEnd(Z,ct){this.markEnd(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${Z}:${ct}`)}}ct.MidwayInitializerPerformanceManager=MidwayInitializerPerformanceManager},53656:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayPriorityManager=ct.DEFAULT_PRIORITY=void 0;const dt=ut(25923);const ft=ut(77866);ct.DEFAULT_PRIORITY={L1:"High",L2:"Medium",L3:"Low"};let _t=class MidwayPriorityManager{priorityList=ct.DEFAULT_PRIORITY;defaultPriority=ct.DEFAULT_PRIORITY.L2;getCurrentPriorityList(){return this.priorityList}getDefaultPriority(){return this.defaultPriority}isHighPriority(Z=ct.DEFAULT_PRIORITY.L2){return Z===ct.DEFAULT_PRIORITY.L1}isMediumPriority(Z=ct.DEFAULT_PRIORITY.L2){return Z===ct.DEFAULT_PRIORITY.L2}isLowPriority(Z=ct.DEFAULT_PRIORITY.L2){return Z===ct.DEFAULT_PRIORITY.L3}getPriority(Z){return Z||this.getDefaultPriority()}};ct.MidwayPriorityManager=_t;ct.MidwayPriorityManager=_t=pt([(0,dt.Provide)(),(0,dt.Scope)(ft.ScopeEnum.Singleton)],_t)},3145:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.LoadBalancerFactory=ct.RoundRobinLoadBalancer=ct.RandomLoadBalance=void 0;const pt=ut(77866);class RandomLoadBalance{select(Z){if(!Z.length){throw new Error("No available instances")}const ct=Math.floor(Math.random()*Z.length);return Z[ct]}}ct.RandomLoadBalance=RandomLoadBalance;class RoundRobinLoadBalancer{currentIndex=0;select(Z){if(!Z.length){throw new Error("No available instances")}const ct=Z[this.currentIndex];this.currentIndex=(this.currentIndex+1)%Z.length;return ct}}ct.RoundRobinLoadBalancer=RoundRobinLoadBalancer;class LoadBalancerFactory{static create(Z){switch(Z){case pt.LoadBalancerType.RANDOM:return new RandomLoadBalance;case pt.LoadBalancerType.ROUND_ROBIN:return new RoundRobinLoadBalancer;default:throw new Error(`Unsupported load balancer type: ${Z}`)}}}ct.LoadBalancerFactory=LoadBalancerFactory},81248:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.ServiceDiscovery=ct.ServiceDiscoveryClient=void 0;const ft=ut(25923);const _t=ut(3145);const mt=ut(77866);const ht=ut(27192);const yt=ut(5904);class ServiceDiscoveryClient{options;instance;client;constructor(Z,ct){this.client=Z;this.options=ct??{}}_defaultMeta;get defaultMeta(){if(!this._defaultMeta){this._defaultMeta=this.getDefaultInstanceMeta()}return this._defaultMeta}getDefaultInstanceMeta(){return{id:`${ht.NetworkUtils.getHostname()}-${process.pid}`,serviceName:`${ht.NetworkUtils.getHostname()}`,host:ht.NetworkUtils.getIpv4Address(),port:0,metadata:{}}}getSelfInstance(){return this.instance}async stop(){await this.beforeStop();if(this.instance){return this.deregister()}}}ct.ServiceDiscoveryClient=ServiceDiscoveryClient;class ServiceDiscovery{serviceDiscoveryClientStore=new Set;loadBalancer;createClient(Z){const ct=(0,yt.extend)({},Z,this.getDefaultServiceDiscoveryOptions());const ut=this.createServiceDiscoverClientImpl(ct);this.serviceDiscoveryClientStore.add(ut);return ut}async beforeStop(){}async getInstance(Z){const ct=await this.getInstances(Z);if(!this.loadBalancer){this.setLoadBalancer(this.getDefaultServiceDiscoveryOptions()?.loadBalancer??mt.LoadBalancerType.ROUND_ROBIN)}return this.loadBalancer.select(ct)}setLoadBalancer(Z){if(typeof Z==="string"){this.loadBalancer=_t.LoadBalancerFactory.create(Z)}else{this.loadBalancer=Z}}async destroy(){await this.beforeStop();for(const Z of this.serviceDiscoveryClientStore){await Z.stop()}this.serviceDiscoveryClientStore.clear()}}ct.ServiceDiscovery=ServiceDiscovery;pt([(0,ft.Destroy)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],ServiceDiscovery.prototype,"destroy",null)},71888:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.ServiceFactory=void 0;const ft=ut(5904);const _t=ut(53656);const mt=ut(25923);const ht=ut(35175);class ServiceFactory{clients=new Map;clientPriority;options={};priorityManager;creatingClients=new Map;async initClients(Z={},ct={}){this.options=Z;if(Z.client){Z.clients=Z.clients||{};Z.clients["default"]=Z.clients["default"]||{};(0,ft.extend)(true,Z.clients["default"],Z.client)}if(Z.clients){const ut=Object.entries(Z.clients);if(ct.concurrent){await Promise.all(ut.map((([Z,ct])=>this.createInstance(ct,Z))))}else{for(const[Z,ct]of ut){await this.createInstance(ct,Z)}}}this.clientPriority=Z.priority||{}}get(Z="default"){return this.clients.get(Z)}has(Z){return this.clients.has(Z)}async createInstance(Z,ct){if(ct){if(this.has(ct)){return this.get(ct)}if(this.creatingClients.has(ct)){return this.creatingClients.get(ct)}}Z=(0,ft.extend)(true,{},this.options["default"],Z);const ut=this.createClient(Z,ct);if(ut&&ht.Types.isPromise(ut)){if(ct){this.creatingClients.set(ct,ut)}return ut.then((Z=>{if(ct){this.clients.set(ct,Z)}return Z})).finally((()=>{if(ct){this.creatingClients.delete(ct)}}))}if(ct){this.clients.set(ct,ut)}return ut}async destroyClient(Z,ct){}async stop(){for(const[Z,ct]of this.clients.entries()){await this.destroyClient(ct,Z)}this.clients.clear()}getDefaultClientName(){return this.options["defaultClientName"]}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}getClientPriority(Z){return this.priorityManager.getPriority(this.clientPriority[Z])}isHighPriority(Z){return this.priorityManager.isHighPriority(this.clientPriority[Z])}isMediumPriority(Z){return this.priorityManager.isMediumPriority(this.clientPriority[Z])}isLowPriority(Z){return this.priorityManager.isLowPriority(this.clientPriority[Z])}}ct.ServiceFactory=ServiceFactory;pt([(0,mt.Inject)(),dt("design:type",_t.MidwayPriorityManager)],ServiceFactory.prototype,"priorityManager",void 0)},40360:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.TypedResourceManager=void 0;class TypedResourceManager{typedResourceInitializerOptions;resourceMap=new Map;resourceBindingMap=new Map;constructor(Z){this.typedResourceInitializerOptions=Z}async createResource(Z,ct){const ut=await this.typedResourceInitializerOptions.resourceInitialize(ct,Z);this.resourceMap.set(Z,ut);return ut}async init(){for(const Z of Object.keys(this.typedResourceInitializerOptions.initializeValue)){const ct=this.typedResourceInitializerOptions.initializeValue[Z];const ut=this.typedResourceInitializerOptions.initializeClzProvider[Z];const pt=await this.createResource(Z,ct);const dt=await this.typedResourceInitializerOptions.resourceBinding(ut,ct,pt,Z);if(dt){this.resourceBindingMap.set(Z,dt)}}}async startParallel(){const Z=[];for(const[ct,ut]of this.resourceMap.entries()){Z.push(this.typedResourceInitializerOptions.resourceStart(ut,this.typedResourceInitializerOptions.initializeValue[ct],this.resourceBindingMap.get(ct)))}await Promise.all(Z)}async start(){for(const[Z,ct]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceStart(ct,this.typedResourceInitializerOptions.initializeValue[Z],this.resourceBindingMap.get(Z))}}async destroyParallel(){const Z=[];for(const[ct,ut]of this.resourceMap.entries()){Z.push(this.typedResourceInitializerOptions.resourceDestroy(ut,this.typedResourceInitializerOptions.initializeValue[ct]))}await Promise.all(Z)}async destroy(){for(const[Z,ct]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceDestroy(ct,this.typedResourceInitializerOptions.initializeValue[Z])}this.resourceMap.clear();this.resourceBindingMap.clear()}getResource(Z){return this.resourceMap.get(Z)}}ct.TypedResourceManager=TypedResourceManager},59972:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.WebControllerGenerator=void 0;const pt=ut(25923);const dt=ut(39023);const ft=ut(28068);const _t=ut(22546);const mt=dt.debuglog("midway:debug");class WebControllerGenerator{app;midwayWebRouterService;constructor(Z,ct){this.app=Z;this.midwayWebRouterService=ct}generateKoaController(Z){return async(ct,ut)=>{if(Z.controllerClz&&typeof Z.method==="string"){const ut=await this.app.getFramework().runGuard(ct,Z.controllerClz,Z.method);if(!ut){throw new ft.httpError.ForbiddenError}}const dt=[ct,ut];let _t;if(typeof Z.method!=="string"){_t=await Z.method(ct,ut)}else{const ut=await ct.requestContext.getAsync(Z.id);_t=await ut[Z.method].apply(ut,dt)}if(_t!==undefined){if(_t===null){ct.response._body=null;ct.response._midwayControllerNullBody=true}else{ct.body=_t}}if(Array.isArray(Z.responseMetadata)&&Z.responseMetadata.length){for(const ut of Z.responseMetadata){switch(ut.type){case pt.WEB_RESPONSE_HTTP_CODE:ct.status=ut.code;break;case pt.WEB_RESPONSE_HEADER:for(const Z in ut?.setHeaders||{}){ct.set(Z,ut.setHeaders[Z])}break;case pt.WEB_RESPONSE_CONTENT_TYPE:ct.type=ut.contentType;break;case pt.WEB_RESPONSE_REDIRECT:ct.status=ut.code;ct.redirect(ut.url);return}}}}}async loadMidwayController(Z){const ct=await this.midwayWebRouterService.getRouterTable();const ut=await this.midwayWebRouterService.getRoutePriorityList();const pt=this.app.getApplicationContext();const dt=this.app.getCoreLogger();const ft=pt.get(_t.MidwayMiddlewareService);for(const _t of ut){pt.bindClass(_t.routerModule);dt.debug(`Load Controller "${_t.controllerId}", prefix=${_t.prefix}`);mt(`[core]: Load Controller "${_t.controllerId}", prefix=${_t.prefix}`);const ut=this.createRouter({prefix:_t.prefix,..._t.routerOptions});_t.middleware=_t.middleware??[];if(_t.middleware.length){const Z=await ft.compose(_t.middleware,this.app);ut.use(Z)}const ht=ct.get(_t.prefix);for(const Z of ht){const ct=[];Z.middleware=Z.middleware??[];if(Z.middleware.length){const ut=await ft.compose(Z.middleware,this.app);ct.push(ut)}if(this.app.getNamespace()==="koa"){if(typeof Z.url==="string"&&/\*$/.test(Z.url)){Z.url=Z.url.replace("*","(.*)")}}const pt=[Z.routerName,Z.url,...ct,this.generateController(Z)];dt.debug(`Load Router "${Z.requestMethod.toUpperCase()} ${Z.url}"`);mt(`[core]: Load Router "${Z.requestMethod.toUpperCase()} ${Z.url}"`);ut[Z.requestMethod.toLowerCase()].apply(ut,pt)}if(Z){Z(ut)}}}}ct.WebControllerGenerator=WebControllerGenerator},98727:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});const pt=ut(53386);ct["default"]=()=>{const Z=(0,pt.isDevelopmentEnvironment)((0,pt.getCurrentEnvironment)());return{core:{healthCheckTimeout:1e3,configLoadTimeout:1e4,readyTimeout:3e4,serverReadyTimeout:3e4},asyncContextManager:{enable:true},tracing:{enable:true,onError:"ignore",logOnError:false},midwayLogger:{default:{level:"info"},clients:{coreLogger:{level:Z?"info":"warn"},appLogger:{aliasName:"logger"}}},debug:{recordConfigMergeOrder:Z}}}},81680:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.SINGLETON_CONTAINER_CTX=ct.IGNORE_PATTERN=ct.DEFAULT_PATTERN=ct.MODULE_LOADER_KEY=ct.ASYNC_CONTEXT_MANAGER_KEY=ct.ASYNC_CONTEXT_KEY=ct.REQUEST_CTX_UNIQUE_KEY=ct.REQUEST_CTX_LOGGER_CACHE_KEY=ct.HTTP_SERVER_KEY=ct.CONTAINER_OBJ_SCOPE=ct.REQUEST_OBJ_CTX_KEY=ct.REQUEST_CTX_KEY=ct.MIDWAY_LOGGER_WRITEABLE_DIR=ct.FUNCTION_INJECT_KEY=ct.KEYS=void 0;ct.KEYS={REF_ELEMENT:"ref",REF_CUSTOM:"ref_custom"};ct.FUNCTION_INJECT_KEY="midway:function_inject_key";ct.MIDWAY_LOGGER_WRITEABLE_DIR="MIDWAY_LOGGER_WRITEABLE_DIR";ct.REQUEST_CTX_KEY="ctx";ct.REQUEST_OBJ_CTX_KEY="_req_ctx";ct.CONTAINER_OBJ_SCOPE="_obj_scope";ct.HTTP_SERVER_KEY="_midway_http_server";ct.REQUEST_CTX_LOGGER_CACHE_KEY="_midway_ctx_logger_cache";ct.REQUEST_CTX_UNIQUE_KEY="_midway_ctx_unique_key";ct.ASYNC_CONTEXT_KEY=Symbol("ASYNC_CONTEXT_KEY");ct.ASYNC_CONTEXT_MANAGER_KEY="MIDWAY_ASYNC_CONTEXT_MANAGER_KEY";ct.MODULE_LOADER_KEY="MIDWAY_MODULE_LOADER_KEY";ct.DEFAULT_PATTERN=["**/**.ts","**/**.js","**/**.mts","**/**.mjs","**/**.cts","**/**.cjs"];ct.IGNORE_PATTERN=["**/**.d.ts","**/**.d.mts","**/**.d.cts"];ct.SINGLETON_CONTAINER_CTX={_MAIN_CTX_:true}},84237:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ComponentConfigurationLoader=void 0;const pt=ut(25923);const dt=ut(88067);const ft=ut(12692);const _t=ut(1565);const mt=ut(39023);const ht=ut(53386);const yt=mt.debuglog("midway:debug");class ComponentConfigurationLoader{container;loadedMap=new WeakMap;namespaceList=[];constructor(Z){this.container=Z}async load(Z){let ct=pt.MAIN_MODULE_KEY;const ut=this.getConfigurationExport(Z);if(!ut.length)return;for(let Z=0;Z<ut.length;Z++){const ft=ut[Z];if(this.loadedMap.get(ft)){continue}let _t;if(dt.MetadataManager.hasOwnMetadata(pt.CONFIGURATION_OBJECT_KEY,ft)){_t=dt.MetadataManager.getOwnMetadata(pt.CONFIGURATION_OBJECT_KEY,ft)}else{_t=dt.MetadataManager.getOwnMetadata(pt.CONFIGURATION_KEY,ft)}this.loadedMap.set(ft,true);if(_t){if(_t.namespace!==undefined){ct=_t.namespace;this.namespaceList.push(ct)}yt(`[core]: load configuration in namespace="${ct}"`);this.addImports(_t.imports);this.addImportObjects(_t.importObjects);this.addImportConfigs(_t.importConfigs);this.addImportConfigFilter(_t.importConfigFilter);if(_t.detector){await _t.detector.run(this.container,ct)}pt.DecoratorManager.saveModule(pt.CONFIGURATION_KEY,{target:ft,namespace:ct})}}this.container.bindClass(Z,{namespace:ct})}loadSync(Z){let ct=pt.MAIN_MODULE_KEY;const ut=this.getConfigurationExport(Z);if(!ut.length)return;for(let Z=0;Z<ut.length;Z++){const ft=ut[Z];if(this.loadedMap.get(ft)){continue}let _t;if(dt.MetadataManager.hasOwnMetadata(pt.CONFIGURATION_OBJECT_KEY,ft)){_t=dt.MetadataManager.getOwnMetadata(pt.CONFIGURATION_OBJECT_KEY,ft)}else{_t=dt.MetadataManager.getOwnMetadata(pt.CONFIGURATION_KEY,ft)}this.loadedMap.set(ft,true);if(_t){if(_t.namespace!==undefined){ct=_t.namespace;this.namespaceList.push(ct)}yt(`[core]: load configuration in namespace="${ct}"`);this.addImports(_t.imports);this.addImportObjects(_t.importObjects);this.addImportConfigs(_t.importConfigs);this.addImportConfigFilter(_t.importConfigFilter);if(_t.detector){_t.detector.runSync(this.container,ct)}pt.DecoratorManager.saveModule(pt.CONFIGURATION_KEY,{target:ft,namespace:ct})}}this.container.bindClass(Z,{namespace:ct})}addImportConfigs(Z){if(Z){if(Array.isArray(Z)){this.container.get(ft.MidwayConfigService).add(Z)}else{this.container.get(ft.MidwayConfigService).addObject(Z)}}}addImportConfigFilter(Z){if(Z){this.container.get(ft.MidwayConfigService).addFilter(Z)}}addImports(Z=[]){for(let ct of Z){if(!ct)continue;if(typeof ct==="string"){ct=require(ct)}if("Configuration"in ct){this.load(ct)}else if("component"in ct){if(ct?.enabledEnvironment){if(ct?.enabledEnvironment?.includes(this.container.get(_t.MidwayEnvironmentService).getCurrentEnvironment())){this.load(ct.component)}}else{this.load(ct.component)}}else{this.load(ct)}}}addImportObjects(Z){if(Z){const ct=Object.keys(Z);for(const ut of ct){if(typeof Z[ut]!=="undefined"){this.container.registerObject(ut,Z[ut])}}}}getConfigurationExport(Z){const ct=[];if((0,ht.isConfigurationExport)(Z)){ct.push(Z)}else{for(const ut in Z){const pt=Z[ut];if((0,ht.isConfigurationExport)(pt)){ct.push(pt)}}}return ct}getNamespaceList(){return this.namespaceList}}ct.ComponentConfigurationLoader=ComponentConfigurationLoader},90494:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayContainer=void 0;const pt=ut(25923);const dt=ut(39023);const ft=ut(53743);const _t=ut(77866);const mt=ut(81680);const ht=ut(99648);const yt=ut(57211);const vt=ut(68454);const St=ut(24434);const bt=ut(35175);const xt=ut(53386);const $t=ut(88067);const Et=ut(4458);const Ct=dt.debuglog("midway:debug");const Tt=dt.debuglog("midway:bind");const wt=9;class MidwayContainer{_resolverFactory=null;_registry=null;_identifierMapping=null;_objectCreateEventTarget;ctx=mt.SINGLETON_CONTAINER_CTX;attrMap=new Map;namespaceSet=new Set;_id=xt.Utils.generateRandomId();get id(){return this._id}constructor(){this.registerObject(mt.REQUEST_CTX_KEY,this.ctx)}get objectCreateEventTarget(){if(!this._objectCreateEventTarget){this._objectCreateEventTarget=new St.EventEmitter}return this._objectCreateEventTarget}get registry(){if(!this._registry){this._registry=new ft.ObjectDefinitionRegistry}return this._registry}set registry(Z){this._registry=Z}get identifierMapping(){if(!this._identifierMapping){this._identifierMapping=this.registry.getIdentifierRelation()}return this._identifierMapping}addNamespace(Z){this.namespaceSet.add(Z)}bindClass(Z,ct){if(bt.Types.isClass(Z)||bt.Types.isFunction(Z)){this.bindModule(Z,ct)}else{for(const ut in Z){const pt=Z[ut];if(bt.Types.isClass(pt)||bt.Types.isFunction(pt)){this.bindModule(pt,ct)}else if(pt&&typeof pt==="object"){const Z=$t.MetadataManager.getOwnMetadata(Et.FUNCTIONAL_API_CONTROLLER_CLASS_KEY,pt)||pt[Et.FUNCTIONAL_API_CONTROLLER_CLASS_KEY];if(bt.Types.isClass(Z)){this.bindModule(Z,ct)}}}}}bind(Z,ct,ut){if(bt.Types.isClass(Z)||bt.Types.isFunction(Z)){return this.bindModule(Z,ct)}if(this.registry.hasDefinition(Z)){return}if(ut?.bindHook){ut.bindHook(ct,ut)}let dt;if(bt.Types.isClass(ct)){dt=new ht.ObjectDefinition;dt.name=pt.DecoratorManager.getProviderName(ct)}else{dt=new yt.FunctionDefinition;if(!bt.Types.isAsyncFunction(ct)){dt.asynchronous=false}dt.name=dt.id}dt.path=ct;dt.id=Z;dt.srcPath=ut?.srcPath||null;dt.namespace=ut?.namespace||"";dt.scope=ut?.scope||_t.ScopeEnum.Request;dt.createFrom=ut?.createFrom;if(dt.srcPath){Ct(`[core]: bind id "${dt.name} (${dt.srcPath}) ${Z}"`)}else{Ct(`[core]: bind id "${dt.name}" ${Z}`)}const ft=$t.MetadataManager.getPropertiesWithMetadata(pt.CONSTRUCTOR_INJECT_KEY,ct);if(ft["default"]){const Z=ft["default"].length;const ct=new Array(Z);for(const Z of ft["default"]){Tt(`${" ".repeat(wt)}inject constructor => [${JSON.stringify(Z)}]`);ct[Z.parameterIndex]=Z}dt.constructorArgs=ct}const mt=$t.MetadataManager.getPropertiesWithMetadata(pt.PROPERTY_INJECT_KEY,ct);for(const Z in mt){const ct=mt[Z];Tt(`${" ".repeat(wt)}inject properties => [${JSON.stringify(ct)}]`);dt.properties.set(ct.targetKey,ct)}const vt=$t.MetadataManager.getPropertiesWithMetadata(pt.CUSTOM_PROPERTY_INJECT_KEY,ct);for(const Z in vt){for(const ct of vt[Z]){dt.handlerProps.push(ct)}}const St=$t.MetadataManager.getPropertiesWithMetadata(pt.OBJECT_DEFINITION_KEY,ct);const xt={};for(const Z in St){Object.assign(xt,St[Z][0])}if(xt.initMethod){Tt(`${" ".repeat(wt)}register initMethod = ${xt.initMethod}`);dt.initMethod=xt.initMethod}if(xt.destroyMethod){Tt(`${" ".repeat(wt)}register destroyMethod = ${xt.destroyMethod}`);dt.destroyMethod=xt.destroyMethod}const Et=$t.MetadataManager.getOwnMetadata(pt.SCOPE_KEY,ct);if(Et){const{scope:Z,allowDowngrade:ct}=Et;Tt(`${" ".repeat(wt)}register scope = ${Z}`);dt.scope=Z;Tt(`${" ".repeat(wt)}register allowDowngrade = ${ct}`);dt.allowDowngrade=ct}this.objectCreateEventTarget.emit(_t.ObjectLifeCycleEvent.BEFORE_BIND,ct,{context:this,definition:dt,replaceCallback:Z=>{dt=Z}});if(dt){this.registry.registerDefinition(dt.id,dt)}return dt}bindModule(Z,ct){if(bt.Types.isClass(Z)){const ut=pt.DecoratorManager.getProviderUUId(Z);if(ut){this.identifierMapping.saveClassRelation(Z,ct?.namespace);return this.bind(ut,Z,ct)}else{}}else{const ut=Z[mt.FUNCTION_INJECT_KEY];if(ut&&ut.id){if(!ut.scope){ut.scope=_t.ScopeEnum.Request}const pt=xt.Utils.generateRandomId();this.identifierMapping.saveFunctionRelation(ut.id,pt);return this.bind(pt,Z,{scope:ut.scope,namespace:ct.namespace,srcPath:ct.srcPath,createFrom:ct.createFrom})}}}setAttr(Z,ct){this.attrMap.set(Z,ct)}getAttr(Z){return this.attrMap.get(Z)}getIdentifier(Z){if(typeof Z!=="string"){Z=pt.DecoratorManager.getProviderUUId(Z)}return Z}getManagedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new vt.ManagedResolverFactory(this)}return this._resolverFactory}async stop(){await this.getManagedResolverFactory().destroyCache();this.registry.clearAll();this.attrMap.clear()}get(Z,ct){return this.getManagedResolverFactory().create(Z,ct,this)}async getAsync(Z,ct){return this.getManagedResolverFactory().createAsync(Z,ct,this)}registerObject(Z,ct){this.registry.registerObject(Z,ct)}removeObject(Z){this.registry.removeObject(Z)}onBeforeBind(Z){this.objectCreateEventTarget.on(_t.ObjectLifeCycleEvent.BEFORE_BIND,Z)}onBeforeObjectCreated(Z){this.objectCreateEventTarget.on(_t.ObjectLifeCycleEvent.BEFORE_CREATED,Z)}onObjectCreated(Z){this.objectCreateEventTarget.on(_t.ObjectLifeCycleEvent.AFTER_CREATED,Z)}onObjectInit(Z){this.objectCreateEventTarget.on(_t.ObjectLifeCycleEvent.AFTER_INIT,Z)}onBeforeObjectDestroy(Z){this.objectCreateEventTarget.on(_t.ObjectLifeCycleEvent.BEFORE_DESTROY,Z)}hasNamespace(Z){return this.namespaceSet.has(Z)}getNamespaceList(){return Array.from(this.namespaceSet)}hasDefinition(Z){return this.registry.hasDefinition(Z)}getDefinition(Z){return this.registry.getDefinition(Z)}hasObject(Z){return this.registry.hasObject(Z)}getObject(Z){return this.registry.getObject(Z)}getInstanceScope(Z){if(Z[mt.CONTAINER_OBJ_SCOPE]){return Z[mt.CONTAINER_OBJ_SCOPE]}return undefined}}ct.MidwayContainer=MidwayContainer},53743:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ObjectDefinitionRegistry=void 0;const pt=ut(25923);class LegacyIdentifierRelation extends Map{saveClassRelation(Z,ct){const ut=pt.DecoratorManager.getProviderUUId(Z);this.set(ut,ut);if(ut){const dt=pt.DecoratorManager.getProviderId(Z);if(dt){this.set(dt,ut)}this.set(pt.DecoratorManager.getProviderName(Z),ut);if(ct){this.set(ct+":"+pt.DecoratorManager.getProviderName(Z),ut)}}}saveFunctionRelation(Z,ct){this.set(ct,ct);this.set(Z,ct)}hasRelation(Z){return this.has(Z)}getRelation(Z){return this.get(Z)}}class ObjectDefinitionRegistry extends Map{singletonIds=[];_identifierRelation=new LegacyIdentifierRelation;objectCache=new Map;get identifierRelation(){if(!this._identifierRelation){this._identifierRelation=new LegacyIdentifierRelation}return this._identifierRelation}set identifierRelation(Z){this._identifierRelation=Z}get identifiers(){return Array.from(this.keys())}get count(){return this.size}getSingletonDefinitionIds(){return this.singletonIds}getDefinitionByName(Z){const ct=[];for(const ut of this.values()){const pt=ut;if(pt.name===Z){ct.push(pt)}}return ct}registerDefinition(Z,ct){if(ct.isSingletonScope()){this.singletonIds.push(Z)}this.set(Z,ct)}getDefinition(Z){Z=this.identifierRelation.getRelation(Z)??Z;return this.get(Z)}removeDefinition(Z){this.delete(Z)}hasDefinition(Z){Z=this.identifierRelation.getRelation(Z)??Z;return this.has(Z)}clearAll(){this.singletonIds=[];this.objectCache.clear();this.clear()}hasObject(Z){Z=this.identifierRelation.getRelation(Z)??Z;return this.objectCache.has(Z)}registerObject(Z,ct){this.objectCache.set(Z,ct)}removeObject(Z){this.objectCache.delete(Z)}getObject(Z){Z=this.identifierRelation.getRelation(Z)??Z;return this.objectCache.get(Z)}getIdentifierRelation(){return this.identifierRelation}setIdentifierRelation(Z){this.identifierRelation=Z}}ct.ObjectDefinitionRegistry=ObjectDefinitionRegistry},3281:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.DynamicMidwayContainer=void 0;const pt=ut(90494);const dt=ut(1565);const ft=ut(53386);const _t=ut(35175);const mt=ut(25923);const ht=ut(39023);const yt=(0,ht.debuglog)("midway:container");class DynamicMidwayContainer extends pt.MidwayContainer{moduleType;modifyClassMapping=new Map;idRefMapping=new Map;constructor(){super();this.onBeforeBind(((Z,ct)=>{const ut=ct.definition;if(ut){if(ut.properties){for(const Z of ut.properties.values()){if(typeof Z.id==="string"){if(this.idRefMapping.has(Z.id)){this.idRefMapping.get(Z.id).push(ut.id)}else{this.idRefMapping.set(Z.id,[ut.id])}}}}if(ut.constructorArgs){for(const Z of ut.constructorArgs){if(typeof Z.id==="string"){if(this.idRefMapping.has(Z.id)){this.idRefMapping.get(Z.id).push(ut.id)}else{this.idRefMapping.set(Z.id,[ut.id])}}}}}}))}async updateDefinition(Z){yt("updateDefinition %s",Z);if(!this.moduleType){const Z=await this.getAsync(dt.MidwayEnvironmentService);this.moduleType=Z.getModuleLoadType()}const ct=this.findDefinitionByPath(Z);yt("oldDefinitionList size %s",ct.length);if(!ct.length){return}const ut={};for(const Z of ct){ut[Z.name]=Z.id}yt("nameList %j",ut);const pt=this.findRequireCacheAndClear(Z);for(const Z of ct){if(this.idRefMapping.has(Z.id)){for(const ct of this.idRefMapping.get(Z.id)){if(this.hasObject(ct)){this.removeObject(ct)}}}else if(this.idRefMapping.has(Z.name)){for(const ct of this.idRefMapping.get(Z.name)){if(this.hasObject(ct)){this.removeObject(ct)}}}this.removeObject(Z.id)}yt("ready to load module %s",Z);const ht=await(0,ft.loadModule)(Z,{loadMode:this.moduleType});const vt=[];if(_t.Types.isClass(ht)||_t.Types.isFunction(ht)){vt.push(ht)}else{for(const Z in ht){const ct=ht[Z];vt.push(ct)}}yt("newClassList size %s",vt.length);let St=false;if(_t.Types.isClass(ht)||_t.Types.isFunction(ht)){const ct=mt.DecoratorManager.getProviderUUId(ht);const pt=mt.DecoratorManager.getProviderName(ht);if(ut[pt]){yt("find old class name %s and will be remapping",pt);this.remapping(ut[pt],ct)}yt("bindModule %s",ct);St=true;this.bindModule(ht,{namespace:mt.MAIN_MODULE_KEY,srcPath:Z,createFrom:"file"})}else{for(const ct in ht){const pt=ht[ct];if(_t.Types.isClass(pt)||_t.Types.isFunction(pt)){const ct=mt.DecoratorManager.getProviderUUId(pt);const dt=mt.DecoratorManager.getProviderName(pt);if(ut[dt]!==ct){if(ut[dt]){yt("find old class name %s and will be remapping",dt);this.remapping(ut[dt],ct)}yt("bindModule %s",ct);St=true;this.bindModule(pt,{namespace:mt.MAIN_MODULE_KEY,srcPath:Z,createFrom:"file"})}}}}return pt&&ct.length>0&&vt.length>0&&St}getIdentifier(Z){let ct="unknown";if(typeof Z!=="string"){ct=mt.DecoratorManager.getProviderName(Z);Z=mt.DecoratorManager.getProviderUUId(Z)}yt("check identifier from %s %s",ct,Z);if(this.modifyClassMapping.has(Z)){yt("getIdentifier from modifyClassMapping %s -> %s",Z,this.modifyClassMapping.get(Z));return this.modifyClassMapping.get(Z)}return Z}findDefinitionByPath(Z){const ct=[];for(const ut of this.registry.values()){if(ut.srcPath===Z){ct.push(ut)}}return ct}findRequireCacheAndClear(Z){let ct=false;const ut=require.resolve(Z);const pt=require.cache[ut];if(pt){yt("clear cache %s",ut);delete require.cache[ut];ct=true}return ct}remapping(Z,ct){for(const[ut,pt]of this.modifyClassMapping.entries()){if(pt===Z){yt("remapping key = %s, %s -> %s",ut,Z,ct);this.modifyClassMapping.set(ut,ct)}}yt("new remapping key = %s, value = %s",Z,ct);this.modifyClassMapping.set(Z,ct)}}ct.DynamicMidwayContainer=DynamicMidwayContainer},68454:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ManagedResolverFactory=void 0;const pt=ut(81680);const dt=ut(77866);const ft=ut(39023);const _t=ut(28068);const mt=ut(57211);const ht=ft.debuglog("midway:debug");function createProxy(Z){let ct;return new Proxy({},{get(ut,pt){if(!ct){ct=Z()}return ct[pt]}})}function formatObjectIdentifier(Z){if(typeof Z==="function"){return Z()}return Z}class ManagedResolverFactory{creating=new Map;context;constructor(Z){this.context=Z}create(Z,ct=[],ut){const pt=typeof Z==="string"?Z:Z.name;Z=ut.getIdentifier(Z);ht('[core]: create "%s(%s)"',Z,pt);if(ut.hasObject(Z)){return ut.getObject(Z)}const dt=this.getObjectDefinition(Z);if(!dt&&ut!==this.context&&this.context.hasObject(Z)){return this.context.getObject(Z)}if(!dt){throw new _t.MidwayDefinitionNotFoundError(Z,pt)}const ft=[];const mt=new Map;const yt=this.createInstance(Z,pt,ct,dt,false,false,ut,mt,ft);mt.clear();const vt=this.initializeInstance(yt,dt,ft);return vt??yt}async createAsync(Z,ct=[],ut){const pt=typeof Z==="string"?Z:Z.name;Z=ut.getIdentifier(Z);ht('[core]: createAsync "%s(%s)"',Z,pt);if(ut.hasObject(Z)){return ut.getObject(Z)}const dt=this.getObjectDefinition(Z);if(!dt&&ut!==this.context&&this.context.hasObject(Z)){return this.context.getObject(Z)}if(!dt){throw new _t.MidwayDefinitionNotFoundError(Z,pt)}const ft=[];const mt=new Map;const yt=this.createInstance(Z,dt?.name??pt,ct,dt,true,false,ut,mt,ft);mt.clear();const vt=await this.initializeInstanceAsync(yt,dt,ft);return vt??yt}async destroyCache(){for(const Z of this.context.registry.getSingletonDefinitionIds()){const ct=this.getObjectDefinition(Z);if(ct.creator){const ut=this.context.getObject(Z);this.getObjectEventTarget().emit(dt.ObjectLifeCycleEvent.BEFORE_DESTROY,ut,{context:this.context,definition:ct});await ct.creator.doDestroyAsync(ut)}this.context.removeObject(Z)}this.creating.clear()}getObjectEventTarget(){return this.context.objectCreateEventTarget}checkSingletonInvokeRequest(Z,ct,ut){if(Z.isSingletonScope()){const pt=Z.properties.get(ct);if(ut.hasDefinition(pt?.id)){const ct=ut.getDefinition(pt.id);if(ct.isRequestScope()&&!ct.allowDowngrade){throw new _t.MidwaySingletonInjectRequestError(Z.path.name,ct.path.name)}}}return true}setInstanceScope(Z,ct){if(typeof Z==="object"){if(ct===dt.ScopeEnum.Request&&Z[pt.REQUEST_OBJ_CTX_KEY]===pt.SINGLETON_CONTAINER_CTX){ct=dt.ScopeEnum.Singleton}Object.defineProperty(Z,pt.CONTAINER_OBJ_SCOPE,{value:ct,writable:false,enumerable:false,configurable:false})}}createInstance(Z,ct,ut=[],ft,mt,yt,vt,St,bt,xt=new Set,$t){Z=vt.getIdentifier(Z);if(vt.hasObject(Z)){return vt.getObject(Z)}ft=ft??vt.getDefinition(Z);if(!ft&&vt!==this.context&&this.context.hasObject(Z)){return this.context.getObject(Z)}if(!ft){throw new _t.MidwayDefinitionNotFoundError(Z,ct,this.translateIdentifiers(Array.from(xt)))}if(ft.isSingletonScope()){vt=this.context;if(this.context.hasObject(ft.id)){ht(`[core]: "${ft.id}(${ft.name})" get from singleton cache.`);return this.context.getObject(ft.id)}}if(xt.has(ft.id)){if(yt){return createProxy((()=>vt.get(ft.id)))}else{const Z=Array.from(xt).concat(ft.id);throw new _t.MidwayCommonError(`Circular dependency detected: ${this.translateIdentifiers(Z).join(" -> ")}`)}}if(St.has(ft.id)){return St.get(ft.id)}xt.add(ft.id);if(ft.hasDependsOn()){for(const Z of ft.dependsOn){ht("[core]: id = %s init depend %s.",ft.id,Z);this.createInstance(Z,Z,[],undefined,mt,false,vt,St,bt,new Set(xt))}}const Et=ft.creator.load();let Ct=new Array(ft.constructorArgs.length);if(ut&&Array.isArray(ut)&&ut.length>0){Ct=ut}else{for(let Z=0;Z<ft.constructorArgs.length;Z++){const ut=ft.constructorArgs[Z];if(ut===undefined)continue;ut.id=formatObjectIdentifier(ut.id);ht('[core]: constructor arg "%s(%s)", pos=%s, in "%s".',ut.id,ut.name,ut.parameterIndex,ct);Ct[Z]=this.createInstance(ut.id,ut.name,[],undefined,mt,ut.isLazyInject,vt,St,bt,new Set(xt))}}this.getObjectEventTarget().emit(dt.ObjectLifeCycleEvent.BEFORE_CREATED,Et,{constructorArgs:Ct,context:vt});let Tt=ft.creator.doConstruct(Et,Ct);if(!Tt){throw new _t.MidwayCommonError(`${ft.id} construct return undefined`)}if(ft.isRequestScope()&&ft.constructor.name==="ObjectDefinition"){ht('[core]: "%s(%s)" inject ctx',ft.id,ft.name);Object.defineProperty(Tt,pt.REQUEST_OBJ_CTX_KEY,{value:vt.get(pt.REQUEST_CTX_KEY),writable:false,enumerable:false})}St.set(ft.id,Tt);if(ft.properties){const Z=Array.from(ft.properties.keys());for(const ut of Z){this.checkSingletonInvokeRequest(ft,ut,vt);const Z=ft.properties.get(ut);Z.id=formatObjectIdentifier(Z.id);ht('[core]: property "%s(%s)", in "%s".',Z.id||Z.name,Z.name,ct);Tt[ut]=this.createInstance(Z.id||Z.name,Z.name,Z.args,undefined,mt,Z.isLazyInject,vt,St,bt,new Set(xt),(Z=>{Tt[ut]=Z}))}}this.getObjectEventTarget().emit(dt.ObjectLifeCycleEvent.AFTER_CREATED,Tt,{context:vt,definition:ft,replaceCallback:Z=>{Tt=Z}});ht('[core]: put "%s(%s)" to pending init queue.',ft.id,ft.name);if(mt){bt.push([Tt,ft,()=>ft.creator.doInitAsync(Tt,vt),$t])}else{bt.push([Tt,ft,()=>ft.creator.doInit(Tt,vt),$t])}return Tt}initializeInstance(Z,ct,ut){const pt=new Map;const ft=new Map;for(const[ct,_t,yt,vt]of ut){if(!ft.has(_t.id)){pt.set(_t.id,ct);ht('[core]: load "%s(%s)" from pending init queue and ready to init.',_t.id,_t.name);const ut=yt?.();if(_t instanceof mt.FunctionDefinition){ft.set(_t.id,ut);vt?.(ut)}else{ft.set(_t.id,ct)}this.storeInstanceScope(ct,_t);this.getObjectEventTarget().emit(dt.ObjectLifeCycleEvent.AFTER_INIT,Z,{context:this.getCurrentMatchedContext(Z),definition:_t});pt.delete(_t.id)}}return ft.get(ct.id)}async initializeInstanceAsync(Z,ct,ut){const pt=new Map;const ft=new Map;for(const[ct,_t,yt,vt]of ut){if(!ft.has(_t.id)){pt.set(_t.id,ct);ht('[core]: load "%s(%s)" from pending init queue and ready to init.',_t.id,_t.name);const ut=await yt();if(_t instanceof mt.FunctionDefinition){ft.set(_t.id,ut);vt?.(ut)}else{ft.set(_t.id,ct)}this.storeInstanceScope(ct,_t);this.getObjectEventTarget().emit(dt.ObjectLifeCycleEvent.AFTER_INIT,Z,{context:this.getCurrentMatchedContext(Z),definition:_t});pt.delete(_t.id)}}return ft.get(ct.id)}storeInstanceScope(Z,ct){if(ct.id){if(ct.isSingletonScope()){ht(`[core]: "${ct.id}(${ct.name})" set to singleton cache`);this.context.registerObject(ct.id,Z);this.setInstanceScope(Z,dt.ScopeEnum.Singleton)}else if(ct.isRequestScope()){ht(`[core]: "${ct.id}(${ct.name})" set to register object`);this.getCurrentMatchedContext(Z).registerObject(ct.id,Z);this.setInstanceScope(Z,dt.ScopeEnum.Request)}else{this.setInstanceScope(Z,dt.ScopeEnum.Prototype)}}}getObjectDefinition(Z){return this.context.getDefinition(Z)}getCurrentMatchedContext(Z){if(Z[pt.REQUEST_OBJ_CTX_KEY]){return Z[pt.REQUEST_OBJ_CTX_KEY]?.[pt.REQUEST_CTX_UNIQUE_KEY]??this.context}return this.context}translateIdentifiers(Z){return Z.map((Z=>{const ct=this.context.getDefinition(Z);return ct.path?.name??ct.name??ct.id}))}}ct.ManagedResolverFactory=ManagedResolverFactory},22837:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.providerWrapper=providerWrapper;const pt=ut(81680);function providerWrapper(Z){for(const ct of Z){Object.defineProperty(ct.provider,pt.FUNCTION_INJECT_KEY,{value:ct,writable:false})}}},33569:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayRequestContainer=void 0;const pt=ut(81680);const dt=ut(53743);class MidwayRequestContainer{ctx;applicationContext;parent;registry=new dt.ObjectDefinitionRegistry;attrMap=new Map;constructor(Z,ct){this.ctx=Z;this.applicationContext=ct;this.parent=ct;this.registry.setIdentifierRelation(this.applicationContext.registry.getIdentifierRelation());this.registerObject(pt.REQUEST_CTX_KEY,Z);this.registerObject("res",{});if(Z.logger){this.registerObject("logger",Z.logger)}Z[pt.REQUEST_CTX_UNIQUE_KEY]=this}get(Z,ct){return this.parent.getManagedResolverFactory().create(Z,ct,this)}async getAsync(Z,ct){return this.parent.getManagedResolverFactory().createAsync(Z,ct,this)}getContext(){return this.ctx}hasDefinition(Z){return this.parent.hasDefinition(Z)}getDefinition(Z){return this.parent.getDefinition(Z)}registerObject(Z,ct){this.registry.registerObject(Z,ct)}removeObject(Z){this.registry.removeObject(Z)}hasObject(Z){return this.registry.hasObject(Z)}getObject(Z){return this.registry.getObject(Z)}setAttr(Z,ct){this.attrMap.set(Z,ct)}getAttr(Z){return this.attrMap.get(Z)}getIdentifier(Z){return this.parent.getIdentifier(Z)}getInstanceScope(Z){return this.parent.getInstanceScope(Z)}hasNamespace(Z){return this.parent.hasNamespace(Z)}}ct.MidwayRequestContainer=MidwayRequestContainer},88725:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Aspect=Aspect;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function Aspect(Z,ct,ut){return function(_t){pt.DecoratorManager.saveModule(pt.ASPECT_KEY,_t);const mt=[].concat(Z);for(const Z of mt){ft.MetadataManager.attachMetadata(pt.ASPECT_KEY,{aspectTarget:Z,match:ct,priority:ut},_t)}(0,pt.Scope)(dt.ScopeEnum.Singleton)(_t);(0,pt.Provide)()(_t)}}},70914:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Autoload=Autoload;const pt=ut(40635);const dt=ut(71652);function Autoload(){return function(Z){pt.DecoratorManager.savePreStartModule(Z);(0,dt.Provide)()(Z)}}},73567:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Configuration=Configuration;const pt=ut(25923);const dt=ut(88067);const ft=ut(77866);function Configuration(Z={}){return ct=>{Z.namespace=Z.namespace??pt.MAIN_MODULE_KEY;dt.MetadataManager.defineMetadata(pt.CONFIGURATION_KEY,Z,ct);(0,pt.Scope)(ft.ScopeEnum.Singleton)(ct);(0,pt.Provide)()(ct)}}},75227:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Catch=Catch;ct.Match=Match;const pt=ut(57347);const dt=ut(71652);const ft=ut(77866);const _t=ut(88067);const mt=ut(28017);function Catch(Z,ct={}){return function(ut){const ht=Z?[].concat(Z):undefined;_t.MetadataManager.defineMetadata(pt.CATCH_KEY,{catchTargets:ht,catchOptions:ct},ut);(0,mt.Scope)(ft.ScopeEnum.Singleton)(ut);(0,dt.Provide)()(ut)}}function Match(Z=true){return function(ct){_t.MetadataManager.defineMetadata(pt.MATCH_KEY,{matchPattern:Z},ct);(0,mt.Scope)(ft.ScopeEnum.Singleton)(ct);(0,dt.Provide)()(ct)}}},61841:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Framework=Framework;ct.Plugin=Plugin;ct.Config=Config;ct.AllConfig=AllConfig;ct.App=App;ct.MainApp=MainApp;ct.Logger=Logger;ct.ApplicationContext=ApplicationContext;const pt=ut(25923);const dt=ut(77866);function Framework(){return Z=>{pt.DecoratorManager.saveModule(pt.FRAMEWORK_KEY,Z);(0,pt.Scope)(dt.ScopeEnum.Singleton)(Z);(0,pt.Provide)()(Z)}}function Plugin(Z){return pt.DecoratorManager.createCustomPropertyDecorator(pt.PLUGIN_KEY,{identifier:Z})}function Config(Z){return pt.DecoratorManager.createCustomPropertyDecorator(pt.CONFIG_KEY,{identifier:Z})}function AllConfig(){return pt.DecoratorManager.createCustomPropertyDecorator(pt.CONFIG_KEY,{identifier:pt.ALL_VALUE_KEY})}function App(Z){return pt.DecoratorManager.createCustomPropertyDecorator(pt.APPLICATION_KEY,{type:Z})}function MainApp(){return pt.DecoratorManager.createCustomPropertyDecorator(pt.MAIN_APPLICATION_KEY,{})}function Logger(Z){return pt.DecoratorManager.createCustomPropertyDecorator(pt.LOGGER_KEY,{identifier:Z})}function ApplicationContext(){return pt.DecoratorManager.createCustomPropertyDecorator(pt.APPLICATION_CONTEXT_KEY,{})}},82056:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.UseGuard=UseGuard;ct.Guard=Guard;const pt=ut(77866);const dt=ut(57347);const ft=ut(71652);const _t=ut(88067);const mt=ut(28017);function UseGuard(Z){return(ct,ut,pt)=>{if(!Array.isArray(Z)){Z=[Z]}_t.MetadataManager.defineMetadata(dt.GUARD_KEY,Z,ct,ut)}}function Guard(){return Z=>{(0,ft.Provide)()(Z);(0,mt.Scope)(pt.ScopeEnum.Singleton)(Z)}}},35572:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.saveInjectMetadata=saveInjectMetadata;ct.Inject=Inject;ct.LazyInject=LazyInject;ct.InjectClient=InjectClient;const pt=ut(40635);const dt=ut(77866);const ft=ut(57347);const _t=ut(35175);const mt=ut(88067);const ht=ut(53386);function getConstructParamNames(Z){let ct=mt.MetadataManager.getOwnMetadata("constructorParamNames",Z);if(!ct){ct=(0,ht.getParamNames)(Z);mt.MetadataManager.defineMetadata("constructorParamNames",ct,Z)}return ct}function saveInjectMetadata(Z,ct,ut,ht=false,yt){let vt=dt.InjectModeEnum.Identifier;let St=Z;const bt=yt!==undefined;if(bt){const Z=getConstructParamNames(ct);if(!St){const ft=mt.MetadataManager.getMethodParamTypes(ct,ut);const ht=mt.MetadataManager.transformTypeFromTSDesign(ft[yt]);if(!ht.isBaseType&&(0,_t.isClass)(ht.originDesign)&&pt.DecoratorManager.isProvide(ht.originDesign)){St=pt.DecoratorManager.getProviderUUId(ht.originDesign);vt=dt.InjectModeEnum.Class}if(!St){St=Z[yt];vt=dt.InjectModeEnum.SelfName}}mt.MetadataManager.attachMetadata(ft.CONSTRUCTOR_INJECT_KEY,{targetKey:ut,id:St,name:Z[yt],injectMode:vt,isLazyInject:ht,parameterIndex:yt},ct,"default")}else{if(!St){const Z=mt.MetadataManager.transformTypeFromTSDesign(mt.MetadataManager.getPropertyType(ct,ut));if(!Z.isBaseType&&(0,_t.isClass)(Z.originDesign)&&pt.DecoratorManager.isProvide(Z.originDesign)){St=pt.DecoratorManager.getProviderUUId(Z.originDesign);vt=dt.InjectModeEnum.Class}if(!St){St=ut;vt=dt.InjectModeEnum.SelfName}}mt.MetadataManager.defineMetadata(ft.PROPERTY_INJECT_KEY,{targetKey:ut,id:St,name:ut,isLazyInject:ht,injectMode:vt},ct,ut)}}function Inject(Z){return function(ct,ut,pt){return saveInjectMetadata(Z,ct,ut,false,pt)}}function LazyInject(Z){let ct=Z;if(ct&&typeof ct!=="function"){ct=()=>Z}return function(Z,ut,pt){return saveInjectMetadata(ct,Z,ut,true,pt)}}function InjectClient(Z,ct){return pt.DecoratorManager.createCustomPropertyDecorator(ft.FACTORY_SERVICE_CLIENT_KEY,{serviceFactoryClz:Z,clientName:ct})}},16741:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Middleware=Middleware;const pt=ut(25923);const dt=ut(77866);function Middleware(){return Z=>{(0,pt.Scope)(dt.ScopeEnum.Singleton)(Z);(0,pt.Provide)()(Z)}}},35467:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Mock=Mock;const pt=ut(25923);const dt=ut(77866);function Mock(){return Z=>{pt.DecoratorManager.saveModule(pt.MOCK_KEY,Z);(0,pt.Scope)(dt.ScopeEnum.Singleton)(Z);(0,pt.Provide)()(Z)}}},13631:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Init=Init;ct.Destroy=Destroy;const pt=ut(88067);const dt=ut(57347);function Init(){return function(Z,ct){pt.MetadataManager.attachMetadata(dt.OBJECT_DEFINITION_KEY,{initMethod:ct},Z,ct)}}function Destroy(){return function(Z,ct){pt.MetadataManager.attachMetadata(dt.OBJECT_DEFINITION_KEY,{destroyMethod:ct},Z,ct)}}},88561:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Pipe=Pipe;const pt=ut(25923);const dt=ut(77866);function Pipe(){return Z=>{(0,pt.Scope)(dt.ScopeEnum.Singleton)(Z);(0,pt.Provide)()(Z)}}},71652:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Provide=Provide;const pt=ut(40635);function Provide(Z){return function(ct){pt.DecoratorManager.saveProviderId(Z,ct)}}},28017:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Scope=Scope;ct.Singleton=Singleton;const pt=ut(57347);const dt=ut(77866);const ft=ut(88067);const _t=ut(71652);function Scope(Z,ct){return function(ut){ft.MetadataManager.defineMetadata(pt.SCOPE_KEY,{scope:Z,...ct},ut)}}function Singleton(){return function(Z){Scope(dt.ScopeEnum.Singleton)(Z);(0,_t.Provide)()(Z)}}},5228:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.TRACE_KEY=void 0;ct.Trace=Trace;const pt=ut(40635);ct.TRACE_KEY="decorator:open_telemetry_key";function Trace(Z){return pt.DecoratorManager.createCustomMethodDecorator(ct.TRACE_KEY,{spanName:Z})}},57347:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MAIN_APPLICATION_KEY=ct.APPLICATION_KEY=ct.LOGGER_KEY=ct.PLUGIN_KEY=ct.CONFIG_KEY=ct.MS_HSF_METHOD_KEY=ct.MS_DUBBO_METHOD_KEY=ct.MS_GRPC_METHOD_KEY=ct.MS_PROVIDER_KEY=ct.MS_PRODUCER_KEY=ct.MS_CONSUMER_KEY=ct.WS_EVENT_KEY=ct.WS_CONTROLLER_KEY=ct.MODULE_TASK_QUEUE_OPTIONS=ct.MODULE_TASK_QUEUE_KEY=ct.MODULE_TASK_TASK_LOCAL_OPTIONS=ct.MODULE_TASK_TASK_LOCAL_KEY=ct.MODULE_TASK_METADATA=ct.MODULE_TASK_KEY=ct.WEB_RESPONSE_RENDER=ct.WEB_RESPONSE_CONTENT_TYPE=ct.WEB_RESPONSE_HEADER=ct.WEB_RESPONSE_REDIRECT=ct.WEB_RESPONSE_HTTP_CODE=ct.WEB_RESPONSE_KEY=ct.WEB_ROUTER_PARAM_KEY=ct.WEB_ROUTER_KEY=ct.CONTROLLER_KEY=ct.SERVERLESS_FUNC_KEY=ct.FUNC_KEY=ct.CUSTOM_PARAM_INJECT_KEY=ct.CUSTOM_METHOD_INJECT_KEY=ct.CUSTOM_PROPERTY_INJECT_KEY=ct.CONSTRUCTOR_INJECT_KEY=ct.PROPERTY_INJECT_KEY=ct.SCOPE_KEY=ct.PROVIDE_KEY=ct.OBJECT_DEFINITION_KEY=ct.PRE_START_MODULE_KEY=ct.FACTORY_SERVICE_CLIENT_KEY=ct.MOCK_KEY=ct.GUARD_KEY=ct.MATCH_KEY=ct.CATCH_KEY=ct.ASPECT_KEY=ct.FRAMEWORK_KEY=ct.CONFIGURATION_OBJECT_KEY=ct.CONFIGURATION_KEY=ct.SCHEDULE_KEY=ct.ALL_VALUE_KEY=void 0;ct.MAIN_MODULE_KEY=ct.CLASS_KEY_CONSTRUCTOR=ct.FUNCTIONAL_API_CONTROLLER_KEY=ct.APPLICATION_CONTEXT_KEY=void 0;ct.ALL_VALUE_KEY="common:all_value_key";ct.SCHEDULE_KEY="common:schedule";ct.CONFIGURATION_KEY="common:configuration";ct.CONFIGURATION_OBJECT_KEY="common:configuration_object";ct.FRAMEWORK_KEY="common:framework";ct.ASPECT_KEY="common:aspect";ct.CATCH_KEY="common:catch";ct.MATCH_KEY="common:match";ct.GUARD_KEY="common:guard";ct.MOCK_KEY="common:mock";ct.FACTORY_SERVICE_CLIENT_KEY="common:service_factory:client";ct.PRE_START_MODULE_KEY="common:pre_start_module";ct.OBJECT_DEFINITION_KEY="common:object_definition";ct.PROVIDE_KEY="common:provide";ct.SCOPE_KEY="common:scope";ct.PROPERTY_INJECT_KEY="common:property_inject";ct.CONSTRUCTOR_INJECT_KEY="common:constructor_inject";ct.CUSTOM_PROPERTY_INJECT_KEY="common:custom_property_inject";ct.CUSTOM_METHOD_INJECT_KEY="common:custom_method_inject";ct.CUSTOM_PARAM_INJECT_KEY="common:custom_param_inject";ct.FUNC_KEY="faas:func";ct.SERVERLESS_FUNC_KEY="faas:serverless:function";ct.CONTROLLER_KEY="web:controller";ct.WEB_ROUTER_KEY="web:router";ct.WEB_ROUTER_PARAM_KEY="web:router_param";ct.WEB_RESPONSE_KEY="web:response";ct.WEB_RESPONSE_HTTP_CODE="web:response_http_code";ct.WEB_RESPONSE_REDIRECT="web:response_redirect";ct.WEB_RESPONSE_HEADER="web:response_header";ct.WEB_RESPONSE_CONTENT_TYPE="web:response_content_type";ct.WEB_RESPONSE_RENDER="web:response_render";ct.MODULE_TASK_KEY="task:task";ct.MODULE_TASK_METADATA="task:task:options";ct.MODULE_TASK_TASK_LOCAL_KEY="task:task:task_local";ct.MODULE_TASK_TASK_LOCAL_OPTIONS="task:task:task_local:options";ct.MODULE_TASK_QUEUE_KEY="task:task:queue";ct.MODULE_TASK_QUEUE_OPTIONS="task:task:queue:options";ct.WS_CONTROLLER_KEY="ws:controller";ct.WS_EVENT_KEY="ws:event";ct.MS_CONSUMER_KEY="ms:consumer";ct.MS_PRODUCER_KEY="ms:producer";ct.MS_PROVIDER_KEY="ms:provider";ct.MS_GRPC_METHOD_KEY="ms:grpc:method";ct.MS_DUBBO_METHOD_KEY="ms:dubbo:method";ct.MS_HSF_METHOD_KEY="ms:hsf:method";ct.CONFIG_KEY="config";ct.PLUGIN_KEY="plugin";ct.LOGGER_KEY="logger";ct.APPLICATION_KEY="common:application";ct.MAIN_APPLICATION_KEY="common:main_application";ct.APPLICATION_CONTEXT_KEY="common:application_context";ct.FUNCTIONAL_API_CONTROLLER_KEY="functional:api_controller";ct.CLASS_KEY_CONSTRUCTOR="midway:class_key_constructor";ct.MAIN_MODULE_KEY="__main__"},40635:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.DecoratorManager=void 0;const pt=ut(57347);const dt=ut(44540);const ft=ut(53386);const _t=ut(53073);const mt=ut(88067);const ht=ut(35175);const yt=ut(28068);const vt=ut(39023).debuglog("midway:debug");class DecoratorManager{static moduleStore=new Map;static saveModule(Z,ct){if((0,ht.isClass)(ct)){this.saveProviderId(undefined,ct)}if(!this.moduleStore.has(Z)){this.moduleStore.set(Z,new Set)}this.moduleStore.get(Z).add(ct)}static listModule(Z,ct){const ut=[...this.moduleStore.get(Z)||[]];if(ct){return ut.filter(ct)}else{return ut}}static savePreStartModule(Z){this.saveModule(pt.PRE_START_MODULE_KEY,Z)}static listPreStartModule(){return this.listModule(pt.PRE_START_MODULE_KEY)}static resetModule(Z){this.moduleStore.set(Z,new Set)}static clearAllModule(){this.moduleStore.clear()}static saveProviderId(Z,ct){if(this.isProvide(ct)){if(Z){const ut=mt.MetadataManager.getOwnMetadata(pt.PROVIDE_KEY,ct);if(ut.id!==Z){ut.id=Z;mt.MetadataManager.defineMetadata(pt.PROVIDE_KEY,ut,ct);vt(`[core]: Update provide: ${ct.name} -> ${ut.uuid}`)}}}else{const ut=(0,ft.generateRandomId)();mt.MetadataManager.defineMetadata(pt.PROVIDE_KEY,{id:Z,originName:ct.name,uuid:ut,name:(0,dt.camelCase)(ct.name)},ct);vt(`[core]: Save provide: ${ct.name} -> ${ut}`)}return ct}static getProviderId(Z){const ct=mt.MetadataManager.getOwnMetadata(pt.PROVIDE_KEY,Z);if(ct&&ct.id){return ct.id}}static getProviderName(Z){const ct=mt.MetadataManager.getOwnMetadata(pt.PROVIDE_KEY,Z);if(ct&&ct.name){return ct.name}}static getProviderUUId(Z){const ct=mt.MetadataManager.getOwnMetadata(pt.PROVIDE_KEY,Z);if(ct&&ct.uuid){return ct.uuid}}static isProvide(Z){return!!mt.MetadataManager.getOwnMetadata(pt.PROVIDE_KEY,Z)}static createCustomPropertyDecorator(Z,ct,ut={impl:true}){const dt=typeof ut==="boolean"?{impl:ut}:ut;dt.impl=dt.impl??true;return function(ut,ft){mt.MetadataManager.attachMetadata(pt.CUSTOM_PROPERTY_INJECT_KEY,{propertyName:ft,key:Z,metadata:ct,options:dt},ut,ft)}}static createCustomMethodDecorator(Z,ct,ut={impl:true}){const dt=typeof ut==="boolean"?{impl:ut}:ut;dt.impl=dt.impl??true;return function(ut,ft){mt.MetadataManager.attachMetadata(pt.CUSTOM_METHOD_INJECT_KEY,{propertyName:ft,key:Z,metadata:ct,options:dt},ut)}}static createCustomParamDecorator(Z,ct,ut={impl:true}){if(typeof ut==="boolean"){ut={impl:ut}}if(ut.impl===undefined){ut.impl=true}return function(dt,ft,_t){mt.MetadataManager.attachMetadata(pt.CUSTOM_PARAM_INJECT_KEY,{key:Z,parameterIndex:_t,propertyName:ft,metadata:ct,options:ut},dt,ft)}}}ct.DecoratorManager=DecoratorManager;if(typeof globalThis==="object"&&globalThis["MIDWAY_GLOBAL_DECORATOR_MANAGER"]){console.warn('DecoratorManager not singleton and please check @midwayjs/core version by "npm ls @midwayjs/core"');const Z=(0,_t.getModuleRequirePathList)("@midwayjs/core");if(Z.length){console.info("The module may be located in:");Z.forEach(((Z,ct)=>{console.info(`${ct+1}. ${Z}`)}))}throw new yt.MidwayInconsistentVersionError}else{globalThis["MIDWAY_GLOBAL_DECORATOR_MANAGER"]=DecoratorManager}},6555:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ServerlessFunction=ServerlessFunction;ct.ServerlessTrigger=ServerlessTrigger;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function ServerlessFunction(Z){return(ct,ut,dt)=>{ft.MetadataManager.defineMetadata(pt.SERVERLESS_FUNC_KEY,Z,ct,ut)}}function ServerlessTrigger(Z,ct={}){return(ut,_t,mt)=>{if(Z===dt.ServerlessTriggerType.HTTP||Z===dt.ServerlessTriggerType.API_GATEWAY){ct["method"]=ct["method"]??"get"}pt.DecoratorManager.saveModule(pt.FUNC_KEY,ut.constructor);ct=ct||{};ft.MetadataManager.attachMetadata(pt.FUNC_KEY,{type:Z,methodName:_t,metadata:ct},ut)}}},25923:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.LazyInject=ct.InjectClient=ct.Inject=void 0;dt(ut(71652),ct);var ft=ut(35572);Object.defineProperty(ct,"Inject",{enumerable:true,get:function(){return ft.Inject}});Object.defineProperty(ct,"InjectClient",{enumerable:true,get:function(){return ft.InjectClient}});Object.defineProperty(ct,"LazyInject",{enumerable:true,get:function(){return ft.LazyInject}});dt(ut(28017),ct);dt(ut(88725),ct);dt(ut(70914),ct);dt(ut(73567),ct);dt(ut(13631),ct);dt(ut(61841),ct);dt(ut(75227),ct);dt(ut(16741),ct);dt(ut(82056),ct);dt(ut(88561),ct);dt(ut(35467),ct);dt(ut(5228),ct);dt(ut(6555),ct);dt(ut(68356),ct);dt(ut(75193),ct);dt(ut(35621),ct);dt(ut(84639),ct);dt(ut(57347),ct);dt(ut(40635),ct);dt(ut(35171),ct);dt(ut(63862),ct);dt(ut(32681),ct);dt(ut(49013),ct);dt(ut(2418),ct);dt(ut(77720),ct);dt(ut(27237),ct);dt(ut(61072),ct);dt(ut(78473),ct);dt(ut(30453),ct)},88067:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MetadataManager=void 0;ut(37159);const pt=ut(35175);const dt=" ";var ft;(function(Z){Z["Class"]="class";Z["Instance"]="instance";Z["Object"]="object"})(ft||(ft={}));class MetadataManager{static _metadataStore=new WeakMap;static metadataClassSymbol=Symbol.for("midway.metadata.class");static metadataPropertySymbol=Symbol.for("midway.metadata.property");static cacheSymbol=Symbol.for("midway.metadata.cache");static cleanHooksSymbol=Symbol.for("midway.clean.hooks");static isClassSymbol=Symbol.for("midway.metadata.isClass");static ObjectType=ft;static emptyValueSymbol=Symbol.for("midway.metadata.empty");static defineMetadata(Z,ct,ut,pt){ut=this.formatTarget(ut);this.setMetadata(Z,ct,ut,pt);this.invalidateCache(Z,ut,pt)}static attachMetadata(Z,ct,ut,pt){ut=this.formatTarget(ut);const dt=this.getOwnMetadata(Z,ut,pt);if(Array.isArray(dt)){dt.push(ct);this.defineMetadata(Z,dt,ut,pt)}else{this.defineMetadata(Z,[ct],ut,pt)}}static getMetadata(Z,ct,ut){ct=this.formatTarget(ct);const pt=this.getCache(Z,ct,ut);if(pt===this.emptyValueSymbol){return undefined}if(pt!==undefined){return pt}let dt=ct;while(dt){const pt=this.getOwnMetadata(Z,dt,ut);if(pt!==undefined){this.setCache(Z,ct,dt,pt,ut);return pt}dt=Object.getPrototypeOf(dt)}this.setCache(Z,ct,ct,this.emptyValueSymbol,ut);return undefined}static getOwnMetadata(Z,ct,ut){ct=this.formatTarget(ct);const pt=this.getOrCreateMetaObject(ct);if(ut){return pt[this.metadataPropertySymbol][ut]?.[Z]}else{return pt[this.metadataClassSymbol][Z]}}static hasMetadata(Z,ct,ut){ct=this.formatTarget(ct);return this.getMetadata(Z,ct,ut)!==undefined}static hasOwnMetadata(Z,ct,ut){return this.getOwnMetadata(Z,ct,ut)!==undefined}static deleteMetadata(Z,ct,ut){ct=this.formatTarget(ct);const pt=this.getOrCreateMetaObject(ct);if(ut){delete pt[this.metadataPropertySymbol][ut]?.[Z]}else{delete pt[this.metadataClassSymbol][Z]}this.invalidateCache(Z,ct,ut)}static getMetadataKeys(Z,ct){Z=this.formatTarget(Z);const ut=new Set;let pt=Z;while(pt){const Z=this.getOwnMetadataKeys(pt,ct);Z.forEach((Z=>ut.add(Z)));pt=Object.getPrototypeOf(pt)}return Array.from(ut)}static getOwnMetadataKeys(Z,ct){Z=this.formatTarget(Z);const ut=this.getOrCreateMetaObject(Z);if(ct){return Object.keys(ut[this.metadataPropertySymbol][ct]||{})}else{return Object.keys(ut[this.metadataClassSymbol])}}static copyMetadata(Z,ct,ut){const{metadataFilter:pt,overwrite:dt=true}=ut||{};const ft={};const _t={};let mt=Z;while(mt){const Z=this.getOrCreateMetaObject(mt);const ct=Z?.[this.metadataClassSymbol];for(const Z in ct){if(ft[Z]===undefined){ft[Z]=ct[Z]}}const ut=Z?.[this.metadataPropertySymbol];for(const Z in ut){if(!_t[Z]){_t[Z]={}}const ct=Object.keys(ut[Z]);for(const pt of ct){if(_t[Z][pt]===undefined){_t[Z][pt]=ut[Z][pt]}}}mt=Object.getPrototypeOf(mt)}this.copyClassAndPropertyMetadata(ct,pt,dt,ft,_t)}static copyOwnMetadata(Z,ct,ut){const{metadataFilter:pt,overwrite:dt=true}=ut||{};const ft=this.getOrCreateMetaObject(Z);const _t=ft?.[this.metadataClassSymbol];const mt=ft?.[this.metadataPropertySymbol];this.copyClassAndPropertyMetadata(ct,pt,dt,_t,mt)}static getOwnPropertiesWithMetadata(Z,ct){ct=this.formatTarget(ct);const ut=this.getOrCreateMetaObject(ct);return Object.keys(ut[this.metadataPropertySymbol]).reduce(((ct,pt)=>{const dt=ut[this.metadataPropertySymbol][pt]?.[Z];if(dt!==undefined){ct[pt]=dt}return ct}),{})}static getPropertiesWithMetadata(Z,ct){const ut={};let pt=this.formatTarget(ct);while(pt){const ct=this.getOrCreateMetaObject(pt);Object.keys(ct[this.metadataPropertySymbol]).forEach((pt=>{const dt=ct[this.metadataPropertySymbol][pt]?.[Z];if(dt!==undefined&&ut[pt]===undefined){ut[pt]=dt}}));pt=Object.getPrototypeOf(pt)}return ut}static getMethodReturnTypes(Z,ct){if((0,pt.isClass)(Z)){Z=Z.prototype}return Reflect.getMetadata("design:returntype",Z,ct)}static getMethodParamTypes(Z,ct,ut){if(ct&&(0,pt.isClass)(Z)){Z=Z.prototype}const dt=Reflect.getMetadata("design:paramtypes",Z,ct);if(ut!==undefined&&dt){return dt[ut]}return dt}static getPropertyType(Z,ct){if((0,pt.isClass)(Z)){Z=Z.prototype}return Reflect.getMetadata("design:type",Z,ct)}static transformTypeFromTSDesign(Z){if((0,pt.isNullOrUndefined)(Z)){return{name:"undefined",isBaseType:true,originDesign:Z}}switch(Z.name){case"String":return{name:"string",isBaseType:true,originDesign:Z};case"Number":return{name:"number",isBaseType:true,originDesign:Z};case"Boolean":return{name:"boolean",isBaseType:true,originDesign:Z};case"Symbol":return{name:"symbol",isBaseType:true,originDesign:Z};case"Object":return{name:"object",isBaseType:true,originDesign:Z};case"Function":return{name:"function",isBaseType:true,originDesign:Z};default:return{name:Z.name,isBaseType:false,originDesign:Z}}}static copyClassAndPropertyMetadata(Z,ct,ut,pt,dt){for(const dt in pt){if(!ct||ct(dt)){const ct=pt[dt];if(!ut&&this.hasOwnMetadata(dt,Z))continue;this.defineMetadata(dt,ct,Z)}}for(const pt in dt){const ft=Object.keys(dt[pt]);for(const _t of ft){if(!ct||ct(_t,pt)){const ct=dt[pt][_t];if(!ut&&this.hasOwnMetadata(_t,Z,pt))continue;this.defineMetadata(_t,ct,Z,pt)}}}}static setMetadata(Z,ct,ut,pt){const dt=this.getOrCreateMetaObject(ut);const ft=pt?dt[this.metadataPropertySymbol][pt]||={}:dt[this.metadataClassSymbol];ft[Z]=ct}static getOrCreateMetaObject(Z){if(!this._metadataStore.has(Z)){this._metadataStore.set(Z,{[this.metadataClassSymbol]:Object.create(null),[this.metadataPropertySymbol]:Object.create(null)})}return this._metadataStore.get(Z)}static invalidateCache(Z,ct,ut){const pt=this.getUnionKey(Z,ut);if(this.hasOwnProperty(ct,this.cacheSymbol)){delete this.getOwnProperty(ct,this.cacheSymbol)?.[pt]}const dt=this.getOwnProperty(ct,this.cleanHooksSymbol);if(dt){this.setOwnProperty(ct,this.cleanHooksSymbol,dt.filter((Z=>!Z(pt))))}}static setCache(Z,ct,ut,pt,dt){this.validCacheConstruct(ct);const ft=this.getUnionKey(Z,dt);if(ct!==ut){this.validCacheConstruct(ut);this.getOwnProperty(ut,this.cleanHooksSymbol).push((Z=>{if(Z===ft){delete this.getOwnProperty(ct,this.cacheSymbol)?.[ft];return true}return false}))}this.getOwnProperty(ct,this.cacheSymbol)[ft]=pt}static validCacheConstruct(Z){const ct=this.getOrCreateMetaObject(Z);if(!ct[this.cacheSymbol]){ct[this.cacheSymbol]=Object.create(null)}if(!ct[this.cleanHooksSymbol]){ct[this.cleanHooksSymbol]=[]}}static getCache(Z,ct,ut){return this.getOwnProperty(ct,this.cacheSymbol)?.[this.getUnionKey(Z,ut)]}static getUnionKey(Z,ct){return ct?`${ct.toString()}${dt}${Z.toString()}`:Z.toString()}static formatTarget(Z){let ct=this.getOwnProperty(Z,this.isClassSymbol);if(!ct){const ut=(0,pt.isClass)(Z);if(ut){ct=ft.Class}else if((0,pt.isClass)(Z.constructor)){ct=ft.Instance}else{ct=ft.Object}this.setOwnProperty(Z,this.isClassSymbol,ct)}return ct===ft.Instance?Z.constructor:Z}static ensureTargetType(Z,ct){const ut=this.getOwnProperty(Z,this.isClassSymbol);if(!ut){this.setOwnProperty(Z,this.isClassSymbol,ct)}}static getOwnProperty(Z,ct){const ut=this.getOrCreateMetaObject(Z);return ut[ct]??undefined}static hasOwnProperty(Z,ct){if(!this._metadataStore.has(Z)){return false}const ut=this._metadataStore.get(Z);return ut[ct]!==undefined}static setOwnProperty(Z,ct,ut){const pt=this.getOrCreateMetaObject(Z);pt[ct]=ut}static clear(){this._metadataStore=new WeakMap}}ct.MetadataManager=MetadataManager},35171:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Consumer=Consumer;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function Consumer(Z,ct={}){return ut=>{pt.DecoratorManager.saveModule(pt.MS_CONSUMER_KEY,ut);ft.MetadataManager.defineMetadata(pt.MS_CONSUMER_KEY,{type:Z,metadata:ct},ut);(0,pt.Scope)(dt.ScopeEnum.Request)(ut);(0,pt.Provide)()(ut)}}},49013:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.KafkaListener=KafkaListener;const pt=ut(25923);const dt=ut(32673);function KafkaListener(Z,ct={}){return(ut,ft)=>{ct.topic=Z;ct.propertyKey=ft;(0,dt.attachPropertyDataToClass)(pt.MS_CONSUMER_KEY,ct,ut,ft)}}},63862:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.GrpcStreamTypeEnum=void 0;ct.Provider=Provider;ct.GrpcMethod=GrpcMethod;ct.DubboMethod=DubboMethod;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function Provider(Z,ct={}){return ut=>{pt.DecoratorManager.saveModule(pt.MS_PROVIDER_KEY,ut);ft.MetadataManager.defineMetadata(pt.MS_PROVIDER_KEY,{type:Z,metadata:ct},ut);(0,pt.Scope)(dt.ScopeEnum.Request)(ut);(0,pt.Provide)()(ut)}}var _t;(function(Z){Z["BASE"]="base";Z["DUPLEX"]="ServerDuplexStream";Z["READABLE"]="ServerReadableStream";Z["WRITEABLE"]="ServerWritableStream"})(_t||(ct.GrpcStreamTypeEnum=_t={}));function GrpcMethod(Z={}){return(ct,ut,dt)=>{if(!Z.type){Z.type=_t.BASE}ft.MetadataManager.defineMetadata(pt.MS_GRPC_METHOD_KEY,{methodName:Z.methodName||ut,type:Z.type,onEnd:Z.onEnd},ct,ut);return dt}}function DubboMethod(Z){return(ct,ut,dt)=>{ft.MetadataManager.attachMetadata(pt.MS_DUBBO_METHOD_KEY,{methodName:Z||ut},ct);return dt}}},32681:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.RabbitMQListener=RabbitMQListener;const pt=ut(25923);const dt=ut(32673);function RabbitMQListener(Z,ct={}){return(ut,ft)=>{ct.queueName=Z;ct.propertyKey=ft;(0,dt.attachPropertyDataToClass)(pt.MS_CONSUMER_KEY,ct,ut,ft)}}},2418:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Queue=Queue;const pt=ut(25923);const dt=ut(57347);const ft=ut(88067);function Queue(Z){return function(ct){pt.DecoratorManager.saveModule(dt.MODULE_TASK_QUEUE_KEY,ct);ft.MetadataManager.defineMetadata(dt.MODULE_TASK_QUEUE_OPTIONS,{options:Z,name:ct.name},ct);(0,pt.Provide)()(ct)}}},61072:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Schedule=Schedule;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function Schedule(Z){return function(ct){pt.DecoratorManager.saveModule(pt.SCHEDULE_KEY,ct);ft.MetadataManager.defineMetadata(pt.SCHEDULE_KEY,Z,ct);(0,pt.Scope)(dt.ScopeEnum.Request)(ct);(0,pt.Provide)()(ct)}}},77720:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Task=Task;const pt=ut(57347);const dt=ut(40635);const ft=ut(88067);function Task(Z){return function(ct,ut,_t){dt.DecoratorManager.saveModule(pt.MODULE_TASK_KEY,ct.constructor);ft.MetadataManager.attachMetadata(pt.MODULE_TASK_METADATA,{options:Z,propertyKey:ut,value:_t.value,name:ct.constructor.name},ct)}}},27237:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.TaskLocal=TaskLocal;const pt=ut(57347);const dt=ut(40635);const ft=ut(88067);function TaskLocal(Z){return function(ct,ut,_t){dt.DecoratorManager.saveModule(pt.MODULE_TASK_TASK_LOCAL_KEY,ct.constructor);ft.MetadataManager.attachMetadata(pt.MODULE_TASK_TASK_LOCAL_OPTIONS,{options:Z,propertyKey:ut,value:_t.value},ct)}}},68356:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Controller=Controller;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function Controller(Z="/",ct={middleware:[],sensitive:true}){return ut=>{pt.DecoratorManager.saveModule(pt.CONTROLLER_KEY,ut);if(Z)ft.MetadataManager.defineMetadata(pt.CONTROLLER_KEY,{prefix:Z,routerOptions:ct},ut);(0,pt.Scope)(dt.ScopeEnum.Request)(ut);(0,pt.Provide)()(ut)}}},75193:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Fields=ct.Queries=ct.RequestIP=ct.RequestPath=ct.Files=ct.File=ct.Headers=ct.Param=ct.Query=ct.Body=ct.Session=ct.createRequestParamDecorator=ct.RouteParamTypes=void 0;const pt=ut(25923);var dt;(function(Z){Z["QUERY"]="query";Z["BODY"]="body";Z["PARAM"]="param";Z["HEADERS"]="headers";Z["SESSION"]="session";Z["FILESTREAM"]="file_stream";Z["FILESSTREAM"]="files_stream";Z["NEXT"]="next";Z["REQUEST_PATH"]="request_path";Z["REQUEST_IP"]="request_ip";Z["QUERIES"]="queries";Z["FIELDS"]="fields";Z["CUSTOM"]="custom"})(dt||(ct.RouteParamTypes=dt={}));const createParamMapping=function(Z){return(ct,ut={})=>{let dt=ct;if(Array.isArray(ct)&&ut.pipes===undefined){ut.pipes=ct;dt=undefined}return pt.DecoratorManager.createCustomParamDecorator(pt.WEB_ROUTER_PARAM_KEY,{type:Z,propertyData:dt},ut)}};const createRequestParamDecorator=function(Z,ct){ct=ct||{};if(Array.isArray(ct)){ct={pipes:ct}}return createParamMapping(dt.CUSTOM)(Z,ct)};ct.createRequestParamDecorator=createRequestParamDecorator;const Session=(Z,ct)=>createParamMapping(dt.SESSION)(Z,{pipes:ct});ct.Session=Session;const Body=(Z,ct)=>createParamMapping(dt.BODY)(Z,{pipes:ct});ct.Body=Body;const Query=(Z,ct)=>createParamMapping(dt.QUERY)(Z,{pipes:ct});ct.Query=Query;const Param=(Z,ct)=>createParamMapping(dt.PARAM)(Z,{pipes:ct});ct.Param=Param;const Headers=(Z,ct)=>createParamMapping(dt.HEADERS)(Z,{pipes:ct});ct.Headers=Headers;const File=(Z,ct)=>createParamMapping(dt.FILESTREAM)(Z,{pipes:ct});ct.File=File;const Files=(Z,ct)=>createParamMapping(dt.FILESSTREAM)(Z,{pipes:ct});ct.Files=Files;const RequestPath=Z=>createParamMapping(dt.REQUEST_PATH)(undefined,{pipes:Z});ct.RequestPath=RequestPath;const RequestIP=Z=>createParamMapping(dt.REQUEST_IP)(undefined,{pipes:Z});ct.RequestIP=RequestIP;const Queries=(Z,ct)=>createParamMapping(dt.QUERIES)(Z,{pipes:ct});ct.Queries=Queries;const Fields=(Z,ct)=>createParamMapping(dt.FIELDS)(Z,{pipes:ct});ct.Fields=Fields},35621:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.All=ct.Head=ct.Options=ct.Patch=ct.Put=ct.Del=ct.Get=ct.Post=ct.RequestMapping=ct.RequestMethod=void 0;const pt=ut(25923);const dt=ut(88067);ct.RequestMethod={GET:"get",POST:"post",PUT:"put",DELETE:"delete",PATCH:"patch",ALL:"all",OPTIONS:"options",HEAD:"head"};const ft={path:"/",requestMethod:ct.RequestMethod.GET,routerName:null,middleware:[]};const RequestMapping=(Z=ft)=>{const ut=Z.path||"/";const _t=Z.requestMethod||ct.RequestMethod.GET;const mt=Z.routerName;const ht=Z.middleware;return(ct,ft,yt)=>{const vt=Object.prototype.hasOwnProperty.call(Z,"ignoreGlobalPrefix")&&Z?.ignoreGlobalPrefix!==undefined;const St={path:ut,requestMethod:_t,routerName:mt,method:ft,middleware:ht,summary:Z?.summary||"",description:Z?.description||"",ignoreGlobalPrefix:vt?Z?.ignoreGlobalPrefix:false};Object.defineProperty(St,"__ignoreGlobalPrefixConfigured",{value:vt,enumerable:false,configurable:false,writable:false});dt.MetadataManager.attachMetadata(pt.WEB_ROUTER_KEY,St,ct);return yt}};ct.RequestMapping=RequestMapping;const createMappingDecorator=Z=>(ut,pt={middleware:[]})=>(0,ct.RequestMapping)(Object.assign(pt,{requestMethod:Z,path:ut}));ct.Post=createMappingDecorator(ct.RequestMethod.POST);ct.Get=createMappingDecorator(ct.RequestMethod.GET);ct.Del=createMappingDecorator(ct.RequestMethod.DELETE);ct.Put=createMappingDecorator(ct.RequestMethod.PUT);ct.Patch=createMappingDecorator(ct.RequestMethod.PATCH);ct.Options=createMappingDecorator(ct.RequestMethod.OPTIONS);ct.Head=createMappingDecorator(ct.RequestMethod.HEAD);ct.All=createMappingDecorator(ct.RequestMethod.ALL)},84639:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Redirect=Redirect;ct.HttpCode=HttpCode;ct.SetHeader=SetHeader;ct.ContentType=ContentType;ct.createRender=createRender;const pt=ut(25923);const dt=ut(88067);function Redirect(Z,ct=302){return(ut,ft,_t)=>{dt.MetadataManager.attachMetadata(pt.WEB_RESPONSE_KEY,{type:pt.WEB_RESPONSE_REDIRECT,url:Z,code:ct},ut,ft);return _t}}function HttpCode(Z){return(ct,ut,ft)=>{dt.MetadataManager.attachMetadata(pt.WEB_RESPONSE_KEY,{type:pt.WEB_RESPONSE_HTTP_CODE,code:Z},ct,ut);return ft}}function SetHeader(Z,ct){return(ut,ft,_t)=>{let mt={};if(ct){mt[Z]=ct}else{mt=Z}dt.MetadataManager.attachMetadata(pt.WEB_RESPONSE_KEY,{type:pt.WEB_RESPONSE_HEADER,setHeaders:mt},ut,ft);return _t}}function ContentType(Z){return(ct,ut,ft)=>{dt.MetadataManager.attachMetadata(pt.WEB_RESPONSE_KEY,{type:pt.WEB_RESPONSE_CONTENT_TYPE,contentType:Z},ct,ut);return ft}}function createRender(Z){return Z=>(ct,ut,ft)=>{dt.MetadataManager.attachMetadata(pt.WEB_RESPONSE_KEY,{type:pt.WEB_RESPONSE_RENDER,templateName:Z},ct,ut);return ft}}},78473:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.WSController=WSController;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function WSController(Z="/",ct={middleware:[],connectionMiddleware:[]}){return ut=>{pt.DecoratorManager.saveModule(pt.WS_CONTROLLER_KEY,ut);ft.MetadataManager.defineMetadata(pt.WS_CONTROLLER_KEY,{namespace:Z,routerOptions:ct},ut);(0,pt.Scope)(dt.ScopeEnum.Request)(ut);(0,pt.Provide)()(ut)}}},30453:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.OnConnection=ct.OnDisConnection=ct.Emit=ct.OnMessage=ct.WSEventTypeEnum=void 0;ct.OnWSConnection=OnWSConnection;ct.OnWSDisConnection=OnWSDisConnection;ct.OnWSMessage=OnWSMessage;ct.WSEmit=WSEmit;ct.WSBroadCast=WSBroadCast;const pt=ut(25923);const dt=ut(88067);var ft;(function(Z){Z["ON_CONNECTION"]="ws:onConnection";Z["ON_DISCONNECTION"]="ws:onDisconnection";Z["ON_MESSAGE"]="ws:onMessage";Z["ON_SOCKET_ERROR"]="ws:onSocketError";Z["EMIT"]="ws:Emit";Z["BROADCAST"]="ws:broadcast"})(ft||(ct.WSEventTypeEnum=ft={}));function OnWSConnection(Z={}){return(ct,ut,_t)=>{dt.MetadataManager.attachMetadata(pt.WS_EVENT_KEY,{eventType:ft.ON_CONNECTION,propertyName:ut,eventOptions:Z,descriptor:_t},ct.constructor)}}function OnWSDisConnection(){return(Z,ct,ut)=>{dt.MetadataManager.attachMetadata(pt.WS_EVENT_KEY,{eventType:ft.ON_DISCONNECTION,propertyName:ct,descriptor:ut},Z.constructor)}}function OnWSMessage(Z,ct={}){return(ut,_t,mt)=>{dt.MetadataManager.attachMetadata(pt.WS_EVENT_KEY,{eventType:ft.ON_MESSAGE,messageEventName:Z,propertyName:_t,eventOptions:ct,descriptor:mt},ut.constructor)}}function WSEmit(Z,ct=[]){return(ut,_t,mt)=>{dt.MetadataManager.attachMetadata(pt.WS_EVENT_KEY,{eventType:ft.EMIT,propertyName:_t,messageEventName:Z,roomName:[].concat(ct),descriptor:mt},ut.constructor)}}function WSBroadCast(Z="",ct=[]){return(ut,_t,mt)=>{dt.MetadataManager.attachMetadata(pt.WS_EVENT_KEY,{eventType:ft.BROADCAST,propertyName:_t,messageEventName:Z,roomName:[].concat(ct),descriptor:mt},ut.constructor)}}ct.OnMessage=OnWSMessage;ct.Emit=WSEmit;ct.OnDisConnection=OnWSDisConnection;ct.OnConnection=OnWSConnection},57211:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.FunctionDefinition=void 0;const pt=ut(77866);const dt=ut(35289);class FunctionWrapperCreator extends dt.ObjectCreator{type="function";doConstruct(Z,ct){return Z}doInit(Z,ct){return Z(ct)}async doInitAsync(Z,ct){return Z(ct)}}class FunctionDefinition{constructor(){this.creator=new FunctionWrapperCreator(this)}constructMethod;constructorArgs=[];creator;dependsOn;destroyMethod;export;id;name;initMethod;srcPath;path;properties;namespace="";asynchronous=true;handlerProps=[];createFrom;allowDowngrade=false;innerAutowire=false;innerScope=pt.ScopeEnum.Singleton;getAttr(Z){}hasAttr(Z){return false}hasConstructorArgs(){return false}hasDependsOn(){return false}isAsync(){return this.asynchronous}isDirect(){return false}isExternal(){return false}set scope(Z){this.innerScope=Z}isSingletonScope(){return this.innerScope===pt.ScopeEnum.Singleton}isRequestScope(){return this.innerScope===pt.ScopeEnum.Request}setAttr(Z,ct){}}ct.FunctionDefinition=FunctionDefinition},35289:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ObjectCreator=void 0;const pt=ut(28068);const dt=ut(35175);class ObjectCreator{definition;type="object";constructor(Z){this.definition=Z}load(){let Z=null;if(typeof this.definition.path==="string"){if(!this.definition.path){return Z}const ct=this.definition.path;if(this.definition.export){Z=require(ct)[this.definition.export]}else{Z=require(ct)}}else{Z=this.definition.path}return Z}doConstruct(Z,ct){if(!Z){return Object.create(null)}let ut;if(this.definition.constructMethod){ut=Z[this.definition.constructMethod].apply(Z,ct)}else{ut=Reflect.construct(Z,ct)}return ut}doInit(Z,ct){const ut=Z;if(this.definition.initMethod&&ut[this.definition.initMethod]){if(dt.Types.isGeneratorFunction(ut[this.definition.initMethod])||dt.Types.isAsyncFunction(ut[this.definition.initMethod])){throw new pt.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}else{const Z=ut[this.definition.initMethod].call(ut);if(dt.Types.isPromise(Z)){throw new pt.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}}}}async doInitAsync(Z,ct){const ut=Z;if(this.definition.initMethod&&ut[this.definition.initMethod]){const Z=ut[this.definition.initMethod];if(dt.Types.isAsyncFunction(Z)){await Z.call(ut)}else{if(Z.length===1){await new Promise((ct=>{Z.call(ut,ct)}))}else{Z.call(ut)}}}}doDestroy(Z){if(this.definition.destroyMethod&&Z[this.definition.destroyMethod]){Z[this.definition.destroyMethod].call(Z)}}async doDestroyAsync(Z){if(Z&&this.definition.destroyMethod&&Z[this.definition.destroyMethod]){const ct=Z[this.definition.destroyMethod];if(dt.Types.isAsyncFunction(ct)){await ct.call(Z)}else{if(ct.length===1){await new Promise((ut=>{ct.call(Z,ut)}))}else{ct.call(Z)}}}}}ct.ObjectCreator=ObjectCreator},99648:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ObjectDefinition=void 0;const pt=ut(77866);const dt=ut(35289);class ObjectDefinition{_attrs=new Map;_asynchronous=false;scope=pt.ScopeEnum.Singleton;creator=null;id=null;name=null;initMethod=null;destroyMethod=null;constructMethod=null;constructorArgs=[];srcPath;path=null;export=null;dependsOn=[];properties=new Map;namespace="";handlerProps=[];createFrom;allowDowngrade=false;constructor(){this.creator=new dt.ObjectCreator(this)}set asynchronous(Z){this._asynchronous=Z}isAsync(){return this._asynchronous}isSingletonScope(){return this.scope===pt.ScopeEnum.Singleton}isRequestScope(){return this.scope===pt.ScopeEnum.Request}hasDependsOn(){return this.dependsOn.length>0}hasConstructorArgs(){return this.constructorArgs.length>0}getAttr(Z){return this._attrs.get(Z)}hasAttr(Z){return this._attrs.has(Z)}setAttr(Z,ct){this._attrs.set(Z,ct)}}ct.ObjectDefinition=ObjectDefinition},16683:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayHttpError=ct.MidwayError=void 0;ct.registerErrorCode=registerErrorCode;const pt=ut(58611);const dt=new Set;function registerErrorCode(Z,ct){if(dt.has(Z)){throw new MidwayError(`Error group ${Z} is duplicated, please check before adding.`)}else{dt.add(Z)}const ut={};for(const pt in ct){ut[pt]=Z.toUpperCase()+"_"+String(ct[pt]).toUpperCase()}return ut}class MidwayError extends Error{code;cause;constructor(Z,ct,ut){super(Z);if(!ct||typeof ct==="object"){ut=ct;ct="MIDWAY_10000"}this.name=this.constructor.name;this.code=ct;this.cause=ut?.cause}}ct.MidwayError=MidwayError;class MidwayHttpError extends MidwayError{status;constructor(Z,ct,ut,dt){super(Z?typeof Z==="string"?Z:Z.message:pt.STATUS_CODES[ct],ut??String(ct),dt);if(Z&&Z["stack"]){this.stack=Z["stack"]}this.status=ct}}ct.MidwayHttpError=MidwayHttpError},70084:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayEmptyValueError=ct.MidwayInvalidConfigPropertyError=ct.MidwayMainFrameworkMissingError=ct.MidwayCodeInvokeTimeoutError=ct.MidwayInvokeForbiddenError=ct.MidwayRetryExceededMaxTimesError=ct.MidwayDuplicateControllerOptionsError=ct.MidwayDuplicateClassNameError=ct.MidwayInconsistentVersionError=ct.MidwayUtilHttpClientTimeoutError=ct.MidwayMissingImportComponentError=ct.MidwaySingletonInjectRequestError=ct.MidwayUseWrongMethodError=ct.MidwayDuplicateRouteError=ct.MidwayInvalidConfigError=ct.MidwayConfigMissingError=ct.MidwayFeatureNotImplementedError=ct.MidwayFeatureNoLongerSupportedError=ct.MidwayDefinitionNotFoundError=ct.MidwayParameterError=ct.MidwayCommonError=ct.FrameworkErrorEnum=void 0;const pt=ut(16683);ct.FrameworkErrorEnum=(0,pt.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 pt.MidwayError{constructor(Z){super(Z,ct.FrameworkErrorEnum.COMMON)}}ct.MidwayCommonError=MidwayCommonError;class MidwayParameterError extends pt.MidwayError{constructor(Z){super(Z??"Parameter type not match",ct.FrameworkErrorEnum.PARAM_TYPE)}}ct.MidwayParameterError=MidwayParameterError;class MidwayDefinitionNotFoundError extends pt.MidwayError{constructor(Z,ut,pt){super(pt?`Definition for "${ut??Z}" not found in current context. Detection path: "${pt.join(" -> ")}"`:`Definition for "${ut??Z}" not found in current context.`,ct.FrameworkErrorEnum.DEFINITION_NOT_FOUND)}}ct.MidwayDefinitionNotFoundError=MidwayDefinitionNotFoundError;class MidwayFeatureNoLongerSupportedError extends pt.MidwayError{constructor(Z){super("This feature no longer supported \n"+Z,ct.FrameworkErrorEnum.FEATURE_NO_LONGER_SUPPORTED)}}ct.MidwayFeatureNoLongerSupportedError=MidwayFeatureNoLongerSupportedError;class MidwayFeatureNotImplementedError extends pt.MidwayError{constructor(Z){super("This feature not implemented \n"+Z,ct.FrameworkErrorEnum.FEATURE_NOT_IMPLEMENTED)}}ct.MidwayFeatureNotImplementedError=MidwayFeatureNotImplementedError;class MidwayConfigMissingError extends pt.MidwayError{constructor(Z){super(`Can't found config key "${Z}" in your config, please set it first`,ct.FrameworkErrorEnum.MISSING_CONFIG)}}ct.MidwayConfigMissingError=MidwayConfigMissingError;class MidwayInvalidConfigError extends pt.MidwayError{constructor(Z){super("Invalid config file \n"+Z,ct.FrameworkErrorEnum.INVALID_CONFIG)}}ct.MidwayInvalidConfigError=MidwayInvalidConfigError;class MidwayDuplicateRouteError extends pt.MidwayError{payload;constructor(Z,ut,pt,dt){super(`Duplicate router "${Z}" at "${ut}" and "${pt}"`,ct.FrameworkErrorEnum.DUPLICATE_ROUTER);this.payload=dt}}ct.MidwayDuplicateRouteError=MidwayDuplicateRouteError;class MidwayUseWrongMethodError extends pt.MidwayError{constructor(Z,ut,pt){const dt=pt?`${pt} not valid by ${Z}, Use ${ut} instead!`:`You should not invoked by ${Z}, Use ${ut} instead!`;super(dt,ct.FrameworkErrorEnum.USE_WRONG_METHOD)}}ct.MidwayUseWrongMethodError=MidwayUseWrongMethodError;class MidwaySingletonInjectRequestError extends pt.MidwayError{constructor(Z,ut){const pt=`${Z} with singleton scope can't implicitly inject ${ut} with request scope directly, please add "@Scope(ScopeEnum.Request, { allowDowngrade: true })" in ${ut} or use "ctx.requestContext.getAsync(${ut})".`;super(pt,ct.FrameworkErrorEnum.SINGLETON_INJECT_REQUEST)}}ct.MidwaySingletonInjectRequestError=MidwaySingletonInjectRequestError;class MidwayMissingImportComponentError extends pt.MidwayError{constructor(Z){const ut=`"${Z}" can't inject and maybe forgot add "{imports: [***]}" in @Configuration.`;super(ut,ct.FrameworkErrorEnum.MISSING_IMPORTS)}}ct.MidwayMissingImportComponentError=MidwayMissingImportComponentError;class MidwayUtilHttpClientTimeoutError extends pt.MidwayError{constructor(Z){super(Z,ct.FrameworkErrorEnum.UTIL_HTTP_TIMEOUT)}}ct.MidwayUtilHttpClientTimeoutError=MidwayUtilHttpClientTimeoutError;class MidwayInconsistentVersionError extends pt.MidwayError{constructor(){const Z='We find a different "@midwayjs/core" package installed, please remove the lock file and use "(p)npm update" to upgrade all dependencies first.';super(Z,ct.FrameworkErrorEnum.INCONSISTENT_VERSION)}}ct.MidwayInconsistentVersionError=MidwayInconsistentVersionError;class MidwayDuplicateClassNameError extends pt.MidwayError{constructor(Z,ut,pt){super(`"${Z}" duplicated between "${ut}" and "${pt}"`,ct.FrameworkErrorEnum.DUPLICATE_CLASS_NAME)}}ct.MidwayDuplicateClassNameError=MidwayDuplicateClassNameError;class MidwayDuplicateControllerOptionsError extends pt.MidwayError{constructor(Z,ut,pt){super(`"Prefix ${Z}" with duplicated controller options between "${ut}" and "${pt}"`,ct.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS)}}ct.MidwayDuplicateControllerOptionsError=MidwayDuplicateControllerOptionsError;class MidwayRetryExceededMaxTimesError extends pt.MidwayError{constructor(Z,ut,pt){super(`Invoke "${Z}" retries exceeded the maximum number of times(${ut}), error: ${pt.message}`,ct.FrameworkErrorEnum.RETRY_OVER_MAX_TIME,{cause:pt})}}ct.MidwayRetryExceededMaxTimesError=MidwayRetryExceededMaxTimesError;class MidwayInvokeForbiddenError extends pt.MidwayError{constructor(Z,ut){super(`Invoke "${ut?ut.name:"unknown"}.${Z}" is forbidden.`,ct.FrameworkErrorEnum.INVOKE_METHOD_FORBIDDEN)}}ct.MidwayInvokeForbiddenError=MidwayInvokeForbiddenError;class MidwayCodeInvokeTimeoutError extends pt.MidwayError{constructor(Z,ut,pt){super(pt?`Function "${Z}" of "${pt}" call more than ${ut}ms`:`Function "${Z}" call more than ${ut}ms`,ct.FrameworkErrorEnum.CODE_INVOKE_TIMEOUT)}}ct.MidwayCodeInvokeTimeoutError=MidwayCodeInvokeTimeoutError;class MidwayMainFrameworkMissingError extends pt.MidwayError{constructor(){super("Main framework missing, please check your configuration.",ct.FrameworkErrorEnum.MAIN_FRAMEWORK_MISSING)}}ct.MidwayMainFrameworkMissingError=MidwayMainFrameworkMissingError;class MidwayInvalidConfigPropertyError extends pt.MidwayError{constructor(Z,ut){super(`Invalid config property "${Z}", ${ut?`only ${ut.join(",")} can be set`:"please check your configuration"}.`,ct.FrameworkErrorEnum.INVALID_CONFIG_PROPERTY)}}ct.MidwayInvalidConfigPropertyError=MidwayInvalidConfigPropertyError;class MidwayEmptyValueError extends pt.MidwayError{constructor(Z){super(Z??"There is an empty value got and it is not allowed.",ct.FrameworkErrorEnum.EMPTY_VALUE)}}ct.MidwayEmptyValueError=MidwayEmptyValueError},87642:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.httpError=ct.GatewayTimeoutError=ct.ServiceUnavailableError=ct.BadGatewayError=ct.NotImplementedError=ct.InternalServerErrorError=ct.TooManyRequestsError=ct.UnprocessableEntityError=ct.UnsupportedMediaTypeError=ct.PayloadTooLargeError=ct.GoneError=ct.ConflictError=ct.RequestTimeoutError=ct.NotAcceptableError=ct.ForbiddenError=ct.NotFoundError=ct.UnauthorizedError=ct.BadRequestError=ct.HttpStatus=void 0;const pt=ut(16683);var dt;(function(Z){Z[Z["CONTINUE"]=100]="CONTINUE";Z[Z["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";Z[Z["PROCESSING"]=102]="PROCESSING";Z[Z["EARLYHINTS"]=103]="EARLYHINTS";Z[Z["OK"]=200]="OK";Z[Z["CREATED"]=201]="CREATED";Z[Z["ACCEPTED"]=202]="ACCEPTED";Z[Z["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";Z[Z["NO_CONTENT"]=204]="NO_CONTENT";Z[Z["RESET_CONTENT"]=205]="RESET_CONTENT";Z[Z["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";Z[Z["AMBIGUOUS"]=300]="AMBIGUOUS";Z[Z["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";Z[Z["FOUND"]=302]="FOUND";Z[Z["SEE_OTHER"]=303]="SEE_OTHER";Z[Z["NOT_MODIFIED"]=304]="NOT_MODIFIED";Z[Z["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";Z[Z["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";Z[Z["BAD_REQUEST"]=400]="BAD_REQUEST";Z[Z["UNAUTHORIZED"]=401]="UNAUTHORIZED";Z[Z["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";Z[Z["FORBIDDEN"]=403]="FORBIDDEN";Z[Z["NOT_FOUND"]=404]="NOT_FOUND";Z[Z["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";Z[Z["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";Z[Z["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";Z[Z["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";Z[Z["CONFLICT"]=409]="CONFLICT";Z[Z["GONE"]=410]="GONE";Z[Z["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";Z[Z["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";Z[Z["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";Z[Z["URI_TOO_LONG"]=414]="URI_TOO_LONG";Z[Z["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";Z[Z["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";Z[Z["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";Z[Z["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";Z[Z["MISDIRECTED"]=421]="MISDIRECTED";Z[Z["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";Z[Z["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";Z[Z["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";Z[Z["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";Z[Z["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";Z[Z["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";Z[Z["BAD_GATEWAY"]=502]="BAD_GATEWAY";Z[Z["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";Z[Z["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";Z[Z["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(dt||(ct.HttpStatus=dt={}));class BadRequestError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.BAD_REQUEST)}}ct.BadRequestError=BadRequestError;class UnauthorizedError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.UNAUTHORIZED)}}ct.UnauthorizedError=UnauthorizedError;class NotFoundError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.NOT_FOUND)}}ct.NotFoundError=NotFoundError;class ForbiddenError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.FORBIDDEN)}}ct.ForbiddenError=ForbiddenError;class NotAcceptableError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.NOT_ACCEPTABLE)}}ct.NotAcceptableError=NotAcceptableError;class RequestTimeoutError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.REQUEST_TIMEOUT)}}ct.RequestTimeoutError=RequestTimeoutError;class ConflictError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.CONFLICT)}}ct.ConflictError=ConflictError;class GoneError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.GONE)}}ct.GoneError=GoneError;class PayloadTooLargeError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.PAYLOAD_TOO_LARGE)}}ct.PayloadTooLargeError=PayloadTooLargeError;class UnsupportedMediaTypeError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.UNSUPPORTED_MEDIA_TYPE)}}ct.UnsupportedMediaTypeError=UnsupportedMediaTypeError;class UnprocessableEntityError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.UNPROCESSABLE_ENTITY)}}ct.UnprocessableEntityError=UnprocessableEntityError;class TooManyRequestsError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.TOO_MANY_REQUESTS)}}ct.TooManyRequestsError=TooManyRequestsError;class InternalServerErrorError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.INTERNAL_SERVER_ERROR)}}ct.InternalServerErrorError=InternalServerErrorError;class NotImplementedError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.NOT_IMPLEMENTED)}}ct.NotImplementedError=NotImplementedError;class BadGatewayError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.BAD_GATEWAY)}}ct.BadGatewayError=BadGatewayError;class ServiceUnavailableError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.SERVICE_UNAVAILABLE)}}ct.ServiceUnavailableError=ServiceUnavailableError;class GatewayTimeoutError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.GATEWAY_TIMEOUT)}}ct.GatewayTimeoutError=GatewayTimeoutError;ct.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}},28068:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.httpError=ct.HttpStatus=void 0;dt(ut(16683),ct);var ft=ut(87642);Object.defineProperty(ct,"HttpStatus",{enumerable:true,get:function(){return ft.HttpStatus}});Object.defineProperty(ct,"httpError",{enumerable:true,get:function(){return ft.httpError}});dt(ut(70084),ct)},4458:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.FUNCTIONAL_API_CONTROLLER_CLASS_KEY=ct.FUNCTIONAL_API_MODULE_META_KEY=void 0;ct.FUNCTIONAL_API_MODULE_META_KEY="__midwayApiMeta";ct.FUNCTIONAL_API_CONTROLLER_CLASS_KEY="__midwayApiControllerClass"},31049:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.DynamicMidwayContainer=ct.MidwayPerformanceManager=ct.TypedResourceManager=ct.HttpServerResponse=ct.ServerResponse=ct.NetworkUtils=ct.FORMAT=ct.FileUtils=ct.PathFileUtils=ct.Types=ct.retryWith=ct.retryWithAsync=ct.extend=ct.Utils=ct.sleep=ct.isTypeScriptEnvironment=ct.wrapAsync=ct.wrapMiddleware=ct.pathMatching=ct.transformRequestObjectByType=ct.deprecatedOutput=ct.delegateTargetAllPrototypeMethod=ct.delegateTargetProperties=ct.delegateTargetMethod=ct.delegateTargetPrototypeMethod=ct.loadModule=ct.safeRequire=ct.safelyGet=ct.ASYNC_ROOT_CONTEXT=ct.MidwayPriorityManager=ct.DEFAULT_PRIORITY=ct.DataSourceManager=ct.MidwayTraceService=ct.MidwayServerlessFunctionService=ct.MidwayWebRouterService=ct.MidwayHealthService=ct.MidwayMockService=ct.MidwayDecoratorService=ct.MidwayMiddlewareService=ct.MidwayLifeCycleService=ct.MidwayAspectService=ct.MidwayFrameworkService=ct.MidwayLoggerService=ct.MidwayInformationService=ct.MidwayEnvironmentService=ct.MidwayConfigService=ct.BaseFramework=ct.MidwayRequestContainer=void 0;dt(ut(77866),ct);dt(ut(90494),ct);var ft=ut(33569);Object.defineProperty(ct,"MidwayRequestContainer",{enumerable:true,get:function(){return ft.MidwayRequestContainer}});var _t=ut(82170);Object.defineProperty(ct,"BaseFramework",{enumerable:true,get:function(){return _t.BaseFramework}});dt(ut(22837),ct);dt(ut(81680),ct);var mt=ut(12692);Object.defineProperty(ct,"MidwayConfigService",{enumerable:true,get:function(){return mt.MidwayConfigService}});var ht=ut(1565);Object.defineProperty(ct,"MidwayEnvironmentService",{enumerable:true,get:function(){return ht.MidwayEnvironmentService}});var yt=ut(7260);Object.defineProperty(ct,"MidwayInformationService",{enumerable:true,get:function(){return yt.MidwayInformationService}});var vt=ut(26966);Object.defineProperty(ct,"MidwayLoggerService",{enumerable:true,get:function(){return vt.MidwayLoggerService}});var St=ut(52590);Object.defineProperty(ct,"MidwayFrameworkService",{enumerable:true,get:function(){return St.MidwayFrameworkService}});var bt=ut(6850);Object.defineProperty(ct,"MidwayAspectService",{enumerable:true,get:function(){return bt.MidwayAspectService}});var xt=ut(10822);Object.defineProperty(ct,"MidwayLifeCycleService",{enumerable:true,get:function(){return xt.MidwayLifeCycleService}});var $t=ut(22546);Object.defineProperty(ct,"MidwayMiddlewareService",{enumerable:true,get:function(){return $t.MidwayMiddlewareService}});var Et=ut(97685);Object.defineProperty(ct,"MidwayDecoratorService",{enumerable:true,get:function(){return Et.MidwayDecoratorService}});var Ct=ut(62724);Object.defineProperty(ct,"MidwayMockService",{enumerable:true,get:function(){return Ct.MidwayMockService}});var Tt=ut(67056);Object.defineProperty(ct,"MidwayHealthService",{enumerable:true,get:function(){return Tt.MidwayHealthService}});var wt=ut(95919);Object.defineProperty(ct,"MidwayWebRouterService",{enumerable:true,get:function(){return wt.MidwayWebRouterService}});var At=ut(84766);Object.defineProperty(ct,"MidwayServerlessFunctionService",{enumerable:true,get:function(){return At.MidwayServerlessFunctionService}});var kt=ut(48757);Object.defineProperty(ct,"MidwayTraceService",{enumerable:true,get:function(){return kt.MidwayTraceService}});var It=ut(59679);Object.defineProperty(ct,"DataSourceManager",{enumerable:true,get:function(){return It.DataSourceManager}});var Nt=ut(53656);Object.defineProperty(ct,"DEFAULT_PRIORITY",{enumerable:true,get:function(){return Nt.DEFAULT_PRIORITY}});Object.defineProperty(ct,"MidwayPriorityManager",{enumerable:true,get:function(){return Nt.MidwayPriorityManager}});dt(ut(47369),ct);dt(ut(71888),ct);dt(ut(98771),ct);dt(ut(19835),ct);dt(ut(59972),ct);dt(ut(45984),ct);dt(ut(8470),ct);dt(ut(89746),ct);dt(ut(86052),ct);dt(ut(28068),ct);var Pt=ut(45213);Object.defineProperty(ct,"ASYNC_ROOT_CONTEXT",{enumerable:true,get:function(){return Pt.ASYNC_ROOT_CONTEXT}});dt(ut(25923),ct);dt(ut(40635),ct);dt(ut(57347),ct);var Ot=ut(53386);Object.defineProperty(ct,"safelyGet",{enumerable:true,get:function(){return Ot.safelyGet}});Object.defineProperty(ct,"safeRequire",{enumerable:true,get:function(){return Ot.safeRequire}});Object.defineProperty(ct,"loadModule",{enumerable:true,get:function(){return Ot.loadModule}});Object.defineProperty(ct,"delegateTargetPrototypeMethod",{enumerable:true,get:function(){return Ot.delegateTargetPrototypeMethod}});Object.defineProperty(ct,"delegateTargetMethod",{enumerable:true,get:function(){return Ot.delegateTargetMethod}});Object.defineProperty(ct,"delegateTargetProperties",{enumerable:true,get:function(){return Ot.delegateTargetProperties}});Object.defineProperty(ct,"delegateTargetAllPrototypeMethod",{enumerable:true,get:function(){return Ot.delegateTargetAllPrototypeMethod}});Object.defineProperty(ct,"deprecatedOutput",{enumerable:true,get:function(){return Ot.deprecatedOutput}});Object.defineProperty(ct,"transformRequestObjectByType",{enumerable:true,get:function(){return Ot.transformRequestObjectByType}});Object.defineProperty(ct,"pathMatching",{enumerable:true,get:function(){return Ot.pathMatching}});Object.defineProperty(ct,"wrapMiddleware",{enumerable:true,get:function(){return Ot.wrapMiddleware}});Object.defineProperty(ct,"wrapAsync",{enumerable:true,get:function(){return Ot.wrapAsync}});Object.defineProperty(ct,"isTypeScriptEnvironment",{enumerable:true,get:function(){return Ot.isTypeScriptEnvironment}});Object.defineProperty(ct,"sleep",{enumerable:true,get:function(){return Ot.sleep}});Object.defineProperty(ct,"Utils",{enumerable:true,get:function(){return Ot.Utils}});var Dt=ut(5904);Object.defineProperty(ct,"extend",{enumerable:true,get:function(){return Dt.extend}});dt(ut(9420),ct);dt(ut(9177),ct);dt(ut(57095),ct);dt(ut(38291),ct);var Ft=ut(34112);Object.defineProperty(ct,"retryWithAsync",{enumerable:true,get:function(){return Ft.retryWithAsync}});Object.defineProperty(ct,"retryWith",{enumerable:true,get:function(){return Ft.retryWith}});var Mt=ut(35175);Object.defineProperty(ct,"Types",{enumerable:true,get:function(){return Mt.Types}});var Lt=ut(53073);Object.defineProperty(ct,"PathFileUtils",{enumerable:true,get:function(){return Lt.PathFileUtils}});var Rt=ut(32587);Object.defineProperty(ct,"FileUtils",{enumerable:true,get:function(){return Rt.FileUtils}});var Bt=ut(62107);Object.defineProperty(ct,"FORMAT",{enumerable:true,get:function(){return Bt.FORMAT}});var Vt=ut(27192);Object.defineProperty(ct,"NetworkUtils",{enumerable:true,get:function(){return Vt.NetworkUtils}});var jt=ut(32525);Object.defineProperty(ct,"ServerResponse",{enumerable:true,get:function(){return jt.ServerResponse}});Object.defineProperty(ct,"HttpServerResponse",{enumerable:true,get:function(){return jt.HttpServerResponse}});var Ut=ut(40360);Object.defineProperty(ct,"TypedResourceManager",{enumerable:true,get:function(){return Ut.TypedResourceManager}});var Jt=ut(11386);Object.defineProperty(ct,"MidwayPerformanceManager",{enumerable:true,get:function(){return Jt.MidwayPerformanceManager}});var zt=ut(3281);Object.defineProperty(ct,"DynamicMidwayContainer",{enumerable:true,get:function(){return zt.DynamicMidwayContainer}});dt(ut(81248),ct);dt(ut(3145),ct);dt(ut(88067),ct);dt(ut(32673),ct)},77866:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ServiceDiscoveryHealthCheckType=ct.LoadBalancerType=ct.MidwayProcessTypeEnum=ct.ObjectLifeCycleEvent=ct.ServerlessTriggerType=ct.MSListenerType=ct.MSProviderType=ct.InjectModeEnum=ct.ScopeEnum=void 0;var ut;(function(Z){Z["Singleton"]="Singleton";Z["Request"]="Request";Z["Prototype"]="Prototype"})(ut||(ct.ScopeEnum=ut={}));var pt;(function(Z){Z["Identifier"]="Identifier";Z["Class"]="Class";Z["SelfName"]="SelfName"})(pt||(ct.InjectModeEnum=pt={}));var dt;(function(Z){Z["DUBBO"]="dubbo";Z["GRPC"]="gRPC"})(dt||(ct.MSProviderType=dt={}));var ft;(function(Z){Z["RABBITMQ"]="rabbitmq";Z["MQTT"]="mqtt";Z["KAFKA"]="kafka";Z["REDIS"]="redis"})(ft||(ct.MSListenerType=ft={}));var _t;(function(Z){Z["EVENT"]="event";Z["HTTP"]="http";Z["API_GATEWAY"]="apigw";Z["OS"]="os";Z["CDN"]="cdn";Z["LOG"]="log";Z["TIMER"]="timer";Z["MQ"]="mq";Z["KAFKA"]="kafka";Z["HSF"]="hsf";Z["MTOP"]="mtop";Z["SSR"]="ssr"})(_t||(ct.ServerlessTriggerType=_t={}));var mt;(function(Z){Z["BEFORE_BIND"]="beforeBind";Z["BEFORE_CREATED"]="beforeObjectCreated";Z["AFTER_CREATED"]="afterObjectCreated";Z["AFTER_INIT"]="afterObjectInit";Z["BEFORE_DESTROY"]="beforeObjectDestroy"})(mt||(ct.ObjectLifeCycleEvent=mt={}));var ht;(function(Z){Z["APPLICATION"]="APPLICATION";Z["AGENT"]="AGENT"})(ht||(ct.MidwayProcessTypeEnum=ht={}));ct.LoadBalancerType={RANDOM:"random",ROUND_ROBIN:"roundRobin"};ct.ServiceDiscoveryHealthCheckType={SELF:"self",TTL:"ttl",HTTP:"http",TCP:"tcp",CUSTOM:"custom"}},88136:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.TAGGED_CLS=ct.INJECT_CUSTOM_PARAM=ct.INJECT_CUSTOM_METHOD=ct.INJECT_CUSTOM_PROPERTY=ct.ALL=ct.INJECT_TAG=ct.OBJ_DEF_CLS=void 0;const pt=ut(25923);ct.OBJ_DEF_CLS=pt.OBJECT_DEFINITION_KEY;ct.INJECT_TAG=pt.PROPERTY_INJECT_KEY;ct.ALL=pt.ALL_VALUE_KEY;ct.INJECT_CUSTOM_PROPERTY=pt.CUSTOM_PROPERTY_INJECT_KEY;ct.INJECT_CUSTOM_METHOD=pt.CUSTOM_METHOD_INJECT_KEY;ct.INJECT_CUSTOM_PARAM=pt.CUSTOM_PARAM_INJECT_KEY;ct.TAGGED_CLS=pt.PROVIDE_KEY},64788:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.saveClassMetadata=saveClassMetadata;ct.attachClassMetadata=attachClassMetadata;ct.getClassExtendedMetadata=getClassExtendedMetadata;ct.getClassMetadata=getClassMetadata;ct.savePropertyDataToClass=savePropertyDataToClass;ct.attachPropertyDataToClass=attachPropertyDataToClass;ct.getPropertyDataFromClass=getPropertyDataFromClass;ct.listPropertyDataFromClass=listPropertyDataFromClass;ct.savePropertyMetadata=savePropertyMetadata;ct.attachPropertyMetadata=attachPropertyMetadata;ct.getPropertyMetadata=getPropertyMetadata;ct.savePreloadModule=savePreloadModule;ct.listPreloadModule=listPreloadModule;ct.saveModule=saveModule;ct.listModule=listModule;ct.resetModule=resetModule;ct.clearAllModule=clearAllModule;ct.saveProviderId=saveProviderId;ct.getProviderId=getProviderId;ct.getProviderName=getProviderName;ct.getProviderUUId=getProviderUUId;ct.isProvide=isProvide;ct.createCustomPropertyDecorator=createCustomPropertyDecorator;ct.createCustomMethodDecorator=createCustomMethodDecorator;ct.createCustomParamDecorator=createCustomParamDecorator;ct.getPropertyType=getPropertyType;ct.getMethodParamTypes=getMethodParamTypes;ct.savePropertyInject=savePropertyInject;ct.getPropertyInject=getPropertyInject;ct.saveObjectDefinition=saveObjectDefinition;ct.getObjectDefinition=getObjectDefinition;const pt=ut(88067);const dt=ut(25923);const ft=ut(35572);const _t=ut(88136);const mt="LEGACY_LIST_PROPERTY_DATA_KEY";function getDecoratorClsMethodPrefix(Z){return Z.toString()+"_CLS_METHOD"}function getDecoratorClsMethodKey(Z,ct){return getDecoratorClsMethodPrefix(Z)+":"+ct.toString()}function saveClassMetadata(Z,ct,ut,dt){if(dt&&typeof ct==="object"){const dt=pt.MetadataManager.getMetadata(Z,ut);if(!dt){return pt.MetadataManager.defineMetadata(Z,ct,ut)}if(Array.isArray(dt)){return pt.MetadataManager.defineMetadata(Z,dt.concat(ct),ut)}else{return pt.MetadataManager.defineMetadata(Z,Object.assign(dt,ct),ut)}}return pt.MetadataManager.defineMetadata(Z,ct,ut)}function attachClassMetadata(Z,ct,ut,dt){return pt.MetadataManager.attachMetadata(Z,ct,ut,dt)}function _getClassExtendedMetadata(Z,ct,ut,dt){const ft=pt.MetadataManager.getPropertiesWithMetadata(Z,ct);const _t={};for(const Z in ft){const ct=ft[Z];if(Array.isArray(ct)&&ct.length){_t[Z]=ct[ct.length-1]}else{_t[Z]=ct}}return _t}function getClassExtendedMetadata(Z,ct,ut,dt){const ft=pt.MetadataManager.getMetadata(Z,ct);if(ft===undefined){const pt=_getClassExtendedMetadata(Z,ct,ut,dt);if(pt){return pt}}return ft}function getClassMetadata(Z,ct){return pt.MetadataManager.getOwnMetadata(Z,ct)}function savePropertyDataToClass(Z,ct,ut,dt){const ft=getDecoratorClsMethodKey(Z,dt);const _t=pt.MetadataManager.getOwnMetadata(mt,ut)||new Map;_t.set(ft,ct);return pt.MetadataManager.defineMetadata(mt,_t,ut)}function attachPropertyDataToClass(Z,ct,ut,dt){const ft=getDecoratorClsMethodKey(Z,dt);const _t=pt.MetadataManager.getOwnMetadata(mt,ut)||new Map;if(_t.has(ft)){const Z=_t.get(ft);Z.push(ct);_t.set(ft,Z)}else{_t.set(ft,[ct])}return pt.MetadataManager.defineMetadata(mt,_t,ut)}function getPropertyDataFromClass(Z,ct,ut){const dt=getDecoratorClsMethodKey(Z,ut);const ft=pt.MetadataManager.getOwnMetadata(mt,ct);return ft&&ft.get(dt)}function listPropertyDataFromClass(Z,ct){const ut=pt.MetadataManager.getOwnMetadata(mt,ct);const dt=[];const ft=getDecoratorClsMethodPrefix(Z);for(const[Z,ct]of ut){if(Z.indexOf(ft)!==-1){dt.push(ct)}}return dt}function savePropertyMetadata(Z,ct,ut,dt){return pt.MetadataManager.defineMetadata(Z,ct,ut,dt)}function attachPropertyMetadata(Z,ct,ut,dt){return pt.MetadataManager.attachMetadata(Z,ct,ut,dt)}function getPropertyMetadata(Z,ct,ut){return pt.MetadataManager.getOwnMetadata(Z,ct,ut)}function savePreloadModule(Z){return dt.DecoratorManager.savePreStartModule(Z)}function listPreloadModule(){return dt.DecoratorManager.listPreStartModule()}function saveModule(Z,ct){return dt.DecoratorManager.saveModule(Z,ct)}function listModule(Z,ct){return dt.DecoratorManager.listModule(Z,ct)}function resetModule(Z){return dt.DecoratorManager.resetModule(Z)}function clearAllModule(){return dt.DecoratorManager.clearAllModule()}function saveProviderId(Z,ct){return dt.DecoratorManager.saveProviderId(Z,ct)}function getProviderId(Z){return dt.DecoratorManager.getProviderId(Z)}function getProviderName(Z){return dt.DecoratorManager.getProviderName(Z)}function getProviderUUId(Z){return dt.DecoratorManager.getProviderUUId(Z)}function isProvide(Z){return dt.DecoratorManager.isProvide(Z)}function createCustomPropertyDecorator(Z,ct,ut=true){return dt.DecoratorManager.createCustomPropertyDecorator(Z,ct,ut)}function createCustomMethodDecorator(Z,ct,ut={impl:true}){return dt.DecoratorManager.createCustomMethodDecorator(Z,ct,ut)}function createCustomParamDecorator(Z,ct,ut={impl:true}){return dt.DecoratorManager.createCustomParamDecorator(Z,ct,ut)}function getPropertyType(Z,ct){return pt.MetadataManager.transformTypeFromTSDesign(pt.MetadataManager.getPropertyType(Z,ct))}function getMethodParamTypes(Z,ct){return pt.MetadataManager.getMethodParamTypes(Z,ct)}function savePropertyInject(Z){(0,ft.saveInjectMetadata)(Z.identifier,Z.target,Z.targetKey)}function getPropertyInject(Z,ct){const ut=_getClassExtendedMetadata(dt.PROPERTY_INJECT_KEY,Z,undefined,ct);for(const Z in ut){const ct=ut[Z];if(Array.isArray(ct)&&ct.length){ut[Z]=ct[ct.length-1]}}return ut}function saveObjectDefinition(Z,ct={}){pt.MetadataManager.attachMetadata(_t.OBJ_DEF_CLS,ct,Z,"__fake_object_def_method");return Z}function getObjectDefinition(Z){const ct=_getClassExtendedMetadata(_t.OBJ_DEF_CLS,Z);const ut=pt.MetadataManager.getOwnMetadata(dt.SCOPE_KEY,Z);if(Array.isArray(ct)){const Z={};for(const ut of ct){Object.assign(Z,ut)}return Z}else{const Z={};for(const ut in ct){const pt=ct[ut];if(Array.isArray(pt)){for(const ct of pt){Object.assign(Z,ct)}}else{Object.assign(Z,pt)}}return Object.assign(Z,ut)}}},32673:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});dt(ut(64788),ct);dt(ut(88136),ct)},59080:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ServerResponse=void 0;class ServerResponse{ctx;isSuccess=true;constructor(Z){this.ctx=Z}static TEXT_TPL=(Z,ct,ut)=>Z;static JSON_TPL=(Z,ct,ut)=>{if(ct){return{success:"true",data:Z}}else{return{success:"false",message:Z||"fail"}}};static BLOB_TPL=(Z,ct,ut)=>Z;json(Z){return Object.getPrototypeOf(this).constructor.JSON_TPL(Z,this.isSuccess,this.ctx)}text(Z){return Object.getPrototypeOf(this).constructor.TEXT_TPL(Z,this.isSuccess,this.ctx)}blob(Z){return Object.getPrototypeOf(this).constructor.BLOB_TPL(Z,this.isSuccess,this.ctx)}success(){this.isSuccess=true;return this}fail(){this.isSuccess=false;return this}}ct.ServerResponse=ServerResponse},75801:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.HttpServerResponse=void 0;const pt=ut(79896);const dt=ut(59080);const ft=ut(61080);const _t=ut(4745);const mt=ut(16928);class HttpServerResponse extends dt.ServerResponse{constructor(Z){super(Z)}static FILE_TPL=(Z,ct,ut)=>Z;static SSE_TPL=(Z,ct)=>Z;static STREAM_TPL=(Z,ct)=>Z;static HTML_TPL=(Z,ct,ut)=>Z;status(Z){this.ctx.res.statusCode=Z;return this}header(Z,ct){this.ctx.res.setHeader(Z,ct);return this}headers(Z){if(this.ctx.res.setHeaders){this.ctx.res.setHeaders(new Map(Object.entries(Z)))}else{for(const ct in Z){this.header(ct,Z[ct])}}return this}json(Z){this.header("Content-Type","application/json");return Object.getPrototypeOf(this).constructor.JSON_TPL(Z,this.isSuccess,this.ctx)}text(Z){this.header("Content-Type","text/plain");return Object.getPrototypeOf(this).constructor.TEXT_TPL(Z,this.isSuccess,this.ctx)}file(Z,ct){this.header("Content-Type",ct||"application/octet-stream");this.header("Content-Disposition",`attachment; filename=${(0,mt.basename)(Z)}`);return Object.getPrototypeOf(this).constructor.FILE_TPL(typeof Z==="string"?(0,pt.createReadStream)(Z):Z,this.isSuccess,this.ctx)}blob(Z,ct){this.header("Content-Type",ct||"application/octet-stream");return Object.getPrototypeOf(this).constructor.BLOB_TPL(Z,this.isSuccess,this.ctx)}html(Z){this.header("Content-Type","text/html");return Object.getPrototypeOf(this).constructor.HTML_TPL(Z,this.isSuccess,this.ctx)}redirect(Z,ct=302){this.status(ct);if(this.ctx.redirect){return this.ctx.redirect(Z)}else if(this.ctx.res.redirect){return this.ctx.res.redirect(Z)}else{this.header("Location",Z)}}sse(Z={}){return new ft.ServerSendEventStream(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.SSE_TPL,...Z})}stream(Z={}){return new _t.HttpStreamResponse(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.STREAM_TPL,...Z})}}ct.HttpServerResponse=HttpServerResponse},32525:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.HttpServerResponse=ct.ServerResponse=void 0;var pt=ut(59080);Object.defineProperty(ct,"ServerResponse",{enumerable:true,get:function(){return pt.ServerResponse}});var dt=ut(75801);Object.defineProperty(ct,"HttpServerResponse",{enumerable:true,get:function(){return dt.HttpServerResponse}})},61080:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ServerSendEventStream=void 0;const pt=ut(2203);class ServerSendEventStream extends pt.Transform{ctx;isActive=false;closeEvent;options;closeHandlers=new Set;constructor(Z,ct={}){super({objectMode:true,...ct});this.ctx=Z;this.closeEvent=ct.closeEvent||"close";this.options=ct;this.ctx.req.on("close",this.handleClose.bind(this))}_transform(Z,ct,ut){try{let ct,pt="data: ";const dt=/^\s*:\s*/;const ft=[];if(!this.isActive){this.isActive=true;const Z={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(const ct in Z){this.ctx.res.setHeader(ct,Z[ct])}this.ctx.req.socket.setTimeout(0);this.ctx.req.socket.setNoDelay(true);this.ctx.req.socket.setKeepAlive(true);ft.push(": ok")}const _t=Z;if(_t.event)ft.push("event: "+_t.event);if(_t.retry)ft.push("retry: "+_t.retry);if(_t.id)ft.push("id: "+_t.id);if(typeof _t.data==="object"){ct=JSON.stringify(_t.data);ft.push(pt+ct)}else if(typeof _t.data==="undefined"){ft.push(pt)}else{_t.data=String(_t.data);if(_t.data.search(dt)!==-1){_t.data=_t.data.replace(dt,"");pt=": "}_t.data=_t.data.replace(/(\r\n|\r|\n)/g,"\n");ct=_t.data.split(/\n/);for(let Z=0,ut=ct.length;Z<ut;++Z){const dt=ct[Z];if(Z+1===ut){ft.push(pt+dt)}else{ft.push(pt+dt)}}}this.push(ft.join("\n")+"\n\n");ut()}catch(Z){this.ctx.logger.error(Z);this.sendError(Z);this.end();ut(Z)}}sendError(Z){this.send({event:"error",data:Z.message||"An error occurred"})}sendEnd(Z={}){Z.event=this.closeEvent;this.send(Z)}send(Z){super.write(this.options.tpl(Z,this.ctx))}async forward(Z,ct={}){const ut=ct.protocol||"eventsource";const abort=()=>{ct.abortController?.abort()};this.closeHandlers.add(abort);try{for await(const pt of Z){if(!this.writable||this.destroyed){break}const Z=ct.transform?await ct.transform(pt,this.ctx):pt;if(Z===null){continue}this.send(this.createForwardMessage(Z,ut))}this.sendForwardEnd(ut,ct.closeEvent)}catch(Z){if(ct.abortController?.signal.aborted||!this.writable){this.end();return}this.ctx.logger.error(Z);this.sendError(Z);this.end()}finally{this.closeHandlers.delete(abort)}}createForwardMessage(Z,ct){if(ct==="anthropic"){return{event:this.getChunkType(Z),data:this.getForwardData(Z)}}return{data:this.getForwardData(Z)}}sendForwardEnd(Z,ct){if(!this.writable||this.destroyed){return}if(Z==="openai"){this.send({data:"[DONE]"});this.end();return}if(Z==="eventsource"&&ct!==false){this.send({event:ct||this.closeEvent,data:""})}this.end()}getChunkType(Z){if(Z&&typeof Z==="object"){const ct=Z.type;if(typeof ct==="string"){return ct}}}getForwardData(Z){if(typeof Z==="string"){return Z}if(Buffer.isBuffer(Z)){return Z.toString()}if(Z&&typeof Z==="object"){return Z}return String(Z)}handleClose(){for(const Z of this.closeHandlers){Z()}this.end()}}ct.ServerSendEventStream=ServerSendEventStream},4745:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.HttpStreamResponse=void 0;const pt=ut(2203);class HttpStreamResponse extends pt.Transform{ctx;isActive=false;options;constructor(Z,ct={}){super({objectMode:true,...ct});this.ctx=Z;this.options=ct}_transform(Z,ct,ut){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 Z==="string"){this.ctx.res.write(Z)}else{this.ctx.res.write(JSON.stringify(Z))}ut()}catch(Z){this.ctx.logger.error(Z);this.end();this.ctx.res.end();ut(Z)}}send(Z){if(!this.writable){return}this.write(this.options.tpl(Z,this.ctx))}sendError(Z){this.ctx.logger.error(Z);this.end();this.ctx.res.end()}_flush(Z){this.ctx.res.end();Z()}}ct.HttpStreamResponse=HttpStreamResponse},6850:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayAspectService=void 0;const ft=ut(63268);const _t=ut(77866);const mt=ut(25923);const ht=ut(35175);const yt=ut(88067);let vt=class MidwayAspectService{applicationContext;constructor(Z){this.applicationContext=Z}async loadAspect(){const Z=mt.DecoratorManager.listModule(mt.ASPECT_KEY);let ct=[];for(const ut of Z){const Z=yt.MetadataManager.getOwnMetadata(mt.ASPECT_KEY,ut);ct=ct.concat(Z.map((Z=>{Z.aspectModule=ut;return Z})))}ct.sort(((Z,ct)=>(ct.priority||0)-(Z.priority||0)));for(const Z of ct){const ct=await this.applicationContext.getAsync(Z.aspectModule);await this.addAspect(ct,Z)}}async addAspect(Z,ct){const ut=ct.aspectTarget;const pt=Object.getOwnPropertyNames(ut.prototype);const dt=ct.match?ft(ct.match):()=>true;for(const ct of pt){if(ct==="constructor"||!dt(ct)){continue}const pt=Object.getOwnPropertyDescriptor(ut.prototype,ct);if(!pt||pt.writable===false){continue}this.interceptPrototypeMethod(ut,ct,Z)}}interceptPrototypeMethod(Z,ct,ut){const pt=Z.prototype[ct];if(ht.Types.isAsyncFunction(Z.prototype[ct])){Z.prototype[ct]=async function(...Z){let dt,ft;const newProceed=(...Z)=>pt.apply(this,Z);const _t={methodName:ct,target:this,args:Z,proceed:newProceed,proceedIsAsyncFunction:true};if(typeof ut==="function"){ut=ut()}try{await(ut.before?.(_t));if(ut.around){ft=await ut.around(_t)}else{ft=await pt.call(this,..._t.args)}_t.proceed=undefined;const Z=await(ut.afterReturn?.(_t,ft));ft=typeof Z==="undefined"?ft:Z;return ft}catch(Z){_t.proceed=undefined;dt=Z;if(ut.afterThrow){await ut.afterThrow(_t,dt)}else{throw Z}}finally{await(ut.after?.(_t,ft,dt))}}}else{Z.prototype[ct]=function(...Z){let dt,ft;const newProceed=(...Z)=>pt.apply(this,Z);const _t={methodName:ct,target:this,args:Z,proceed:newProceed,proceedIsAsyncFunction:false};if(typeof ut==="function"){ut=ut()}try{ut.before?.(_t);if(ut.around){ft=ut.around(_t)}else{ft=pt.call(this,..._t.args)}_t.proceed=undefined;const Z=ut.afterReturn?.(_t,ft);ft=typeof Z==="undefined"?ft:Z;return ft}catch(Z){_t.proceed=undefined;dt=Z;if(ut.afterThrow){ut.afterThrow(_t,dt)}else{throw Z}}finally{ut.after?.(_t,ft,dt)}}}}};ct.MidwayAspectService=vt;ct.MidwayAspectService=vt=pt([(0,mt.Provide)(),(0,mt.Scope)(_t.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],vt)},12692:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayConfigService=void 0;const ft=ut(16928);const _t=ut(77866);const mt=ut(53386);const ht=ut(79896);const yt=ut(39023);const vt=ut(1565);const St=ut(7260);const bt=ut(5904);const xt=ut(28068);const $t=ut(25923);const Et=ut(35175);const Ct=yt.debuglog("midway:debug");let Tt=class MidwayConfigService{envDirMap=new Map;aliasMap={prod:"production",unittest:"test"};configMergeOrder=[];configuration={};isReady=false;externalObject=[];appInfo;configFilterList=[];environmentService;informationService;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(Z){for(const ct of Z){if(typeof ct==="string"){if(/\.\w+$/.test(ct)){const Z=this.getConfigEnv(ct);const ut=this.getEnvSet(Z);ut.add(ct);if(this.aliasMap[Z]){this.getEnvSet(this.aliasMap[Z]).add(ct)}}else{const Z=(0,ht.statSync)(ct);if(Z.isDirectory()){const Z=(0,ht.readdirSync)(ct);this.add(Z.map((Z=>(0,ft.join)(ct,Z))))}}}else{for(const Z in ct){this.getEnvSet(Z).add(ct[Z]);if(this.aliasMap[Z]){this.getEnvSet(this.aliasMap[Z]).add(ct[Z])}}}}}addObject(Z,ct=false){if(this.isReady){Z=this.runWithFilter(Z);if(!Z){Ct("[config]: Filter config and got undefined will be drop it");return}this.configMergeOrder.push({env:"default",extraPath:"",value:Z});if(ct){this.configuration=(0,bt.extend)(true,Z,this.configuration)}else{(0,bt.extend)(true,this.configuration,Z)}}else{this.externalObject.push(Z)}}getEnvSet(Z){if(!this.envDirMap.has(Z)){this.envDirMap.set(Z,new Set)}return this.envDirMap.get(Z)}getConfigEnv(Z){const ct=(0,ft.basename)(Z);const ut=ct.split(".");const pt=ut.pop();if(pt!=="js"&&pt!=="ts"){return pt}return ut.pop()}load(){if(this.isReady)return;const Z=this.getEnvSet("default");const ct=this.getEnvSet(this.environmentService.getCurrentEnvironment());const ut={};const pt=Z.size;for(const[dt,ft]of[...Z,...ct].entries()){let Z=this.loadConfig(ft);if(Et.Types.isFunction(Z)){Z=Z.apply(null,[this.appInfo,ut])}if(!Z){continue}Z=this.runWithFilter(Z);if(!Z){Ct("[config]: Filter config and got undefined will be drop it");continue}if(typeof ft==="string"){Ct("[config]: Loaded config %s, %j",ft,Z)}else{Ct("[config]: Loaded config %j",Z)}this.configMergeOrder.push({env:dt<pt?"default":this.environmentService.getCurrentEnvironment(),extraPath:ft,value:Z});(0,bt.extend)(true,ut,Z)}if(this.externalObject.length){for(let Z of this.externalObject){if(Z){Z=this.runWithFilter(Z);if(!Z){Ct("[config]: Filter config and got undefined will be drop it");continue}Ct("[config]: Loaded external object %j",Z);(0,bt.extend)(true,ut,Z);this.configMergeOrder.push({env:"default",extraPath:"",value:Z})}}}this.configuration=ut;this.isReady=true}getConfiguration(Z,ct){if(Z){const ut=(0,mt.safelyGet)(Z,this.configuration);return ut===undefined?ct:ut}return this.configuration}getConfigMergeOrder(){return this.configMergeOrder}loadConfig(Z){let ct=typeof Z==="string"?require(Z):Z;if(ct&&ct.__esModule){if(ct&&ct.default){if(Object.keys(ct).length>1){throw new xt.MidwayInvalidConfigError(`${Z} should not have both a default export and named export`)}ct=ct.default}}return ct}clearAllConfig(){this.configuration={}}clearConfigMergeOrder(){this.configMergeOrder.length=0}addFilter(Z){this.configFilterList.push(Z)}runWithFilter(Z){for(const ct of this.configFilterList){Ct(`[config]: Filter config by filter = "${ct.name||"anonymous filter"}"`);Z=ct(Z);Ct("[config]: Filter config result = %j",Z)}return Z}getAppInfo(){return this.appInfo}};ct.MidwayConfigService=Tt;pt([(0,$t.Inject)(),dt("design:type",vt.MidwayEnvironmentService)],Tt.prototype,"environmentService",void 0);pt([(0,$t.Inject)(),dt("design:type",St.MidwayInformationService)],Tt.prototype,"informationService",void 0);pt([(0,$t.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",void 0)],Tt.prototype,"init",null);ct.MidwayConfigService=Tt=pt([(0,$t.Provide)(),(0,$t.Scope)(_t.ScopeEnum.Singleton)],Tt)},97685:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayDecoratorService=void 0;const ft=ut(25923);const _t=ut(77866);const mt=ut(6850);const ht=ut(28068);const yt=ut(39023);const vt=ut(35175);const St=ut(88067);const bt=yt.debuglog("midway:debug");let xt=class MidwayDecoratorService{applicationContext;propertyHandlerMap=new Map;methodDecoratorMap=new Map;parameterDecoratorMap=new Map;parameterDecoratorPipes=new Map;aspectService;constructor(Z){this.applicationContext=Z}init(){this.applicationContext.onBeforeBind((Z=>{bt(`[core]: Bind class ${Z.name} in decorator service`);const ct=St.MetadataManager.getMetadata(ft.CUSTOM_METHOD_INJECT_KEY,Z);if(ct){bt(`[core]: Find method decorator metadata in ${Z.name}`);for(const ut of ct){const{propertyName:ct,key:pt,metadata:dt,options:ft}=ut;if(!ft||!ft.impl){continue}this.aspectService.interceptPrototypeMethod(Z,ct,(()=>{const ut=this.methodDecoratorMap.get(pt);if(!ut){throw new ht.MidwayCommonError(`Method Decorator "${pt}" handler not found, please register first.`)}return ut({target:Z,propertyName:ct,metadata:dt})}))}}const ut=St.MetadataManager.getOwnPropertiesWithMetadata(ft.CUSTOM_PARAM_INJECT_KEY,Z);if(ut){bt(`[core]: Find parameter decorator metadata in ${Z.name}`);for(const ct of Object.keys(ut)){this.aspectService.interceptPrototypeMethod(Z,ct,(()=>({before:async pt=>{const dt=[...pt.args];for(const ft of ut[ct]){const{propertyName:ct,key:ut,metadata:_t,parameterIndex:mt,options:yt}=ft;let xt;if(yt&&yt.impl){xt=this.parameterDecoratorMap.get(ut);if(!xt){throw new ht.MidwayCommonError(`Parameter Decorator "${ut}" handler not found, please register first.`)}}else{xt=async({parameterIndex:Z,originArgs:ct})=>ct[Z]}const $t=St.MetadataManager.getMethodParamTypes(Z,ct);let Et=false;try{dt[mt]=await xt({metadata:_t,propertyName:ct,parameterIndex:mt,target:Z,originArgs:dt,originParamType:$t[mt],instance:pt.target})}catch(Z){Et=true;if(yt?.throwError===true){throw Z}else{bt(`[core]: Parameter decorator throw error and use origin args, ${Z.stack}`)}}if(Et){continue}const Ct=[...this.parameterDecoratorPipes.get(ut)||[],...yt?.pipes||[]];for(const Z of Ct){let ct;if("transform"in Z){ct=Z["transform"].bind(Z)}else if((0,vt.isClass)(Z)){const ut=await this.applicationContext.getAsync(Z);ct=ut.transform.bind(ut)}else if(typeof Z==="function"){ct=Z}else{throw new ht.MidwayParameterError("Pipe must be a function or implement PipeTransform interface")}dt[mt]=await ct(dt[mt],{metaType:St.MetadataManager.transformTypeFromTSDesign($t[mt]),metadata:_t,target:pt.target,methodName:pt.methodName})}}pt.args=dt}})))}}}));this.applicationContext.onObjectCreated(((Z,ct)=>{if(this.propertyHandlerMap.size>0&&Array.isArray(ct.definition.handlerProps)){for(const ut of ct.definition.handlerProps){this.defineGetterPropertyValue(ut,Z,this.getHandler(ut.key))}}}));this.registerPropertyHandler(ft.APPLICATION_CONTEXT_KEY,((Z,ct)=>this.applicationContext))}registerPropertyHandler(Z,ct){bt(`[core]: Register property decorator key="${Z}"`);this.propertyHandlerMap.set(Z,ct)}registerMethodHandler(Z,ct){bt(`[core]: Register method decorator key="${Z}"`);this.methodDecoratorMap.set(Z,ct)}registerParameterHandler(Z,ct){bt(`[core]: Register parameter decorator key="${Z}"`);this.parameterDecoratorMap.set(Z,ct)}registerParameterPipes(Z,ct){if(!this.parameterDecoratorPipes.has(Z)){this.parameterDecoratorPipes.set(Z,[])}this.parameterDecoratorPipes.set(Z,this.parameterDecoratorPipes.get(Z).concat(ct))}defineGetterPropertyValue(Z,ct,ut){if(Z&&ut){if(Z.propertyName){Object.defineProperty(ct,Z.propertyName,{get:()=>ut(Z.propertyName,Z.metadata??{},ct),configurable:true,enumerable:true})}}}getHandler(Z){if(this.propertyHandlerMap.has(Z)){return this.propertyHandlerMap.get(Z)}}};ct.MidwayDecoratorService=xt;pt([(0,ft.Inject)(),dt("design:type",mt.MidwayAspectService)],xt.prototype,"aspectService",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",void 0)],xt.prototype,"init",null);ct.MidwayDecoratorService=xt=pt([(0,ft.Provide)(),(0,ft.Scope)(_t.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],xt)},1565:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayEnvironmentService=void 0;const dt=ut(77866);const ft=ut(53386);const _t=ut(25923);let mt=class MidwayEnvironmentService{environment;moduleLoadType="commonjs";getCurrentEnvironment(){if(!this.environment){this.environment=(0,ft.getCurrentEnvironment)()}return this.environment}setCurrentEnvironment(Z){this.environment=Z}isDevelopmentEnvironment(){return(0,ft.isDevelopmentEnvironment)(this.environment)}setModuleLoadType(Z){this.moduleLoadType=Z}getModuleLoadType(){return this.moduleLoadType}isPkgEnvironment(){return typeof process["pkg"]!=="undefined"}};ct.MidwayEnvironmentService=mt;ct.MidwayEnvironmentService=mt=pt([(0,_t.Provide)(),(0,_t.Scope)(dt.ScopeEnum.Singleton)],mt)},52590:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayFrameworkService=void 0;const ft=ut(25923);const _t=ut(77866);const mt=ut(12692);const ht=ut(26966);const yt=ut(82170);const vt=ut(97685);const St=ut(6850);const bt=ut(89746);const xt=ut(39023);const $t=ut(28068);const Et=ut(11386);const Ct=xt.debuglog("midway:debug");let Tt=class MidwayFrameworkService{applicationContext;globalOptions;configService;loggerService;aspectService;decoratorService;applicationManager;constructor(Z,ct){this.applicationContext=Z;this.globalOptions=ct}mainFramework;globalFrameworkList=[];async init(){this.decoratorService.registerPropertyHandler(ft.CONFIG_KEY,((Z,ct)=>{if(ct.identifier===ft.ALL_VALUE_KEY){return this.configService.getConfiguration()}else{return this.configService.getConfiguration(ct.identifier??Z)}}));this.decoratorService.registerPropertyHandler(ft.LOGGER_KEY,((Z,ct)=>this.loggerService.getLogger(ct.identifier??Z)));this.decoratorService.registerPropertyHandler(ft.APPLICATION_KEY,((Z,ct)=>{if(ct.type){const Z=this.applicationManager.getApplication(ct.type);if(!Z){throw new $t.MidwayCommonError(`Framework ${ct.type} not Found`)}return Z}else{return this.getMainApp()}}));this.decoratorService.registerPropertyHandler(ft.MAIN_APPLICATION_KEY,((Z,ct)=>this.getMainApp()));this.decoratorService.registerPropertyHandler(ft.PLUGIN_KEY,((Z,ct)=>this.getMainApp()[ct.identifier??Z]));this.decoratorService.registerPropertyHandler(ft.FACTORY_SERVICE_CLIENT_KEY,((Z,ct)=>{const ut=this.applicationContext.get(ct.serviceFactoryClz);const pt=ct.clientName||ut.getDefaultClientName();if(pt&&ut.has(pt)){return ut.get(pt)}else{if(!pt){throw new $t.MidwayParameterError(`Please set clientName or options.defaultClientName for ${ct.serviceFactoryClz.name}).`)}else{throw new $t.MidwayParameterError(`ClientName(${pt} not found in ${ct.serviceFactoryClz.name}).`)}}}));let Z=ft.DecoratorManager.listModule(ft.FRAMEWORK_KEY);Z=filterProtoFramework(Z);Ct(`[core]: Found Framework length = ${Z.length}`);if(Z.length){for(const ct of Z){if(!this.applicationContext.hasDefinition(ft.DecoratorManager.getProviderUUId(ct))){Ct(`[core]: Found Framework "${ct.name}" but missing definition, skip initialize.`);continue}const Z=await this.applicationContext.getAsync(ct,[this.applicationContext]);if(Z.isEnable()){Et.MidwayInitializerPerformanceManager.frameworkInitializeStart(Z.getFrameworkName());await Z.initialize({applicationContext:this.applicationContext,namespace:Z.getNamespace(),...this.globalOptions});Et.MidwayInitializerPerformanceManager.frameworkInitializeEnd(Z.getFrameworkName());Ct(`[core]: Found Framework "${Z.getFrameworkName()}" and initialize.`)}else{Ct(`[core]: Found Framework "${Z.getFrameworkName()}" and delay initialize.`)}const ut=this.applicationContext.registry.getDefinition(ft.DecoratorManager.getProviderUUId(ct));Z.setNamespace(ut?.namespace);this.applicationManager.addFramework(Z.getFrameworkName()??ut?.namespace,Z);if(ut?.namespace&&!this.applicationManager.hasFramework(ut.namespace)){this.applicationManager.addFramework(ut.namespace,Z)}this.globalFrameworkList.push(Z)}let ct;const ut=this.applicationContext.getNamespaceList();for(const Z of ut){const ut=this.applicationManager.getApplication(Z);if(ut){ct=Z;break}}global["MIDWAY_MAIN_FRAMEWORK"]=this.mainFramework=this.applicationManager.getFramework(ct)??this.globalFrameworkList[0];Ct(`[core]: Current main Framework is "${ct}".`)}await this.aspectService.loadAspect()}getMainApp(){return this.mainFramework?.getApplication()}setMainApp(Z){this.mainFramework=this.applicationManager.getFramework(Z)}getMainFramework(){return this.mainFramework}getFramework(Z){return this.applicationManager.getFramework(Z)}async runFramework(){const Z=this.applicationContext.getNamespaceList();this.globalFrameworkList=this.globalFrameworkList.sort(((ct,ut)=>Z.indexOf(ct.getNamespace())-Z.indexOf(ut.getNamespace())));for(const Z of this.globalFrameworkList){if(Z.isEnable()){Et.MidwayInitializerPerformanceManager.frameworkRunStart(Z.getFrameworkName());await Z.run();Ct(`[core]: Found Framework "${Z.getFrameworkName()}" and run.`);Et.MidwayInitializerPerformanceManager.frameworkRunEnd(Z.getFrameworkName())}}}async stopFramework(){await Promise.all(Array.from(this.globalFrameworkList).map((Z=>Z.stop())))}};ct.MidwayFrameworkService=Tt;pt([(0,ft.Inject)(),dt("design:type",mt.MidwayConfigService)],Tt.prototype,"configService",void 0);pt([(0,ft.Inject)(),dt("design:type",ht.MidwayLoggerService)],Tt.prototype,"loggerService",void 0);pt([(0,ft.Inject)(),dt("design:type",St.MidwayAspectService)],Tt.prototype,"aspectService",void 0);pt([(0,ft.Inject)(),dt("design:type",vt.MidwayDecoratorService)],Tt.prototype,"decoratorService",void 0);pt([(0,ft.Inject)(),dt("design:type",bt.MidwayApplicationManager)],Tt.prototype,"applicationManager",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],Tt.prototype,"init",null);ct.MidwayFrameworkService=Tt=pt([(0,ft.Provide)(),(0,ft.Scope)(_t.ScopeEnum.Singleton),dt("design:paramtypes",[Object,Object])],Tt);function filterProtoFramework(Z){const ct=[];for(const ut of Z){let Z=Object.getPrototypeOf(ut);while(Z.name&&Z.name!==yt.BaseFramework.name){ct.push(Z);Z=Object.getPrototypeOf(Z)}}return Z.filter((Z=>!ct.includes(Z)))}},67056:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayHealthService=void 0;const ft=ut(25923);const _t=ut(77866);const mt=ut(12692);const ht=ut(22041);const yt=ut(52590);let vt=class MidwayHealthService{configService;frameworkService;applicationContext;healthCheckTimeout=1e3;healthCheckMethods=[];async init(Z){const ct=this.configService.getConfiguration("core.healthCheckTimeout")||1e3;this.setCheckTimeout(ct);for(const ct of Z){if(ct.instance&&ct.instance["onHealthCheck"]){this.healthCheckMethods.push({item:ct.instance["onHealthCheck"].bind(ct.instance),meta:{namespace:ct.namespace}})}}}async getStatus(){const Z=await(0,ht.createPromiseTimeoutInvokeChain)({promiseItems:this.healthCheckMethods.map((Z=>({item:ct=>Z.item(this.applicationContext,this.frameworkService.getMainApp(),{abortController:ct,timeout:this.healthCheckTimeout}),meta:Z.meta,itemName:Z.meta.namespace}))),itemTimeout:this.healthCheckTimeout,methodName:"configuration.onHealthCheck",onSuccess:(Z,ct)=>{if(Z["status"]!==undefined){return{namespace:ct.namespace,...Z}}else{return{status:false,namespace:ct.namespace,reason:"configuration.onHealthCheck return value must be object and contain status field"}}},onFail:(Z,ct)=>({status:false,namespace:ct.namespace,reason:Z.message})});const ct=Z.find((Z=>!Z.status));return{status:!ct,namespace:ct?.namespace,reason:ct?.reason,results:Z}}setCheckTimeout(Z){this.healthCheckTimeout=Z}};ct.MidwayHealthService=vt;pt([(0,ft.Inject)(),dt("design:type",mt.MidwayConfigService)],vt.prototype,"configService",void 0);pt([(0,ft.Inject)(),dt("design:type",yt.MidwayFrameworkService)],vt.prototype,"frameworkService",void 0);pt([(0,ft.ApplicationContext)(),dt("design:type",Object)],vt.prototype,"applicationContext",void 0);ct.MidwayHealthService=vt=pt([(0,ft.Provide)(),(0,ft.Scope)(_t.ScopeEnum.Singleton)],vt)},7260:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayInformationService=void 0;const ft=ut(77866);const _t=ut(53386);const mt=ut(16928);const ht=ut(25923);const yt=ut(79896);const vt=ut(27192);let St=class MidwayInformationService{pkg;appDir;baseDir;init(){if(this.baseDir){if(!this.appDir){this.appDir=(0,mt.dirname)(this.baseDir)}const Z=(0,mt.join)(this.appDir,"package.json");if((0,yt.existsSync)(Z)){const ct=(0,yt.readFileSync)(Z,{encoding:"utf-8"});this.pkg=JSON.parse(ct)}else{this.pkg={}}}else{this.pkg={}}}getAppDir(){return this.appDir}getBaseDir(){return this.baseDir}getHome(){return(0,_t.getUserHome)()}getPkg(){return this.pkg}getProjectName(){return this.pkg?.["name"]||""}getRoot(){const Z=(0,_t.isDevelopmentEnvironment)((0,_t.getCurrentEnvironment)());return Z?this.getAppDir():this.getHome()}getHostname(){return vt.NetworkUtils.getHostname()}getIpv4Address(){return vt.NetworkUtils.getIpv4Address()}getIpv6Address(){return vt.NetworkUtils.getIpv6Address()}};ct.MidwayInformationService=St;pt([(0,ht.Inject)(),dt("design:type",String)],St.prototype,"appDir",void 0);pt([(0,ht.Inject)(),dt("design:type",String)],St.prototype,"baseDir",void 0);pt([(0,ht.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",void 0)],St.prototype,"init",null);ct.MidwayInformationService=St=pt([(0,ht.Provide)(),(0,ht.Scope)(ft.ScopeEnum.Singleton)],St)},10822:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayLifeCycleService=void 0;const ft=ut(77866);const _t=ut(25923);const mt=ut(52590);const ht=ut(12692);const yt=ut(39023);const vt=ut(62724);const St=ut(67056);const bt=ut(88067);const xt=ut(11386);const $t=ut(22041);const Et=(0,yt.debuglog)("midway:debug");let Ct=class MidwayLifeCycleService{applicationContext;frameworkService;configService;mockService;healthService;lifecycleInstanceList=[];constructor(Z){this.applicationContext=Z}async init(){await this.mockService.initSimulation();const Z=_t.DecoratorManager.listModule(_t.CONFIGURATION_KEY);Et(`[core]: Found Configuration length = ${Z.length}`);for(const ct of Z){if(bt.MetadataManager.hasOwnMetadata(_t.CONFIGURATION_OBJECT_KEY,ct.target)){ct.instance=ct.target}else{Et(`[core]: Lifecycle run ${ct.namespace} init`);ct.instance=await this.applicationContext.getAsync(ct.target)}if(ct.instance){this.lifecycleInstanceList.push(ct)}}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",{resultHandler:Z=>{if(Z){this.configService.addObject(Z)}},timeout:this.configService.getConfiguration("core.configLoadTimeout")});await this.mockService.runSimulatorSetup();await this.runContainerLifeCycle(this.lifecycleInstanceList,"onReady",{timeout:this.configService.getConfiguration("core.readyTimeout")});await this.frameworkService.runFramework();await this.runContainerLifeCycle(this.lifecycleInstanceList,"onServerReady",{timeout:this.configService.getConfiguration("core.serverReadyTimeout")});if(!this.configService.getConfiguration("debug.recordConfigMergeOrder")){this.configService.clearConfigMergeOrder()}}async stop(){await this.mockService.runSimulatorTearDown();await this.runContainerLifeCycle(this.lifecycleInstanceList.reverse(),"onStop",{timeout:this.configService.getConfiguration("core.stopTimeout")});await this.frameworkService.stopFramework()}async runContainerLifeCycle(Z,ct,ut){await(0,$t.createPromiseTimeoutInvokeChain)({promiseItems:Z.map((Z=>({item:async pt=>this.runLifeCycle(Z,ct,{...ut,abortController:pt}),meta:{namespace:Z.namespace},itemName:Z.namespace}))),itemTimeout:ut?.timeout,isConcurrent:false,methodName:`configuration.${ct}`})}async runLifeCycle(Z,ct,ut){if(typeof Z.instance[ct]==="function"){Et(`[core]: Lifecycle run ${Z.instance.constructor.name} ${ct}`);xt.MidwayInitializerPerformanceManager.lifecycleStart(Z.namespace,ct);const pt=await Z.instance[ct](this.applicationContext,this.frameworkService.getMainApp(),{timeout:ut.timeout,abortController:ut.abortController});if(ut?.resultHandler){ut.resultHandler(pt)}xt.MidwayInitializerPerformanceManager.lifecycleEnd(Z.namespace,ct);return pt}}async runObjectLifeCycle(Z,ct){for(const ut of Z){if(typeof ut.instance[ct]==="function"){Et(`[core]: Lifecycle run ${ut.instance.constructor.name} ${ct}`);return await this.applicationContext[ct](ut.instance[ct].bind(ut.instance))}}}getLifecycleInstanceList(){return this.lifecycleInstanceList}};ct.MidwayLifeCycleService=Ct;pt([(0,_t.Inject)(),dt("design:type",mt.MidwayFrameworkService)],Ct.prototype,"frameworkService",void 0);pt([(0,_t.Inject)(),dt("design:type",ht.MidwayConfigService)],Ct.prototype,"configService",void 0);pt([(0,_t.Inject)(),dt("design:type",vt.MidwayMockService)],Ct.prototype,"mockService",void 0);pt([(0,_t.Inject)(),dt("design:type",St.MidwayHealthService)],Ct.prototype,"healthService",void 0);pt([(0,_t.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],Ct.prototype,"init",null);ct.MidwayLifeCycleService=Ct=pt([(0,_t.Provide)(),(0,_t.Scope)(ft.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],Ct)},26966:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayLoggerService=void 0;const ft=ut(25923);const _t=ut(12692);const mt=ut(71888);const ht=ut(77866);const yt=ut(47369);const vt=ut(28068);let St=class MidwayLoggerService extends mt.ServiceFactory{applicationContext;globalOptions;configService;loggerFactory;lazyLoggerConfigMap=new Map;aliasLoggerMap=new Map;constructor(Z,ct={}){super();this.applicationContext=Z;this.globalOptions=ct}init(){const Z=this.configService.getConfiguration("loggerFactory");this.loggerFactory=Z||this.globalOptions["loggerFactory"]||new yt.DefaultConsoleLoggerFactory;if(!this.loggerFactory.getDefaultMidwayLoggerConfig){throw new vt.MidwayFeatureNoLongerSupportedError("please upgrade your @midwayjs/logger to latest version")}const ct=this.loggerFactory.getDefaultMidwayLoggerConfig(this.configService.getAppInfo());this.configService.addObject(ct,true);this.initClients(this.configService.getConfiguration("midwayLogger"));this.applicationContext?.registerObject("logger",this.getLogger("appLogger"))}createClient(Z,ct){if(Z.aliasName){this.aliasLoggerMap.set(Z.aliasName,ct)}if(!Z.lazyLoad){this.loggerFactory.createLogger(ct,Z)}else{delete Z["lazyLoad"];this.lazyLoggerConfigMap.set(ct,Z)}}getName(){return"logger"}createLogger(Z,ct){delete ct["aliasName"];return this.loggerFactory.createLogger(Z,ct)}getLogger(Z){if(this.aliasLoggerMap.has(Z)){Z=this.aliasLoggerMap.get(Z)}const ct=this.loggerFactory.getLogger(Z);if(ct){return ct}if(this.lazyLoggerConfigMap.has(Z)){this.createClient(this.lazyLoggerConfigMap.get(Z),Z);this.lazyLoggerConfigMap.delete(Z)}return this.loggerFactory.getLogger(Z)}getCurrentLoggerFactory(){return this.loggerFactory}createContextLogger(Z,ct,ut){return this.loggerFactory.createContextLogger(Z,ct,ut)}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}};ct.MidwayLoggerService=St;pt([(0,ft.Inject)(),dt("design:type",_t.MidwayConfigService)],St.prototype,"configService",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",void 0)],St.prototype,"init",null);ct.MidwayLoggerService=St=pt([(0,ft.Provide)(),(0,ft.Scope)(ht.ScopeEnum.Singleton),dt("design:paramtypes",[Object,Object])],St)},22546:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayMiddlewareService=void 0;const ft=ut(25923);const _t=ut(77866);const mt=ut(28068);const ht=ut(53386);const yt=ut(35175);const vt=ut(39023);const St=(0,vt.debuglog)("midway:debug");let bt=class MidwayMiddlewareService{applicationContext;constructor(Z){this.applicationContext=Z}async compose(Z,ct,ut){if(!Array.isArray(Z)){throw new mt.MidwayParameterError("Middleware stack must be an array")}const pt=[];for(let ut of Z){if(yt.Types.isClass(ut)||typeof ut==="string"||ut?.["middleware"]){let Z=ut?.["middleware"]??ut;const dt=ut?.["options"];let ft=ut?.["name"];if(typeof Z==="string"&&!this.applicationContext.hasDefinition(Z)){throw new mt.MidwayCommonError(`Middleware definition of "${Z}" not found in midway container`)}const _t=await this.applicationContext.getAsync(Z);if(_t){ft=ft??_t.constructor.name;Z=await _t.resolve(ct,dt);if(!Z){continue}if(!_t.match&&!_t.ignore){if(!Z.name){Z._name=ft}pt.push(Z)}else{const ct=(0,ht.pathMatching)({match:_t.match,ignore:_t.ignore,thisResolver:_t});ut=(ut,pt,dt)=>{if(!ct(ut))return pt();return Z(ut,pt,dt)};ut._name=ft;pt.push(ut)}}else{throw new mt.MidwayCommonError("Middleware must have resolve method!")}}else{pt.push(ut)}}const composeFn=(Z,ct)=>{const dt=(0,ht.isIncludeProperty)(Z,"body");let ft=-1;return dispatch(0);function dispatch(_t){if(_t<=ft)return Promise.reject(new mt.MidwayCommonError("next() called multiple times"));ft=_t;let ht=pt[_t];if(_t===pt.length)ht=ct;if(!ht)return Promise.resolve();const yt=`${ut?`${ut}.`:""}${ft} ${ht._name||ht.name||"anonymous"}`;const vt=Date.now();St(`[middleware]: in ${yt} +0`);try{if(dt){return Promise.resolve(ht(Z,dispatch.bind(null,_t+1),{index:ft})).then((ct=>{if(ct!==undefined&&ct!==Z["body"]){Z["body"]=ct}else if(Z["body"]!==undefined){ct=Z["body"]}St(`[middleware]: out ${yt} +${Date.now()-vt} with body`);return ct}))}else{return Promise.resolve(ht(Z,dispatch.bind(null,_t+1),{index:ft})).then((Z=>{St(`[middleware]: out ${yt} +${Date.now()-vt}`);return Z}))}}catch(Z){St(`[middleware]: out ${yt} +${Date.now()-vt} with err ${Z.message}`);return Promise.reject(Z)}}};if(ut){composeFn._name=ut}return composeFn}};ct.MidwayMiddlewareService=bt;ct.MidwayMiddlewareService=bt=pt([(0,ft.Provide)(),(0,ft.Scope)(_t.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],bt)},62724:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft;Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayMockService=void 0;const _t=ut(77866);const mt=ut(25923);const ht=ut(35175);let yt=class MidwayMockService{static{ft=this}applicationContext;mocks=new Map;contextMocks=new Map;cache=new Map;simulatorList=[];constructor(Z){this.applicationContext=Z}async init(){if(ft.prepareMocks.length>0){for(const Z of ft.prepareMocks){this.mockProperty(Z.obj,Z.key,Z.value,Z.group)}ft.prepareMocks=[]}}static prepareMocks=[];static mockClassProperty(Z,ct,ut,pt="default"){this.mockProperty(Z.prototype,ct,ut,pt)}static mockProperty(Z,ct,ut,pt="default"){this.prepareMocks.push({obj:Z,key:ct,value:ut,group:pt})}mockClassProperty(Z,ct,ut,pt="default"){return this.mockProperty(Z.prototype,ct,ut,pt)}mockProperty(Z,ct,ut,pt="default"){const dt=Z.hasOwnProperty(ct);const ft={obj:Z,key:ct,descriptor:Object.getOwnPropertyDescriptor(Z,ct),hasOwnProperty:dt};if(!this.mocks.has(pt)){this.mocks.set(pt,[])}this.mocks.get(pt).push(ft);if(dt){delete Z[ct]}let _t=this.cache.get(pt);if(!_t){_t=new Map;this.cache.set(pt,_t)}let mt=_t.get(Z);if(!mt){mt=new Set;_t.set(Z,mt)}mt.add(ct);const ht=this.overridePropertyDescriptor(ut);Object.defineProperty(Z,ct,ht)}mockContext(Z,ct,ut,pt="default"){if(!this.contextMocks.has(pt)){this.contextMocks.set(pt,[])}this.contextMocks.get(pt).push({app:Z,key:ct,value:ut})}restore(Z="default"){this.restoreGroup(Z)}restoreAll(){const Z=new Set([...this.mocks.keys(),...this.contextMocks.keys(),...this.cache.keys()]);for(const ct of Z){this.restoreGroup(ct)}this.simulatorList=[]}restoreGroup(Z){const ct=this.mocks.get(Z)||[];for(let Z=ct.length-1;Z>=0;Z--){const ut=ct[Z];if(!ut.hasOwnProperty){delete ut.obj[ut.key]}else{Object.defineProperty(ut.obj,ut.key,ut.descriptor)}}this.mocks.delete(Z);this.contextMocks.delete(Z);this.cache.delete(Z);this.simulatorList=this.simulatorList.filter((ct=>ct["group"]!==Z))}isMocked(Z,ct,ut="default"){if((0,ht.isClass)(Z)){Z=Z.prototype}const pt=this.cache.get(ut);const dt=pt?pt.get(Z):undefined;return dt?dt.has(ct):false}applyContextMocks(Z,ct){for(const[,ut]of this.contextMocks){for(const pt of ut){if(pt.app===Z){const Z=this.overridePropertyDescriptor(pt.value);if(typeof pt.key==="string"){Object.defineProperty(ct,pt.key,Z)}else{pt.key(ct)}}}}}getContextMocksSize(){return Array.from(this.contextMocks.values()).reduce(((Z,ct)=>Z+ct.length),0)}overridePropertyDescriptor(Z){const ct={configurable:true,enumerable:true};if(Z&&(Z.get||Z.set)){ct.get=Z.get;ct.set=Z.set}else{ct.value=Z;ct.writable=true}return ct}async initSimulation(Z="default"){const ct=mt.DecoratorManager.listModule(mt.MOCK_KEY);for(const ut of ct){const ct=await this.applicationContext.getAsync(ut);if(await ct.enableCondition()){ct["group"]=Z;this.simulatorList.push(ct)}}}async runSimulatorSetup(){for(const Z of this.simulatorList){await(Z.setup?.())}}async runSimulatorTearDown(){for(let Z=this.simulatorList.length-1;Z>=0;Z--){const ct=this.simulatorList[Z];await(ct.tearDown?.())}}async runSimulatorAppSetup(Z){for(const ct of this.simulatorList){await(ct.appSetup?.(Z))}}async runSimulatorAppTearDown(Z){for(let ct=this.simulatorList.length-1;ct>=0;ct--){const ut=this.simulatorList[ct];await(ut.appTearDown?.(Z))}}async runSimulatorContextSetup(Z,ct){for(const ut of this.simulatorList){await(ut.contextSetup?.(Z,ct))}}async runSimulatorContextTearDown(Z,ct){for(let ut=this.simulatorList.length-1;ut>=0;ut--){const pt=this.simulatorList[ut];await(pt?.contextTearDown?.(Z,ct))}}};ct.MidwayMockService=yt;pt([(0,mt.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],yt.prototype,"init",null);pt([(0,mt.Destroy)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",void 0)],yt.prototype,"restoreAll",null);ct.MidwayMockService=yt=ft=pt([(0,mt.Provide)(),(0,mt.Scope)(_t.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],yt)},84766:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayServerlessFunctionService=void 0;const ft=ut(25923);const _t=ut(95919);const mt=ut(77866);const ht=ut(88067);let yt=class MidwayServerlessFunctionService extends _t.MidwayWebRouterService{options;constructor(Z={}){super(Object.assign({},Z,{includeFunctionRouter:true}));this.options=Z}async analyze(){this.analyzeController();this.analyzeFunction();this.sortPrefixAndRouter();for(const Z of this.routes.values()){for(const ct of Z){if(ct.requestMethod==="all"){ct.functionTriggerMetadata=ct.functionTriggerMetadata||{};ct.functionTriggerMetadata.method=["get","post","put","delete","head","patch","options"]}}}}analyzeFunction(){const Z=ft.DecoratorManager.listModule(ft.FUNC_KEY);for(const ct of Z){this.collectFunctionRoute(ct)}}collectFunctionRoute(Z){const ct=ht.MetadataManager.getOwnMetadata(ft.FUNC_KEY,Z);const ut=ft.DecoratorManager.getProviderName(Z);const pt=ft.DecoratorManager.getProviderUUId(Z);const dt="/";if(!this.routes.has(dt)){this.routes.set(dt,[]);this.routesPriority.push({prefix:dt,priority:-999,middleware:[],routerOptions:{},controllerId:ut,routerModule:Z})}for(const _t of ct){if(_t["metadata"]?.["path"]){const ct=ht.MetadataManager.getOwnMetadata(ft.WEB_ROUTER_PARAM_KEY,Z,_t["methodName"])||[];const mt=ht.MetadataManager.getOwnMetadata(ft.WEB_RESPONSE_KEY,Z,_t["methodName"])||[];const yt={id:pt,prefix:dt,routerName:"",url:_t["metadata"]["path"],requestMethod:_t["metadata"]?.["method"]??"get",method:_t["methodName"],description:"",summary:"",handlerName:`${ut}.${_t["methodName"]}`,funcHandlerName:`${ut}.${_t["methodName"]}`,controllerId:ut,middleware:_t["metadata"]?.["middleware"]||[],controllerMiddleware:[],requestMetadata:ct,responseMetadata:mt};const vt=ht.MetadataManager.getOwnMetadata(ft.SERVERLESS_FUNC_KEY,Z,_t["methodName"])||{};const St=vt["functionName"]??_t?.["metadata"]?.["functionName"]??createFunctionName(Z,_t["methodName"]);const bt=vt["handlerName"]??_t?.["metadata"]?.["handlerName"]??yt.funcHandlerName;yt.functionName=St;yt.funcHandlerName=bt;yt.functionTriggerName=_t["type"];yt.functionTriggerMetadata=_t["metadata"];yt.functionMetadata={functionName:St,...vt};this.checkDuplicateAndPush(dt,yt)}else{const ct=ht.MetadataManager.getOwnMetadata(ft.SERVERLESS_FUNC_KEY,Z,_t["methodName"])||{};const mt=ct["functionName"]??_t?.["metadata"]?.["functionName"]??createFunctionName(Z,_t["methodName"]);const yt=ct["handlerName"]??_t?.["metadata"]?.["handlerName"]??`${ut}.${_t["methodName"]}`;this.checkDuplicateAndPush(dt,{id:pt,prefix:dt,routerName:"",url:"",requestMethod:"",method:_t["methodName"],description:"",summary:"",handlerName:`${ut}.${_t["methodName"]}`,funcHandlerName:yt,controllerId:ut,middleware:_t["metadata"]?.["middleware"]||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:mt,functionTriggerName:_t["type"],functionTriggerMetadata:_t["metadata"],functionMetadata:{functionName:mt,...ct}})}}}async getFunctionList(){return this.getFlattenRouterTable({compileUrlPattern:true})}addServerlessFunction(Z,ct,ut={}){const pt="";if(!this.routes.has(pt)){this.routes.set(pt,[]);this.routesPriority.push({prefix:pt,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}const dt=ct.functionName??ut.functionName;this.checkDuplicateAndPush(pt,{id:null,method:Z,url:ct.metadata["path"]||"",requestMethod:ct.metadata["method"]||"",description:"",summary:"",handlerName:"",funcHandlerName:ct.handlerName||ut.handlerName,controllerId:"",middleware:ct.metadata?.middleware||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:dt,functionTriggerName:ct.metadata.name,functionTriggerMetadata:ct.metadata,functionMetadata:{functionName:dt,...ut}})}};ct.MidwayServerlessFunctionService=yt;ct.MidwayServerlessFunctionService=yt=pt([(0,ft.Provide)(),(0,ft.Scope)(mt.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],yt);function createFunctionName(Z,ct){return ft.DecoratorManager.getProviderName(Z).replace(/[:#]/g,"-")+"-"+ct}},48757:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayTraceService=void 0;const ft=ut(80794);const _t=ut(25923);const mt=ut(77866);const ht=ut(5228);const yt=ut(97685);let vt=class MidwayTraceService{currentTracerName="midway";tracingConfig;app;decoratorService;tracingOptions;logger;init(){this.currentTracerName=this.app?.getProjectName?.()??"unknown_project";this.tracingConfig={enable:true,onError:"ignore",logOnError:false,...this.tracingOptions??{}};this.decoratorService.registerMethodHandler(ht.TRACE_KEY,(Z=>({around:async ct=>this.createSpan(Z.metadata["spanName"],(async Z=>{try{const ut=await ct.proceed(...ct.args);Z.setStatus({code:ft.SpanStatusCode.OK});Z.end();return ut}catch(ct){Z.setStatus({code:ft.SpanStatusCode.ERROR});Z.recordException(ct);Z.end();throw ct}}))})))}getCurrentSpan(){return ft.trace.getSpan(ft.context.active())}getTraceId(){return this.getCurrentSpan()?.spanContext().traceId}createSpan(Z,ct){return ft.trace.getTracer(this.currentTracerName).startActiveSpan(Z,{kind:ft.SpanKind.CLIENT},ct)}defaultGetter={get(Z,ct){if(!Z||!ct){return undefined}if(typeof Z.get==="function"){return Z.get(ct)}const ut=ct.toLowerCase();const pt=Object.keys(Z).find((Z=>Z.toLowerCase()===ut));return pt?Z[pt]:undefined},keys(Z){if(!Z){return[]}return Object.keys(Z)}};defaultSetter={set(Z,ct,ut){if(!Z||!ct){return}if(typeof Z.setHeader==="function"){Z.setHeader(ct,ut);return}if(typeof Z.set==="function"){Z.set(ct,ut);return}Z[ct]=ut}};getProtocolFromAttributes(Z){const ct=Z?.["midway.protocol"];if(!ct||typeof ct!=="string"){return"default"}return ct}isProtocolEnabled(){return this.tracingConfig?.enable!==false}handleTraceError(Z,ct){if(this.tracingConfig?.logOnError){this.logger?.warn?.(`[midway:trace] ${ct} failed: ${Z?.message||Z}`)}if(this.tracingConfig?.onError==="throw"){throw Z}}pickTraceMetaValue(Z){if(!Z||typeof Z!=="object"){return{}}const ct={};for(const[ut,pt]of Object.entries(Z)){if(pt===null||pt===undefined){continue}if(typeof pt==="string"||typeof pt==="number"||typeof pt==="boolean"){ct[ut]=pt}}return ct}resolveTraceMeta(Z,ct){if(!Z){return{}}const mergeMeta=(Z,ut)=>{if(!ut){return}const pt=typeof ut==="function"?ut(ct):ut;Object.assign(Z,this.pickTraceMetaValue(pt))};if(typeof Z==="function"){return this.pickTraceMetaValue(Z(ct))}const ut=Z;if(ut.common!==undefined||ut.entry!==undefined||ut.exit!==undefined){const Z={};mergeMeta(Z,ut.common);mergeMeta(Z,ut[ct.direction]);return Z}return this.pickTraceMetaValue(Z)}runWithEntrySpan(Z,ct,ut){const pt=this.getProtocolFromAttributes(ct.attributes);const dt=this.resolveTraceMeta(ct.meta,{direction:"entry",protocol:pt,spanName:Z,...ct.metaArgs??{}});const _t={...ct.attributes??{},...dt};if(!this.isProtocolEnabled()||ct.enable===false){return Promise.resolve(ut(undefined))}const mt=ct.getter??this.defaultGetter;const ht=ct.setter??this.defaultSetter;let yt=ft.context.active();if(ct.carrier){try{yt=ft.propagation.extract(ft.context.active(),ct.carrier,mt)}catch(Z){this.handleTraceError(Z,"extract entry context")}}return ft.trace.getTracer(this.currentTracerName).startActiveSpan(Z,{kind:ct.kind??ft.SpanKind.SERVER,attributes:_t},yt,(async Z=>{try{const pt=await ut(Z);Z.setStatus({code:ft.SpanStatusCode.OK});if(ct.responseCarrier){try{ft.propagation.inject(ft.context.active(),ct.responseCarrier,ht)}catch(Z){this.handleTraceError(Z,"inject entry response context")}}return pt}catch(ct){Z.setStatus({code:ft.SpanStatusCode.ERROR});Z.recordException(ct);throw ct}finally{Z.end()}}))}runWithExitSpan(Z,ct,ut){const pt=this.getProtocolFromAttributes(ct.attributes);const dt=this.resolveTraceMeta(ct.meta,{direction:"exit",protocol:pt,spanName:Z,...ct.metaArgs??{}});const _t={...ct.attributes??{},...dt};if(!this.isProtocolEnabled()||ct.enable===false){return Promise.resolve(ut(undefined))}const mt=ct.setter??this.defaultSetter;const ht=ct.carrier??{};return ft.trace.getTracer(this.currentTracerName).startActiveSpan(Z,{kind:ct.kind??ft.SpanKind.CLIENT,attributes:_t},(async Z=>{try{try{ft.propagation.inject(ft.context.active(),ht,mt)}catch(Z){this.handleTraceError(Z,"inject exit context")}const ct=await ut(Z);Z.setStatus({code:ft.SpanStatusCode.OK});return ct}catch(ct){Z.setStatus({code:ft.SpanStatusCode.ERROR});Z.recordException(ct);throw ct}finally{Z.end()}}))}injectContext(Z,ct){try{ft.propagation.inject(ft.context.active(),Z,ct??this.defaultSetter)}catch(Z){this.handleTraceError(Z,"inject context")}return Z}};ct.MidwayTraceService=vt;pt([(0,_t.MainApp)(),dt("design:type",Object)],vt.prototype,"app",void 0);pt([(0,_t.Inject)(),dt("design:type",yt.MidwayDecoratorService)],vt.prototype,"decoratorService",void 0);pt([(0,_t.Config)("tracing"),dt("design:type",Object)],vt.prototype,"tracingOptions",void 0);pt([(0,_t.Logger)("coreLogger"),dt("design:type",Object)],vt.prototype,"logger",void 0);pt([(0,_t.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",void 0)],vt.prototype,"init",null);ct.MidwayTraceService=vt=pt([(0,_t.Provide)(),(0,_t.Scope)(mt.ScopeEnum.Singleton)],vt)},95919:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayWebRouterService=void 0;const ft=ut(25923);const _t=ut(53386);const mt=ut(28068);const ht=ut(39023);const yt=ut(57095);const vt=ut(35175);const St=ut(77866);const bt=ut(88067);const xt=ut(26966);const $t=ht.debuglog("midway:debug");let Et=class MidwayWebRouterService{options;isReady=false;routes=new Map;routesPriority=[];loggerService;constructor(Z={}){this.options=Z}async analyze(){this.analyzeController();this.sortPrefixAndRouter()}analyzeController(){const Z=ft.DecoratorManager.listModule(ft.CONTROLLER_KEY);const ct=[];const ut=new Map;for(const pt of Z){const Z=!!bt.MetadataManager.getOwnMetadata(ft.FUNCTIONAL_API_CONTROLLER_KEY,pt);if(!Z){ct.push(pt);continue}const dt=bt.MetadataManager.getOwnMetadata(ft.CONTROLLER_KEY,pt);const _t=bt.MetadataManager.getOwnMetadata(ft.WEB_ROUTER_KEY,pt);if(!dt||!_t){ct.push(pt);continue}const mt=_t.map((Z=>`${(Z.requestMethod||"").toLowerCase()}|${String(Z.path||"/")}|${Z.routerName||""}|${Z.method||""}`)).sort().join(";");const ht=`${dt.prefix||"/"}::${mt}`;const yt=ut.get(ht);if(typeof yt==="number"){ct[yt]=pt}else{ut.set(ht,ct.length);ct.push(pt)}}for(const Z of ct){const ct=bt.MetadataManager.getOwnMetadata(ft.CONTROLLER_KEY,Z);this.addController(Z,ct,this.options.includeFunctionRouter)}}sortPrefixAndRouter(){this.routesPriority=this.routesPriority.filter((Z=>{const ct=this.routes.get(Z.prefix);if(ct.length>0){return true}else{this.routes.delete(Z.prefix);return false}}));for(const Z of this.routes.keys()){const ct=this.routes.get(Z);this.routes.set(Z,this.sortRouter(ct))}this.routesPriority=this.routesPriority.sort(((Z,ct)=>ct.prefix.length-Z.prefix.length))}addController(Z,ct,ut={},pt=false){if(ut&&typeof ut==="boolean"){pt=ut;ut=undefined}if(!ut){ut={}}const dt=ft.DecoratorManager.getProviderName(Z);$t(`[core]: Found Controller ${dt}.`);const ht=ft.DecoratorManager.getProviderUUId(Z);ct.routerOptions=ct.routerOptions||{};const yt=ct.routerOptions.middleware;const vt=!!ct.routerOptions?.ignoreGlobalPrefix;const xt=ct.routerOptions?.version;const Et=xt?ct.routerOptions?.versionType||"URI":undefined;const Ct=Et==="URI"?ct.routerOptions?.versionPrefix||"v":ct.routerOptions?.versionPrefix;let Tt=(0,_t.joinURLPath)(this.options.globalPrefix,ct.prefix||"/");const wt=ct.prefix||"/";let At=wt;if(xt&&Et==="URI"){const Z=Array.isArray(xt)?xt[0]:xt;const ut=`/${Ct}${Z}`;Tt=(0,_t.joinURLPath)(this.options.globalPrefix,ut,ct.prefix||"/");At=(0,_t.joinURLPath)(ut,wt)}if(/\*/.test(Tt)){throw new mt.MidwayCommonError(`Router prefix ${Tt} can't set string with *`)}if(!this.routes.has(Tt)){this.routes.set(Tt,[]);this.routesPriority.push({prefix:Tt,priority:Tt==="/"?-999:0,middleware:yt,routerOptions:ct.routerOptions,controllerId:dt,routerModule:Z})}else{if(yt&&yt.length>0){const Z=this.routesPriority.filter((Z=>Z.prefix===Tt))[0];throw new mt.MidwayDuplicateControllerOptionsError(Tt,dt,Z.controllerId)}}const kt=bt.MetadataManager.getOwnMetadata(ft.WEB_ROUTER_KEY,Z);const It=!!kt&&kt.some((Z=>Z?.ignoreGlobalPrefix===true));if(vt||It){if(!this.routes.has(At)){this.routes.set(At,[]);this.routesPriority.push({prefix:At,priority:At==="/"?-999:0,middleware:yt,routerOptions:ct.routerOptions,controllerId:dt,routerModule:Z})}}if(kt&&typeof kt[Symbol.iterator]==="function"){for(const ct of kt){const mt=ct.__ignoreGlobalPrefixConfigured===true;const $t=bt.MetadataManager.getOwnMetadata(ft.WEB_ROUTER_PARAM_KEY,Z,ct.method)||[];const wt=bt.MetadataManager.getOwnMetadata(ft.WEB_RESPONSE_KEY,Z,ct.method)||[];const kt={id:ht,prefix:mt?ct.ignoreGlobalPrefix?At:Tt:vt?At:Tt,routerName:ct.routerName||"",url:ct.path,requestMethod:ct.requestMethod,method:ct.method,description:ct.description||"",summary:ct.summary||"",handlerName:`${dt}.${ct.method}`,funcHandlerName:`${dt}.${ct.method}`,controllerId:dt,controllerClz:Z,middleware:ct.middleware||[],controllerMiddleware:yt||[],requestMetadata:$t,responseMetadata:wt};const It=!!bt.MetadataManager.getOwnMetadata(ft.FUNCTIONAL_API_CONTROLLER_KEY,Z);if(It){kt.source="functional"}if(mt||vt){const Z=mt?!!ct.ignoreGlobalPrefix:vt;if(Z){kt.ignoreGlobalPrefix=true}}if(xt){kt.version=xt;kt.versionType=Et;kt.versionPrefix=Ct}if(pt){kt.functionName=dt+"-"+ct.method;kt.functionTriggerName=St.ServerlessTriggerType.HTTP;kt.functionTriggerMetadata={path:(0,_t.joinURLPath)(kt.prefix,ct.path.toString()),method:ct.requestMethod};kt.functionMetadata={functionName:kt.functionName}}if(ut.resourceFilter&&!ut.resourceFilter(kt)){continue}this.checkDuplicateAndPush(kt.prefix,kt)}}}addRouter(Z,ct){const ut=ct.prefix||"";ct.requestMethod=(ct.requestMethod||"GET").toUpperCase();if(!this.routes.has(ut)){this.routes.set(ut,[]);this.routesPriority.push({prefix:ut,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}this.checkDuplicateAndPush(ut,Object.assign(ct,{method:Z}));this.sortPrefixAndRouter()}sortRouter(Z){return Z.map((Z=>{const ct=Z.url.toString();const ut=vt.Types.isRegExp(Z.url)?ct.split("\\/"):ct.split("/");let pt=0;for(const Z of ut){if(Z===""||Z.includes(":")||Z.includes("*")){pt+=0}else{pt+=1}}let dt=2;const ft=ct.includes(":")?ct.replace(/:.+$/,""):"";if(ft){dt=1}if(ct.includes("*")){dt=0}return{...Z,_pureRouter:ct.replace(/\**$/,"").replace(/:\w+/,"123"),_level:ct.split("/").length-1,_paramString:ft,_category:dt,_weight:pt}})).sort(((Z,ct)=>{if(Z._category!==ct._category){return ct._category-Z._category}if(Z._weight!==ct._weight){return ct._weight-Z._weight}if(Z._level===ct._level){if(ct._pureRouter===Z._pureRouter){return Z.url.toString().length-ct.url.toString().length}return ct._pureRouter.length-Z._pureRouter.length}return ct._level-Z._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(Z={}){if(!this.isReady){await this.analyze();this.isReady=true}let ct=[];for(const Z of this.routesPriority){ct=ct.concat(this.routes.get(Z.prefix))}if(Z.compileUrlPattern){for(const Z of ct){if(Z.fullUrlFlattenString){Z.fullUrlCompiledRegexp=yt.PathToRegexpUtil.toRegexp(Z.fullUrlFlattenString)}}}return ct}async getMatchedRouterInfo(Z,ct){const ut=await this.getFlattenRouterTable({compileUrlPattern:true});let pt;for(const dt of ut){if(dt.fullUrlCompiledRegexp){const ut=dt["requestMethod"].toUpperCase();if(("ALL"===ut||ct.toUpperCase()===ut)&&dt.fullUrlCompiledRegexp.test(Z)){pt=dt;break}}}return pt}async getRouteManifest(){const Z=await this.getFlattenRouterTable();const ct=Z.map((Z=>({source:Z.source??"decorator",operationId:this.getOperationId(Z),controllerId:Z.controllerId,controllerPrefix:Z.prefix||"",method:Z.requestMethod,path:Z.url?.toString()||"",fullPath:Z.fullUrl||"",routerName:Z.routerName,middlewareCount:(Z.middleware?.length||0)+(Z.controllerMiddleware?.length||0),ignoreGlobalPrefix:!!Z.ignoreGlobalPrefix,version:Z.version,versionType:Z.versionType,versionPrefix:Z.versionPrefix,summary:Z.summary,description:Z.description})));this.checkDuplicateOperationId(ct);return ct}checkDuplicateAndPush(Z,ct){const ut=this.routes.get(Z);const pt=ut.filter((Z=>ct.url&&ct.requestMethod&&Z.url===ct.url&&Z.requestMethod===ct.requestMethod));if(pt&&pt.length){const ut=pt[0];const dt=ut.fullUrl||(typeof ct.url==="string"?(0,_t.joinURLPath)(Z,ct.url):`${Z}${ct.url?.toString()||""}`);const ft={code:"MIDWAY_DUPLICATE_ROUTE",method:(ct.requestMethod||"").toUpperCase(),fullPath:dt,existing:{source:ut.source??"decorator",handler:this.getRouterHandlerIdentity(ut)},current:{source:ct.source??"decorator",handler:this.getRouterHandlerIdentity(ct)}};throw new mt.MidwayDuplicateRouteError(`${ct.requestMethod} ${ct.url}`,ft.existing.handler,ft.current.handler,ft)}if(!ct.fullUrlFlattenString&&ct.url&&typeof ct.url==="string"){ct.fullUrl=(0,_t.joinURLPath)(Z,ct.url);if(/\*$/.test(ct.fullUrl)){ct.fullUrlFlattenString=ct.fullUrl.replace("*","(.*)")}else{ct.fullUrlFlattenString=ct.fullUrl}}ut.push(ct);this.logRouteLoaded(ct)}logRouteLoaded(Z){const ct=Z.fullUrl||(typeof Z.url==="string"?(0,_t.joinURLPath)(Z.prefix||"",Z.url):`${Z.prefix||""}${Z.url?.toString()||""}`);const ut=this.loggerService?.getLogger("appLogger");if(!ut||typeof ut.info!=="function"){return}ut.info("[midway:router] loaded route %s %s -> %s (%s)",(Z.requestMethod||"ALL").toUpperCase(),ct,this.getRouterHandlerIdentity(Z),Z.source??"decorator")}getRouterHandlerIdentity(Z){if(Z.handlerName){return Z.handlerName}if(typeof Z.method==="string"){return Z.controllerId?`${Z.controllerId}.${Z.method}`:Z.method}if(typeof Z.method==="function"){return Z.method.name||"anonymous"}return"unknown"}getOperationId(Z){if(Z.routerName){return Z.routerName}const ct=Z.fullUrl||Z.url?.toString()||"/";return`${(Z.requestMethod||"all").toLowerCase()}_${ct.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}`}checkDuplicateOperationId(Z){const ct=new Map;for(const ut of Z){const Z=ct.get(ut.operationId);if(Z){throw new mt.MidwayCommonError(`Duplicate operationId "${ut.operationId}" between "${Z.method.toUpperCase()} ${Z.fullPath}" and "${ut.method.toUpperCase()} ${ut.fullPath}"`)}ct.set(ut.operationId,ut)}}};ct.MidwayWebRouterService=Et;pt([(0,ft.Inject)(),dt("design:type",xt.MidwayLoggerService)],Et.prototype,"loggerService",void 0);ct.MidwayWebRouterService=Et=pt([(0,ft.Provide)(),(0,ft.Scope)(St.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],Et)},86052:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.initializeGlobalApplicationContext=initializeGlobalApplicationContext;ct.destroyGlobalApplicationContext=destroyGlobalApplicationContext;ct.prepareGlobalApplicationContextAsync=prepareGlobalApplicationContextAsync;ct.prepareGlobalApplicationContext=prepareGlobalApplicationContext;const pt=ut(31049);const dt=ut(98727);const ft=ut(39023);const _t=ut(84766);const mt=ut(67056);const ht=ut(48757);const yt=ut(84237);const vt=ut(53386);const St=ut(45213);const bt=ut(81680);const xt=ut(11386);const $t=ft.debuglog("midway:debug");let Et=1;let Ct=1;function printStepDebugInfo(Z){$t(`\n\nProject ${Ct} - Step ${Et++}: ${Z}\n`)}async function initializeGlobalApplicationContext(Z){xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);const ct=await prepareGlobalApplicationContextAsync(Z);printStepDebugInfo("Init logger");xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);const ut=await ct.getAsync(pt.MidwayLoggerService,[ct,Z]);if(ut.getLogger("appLogger")){ct.registerObject("logger",ut.getLogger("appLogger"))}xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);printStepDebugInfo("Init MidwayMockService");await ct.getAsync(pt.MidwayMockService,[ct]);printStepDebugInfo("Init framework");xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);await ct.getAsync(pt.MidwayFrameworkService,[ct,Z]);printStepDebugInfo("Init tracing");await ct.getAsync(ht.MidwayTraceService);xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);printStepDebugInfo("Init lifecycle");xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);await ct.getAsync(pt.MidwayLifeCycleService,[ct]);xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);printStepDebugInfo("Init pre-start modules");xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);const dt=pt.DecoratorManager.listPreStartModule();for(const Z of dt){await ct.getAsync(Z)}xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);printStepDebugInfo("End of initialize and start");xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);return ct}async function destroyGlobalApplicationContext(Z){printStepDebugInfo("Ready to destroy applicationContext");const ct=await Z.getAsync(pt.MidwayLoggerService);const ut=ct.getCurrentLoggerFactory();printStepDebugInfo("Stopping lifecycle");const dt=await Z.getAsync(pt.MidwayLifeCycleService);await dt.stop();printStepDebugInfo("Stopping applicationContext");await Z.stop();printStepDebugInfo("Closing loggerFactory");ut.close();printStepDebugInfo("Cleaning performance manager");xt.MidwayPerformanceManager.cleanAll();global["MIDWAY_APPLICATION_CONTEXT"]=undefined;global["MIDWAY_MAIN_FRAMEWORK"]=undefined;Et=1;Ct++}async function prepareGlobalApplicationContextAsync(Z){printStepDebugInfo("Ready to create applicationContext");$t('[core]: start "initializeGlobalApplicationContext"');$t(`[core]: bootstrap options = ${ft.inspect(Z)}`);const ct=Z.appDir??"";const ut=Z.baseDir??"";xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const Et=Z.applicationContext??new pt.MidwayContainer;global["MIDWAY_APPLICATION_CONTEXT"]=Et;Et.registerObject("baseDir",ut);Et.registerObject("appDir",ct);if(Z.moduleLoader){Et.registerObject(bt.MODULE_LOADER_KEY,Z.moduleLoader)}if(!Z.asyncContextManager){Z.asyncContextManager=new St.AsyncLocalStorageContextManager}$t("[core]: set default module load type and entry file");xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);$t("[core]: set default file detector");xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Ready module detector");if(!Z.moduleLoadType){Z.moduleLoadType="commonjs"}Z.imports=[...Z.imports??[],await(0,vt.findProjectEntryFile)(ct,ut,Z.moduleLoadType,Z.moduleLoader)];xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding built-in service");Et.bindClass(pt.MidwayEnvironmentService);Et.bindClass(pt.MidwayInformationService);Et.bindClass(pt.MidwayAspectService);Et.bindClass(pt.MidwayDecoratorService);Et.bindClass(pt.MidwayConfigService);Et.bindClass(pt.MidwayLoggerService);Et.bindClass(pt.MidwayApplicationManager);Et.bindClass(pt.MidwayFrameworkService);Et.bindClass(pt.MidwayMiddlewareService);Et.bindClass(pt.MidwayLifeCycleService);Et.bindClass(pt.MidwayMockService);Et.bindClass(pt.MidwayWebRouterService);Et.bindClass(_t.MidwayServerlessFunctionService);Et.bindClass(mt.MidwayHealthService);Et.bindClass(pt.MidwayPriorityManager);Et.bindClass(ht.MidwayTraceService);printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const Ct=Et.get(pt.MidwayEnvironmentService);Ct.setModuleLoadType(Z.moduleLoadType);const Tt=Et.get(pt.MidwayConfigService);Tt.add([{default:dt.default}]);Et.get(pt.MidwayAspectService,[Et]);Et.get(pt.MidwayDecoratorService,[Et]);printStepDebugInfo("Binding preload module");if(Z.preloadModules&&Z.preloadModules.length){for(const ct of Z.preloadModules){Et.bindClass(ct)}}printStepDebugInfo("Load imports(component) and user code configuration module");xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);const wt=new yt.ComponentConfigurationLoader(Et);const At=[...Z.imports??[]];for(const Z of At){if(Z){await wt.load(Z)}}for(const Z of wt.getNamespaceList()){Et.addNamespace(Z);$t(`[core]: load configuration in namespace="${Z}" complete`)}xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(Z.globalConfig){if(Array.isArray(Z.globalConfig)){Tt.add(Z.globalConfig)}else{Tt.addObject(Z.globalConfig)}}printStepDebugInfo("Load config file");Tt.load();$t("[core]: Current config = %j",Tt.getConfiguration());xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);Et.get(pt.MidwayMiddlewareService,[Et]);return Et}function prepareGlobalApplicationContext(Z){printStepDebugInfo("Ready to create applicationContext");$t('[core]: start "initializeGlobalApplicationContext"');$t(`[core]: bootstrap options = ${ft.inspect(Z)}`);const ct=Z.appDir??"";const ut=Z.baseDir??"";xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const ht=Z.applicationContext??new pt.MidwayContainer;global["MIDWAY_APPLICATION_CONTEXT"]=ht;ht.registerObject("baseDir",ut);ht.registerObject("appDir",ct);if(Z.moduleLoader){ht.registerObject(bt.MODULE_LOADER_KEY,Z.moduleLoader)}if(!Z.asyncContextManager){Z.asyncContextManager=new St.AsyncLocalStorageContextManager}xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);$t("[core]: set default module load type and entry file");if(!Z.moduleLoadType){Z.moduleLoadType="commonjs"}Z.imports=[...Z.imports??[],(0,vt.findProjectEntryFileSync)(ct,ut)];printStepDebugInfo("Binding built-in service");ht.bindClass(pt.MidwayEnvironmentService);ht.bindClass(pt.MidwayInformationService);ht.bindClass(pt.MidwayAspectService);ht.bindClass(pt.MidwayDecoratorService);ht.bindClass(pt.MidwayConfigService);ht.bindClass(pt.MidwayLoggerService);ht.bindClass(pt.MidwayApplicationManager);ht.bindClass(pt.MidwayFrameworkService);ht.bindClass(pt.MidwayMiddlewareService);ht.bindClass(pt.MidwayLifeCycleService);ht.bindClass(pt.MidwayMockService);ht.bindClass(pt.MidwayWebRouterService);ht.bindClass(_t.MidwayServerlessFunctionService);ht.bindClass(mt.MidwayHealthService);ht.bindClass(pt.MidwayPriorityManager);printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const Et=ht.get(pt.MidwayEnvironmentService);Et.setModuleLoadType(Z.moduleLoadType);const Ct=ht.get(pt.MidwayConfigService);Ct.add([{default:dt.default}]);ht.get(pt.MidwayAspectService,[ht]);ht.get(pt.MidwayDecoratorService,[ht]);printStepDebugInfo("Binding preload module");if(Z.preloadModules&&Z.preloadModules.length){for(const ct of Z.preloadModules){ht.bindClass(ct)}}printStepDebugInfo("Load imports(component) and user code configuration module");const Tt=new yt.ComponentConfigurationLoader(ht);const wt=[...Z.imports??[]];xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);for(const Z of wt){if(Z){Tt.loadSync(Z)}}for(const Z of Tt.getNamespaceList()){ht.addNamespace(Z);$t(`[core]: load configuration in namespace="${Z}" complete`)}xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(Z.globalConfig){if(Array.isArray(Z.globalConfig)){Ct.add(Z.globalConfig)}else{Ct.addObject(Z.globalConfig)}}printStepDebugInfo("Load config file");Ct.load();$t("[core]: Current config = %j",Ct.getConfiguration());xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);ht.get(pt.MidwayMiddlewareService,[ht]);return ht}},44540:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.camelCase=camelCase;ct.pascalCase=pascalCase;const ut=/[\p{Lu}]/u;const pt=/[\p{Ll}]/u;const dt=/([\p{Alpha}\p{N}_]|$)/u;const ft=/[_.\- ]+/;const _t=new RegExp("^"+ft.source);const mt=new RegExp(ft.source+dt.source,"gu");const ht=new RegExp("\\d+"+dt.source,"gu");const preserveCamelCase=(Z,ct,dt)=>{let ft=false;let _t=false;let mt=false;for(let ht=0;ht<Z.length;ht++){const yt=Z[ht];if(ft&&ut.test(yt)){Z=Z.slice(0,ht)+"-"+Z.slice(ht);ft=false;mt=_t;_t=true;ht++}else if(_t&&mt&&pt.test(yt)){Z=Z.slice(0,ht-1)+"-"+Z.slice(ht-1);mt=_t;_t=false;ft=true}else{ft=ct(yt)===yt&&dt(yt)!==yt;mt=_t;_t=dt(yt)===yt&&ct(yt)!==yt}}return Z};const postProcess=(Z,ct)=>{mt.lastIndex=0;ht.lastIndex=0;return Z.replace(mt,((Z,ut)=>ct(ut))).replace(ht,(Z=>ct(Z)))};function camelCaseOrigin(Z,ct){ct={pascalCase:false,...ct};Z=Z.trim();if(Z.length===0){return""}const toLowerCase=Z=>Z.toLowerCase();const toUpperCase=Z=>Z.toUpperCase();if(Z.length===1){if(ft.test(Z)){return""}return ct.pascalCase?toUpperCase(Z):toLowerCase(Z)}const ut=Z!==toLowerCase(Z);if(ut){Z=preserveCamelCase(Z,toLowerCase,toUpperCase)}Z=Z.replace(_t,"");Z=toLowerCase(Z);if(ct.pascalCase){Z=toUpperCase(Z.charAt(0))+Z.slice(1)}return postProcess(Z,toUpperCase)}function camelCase(Z){return camelCaseOrigin(Z,{pascalCase:false})}function pascalCase(Z){return camelCaseOrigin(Z,{pascalCase:true})}},9177:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.getCurrentAsyncContextManager=ct.getCurrentMainApp=ct.getCurrentMainFramework=ct.getCurrentApplicationContext=void 0;const pt=ut(81680);const getCurrentApplicationContext=()=>global["MIDWAY_APPLICATION_CONTEXT"];ct.getCurrentApplicationContext=getCurrentApplicationContext;const getCurrentMainFramework=()=>global["MIDWAY_MAIN_FRAMEWORK"];ct.getCurrentMainFramework=getCurrentMainFramework;const getCurrentMainApp=()=>{const Z=(0,ct.getCurrentMainFramework)();if(Z){return Z.getApplication()}return undefined};ct.getCurrentMainApp=getCurrentMainApp;const getCurrentAsyncContextManager=()=>(0,ct.getCurrentApplicationContext)().get(pt.ASYNC_CONTEXT_MANAGER_KEY);ct.getCurrentAsyncContextManager=getCurrentAsyncContextManager},5904:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.extend=extend;const pt=ut(35175);function extend(...Z){let ct,ut,dt,ft,_t;let mt=Z[0];let ht=1;const yt=Z.length;let vt=false;if(typeof mt==="boolean"){vt=mt;mt=Z[1]||{};ht=2}else if(typeof mt!=="object"&&typeof mt!=="function"||mt==null){mt={}}for(;ht<yt;++ht){ct=Z[ht];if(ct==null)continue;for(ut in ct){if(ut==="__proto__")continue;dt=mt[ut];ft=ct[ut];if(mt===ft)continue;if(vt&&ft&&pt.Types.isPlainObject(ft)){_t=dt&&pt.Types.isPlainObject(dt)?dt:{};mt[ut]=extend(vt,_t,ft)}else if(typeof ft!=="undefined"){mt[ut]=ft}}}return mt}},17658:(Z,ct)=>{"use strict";
|
|
1
|
+
(()=>{var __webpack_modules__={34286:Z=>{function webpackEmptyAsyncContext(Z){return Promise.resolve().then((()=>{var ct=new Error("Cannot find module '"+Z+"'");ct.code="MODULE_NOT_FOUND";throw ct}))}webpackEmptyAsyncContext.keys=()=>[];webpackEmptyAsyncContext.resolve=webpackEmptyAsyncContext;webpackEmptyAsyncContext.id=34286;Z.exports=webpackEmptyAsyncContext},61242:Z=>{function webpackEmptyContext(Z){var ct=new Error("Cannot find module '"+Z+"'");ct.code="MODULE_NOT_FOUND";throw ct}webpackEmptyContext.keys=()=>[];webpackEmptyContext.resolve=webpackEmptyContext;webpackEmptyContext.id=61242;Z.exports=webpackEmptyContext},38818:(Z,ct,ut)=>{const{Bootstrap:pt}=ut(48797);pt.configure({imports:[ut(15545)]}).run()},14071:function(Z,ct,ut){"use strict";var pt=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});const dt=pt(ut(22078));const ft=ut(28234);const{logLevel:_t=""}=(0,dt.default)(process.argv.slice(2));ct["default"]={keys:"1755564797722_8890",koa:{globalPrefix:"/api"},midwayLogger:{default:{transports:{console:{level:"all"}}},clients:{appLogger:{level:_t||"warn"},coreLogger:{level:_t||"info"}}},cacheManager:{clients:{default:{store:"memory"}}},i18n:{defaultLocale:"zh",localeTable:{en:{default:ft.backendMessages.en},zh:{default:ft.backendMessages.zh}},writeCookie:false}}},91921:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct["default"]={}},12799:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ht=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});ct.MainConfiguration=void 0;const yt=ut(31049);const vt=_t(ut(58647));const St=_t(ut(18649));const bt=_t(ut(66909));const xt=_t(ut(25027));const $t=_t(ut(90381));const Et=_t(ut(98085));const Ct=_t(ut(14013));const Tt=_t(ut(59537));const wt=_t(ut(16928));const At=_t(ut(79896));const kt=ut(79896);const It=ut(24434);const Nt=ht(ut(10274));const Pt=ht(ut(44400));const Ot=ht(ut(22078));const Dt=ht(ut(77036));const Ft=ut(76289);const Mt=ut(60449);const Lt=ut(54633);const Rt=ut(59416);const Bt=ut(61142);const Vt=ut(64754);const jt=ut(10778);const Ut=_t(ut(14071));const Jt=_t(ut(91921));const zt=ut(74952);const Wt=ut(44120);const qt=_t(ut(67213));const Ht={DEFAULT_PORT:Number(zt.uri.getUrlPort(Mt.KEYS.LOCAL_SERVICE_URL_DEV)),DEFAULT_LOG_LEVEL:"info",MAX_SUB_PORT_RETRIES:20};function getErrorMessage(Z){if(Z instanceof Error)return Z.message;if(typeof Z==="string")return Z;return String(Z)}const Kt=(0,Ot.default)(process.argv.slice(2));const Gt={p:"port",port:"port",d:"dir",dir:"dir",l:"log",log:"log",api:"api","allow-debug":"allowDebug",cwd:"cwd"};function mergeConfigWithArgs(Z){const ct={...Z};for(const[Z,ut]of Object.entries(Gt)){const pt=Kt[Z];if(pt!==undefined){ct[ut]=pt}}return ct}async function loadComphubConfig(Z,ct){const ut=wt.join(Z,".comphub.json");const pt=wt.join(Z,".comphub.js");const dt=await zt.fileSys.readJsonFile(ut);if(dt){return dt}ct.info("未找到 .comphub.json,尝试加载 .comphub.js");try{const Z=await Promise.resolve(`${pt}`).then((Z=>_t(require(Z))));const ut=Z.default||Z;if(Object.keys(ut).length===0){ct.warn(".comphub.js 为空,使用默认配置")}return ut}catch{ct.info("用户未配置.comphub.js文件");return{}}}let Xt=class MainConfiguration{constructor(){this.appConfig=null;this.subServer=null;this._websitePath=null}get websitePath(){if(!this._websitePath){const Z=this.app.getEnv();this._websitePath=wt.resolve(__dirname,Z===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL?"../../../website":"./website")}return this._websitePath}get apiUrl(){const Z=this.app.getEnv();return Z===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL?Mt.KEYS.REMOTE_SERVICE_URL_DEV:Mt.KEYS.REMOTE_SERVICE_URL_PROD}getVersion(){const Z=this.app.getEnv();if(Z===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const Z=wt.join(__dirname,"../../cli/package.json");const ct=JSON.parse((0,kt.readFileSync)(Z,"utf8"));return ct.version}return process.env.COMP_HUB_VERSION||"unknown"}createProxyConfig(Z){const ct=new It.EventEmitter;const ut={...Z,on:{...Z.on,error:Z=>{this.logger.error("Proxy Error:",Z.message);ct.emit("error",Z)},proxyRes:()=>ct.emit("proxyRes"),proxyReq:Z=>{const ut=`${Z.protocol}//${Z.host}${Z.path}`;this.logger.debug("[Proxy] →",ut);ct.emit("proxyReq",Z)},proxyReqWs:(...Z)=>ct.emit("proxyReqWs",...Z)}};const pt=Z.pathRewrite;const dt=Object.keys(pt??{});if(dt.length>0){const[Z]=dt;ut.pathRewrite=ct=>{let ut=ct.replace(Mt.KEYS.PROXY_PATH_PREFIX,"");ut=ut.replace(new RegExp(Z),pt[Z]);return ut}}else{ut.pathRewrite=Z=>Z.replace(Mt.KEYS.PROXY_PATH_PREFIX,"")}return{proxy:(0,Ft.createProxyMiddleware)(ut),opt:ut,event:ct}}createProxyMap(Z){const ct={};for(const[ut,pt]of Object.entries(Z)){ct[ut]=this.createProxyConfig(pt)}return ct}setupProxy(){const Z=this.app.getAttr(Mt.KEYS.COMPHUB_CONFIG_KEY);if(Vt.ProxyController.proxys){for(const Z of Object.values(Vt.ProxyController.proxys)){Z.event.removeAllListeners()}}Vt.ProxyController.proxys={};if(!Z.proxy)return;Vt.ProxyController.proxys=this.createProxyMap(Z.proxy)}async buildConfig(){const Z=this.app.getEnv();let ct=Kt["cwd"];if(ct){if(!wt.isAbsolute(ct)){ct=wt.resolve(process.cwd(),ct)}try{await At.promises.access(ct)}catch(Z){throw new Error(getErrorMessage(Z))}}const ut=ct||process.cwd();this.logger.info("cwd:",ut);this.logger.info("env:",Z);const pt=await loadComphubConfig(ut,this.logger);const dt={port:Ht.DEFAULT_PORT,log:Ht.DEFAULT_LOG_LEVEL,allowDebug:false,api:this.apiUrl};const ft=mergeConfigWithArgs({...dt,...pt});const _t=wt.join(this.websitePath,Mt.KEYS.WEBSITE_PATH_MAIN);const mt=wt.join(ut,ft.dir||"");const ht=wt.join(ut,Mt.KEYS.PREBUILD_MODULE_DIR);const yt=wt.join(ut,"node_modules");await At.promises.mkdir(ht,{recursive:true});const vt={websitePath:_t,prebuildModulePath:ht,cwd:ut,port:ft.port,srcPath:mt,remoteServer:ft.api,logLevel:ft.log,version:this.getVersion(),allowDebug:ft.allowDebug,proxy:ft.proxy};jt.remoteInstance.defaults.baseURL=vt.remoteServer;if(Z===Mt.KEYS.LOCAL_MIDWAY_ENV_PROD){vt.port=await(0,Dt.default)({port:Dt.default.makeRange(vt.port,vt.port+100)})}this.appConfig=vt;const St={dirs:{default:{prefix:`/${Mt.KEYS.WEBSITE_PATH_MAIN}`,dir:_t},[Mt.KEYS.MODULE_LOAD_PREFIX]:{prefix:Mt.KEYS.MODULE_LOAD_PREFIX,dir:ht,maxAge:0},[Mt.KEYS.NODE_MODULES_LOAD_PREFIX]:{prefix:Mt.KEYS.NODE_MODULES_LOAD_PREFIX,dir:yt,maxAge:0},[Mt.KEYS.COMP_PREVIEW_PREFIX_LOCAL]:{prefix:Mt.KEYS.COMP_PREVIEW_PREFIX_LOCAL,dir:vt.srcPath,maxAge:0}}};try{await At.promises.access(_t,At.constants.F_OK)}catch(Z){this.logger.warn("websitePathMain 不存在:请先构建前端项目",getErrorMessage(Z));await At.promises.mkdir(_t,{recursive:true})}if(Z===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await At.promises.writeFile(wt.join(__dirname,".comphubConfig.json"),JSON.stringify(vt,null,2))}return{koa:{port:vt.port},staticFile:St,httpProxy:{strategy:{[Mt.KEYS.REMOTE_SERVICE_PREFIX]:{match:new RegExp(`^/${Mt.KEYS.REMOTE_SERVICE_PREFIX}/(.*)$`),target:`${vt.remoteServer}/$1`}}}}}async createKoaProxy(Z,ct,ut){return new Promise(((pt,dt)=>{const ft=(0,Ft.createProxyMiddleware)({target:ct,changeOrigin:true,secure:false,pathRewrite:ut,on:{proxyReq:(Z,ct,ut,pt)=>{const dt=pt.target.href;this.logger.debug("[Proxy] →",`${dt}${Z.path.slice(1)}`)},error:dt}});Z.res.on("finish",pt);Z.res.on("error",dt);ft(Z.req,Z.res,(Z=>{if(Z instanceof Error){dt(Z)}}))}))}async startSubPort(){const Z=this.app.getEnv();const ct=this.app.getAttr(Mt.KEYS.COMPHUB_CONFIG_KEY);const{port:ut,remoteServer:pt}=ct;let dt=await(0,Dt.default)({port:Dt.default.makeRange(ut,ut+100)});if(Z===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){dt=Number(zt.uri.getUrlPort(Mt.KEYS.LOCAL_SERVICE_URL_DEV_SUB))}const ft=new Nt.default;ft.use((async(Z,dt)=>{if(Z.path.startsWith(Mt.KEYS.COMP_PREVIEW_PREFIX_LOCAL)){const{srcPath:ut}=ct;const pt=Z.path[0];const dt=Z.path.replace(Mt.KEYS.COMP_PREVIEW_PREFIX_LOCAL,"");const ft=await zt.locate.resolveBuildPath(dt,{baseDir:ut});if(ft){const ct=ft.replace(ut,"");const _t=Wt.textKit.replaceSlashWithSpecifiedSeparator(ct,pt);if(dt!==_t){const ct=_t.replace(dt,"");Z.redirect(Z.path+ct);return}}}const ft=[{prefix:`/${Mt.KEYS.REMOTE_SERVICE_PREFIX}`,target:pt,rewrite:{[`^/${Mt.KEYS.REMOTE_SERVICE_PREFIX}`]:""}},{prefix:`/${Mt.KEYS.LOCAL_SERVICE_PREFIX}`,target:`${Mt.KEYS.IFRAME_HOST}:${ut}`,rewrite:{[`^/${Mt.KEYS.LOCAL_SERVICE_PREFIX}`]:""}},{prefix:Mt.KEYS.MODULE_LOAD_PREFIX,target:`${Mt.KEYS.IFRAME_HOST}:${ut}`,rewrite:{}},{prefix:Mt.KEYS.NODE_MODULES_LOAD_PREFIX,target:`${Mt.KEYS.IFRAME_HOST}:${ut}`,rewrite:{}},{prefix:Mt.KEYS.COMP_PREVIEW_PREFIX_LOCAL,target:`${Mt.KEYS.IFRAME_HOST}:${ut}`,rewrite:{}}];for(const ct of ft){if(Z.path.startsWith(ct.prefix)){await this.createKoaProxy(Z,ct.target,ct.rewrite);return}}await dt()}));ft.use((0,Pt.default)(this.websitePath,{index:false}));ft.use((async Z=>{try{const ct=(()=>{if(Z.path.startsWith(`${Mt.KEYS.IFRAME_ITEM_WEBSITE_PATH}/`)){return Mt.KEYS.IFRAME_ITEM_WEBSITE_PATH}if(Z.path.startsWith(`${Mt.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}/`)){return Mt.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}return""})();const ut=wt.join(this.websitePath,ct,"index.html");const pt=await At.promises.readFile(ut,"utf-8");const ft=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify({subPort:dt})};<\/script>`;const _t=pt.replace("\x3c!--GLOBAL_CONFIG--\x3e",ft);Z.type="text/html; charset=utf-8";Z.status=200;Z.body=_t}catch(ct){this.logger.error("读取 index.html 失败:",ct);Z.status=500;Z.body="服务器内部错误"}}));await new Promise(((ut,pt)=>{let _t=0;const mt=ft.listen(dt,(()=>{this.subServer=mt;this.app.setAttr(Mt.KEYS.COMPHUB_CONFIG_KEY,{...ct,subPort:dt});if(Z===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){this.logger.info(`子端口 ${dt} 已启动`)}ut()}));mt.on("error",(Z=>{if(Z.code==="EADDRINUSE"&&_t<Ht.MAX_SUB_PORT_RETRIES){_t++;this.logger.error(`子端口 ${dt} 被占用,正在尝试端口 ${++dt}`);mt.close();mt.listen(dt)}else{pt(Z)}}))}))}async printAccessInfo(Z){const ct=await Z.getAsync(vt.Framework);const ut=ct.getServer();const pt=ut.address();const dt=this.app.getEnv();if(pt&&typeof pt!=="string"){const Z=zt.network.getLocalIPv4();const ct=pt.port;this.logger.info("Local Address:",`[34mhttp://localhost:${ct}[0m`);if(Z){this.logger.info("Network Address:",`[34mhttp://${Z}:${ct}[0m`)}if(dt===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){this.logger.info("Swagger UI:",`[34mhttp://localhost:${ct}/swagger-ui/index.html[0m`)}}}async onConfigLoad(){const Z=await this.buildConfig();const ct=this.app.getEnv();if(ct===Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await At.promises.writeFile(wt.join(__dirname,".start.json"),JSON.stringify(Z,null,2))}return Z}async onReady(){this.app.setAttr(Mt.KEYS.COMPHUB_CONFIG_KEY,this.appConfig);this.app.useMiddleware([Bt.ReportMiddleware]);this.app.useFilter([Rt.BadRequestErrorFilter,Lt.DefaultErrorFilter])}async onServerReady(Z){this.setupProxy();await this.startSubPort();await this.printAccessInfo(Z)}async onStop(){if(this.subServer){await new Promise((Z=>{this.subServer.close((()=>Z()))}));this.logger.info("子服务已关闭")}}};ct.MainConfiguration=Xt;ft([(0,yt.Logger)("coreLogger"),mt("design:type",Object)],Xt.prototype,"logger",void 0);ft([(0,yt.MainApp)(),mt("design:type",Object)],Xt.prototype,"app",void 0);ct.MainConfiguration=Xt=ft([(0,yt.Configuration)({detector:new yt.CommonJSFileDetector,imports:[vt,St,xt,Et,Ct,Tt,qt,{component:bt,enabledEnvironment:[Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL]},{component:$t,enabledEnvironment:[Mt.KEYS.LOCAL_MIDWAY_ENV_LOCAL]}],importConfigs:[{default:Ut,local:Jt}]})],Xt)},64754:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft;Object.defineProperty(ct,"__esModule",{value:true});ct.ProxyController=void 0;const _t=ut(31049);const mt=ut(60449);const ht=mt.KEYS.PROXY_PATH_PREFIX;let yt=ft=class ProxyController{async proxy(){const Z=this.ctx.path.replace(ht,"");let ct=null;for(const[ut,pt]of Object.entries(ft.proxys)){const dt=new RegExp(ut);if(dt.test(Z)||Z.startsWith(ut)){ct=pt;break}}if(!ct){this.ctx.status=404;this.ctx.body={message:"Proxy not found"};return}const{proxy:ut,event:pt}=ct;await new Promise(((Z,ct)=>{ut(this.ctx.req,this.ctx.res);pt.on("error",ct);pt.on("proxyRes",Z)}))}};ct.ProxyController=yt;pt([(0,_t.Inject)(),dt("design:type",Object)],yt.prototype,"ctx",void 0);pt([(0,_t.All)("/*"),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],yt.prototype,"proxy",null);ct.ProxyController=yt=ft=pt([(0,_t.Controller)(ht,{ignoreGlobalPrefix:true})],yt)},17076:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.SpaController=void 0;const ht=ut(31049);const yt=_t(ut(79896));const vt=ut(16928);const St=ut(90381);const bt=ut(63366);const xt=ut(60449);let $t=class SpaController{async index(){this.ctx.redirect(`/${xt.KEYS.WEBSITE_PATH_MAIN}/`)}async spa(){const Z=this.configService.comphubConfig();const{websitePath:ct}=Z;const ut=(0,vt.resolve)(ct,"index.html");let pt=await yt.promises.readFile(ut,"utf-8");const dt=this.configService.getGlobalConfig();const ft=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify(dt)};<\/script>`;pt=pt.replace("\x3c!--GLOBAL_CONFIG--\x3e",ft);return pt}async getGlobalConfig(){return this.configService.getGlobalConfig()}};ct.SpaController=$t;ft([(0,ht.Inject)(),mt("design:type",Object)],$t.prototype,"ctx",void 0);ft([(0,ht.MainApp)(),mt("design:type",Object)],$t.prototype,"app",void 0);ft([(0,ht.Inject)(),mt("design:type",bt.ConfigService)],$t.prototype,"configService",void 0);ft([(0,ht.Get)("/"),mt("design:type",Function),mt("design:paramtypes",[]),mt("design:returntype",Promise)],$t.prototype,"index",null);ft([(0,ht.Get)(`/${xt.KEYS.WEBSITE_PATH_MAIN}/*`),mt("design:type",Function),mt("design:paramtypes",[]),mt("design:returntype",Promise)],$t.prototype,"spa",null);ft([(0,ht.Get)(xt.KEYS.GLOBAL_CONFIG_PATH),mt("design:type",Function),mt("design:paramtypes",[]),mt("design:returntype",Promise)],$t.prototype,"getGlobalConfig",null);ct.SpaController=$t=ft([(0,St.ApiExcludeController)(),(0,ht.Controller)("/",{ignoreGlobalPrefix:true})],$t)},78805:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft=this&&this.__param||function(Z,ct){return function(ut,pt){ct(ut,pt,Z)}};Object.defineProperty(ct,"__esModule",{value:true});ct.CompController=void 0;const _t=ut(31049);const mt=ut(48795);const ht=ut(63366);const yt=ut(90381);const vt=ut(8131);const St=ut(101);const bt=ut(19465);const xt=ut(93597);const $t=ut(6586);let Et=class CompController{async dir(Z){const ct=await this.compService.getCompDir(Z.compPath);return xt.resUtil.success(ct)}async file(Z){const{filePath:ct}=Z;const ut=await this.compService.getCompFile(ct);return xt.resUtil.success({content:ut})}async check(Z){const ct=await this.compService.checkCompConfig(Z.compPath);return xt.resUtil.success(ct)}async updateVersion(Z){const{compPath:ct,version:ut}=Z;await this.compService.updateCompVersion(ct,ut);return xt.resUtil.noData()}async generateCompJson(Z){const{compPath:ct}=Z;await this.compService.generateCompJson(ct);return xt.resUtil.noData()}async dep(Z){const{compPath:ct}=Z;const ut=await this.compService.getCompDep(ct);return xt.resUtil.success({thirdParty:ut})}async checkCompRepeat(Z){await $t.remoteApi.v1Token.tokencontrollerApproachexpire();const ct=await this.compService.checkCompRepeat(Z);return xt.resUtil.success(ct)}async submit(Z){await $t.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.submitComp(Z);return xt.resUtil.noData()}async update(Z){await $t.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.updateComp(Z);return xt.resUtil.noData()}async download(Z){const ct=await this.compService.downloadComp(Z);if(ct?.isRepeat){return xt.resUtil.success({isRepeat:true})}return xt.resUtil.success({isRepeat:false})}async localCompsByIds(Z){const{compIds:ct}=Z;const ut=await this.compService.getLocalCompsByIds(ct);return xt.resUtil.success({compInfos:ut})}async compFilesOssSignedUrl(Z){const ct=await this.compService.getCompFilesOssSignedUrl(Z);return xt.resUtil.success(ct)}async packageJson(){const Z=await this.compService.getPackageJsonContent();return xt.resUtil.success({packageJson:Z})}async compFileHash(Z){const ct=await this.compService.getCompFileHash(Z);return xt.resUtil.success(ct)}async localComps(Z){const ct=await this.compService.getLocalComps(Z);return xt.resUtil.success(ct)}async openCompPathInVscode(Z){await this.compService.openCompPathInVscode(Z);return xt.resUtil.noData()}async localCompDetailByPathHash(Z){const ct=await this.compService.getLocalCompDetailByPathHash(Z);return xt.resUtil.success(ct)}};ct.CompController=Et;pt([(0,_t.MainApp)(),dt("design:type",Object)],Et.prototype,"app",void 0);pt([(0,_t.Inject)(),dt("design:type",mt.CompService)],Et.prototype,"compService",void 0);pt([(0,_t.Inject)(),dt("design:type",ht.ConfigService)],Et.prototype,"configService",void 0);pt([(0,yt.ApiOperation)({summary:"获取组件目录"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.CompFileVO)}),(0,_t.Post)("/dir"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.CompDirDTO]),dt("design:returntype",Promise)],Et.prototype,"dir",null);pt([(0,yt.ApiOperation)({summary:"获取组件目录内指定文件的内容"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.CompFileContentVO)}),(0,_t.Post)("/file"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.CompFileDTO]),dt("design:returntype",Promise)],Et.prototype,"file",null);pt([(0,yt.ApiOperation)({summary:"检查组件配置是否符合规范"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.CompCheckVO)}),(0,_t.Post)("/check"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.CompCheckDTO]),dt("design:returntype",Promise)],Et.prototype,"check",null);pt([(0,yt.ApiOperation)({summary:"更新组件版本号"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:xt.NoData}),(0,_t.Post)("/updateVersion"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.UpdateVersionDTO]),dt("design:returntype",Promise)],Et.prototype,"updateVersion",null);pt([(0,yt.ApiOperation)({summary:"生成组件指纹文件"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:xt.NoData}),(0,_t.Post)("/generateCompJson"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.GenerateCompJsonDTO]),dt("design:returntype",Promise)],Et.prototype,"generateCompJson",null);pt([(0,yt.ApiOperation)({summary:"获取组件依赖关系"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.ImportScanResultVO)}),(0,_t.Post)("/dep"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.DepDTO]),dt("design:returntype",Promise)],Et.prototype,"dep",null);pt([(0,yt.ApiOperation)({summary:"检查组件是否重复"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.CompSimilarListVO)}),(0,_t.Post)("/checkCompRepeat",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.CheckCompRepeatDTO]),dt("design:returntype",Promise)],Et.prototype,"checkCompRepeat",null);pt([(0,yt.ApiOperation)({summary:"提交组件"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:xt.NoData}),(0,_t.Post)("/submit",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.SubmitCompDTO]),dt("design:returntype",Promise)],Et.prototype,"submit",null);pt([(0,yt.ApiOperation)({summary:"更新组件"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:xt.NoData}),(0,_t.Post)("/update",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.UpdateCompDTO]),dt("design:returntype",Promise)],Et.prototype,"update",null);pt([(0,yt.ApiOperation)({summary:"下载组件"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.DownloadCompVO)}),(0,_t.Post)("/download",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.DownloadCompDTO]),dt("design:returntype",Promise)],Et.prototype,"download",null);pt([(0,yt.ApiOperation)({summary:"通过ids在本地查询组件"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.LocalCompsByIdsVO)}),(0,_t.Post)("/localCompsByIds"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.LocalCompsByIdsDTO]),dt("design:returntype",Promise)],Et.prototype,"localCompsByIds",null);pt([(0,yt.ApiOperation)({summary:"获取组件文件夹下所有文件的oss签名访问地址"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.CompFilesOssSignedUrlVO)}),(0,_t.Post)("/compFilesOssSignedUrl",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.CompFilesOssSignedUrlDTO]),dt("design:returntype",Promise)],Et.prototype,"compFilesOssSignedUrl",null);pt([(0,yt.ApiOperation)({summary:"获取package.json"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.PackageJsonVO)}),(0,_t.Post)("/packageJson"),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],Et.prototype,"packageJson",null);pt([(0,yt.ApiOperation)({summary:"获取组件文件hash"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.CompFileHashVO)}),(0,_t.Post)("/compFileHash"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.CompFileHashDTO]),dt("design:returntype",Promise)],Et.prototype,"compFileHash",null);pt([(0,yt.ApiOperation)({summary:"获取本地组件列表,分页查询"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)((0,xt.createListWrapper)(St.LocalCompsVO))}),(0,_t.Post)("/localComps",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.LocalCompsDTO]),dt("design:returntype",Promise)],Et.prototype,"localComps",null);pt([(0,yt.ApiOperation)({summary:"通过组件路径打开在vscode中打开所在文件夹"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:xt.NoData}),(0,_t.Post)("/openCompPathInVscode"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.OpenCompPathInVscodeDTO]),dt("design:returntype",Promise)],Et.prototype,"openCompPathInVscode",null);pt([(0,yt.ApiOperation)({summary:"通过组件完整文件路径hash获取组件信息"}),(0,yt.ApiResponse)({status:200,description:"返回结果",type:(0,xt.createSuccessWrapper)(St.LocalCompDetailVO)}),(0,_t.Post)("/localCompDetailByPathHash"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[vt.LocalCompDetailByPathHashDTO]),dt("design:returntype",Promise)],Et.prototype,"localCompDetailByPathHash",null);ct.CompController=Et=pt([(0,yt.ApiTags)(["v1-comp"]),(0,_t.Controller)("/v1/comp")],Et)},91308:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft=this&&this.__param||function(Z,ct){return function(ut,pt){ct(ut,pt,Z)}};Object.defineProperty(ct,"__esModule",{value:true});ct.ModuleController=void 0;const _t=ut(31049);const mt=ut(90381);const ht=ut(85984);const yt=ut(19428);const vt=ut(71692);const St=ut(61275);const bt=ut(93597);let xt=class ModuleController{async preBuild(Z){const{deps:ct}=Z;let ut=null;await this.queueService.enqueue((async()=>{ut=await this.moduleService.preBuild(ct)}));return bt.resUtil.success(ut)}async preBuildSize(){const Z=await this.moduleService.preBuildSize();return bt.resUtil.success({size:Z})}async clearPreBuild(){await this.moduleService.clearPreBuild();return bt.resUtil.noData()}};ct.ModuleController=xt;pt([(0,_t.Inject)(),dt("design:type",ht.ModuleService)],xt.prototype,"moduleService",void 0);pt([(0,_t.Inject)(),dt("design:type",St.QueueService)],xt.prototype,"queueService",void 0);pt([(0,mt.ApiOperation)({summary:"模块预构建"}),(0,mt.ApiResponse)({status:200,description:"返回结果",type:(0,bt.createSuccessWrapper)(vt.PreBuildVO)}),(0,_t.Post)("/preBuild"),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[yt.PreBuildDTO]),dt("design:returntype",Promise)],xt.prototype,"preBuild",null);pt([(0,mt.ApiOperation)({summary:"获取预构建模块文件总大小"}),(0,mt.ApiResponse)({status:200,description:"返回结果",type:(0,bt.createSuccessWrapper)(vt.PreBuildSizeVO)}),(0,_t.Post)("/preBuildSize"),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],xt.prototype,"preBuildSize",null);pt([(0,mt.ApiOperation)({summary:"清除预构建模块文件"}),(0,mt.ApiResponse)({status:200,description:"返回结果",type:bt.NoData}),(0,_t.Post)("/clearPreBuild"),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],xt.prototype,"clearPreBuild",null);ct.ModuleController=xt=pt([(0,mt.ApiTags)(["v1-module"]),(0,_t.Controller)("/v1/module")],xt)},5387:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft=this&&this.__param||function(Z,ct){return function(ut,pt){ct(ut,pt,Z)}};Object.defineProperty(ct,"__esModule",{value:true});ct.OssController=void 0;const _t=ut(31049);const mt=ut(90381);const ht=ut(93597);const yt=ut(56415);const vt=ut(75049);const St=ut(80799);const bt=ut(19465);let xt=class OssController{async fileSignUrl(Z){const{objectId:ct}=Z;const ut=await this.ossService.getDownloadSts();const pt=await this.ossService.getFilePreviewUrl(ut,ct);return ht.resUtil.success({signUrl:pt})}};ct.OssController=xt;pt([(0,_t.MainApp)(),dt("design:type",Object)],xt.prototype,"app",void 0);pt([(0,_t.Inject)(),dt("design:type",St.OssService)],xt.prototype,"ossService",void 0);pt([(0,mt.ApiOperation)({summary:"获取文件访问地址",description:"获取文件访问地址"}),(0,mt.ApiResponse)({status:200,description:"返回结果",type:(0,ht.createSuccessWrapper)(vt.SignedUrlVO)}),(0,_t.Post)("/fileSignUrl",{middleware:[bt.TokenMiddleware]}),ft(0,(0,_t.Body)()),dt("design:type",Function),dt("design:paramtypes",[yt.SignedUrlDTO]),dt("design:returntype",Promise)],xt.prototype,"fileSignUrl",null);ct.OssController=xt=pt([(0,mt.ApiTags)(["v1-oss"]),(0,_t.Controller)("/v1/oss")],xt)},6444:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft=this&&this.__param||function(Z,ct){return function(ut,pt){ct(ut,pt,Z)}};Object.defineProperty(ct,"__esModule",{value:true});ct.PreprocessingController=void 0;const _t=ut(90381);const mt=ut(31049);const ht=ut(90218);const yt=ut(18922);const vt=ut(5578);const St=ut(93597);let bt=class PreprocessingController{async preprocess(Z){const ct=await this.preprocessingService.preprocessCode(Z);return St.resUtil.success({preprocessedCode:ct})}};ct.PreprocessingController=bt;pt([(0,mt.Inject)(),dt("design:type",vt.PreprocessingService)],bt.prototype,"preprocessingService",void 0);pt([(0,_t.ApiOperation)({summary:"css预处理",description:"预处理css代码"}),(0,_t.ApiResponse)({status:200,description:"返回结果",type:(0,St.createSuccessWrapper)(yt.PreprocessedCodeVO)}),(0,mt.Post)("/preprocess"),ft(0,(0,mt.Body)()),dt("design:type",Function),dt("design:paramtypes",[ht.PreprocessingDTO]),dt("design:returntype",Promise)],bt.prototype,"preprocess",null);ct.PreprocessingController=bt=pt([(0,_t.ApiTags)(["v1-preprocessing"]),(0,mt.Controller)("/v1/preprocessing")],bt)},20346:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft=this&&this.__param||function(Z,ct){return function(ut,pt){ct(ut,pt,Z)}};Object.defineProperty(ct,"__esModule",{value:true});ct.VuefinderController=void 0;const _t=ut(31049);const mt=ut(5808);const ht=ut(90381);const yt=ut(23444);let vt=class VuefinderController{async list(Z){const ct=await this.vuefinderService.list(Z);return ct}};ct.VuefinderController=vt;pt([(0,_t.MainApp)(),dt("design:type",Object)],vt.prototype,"app",void 0);pt([(0,_t.Inject)(),dt("design:type",mt.VuefinderService)],vt.prototype,"vuefinderService",void 0);pt([(0,ht.ApiOperation)({summary:"list"}),(0,_t.Get)("/list"),ft(0,(0,_t.Query)()),dt("design:type",Function),dt("design:paramtypes",[yt.VueFinderIndexDTO]),dt("design:returntype",Promise)],vt.prototype,"list",null);ct.VuefinderController=vt=pt([(0,ht.ApiTags)(["v1-vuefinder"]),(0,_t.Controller)("/v1/vuefinder")],vt)},60149:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.BasePageDTO=void 0;const ft=ut(90381);const _t=ut(18649);class BasePageDTO{}ct.BasePageDTO=BasePageDTO;pt([(0,ft.ApiProperty)({example:1,description:"当前页码",required:false}),(0,_t.Rule)(_t.RuleType.number().min(1)),dt("design:type",Number)],BasePageDTO.prototype,"page",void 0);pt([(0,ft.ApiProperty)({example:10,description:"每页数量",required:false}),(0,_t.Rule)(_t.RuleType.number().min(1).max(50)),dt("design:type",Number)],BasePageDTO.prototype,"pageSize",void 0);pt([(0,_t.Rule)(_t.RuleType.string().allow("").max(50).pattern(/\{\s*\$\w+:/i,{invert:true}).trim()),(0,ft.ApiProperty)({example:"小明",description:"关键词",required:false}),dt("design:type",String)],BasePageDTO.prototype,"keyword",void 0)},8131:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.LocalCompDetailByPathHashDTO=ct.OpenCompPathInVscodeDTO=ct.LocalCompsDTO=ct.CompFilesOssSignedUrlDTO=ct.DownloadCompDTO=ct.UpdateCompDTO=ct.SubmitCompDTO=ct.CompFileDTO=ct.UpdateVersionDTO=ct.CompFileHashDTO=ct.CheckCompRepeatDTO=ct.LocalCompsByIdsDTO=ct.DepDTO=ct.GenerateCompJsonDTO=ct.CompCheckDTO=ct.CompDirDTO=void 0;const ft=ut(90381);const _t=ut(18649);const mt=ut(60149);class CompPathDTO{}pt([(0,ft.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],CompPathDTO.prototype,"compPath",void 0);class CompIdDTO{}pt([(0,ft.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],CompIdDTO.prototype,"compId",void 0);class CompDirDTO extends CompPathDTO{}ct.CompDirDTO=CompDirDTO;class CompCheckDTO extends CompPathDTO{}ct.CompCheckDTO=CompCheckDTO;class GenerateCompJsonDTO extends CompPathDTO{}ct.GenerateCompJsonDTO=GenerateCompJsonDTO;class DepDTO extends CompPathDTO{}ct.DepDTO=DepDTO;class LocalCompsByIdsDTO{}ct.LocalCompsByIdsDTO=LocalCompsByIdsDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件id列表",example:["123","456"]}),(0,_t.Rule)(_t.RuleType.array().required().items(_t.RuleType.string())),dt("design:type",Array)],LocalCompsByIdsDTO.prototype,"compIds",void 0);class CheckCompRepeatDTO extends CompPathDTO{}ct.CheckCompRepeatDTO=CheckCompRepeatDTO;pt([(0,ft.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,_t.Rule)(_t.RuleType.string()),dt("design:type",String)],CheckCompRepeatDTO.prototype,"teamId",void 0);class CompFileHashDTO extends CompPathDTO{}ct.CompFileHashDTO=CompFileHashDTO;class UpdateVersionDTO extends CompPathDTO{}ct.UpdateVersionDTO=UpdateVersionDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件版本号",example:"1.0.0"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],UpdateVersionDTO.prototype,"version",void 0);class CompFileDTO{}ct.CompFileDTO=CompFileDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件文件路径",example:"/src/components/MyComp/index.vue"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],CompFileDTO.prototype,"filePath",void 0);class PreviewItemDTO{}pt([(0,ft.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),(0,_t.Rule)(_t.RuleType.array().required().items(_t.RuleType.string())),dt("design:type",Array)],PreviewItemDTO.prototype,"miniPath",void 0);pt([(0,ft.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),(0,_t.Rule)(_t.RuleType.array().optional().items(_t.RuleType.string())),dt("design:type",Array)],PreviewItemDTO.prototype,"fullPath",void 0);pt([(0,ft.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),(0,_t.Rule)(_t.RuleType.string()),dt("design:type",String)],PreviewItemDTO.prototype,"desc",void 0);class ParentDTO{}pt([(0,ft.ApiProperty)({description:"父库名称",required:true,example:"vue"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],ParentDTO.prototype,"name",void 0);pt([(0,ft.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],ParentDTO.prototype,"version",void 0);class DepItemDTO{}pt([(0,ft.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],DepItemDTO.prototype,"name",void 0);pt([(0,ft.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],DepItemDTO.prototype,"version",void 0);pt([(0,ft.ApiProperty)({type:ParentDTO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),(0,_t.Rule)(_t.RuleType.object().optional()),dt("design:type",ParentDTO)],DepItemDTO.prototype,"parent",void 0);class SubmitCompDTO{}ct.SubmitCompDTO=SubmitCompDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],SubmitCompDTO.prototype,"name",void 0);pt([(0,ft.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],SubmitCompDTO.prototype,"compPath",void 0);pt([(0,ft.ApiProperty)({type:[DepItemDTO],required:true,description:"组件依赖"}),(0,_t.Rule)(_t.RuleType.array().required()),dt("design:type",Array)],SubmitCompDTO.prototype,"dep",void 0);pt([(0,ft.ApiProperty)({type:[PreviewItemDTO],required:true,description:"组件预览数据"}),(0,_t.Rule)(_t.RuleType.array().required()),dt("design:type",Array)],SubmitCompDTO.prototype,"previewConfigs",void 0);pt([(0,ft.ApiProperty)({required:true,description:"组件描述",example:"这是一个组件"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],SubmitCompDTO.prototype,"desc",void 0);pt([(0,ft.ApiProperty)({required:false,description:"组件背景颜色",example:"#f0f0f0"}),(0,_t.Rule)(_t.RuleType.string().empty("").default("")),dt("design:type",String)],SubmitCompDTO.prototype,"bgColor",void 0);pt([(0,ft.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,_t.Rule)(_t.RuleType.string()),dt("design:type",String)],SubmitCompDTO.prototype,"teamId",void 0);class UpdateCompDTO extends SubmitCompDTO{}ct.UpdateCompDTO=UpdateCompDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],UpdateCompDTO.prototype,"compId",void 0);pt([(0,ft.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,_t.Rule)(_t.RuleType.string()),dt("design:type",String)],UpdateCompDTO.prototype,"teamId",void 0);pt([(0,ft.ApiProperty)({required:false,description:"组件升级描述",example:"升级组件描述"}),(0,_t.Rule)(_t.RuleType.string().allow("").max(200)),dt("design:type",String)],UpdateCompDTO.prototype,"upgradeDesc",void 0);class DownloadCompDTO extends CompIdDTO{}ct.DownloadCompDTO=DownloadCompDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件下载路径",example:"/src/components/MyComp"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],DownloadCompDTO.prototype,"savePath",void 0);pt([(0,ft.ApiProperty)({required:false,description:"是否覆盖",example:true}),(0,_t.Rule)(_t.RuleType.boolean().default(false)),dt("design:type",Boolean)],DownloadCompDTO.prototype,"isCover",void 0);pt([(0,ft.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],DownloadCompDTO.prototype,"compName",void 0);pt([(0,ft.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],DownloadCompDTO.prototype,"version",void 0);class CompFilesOssSignedUrlDTO{}ct.CompFilesOssSignedUrlDTO=CompFilesOssSignedUrlDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"version",void 0);pt([(0,ft.ApiProperty)({required:true,description:"对象存储id",example:"123"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"objectId",void 0);pt([(0,ft.ApiProperty)({required:true,description:"组件文件路径",example:"MyComp/index.vue"}),(0,_t.Rule)(_t.RuleType.array().required().items(_t.RuleType.string())),dt("design:type",Array)],CompFilesOssSignedUrlDTO.prototype,"files",void 0);class LocalCompsDTO extends mt.BasePageDTO{}ct.LocalCompsDTO=LocalCompsDTO;class OpenCompPathInVscodeDTO{}ct.OpenCompPathInVscodeDTO=OpenCompPathInVscodeDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],OpenCompPathInVscodeDTO.prototype,"folderPath",void 0);pt([(0,ft.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],OpenCompPathInVscodeDTO.prototype,"relativeFilePath",void 0);class LocalCompDetailByPathHashDTO{}ct.LocalCompDetailByPathHashDTO=LocalCompDetailByPathHashDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件完整文件路径hash",example:"1234567890"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],LocalCompDetailByPathHashDTO.prototype,"fullPathHash",void 0)},19428:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.PreBuildDTO=void 0;const ft=ut(90381);const _t=ut(18649);class PreBuildDTO{}ct.PreBuildDTO=PreBuildDTO;pt([(0,ft.ApiProperty)({required:true,description:"组件依赖",example:["axios","md5"]}),(0,_t.Rule)(_t.RuleType.array().required().items(_t.RuleType.string())),dt("design:type",Array)],PreBuildDTO.prototype,"deps",void 0)},56415:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.SignedUrlDTO=void 0;const ft=ut(90381);const _t=ut(18649);class SignedUrlDTO{}ct.SignedUrlDTO=SignedUrlDTO;pt([(0,_t.Rule)(_t.RuleType.string().required().error(new Error("对象id不能为空"))),(0,ft.ApiProperty)({example:"xcxcxdas",description:"对象id",required:true}),dt("design:type",String)],SignedUrlDTO.prototype,"objectId",void 0)},90218:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.PreprocessingDTO=void 0;const ft=ut(90381);const _t=ut(18649);const mt=ut(34985);class PreprocessingDTO{}ct.PreprocessingDTO=PreprocessingDTO;pt([(0,ft.ApiProperty)({description:"css代码"}),(0,_t.Rule)(_t.RuleType.string().required()),dt("design:type",String)],PreprocessingDTO.prototype,"cssCode",void 0);pt([(0,ft.ApiProperty)({enum:mt.PrecompilerEnum,example:mt.PrecompilerEnum.SASS,description:"预编译器类型",required:false}),(0,_t.Rule)(_t.RuleType.string().valid(...Object.values(mt.PrecompilerEnum))),dt("design:type",String)],PreprocessingDTO.prototype,"precompilerType",void 0)},23444:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.VueFinderIndexDTO=void 0;const ft=ut(90381);const _t=ut(18649);class VueFinderIndexDTO{}ct.VueFinderIndexDTO=VueFinderIndexDTO;pt([(0,ft.ApiProperty)({required:false,description:"文件路径"}),(0,_t.Rule)(_t.RuleType.string()),dt("design:type",String)],VueFinderIndexDTO.prototype,"path",void 0)},59416:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.BadRequestErrorFilter=void 0;const dt=ut(31049);const ft=ut(93597);const _t=ut(60449);let mt=class BadRequestErrorFilter{async catch(Z,ct){const ut=ct.app.getEnv();if(ut===_t.KEYS.LOCAL_MIDWAY_ENV_LOCAL){ct.logger.error("BadRequestErrorFilter==>",Z)}return ft.resUtil.error(Z.message,Z.status)}};ct.BadRequestErrorFilter=mt;ct.BadRequestErrorFilter=mt=pt([(0,dt.Catch)(dt.httpError.BadRequestError)],mt)},54633:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.DefaultErrorFilter=void 0;const dt=ut(31049);const ft=ut(60449);let _t=class DefaultErrorFilter{async catch(Z,ct){const ut=ct.app.getEnv();try{const ct=JSON.parse(Z.message);return{...ct}}catch(Z){if(ut===ft.KEYS.LOCAL_MIDWAY_ENV_LOCAL){ct.logger.error("解析错误信息失败==>",Z.message,"\n")}}finally{if(ut===ft.KEYS.LOCAL_MIDWAY_ENV_LOCAL){ct.logger.error("原始错误==>",Z)}}ct.status=Z.status??500;return{code:Z.status??500,message:Z.message??"未知错误"}}};ct.DefaultErrorFilter=_t;ct.DefaultErrorFilter=_t=pt([(0,dt.Catch)()],_t)},15545:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.Configuration=void 0;var ft=ut(12799);Object.defineProperty(ct,"Configuration",{enumerable:true,get:function(){return ft.MainConfiguration}});dt(ut(14071),ct);dt(ut(91921),ct);dt(ut(64754),ct);dt(ut(17076),ct);dt(ut(78805),ct);dt(ut(91308),ct);dt(ut(5387),ct);dt(ut(6444),ct);dt(ut(20346),ct);dt(ut(60149),ct);dt(ut(8131),ct);dt(ut(19428),ct);dt(ut(56415),ct);dt(ut(34985),ct);dt(ut(90218),ct);dt(ut(23444),ct);dt(ut(59416),ct);dt(ut(54633),ct);dt(ut(9711),ct);dt(ut(53951),ct);dt(ut(77523),ct);dt(ut(61142),ct);dt(ut(19465),ct);dt(ut(95637),ct);dt(ut(48795),ct);dt(ut(63366),ct);dt(ut(23086),ct);dt(ut(85984),ct);dt(ut(80799),ct);dt(ut(5578),ct);dt(ut(61275),ct);dt(ut(19452),ct);dt(ut(5808),ct);dt(ut(66593),ct);dt(ut(58953),ct);dt(ut(10778),ct);dt(ut(101),ct);dt(ut(71692),ct);dt(ut(75049),ct);dt(ut(18922),ct)},9711:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},53951:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},34985:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.PrecompilerEnum=void 0;var ut;(function(Z){Z["LESS"]="less";Z["SASS"]="sass";Z["SCSS"]="scss"})(ut||(ct.PrecompilerEnum=ut={}))},77523:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},61142:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.ReportMiddleware=void 0;const dt=ut(31049);let ft=class ReportMiddleware{resolve(){return async(Z,ct)=>{const ut=Date.now();const pt=await ct();const dt=Z.url;Z.logger.debug(`请求 ${dt} 耗时 = ${Date.now()-ut}ms`);return pt}}static getName(){return"report"}};ct.ReportMiddleware=ft;ct.ReportMiddleware=ft=pt([(0,dt.Middleware)()],ft)},19465:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.TokenMiddleware=void 0;const dt=ut(31049);const ft=ut(10778);let _t=class TokenMiddleware{resolve(){return async(Z,ct)=>{(0,ft.setHeader)(Z.header);await ct()}}static getName(){return"token"}};ct.TokenMiddleware=_t;ct.TokenMiddleware=_t=pt([(0,dt.Middleware)()],_t)},95637:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});ct.CommandService=void 0;const _t=ut(31049);const mt=ft(ut(79896));const ht=ut(63366);const yt=ut(94798);const vt=ft(ut(16928));const St=ut(67213);let bt=class CommandService{async revealInVSCode(Z,ct,ut=1,pt=1){const{cwd:dt}=this.configService.comphubConfig();if(!Z||!mt.default.existsSync(Z)||!mt.default.statSync(Z).isDirectory()){throw new _t.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist"))}const ft=vt.default.resolve(Z,ct);if(!mt.default.existsSync(ft)||mt.default.statSync(ft).isDirectory()){throw new _t.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist"))}(0,yt.launchIDE)({file:dt});(0,yt.launchIDE)({file:ft,line:ut,column:pt})}};ct.CommandService=bt;pt([(0,_t.Inject)(),dt("design:type",ht.ConfigService)],bt.prototype,"configService",void 0);pt([(0,_t.Inject)(),dt("design:type",Object)],bt.prototype,"ctx",void 0);pt([(0,_t.Inject)(),dt("design:type",St.MidwayI18nService)],bt.prototype,"i18nService",void 0);ct.CommandService=bt=pt([(0,_t.Provide)()],bt)},48795:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.CompService=void 0;const ht=ut(31049);const yt=_t(ut(16928));const vt=_t(ut(79896));const St=ut(63366);const bt=ut(23086);const xt=ut(80799);const $t=_t(ut(70857));const Et=_t(ut(83929));const Ct=ut(74952);const Tt=ut(84464);const wt=ut(95637);const At=ut(60449);const kt=ut(44120);const It=ut(6586);const Nt=ut(67213);let Pt=class CompService{getCompFullPath(Z){const{srcPath:ct}=this.configService.comphubConfig();Z=Z.replace(At.KEYS.FILE_MANAGER_DIRNAME,"");const ut=yt.join(ct,Z);return ut}checkCompEntryIndex(Z){const ct=yt.join(Z,At.KEYS.COMP_USE_ENTRY_FILE);if(!vt.existsSync(ct)){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[At.KEYS.COMP_USE_ENTRY_FILE]}))}}checkCompJson(Z){const ct=this.getCompFullPath(Z);const ut=yt.join(ct,At.KEYS.COMP_CONFIG_FILENAME);if(!vt.existsSync(ut)){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.configFileNotExist"))}}checkCompJsonFormat(Z){const ct=Object.keys(Z);const ut=At.ARRAY.COMP_DEFAULT_FIELD.every((Z=>!Z.required||ct.includes(Z.name)));if(!ut)return false;return kt.versionKit.validateVersion(Z.version)}async updateCompJson(Z,ct){const ut=this.getCompFullPath(Z);const pt=yt.join(ut,At.KEYS.COMP_CONFIG_FILENAME);const dt=await this.getCompFile(pt);const ft=ct(JSON.parse(dt));await vt.promises.writeFile(pt,JSON.stringify(ft,null,4))}async readCompVersion(Z){const ct=yt.join(Z,At.KEYS.COMP_CONFIG_FILENAME);const ut=await this.getCompFile(ct);const pt=JSON.parse(ut);return pt.version}initCompJson(){return At.ARRAY.COMP_DEFAULT_FIELD.reduce(((Z,ct)=>{const ut={};if(ct.required){ut[ct.name]=ct.default}return{...Z,...ut}}),{})}async uploadCompFolderToOss({compFullPath:Z,version:ct,ossData:ut}){const{files:pt}=await Ct.fileTree.generateTree(Z);const dt=pt.map((({absolutePath:ct,size:ut})=>{const pt=ct.replace(Z,"");return{filePath:pt,fileFullPath:ct,size:ut??0}}));dt.sort(((Z,ct)=>ct.size-Z.size));for(let Z=0;Z<dt.length;Z++){const{filePath:pt,fileFullPath:ft}=dt[Z];const _t=yt.join(ut.key,ct,pt);const mt={...ut,key:_t.replace(new RegExp(kt.textKit.escapeRegExp(yt.sep),"g"),"/")};const ht=vt.createReadStream(ft);await this.ossService.uploadFileToOss(mt,ht)}}async getCompHash(Z){const ct=await Ct.digest.getFileHashList(Z);const ut=ct.map((Z=>`${Z.relativePath}-${Z.hash}`)).join(";");return Ct.digest.getStringHash(ut)}async getCompFeatures(Z){const ct=await Ct.digest.getFileHashAndSsdeepList(Z);const ut=ct.map((Z=>{const ct=(0,Tt.omit)(Z,["relativePath"]);return{...ct,path:Z.relativePath}}));const pt=await Ct.digest.getRelativeDirList(Z);const dt=JSON.stringify(pt);const ft=Ct.digest.getStringFuzzyHash(dt);const _t=await this.getCompHash(Z);return{fileHashList:ut,compHash:_t,dirHash:Ct.digest.getStringHash(dt),dirSsdeep:Ct.digest.getSsdeepStruct(ft)}}async getCompFileList(Z){const{files:ct}=await Ct.fileTree.generateTree(Z);const ut=ct.map((({name:ct,size:ut,absolutePath:pt})=>({name:ct,size:ut??0,path:pt.replace(Z,"").replace(new RegExp(kt.textKit.escapeRegExp(yt.sep),"g"),"/")})));return ut}checkCompFileSize(Z){if(Z>At.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSizeExceeded",{args:[Math.floor(At.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE/1024/1024).toString()]}))}}checkCompFileNum(Z){if(Z>At.KEYS.COMP_SUBMIT_MAX_FILE_COUNT){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitFileCountExceeded",{args:[At.KEYS.COMP_SUBMIT_MAX_FILE_COUNT.toString()]}))}}async findCompJsonPath(Z){const{files:ct}=await Ct.fileTree.generateTree(Z,{ignore:["node_modules"]});this.ctx.logger.debug("项目文件数量:",ct.length);const ut=ct.filter((({absolutePath:Z})=>Z.endsWith(At.KEYS.COMP_CONFIG_FILENAME)));return ut}async getAllLocalCompIds(){const{srcPath:Z}=this.configService.comphubConfig();const ct=await this.findCompJsonPath(Z);this.ctx.logger.debug("组件文件数量:",ct.length);const ut=ct.map((async({absolutePath:Z})=>{const ct=await vt.promises.readFile(Z,"utf8");const ut=JSON.parse(ct);const pt=this.checkCompJsonFormat(ut);const dt=yt.dirname(Z);return{compjson:ut,isCompHub:pt,compPath:dt,pathHash:Ct.digest.getStringHash(dt)}}));const pt=await Promise.all(ut);return pt.filter((Z=>Z.isCompHub&&Z.compjson.__id__))}async getCompDir(Z){const{srcPath:ct}=this.configService.comphubConfig();const ut=yt.join(Z.replace(At.KEYS.FILE_MANAGER_DIRNAME,`${ct}${yt.sep}`));const{tree:pt,files:dt}=await Ct.fileTree.generateTree(ut,{sortBy:"type"});const _handleTree=Z=>{const ct={name:Z.name,path:Z.absolutePath,type:Z.type};if(Z.children&&Z.children.length>0){ct.children=Z.children.map((Z=>_handleTree(Z)))}return ct};return{tree:_handleTree(pt),files:dt.map((Z=>Z.absolutePath))}}async getCompFile(Z){const ct=await vt.promises.readFile(Z,"utf-8");return ct}async checkCompConfig(Z){const ct=yt.basename(Z);const ut=this.getCompFullPath(Z);try{this.checkCompEntryIndex(ut)}catch(Z){this.ctx.logger.error("检查组件入口文件index.vue失败",Z);return{errorMsg:"组件入口文件index.vue不存在"}}const pt=yt.join(ct,At.KEYS.COMP_USE_ENTRY_FILE);try{this.checkCompJson(Z)}catch(Z){this.ctx.logger.error("检查组件配置文件comp.json失败",Z);return{entryIndexPath:pt,errorMsg:"组件配置文件comp.json不存在"}}const dt=yt.join(ct,At.KEYS.COMP_CONFIG_FILENAME);try{const ct=yt.join(this.getCompFullPath(Z),At.KEYS.COMP_CONFIG_FILENAME);const ut=await this.getCompFile(ct);const ft=this.checkCompJsonFormat(JSON.parse(ut));if(!ft){return{entryIndexPath:pt,compJsonPath:dt,errorMsg:"comp.json文件格式错误"}}}catch(Z){this.ctx.logger.error("读取组件配置文件comp.json失败",Z);return{entryIndexPath:pt,compJsonPath:dt,errorMsg:"读取comp.json文件失败"}}return{entryIndexPath:pt,compJsonPath:dt,errorMsg:""}}async updateCompVersion(Z,ct){const ut=kt.versionKit.validateVersion(ct);if(!ut){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidVersionFormat"))}const pt=this.getCompFullPath(Z);const dt=yt.join(pt,At.KEYS.COMP_CONFIG_FILENAME);const ft=await this.getCompFile(dt);const _t=JSON.parse(ft);_t.version=ct;const mt=JSON.stringify(_t,null,2);await vt.promises.writeFile(dt,mt)}async generateCompJson(Z){const ct=this.getCompFullPath(Z);const ut=yt.basename(ct);const pt=this.initCompJson();pt.name=ut;await vt.promises.writeFile(yt.join(ct,At.KEYS.COMP_CONFIG_FILENAME),JSON.stringify(pt,null,4))}async getCompDep(Z){const{cwd:ct}=this.configService.comphubConfig();const ut=this.getCompFullPath(Z);const pt=await this.depsService.getModuleEntry(ut,ct);return pt}async getCompFileHash(Z){const{compPath:ct}=Z;const ut=this.getCompFullPath(ct);const pt=await this.getCompFeatures(ut);return{compHash:pt.compHash}}async checkCompRepeat(Z){const{compPath:ct,teamId:ut}=Z;const pt=this.getCompFullPath(ct);const dt=await this.getCompFeatures(pt);const ft=await It.remoteApi.v1Comp.compcontrollerCheckcompexistbyhash(dt,{headers:{"team-id":ut}});return ft.data}async submitComp(Z){let ct="";let ut={};try{const{compPath:pt,dep:dt,previewConfigs:ft,desc:_t,bgColor:mt,name:ht,teamId:yt}=Z;ut={"team-id":yt};this.checkCompJson(pt);const vt=this.getCompFullPath(pt);const St=await this.getCompFeatures(vt);this.checkCompEntryIndex(vt);const bt=await this.readCompVersion(vt);const xt=await this.getCompFileList(vt);const $t=xt.reduce(((Z,ct)=>Z+ct.size),0);this.checkCompFileNum(xt.length);this.checkCompFileSize($t);const Et={name:ht,dep:dt,previewConfigs:ft,desc:_t,version:bt,size:$t,files:xt,bgColor:mt,compFeatures:St};const Ct=await It.remoteApi.v1Comp.compcontrollerUpload(Et,{headers:ut});const Tt=Ct.data._id;ct=Tt;await this.updateCompJson(pt,(Z=>({...Z,name:ht,__id__:Tt})));const{data:{componentDir:wt}}=await It.remoteApi.v1Oss.osscontrollerCompossdir();const At=await It.remoteApi.v1Oss.osscontrollerPutpolicy({type:wt});const kt={compFullPath:vt,version:bt,ossData:At.data};await this.uploadCompFolderToOss(kt);const{key:Nt}=At.data;const Pt={compId:Tt,objectId:`${wt}${Nt}`};await It.remoteApi.v1Comp.compcontrollerUpdateobjectid(Pt)}catch(Z){if(ct){await It.remoteApi.v1Comp.compcontrollerDeletefailedcomp({compId:ct},{headers:ut})}if(Z instanceof ht.httpError.BadRequestError){throw new ht.httpError.BadRequestError(Z)}throw new Error(Z.message)}}async updateComp(Z){const{compId:ct,compPath:ut,dep:pt,previewConfigs:dt,desc:ft,bgColor:_t,name:mt,upgradeDesc:ht,teamId:yt}=Z;const vt=this.getCompFullPath(ut);const St=await this.getCompFeatures(vt);this.checkCompEntryIndex(vt);const bt=await It.remoteApi.v1Comp.compcontrollerCompdetail({compId:ct});const{objectId:xt,version:$t}=bt.data;const Et=await this.readCompVersion(vt);const Ct=await this.getCompFileList(vt);const Tt=Ct.reduce(((Z,ct)=>Z+ct.size),0);this.checkCompFileNum(Ct.length);this.checkCompFileSize(Tt);const wt={compId:ct,name:mt,dep:pt,previewConfigs:dt,desc:ft,version:Et,size:Tt,files:Ct,bgColor:_t,compFeatures:St,upgradeDesc:ht};const At=await It.remoteApi.v1Comp.compcontrollerUpdate(wt,{headers:{"team-id":yt}});const{isFileChange:kt}=At.data;if(!kt&&$t===Et){return}const Nt=await It.remoteApi.v1Oss.osscontrollerCompossdir();const{componentDir:Pt}=Nt.data;const Ot=await It.remoteApi.v1Oss.osscontrollerPutpolicy({type:Pt});const Dt=xt.replace(Ot.data.dir,"");const Ft={...Ot.data,key:Dt};const Mt={compFullPath:vt,version:Et,ossData:Ft};await this.uploadCompFolderToOss(Mt);await this.updateCompJson(ut,(Z=>({...Z,name:mt,__id__:ct})))}async downloadComp(Z){const{compId:ct,savePath:ut,isCover:pt,compName:dt,version:ft}=Z;const{srcPath:_t}=this.configService.comphubConfig();const mt=At.KEYS.FILE_MANAGER_DIRNAME;const St=ut.replace(mt,"").replace(/[/\\]/g,yt.sep);const bt=yt.join(_t,St,dt);if(!pt&&vt.existsSync(bt)){return{isRepeat:true}}const xt=$t.tmpdir();const Tt=yt.join(xt,At.KEYS.COMP_TEMP_DIR);this.ctx.logger.debug("组件下载到临时目录",Tt);const wt=await It.remoteApi.v1Comp.compcontrollerCompdetail({compId:ct,version:ft});if(!wt?.data){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compNotExist"))}const{files:kt,objectId:Nt,name:Pt}=wt.data;let Ot=[];const Dt=yt.join(Tt,Nt,ft);if(vt.existsSync(Dt)){const{files:Z}=await Ct.fileTree.generateTree(Dt);Ot=Z}await It.remoteApi.v1Comp.compcontrollerUpdatecompdownloadcount({compId:ct,version:ft});if(kt.length===Ot.length){const Z=Ot.find((({absolutePath:Z})=>Z.replace(Dt,"").startsWith(`${yt.sep}${At.KEYS.COMP_CONFIG_FILENAME}`)));if(Z){const ct=await vt.promises.readFile(Z.absolutePath,"utf8");const ut=JSON.parse(ct);const{name:pt}=ut;if(Pt===pt){await Et.copy(Dt,bt);this.ctx.logger.debug("组件缓存文件和服务器文件一致,直接使用缓存文件");return}}}const Ft=kt.map((Z=>{const ct=yt.join(Nt,ft,Z.path);return{path:ct.replace(/[/\\]/g,"/")}}));const Mt=await this.ossService.getDownloadSts();await this.ossService.downloadFileToPath(Mt,Ft,Tt);const Lt=yt.join(Tt,Nt,ft);await Et.copy(Lt,bt)}async getLocalCompsByIds(Z){const{srcPath:ct}=this.configService.comphubConfig();const ut=await this.findCompJsonPath(ct);this.ctx.logger.debug("组件文件数量:",ut.length);const pt=ut.map((async({absolutePath:Z})=>{const ct=await vt.promises.readFile(Z,"utf8");const ut=JSON.parse(ct);return{...ut,path:yt.dirname(Z)}}));const dt=await Promise.all(pt);const ft=dt.filter((ct=>Z.includes(ct.__id__)));if(!ft){return[]}const _t=At.KEYS.FILE_MANAGER_DIRNAME;const mt=new RegExp(kt.textKit.escapeRegExp(yt.sep),"g");const ht=ft.map((Z=>{const ut=Z.path.replace(ct,"").replace(mt,"/").slice(1);return{id:Z.__id__,path:_t+ut,fullPath:Z.path,fullPathHash:Ct.digest.getStringHash(Z.path),basename:yt.basename(Z.path)}}));return ht}async getCompFilesOssSignedUrl(Z){const{version:ct,objectId:ut,files:pt}=Z;const dt=await this.ossService.getDownloadSts();const ft=pt.map((async Z=>{const pt=yt.join(ut,ct,Z);const ft=await this.ossService.getFilePreviewUrl(dt,pt.replace(/[/\\]/g,"/"));return{path:Z,signedUrl:ft}}));const _t=await Promise.all(ft);return{signedUrls:_t}}async getPackageJsonContent(){const Z=this.configService.comphubConfig();const ct=yt.join(Z.cwd,"package.json");return await Ct.fileSys.readJsonFile(ct)}async getLocalComps(Z){const{page:ct=1,pageSize:ut=10}=Z;const{srcPath:pt}=this.configService.comphubConfig();const dt=await this.getAllLocalCompIds();const ft=dt.map((Z=>({id:Z.compjson.__id__,pathHash:Z.pathHash})));ft.sort(((Z,ct)=>Z.id.localeCompare(ct.id)));const _t=[...new Set(ft.map((Z=>Z.id)))];const mt=await It.remoteApi.v1Comp.compcontrollerExistcompsbyids({compIds:_t});const{ids:vt=[]}=mt.data;const St=ft.filter((Z=>vt.includes(Z.id)));const bt=St.length;const xt=St.slice((ct-1)*ut,ct*ut);const $t=new Map(dt.map((Z=>[`${Z.compjson.__id__}_${Z.pathHash}`,Z])));const Et=await It.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:xt.map((Z=>Z.id))});const{rows:Tt=[]}=Et.data;const wt=new Map(Tt.map((Z=>[Z._id,Z])));const Nt=new RegExp(kt.textKit.escapeRegExp(yt.sep),"g");const Pt=At.KEYS.FILE_MANAGER_DIRNAME;const Ot=xt.map((async({id:Z,pathHash:ct})=>{const ut=$t.get(`${Z}_${ct}`);const dt=wt.get(Z);if(!dt||!ut){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithIdNotExist",{args:[Z]}))}const ft=ut.compPath.replace(pt,"").replace(Nt,"/").slice(1);return{_id:Ct.digest.getStringHash(ut.compPath),name:dt.name,compId:Z,version:ut.compjson.version,path:Pt+ft,previewConfigs:dt.previewConfigs,bgColor:dt.bgColor,fullPath:ut.compPath}}));const Dt=await Promise.all(Ot);return{total:bt,page:ct,pageSize:ut,rows:Dt}}async getLocalCompDetailByPathHash(Z){const{fullPathHash:ct}=Z;const ut=await this.getAllLocalCompIds();const pt=ut.find((Z=>Z.pathHash===ct));if(!pt){throw new ht.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithPathNotExist",{args:[ct]}))}const{srcPath:dt}=this.configService.comphubConfig();const{__id__:ft,version:_t}=pt.compjson;const mt=await It.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:[ft]});const{rows:vt=[]}=mt.data;const St=vt[0];const bt=new RegExp(kt.textKit.escapeRegExp(yt.sep),"g");const xt=At.KEYS.FILE_MANAGER_DIRNAME;const $t=pt.compPath.replace(dt,"").replace(bt,"/").slice(1);return{_id:ct,name:St.name,compId:ft,version:_t,path:xt+$t,previewConfigs:St.previewConfigs,bgColor:St.bgColor,fullPath:pt.compPath}}async openCompPathInVscode(Z){const{folderPath:ct,relativeFilePath:ut}=Z;await this.commandService.revealInVSCode(ct,ut)}};ct.CompService=Pt;ft([(0,ht.MainApp)(),mt("design:type",Object)],Pt.prototype,"app",void 0);ft([(0,ht.Inject)(),mt("design:type",St.ConfigService)],Pt.prototype,"configService",void 0);ft([(0,ht.Inject)(),mt("design:type",xt.OssService)],Pt.prototype,"ossService",void 0);ft([(0,ht.Inject)(),mt("design:type",wt.CommandService)],Pt.prototype,"commandService",void 0);ft([(0,ht.Inject)(),mt("design:type",bt.DepsService)],Pt.prototype,"depsService",void 0);ft([(0,ht.Inject)(),mt("design:type",Object)],Pt.prototype,"ctx",void 0);ft([(0,ht.Inject)(),mt("design:type",Nt.MidwayI18nService)],Pt.prototype,"i18nService",void 0);ct.CompService=Pt=ft([(0,ht.Provide)()],Pt)},63366:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.ConfigService=void 0;const ht=ut(31049);const yt=ut(60449);const vt=_t(ut(16928));let St=class ConfigService{comphubConfig(){const Z=this.app.getAttr(yt.KEYS.COMPHUB_CONFIG_KEY);return Z}getGlobalConfig(){const Z=this.comphubConfig();const{cwd:ct,srcPath:ut,version:pt,allowDebug:dt,subPort:ft}=Z;return{cwd:ct,srcPath:ut,sep:vt.sep,version:pt,allowDebug:dt,subPort:ft}}};ct.ConfigService=St;ft([(0,ht.MainApp)(),mt("design:type",Object)],St.prototype,"app",void 0);ct.ConfigService=St=ft([(0,ht.Provide)()],St)},23086:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.DepsService=void 0;const ht=ut(31049);const yt=_t(ut(16928));const vt=_t(ut(79896));const St=ut(64713);const bt=ut(74952);const xt=ut(60449);const $t=ut(63366);const Et=ut(58953);let Ct=class DepsService{async getModuleEntry(Z,ct){const ut=await bt.fileSys.readJsonFile(yt.join(ct,"package.json"));if(!ut){console.error("未找到 package.json 文件");return[]}const pt=bt.resolver.findDependencyVersion(ut,"vue");const dt=await bt.depGraph.detectImports(Z,{pathAliases:["@"]});dt.vue={version:pt};const ft={};for(const[Z]of Object.entries(dt)){const pt=bt.resolver.findDependencyVersion(ut,Z);const dt={version:pt};const _t=await bt.resolver.findOwningPackage(Z,ct);if(_t){dt.version=_t.version;if(!pt){dt.parent={name:_t.name,version:_t.version}}}ft[Z]=dt}return Object.entries(ft).map((([Z,ct])=>({name:Z,version:ct.version,...ct.parent&&{parent:ct.parent}})))}async precompileModule(Z,ct,ut){const pt=await bt.fileSys.readJsonFile(yt.join(ut,"package.json"));if(!pt){console.error("未找到 package.json 文件");return{entryNameToFile:{}}}const{entryPoints:dt,skippedModules:ft}=(0,Et.buildEntryPoints)(ct,pt,ut);await vt.promises.mkdir(Z,{recursive:true});const _t={};for(const[Z,ct]of Object.entries(dt)){if(bt.resolver.isModuleInstalled(Z,ut)){_t[Z]=ct}}const mt={};for(const Z of ft){mt[Z]=Z}const ht=yt.join(Z,xt.KEYS.META_FILE_NAME);const $t=await bt.fileSys.readJsonFile(ht);const{filteredEntryPoints:Ct,cachedMappings:Tt}=(0,Et.filterCachedModules)(_t,$t);Object.assign(mt,Tt);if(Object.keys(Ct).length===0){return{entryNameToFile:mt}}const wt={entryPoints:Ct,bundle:true,format:"esm",splitting:true,outdir:Z,entryNames:"[name]-[hash]",chunkNames:"chunk-[hash]",outExtension:{".js":".js"},metafile:true,write:true,target:"esnext",sourcemap:false,external:["vue"],absWorkingDir:ut,nodePaths:[yt.join(ut,"node_modules")]};const At=await(0,St.build)(wt);const{optimized:kt,entryNameToFile:It}=(0,Et.analyzeBuildOutputs)(At,Ct,Z);const Nt={...$t,...kt};await(0,Et.saveBuildMetadata)(ht,Nt);return{entryNameToFile:{...mt,...It}}}};ct.DepsService=Ct;ft([(0,ht.MainApp)(),mt("design:type",Object)],Ct.prototype,"app",void 0);ft([(0,ht.Inject)(),mt("design:type",$t.ConfigService)],Ct.prototype,"configService",void 0);ct.DepsService=Ct=ft([(0,ht.Provide)()],Ct)},85984:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.ModuleService=void 0;const ht=ut(31049);const yt=ut(63366);const vt=ut(23086);const St=_t(ut(16928));const bt=ut(74952);const xt=_t(ut(79896));const $t=ut(60449);let Et=class ModuleService{async getPreBuildModuleDir(){const{cwd:Z}=this.configService.comphubConfig();const ct=St.join(Z,$t.KEYS.PREBUILD_MODULE_DIR);await xt.promises.mkdir(ct,{recursive:true});return ct}async preBuild(Z){const ct=await this.getPreBuildModuleDir();const{cwd:ut}=this.configService.comphubConfig();return await this.depsService.precompileModule(ct,Z,ut)}async preBuildSize(){const Z=await this.getPreBuildModuleDir();return await bt.fileSys.dirSize(Z)}async clearPreBuild(){const Z=await this.getPreBuildModuleDir();await xt.promises.rm(Z,{recursive:true,force:true})}};ct.ModuleService=Et;ft([(0,ht.Inject)(),mt("design:type",yt.ConfigService)],Et.prototype,"configService",void 0);ft([(0,ht.Inject)(),mt("design:type",vt.DepsService)],Et.prototype,"depsService",void 0);ft([(0,ht.MainApp)(),mt("design:type",Object)],Et.prototype,"app",void 0);ct.ModuleService=Et=ft([(0,ht.Provide)()],Et)},80799:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ht=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});ct.OssService=void 0;const yt=ut(31049);const vt=ht(ut(51515));const St=ht(ut(12593));const bt=ht(ut(18451));const xt=_t(ut(16928));const $t=_t(ut(79896));const Et=ut(14013);const Ct=ut(6586);const Tt=ht(ut(26506));const wt=ht(ut(24403));const At=ut(45853);const kt=ut(60449);const It=ut(67213);let Nt=class OssService{createOssClient(Z){const ct={endpoint:kt.KEYS.OSS_CUSTOM_DOMAIN,authorizationV4:true,cname:true,...Z};return new bt.default(ct)}createOssFormData(Z,ct){const ut=new vt.default;const pt=Z.dir+Z.key;ut.append("success_action_status","200");ut.append("policy",Z.policy);ut.append("x-oss-signature",Z.signature);ut.append("x-oss-signature-version",Z.x_oss_signature_version);ut.append("x-oss-credential",Z.x_oss_credential);ut.append("x-oss-date",Z.x_oss_date);ut.append("key",pt);ut.append("x-oss-security-token",Z.security_token);ut.append("x-oss-forbid-overwrite","true");ut.append("Cache-Control","public, max-age=31536000");ut.append("file",ct);return{host:Z.host,filePath:pt,formData:ut}}async getDownloadSts(){const Z=await this.cache.get(kt.KEYS.CACHE_KEY_STS_TOKEN);if(Z){return Z}const ct=await Ct.remoteApi.v1Oss.osscontrollerGetsts();const ut=new Date(ct.data.Expiration).getTime()-1*60*1e3;await this.cache.set(kt.KEYS.CACHE_KEY_STS_EXPIRE_TIME,ut);const pt=ut-Date.now();this.ctx.logger.debug("STS过期时间",(0,wt.default)(ut).format("YYYY-MM-DD HH:mm:ss"));this.cache.set(kt.KEYS.CACHE_KEY_STS_TOKEN,ct.data,pt);return ct.data}async uploadFileToOss(Z,ct){const{host:ut,formData:pt}=this.createOssFormData(Z,ct);const dt=await St.default.post(ut,pt,{headers:{...pt.getHeaders()}}).catch((async Z=>{const ct=Z.response.data;const ut=await(0,At.parseStringPromise)(ct);if(ut?.Error){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.parseXmlFailed",{args:[ut.Error.Message]}))}throw new yt.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[Z.message||Z]}))}));if(dt.status!==200){throw new yt.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[dt.data]}))}}async downloadFileToPath(Z,ct,ut){const pt=this.createOssClient({region:Z.region,accessKeyId:Z.AccessKeyId,accessKeySecret:Z.AccessKeySecret,stsToken:Z.SecurityToken,bucket:Z.bucket,refreshSTSToken:async()=>{const Z=await this.getDownloadSts();return{accessKeyId:Z.AccessKeyId,accessKeySecret:Z.AccessKeySecret,stsToken:Z.SecurityToken}}});const dt=ct.map((async Z=>{const{path:ct}=Z;const dt=xt.join(ut,ct);const ft=xt.dirname(dt);if(!$t.existsSync(ft)){$t.mkdirSync(ft,{recursive:true})}return await pt.get(ct,dt)}));return await Promise.all(dt)}async getFilePreviewUrl(Z,ct){const ut=(0,Tt.default)(ct);const pt=await this.cache.get(kt.KEYS.CACHE_KEY_STS_EXPIRE_TIME);const dt=await this.cache.get(ut);const ft=Math.floor((Number(pt)-Date.now())/1e3);this.ctx.logger.debug("文件地址过期时间:",ft,"秒",Math.floor(ft/60),"分钟");if(dt&&ft>0){return dt}const _t=this.createOssClient({region:Z.region,accessKeyId:Z.AccessKeyId,accessKeySecret:Z.AccessKeySecret,stsToken:Z.SecurityToken,bucket:Z.bucket,refreshSTSToken:async()=>{const Z=await this.getDownloadSts();return{accessKeyId:Z.AccessKeyId,accessKeySecret:Z.AccessKeySecret,stsToken:Z.SecurityToken}}});this.ctx.logger.debug("文件地址过期时间:",ft,"秒",Math.floor(ft/60),"分钟");const mt=_t.signatureUrl(ct,{expires:ft});await this.cache.set(ut,mt,ft*1e3);this.ctx.logger.debug("缓存预览URL",ct);return mt}};ct.OssService=Nt;ft([(0,yt.Inject)(),mt("design:type",Object)],Nt.prototype,"ctx",void 0);ft([(0,yt.InjectClient)(Et.CachingFactory,"default"),mt("design:type",Object)],Nt.prototype,"cache",void 0);ft([(0,yt.Inject)(),mt("design:type",It.MidwayI18nService)],Nt.prototype,"i18nService",void 0);ct.OssService=Nt=ft([(0,yt.Provide)()],Nt)},5578:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});ct.PreprocessingService=void 0;const ft=ut(31049);const _t=ut(34985);const mt=ut(81806);const ht=dt(ut(60505));let yt=class PreprocessingService{async preprocessCode(Z){const{cssCode:ct,precompilerType:ut}=Z;if(ut===_t.PrecompilerEnum.SASS||ut===_t.PrecompilerEnum.SCSS){const Z=(0,mt.compileString)(ct);return Z.css}else if(ut===_t.PrecompilerEnum.LESS){const Z=await ht.default.render(ct);return Z.css}return ct}};ct.PreprocessingService=yt;ct.PreprocessingService=yt=pt([(0,ft.Provide)()],yt)},61275:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.QueueService=void 0;const dt=ut(31049);let ft=class QueueService{constructor(){this.queue=[];this.isProcessing=false}async processQueue(){if(this.isProcessing||this.queue.length===0){return}this.isProcessing=true;const Z=this.queue.shift();if(Z){await Z()}this.isProcessing=false;this.processQueue()}async enqueue(Z){return new Promise((ct=>{this.queue.push((async()=>{try{await Z()}finally{ct()}}));this.processQueue()}))}};ct.QueueService=ft;ct.QueueService=ft=pt([(0,dt.Provide)(),(0,dt.Scope)(dt.ScopeEnum.Singleton)],ft)},19452:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ht=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});ct.TerminalService=void 0;const yt=ut(31049);const vt=ut(35317);const St=ut(63366);const bt=_t(ut(95892));const xt=ut(73024);const $t=ut(51455);const Et=ut(74952);const Ct=ht(ut(44644));let Tt=class TerminalService{constructor(){this.subprocess=null;this.cwd="";this.tabIndex=0}getPrompt(){return`${this.cwd}`}smartDecode(Z){if(!Z||Z.length===0)return"";try{new TextDecoder("utf-8",{fatal:true}).decode(Z);return bt.decode(Z,"utf-8")}catch{return bt.decode(Z,"gbk")}}async folderExists(Z){try{await(0,$t.access)(Z,xt.constants.F_OK|xt.constants.R_OK);return true}catch{return false}}async shutdown(Z=5e3){const ct=this.subprocess;if(!ct||ct.killed){this.ctx.emit("output",{cwd:this.getPrompt()});return}return new Promise((ut=>{let pt=false;const done=()=>{if(!pt){pt=true;ut(0)}};ct.once("exit",done);(0,Ct.default)(ct.pid,"SIGTERM",(Z=>{if(Z){this.ctx.emit("output",{err:Z.message})}}));const dt=setTimeout((()=>{(0,Ct.default)(ct.pid,"SIGKILL",(Z=>{if(Z){this.ctx.emit("output",{err:Z.message})}done()}))}),Z);ct.once("exit",(()=>clearTimeout(dt)))}))}async execCmd({cwd:Z,oldCwd:ct,command:ut}){if(!await this.folderExists(Z)){this.ctx.emit("output",{err:`${Z} 路径不存在`});this.ctx.emit("output",{cwd:ct});return}this.cwd=Z;if(!ut.trim()){this.ctx.emit("output",{cwd:this.getPrompt()});return}if(ut==="^C"){await this.shutdown();return}this.subprocess=(0,vt.spawn)(ut,{shell:true,cwd:Z,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",(Z=>{this.ctx.emit("output",{stdout:this.smartDecode(Z)})}));this.subprocess.stderr?.on("data",(Z=>{this.ctx.emit("output",{stderr:this.smartDecode(Z)})}));this.subprocess.on("close",(()=>{this.subprocess=null;this.ctx.emit("output",{cwd:this.getPrompt(),command:ut})}));this.subprocess.on("error",(Z=>{this.ctx.emit("output",{err:Z.message})}))}async cmdTab({cwd:Z,lastWord:ct}){let ut=await Et.fileSys.readDirFiles(Z);if(ct){ut=ut.filter((Z=>Z.name.startsWith(ct)))}if(ut.length===0){return}this.tabIndex=(this.tabIndex+1)%ut.length;const pt=ut[this.tabIndex];this.ctx.emit("output",{tab:pt.name})}};ct.TerminalService=Tt;ft([(0,yt.Inject)(),mt("design:type",St.ConfigService)],Tt.prototype,"configService",void 0);ft([(0,yt.Inject)(),mt("design:type",Object)],Tt.prototype,"ctx",void 0);ct.TerminalService=Tt=ft([(0,yt.Provide)()],Tt)},5808:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var _t=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();var mt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.VuefinderService=void 0;const ht=ut(31049);const yt=_t(ut(16928));const vt=_t(ut(79896));const St=ut(63366);const bt=_t(ut(93900));const xt=ut(60449);let $t=class VuefinderService{async list({path:Z}){const ct=this.configService.comphubConfig();const{srcPath:ut}=ct;const pt=Z?.replace(xt.KEYS.FILE_MANAGER_DIRNAME,"")||"";let dt=yt.join(ut,pt);const ft=await vt.promises.access(dt).then((()=>true)).catch((()=>false));if(!ft){dt=ut;Z=xt.KEYS.FILE_MANAGER_DIRNAME}const _t=await vt.promises.readdir(dt);const mt=_t.map((async ct=>{const ut=yt.join(dt,ct);const pt=await vt.promises.stat(ut);const ft=pt.isDirectory();const _t=Z===xt.KEYS.FILE_MANAGER_DIRNAME?`${Z}${ct}`:`${Z}/${ct}`;return{type:ft?"dir":"file",path:_t,file_size:pt.size,visibility:"public",last_modified:Math.floor(pt.mtimeMs/1e3),basename:ct,extension:ft?"":yt.extname(ct).slice(1),mime_type:bt.lookup(ct)||""}}));const ht=await Promise.all(mt);ht.sort(((Z,ct)=>{if(Z.type==="dir"&&ct.type==="file"){return-1}else if(Z.type==="file"&&ct.type==="dir"){return 1}else{return 0}}));return{storages:_t,dirname:Z,files:ht}}};ct.VuefinderService=$t;ft([(0,ht.MainApp)(),mt("design:type",Object)],$t.prototype,"app",void 0);ft([(0,ht.Inject)(),mt("design:type",St.ConfigService)],$t.prototype,"configService",void 0);ct.VuefinderService=$t=ft([(0,ht.Provide)()],$t)},66593:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.TerminalSocketController=void 0;const ft=ut(31049);const _t=ut(19452);let mt=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(Z){this.terminalService.execCmd(Z)}async onTab(Z){this.terminalService.cmdTab(Z)}};ct.TerminalSocketController=mt;pt([(0,ft.Inject)(),dt("design:type",Object)],mt.prototype,"ctx",void 0);pt([(0,ft.Inject)(),dt("design:type",_t.TerminalService)],mt.prototype,"terminalService",void 0);pt([(0,ft.OnWSConnection)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],mt.prototype,"onConnection",null);pt([(0,ft.OnWSDisConnection)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],mt.prototype,"onDisConnection",null);pt([(0,ft.OnWSMessage)("command"),dt("design:type",Function),dt("design:paramtypes",[Object]),dt("design:returntype",Promise)],mt.prototype,"onCommand",null);pt([(0,ft.OnWSMessage)("tab"),dt("design:type",Function),dt("design:paramtypes",[Object]),dt("design:returntype",Promise)],mt.prototype,"onTab",null);ct.TerminalSocketController=mt=pt([(0,ft.WSController)("/terminal")],mt)},58953:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__setModuleDefault||(Object.create?function(Z,ct){Object.defineProperty(Z,"default",{enumerable:true,value:ct})}:function(Z,ct){Z["default"]=ct});var ft=this&&this.__importStar||function(){var ownKeys=function(Z){ownKeys=Object.getOwnPropertyNames||function(Z){var ct=[];for(var ut in Z)if(Object.prototype.hasOwnProperty.call(Z,ut))ct[ct.length]=ut;return ct};return ownKeys(Z)};return function(Z){if(Z&&Z.__esModule)return Z;var ct={};if(Z!=null)for(var ut=ownKeys(Z),ft=0;ft<ut.length;ft++)if(ut[ft]!=="default")pt(ct,Z,ut[ft]);dt(ct,Z);return ct}}();Object.defineProperty(ct,"__esModule",{value:true});ct.analyzeBuildOutputs=analyzeBuildOutputs;ct.saveBuildMetadata=saveBuildMetadata;ct.filterCachedModules=filterCachedModules;ct.buildEntryPoints=buildEntryPoints;const _t=ft(ut(16928));const mt=ft(ut(79896));const ht=ut(74952);const yt=ut(44120);const vt=ut(60449);function resolveModuleEntry(Z,ct){if(Z!=="vue")return Z;const ut=yt.versionKit.getMajorVersion(ct);return ut==="3"?vt.KEYS.VUE_ESM_BUNDLER:Z}function extractModuleName(Z){const ct=Z.slice(0,-12);return _t.basename(ct)}function matchEntryKey(Z,ct){return Z.find((Z=>{const ut=Z.split("/");const pt=ut.length===1?ut[0]:ut[ut.length-1];return ct===pt}))}function analyzeBuildOutputs(Z,ct,ut){const pt={};const dt={};const ft=Object.keys(ct);const yt=Z.metafile?.outputs??{};for(const[Z,ct]of Object.entries(yt)){if(!ct.entryPoint)continue;const yt=_t.basename(Z);const vt=extractModuleName(Z);const St=matchEntryKey(ft,vt);if(!St)continue;dt[St]=yt;const bt=_t.join(ut,yt);const xt=mt.readFileSync(bt,"utf-8");const $t=ht.digest.getStringHash(xt).slice(0,8);pt[St]={src:ct.entryPoint,file:yt,fileHash:$t,needsInterop:false}}return{optimized:pt,entryNameToFile:dt}}async function saveBuildMetadata(Z,ct){await mt.promises.writeFile(Z,JSON.stringify(ct,null,2))}function filterCachedModules(Z,ct){if(!ct){return{filteredEntryPoints:Z,cachedMappings:{}}}const ut={};const pt={};for(const[dt,ft]of Object.entries(Z)){if(ct[dt]){pt[dt]=ct[dt].file}else{ut[dt]=ft}}return{filteredEntryPoints:ut,cachedMappings:pt}}function buildEntryPoints(Z,ct,ut){const pt={};const dt=[];for(const ft of Z){if(ht.resolver.shouldSkipByExtension(ft)){dt.push(ft);continue}const Z=ht.resolver.findDependencyVersion(ct,ft);if(!Z){const Z=ht.resolver.findOwningPackage(ft,ut);if(!Z)continue}pt[ft]=resolveModuleEntry(ft,Z)}return{entryPoints:pt,skippedModules:dt}}},10778:function(Z,ct,ut){"use strict";var pt=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(ct,"__esModule",{value:true});ct.remoteInstance=ct.setHeader=void 0;const dt=ut(63536);const ft=ut(60449);const _t=pt(ut(65692));const mt=(0,dt.initInstance)(ft.KEYS.REMOTE_SERVICE_PREFIX,{timeout:1e4,httpsAgent:new _t.default.Agent({rejectUnauthorized:false})});ct.remoteInstance=mt;let ht=null;const setHeader=Z=>{ht=Z};ct.setHeader=setHeader;mt.interceptors.request.use((Z=>{Z.headers[ft.KEYS.AUTHORIZATION_HEADER_NAME]=ht[ft.KEYS.AUTHORIZATION_HEADER_NAME];Z.headers[ft.KEYS.CSRF_TOKEN_HEADER_NAME]=ht[ft.KEYS.CSRF_TOKEN_HEADER_NAME];Z.headers[ft.KEYS.ACCEPT_LANGUAGE_HEADER_NAME]=ht[ft.KEYS.ACCEPT_LANGUAGE_HEADER_NAME.toLowerCase()];Z.headers["cookie"]=ht.cookie;return Z}),(Z=>Promise.reject(Z)));mt.interceptors.response.use((async Z=>{if(Z.data.code!==0){throw new Error(JSON.stringify(Z.data))}return Z.data}),(Z=>Promise.reject(Z)))},101:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.PackageJsonVO=ct.LocalCompDetailVO=ct.LocalCompsVO=ct.CompFileHashVO=ct.CompSimilarListVO=ct.CompFilesOssSignedUrlVO=ct.DownloadCompVO=ct.LocalCompsByIdsVO=ct.ImportScanResultVO=ct.CompCheckVO=ct.CompFileContentVO=ct.CompFileVO=ct.CompSimilarListItemVO=ct.FileNode=void 0;const ft=ut(90381);const _t=ut(60449);class FileNode{}ct.FileNode=FileNode;pt([(0,ft.ApiProperty)({description:"目录/文件名称",example:"index.vue",required:true}),dt("design:type",String)],FileNode.prototype,"name",void 0);pt([(0,ft.ApiProperty)({description:"目录/文件路径",example:"/src/components/MyComp/index.vue",required:true}),dt("design:type",String)],FileNode.prototype,"path",void 0);pt([(0,ft.ApiProperty)({description:"目录/文件类型",example:"file",required:true,enum:_t.ENUM.FileType}),dt("design:type",String)],FileNode.prototype,"type",void 0);pt([(0,ft.ApiProperty)({description:"子节点",type:[FileNode]}),dt("design:type",Array)],FileNode.prototype,"children",void 0);class CompSimilarListItemVO{}ct.CompSimilarListItemVO=CompSimilarListItemVO;pt([(0,ft.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),dt("design:type",String)],CompSimilarListItemVO.prototype,"_id",void 0);pt([(0,ft.ApiProperty)({example:"组件名称",description:"组件名称",required:true}),dt("design:type",String)],CompSimilarListItemVO.prototype,"name",void 0);class CompFileVO{}ct.CompFileVO=CompFileVO;pt([(0,ft.ApiProperty)({type:FileNode,description:"组件文件树",required:true}),dt("design:type",FileNode)],CompFileVO.prototype,"tree",void 0);pt([(0,ft.ApiProperty)({type:[String],description:"组件文件列表",required:true}),dt("design:type",Array)],CompFileVO.prototype,"files",void 0);class CompFileContentVO{}ct.CompFileContentVO=CompFileContentVO;pt([(0,ft.ApiProperty)({description:"组件文件内容",example:"let a=123;",required:true}),dt("design:type",String)],CompFileContentVO.prototype,"content",void 0);class CompCheckVO{}ct.CompCheckVO=CompCheckVO;pt([(0,ft.ApiProperty)({description:"组件入口文件路径",required:false}),dt("design:type",String)],CompCheckVO.prototype,"entryIndexPath",void 0);pt([(0,ft.ApiProperty)({description:"组件配置文件路径",required:false}),dt("design:type",String)],CompCheckVO.prototype,"compJsonPath",void 0);pt([(0,ft.ApiProperty)({description:"异常结果内容",required:true}),dt("design:type",String)],CompCheckVO.prototype,"errorMsg",void 0);class ParentVO{}pt([(0,ft.ApiProperty)({description:"父库名称",required:true,example:"vue"}),dt("design:type",String)],ParentVO.prototype,"name",void 0);pt([(0,ft.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),dt("design:type",String)],ParentVO.prototype,"version",void 0);class ImportDetailVO{}pt([(0,ft.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),dt("design:type",String)],ImportDetailVO.prototype,"name",void 0);pt([(0,ft.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),dt("design:type",String)],ImportDetailVO.prototype,"version",void 0);pt([(0,ft.ApiProperty)({type:ParentVO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),dt("design:type",ParentVO)],ImportDetailVO.prototype,"parent",void 0);class ImportScanResultVO{}ct.ImportScanResultVO=ImportScanResultVO;pt([(0,ft.ApiProperty)({type:[ImportDetailVO],required:true,description:"第三方库导入详情"}),dt("design:type",Array)],ImportScanResultVO.prototype,"thirdParty",void 0);class CompInfoVO{}pt([(0,ft.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),dt("design:type",String)],CompInfoVO.prototype,"id",void 0);pt([(0,ft.ApiProperty)({description:"组件文件路径",example:"local:///MyComp/index.vue",required:true}),dt("design:type",String)],CompInfoVO.prototype,"path",void 0);pt([(0,ft.ApiProperty)({description:"组件文件名称",example:"base-table",required:true}),dt("design:type",String)],CompInfoVO.prototype,"basename",void 0);pt([(0,ft.ApiProperty)({description:"组件文件完整路径",example:"/src/components/MyComp/index.vue",required:true}),dt("design:type",String)],CompInfoVO.prototype,"fullPath",void 0);pt([(0,ft.ApiProperty)({description:"组件文件完整路径哈希值",example:"123",required:true}),dt("design:type",String)],CompInfoVO.prototype,"fullPathHash",void 0);class LocalCompsByIdsVO{}ct.LocalCompsByIdsVO=LocalCompsByIdsVO;pt([(0,ft.ApiProperty)({type:[CompInfoVO],required:true}),dt("design:type",Array)],LocalCompsByIdsVO.prototype,"compInfos",void 0);class DownloadCompVO{}ct.DownloadCompVO=DownloadCompVO;pt([(0,ft.ApiProperty)({description:"组件是否重复",example:true,required:true}),dt("design:type",Boolean)],DownloadCompVO.prototype,"isRepeat",void 0);class SignedUrlItem{}pt([(0,ft.ApiProperty)({description:"文件路径",example:"/src/components/MyComp/index.vue",required:true}),dt("design:type",String)],SignedUrlItem.prototype,"path",void 0);pt([(0,ft.ApiProperty)({description:"文件oss签名访问地址",example:"https://comp-hub.oss-cn-beijing.aliyuncs.com/src/components/MyComp/index.vue?x-oss-security-token=...",required:true}),dt("design:type",String)],SignedUrlItem.prototype,"signedUrl",void 0);class CompFilesOssSignedUrlVO{}ct.CompFilesOssSignedUrlVO=CompFilesOssSignedUrlVO;pt([(0,ft.ApiProperty)({description:"文件oss签名访问地址列表",type:[SignedUrlItem],required:true}),dt("design:type",Array)],CompFilesOssSignedUrlVO.prototype,"signedUrls",void 0);class CompSimilarListVO{}ct.CompSimilarListVO=CompSimilarListVO;pt([(0,ft.ApiProperty)({type:[CompSimilarListItemVO],description:"相似组件列表",required:true}),dt("design:type",Array)],CompSimilarListVO.prototype,"similarList",void 0);class CompFileHashVO{}ct.CompFileHashVO=CompFileHashVO;pt([(0,ft.ApiProperty)({example:"123",description:"组件哈希值",required:true}),dt("design:type",String)],CompFileHashVO.prototype,"compHash",void 0);class PreviewItem{}pt([(0,ft.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"预览配置项主键ID(自动生成)",required:false}),dt("design:type",String)],PreviewItem.prototype,"_id",void 0);pt([(0,ft.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),dt("design:type",Array)],PreviewItem.prototype,"miniPath",void 0);pt([(0,ft.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),dt("design:type",Array)],PreviewItem.prototype,"fullPath",void 0);pt([(0,ft.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),dt("design:type",String)],PreviewItem.prototype,"desc",void 0);class LocalCompsVO{}ct.LocalCompsVO=LocalCompsVO;pt([(0,ft.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"内容id,这里用路径哈希值",required:true}),dt("design:type",String)],LocalCompsVO.prototype,"_id",void 0);pt([(0,ft.ApiProperty)({type:String,example:"qin-table",description:"组件名称",required:true}),dt("design:type",String)],LocalCompsVO.prototype,"name",void 0);pt([(0,ft.ApiProperty)({type:String,example:"123456",description:"组件ID",required:true}),dt("design:type",String)],LocalCompsVO.prototype,"compId",void 0);pt([(0,ft.ApiProperty)({type:String,example:"1.0.0",description:"组件版本",required:true}),dt("design:type",String)],LocalCompsVO.prototype,"version",void 0);pt([(0,ft.ApiProperty)({type:[PreviewItem],required:true}),dt("design:type",Array)],LocalCompsVO.prototype,"previewConfigs",void 0);pt([(0,ft.ApiProperty)({type:String,example:"local://components/QinTable",description:"组件文件路径",required:true}),dt("design:type",String)],LocalCompsVO.prototype,"path",void 0);pt([(0,ft.ApiProperty)({type:String,example:"D:/src/components/QinTable/index.vue",description:"组件文件完整路径",required:true}),dt("design:type",String)],LocalCompsVO.prototype,"fullPath",void 0);pt([(0,ft.ApiProperty)({type:String,example:"#f0f0f0",description:"组件背景颜色",required:false}),dt("design:type",String)],LocalCompsVO.prototype,"bgColor",void 0);class LocalCompDetailVO extends LocalCompsVO{}ct.LocalCompDetailVO=LocalCompDetailVO;class PackageJsonVO{}ct.PackageJsonVO=PackageJsonVO;pt([(0,ft.ApiProperty)({type:Object,description:"组件package.json文件内容",required:true}),dt("design:type",Object)],PackageJsonVO.prototype,"packageJson",void 0)},71692:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.PreBuildSizeVO=ct.PreBuildVO=void 0;const ft=ut(90381);class PreBuildVO{}ct.PreBuildVO=PreBuildVO;pt([(0,ft.ApiProperty)({description:"预构建模块对应文件",required:true,example:{vue:"vue-hash.js"}}),dt("design:type",Object)],PreBuildVO.prototype,"entryNameToFile",void 0);class PreBuildSizeVO{}ct.PreBuildSizeVO=PreBuildSizeVO;pt([(0,ft.ApiProperty)({description:"预构建模块文件总大小",required:true,example:1024}),dt("design:type",Number)],PreBuildSizeVO.prototype,"size",void 0)},75049:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.SignedUrlVO=void 0;const ft=ut(90381);class SignedUrlVO{}ct.SignedUrlVO=SignedUrlVO;pt([(0,ft.ApiProperty)({example:"xxxx",description:"带签名的访问地址",required:true}),dt("design:type",String)],SignedUrlVO.prototype,"signUrl",void 0)},18922:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.PreprocessedCodeVO=void 0;const ft=ut(90381);class PreprocessedCodeVO{}ct.PreprocessedCodeVO=PreprocessedCodeVO;pt([(0,ft.ApiProperty)({description:"预处理后的css代码",required:true}),dt("design:type",String)],PreprocessedCodeVO.prototype,"preprocessedCode",void 0)},15798:(Z,ct)=>{"use strict";const ut={suspectRx:/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*\:/};ct.parse=function(Z,...pt){const dt=typeof pt[0]==="object"&&pt[0];const ft=pt.length>1||!dt?pt[0]:undefined;const _t=pt.length>1&&pt[1]||dt||{};const mt=JSON.parse(Z,ft);if(_t.protoAction==="ignore"){return mt}if(!mt||typeof mt!=="object"){return mt}if(!Z.match(ut.suspectRx)){return mt}ct.scan(mt,_t);return mt};ct.scan=function(Z,ct={}){let ut=[Z];while(ut.length){const Z=ut;ut=[];for(const pt of Z){if(Object.prototype.hasOwnProperty.call(pt,"__proto__")){if(ct.protoAction!=="remove"){throw new SyntaxError("Object contains forbidden prototype property")}delete pt.__proto__}for(const Z in pt){const ct=pt[Z];if(ct&&typeof ct==="object"){ut.push(pt[Z])}}}}};ct.safeParse=function(Z,ut){try{return ct.parse(Z,ut)}catch(Z){return null}}},35522:(Z,ct,ut)=>{"use strict";const pt=ut(99583);const dt=ut(43700);const ft=ut(66621);const _t=ut(69322);const mt={};Z.exports=function(Z,ct,ut={}){pt(Z&&typeof Z==="object","Invalid defaults value: must be an object");pt(!ct||ct===true||typeof ct==="object","Invalid source value: must be true, falsy or an object");pt(typeof ut==="object","Invalid options: must be an object");if(!ct){return null}if(ut.shallow){return mt.applyToDefaultsWithShallow(Z,ct,ut)}const _t=dt(Z);if(ct===true){return _t}const ht=ut.nullOverride!==undefined?ut.nullOverride:false;return ft(_t,ct,{nullOverride:ht,mergeArrays:false})};mt.applyToDefaultsWithShallow=function(Z,ct,ut){const ht=ut.shallow;pt(Array.isArray(ht),"Invalid keys");const yt=new Map;const vt=ct===true?null:new Set;for(let ut of ht){ut=Array.isArray(ut)?ut:ut.split(".");const pt=_t(Z,ut);if(pt&&typeof pt==="object"){yt.set(pt,vt&&_t(ct,ut)||pt)}else if(vt){vt.add(ut)}}const St=dt(Z,{},yt);if(!vt){return St}for(const Z of vt){mt.reachCopy(St,ct,Z)}const bt=ut.nullOverride!==undefined?ut.nullOverride:false;return ft(St,ct,{nullOverride:bt,mergeArrays:false})};mt.reachCopy=function(Z,ct,ut){for(const Z of ut){if(!(Z in ct)){return}const ut=ct[Z];if(typeof ut!=="object"||ut===null){return}ct=ut}const pt=ct;let dt=Z;for(let Z=0;Z<ut.length-1;++Z){const ct=ut[Z];if(typeof dt[ct]!=="object"){dt[ct]={}}dt=dt[ct]}dt[ut[ut.length-1]]=pt}},99583:(Z,ct,ut)=>{"use strict";const pt=ut(16443);const dt={};Z.exports=function(Z,...ct){if(Z){return}if(ct.length===1&&ct[0]instanceof Error){throw ct[0]}throw new pt(ct)}},43700:(Z,ct,ut)=>{"use strict";const pt=ut(69322);const dt=ut(99704);const ft=ut(87492);const _t={needsProtoHack:new Set([dt.set,dt.map,dt.weakSet,dt.weakMap])};Z.exports=_t.clone=function(Z,ct={},ut=null){if(typeof Z!=="object"||Z===null){return Z}let pt=_t.clone;let mt=ut;if(ct.shallow){if(ct.shallow!==true){return _t.cloneWithShallow(Z,ct)}pt=Z=>Z}else if(mt){const ct=mt.get(Z);if(ct){return ct}}else{mt=new Map}const ht=dt.getInternalProto(Z);if(ht===dt.buffer){return Buffer&&Buffer.from(Z)}if(ht===dt.date){return new Date(Z.getTime())}if(ht===dt.regex){return new RegExp(Z)}const yt=_t.base(Z,ht,ct);if(yt===Z){return Z}if(mt){mt.set(Z,yt)}if(ht===dt.set){for(const ut of Z){yt.add(pt(ut,ct,mt))}}else if(ht===dt.map){for(const[ut,dt]of Z){yt.set(ut,pt(dt,ct,mt))}}const vt=ft.keys(Z,ct);for(const ut of vt){if(ut==="__proto__"){continue}if(ht===dt.array&&ut==="length"){yt.length=Z.length;continue}const ft=Object.getOwnPropertyDescriptor(Z,ut);if(ft){if(ft.get||ft.set){Object.defineProperty(yt,ut,ft)}else if(ft.enumerable){yt[ut]=pt(Z[ut],ct,mt)}else{Object.defineProperty(yt,ut,{enumerable:false,writable:true,configurable:true,value:pt(Z[ut],ct,mt)})}}else{Object.defineProperty(yt,ut,{enumerable:true,writable:true,configurable:true,value:pt(Z[ut],ct,mt)})}}return yt};_t.cloneWithShallow=function(Z,ct){const ut=ct.shallow;ct=Object.assign({},ct);ct.shallow=false;const dt=new Map;for(const ct of ut){const ut=pt(Z,ct);if(typeof ut==="object"||typeof ut==="function"){dt.set(ut,ut)}}return _t.clone(Z,ct,dt)};_t.base=function(Z,ct,ut){if(ut.prototype===false){if(_t.needsProtoHack.has(ct)){return new ct.constructor}return ct===dt.array?[]:{}}const pt=Object.getPrototypeOf(Z);if(pt&&pt.isImmutable){return Z}if(ct===dt.array){const Z=[];if(pt!==ct){Object.setPrototypeOf(Z,pt)}return Z}if(_t.needsProtoHack.has(ct)){const Z=new pt.constructor;if(pt!==ct){Object.setPrototypeOf(Z,pt)}return Z}return Object.create(pt)}},35879:(Z,ct,ut)=>{"use strict";const pt=ut(99704);const dt={mismatched:null};Z.exports=function(Z,ct,ut){ut=Object.assign({prototype:true},ut);return!!dt.isDeepEqual(Z,ct,ut,[])};dt.isDeepEqual=function(Z,ct,ut,ft){if(Z===ct){return Z!==0||1/Z===1/ct}const _t=typeof Z;if(_t!==typeof ct){return false}if(Z===null||ct===null){return false}if(_t==="function"){if(!ut.deepFunction||Z.toString()!==ct.toString()){return false}}else if(_t!=="object"){return Z!==Z&&ct!==ct}const mt=dt.getSharedType(Z,ct,!!ut.prototype);switch(mt){case pt.buffer:return Buffer&&Buffer.prototype.equals.call(Z,ct);case pt.promise:return Z===ct;case pt.regex:return Z.toString()===ct.toString();case dt.mismatched:return false}for(let ut=ft.length-1;ut>=0;--ut){if(ft[ut].isSame(Z,ct)){return true}}ft.push(new dt.SeenEntry(Z,ct));try{return!!dt.isDeepEqualObj(mt,Z,ct,ut,ft)}finally{ft.pop()}};dt.getSharedType=function(Z,ct,ut){if(ut){if(Object.getPrototypeOf(Z)!==Object.getPrototypeOf(ct)){return dt.mismatched}return pt.getInternalProto(Z)}const ft=pt.getInternalProto(Z);if(ft!==pt.getInternalProto(ct)){return dt.mismatched}return ft};dt.valueOf=function(Z){const ct=Z.valueOf;if(ct===undefined){return Z}try{return ct.call(Z)}catch(Z){return Z}};dt.hasOwnEnumerableProperty=function(Z,ct){return Object.prototype.propertyIsEnumerable.call(Z,ct)};dt.isSetSimpleEqual=function(Z,ct){for(const ut of Set.prototype.values.call(Z)){if(!Set.prototype.has.call(ct,ut)){return false}}return true};dt.isDeepEqualObj=function(Z,ct,ut,ft,_t){const{isDeepEqual:mt,valueOf:ht,hasOwnEnumerableProperty:yt}=dt;const{keys:vt,getOwnPropertySymbols:St}=Object;if(Z===pt.array){if(ft.part){for(const Z of ct){for(const ct of ut){if(mt(Z,ct,ft,_t)){return true}}}}else{if(ct.length!==ut.length){return false}for(let Z=0;Z<ct.length;++Z){if(!mt(ct[Z],ut[Z],ft,_t)){return false}}return true}}else if(Z===pt.set){if(ct.size!==ut.size){return false}if(!dt.isSetSimpleEqual(ct,ut)){const Z=new Set(Set.prototype.values.call(ut));for(const ut of Set.prototype.values.call(ct)){if(Z.delete(ut)){continue}let ct=false;for(const pt of Z){if(mt(ut,pt,ft,_t)){Z.delete(pt);ct=true;break}}if(!ct){return false}}}}else if(Z===pt.map){if(ct.size!==ut.size){return false}for(const[Z,pt]of Map.prototype.entries.call(ct)){if(pt===undefined&&!Map.prototype.has.call(ut,Z)){return false}if(!mt(pt,Map.prototype.get.call(ut,Z),ft,_t)){return false}}}else if(Z===pt.error){if(ct.name!==ut.name||ct.message!==ut.message){return false}}const bt=ht(ct);const xt=ht(ut);if((ct!==bt||ut!==xt)&&!mt(bt,xt,ft,_t)){return false}const $t=vt(ct);if(!ft.part&&$t.length!==vt(ut).length&&!ft.skip){return false}let Et=0;for(const Z of $t){if(ft.skip&&ft.skip.includes(Z)){if(ut[Z]===undefined){++Et}continue}if(!yt(ut,Z)){return false}if(!mt(ct[Z],ut[Z],ft,_t)){return false}}if(!ft.part&&$t.length-Et!==vt(ut).length){return false}if(ft.symbols!==false){const Z=St(ct);const pt=new Set(St(ut));for(const dt of Z){if(!ft.skip||!ft.skip.includes(dt)){if(yt(ct,dt)){if(!yt(ut,dt)){return false}if(!mt(ct[dt],ut[dt],ft,_t)){return false}}else if(yt(ut,dt)){return false}}pt.delete(dt)}for(const Z of pt){if(yt(ut,Z)){return false}}}return true};dt.SeenEntry=class{constructor(Z,ct){this.obj=Z;this.ref=ct}isSame(Z,ct){return this.obj===Z&&this.ref===ct}}},16443:(Z,ct,ut)=>{"use strict";const pt=ut(72912);const dt={};Z.exports=class extends Error{constructor(Z){const ut=Z.filter((Z=>Z!=="")).map((Z=>typeof Z==="string"?Z:Z instanceof Error?Z.message:pt(Z)));super(ut.join(" ")||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,ct.assert)}}}},57391:Z=>{"use strict";const ct={};Z.exports=function(Z){if(!Z){return""}let ut="";for(let pt=0;pt<Z.length;++pt){const dt=Z.charCodeAt(pt);if(ct.isSafe(dt)){ut+=Z[pt]}else{ut+=ct.escapeHtmlChar(dt)}}return ut};ct.escapeHtmlChar=function(Z){const ut=ct.namedHtml.get(Z);if(ut){return ut}if(Z>=256){return"&#"+Z+";"}const pt=Z.toString(16).padStart(2,"0");return`&#x${pt};`};ct.isSafe=function(Z){return ct.safeCharCodes.has(Z)};ct.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]);ct.safeCharCodes=function(){const Z=new Set;for(let ct=32;ct<123;++ct){if(ct>=97||ct>=65&&ct<=90||ct>=48&&ct<=57||ct===32||ct===46||ct===44||ct===45||ct===58||ct===95){Z.add(ct)}}return Z}()},43935:Z=>{"use strict";const ct={};Z.exports=function(Z){return Z.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},85363:Z=>{"use strict";const ct={};Z.exports=function(){}},66621:(Z,ct,ut)=>{"use strict";const pt=ut(99583);const dt=ut(43700);const ft=ut(87492);const _t={};Z.exports=_t.merge=function(Z,ct,ut){pt(Z&&typeof Z==="object","Invalid target value: must be an object");pt(ct===null||ct===undefined||typeof ct==="object","Invalid source value: must be null, undefined, or an object");if(!ct){return Z}ut=Object.assign({nullOverride:true,mergeArrays:true},ut);if(Array.isArray(ct)){pt(Array.isArray(Z),"Cannot merge array onto an object");if(!ut.mergeArrays){Z.length=0}for(let pt=0;pt<ct.length;++pt){Z.push(dt(ct[pt],{symbols:ut.symbols}))}return Z}const mt=ft.keys(ct,ut);for(let pt=0;pt<mt.length;++pt){const ft=mt[pt];if(ft==="__proto__"||!Object.prototype.propertyIsEnumerable.call(ct,ft)){continue}const ht=ct[ft];if(ht&&typeof ht==="object"){if(Z[ft]===ht){continue}if(!Z[ft]||typeof Z[ft]!=="object"||Array.isArray(Z[ft])!==Array.isArray(ht)||ht instanceof Date||Buffer&&Buffer.isBuffer(ht)||ht instanceof RegExp){Z[ft]=dt(ht,{symbols:ut.symbols})}else{_t.merge(Z[ft],ht,ut)}}else{if(ht!==null&&ht!==undefined){Z[ft]=ht}else if(ut.nullOverride){Z[ft]=ht}}}return Z}},69322:(Z,ct,ut)=>{"use strict";const pt=ut(99583);const dt={};Z.exports=function(Z,ct,ut){if(ct===false||ct===null||ct===undefined){return Z}ut=ut||{};if(typeof ut==="string"){ut={separator:ut}}const ft=Array.isArray(ct);pt(!ft||!ut.separator,"Separator option is not valid for array-based chain");const _t=ft?ct:ct.split(ut.separator||".");let mt=Z;for(let Z=0;Z<_t.length;++Z){let ft=_t[Z];const ht=ut.iterables&&dt.iterables(mt);if(Array.isArray(mt)||ht==="set"){const Z=Number(ft);if(Number.isInteger(Z)){ft=Z<0?mt.length+Z:Z}}if(!mt||typeof mt==="function"&&ut.functions===false||!ht&&mt[ft]===undefined){pt(!ut.strict||Z+1===_t.length,"Missing segment",ft,"in reach path ",ct);pt(typeof mt==="object"||ut.functions===true||typeof mt!=="function","Invalid segment",ft,"in reach path ",ct);mt=ut.default;break}if(!ht){mt=mt[ft]}else if(ht==="set"){mt=[...mt][ft]}else{mt=mt.get(ft)}}return mt};dt.iterables=function(Z){if(Z instanceof Set){return"set"}if(Z instanceof Map){return"map"}}},72912:Z=>{"use strict";const ct={};Z.exports=function(...Z){try{return JSON.stringify(...Z)}catch(Z){return"[Cannot display object: "+Z.message+"]"}}},99704:(Z,ct)=>{"use strict";const ut={};ct=Z.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};ut.typeMap=new Map([["[object Error]",ct.error],["[object Map]",ct.map],["[object Promise]",ct.promise],["[object Set]",ct.set],["[object WeakMap]",ct.weakMap],["[object WeakSet]",ct.weakSet]]);ct.getInternalProto=function(Z){if(Array.isArray(Z)){return ct.array}if(Buffer&&Z instanceof Buffer){return ct.buffer}if(Z instanceof Date){return ct.date}if(Z instanceof RegExp){return ct.regex}if(Z instanceof Error){return ct.error}const pt=Object.prototype.toString.call(Z);return ut.typeMap.get(pt)||ct.generic}},87492:(Z,ct)=>{"use strict";const ut={};ct.keys=function(Z,ct={}){return ct.symbols!==false?Reflect.ownKeys(Z):Object.getOwnPropertyNames(Z)}},75663:(Z,ct,ut)=>{"use strict";const pt=ut(99583);const dt={};ct.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(Z,ct){ct=ct||{};const ut=[].concat(ct.before||[]);const dt=[].concat(ct.after||[]);const ft=ct.group||"?";const _t=ct.sort||0;pt(!ut.includes(ft),`Item cannot come before itself: ${ft}`);pt(!ut.includes("?"),"Item cannot come before unassociated items");pt(!dt.includes(ft),`Item cannot come after itself: ${ft}`);pt(!dt.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(Z)){Z=[Z]}for(const ct of Z){const Z={seq:this._items.length,sort:_t,before:ut,after:dt,group:ft,node:ct};this._items.push(Z)}if(!ct.manual){const Z=this._sort();pt(Z,"item",ft!=="?"?`added into group ${ft}`:"","created a dependencies error")}return this.nodes}merge(Z){if(!Array.isArray(Z)){Z=[Z]}for(const ct of Z){if(ct){for(const Z of ct._items){this._items.push(Object.assign({},Z))}}}this._items.sort(dt.mergeSort);for(let Z=0;Z<this._items.length;++Z){this._items[Z].seq=Z}const ct=this._sort();pt(ct,"merge created a dependencies error");return this.nodes}sort(){const Z=this._sort();pt(Z,"sort created a dependencies error");return this.nodes}_sort(){const Z={};const ct=Object.create(null);const ut=Object.create(null);for(const pt of this._items){const dt=pt.seq;const ft=pt.group;ut[ft]=ut[ft]||[];ut[ft].push(dt);Z[dt]=pt.before;for(const Z of pt.after){ct[Z]=ct[Z]||[];ct[Z].push(dt)}}for(const ct in Z){const pt=[];for(const dt in Z[ct]){const ft=Z[ct][dt];ut[ft]=ut[ft]||[];pt.push(...ut[ft])}Z[ct]=pt}for(const pt in ct){if(ut[pt]){for(const dt of ut[pt]){Z[dt].push(...ct[pt])}}}const pt={};for(const ct in Z){const ut=Z[ct];for(const Z of ut){pt[Z]=pt[Z]||[];pt[Z].push(ct)}}const dt={};const ft=[];for(let Z=0;Z<this._items.length;++Z){let ct=Z;if(pt[Z]){ct=null;for(let Z=0;Z<this._items.length;++Z){if(dt[Z]===true){continue}if(!pt[Z]){pt[Z]=[]}const ut=pt[Z].length;let ft=0;for(let ct=0;ct<ut;++ct){if(dt[pt[Z][ct]]){++ft}}if(ft===ut){ct=Z;break}}}if(ct!==null){dt[ct]=true;ft.push(ct)}}if(ft.length!==this._items.length){return false}const _t={};for(const Z of this._items){_t[Z.seq]=Z}this._items=[];this.nodes=[];for(const Z of ft){const ct=_t[Z];this.nodes.push(ct.node);this._items.push(ct)}return true}};dt.mergeSort=(Z,ct)=>Z.sort===ct.sort?0:Z.sort<ct.sort?-1:1},46284:function(Z,ct,ut){Z=ut.nmd(Z);(function(ct,pt){if(true){pt(Z,ut(35073),ut(17239));Z.exports=def(Z)}else{}function def(Z){return"default"in Z.exports?Z.exports.default:Z.exports}})(this,(function(Z,ct,ut){"use strict";var pt=Object.create;var dt=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var mt=Object.getPrototypeOf;var ht=Object.prototype.hasOwnProperty;var __commonJS=(Z,ct)=>function __require(){return ct||(0,Z[_t(Z)[0]])((ct={exports:{}}).exports,ct),ct.exports};var __export=(Z,ct)=>{for(var ut in ct)dt(Z,ut,{get:ct[ut],enumerable:true})};var __copyProps=(Z,ct,ut,pt)=>{if(ct&&typeof ct==="object"||typeof ct==="function"){for(let mt of _t(ct))if(!ht.call(Z,mt)&&mt!==ut)dt(Z,mt,{get:()=>ct[mt],enumerable:!(pt=ft(ct,mt))||pt.enumerable})}return Z};var __toESM=(Z,ct,ut)=>(ut=Z!=null?pt(mt(Z)):{},__copyProps(ct||!Z||!Z.__esModule?dt(ut,"default",{value:Z,enumerable:true}):ut,Z));var __toCommonJS=Z=>__copyProps(dt({},"__esModule",{value:true}),Z);var yt=__commonJS({"umd:@jridgewell/sourcemap-codec"(Z,ut){ut.exports=ct}});var vt=__commonJS({"umd:@jridgewell/trace-mapping"(Z,ct){ct.exports=ut}});var St={};__export(St,{GenMapping:()=>It,addMapping:()=>addMapping,addSegment:()=>addSegment,allMappings:()=>allMappings,fromMap:()=>fromMap,maybeAddMapping:()=>maybeAddMapping,maybeAddSegment:()=>maybeAddSegment,setIgnore:()=>setIgnore,setSourceContent:()=>setSourceContent,toDecodedMap:()=>toDecodedMap,toEncodedMap:()=>toEncodedMap});Z.exports=__toCommonJS(St);var bt=class{constructor(){this._indexes={__proto__:null};this.array=[]}};function cast(Z){return Z}function get(Z,ct){return cast(Z)._indexes[ct]}function put(Z,ct){const ut=get(Z,ct);if(ut!==void 0)return ut;const{array:pt,_indexes:dt}=cast(Z);const ft=pt.push(ct);return dt[ct]=ft-1}function remove(Z,ct){const ut=get(Z,ct);if(ut===void 0)return;const{array:pt,_indexes:dt}=cast(Z);for(let Z=ut+1;Z<pt.length;Z++){const ct=pt[Z];pt[Z-1]=ct;dt[ct]--}dt[ct]=void 0;pt.pop()}var xt=__toESM(yt());var $t=__toESM(vt());var Et=0;var Ct=1;var Tt=2;var wt=3;var At=4;var kt=-1;var It=class{constructor({file:Z,sourceRoot:ct}={}){this._names=new bt;this._sources=new bt;this._sourcesContent=[];this._mappings=[];this.file=Z;this.sourceRoot=ct;this._ignoreList=new bt}};function cast2(Z){return Z}function addSegment(Z,ct,ut,pt,dt,ft,_t,mt){return addSegmentInternal(false,Z,ct,ut,pt,dt,ft,_t,mt)}function addMapping(Z,ct){return addMappingInternal(false,Z,ct)}var maybeAddSegment=(Z,ct,ut,pt,dt,ft,_t,mt)=>addSegmentInternal(true,Z,ct,ut,pt,dt,ft,_t,mt);var maybeAddMapping=(Z,ct)=>addMappingInternal(true,Z,ct);function setSourceContent(Z,ct,ut){const{_sources:pt,_sourcesContent:dt}=cast2(Z);const ft=put(pt,ct);dt[ft]=ut}function setIgnore(Z,ct,ut=true){const{_sources:pt,_sourcesContent:dt,_ignoreList:ft}=cast2(Z);const _t=put(pt,ct);if(_t===dt.length)dt[_t]=null;if(ut)put(ft,_t);else remove(ft,_t)}function toDecodedMap(Z){const{_mappings:ct,_sources:ut,_sourcesContent:pt,_names:dt,_ignoreList:ft}=cast2(Z);removeEmptyFinalLines(ct);return{version:3,file:Z.file||void 0,names:dt.array,sourceRoot:Z.sourceRoot||void 0,sources:ut.array,sourcesContent:pt,mappings:ct,ignoreList:ft.array}}function toEncodedMap(Z){const ct=toDecodedMap(Z);return Object.assign({},ct,{mappings:(0,xt.encode)(ct.mappings)})}function fromMap(Z){const ct=new $t.TraceMap(Z);const ut=new It({file:ct.file,sourceRoot:ct.sourceRoot});putAll(cast2(ut)._names,ct.names);putAll(cast2(ut)._sources,ct.sources);cast2(ut)._sourcesContent=ct.sourcesContent||ct.sources.map((()=>null));cast2(ut)._mappings=(0,$t.decodedMappings)(ct);if(ct.ignoreList)putAll(cast2(ut)._ignoreList,ct.ignoreList);return ut}function allMappings(Z){const ct=[];const{_mappings:ut,_sources:pt,_names:dt}=cast2(Z);for(let Z=0;Z<ut.length;Z++){const ft=ut[Z];for(let ut=0;ut<ft.length;ut++){const _t=ft[ut];const mt={line:Z+1,column:_t[Et]};let ht=void 0;let yt=void 0;let vt=void 0;if(_t.length!==1){ht=pt.array[_t[Ct]];yt={line:_t[Tt]+1,column:_t[wt]};if(_t.length===5)vt=dt.array[_t[At]]}ct.push({generated:mt,source:ht,original:yt,name:vt})}}return ct}function addSegmentInternal(Z,ct,ut,pt,dt,ft,_t,mt,ht){const{_mappings:yt,_sources:vt,_sourcesContent:St,_names:bt}=cast2(ct);const xt=getIndex(yt,ut);const $t=getColumnIndex(xt,pt);if(!dt){if(Z&&skipSourceless(xt,$t))return;return insert(xt,$t,[pt])}assert(ft);assert(_t);const Et=put(vt,dt);const Ct=mt?put(bt,mt):kt;if(Et===St.length)St[Et]=ht!=null?ht:null;if(Z&&skipSource(xt,$t,Et,ft,_t,Ct)){return}return insert(xt,$t,mt?[pt,Et,ft,_t,Ct]:[pt,Et,ft,_t])}function assert(Z){}function getIndex(Z,ct){for(let ut=Z.length;ut<=ct;ut++){Z[ut]=[]}return Z[ct]}function getColumnIndex(Z,ct){let ut=Z.length;for(let pt=ut-1;pt>=0;ut=pt--){const ut=Z[pt];if(ct>=ut[Et])break}return ut}function insert(Z,ct,ut){for(let ut=Z.length;ut>ct;ut--){Z[ut]=Z[ut-1]}Z[ct]=ut}function removeEmptyFinalLines(Z){const{length:ct}=Z;let ut=ct;for(let ct=ut-1;ct>=0;ut=ct,ct--){if(Z[ct].length>0)break}if(ut<ct)Z.length=ut}function putAll(Z,ct){for(let ut=0;ut<ct.length;ut++)put(Z,ct[ut])}function skipSourceless(Z,ct){if(ct===0)return true;const ut=Z[ct-1];return ut.length===1}function skipSource(Z,ct,ut,pt,dt,ft){if(ct===0)return false;const _t=Z[ct-1];if(_t.length===1)return false;return ut===_t[Ct]&&pt===_t[Tt]&&dt===_t[wt]&&ft===(_t.length===5?_t[At]:kt)}function addMappingInternal(Z,ct,ut){const{generated:pt,source:dt,original:ft,name:_t,content:mt}=ut;if(!dt){return addSegmentInternal(Z,ct,pt.line-1,pt.column,null,null,null,null,null)}assert(ft);return addSegmentInternal(Z,ct,pt.line-1,pt.column,dt,ft.line-1,ft.column,_t,mt)}}))},6001:function(Z){(function(ct,ut){true?Z.exports=ut():0})(this,(function(){"use strict";const Z=/^[\w+.-]+:\/\//;const ct=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;const ut=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function isAbsoluteUrl(ct){return Z.test(ct)}function isSchemeRelativeUrl(Z){return Z.startsWith("//")}function isAbsolutePath(Z){return Z.startsWith("/")}function isFileUrl(Z){return Z.startsWith("file:")}function isRelative(Z){return/^[.?#]/.test(Z)}function parseAbsoluteUrl(Z){const ut=ct.exec(Z);return makeUrl(ut[1],ut[2]||"",ut[3],ut[4]||"",ut[5]||"/",ut[6]||"",ut[7]||"")}function parseFileUrl(Z){const ct=ut.exec(Z);const pt=ct[2];return makeUrl("file:","",ct[1]||"","",isAbsolutePath(pt)?pt:"/"+pt,ct[3]||"",ct[4]||"")}function makeUrl(Z,ct,ut,pt,dt,ft,_t){return{scheme:Z,user:ct,host:ut,port:pt,path:dt,query:ft,hash:_t,type:7}}function parseUrl(Z){if(isSchemeRelativeUrl(Z)){const ct=parseAbsoluteUrl("http:"+Z);ct.scheme="";ct.type=6;return ct}if(isAbsolutePath(Z)){const ct=parseAbsoluteUrl("http://foo.com"+Z);ct.scheme="";ct.host="";ct.type=5;return ct}if(isFileUrl(Z))return parseFileUrl(Z);if(isAbsoluteUrl(Z))return parseAbsoluteUrl(Z);const ct=parseAbsoluteUrl("http://foo.com/"+Z);ct.scheme="";ct.host="";ct.type=Z?Z.startsWith("?")?3:Z.startsWith("#")?2:4:1;return ct}function stripPathFilename(Z){if(Z.endsWith("/.."))return Z;const ct=Z.lastIndexOf("/");return Z.slice(0,ct+1)}function mergePaths(Z,ct){normalizePath(ct,ct.type);if(Z.path==="/"){Z.path=ct.path}else{Z.path=stripPathFilename(ct.path)+Z.path}}function normalizePath(Z,ct){const ut=ct<=4;const pt=Z.path.split("/");let dt=1;let ft=0;let _t=false;for(let Z=1;Z<pt.length;Z++){const ct=pt[Z];if(!ct){_t=true;continue}_t=false;if(ct===".")continue;if(ct===".."){if(ft){_t=true;ft--;dt--}else if(ut){pt[dt++]=ct}continue}pt[dt++]=ct;ft++}let mt="";for(let Z=1;Z<dt;Z++){mt+="/"+pt[Z]}if(!mt||_t&&!mt.endsWith("/..")){mt+="/"}Z.path=mt}function resolve(Z,ct){if(!Z&&!ct)return"";const ut=parseUrl(Z);let pt=ut.type;if(ct&&pt!==7){const Z=parseUrl(ct);const dt=Z.type;switch(pt){case 1:ut.hash=Z.hash;case 2:ut.query=Z.query;case 3:case 4:mergePaths(ut,Z);case 5:ut.user=Z.user;ut.host=Z.host;ut.port=Z.port;case 6:ut.scheme=Z.scheme}if(dt>pt)pt=dt}normalizePath(ut,pt);const dt=ut.query+ut.hash;switch(pt){case 2:case 3:return dt;case 4:{const pt=ut.path.slice(1);if(!pt)return dt||".";if(isRelative(ct||Z)&&!isRelative(pt)){return"./"+pt+dt}return pt+dt}case 5:return ut.path+dt;default:return ut.scheme+"//"+ut.user+ut.host+ut.port+ut.path+dt}}return resolve}))},35073:function(Z,ct,ut){Z=ut.nmd(Z);(function(ct,ut){if(true){ut(Z);Z.exports=def(Z)}else{}function def(Z){return"default"in Z.exports?Z.exports.default:Z.exports}})(this,(function(Z){"use strict";var ct=Object.defineProperty;var ut=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var dt=Object.prototype.hasOwnProperty;var __export=(Z,ut)=>{for(var pt in ut)ct(Z,pt,{get:ut[pt],enumerable:true})};var __copyProps=(Z,ft,_t,mt)=>{if(ft&&typeof ft==="object"||typeof ft==="function"){for(let ht of pt(ft))if(!dt.call(Z,ht)&&ht!==_t)ct(Z,ht,{get:()=>ft[ht],enumerable:!(mt=ut(ft,ht))||mt.enumerable})}return Z};var __toCommonJS=Z=>__copyProps(ct({},"__esModule",{value:true}),Z);var ft={};__export(ft,{decode:()=>decode,decodeGeneratedRanges:()=>decodeGeneratedRanges,decodeOriginalScopes:()=>decodeOriginalScopes,encode:()=>encode,encodeGeneratedRanges:()=>encodeGeneratedRanges,encodeOriginalScopes:()=>encodeOriginalScopes});Z.exports=__toCommonJS(ft);var _t=",".charCodeAt(0);var mt=";".charCodeAt(0);var ht="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var yt=new Uint8Array(64);var vt=new Uint8Array(128);for(let Z=0;Z<ht.length;Z++){const ct=ht.charCodeAt(Z);yt[Z]=ct;vt[ct]=Z}function decodeInteger(Z,ct){let ut=0;let pt=0;let dt=0;do{const ct=Z.next();dt=vt[ct];ut|=(dt&31)<<pt;pt+=5}while(dt&32);const ft=ut&1;ut>>>=1;if(ft){ut=-2147483648|-ut}return ct+ut}function encodeInteger(Z,ct,ut){let pt=ct-ut;pt=pt<0?-pt<<1|1:pt<<1;do{let ct=pt&31;pt>>>=5;if(pt>0)ct|=32;Z.write(yt[ct])}while(pt>0);return ct}function hasMoreVlq(Z,ct){if(Z.pos>=ct)return false;return Z.peek()!==_t}var St=1024*16;var bt=typeof TextDecoder!=="undefined"?new TextDecoder:typeof Buffer!=="undefined"?{decode(Z){const ct=Buffer.from(Z.buffer,Z.byteOffset,Z.byteLength);return ct.toString()}}:{decode(Z){let ct="";for(let ut=0;ut<Z.length;ut++){ct+=String.fromCharCode(Z[ut])}return ct}};var xt=class{constructor(){this.pos=0;this.out="";this.buffer=new Uint8Array(St)}write(Z){const{buffer:ct}=this;ct[this.pos++]=Z;if(this.pos===St){this.out+=bt.decode(ct);this.pos=0}}flush(){const{buffer:Z,out:ct,pos:ut}=this;return ut>0?ct+bt.decode(Z.subarray(0,ut)):ct}};var $t=class{constructor(Z){this.pos=0;this.buffer=Z}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(Z){const{buffer:ct,pos:ut}=this;const pt=ct.indexOf(Z,ut);return pt===-1?ct.length:pt}};var Et=[];function decodeOriginalScopes(Z){const{length:ct}=Z;const ut=new $t(Z);const pt=[];const dt=[];let ft=0;for(;ut.pos<ct;ut.pos++){ft=decodeInteger(ut,ft);const Z=decodeInteger(ut,0);if(!hasMoreVlq(ut,ct)){const ct=dt.pop();ct[2]=ft;ct[3]=Z;continue}const _t=decodeInteger(ut,0);const mt=decodeInteger(ut,0);const ht=mt&1;const yt=ht?[ft,Z,0,0,_t,decodeInteger(ut,0)]:[ft,Z,0,0,_t];let vt=Et;if(hasMoreVlq(ut,ct)){vt=[];do{const Z=decodeInteger(ut,0);vt.push(Z)}while(hasMoreVlq(ut,ct))}yt.vars=vt;pt.push(yt);dt.push(yt)}return pt}function encodeOriginalScopes(Z){const ct=new xt;for(let ut=0;ut<Z.length;){ut=_encodeOriginalScopes(Z,ut,ct,[0])}return ct.flush()}function _encodeOriginalScopes(Z,ct,ut,pt){const dt=Z[ct];const{0:ft,1:mt,2:ht,3:yt,4:vt,vars:St}=dt;if(ct>0)ut.write(_t);pt[0]=encodeInteger(ut,ft,pt[0]);encodeInteger(ut,mt,0);encodeInteger(ut,vt,0);const bt=dt.length===6?1:0;encodeInteger(ut,bt,0);if(dt.length===6)encodeInteger(ut,dt[5],0);for(const Z of St){encodeInteger(ut,Z,0)}for(ct++;ct<Z.length;){const dt=Z[ct];const{0:ft,1:_t}=dt;if(ft>ht||ft===ht&&_t>=yt){break}ct=_encodeOriginalScopes(Z,ct,ut,pt)}ut.write(_t);pt[0]=encodeInteger(ut,ht,pt[0]);encodeInteger(ut,yt,0);return ct}function decodeGeneratedRanges(Z){const{length:ct}=Z;const ut=new $t(Z);const pt=[];const dt=[];let ft=0;let _t=0;let mt=0;let ht=0;let yt=0;let vt=0;let St=0;let bt=0;do{const Z=ut.indexOf(";");let ct=0;for(;ut.pos<Z;ut.pos++){ct=decodeInteger(ut,ct);if(!hasMoreVlq(ut,Z)){const Z=dt.pop();Z[2]=ft;Z[3]=ct;continue}const xt=decodeInteger(ut,0);const $t=xt&1;const Ct=xt&2;const Tt=xt&4;let wt=null;let At=Et;let kt;if($t){const Z=decodeInteger(ut,_t);mt=decodeInteger(ut,_t===Z?mt:0);_t=Z;kt=[ft,ct,0,0,Z,mt]}else{kt=[ft,ct,0,0]}kt.isScope=!!Tt;if(Ct){const Z=ht;const ct=yt;ht=decodeInteger(ut,ht);const pt=Z===ht;yt=decodeInteger(ut,pt?yt:0);vt=decodeInteger(ut,pt&&ct===yt?vt:0);wt=[ht,yt,vt]}kt.callsite=wt;if(hasMoreVlq(ut,Z)){At=[];do{St=ft;bt=ct;const Z=decodeInteger(ut,0);let pt;if(Z<-1){pt=[[decodeInteger(ut,0)]];for(let ct=-1;ct>Z;ct--){const Z=St;St=decodeInteger(ut,St);bt=decodeInteger(ut,St===Z?bt:0);const ct=decodeInteger(ut,0);pt.push([ct,St,bt])}}else{pt=[[Z]]}At.push(pt)}while(hasMoreVlq(ut,Z))}kt.bindings=At;pt.push(kt);dt.push(kt)}ft++;ut.pos=Z+1}while(ut.pos<ct);return pt}function encodeGeneratedRanges(Z){if(Z.length===0)return"";const ct=new xt;for(let ut=0;ut<Z.length;){ut=_encodeGeneratedRanges(Z,ut,ct,[0,0,0,0,0,0,0])}return ct.flush()}function _encodeGeneratedRanges(Z,ct,ut,pt){const dt=Z[ct];const{0:ft,1:mt,2:ht,3:yt,isScope:vt,callsite:St,bindings:bt}=dt;if(pt[0]<ft){catchupLine(ut,pt[0],ft);pt[0]=ft;pt[1]=0}else if(ct>0){ut.write(_t)}pt[1]=encodeInteger(ut,dt[1],pt[1]);const xt=(dt.length===6?1:0)|(St?2:0)|(vt?4:0);encodeInteger(ut,xt,0);if(dt.length===6){const{4:Z,5:ct}=dt;if(Z!==pt[2]){pt[3]=0}pt[2]=encodeInteger(ut,Z,pt[2]);pt[3]=encodeInteger(ut,ct,pt[3])}if(St){const{0:Z,1:ct,2:ft}=dt.callsite;if(Z!==pt[4]){pt[5]=0;pt[6]=0}else if(ct!==pt[5]){pt[6]=0}pt[4]=encodeInteger(ut,Z,pt[4]);pt[5]=encodeInteger(ut,ct,pt[5]);pt[6]=encodeInteger(ut,ft,pt[6])}if(bt){for(const Z of bt){if(Z.length>1)encodeInteger(ut,-Z.length,0);const ct=Z[0][0];encodeInteger(ut,ct,0);let pt=ft;let dt=mt;for(let ct=1;ct<Z.length;ct++){const ft=Z[ct];pt=encodeInteger(ut,ft[1],pt);dt=encodeInteger(ut,ft[2],dt);encodeInteger(ut,ft[0],0)}}}for(ct++;ct<Z.length;){const dt=Z[ct];const{0:ft,1:_t}=dt;if(ft>ht||ft===ht&&_t>=yt){break}ct=_encodeGeneratedRanges(Z,ct,ut,pt)}if(pt[0]<ht){catchupLine(ut,pt[0],ht);pt[0]=ht;pt[1]=0}else{ut.write(_t)}pt[1]=encodeInteger(ut,yt,pt[1]);return ct}function catchupLine(Z,ct,ut){do{Z.write(mt)}while(++ct<ut)}function decode(Z){const{length:ct}=Z;const ut=new $t(Z);const pt=[];let dt=0;let ft=0;let _t=0;let mt=0;let ht=0;do{const Z=ut.indexOf(";");const ct=[];let yt=true;let vt=0;dt=0;while(ut.pos<Z){let pt;dt=decodeInteger(ut,dt);if(dt<vt)yt=false;vt=dt;if(hasMoreVlq(ut,Z)){ft=decodeInteger(ut,ft);_t=decodeInteger(ut,_t);mt=decodeInteger(ut,mt);if(hasMoreVlq(ut,Z)){ht=decodeInteger(ut,ht);pt=[dt,ft,_t,mt,ht]}else{pt=[dt,ft,_t,mt]}}else{pt=[dt]}ct.push(pt);ut.pos++}if(!yt)sort(ct);pt.push(ct);ut.pos=Z+1}while(ut.pos<=ct);return pt}function sort(Z){Z.sort(sortComparator)}function sortComparator(Z,ct){return Z[0]-ct[0]}function encode(Z){const ct=new xt;let ut=0;let pt=0;let dt=0;let ft=0;for(let ht=0;ht<Z.length;ht++){const yt=Z[ht];if(ht>0)ct.write(mt);if(yt.length===0)continue;let vt=0;for(let Z=0;Z<yt.length;Z++){const mt=yt[Z];if(Z>0)ct.write(_t);vt=encodeInteger(ct,mt[0],vt);if(mt.length===1)continue;ut=encodeInteger(ct,mt[1],ut);pt=encodeInteger(ct,mt[2],pt);dt=encodeInteger(ct,mt[3],dt);if(mt.length===4)continue;ft=encodeInteger(ct,mt[4],ft)}}return ct.flush()}}))},17239:function(Z,ct,ut){Z=ut.nmd(Z);(function(ct,pt){if(true){pt(Z,ut(6001),ut(35073));Z.exports=def(Z)}else{}function def(Z){return"default"in Z.exports?Z.exports.default:Z.exports}})(this,(function(Z,ct,ut){"use strict";var pt=Object.create;var dt=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var mt=Object.getPrototypeOf;var ht=Object.prototype.hasOwnProperty;var __commonJS=(Z,ct)=>function __require(){return ct||(0,Z[_t(Z)[0]])((ct={exports:{}}).exports,ct),ct.exports};var __export=(Z,ct)=>{for(var ut in ct)dt(Z,ut,{get:ct[ut],enumerable:true})};var __copyProps=(Z,ct,ut,pt)=>{if(ct&&typeof ct==="object"||typeof ct==="function"){for(let mt of _t(ct))if(!ht.call(Z,mt)&&mt!==ut)dt(Z,mt,{get:()=>ct[mt],enumerable:!(pt=ft(ct,mt))||pt.enumerable})}return Z};var __toESM=(Z,ct,ut)=>(ut=Z!=null?pt(mt(Z)):{},__copyProps(ct||!Z||!Z.__esModule?dt(ut,"default",{value:Z,enumerable:true}):ut,Z));var __toCommonJS=Z=>__copyProps(dt({},"__esModule",{value:true}),Z);var yt=__commonJS({"umd:@jridgewell/sourcemap-codec"(Z,ct){ct.exports=ut}});var vt=__commonJS({"umd:@jridgewell/resolve-uri"(Z,ut){ut.exports=ct}});var St={};__export(St,{AnyMap:()=>FlattenMap,FlattenMap:()=>FlattenMap,GREATEST_LOWER_BOUND:()=>Dt,LEAST_UPPER_BOUND:()=>Ot,TraceMap:()=>Ft,allGeneratedPositionsFor:()=>allGeneratedPositionsFor,decodedMap:()=>decodedMap,decodedMappings:()=>decodedMappings,eachMapping:()=>eachMapping,encodedMap:()=>encodedMap,encodedMappings:()=>encodedMappings,generatedPositionFor:()=>generatedPositionFor,isIgnored:()=>isIgnored,originalPositionFor:()=>originalPositionFor,presortedDecodedMap:()=>presortedDecodedMap,sourceContentFor:()=>sourceContentFor,traceSegment:()=>traceSegment});Z.exports=__toCommonJS(St);var bt=__toESM(yt());var xt=__toESM(vt());function stripFilename(Z){if(!Z)return"";const ct=Z.lastIndexOf("/");return Z.slice(0,ct+1)}function resolver(Z,ct){const ut=stripFilename(Z);const pt=ct?ct+"/":"";return Z=>(0,xt.default)(pt+(Z||""),ut)}var $t=0;var Et=1;var Ct=2;var Tt=3;var wt=4;var At=1;var kt=2;function maybeSort(Z,ct){const ut=nextUnsortedSegmentLine(Z,0);if(ut===Z.length)return Z;if(!ct)Z=Z.slice();for(let pt=ut;pt<Z.length;pt=nextUnsortedSegmentLine(Z,pt+1)){Z[pt]=sortSegments(Z[pt],ct)}return Z}function nextUnsortedSegmentLine(Z,ct){for(let ut=ct;ut<Z.length;ut++){if(!isSorted(Z[ut]))return ut}return Z.length}function isSorted(Z){for(let ct=1;ct<Z.length;ct++){if(Z[ct][$t]<Z[ct-1][$t]){return false}}return true}function sortSegments(Z,ct){if(!ct)Z=Z.slice();return Z.sort(sortComparator)}function sortComparator(Z,ct){return Z[$t]-ct[$t]}function buildBySources(Z,ct){const ut=ct.map((()=>[]));for(let ct=0;ct<Z.length;ct++){const pt=Z[ct];for(let Z=0;Z<pt.length;Z++){const dt=pt[Z];if(dt.length===1)continue;const ft=dt[Et];const _t=dt[Ct];const mt=dt[Tt];const ht=ut[ft];const yt=ht[_t]||(ht[_t]=[]);yt.push([mt,ct,dt[$t]])}}for(let Z=0;Z<ut.length;Z++){const ct=ut[Z];for(let Z=0;Z<ct.length;Z++){const ut=ct[Z];if(ut)ut.sort(sortComparator)}}return ut}var It=false;function binarySearch(Z,ct,ut,pt){while(ut<=pt){const dt=ut+(pt-ut>>1);const ft=Z[dt][$t]-ct;if(ft===0){It=true;return dt}if(ft<0){ut=dt+1}else{pt=dt-1}}It=false;return ut-1}function upperBound(Z,ct,ut){for(let pt=ut+1;pt<Z.length;ut=pt++){if(Z[pt][$t]!==ct)break}return ut}function lowerBound(Z,ct,ut){for(let pt=ut-1;pt>=0;ut=pt--){if(Z[pt][$t]!==ct)break}return ut}function memoizedState(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function memoizedBinarySearch(Z,ct,ut,pt){const{lastKey:dt,lastNeedle:ft,lastIndex:_t}=ut;let mt=0;let ht=Z.length-1;if(pt===dt){if(ct===ft){It=_t!==-1&&Z[_t][$t]===ct;return _t}if(ct>=ft){mt=_t===-1?0:_t}else{ht=_t}}ut.lastKey=pt;ut.lastNeedle=ct;return ut.lastIndex=binarySearch(Z,ct,mt,ht)}function parse(Z){return typeof Z==="string"?JSON.parse(Z):Z}var FlattenMap=function(Z,ct){const ut=parse(Z);if(!("sections"in ut)){return new Ft(ut,ct)}const pt=[];const dt=[];const ft=[];const _t=[];const mt=[];recurse(ut,ct,pt,dt,ft,_t,mt,0,0,Infinity,Infinity);const ht={version:3,file:ut.file,names:_t,sources:dt,sourcesContent:ft,mappings:pt,ignoreList:mt};return presortedDecodedMap(ht)};function recurse(Z,ct,ut,pt,dt,ft,_t,mt,ht,yt,vt){const{sections:St}=Z;for(let Z=0;Z<St.length;Z++){const{map:bt,offset:xt}=St[Z];let $t=yt;let Et=vt;if(Z+1<St.length){const ct=St[Z+1].offset;$t=Math.min(yt,mt+ct.line);if($t===yt){Et=Math.min(vt,ht+ct.column)}else if($t<yt){Et=ht+ct.column}}addSection(bt,ct,ut,pt,dt,ft,_t,mt+xt.line,ht+xt.column,$t,Et)}}function addSection(Z,ct,ut,pt,dt,ft,_t,mt,ht,yt,vt){const St=parse(Z);if("sections"in St)return recurse(...arguments);const bt=new Ft(St,ct);const xt=pt.length;const At=ft.length;const kt=decodedMappings(bt);const{resolvedSources:It,sourcesContent:Nt,ignoreList:Pt}=bt;append(pt,It);append(ft,bt.names);if(Nt)append(dt,Nt);else for(let Z=0;Z<It.length;Z++)dt.push(null);if(Pt)for(let Z=0;Z<Pt.length;Z++)_t.push(Pt[Z]+xt);for(let Z=0;Z<kt.length;Z++){const ct=mt+Z;if(ct>yt)return;const pt=getLine(ut,ct);const dt=Z===0?ht:0;const ft=kt[Z];for(let Z=0;Z<ft.length;Z++){const ut=ft[Z];const _t=dt+ut[$t];if(ct===yt&&_t>=vt)return;if(ut.length===1){pt.push([_t]);continue}const mt=xt+ut[Et];const ht=ut[Ct];const St=ut[Tt];pt.push(ut.length===4?[_t,mt,ht,St]:[_t,mt,ht,St,At+ut[wt]])}}}function append(Z,ct){for(let ut=0;ut<ct.length;ut++)Z.push(ct[ut])}function getLine(Z,ct){for(let ut=Z.length;ut<=ct;ut++)Z[ut]=[];return Z[ct]}var Nt="`line` must be greater than 0 (lines start at line 1)";var Pt="`column` must be greater than or equal to 0 (columns start at column 0)";var Ot=-1;var Dt=1;var Ft=class{constructor(Z,ct){const ut=typeof Z==="string";if(!ut&&Z._decodedMemo)return Z;const pt=parse(Z);const{version:dt,file:ft,names:_t,sourceRoot:mt,sources:ht,sourcesContent:yt}=pt;this.version=dt;this.file=ft;this.names=_t||[];this.sourceRoot=mt;this.sources=ht;this.sourcesContent=yt;this.ignoreList=pt.ignoreList||pt.x_google_ignoreList||void 0;const vt=resolver(ct,mt);this.resolvedSources=ht.map(vt);const{mappings:St}=pt;if(typeof St==="string"){this._encoded=St;this._decoded=void 0}else if(Array.isArray(St)){this._encoded=void 0;this._decoded=maybeSort(St,ut)}else if(pt.sections){throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`)}else{throw new Error(`invalid source map: ${JSON.stringify(pt)}`)}this._decodedMemo=memoizedState();this._bySources=void 0;this._bySourceMemos=void 0}};function cast(Z){return Z}function encodedMappings(Z){var ct,ut;return(ut=(ct=cast(Z))._encoded)!=null?ut:ct._encoded=(0,bt.encode)(cast(Z)._decoded)}function decodedMappings(Z){var ct;return(ct=cast(Z))._decoded||(ct._decoded=(0,bt.decode)(cast(Z)._encoded))}function traceSegment(Z,ct,ut){const pt=decodedMappings(Z);if(ct>=pt.length)return null;const dt=pt[ct];const ft=traceSegmentInternal(dt,cast(Z)._decodedMemo,ct,ut,Dt);return ft===-1?null:dt[ft]}function originalPositionFor(Z,ct){let{line:ut,column:pt,bias:dt}=ct;ut--;if(ut<0)throw new Error(Nt);if(pt<0)throw new Error(Pt);const ft=decodedMappings(Z);if(ut>=ft.length)return OMapping(null,null,null,null);const _t=ft[ut];const mt=traceSegmentInternal(_t,cast(Z)._decodedMemo,ut,pt,dt||Dt);if(mt===-1)return OMapping(null,null,null,null);const ht=_t[mt];if(ht.length===1)return OMapping(null,null,null,null);const{names:yt,resolvedSources:vt}=Z;return OMapping(vt[ht[Et]],ht[Ct]+1,ht[Tt],ht.length===5?yt[ht[wt]]:null)}function generatedPositionFor(Z,ct){const{source:ut,line:pt,column:dt,bias:ft}=ct;return generatedPosition(Z,ut,pt,dt,ft||Dt,false)}function allGeneratedPositionsFor(Z,ct){const{source:ut,line:pt,column:dt,bias:ft}=ct;return generatedPosition(Z,ut,pt,dt,ft||Ot,true)}function eachMapping(Z,ct){const ut=decodedMappings(Z);const{names:pt,resolvedSources:dt}=Z;for(let Z=0;Z<ut.length;Z++){const ft=ut[Z];for(let ut=0;ut<ft.length;ut++){const _t=ft[ut];const mt=Z+1;const ht=_t[0];let yt=null;let vt=null;let St=null;let bt=null;if(_t.length!==1){yt=dt[_t[1]];vt=_t[2]+1;St=_t[3]}if(_t.length===5)bt=pt[_t[4]];ct({generatedLine:mt,generatedColumn:ht,source:yt,originalLine:vt,originalColumn:St,name:bt})}}}function sourceIndex(Z,ct){const{sources:ut,resolvedSources:pt}=Z;let dt=ut.indexOf(ct);if(dt===-1)dt=pt.indexOf(ct);return dt}function sourceContentFor(Z,ct){const{sourcesContent:ut}=Z;if(ut==null)return null;const pt=sourceIndex(Z,ct);return pt===-1?null:ut[pt]}function isIgnored(Z,ct){const{ignoreList:ut}=Z;if(ut==null)return false;const pt=sourceIndex(Z,ct);return pt===-1?false:ut.includes(pt)}function presortedDecodedMap(Z,ct){const ut=new Ft(clone(Z,[]),ct);cast(ut)._decoded=Z.mappings;return ut}function decodedMap(Z){return clone(Z,decodedMappings(Z))}function encodedMap(Z){return clone(Z,encodedMappings(Z))}function clone(Z,ct){return{version:Z.version,file:Z.file,names:Z.names,sourceRoot:Z.sourceRoot,sources:Z.sources,sourcesContent:Z.sourcesContent,mappings:ct,ignoreList:Z.ignoreList||Z.x_google_ignoreList}}function OMapping(Z,ct,ut,pt){return{source:Z,line:ct,column:ut,name:pt}}function GMapping(Z,ct){return{line:Z,column:ct}}function traceSegmentInternal(Z,ct,ut,pt,dt){let ft=memoizedBinarySearch(Z,pt,ct,ut);if(It){ft=(dt===Ot?upperBound:lowerBound)(Z,pt,ft)}else if(dt===Ot)ft++;if(ft===-1||ft===Z.length)return-1;return ft}function sliceGeneratedPositions(Z,ct,ut,pt,dt){let ft=traceSegmentInternal(Z,ct,ut,pt,Dt);if(!It&&dt===Ot)ft++;if(ft===-1||ft===Z.length)return[];const _t=It?pt:Z[ft][$t];if(!It)ft=lowerBound(Z,_t,ft);const mt=upperBound(Z,_t,ft);const ht=[];for(;ft<=mt;ft++){const ct=Z[ft];ht.push(GMapping(ct[At]+1,ct[kt]))}return ht}function generatedPosition(Z,ct,ut,pt,dt,ft){var _t,mt;ut--;if(ut<0)throw new Error(Nt);if(pt<0)throw new Error(Pt);const{sources:ht,resolvedSources:yt}=Z;let vt=ht.indexOf(ct);if(vt===-1)vt=yt.indexOf(ct);if(vt===-1)return ft?[]:GMapping(null,null);const St=(_t=cast(Z))._bySourceMemos||(_t._bySourceMemos=ht.map(memoizedState));const bt=(mt=cast(Z))._bySources||(mt._bySources=buildBySources(decodedMappings(Z),St));const xt=bt[vt][ut];if(xt==null)return ft?[]:GMapping(null,null);const $t=St[vt];if(ft)return sliceGeneratedPositions(xt,$t,ut,pt,dt);const Et=traceSegmentInternal(xt,$t,ut,pt,dt);if(Et===-1)return GMapping(null,null);const Ct=xt[Et];return GMapping(Ct[At]+1,Ct[kt])}}))},3563:(Z,ct,ut)=>{const{parse:pt,format:dt}=ut(87016);const{pathToRegexp:ft,compile:_t,parse:mt}=ut(44985);Z.exports=Layer;function Layer(Z,ct,ut,pt={}){this.opts=pt;this.name=this.opts.name||null;this.methods=[];this.paramNames=[];this.stack=Array.isArray(ut)?ut:[ut];for(const Z of ct){const ct=this.methods.push(Z.toUpperCase());if(this.methods[ct-1]==="GET")this.methods.unshift("HEAD")}for(let ut=0;ut<this.stack.length;ut++){const pt=this.stack[ut];const dt=typeof pt;if(dt!=="function")throw new Error(`${ct.toString()} \`${this.opts.name||Z}\`: \`middleware\` must be a function, not \`${dt}\``)}this.path=Z;this.regexp=ft(Z,this.paramNames,this.opts)}Layer.prototype.match=function(Z){return this.regexp.test(Z)};Layer.prototype.params=function(Z,ct,ut={}){for(let Z=ct.length,pt=0;pt<Z;pt++){if(this.paramNames[pt]){const Z=ct[pt];if(Z&&Z.length>0)ut[this.paramNames[pt].name]=Z?safeDecodeURIComponent(Z):Z}}return ut};Layer.prototype.captures=function(Z){return this.opts.ignoreCaptures?[]:Z.match(this.regexp).slice(1)};Layer.prototype.url=function(Z,ct){let ut=Z;const ft=this.path.replace(/\(\.\*\)/g,"");if(typeof Z!=="object"){ut=Array.prototype.slice.call(arguments);if(typeof ut[ut.length-1]==="object"){ct=ut[ut.length-1];ut=ut.slice(0,-1)}}const ht=_t(ft,{encode:encodeURIComponent,...ct});let yt;const vt=mt(ft);let St={};if(Array.isArray(ut)){for(let Z=vt.length,ct=0,pt=0;ct<Z;ct++){if(vt[ct].name)St[vt[ct].name]=ut[pt++]}}else if(vt.some((Z=>Z.name))){St=Z}else if(!ct){ct=Z}yt=ht(St);if(ct&&ct.query){yt=pt(yt);if(typeof ct.query==="string"){yt.search=ct.query}else{yt.search=undefined;yt.query=ct.query}return dt(yt)}return yt};Layer.prototype.param=function(Z,ct){const{stack:ut}=this;const pt=this.paramNames;const middleware=function(ut,pt){return ct.call(this,ut.params[Z],ut,pt)};middleware.param=Z;const dt=pt.map((function(Z){return Z.name}));const ft=dt.indexOf(Z);if(ft>-1){ut.some((function(Z,ct){if(!Z.param||dt.indexOf(Z.param)>ft){ut.splice(ct,0,middleware);return true}}))}return this};Layer.prototype.setPrefix=function(Z){if(this.path){this.path=this.path!=="/"||this.opts.strict===true?`${Z}${this.path}`:Z;this.paramNames=[];this.regexp=ft(this.path,this.paramNames,this.opts)}return this};function safeDecodeURIComponent(Z){try{return decodeURIComponent(Z)}catch{return Z}}},53777:(Z,ct,ut)=>{const pt=ut(77246);const dt=ut(58024);const ft=ut(93);const{pathToRegexp:_t}=ut(44985);const mt=ut(3563);const ht=ut(26675)("koa-router");Z.exports=Router;function Router(Z={}){if(!(this instanceof Router))return new Router(Z);this.opts=Z;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 yt of ft){function setMethodVerb(Z){Router.prototype[Z]=function(ct,ut,pt){if(typeof ut==="string"||ut instanceof RegExp){pt=Array.prototype.slice.call(arguments,2)}else{pt=Array.prototype.slice.call(arguments,1);ut=ct;ct=null}if(typeof ut!=="string"&&!(ut instanceof RegExp)&&(!Array.isArray(ut)||ut.length===0))throw new Error(`You have to provide a path when adding a ${Z} handler`);this.register(ut,[Z],pt,{name:ct});return this}}setMethodVerb(yt)}Router.prototype.del=Router.prototype["delete"];Router.prototype.use=function(){const Z=this;const ct=Array.prototype.slice.call(arguments);let ut;if(Array.isArray(ct[0])&&typeof ct[0][0]==="string"){const dt=ct[0];for(const ft of dt){Z.use.apply(Z,[ft].concat(ct.slice(1)))}return this}const pt=typeof ct[0]==="string";if(pt)ut=ct.shift();for(const ht of ct){if(ht.router){const yt=Object.assign(Object.create(Router.prototype),ht.router,{stack:[...ht.router.stack]});for(let vt=0;vt<yt.stack.length;vt++){const St=yt.stack[vt];const bt=Object.assign(Object.create(mt.prototype),St);if(ut)bt.setPrefix(ut);if(Z.opts.prefix)bt.setPrefix(Z.opts.prefix);Z.stack.push(bt);yt.stack[vt]=bt}if(Z.params){function setRouterParams(ct){const ut=ct;for(const ct of ut){yt.param(ct,Z.params[ct])}}setRouterParams(Object.keys(Z.params))}}else{const xt=[];_t(Z.opts.prefix||"",xt);const $t=Z.opts.prefix&&xt.length;Z.register(ut||"([^/]*)",[],ht,{end:false,ignoreCaptures:!pt&&!$t})}}return this};Router.prototype.prefix=function(Z){Z=Z.replace(/\/$/,"");this.opts.prefix=Z;for(let ct=0;ct<this.stack.length;ct++){const ut=this.stack[ct];ut.setPrefix(Z)}return this};Router.prototype.routes=Router.prototype.middleware=function(){const Z=this;const ct=function dispatch(ct,ut){ht("%s %s",ct.method,ct.path);const dt=Z.matchHost(ct.host);if(!dt){return ut()}const ft=Z.opts.routerPath||ct.newRouterPath||ct.path||ct.routerPath;const _t=Z.match(ft,ct.method);let mt;if(ct.matched){ct.matched.push.apply(ct.matched,_t.path)}else{ct.matched=_t.path}ct.router=Z;if(!_t.route)return ut();const yt=_t.pathAndMethod;const vt=yt[yt.length-1];ct._matchedRoute=vt.path;if(vt.name){ct._matchedRouteName=vt.name}mt=(Z.exclusive?[vt]:yt).reduce((function(Z,ct){Z.push((function(Z,ut){Z.captures=ct.captures(ft,Z.captures);Z.params=Z.request.params=ct.params(ft,Z.captures,Z.params);Z.routerPath=ct.path;Z.routerName=ct.name;Z._matchedRoute=ct.path;if(ct.name){Z._matchedRouteName=ct.name}return ut()}));return Z.concat(ct.stack)}),[]);return pt(mt)(ct,ut)};ct.router=this;return ct};Router.prototype.allowedMethods=function(Z={}){const ct=this.methods;return function allowedMethods(ut,pt){return pt().then((function(){const pt={};if(!ut.status||ut.status===404){for(let Z=0;Z<ut.matched.length;Z++){const ct=ut.matched[Z];for(let Z=0;Z<ct.methods.length;Z++){const ut=ct.methods[Z];pt[ut]=ut}}const ft=Object.keys(pt);if(!~ct.indexOf(ut.method)){if(Z.throw){const ct=typeof Z.notImplemented==="function"?Z.notImplemented():new dt.NotImplemented;throw ct}else{ut.status=501;ut.set("Allow",ft.join(", "))}}else if(ft.length>0){if(ut.method==="OPTIONS"){ut.status=200;ut.body="";ut.set("Allow",ft.join(", "))}else if(!pt[ut.method]){if(Z.throw){const ct=typeof Z.methodNotAllowed==="function"?Z.methodNotAllowed():new dt.MethodNotAllowed;throw ct}else{ut.status=405;ut.set("Allow",ft.join(", "))}}}}}))}};Router.prototype.all=function(Z,ct,ut){if(typeof ct==="string"){ut=Array.prototype.slice.call(arguments,2)}else{ut=Array.prototype.slice.call(arguments,1);ct=Z;Z=null}if(typeof ct!=="string"&&!(ct instanceof RegExp)&&(!Array.isArray(ct)||ct.length===0))throw new Error("You have to provide a path when adding an all handler");this.register(ct,ft,ut,{name:Z});return this};Router.prototype.redirect=function(Z,ct,ut){if(typeof Z==="symbol"||Z[0]!=="/"){Z=this.url(Z);if(Z instanceof Error)throw Z}if(typeof ct==="symbol"||ct[0]!=="/"&&!ct.includes("://")){ct=this.url(ct);if(ct instanceof Error)throw ct}return this.all(Z,(Z=>{Z.redirect(ct);Z.status=ut||301}))};Router.prototype.register=function(Z,ct,ut,pt={}){const dt=this;const{stack:ft}=this;if(Array.isArray(Z)){for(const ft of Z){dt.register.call(dt,ft,ct,ut,pt)}return this}const _t=new mt(Z,ct,ut,{end:pt.end===false?pt.end:true,name:pt.name,sensitive:pt.sensitive||this.opts.sensitive||false,strict:pt.strict||this.opts.strict||false,prefix:pt.prefix||this.opts.prefix||"",ignoreCaptures:pt.ignoreCaptures});if(this.opts.prefix){_t.setPrefix(this.opts.prefix)}for(let Z=0;Z<Object.keys(this.params).length;Z++){const ct=Object.keys(this.params)[Z];_t.param(ct,this.params[ct])}ft.push(_t);ht("defined route %s %s",_t.methods,_t.path);return _t};Router.prototype.route=function(Z){const ct=this.stack;for(let ut=ct.length,pt=0;pt<ut;pt++){if(ct[pt].name&&ct[pt].name===Z)return ct[pt]}return false};Router.prototype.url=function(Z,ct){const ut=this.route(Z);if(ut){const Z=Array.prototype.slice.call(arguments,1);return ut.url.apply(ut,Z)}return new Error(`No route found for name: ${String(Z)}`)};Router.prototype.match=function(Z,ct){const ut=this.stack;let pt;const dt={path:[],pathAndMethod:[],route:false};for(let ft=ut.length,_t=0;_t<ft;_t++){pt=ut[_t];ht("test %s %s",pt.path,pt.regexp);if(pt.match(Z)){dt.path.push(pt);if(pt.methods.length===0||~pt.methods.indexOf(ct)){dt.pathAndMethod.push(pt);if(pt.methods.length>0)dt.route=true}}}return dt};Router.prototype.matchHost=function(Z){const{host:ct}=this;if(!ct){return true}if(!Z){return false}if(typeof ct==="string"){return Z===ct}if(typeof ct==="object"&&ct instanceof RegExp){return ct.test(Z)}};Router.prototype.param=function(Z,ct){this.params[Z]=ct;for(let ut=0;ut<this.stack.length;ut++){const pt=this.stack[ut];pt.param(Z,ct)}return this};Router.url=function(Z){const ct=Array.prototype.slice.call(arguments,1);return mt.prototype.url.apply({path:Z},ct)}},88675:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Bootstrap=ct.BootstrapStarter=void 0;const pt=ut(31049);const dt=ut(16928);const ft=ut(51169);const _t=ut(5982);const mt=ut(28014);class BootstrapStarter{appDir;baseDir;globalOptions={};globalConfig;applicationContext;eventBus;configure(Z={}){this.globalOptions=Z;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 _t.ChildProcessEventBus({isWorker:true})}else if(process.env["MIDWAY_FORK_MODE"]==="thread"){this.eventBus=new _t.ThreadEventBus({isWorker:true})}}if(!this.globalOptions.moduleLoadType){const Z=await(0,pt.loadModule)((0,dt.join)(this.appDir,"package.json"),{safeLoad:true,enableCache:false});this.globalOptions.moduleLoadType=Z?.type==="module"?"esm":"commonjs"}this.applicationContext=await(0,pt.initializeGlobalApplicationContext)({loggerFactory:ft.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 Z=this.applicationContext.get(pt.MidwayApplicationManager);const ct=Z.getApplication("socketIO");(0,mt.setupWorker)(ct)}}const Z=this.applicationContext.get(pt.MidwayFrameworkService);if(!Z.getMainApp()){throw new pt.MidwayMainFrameworkMissingError}}async stop(){if(this.applicationContext){await(0,pt.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,pt.isTypeScriptEnvironment)()){return(0,dt.join)(this.appDir,"src")}else{return(0,dt.join)(this.appDir,"dist")}}}ct.BootstrapStarter=BootstrapStarter;class Bootstrap{static starter;static logger;static configured=false;static bootstrapLoggerFactory=new ft.LoggerFactory;static runningPromise=null;static configure(Z={}){this.configured=true;if(!this.logger&&!Z.logger){this.logger=this.bootstrapLoggerFactory.createLogger("bootstrap",{enableError:false,enableFile:false,enableConsole:true});if(Z.logger===false){if(this.logger["disableConsole"]){this.logger["disableConsole"]()}else{this.logger["level"]="none"}}Z.logger=this.logger}else{this.logger=this.logger||Z.logger}if(Z.appDir&&Z.appDir!==process.cwd()){process.chdir(Z.appDir)}this.getStarter().configure(Z);return this}static getStarter(){if(!this.starter){this.starter=new BootstrapStarter}return this.starter}static async run(){if(this.runningPromise){return this.runningPromise}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);this.runningPromise=this.getStarter().run().then((()=>{this.logger.info("[midway:bootstrap] current app started");global["MIDWAY_BOOTSTRAP_APP_READY"]=true;return this.getApplicationContext()})).catch((Z=>{this.logger.error(Z);process.exit(1)}));return this.runningPromise}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.runningPromise=null;this.bootstrapLoggerFactory.close()}static async onSignal(Z){this.logger.info("[midway:bootstrap] receive signal %s, closing",Z);try{await this.stop();this.logger.info("[midway:bootstrap] close done, exiting with code:0");process.exit(0)}catch(Z){this.logger.error("[midway:bootstrap] close with error: ",Z);process.exit(1)}}static onExit(Z){this.logger.info("[midway:bootstrap] exit with code:%s",Z)}static uncaughtExceptionHandler(Z){if(!(Z instanceof Error)){Z=new Error(String(Z))}if(Z.name==="Error"){Z.name="unhandledExceptionError"}this.logger.error(Z)}static unhandledRejectionHandler(Z){if(!(Z instanceof Error)){const ct=new Error(String(Z));if(Z){if(Z.name)ct.name=Z.name;if(Z.message)ct.message=Z.message;if(Z.stack)ct.stack=Z.stack}Z=ct}if(Z.name==="Error"){Z.name="unhandledRejectionError"}this.logger.error(Z)}static getApplicationContext(){return this.getStarter().getApplicationContext()}}ct.Bootstrap=Bootstrap},48797:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.setupStickyMaster=ct.AbstractForkManager=ct.ClusterManager=ct.BootstrapStarter=ct.Bootstrap=void 0;dt(ut(24846),ct);var ft=ut(88675);Object.defineProperty(ct,"Bootstrap",{enumerable:true,get:function(){return ft.Bootstrap}});Object.defineProperty(ct,"BootstrapStarter",{enumerable:true,get:function(){return ft.BootstrapStarter}});var _t=ut(84014);Object.defineProperty(ct,"ClusterManager",{enumerable:true,get:function(){return _t.ClusterManager}});var mt=ut(46776);Object.defineProperty(ct,"AbstractForkManager",{enumerable:true,get:function(){return mt.AbstractForkManager}});var ht=ut(28014);Object.defineProperty(ct,"setupStickyMaster",{enumerable:true,get:function(){return ht.setupStickyMaster}})},24846:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},46776:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.AbstractForkManager=void 0;const pt=ut(70857);const dt=ut(39023);const ft=ut(25901);const _t=ut(24434);const mt=ut(39023);const ht=(0,mt.debuglog)("midway:bootstrap");class AbstractForkManager{options;reforks=[];disconnectCount=0;unexpectedCount=0;disconnects={};hub=new _t.EventEmitter;workers=new Map;eventBus;isClosing=false;exitListener;constructor(Z){this.options=Z;Z.count=Z.count||pt.cpus().length-1;Z.refork=Z.refork!==false;Z.limit=Z.limit||60;Z.duration=Z.duration||6e4;Z.logger=Z.logger||console;Z.workerInitTimeout=Z.workerInitTimeout||3e4;this.eventBus=this.createEventBus({initTimeout:Z.workerInitTimeout})}async start(){ht("Start manager with options: %j",this.options);this.bindWorkerDisconnect((Z=>{ht(" - worker(%s): trigger event = disconnect",this.getWorkerId(Z));const ct=this.options.logger[Z["disableRefork"]?"info":"error"];this.disconnectCount++;const ut=this.isWorkerDead(Z);if(ut){ht(" - worker(%s): worker is dead",this.getWorkerId(Z));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork, because worker:%s exit event emit before disconnect",(0,ft.logDate)(),process.pid,this.getWorkerId(Z));return}if(Z["disableRefork"]){ht(" - worker(%s): worker is disableRefork(maybe terminated by master)",this.getWorkerId(Z));ct("[%s] [bootstrap:master:%s] don't fork, because worker:%s will be kill soon",(0,ft.logDate)(),process.pid,this.getWorkerId(Z));return}this.disconnects[this.getWorkerId(Z)]=(0,ft.logDate)();this.tryToRefork(Z)}));this.bindWorkerExit(((Z,ct,ut)=>{ht(" - worker(%s): trigger event = exit",this.getWorkerId(Z));this.workers.delete(this.getWorkerId(Z));if(Z["disableRefork"]){return}const pt=!!this.disconnects[this.getWorkerId(Z)];ht(" - worker(%s): isExpected=%s",this.getWorkerId(Z),pt);if(pt){delete this.disconnects[this.getWorkerId(Z)];return}ht(" - worker(%s): isWorkerDead=%s",this.getWorkerId(Z),this.isWorkerDead(Z));if(this.isWorkerDead(Z)){return}ht(" - worker(%s): unexpectedCount will add");this.unexpectedCount++;this.tryToRefork(Z);this.onUnexpected(Z,ct,ut)}));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 Z=0;Z<this.options.count;Z++){const Z=this.createWorker();ht(" - worker(%s) created",this.getWorkerId(Z));this.eventBus.addWorker(Z);this.workers.set(this.getWorkerId(Z),Z)}await this.eventBus.start()}tryToRefork(Z){if(this.allowRefork()){ht(" - worker(%s): allow refork and will fork new",this.getWorkerId(Z));const ct=this.createWorker(Z);this.workers.set(this.getWorkerId(ct),ct);this.options.logger.info("[%s] [bootstrap:master:%s] new worker:%s fork (state: %s)",(0,ft.logDate)(),process.pid,this.getWorkerId(ct),ct["state"]);this.eventBus.addWorker(ct)}else{ht(" - worker(%s): forbidden refork and will stop",this.getWorkerId(Z));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork new work (refork: %s)",(0,ft.logDate)(),process.pid,this.options.refork)}}allowRefork(){if(!this.options.refork||this.isClosing){return false}const Z=this.reforks.push(Date.now());if(Z>this.options.limit){this.reforks.shift()}const ct=this.reforks[this.reforks.length-1]-this.reforks[0];const ut=this.reforks.length<this.options.limit||ct>this.options.duration;if(!ut){this.hub.emit("reachReforkLimit")}return ut}onerror(Z){if(!Z){return}this.options.logger.error("[%s] [bootstrap:master:%s] master uncaughtException: %s",(0,ft.logDate)(),process.pid,Z.stack);this.options.logger.error(Z);this.options.logger.error("(total %d disconnect, %d unexpected exit)",this.disconnectCount,this.unexpectedCount)}onUnexpected(Z,ct,ut){const pt=Z.hasOwnProperty("exitedAfterDisconnect")?"exitedAfterDisconnect":"suicide";const _t=new Error(dt.format("worker:%s died unexpected (code: %s, signal: %s, %s: %s, state: %s)",this.getWorkerId(Z),ct,ut,pt,Z[pt],Z["state"]));_t.name="WorkerDiedUnexpectedError";this.options.logger.error("[%s] [bootstrap:master:%s] (total %d disconnect, %d unexpected exit) %s",(0,ft.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount,_t.stack)}onReachReforkLimit(){this.options.logger.error("[%s] [bootstrap:master:%s] worker died too fast (total %d disconnect, %d unexpected exit)",(0,ft.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount)}async killWorker(Z,ct){await this.closeWorker(Z);await Promise.race([(0,_t.once)(Z,"exit"),(0,ft.sleep)(ct)]);if(Z.killed)return;(Z.process||Z).kill("SIGKILL")}async stop(Z=2e3){ht("run close");this.isClosing=true;await this.eventBus.stop();for(const ct of this.workers.values()){ct["disableRefork"]=true;await this.killWorker(ct,Z)}if(this.exitListener){await this.exitListener()}}hasWorker(Z){return this.workers.has(Z)}getWorker(Z){return this.workers.get(Z)}getWorkerIds(){return Array.from(this.workers.keys())}onStop(Z){this.exitListener=Z}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(Z){if(!this.isClosing){this.options.logger.info("[bootstrap:master] receive signal %s, closing",Z);try{await this.stop();this.options.logger.info("[bootstrap:master] close done, exiting with code:0");process.exit(0)}catch(Z){this.options.logger.error("[midway:master] close with error: ",Z);process.exit(1)}}}onMasterExit(Z){this.options.logger.info("[bootstrap:master] exit with code:%s",Z)}}ct.AbstractForkManager=AbstractForkManager},84014:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ClusterManager=void 0;const pt=ut(5982);const dt=ut(46776);const ft=ut(29907);const _t=ut(39023);const mt=ut(31049);const ht=(0,_t.debuglog)("midway:bootstrap");class ClusterManager extends dt.AbstractForkManager{options;constructor(Z={}){super(Z);this.options=Z;Z.args=Z.args||[];Z.execArgv=Z.execArgv||[];if((0,mt.isTypeScriptEnvironment)()){Z.execArgv.push(...["--require","ts-node/register"])}}createWorker(){if(ft["setupPrimary"]){ft["setupPrimary"](this.options)}else if(ft["setupMaster"]){ft["setupMaster"](this.options)}return ft.fork({MIDWAY_FORK_MODE:"cluster",MIDWAY_STICKY_MODE:this.options.sticky?"true":"false",...this.options.env})}bindWorkerDisconnect(Z){ht("Bind cluster.disconnect event");ft.on("disconnect",Z)}bindWorkerExit(Z){ht("Bind cluster.exit event");ft.on("exit",Z)}getWorkerId(Z){return String(Z.process.pid)}isWorkerDead(Z){return Z.isDead()}closeWorker(Z){Z.kill("SIGTERM")}createEventBus(Z){return new pt.ChildProcessEventBus(Z)}isPrimary(){return!ft.isWorker}}ct.ClusterManager=ClusterManager},28014:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.setupStickyMaster=setupStickyMaster;ct.setupWorker=setupWorker;const pt=ut(29907);const dt=ut(76982);const randomId=()=>(0,dt.randomBytes)(8).toString("hex");function setupStickyMaster(Z,ct={}){const ut={loadBalancingMethod:"least-connection",...ct};const dt=new Map;const ft=/sid=([\w-]{20})/;let _t=0;const computeWorkerId=Z=>{const ct=ft.exec(Z);if(ct){const Z=ct[1];const ut=dt.get(Z);if(ut&&pt.workers[ut]){return ut}}switch(ut.loadBalancingMethod){case"random":{const Z=Object.keys(pt.workers);return Z[Math.floor(Math.random()*Z.length)]}case"round-robin":{const Z=Object.keys(pt.workers);_t++;if(_t>=Z.length){_t=0}return Z[_t]}case"least-connection":let Z;for(const ct in pt.workers){const ut=pt.workers[ct];if(Z===undefined){Z=ut}else{const ct=ut["clientsCount"]||0;const pt=Z["clientsCount"]||0;if(ct<pt){Z=ut}}}return Z.id}};Z.on("connection",(Z=>{let ct,ut;const sendCallback=ct=>{if(ct){Z.destroy()}};Z.on("data",(dt=>{let ft="utf-8";let _t=dt.toString(ft);if(ct&&ut){pt.workers[ct].send({type:"sticky:http-chunk",data:_t,encoding:ft,connectionId:ut},sendCallback);return}ct=computeWorkerId(_t);const mt=!(_t.startsWith("GET")||_t.substring(0,_t.indexOf("\r\n\r\n")).includes("pgrade: websocket"));if(_t.startsWith("POST")&&_t.includes("multipart/form-data")){ft="base64";_t=dt.toString("base64")}Z.pause();if(mt){ut=randomId()}pt.workers[ct].send({type:"sticky:connection",data:_t,encoding:ft,connectionId:ut},Z,{keepOpen:mt},sendCallback)}))}));Z.on("request",(Z=>{Z.on("data",(()=>{}))}));pt.on("message",((Z,{type:ct,data:pt})=>{switch(ct){case"sticky:connection":dt.set(pt,Z.id);if(ut.loadBalancingMethod==="least-connection"){Z["clientsCount"]=(Z["clientsCount"]||0)+1}break;case"sticky:disconnection":dt.delete(pt);if(ut.loadBalancingMethod==="least-connection"){Z["clientsCount"]--}break}}))}function setupWorker(Z){const ct=new Map;process.on("message",(({type:ut,data:pt,encoding:dt,connectionId:ft},_t)=>{switch(ut){case"sticky:connection":if(!_t){return}Z.httpServer.emit("connection",_t);_t.emit("data",Buffer.from(pt,dt));_t.resume();if(ft){ct.set(ft,_t);_t.on("close",(()=>{ct.delete(ft)}))}break;case"sticky:http-chunk":{const Z=ct.get(ft);if(Z){Z.emit("data",Buffer.from(pt,dt))}}}}));const ignoreError=()=>{};Z.engine.on("connection",(Z=>{process.send({type:"sticky:connection",data:Z.id},ignoreError);Z.once("close",(()=>{process.send({type:"sticky:disconnection",data:Z.id},ignoreError)}))}))}},25901:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.logDate=logDate;ct.sleep=sleep;function logDate(){const Z=new Date;let ct=Z.getDate();if(ct<10){ct="0"+ct}let ut=Z.getMonth()+1;if(ut<10){ut="0"+ut}let pt=Z.getHours();if(pt<10){pt="0"+pt}let dt=Z.getMinutes();if(dt<10){dt="0"+dt}let ft=Z.getSeconds();if(ft<10){ft="0"+ft}let _t=Z.getMilliseconds();if(_t<10){_t="00"+_t}else if(_t<100){_t="0"+_t}return Z.getFullYear()+"-"+ut+"-"+ct+" "+pt+":"+dt+":"+ft+"."+_t}async function sleep(Z){return new Promise((ct=>{setTimeout(ct,Z)}))}},96294:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.caching=caching;ct.createCache=createCache;ct.multiCaching=multiCaching;const pt=ut(71773);const dt=ut(48998);async function caching(Z,ct){if(Z==="memory"){const Z=(0,dt.memoryStore)(ct);return createCache(Z,ct)}if(typeof Z==="function"){const ut=await Z(ct);return createCache(ut,ct)}return createCache(Z,ct)}function createCache(Z,ct){return{wrap:async(ut,dt,ft)=>(0,pt.coalesceAsync)(ut,(async()=>{const _t=await Z.get(ut);if(_t===undefined){const ct=await dt();const pt=typeof ft==="function"?ft(ct):ft;await Z.set(ut,ct,pt);return ct}else if(ct?.refreshThreshold){const mt=typeof ft==="function"?ft(_t):ft;const ht=await Z.ttl(ut);if(ht!==-1&&ht<ct.refreshThreshold){(0,pt.coalesceAsync)(`+++${ut}`,dt).then((ct=>Z.set(ut,ct,mt)))}}return _t})),store:Z,del:ct=>Z.del(ct),get:ct=>Z.get(ct),set:(ct,ut,pt)=>Z.set(ct,ut,pt),reset:()=>Z.reset(),methodWrap:async(ut,dt,ft,_t)=>(0,pt.coalesceAsync)(ut,(async()=>{const mt=await Z.get(ut);if(mt===undefined){const ct=await dt(...ft);const pt=typeof _t==="function"?_t(ct):_t;await Z.set(ut,ct,pt);return ct}else if(ct?.refreshThreshold){const ht=typeof _t==="function"?_t(mt):_t;const yt=await Z.ttl(ut);if(yt!==-1&&yt<ct.refreshThreshold){(0,pt.coalesceAsync)(`+++${ut}`,(()=>dt(...ft))).then((ct=>Z.set(ut,ct,ht)))}}return mt}))}}function multiCaching(Z){const get=async ct=>{for(const ut of Z){try{const Z=await ut.get(ct);if(Z!==undefined)return Z}catch(Z){}}};const set=async(ct,ut,pt)=>{await Promise.all(Z.map((Z=>Z.set(ct,ut,pt))))};return{get:get,set:set,del:async ct=>{await Promise.all(Z.map((Z=>Z.del(ct))))},async wrap(ct,ut,pt){let dt;let ft=0;for(;ft<Z.length;ft++){try{dt=await Z[ft].get(ct);if(dt!==undefined)break}catch(Z){}}if(dt===undefined){const Z=await ut();const dt=typeof pt==="function"?pt(Z):pt;await set(ct,Z,dt);return Z}else{const _t=typeof pt==="function"?pt(dt):pt;Promise.all(Z.slice(0,ft).map((Z=>Z.set(ct,dt,_t)))).then();Z[ft].wrap(ct,ut,pt).then()}return dt},reset:async()=>{await Promise.all(Z.map((Z=>Z.reset())))},mget:async(...ct)=>{const ut=new Array(ct.length).fill(undefined);for(const pt of Z){if(ut.every((Z=>Z!==undefined)))break;try{const Z=await pt.store.mget(...ct);Z.forEach(((Z,ct)=>{if(ut[ct]===undefined&&Z!==undefined)ut[ct]=Z}))}catch(Z){}}return ut},mset:async(ct,ut)=>{await Promise.all(Z.map((Z=>Z.store.mset(ct,ut))))},mdel:async(...ct)=>{await Promise.all(Z.map((Z=>Z.store.mdel(...ct))))},methodWrap:async(ct,ut,pt,dt)=>{let ft;let _t=0;for(;_t<Z.length;_t++){try{ft=await Z[_t].get(ct);if(ft!==undefined)break}catch(Z){}}if(ft===undefined){const Z=await ut(...pt);const ft=typeof dt==="function"?dt(Z):dt;await set(ct,Z,ft);return Z}else{const mt=typeof dt==="function"?dt(ft):dt;Promise.all(Z.slice(0,_t).map((Z=>Z.set(ct,ft,mt)))).then();Z[_t].methodWrap(ct,ut,pt,dt).then()}return ft}}}},21263:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});dt(ut(96294),ct);dt(ut(48998),ct);dt(ut(85894),ct)},71773:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.coalesceAsync=coalesceAsync;const ut=new Map;async function coalesceAsync(Z,ct){if(!hasKey(Z)){addKey(Z);try{const ut=await Promise.resolve(ct());coalesce({key:Z,result:ut});return ut}catch(ct){coalesce({key:Z,error:ct});throw ct}}return enqueue(Z)}function hasKey(Z){return ut.has(Z)}function addKey(Z){ut.set(Z,[])}function removeKey(Z){ut.delete(Z)}function addCallbackToKey(Z,ct){const pt=getCallbacksByKey(Z);pt.push(ct);ut.set(Z,pt)}function getCallbacksByKey(Z){return ut.get(Z)??[]}function enqueue(Z){return new Promise(((ct,ut)=>{const pt={resolve:ct,reject:ut};addCallbackToKey(Z,pt)}))}function dequeue(Z){const ct=getCallbacksByKey(Z);removeKey(Z);return ct}function coalesce(Z){const{key:ct,error:ut,result:pt}=Z;dequeue(ct).forEach((Z=>{if(ut){Z.reject(ut)}else{Z.resolve(pt)}}))}},48998:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.memoryStore=memoryStore;const pt=ut(57223);const dt=ut(19944);function clone(Z){if(typeof Z==="object"&&Z!==null){return dt(Z)}return Z}function memoryStore(Z){const ct=Z?.shouldCloneBeforeSet!==false;const ut=Z?.isCacheable??(Z=>Z!==undefined);const dt={ttlAutopurge:true,...Z,max:Z?.max||500,ttl:Z?.ttl!==undefined?Z.ttl:0};const ft=new pt(dt);return{async del(Z){ft.delete(Z)},get:async Z=>ft.get(Z),keys:async()=>[...ft.keys()],mget:async(...Z)=>Z.map((Z=>ft.get(Z))),async mset(Z,pt){const _t={ttl:pt!==undefined?pt:dt.ttl};for(const[pt,dt]of Z){if(!ut(dt))throw new Error(`no cacheable value ${JSON.stringify(dt)}`);if(ct)ft.set(pt,clone(dt),_t);else ft.set(pt,dt,_t)}},async mdel(...Z){for(const ct of Z)ft.delete(ct)},async reset(){ft.clear()},ttl:async Z=>ft.getRemainingTTL(Z),async set(Z,pt,_t){if(!ut(pt))throw new Error(`no cacheable value ${JSON.stringify(pt)}`);if(ct)pt=clone(pt);const mt=_t!==undefined?_t:dt.ttl;ft.set(Z,pt,{ttl:mt})},get calculatedSize(){return ft.calculatedSize},get size(){return ft.size},dump:()=>ft.dump(),load:(...Z)=>ft.load(...Z)}}},85894:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},27499:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.CacheConfiguration=void 0;ct.getClassMethodDefaultCacheKey=getClassMethodDefaultCacheKey;const ft=ut(31049);const _t=ut(93310);const mt=ut(63191);function getClassMethodDefaultCacheKey(Z,ct){return Z.name+"-"+ft.DecoratorManager.getProviderUUId(Z)+"-"+ct}let ht=class CacheConfiguration{decoratorService;cacheService;async onReady(Z){this.cacheService=await Z.getAsync(mt.CachingFactory);this.decoratorService.registerMethodHandler(_t.CACHE_DECORATOR_KEY,(({target:Z,propertyName:ct,metadata:ut})=>{if(!ut.cacheKey){ut.cacheKey=getClassMethodDefaultCacheKey(Z,ct)}return{around:async Z=>{let ct=ut.cacheKey;const pt=this.cacheService.get(ut.cacheInstanceName);if(typeof ct==="function"){ct=await ct({methodArgs:Z.args,ctx:Z.target[ft.REQUEST_OBJ_CTX_KEY],target:Z.target})}if(typeof ct==="string"){return pt.methodWrap(ct,Z.proceed,Z.args,ut.ttl)}else{return Z.proceed(...Z.args)}}}}))}};ct.CacheConfiguration=ht;pt([(0,ft.Inject)(),dt("design:type",ft.MidwayDecoratorService)],ht.prototype,"decoratorService",void 0);ct.CacheConfiguration=ht=pt([(0,ft.Configuration)({namespace:"cacheManager",importConfigs:[{default:{cacheManager:{}}}]})],ht)},93310:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.CACHE_DECORATOR_KEY=void 0;ct.Caching=Caching;const pt=ut(31049);ct.CACHE_DECORATOR_KEY="cache-manager:caching";function Caching(Z,ut,dt){if(typeof ut==="number"){dt=ut;ut=undefined}return pt.DecoratorManager.createCustomMethodDecorator(ct.CACHE_DECORATOR_KEY,{cacheInstanceName:Z,cacheKey:ut,ttl:dt})}},63191:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.CachingFactory=void 0;const ft=ut(31049);const _t=ut(21263);let mt=class CachingFactory extends ft.ServiceFactory{cacheManagerConfig;applicationContext;traceService;traceMetaResolver;traceEnabled;traceInjector;async init(){await this.initClients(this.cacheManagerConfig)}async createClient(Z,ct){if(Array.isArray(Z.store)){const ut=[];for(const pt of Z.store){if(typeof pt==="string"){if(!this.has(pt)){throw new ft.MidwayCommonError(`cache instance "${pt}" not found in "${ct}", please check your configuration.`)}ut.push(this.get(pt))}else if(typeof pt==="function"){ut.push(await pt())}else if(pt["wrap"]){ut.push(pt["wrap"])}else if(typeof pt==="object"){if(typeof pt.store==="function"){pt.store=await pt.store(pt["options"]||{},this.applicationContext)}if(!pt.store){throw new ft.MidwayCommonError(`cache instance "${ct}" store is undefined, please check your configuration.`)}ut.push(await(0,_t.caching)(pt.store,pt["options"]))}else{throw new ft.MidwayCommonError("invalid cache config")}}const pt=await(0,_t.multiCaching)(ut);this.bindTraceContext(pt,ct);return pt}else{if(typeof Z.store==="function"){Z.store=await Z.store(Z["options"]||{},this.applicationContext)}if(!Z.store){throw new ft.MidwayCommonError(`cache instance "${ct}" store is undefined, please check your configuration.`)}const ut=await(0,_t.caching)(Z.store,Z["options"]);this.bindTraceContext(ut,ct);return ut}}bindTraceContext(Z,ct){if(!Z||!this.traceService){return}const wrapMethod=(Z,ut)=>{const pt=Z?.[ut];if(typeof pt!=="function"){return}Z[ut]=(...dt)=>{const ft=typeof this.traceInjector==="function"?this.traceInjector({request:dt,custom:{clientName:ct,methodName:ut}}):{};const _t=ft&&typeof ft==="object"?ft:{};return this.traceService.runWithExitSpan(`cache.${ut}`,{enable:this.traceEnabled!==false,carrier:_t,attributes:{"midway.protocol":"cache","midway.cache.client":ct,"midway.cache.method":ut},meta:this.traceMetaResolver,metaArgs:{carrier:_t,request:dt,custom:{clientName:ct,methodName:ut}}},(async()=>pt.apply(Z,dt)))}};["get","set","del","wrap","methodWrap","mget","mset","mdel","reset"].forEach((ct=>wrapMethod(Z,ct)))}getName(){return"cache-manager"}getCaching(Z){return this.get(Z)}getMultiCaching(Z){return this.get(Z)}};ct.CachingFactory=mt;pt([(0,ft.Config)("cacheManager"),dt("design:type",Object)],mt.prototype,"cacheManagerConfig",void 0);pt([(0,ft.ApplicationContext)(),dt("design:type",Object)],mt.prototype,"applicationContext",void 0);pt([(0,ft.Inject)(),dt("design:type",ft.MidwayTraceService)],mt.prototype,"traceService",void 0);pt([(0,ft.Config)("cacheManager.tracing.meta"),dt("design:type",Object)],mt.prototype,"traceMetaResolver",void 0);pt([(0,ft.Config)("cacheManager.tracing.enable"),dt("design:type",Object)],mt.prototype,"traceEnabled",void 0);pt([(0,ft.Config)("cacheManager.tracing.injector"),dt("design:type",Object)],mt.prototype,"traceInjector",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],mt.prototype,"init",null);ct.CachingFactory=mt=pt([(0,ft.Provide)(),(0,ft.Scope)(ft.ScopeEnum.Singleton)],mt)},14013:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.CacheManager=ct.getClassMethodDefaultCacheKey=ct.Configuration=void 0;var ft=ut(27499);Object.defineProperty(ct,"Configuration",{enumerable:true,get:function(){return ft.CacheConfiguration}});Object.defineProperty(ct,"getClassMethodDefaultCacheKey",{enumerable:true,get:function(){return ft.getClassMethodDefaultCacheKey}});dt(ut(58158),ct);dt(ut(63191),ct);dt(ut(93310),ct);ct.CacheManager=ut(21263);dt(ut(81268),ct)},58158:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},81268:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.createRedisStore=createRedisStore;const pt=ut(31049);const getVal=Z=>JSON.stringify(Z)||'"undefined"';function createRedisStore(Z){return async(ct,ut)=>{const{RedisServiceFactory:dt}=(0,pt.safeRequire)("@midwayjs/redis");const ft=await ut.getAsync(dt);const _t=ft.get(Z);return createStore(_t,ct)}}function createStore(Z,ct){const ut=ct?.isCacheable||(Z=>Z!==undefined&&Z!==null);const keys=ct=>Z.keys(ct);return{async get(ct){const ut=await Z.get(ct);if(ut===undefined||ut===null)return undefined;else{try{return JSON.parse(ut)}catch(Z){return ut}}},async set(dt,ft,_t){if(!ut(ft))throw new pt.MidwayCommonError(`"${ft}" is not a cacheable value`);const mt=_t===undefined?ct?.ttl:_t;if(mt!==undefined&&mt!==0)await Z.set(dt,getVal(ft),"PX",mt);else await Z.set(dt,getVal(ft))},async mset(dt,ft){const _t=ft===undefined?ct?.ttl:ft;if(_t!==undefined&&_t!==0){const ct=Z.multi();for(const[Z,ft]of dt){if(!ut(ft))throw new pt.MidwayCommonError(`"${getVal(ft)}" is not a cacheable value`);ct.set(Z,getVal(ft),"PX",_t)}await ct.exec()}else await Z.mset(dt.flatMap((([Z,ct])=>{if(!ut(ct))throw new Error(`"${getVal(ct)}" is not a cacheable value`);return[Z,getVal(ct)]})))},mget:(...ct)=>Z.mget(ct).then((Z=>Z.map((Z=>{if(Z===null||Z===undefined){return undefined}else{try{return JSON.parse(Z)}catch{return Z}}})))),async mdel(...ct){await Z.del(ct)},async del(ct){await Z.del(ct)},ttl:async ct=>Z.pttl(ct),keys:(Z="*")=>keys(Z),reset:()=>{throw new pt.MidwayCommonError("flushdb() is too dangerous, if necessary, please use redisServiceFactory.get(client) to get the instance and call it manually.")},isCacheable:ut}}},4074:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Cookie=void 0;const pt=ut(42613);const dt=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;const ft=/^(?:none|lax|strict)$/i;class Cookie{constructor(Z,ct,ut){pt(dt.test(Z),"argument name is invalid");pt(!ct||dt.test(ct),"argument value is invalid");this.name=Z;this.value=ct||"";this.attrs=mergeDefaultAttrs(ut);pt(!this.attrs.path||dt.test(this.attrs.path),"argument option path is invalid");pt(!this.attrs.domain||dt.test(this.attrs.domain),"argument option domain is invalid");pt(!this.attrs.sameSite||this.attrs.sameSite===true||ft.test(this.attrs.sameSite),"argument option sameSite is invalid");if(!ct){this.attrs.expires=new Date(0);this.attrs.maxAge=null}}toString(){return this.name+"="+this.value}toHeader(){let Z=this.toString();const ct=this.attrs;if(ct.path)Z+="; path="+ct.path;const ut=typeof ct.maxAge==="string"?parseInt(ct.maxAge,10):ct.maxAge;if(ut){Z+="; max-age="+Math.round(ut/1e3);ct.expires=new Date(Date.now()+ut)}if(ct.expires)Z+="; expires="+ct.expires.toUTCString();if(ct.domain)Z+="; domain="+ct.domain;if(ct.sameSite)Z+="; samesite="+(ct.sameSite===true?"strict":ct.sameSite.toLowerCase());if(ct.secure)Z+="; secure";if(ct.httpOnly)Z+="; httponly";if(ct.priority)Z+="; priority="+ct.priority;if(ct.partitioned)Z+="; partitioned";return Z}}ct.Cookie=Cookie;const _t=["path","expires","domain","httpOnly","secure","partitioned","maxAge","overwrite","sameSite","priority"];function mergeDefaultAttrs(Z){const ct={path:"/",httpOnly:true,secure:false,overwrite:false,sameSite:false,partitioned:false};if(!Z)return ct;for(let ut=0;ut<_t.length;ut++){const pt=_t[ut];if(pt in Z)ct[pt]=Z[pt]}return ct}},11033:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.urlSafeDecode=ct.urlSafeEncode=ct.Cookies=void 0;const pt=ut(42613);const dt=ut(4074);const ft=ut(5693);const _t=ut(86054);const mt=Symbol("midwayCookies:keysArray");const ht=Symbol("midwayCookies:keys");const yt=new Map;class Cookies{constructor(Z,ct,ut,pt){var dt;this[mt]=ct?[].concat(ct):ct;this._defaultCookieOptions=ut;this._defaultGetCookieOptions=pt;this.ctx=Z;this.secure=(dt=ut===null||ut===void 0?void 0:ut.secure)!==null&&dt!==void 0?dt:this.ctx.secure;this.app=Z.app}get keys(){if(!this[ht]){const Z=this[mt];pt(Array.isArray(Z),".keys required for encrypt/sign cookies");const ct=yt.get(Z);if(ct){this[ht]=ct}else{this[ht]=new ft.Keygrip(this[mt]);yt.set(Z,this[ht])}}return this[ht]}get(Z,ct){ct=Object.assign({},this._defaultGetCookieOptions||{},ct);const ut=computeSigned(ct);const pt=this.ctx.get("cookie");if(!pt)return;const dt=pt.match(getPattern(Z));if(!dt)return;let ft=dt[1];if(!ct.encrypt&&!ut)return ft;if(ut){const ct=Z+".sig";const ut=this.get(ct,{signed:false});if(!ut)return;const pt=Z+"="+ft;const dt=this.keys.verify(pt,ut);if(dt<0){this.set(ct,null,{path:"/",signed:false});return}if(dt>0){this.set(ct,this.keys.sign(pt),{signed:false})}return ft}ft=urlSafeDecode(ft);const _t=this.keys.decrypt(ft);if(_t===null||_t===void 0?void 0:_t.value){return _t.value.toString()}return undefined}set(Z,ct,ut){if(!ut&&typeof ct!=="string"){ut=ct;ct=""}ut=Object.assign({},this._defaultCookieOptions,ut);const pt=computeSigned(ut);ct=ct||"";if(!this.secure&&ut.secure){throw new Error("Cannot send secure cookie over unencrypted connection")}let ft=this.ctx.response.get("set-cookie")||[];if(!Array.isArray(ft))ft=[ft];if(ut.encrypt){ct=ct&&urlSafeEncode(this.keys.encrypt(ct))}if(ct.length>4093){this.app.emit("cookieLimitExceed",{name:Z,value:ct,ctx:this.ctx})}const _t=this.ctx.get("user-agent");if(ut.sameSite&&typeof ut.sameSite==="string"&&ut.sameSite.toLowerCase()==="none"){if(!this.secure||_t&&!this.isSameSiteNoneCompatible(_t)){ut.sameSite=false}}if(ut.partitioned){if(!this.secure||!_t||_t&&!this.isPartitionedCompatible(_t)){ut.partitioned=false}}if(ut.partitioned&&ut.removeUnpartitioned){const ct=ut.overwrite;if(ct){ut.overwrite=false;ft=ignoreCookiesByName(ft,Z)}const _t=Object.assign({},ut,{partitioned:false});const mt=new dt.Cookie(Z,"",_t);if(ut.secure===undefined)mt.attrs.secure=this.secure;ft=pushCookie(ft,mt);if(pt){mt.name+=".sig";ft=ignoreCookiesByName(ft,mt.name);ft=pushCookie(ft,mt)}}if(ut.priority){if(!_t||_t&&!this.isPriorityCompatible(_t)){ut.priority=undefined}}const mt=new dt.Cookie(Z,ct,ut);if(ut.secure===undefined)mt.attrs.secure=this.secure;ft=pushCookie(ft,mt);if(pt){mt.value=ct&&this.keys.sign(mt.toString());mt.name+=".sig";ft=pushCookie(ft,mt)}this.ctx.set("set-cookie",ft);return this}isSameSiteNoneCompatible(Z){const ct=this.parseChromiumAndMajorVersion(Z);if(ct.chromium&&ct.majorVersion){return ct.majorVersion>=80}return(0,_t.isSameSiteNoneCompatible)(Z)}isPartitionedCompatible(Z){const ct=this.parseChromiumAndMajorVersion(Z);if(ct.chromium&&ct.majorVersion){return ct.majorVersion>=114}return false}parseChromiumAndMajorVersion(Z){if(!this.uaParseResult){const ct=/Chrom[^ /]+\/(\d+)[.\d]* /.exec(Z);if(!ct)return{chromium:false,majorVersion:undefined};this.uaParseResult={chromium:true,majorVersion:parseInt(ct[1])}}return this.uaParseResult}isPriorityCompatible(Z){const ct=this.parseChromiumAndMajorVersion(Z);if(ct.chromium&&ct.majorVersion){return ct.majorVersion>=81}return false}}ct.Cookies=Cookies;const vt=new Map;function getPattern(Z){const ct=vt.get(Z);if(ct)return ct;const ut=new RegExp("(?:^|;) *"+Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)");vt.set(Z,ut);return ut}function computeSigned(Z){if(Z.encrypt)return false;return Z.signed!==false}function pushCookie(Z,ct){if(ct.attrs.overwrite){Z=ignoreCookiesByName(Z,ct.name)}Z.push(ct.toHeader());return Z}function ignoreCookiesByName(Z,ct){const ut=`${ct}=`;return Z.filter((Z=>!Z.startsWith(ut)))}function urlSafeEncode(Z){return Z.replace(/\+/g,"-").replace(/\//g,"_")}ct.urlSafeEncode=urlSafeEncode;function urlSafeDecode(Z){return Z.replace(/-/g,"+").replace(/_/g,"/")}ct.urlSafeDecode=urlSafeDecode},60990:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});dt(ut(33249),ct);dt(ut(11033),ct)},33249:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},5693:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Keygrip=void 0;const pt=ut(42613);const dt=ut(39023);const ft=ut(76982);const _t=ut(48978);const mt=(0,dt.debuglog)("midway:cookies");const ht={"/":"_","+":"-","=":""};class Keygrip{constructor(Z){pt(Array.isArray(Z)&&Z.length,"keys must be provided and should be an array");this.keys=Z;this.hash="sha256"}encrypt(Z,ct){ct=ct||this.keys[0];try{Z=String(Z);const ut=getAlgorithm();const pt=(0,ft.randomBytes)(64);const dt=(0,ft.randomBytes)(16);const _t=Math.floor(Math.random()*(99999-1e4+1))+1e4;const mt=deriveKeyFromPassword(ct,pt,Math.floor(_t*.47+1337));const ht=(0,ft.createCipheriv)(ut,mt,dt);const yt=Buffer.concat([ht.update(Z,"utf8"),ht.final()]);const vt=ht.getAuthTag();const St=Buffer.concat([pt,dt,vt,Buffer.from(_t.toString()),yt]).toString("hex");return getEncryptedPrefix()+St}catch(Z){mt("crypt error",Z.stack);return undefined}}decrypt(Z,ct){if(!ct){const ct=this.keys;for(let ut=0;ut<ct.length;ut++){const pt=this.decrypt(Z,ct[ut]);if(pt!==false)return{value:pt,index:ut}}return false}try{const ut=getAlgorithm();const pt=Z.split(getEncryptedPrefix());if(pt.length!==2){return void 0}else{Z=pt[1]}const dt=Buffer.from(Z,"hex");const _t=dt.slice(0,64);const mt=dt.slice(64,80);const ht=dt.slice(80,96);const yt=parseInt(dt.slice(96,101).toString("utf-8"),10);const vt=dt.slice(101);const St=deriveKeyFromPassword(ct,_t,Math.floor(yt*.47+1337));const bt=(0,ft.createDecipheriv)(ut,St,mt);bt.setAuthTag(ht);return bt.update(vt,"binary","utf-8")+bt.final("utf-8")}catch(Z){mt("crypt error",Z.stack);return false}}sign(Z,ct){ct=ct||this.keys[0];return(0,ft.createHmac)(this.hash,ct).update(Z).digest("base64").replace(/\/|\+|=/g,(Z=>ht[Z]))}verify(Z,ct){const ut=this.keys;for(let pt=0;pt<ut.length;pt++){if(_t(Buffer.from(ct),Buffer.from(this.sign(Z,ut[pt])))){mt("data %s match key %s",Z,ut[pt]);return pt}}return-1}}ct.Keygrip=Keygrip;function getAlgorithm(){return"aes-256-gcm"}function getEncryptedPrefix(){return"enc::"}function deriveKeyFromPassword(Z,ct,ut){return(0,ft.pbkdf2Sync)(Z,ct,ut,32,"sha512")}},82170:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.BaseFramework=void 0;const ft=ut(77866);const _t=ut(81680);const mt=ut(25923);const ht=ut(33569);const yt=ut(1565);const vt=ut(12692);const St=ut(7260);const bt=ut(26966);const xt=ut(45984);const $t=ut(22546);const Et=ut(8470);const Ct=ut(62724);const Tt=ut(48757);const wt=ut(39023);const At=ut(45213);const kt=ut(55319);const It=wt.debuglog("midway:debug");class BaseFramework{applicationContext;app;configurationOptions;logger;frameworkLoggerName="appLogger";defaultContext={};middlewareManager=this.createMiddlewareManager();filterManager=this.createFilterManager();guardManager=this.createGuardManager();composeMiddleware=null;bootstrapOptions;asyncContextManager;namespace;loggerService;environmentService;configService;informationService;middlewareService;mockService;constructor(Z){this.applicationContext=Z}async init(){this.configurationOptions=this.configure()??{};this.logger=this.loggerService.getLogger("coreLogger");return this}isEnable(){return true}async initialize(Z){this.bootstrapOptions=Z;await this.applicationInitialize(Z);if(!this.app.getApplicationContext){this.defineApplicationProperties()}await this.mockService.runSimulatorAppSetup(this.app)}getApplicationContext(){return this.applicationContext}getConfiguration(Z){return this.configService.getConfiguration(Z)}getCurrentEnvironment(){return this.environmentService.getCurrentEnvironment()}getApplication(){return this.app}createContextLogger(Z,ct){if(ct&&ct!==this.frameworkLoggerName){const ut=this.getLogger(ct);let pt=Z.getAttr(_t.REQUEST_CTX_LOGGER_CACHE_KEY);if(!pt){pt=new Map;Z.setAttr(_t.REQUEST_CTX_LOGGER_CACHE_KEY,pt)}if(pt.has(ct)){return pt.get(ct)}const dt=this.loggerService.createContextLogger(Z,ut);pt.set(ct,dt);return dt}else{if(Z["_logger"]){return Z["_logger"]}const ut=this.getLogger(ct);Z["_logger"]=this.loggerService.createContextLogger(Z,ut);return Z["_logger"]}}async stop(){await this.mockService.runSimulatorAppTearDown(this.app);await this.beforeStop()}getAppDir(){return this.informationService.getAppDir()}getBaseDir(){return this.informationService.getBaseDir()}defineApplicationProperties(Z={},ct=[]){const ut={getBaseDir:()=>this.getBaseDir(),getAppDir:()=>this.getAppDir(),getEnv:()=>this.getCurrentEnvironment(),getApplicationContext:()=>this.getApplicationContext(),getConfig:Z=>this.getConfiguration(Z),getProcessType:()=>ft.MidwayProcessTypeEnum.APPLICATION,getCoreLogger:()=>this.getCoreLogger(),getLogger:Z=>this.getLogger(Z),createLogger:(Z,ct={})=>this.createLogger(Z,ct),getFramework:()=>this,getProjectName:()=>this.getProjectName(),createAnonymousContext:Z=>{const ct=Z||Object.create(this.defaultContext);if(!ct.startTime){ct.startTime=Date.now()}if(!ct.logger){ct.logger=this.createContextLogger(ct)}if(!ct.requestContext){ct.requestContext=new ht.MidwayRequestContainer(ct,this.getApplicationContext())}if(!ct.getLogger){ct.getLogger=Z=>this.createContextLogger(ct,Z)}ct.setAttr=(Z,ut)=>{ct.requestContext.setAttr(Z,ut)};ct.getAttr=Z=>ct.requestContext.getAttr(Z);ct.getApp=()=>this.getApplication();if(!Object.getOwnPropertyDescriptor(ct,"traceId")){Object.defineProperty(ct,"traceId",{get:()=>{try{return this.getApplicationContext().get(Tt.MidwayTraceService).getTraceId()}catch{return undefined}},enumerable:true,configurable:true})}return ct},addConfigObject:Z=>{this.configService.addObject(Z)},setAttr:(Z,ct)=>{this.getApplicationContext().setAttr(Z,ct)},getAttr:Z=>this.getApplicationContext().getAttr(Z),useMiddleware:Z=>this.useMiddleware(Z),getMiddleware:()=>this.getMiddleware(),useFilter:Z=>this.useFilter(Z),useGuard:Z=>this.useGuard(Z),getNamespace:()=>this.getNamespace()};for(const Z of ct){delete ut[Z]}Object.assign(this.app,ut,Z)}async beforeStop(){}async applyMiddleware(Z){if(!this.composeMiddleware){if(!this.applicationContext.hasObject(_t.ASYNC_CONTEXT_MANAGER_KEY)){const Z=this.configService.getConfiguration("asyncContextManager.enable")||false;const ct=Z?this.bootstrapOptions?.asyncContextManager||new At.NoopContextManager:new At.NoopContextManager;if(Z){ct.enable()}this.applicationContext.registerObject(_t.ASYNC_CONTEXT_MANAGER_KEY,ct)}this.middlewareManager.insertFirst((async(Z,ct)=>{const ut=At.ASYNC_ROOT_CONTEXT.setValue(_t.ASYNC_CONTEXT_KEY,Z);const pt=this.applicationContext.get(_t.ASYNC_CONTEXT_MANAGER_KEY);return await pt.with(ut,(async()=>{await this.mockService.runSimulatorContextSetup(Z,this.app);this.mockService.applyContextMocks(this.app,Z);let ut;try{const pt=await ct();ut=await this.filterManager.runResultFilter(pt,Z)}catch(ct){ut=await this.filterManager.runErrorFilter(ct,Z)}finally{await this.mockService.runSimulatorContextTearDown(Z,this.app)}if(ut.error){throw ut.error}return ut.result}))}));It(`[core]: Compose middleware = [${this.middlewareManager.getNames()}]`);this.composeMiddleware=await this.middlewareService.compose(this.middlewareManager,this.app);await this.filterManager.init(this.applicationContext)}if(Z){Z=Array.isArray(Z)?Z:[Z];return await this.middlewareService.compose([this.composeMiddleware,...Z],this.app)}return this.composeMiddleware}getLogger(Z){return this.loggerService.getLogger(Z??this.frameworkLoggerName)}getCoreLogger(){return this.logger}createLogger(Z,ct={}){return this.loggerService.createLogger(Z,ct)}getProjectName(){return this.informationService.getProjectName()}getFrameworkName(){return this.constructor.name}useMiddleware(Z){this.middlewareManager.insertLast(Z)}getMiddleware(){return this.middlewareManager}useFilter(Z){return this.filterManager.useFilter(Z)}useGuard(Z){return this.guardManager.addGlobalGuard(Z)}async runGuard(Z,ct,ut){return this.guardManager.runGuard(Z,ct,ut)}createMiddlewareManager(){return new xt.ContextMiddlewareManager}createFilterManager(){return new Et.FilterManager}createGuardManager(){return new kt.GuardManager}setNamespace(Z){this.namespace=Z}getNamespace(){return this.namespace}setFrameworkLoggerName(Z){this.frameworkLoggerName=Z}}ct.BaseFramework=BaseFramework;pt([(0,mt.Inject)(),dt("design:type",bt.MidwayLoggerService)],BaseFramework.prototype,"loggerService",void 0);pt([(0,mt.Inject)(),dt("design:type",yt.MidwayEnvironmentService)],BaseFramework.prototype,"environmentService",void 0);pt([(0,mt.Inject)(),dt("design:type",vt.MidwayConfigService)],BaseFramework.prototype,"configService",void 0);pt([(0,mt.Inject)(),dt("design:type",St.MidwayInformationService)],BaseFramework.prototype,"informationService",void 0);pt([(0,mt.Inject)(),dt("design:type",$t.MidwayMiddlewareService)],BaseFramework.prototype,"middlewareService",void 0);pt([(0,mt.Inject)(),dt("design:type",Ct.MidwayMockService)],BaseFramework.prototype,"mockService",void 0);pt([(0,mt.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],BaseFramework.prototype,"init",null)},89746:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayApplicationManager=void 0;const dt=ut(77866);const ft=ut(25923);let _t=class MidwayApplicationManager{globalFrameworkMap=new Map;addFramework(Z,ct){this.globalFrameworkMap.set(Z,ct)}hasFramework(Z){return this.globalFrameworkMap.has(Z)}getFramework(Z){if(this.globalFrameworkMap.has(Z)){return this.globalFrameworkMap.get(Z)}}getApplication(Z){if(this.globalFrameworkMap.has(Z)){return this.globalFrameworkMap.get(Z).getApplication()}}getApplications(Z){if(!Z){return Array.from(this.globalFrameworkMap.values()).map((Z=>Z.getApplication())).filter((Z=>!!Z))}else{return Z.map((Z=>this.getApplication(Z))).filter((Z=>!!Z))}}};ct.MidwayApplicationManager=_t;ct.MidwayApplicationManager=_t=pt([(0,ft.Provide)(),(0,ft.Scope)(dt.ScopeEnum.Singleton)],_t)},45213:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.AsyncLocalStorageContextManager=ct.NoopContextManager=ct.ASYNC_ROOT_CONTEXT=void 0;const pt=ut(90290);class AsyncBaseContext{_currentContext;constructor(Z){const ct=this;ct._currentContext=Z?new Map(Z):new Map;ct.getValue=Z=>ct._currentContext.get(Z);ct.setValue=(Z,ut)=>{const pt=new AsyncBaseContext(ct._currentContext);pt._currentContext.set(Z,ut);return pt};ct.deleteValue=Z=>{const ut=new AsyncBaseContext(ct._currentContext);ut._currentContext.delete(Z);return ut}}getValue;setValue;deleteValue}ct.ASYNC_ROOT_CONTEXT=new AsyncBaseContext;class NoopContextManager{active(){return ct.ASYNC_ROOT_CONTEXT}with(Z,ct,ut,...pt){return ct.call(ut,...pt)}bind(Z,ct){return ct}enable(){return this}disable(){return this}}ct.NoopContextManager=NoopContextManager;class AsyncLocalStorageContextManager{_asyncLocalStorage;constructor(){this._asyncLocalStorage=new pt.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??ct.ASYNC_ROOT_CONTEXT}with(Z,ct,ut,...pt){const dt=ut==null?ct:ct.bind(ut);return this._asyncLocalStorage.run(Z,dt,...pt)}enable(){return this}disable(){this._asyncLocalStorage.disable();return this}bind(Z,ct){if(typeof ct==="function"){const ut=this;const contextWrapper=function(...pt){return ut.with(Z,(()=>ct.apply(this,pt)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:ct.length});return contextWrapper}return ct}}ct.AsyncLocalStorageContextManager=AsyncLocalStorageContextManager},98771:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.DataListener=void 0;const ft=ut(25923);class DataListener{innerData;isReady=false;async init(){if(!this.isReady){this.innerData=await this.initData();await this.onData(this.setData.bind(this));this.isReady=true}}setData(Z){this.innerData=Z}getData(){return this.transformData(this.innerData)}transformData(Z){return Z}async stop(){await this.destroyListener()}async destroyListener(){}}ct.DataListener=DataListener;pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],DataListener.prototype,"init",null);pt([(0,ft.Destroy)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],DataListener.prototype,"stop",null)},59679:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.DataSourceManager=void 0;const ft=ut(5904);const _t=ut(28068);const mt=ut(62525);const ht=ut(16928);const yt=ut(35175);const vt=ut(81680);const St=ut(39023);const bt=ut(53386);const xt=ut(25923);const $t=ut(1565);const Et=ut(53656);const Ct=(0,St.debuglog)("midway:debug");class DataSourceManager{dataSource=new Map;options={};modelMapping=new WeakMap;innerDefaultDataSourceName;dataSourcePriority={};creatingDataSources=new Map;baseDir;environmentService;priorityManager;async initDataSource(Z,ct){this.options=Z;if(!this.options.dataSource){throw new _t.MidwayParameterError("[DataSourceManager] must set options.dataSource.")}if(typeof ct==="string"){ct={baseDir:ct,entitiesConfigKey:"entities",concurrent:false}}const{baseDir:ut=this.baseDir,entitiesConfigKey:pt="entities",concurrent:dt}=ct;const processDataSource=async(ct,ft)=>{const _t=ft[pt];if(_t){const Z=new Set;const processEntity=async pt=>{if(typeof pt==="string"){const dt=await DataSourceManager.globModels(pt,ut,this.environmentService?.getModuleLoadType());for(const ut of dt){Z.add(ut);this.modelMapping.set(ut,ct)}}else{Z.add(pt);this.modelMapping.set(pt,ct)}};if(dt){await Promise.all(_t.map(processEntity))}else{for(const Z of _t){await processEntity(Z)}}ft[pt]=Array.from(Z);Ct(`[core]: DataManager load ${ft[pt].length} models from ${ct}.`)}const mt={cacheInstance:Z.cacheInstance,validateConnection:Z.validateConnection};return this.createInstance(ft,ct,mt)};const ft=Object.entries(Z.dataSource);if(dt){await Promise.all(ft.map((([Z,ct])=>processDataSource(Z,ct))))}else{for(const[Z,ct]of ft){await processDataSource(Z,ct)}}}getDataSource(Z){return this.dataSource.get(Z)}hasDataSource(Z){return this.dataSource.has(Z)}getDataSourceNames(){return Array.from(this.dataSource.keys())}getAllDataSources(){return this.dataSource}async isConnected(Z){const ct=this.getDataSource(Z);return ct?this.checkConnected(ct):false}async createInstance(Z,ct,ut){if(ct&&typeof ct!=="string"){ut=ct;ct=undefined}if(ct&&ut&&ut.cacheInstance===false){ct=undefined}if(ct){if(this.dataSource.has(ct)){return this.dataSource.get(ct)}if(this.creatingDataSources.has(ct)){return this.creatingDataSources.get(ct)}}const pt=Z.validateConnection??(ut&&ut.validateConnection)??false;const dt=(0,ft.extend)(true,{},this.options["default"],Z);const mt=this.createDataSource(dt,ct);if(mt&&yt.Types.isPromise(mt)){if(ct){this.creatingDataSources.set(ct,mt)}return mt.then((async Z=>{if(ct){this.dataSource.set(ct,Z)}if(pt){if(!Z){throw new _t.MidwayCommonError(`[DataSourceManager] ${ct} initialization failed.`)}const ut=await this.checkConnected(Z);if(!ut){throw new _t.MidwayCommonError(`[DataSourceManager] ${ct} is not connected.`)}}return Z})).finally((()=>{if(ct){this.creatingDataSources.delete(ct)}}))}if(ct){this.dataSource.set(ct,mt)}return mt}getDataSourceNameByModel(Z){return this.modelMapping.get(Z)}async stop(){const Z=Array.from(this.dataSource.values());await Promise.all(Z.map((Z=>this.destroyDataSource(Z))));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(Z){return this.priorityManager.getPriority(this.dataSourcePriority[Z])}isHighPriority(Z){return this.priorityManager.isHighPriority(this.dataSourcePriority[Z])}isMediumPriority(Z){return this.priorityManager.isMediumPriority(this.dataSourcePriority[Z])}isLowPriority(Z){return this.priorityManager.isLowPriority(this.dataSourcePriority[Z])}static formatGlobString(Z){let ct;if(!/^\*/.test(Z)){Z="/"+Z}const ut=(0,ht.parse)(Z);if(ut.base&&(/\*/.test(ut.base)||ut.ext)){ct=[Z]}else{ct=[...vt.DEFAULT_PATTERN.map((ct=>(0,ht.join)(Z,ct)))]}return ct}static async globModels(Z,ct,ut){const pt=this.formatGlobString(Z);const dt=[];const ft=(0,mt.run)(pt,{cwd:ct,ignore:vt.IGNORE_PATTERN});for(const Z of ft){const ct=await(0,bt.loadModule)(Z,{loadMode:ut});if(yt.Types.isClass(ct)){dt.push(ct)}else{for(const Z in ct){const ut=ct[Z];if(yt.Types.isClass(ut)){dt.push(ut)}}}}return dt}}ct.DataSourceManager=DataSourceManager;pt([(0,xt.Inject)(),dt("design:type",String)],DataSourceManager.prototype,"baseDir",void 0);pt([(0,xt.Inject)(),dt("design:type",$t.MidwayEnvironmentService)],DataSourceManager.prototype,"environmentService",void 0);pt([(0,xt.Inject)(),dt("design:type",Et.MidwayPriorityManager)],DataSourceManager.prototype,"priorityManager",void 0)},19835:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.CustomModuleDetector=ct.ESModuleFileDetector=ct.CommonJSFileDetector=ct.AbstractFileDetector=void 0;const pt=ut(35175);const dt=ut(62525);const ft=ut(28068);const _t=ut(81680);const mt=ut(53386);const ht=ut(25923);const yt=ut(39023);const vt=ut(16928);const St=(0,yt.debuglog)("midway:debug");class AbstractFileDetector{options;constructor(Z){this.options=Z}}ct.AbstractFileDetector=AbstractFileDetector;const bt=["**/**.tsx"].concat(_t.DEFAULT_PATTERN);const xt=["**/logs/**","**/run/**","**/public/**","**/app/view/**","**/app/views/**","**/app/extend/**","**/node_modules/**","**/**.test.ts","**/**.test.js","**/__test__/**"].concat(_t.IGNORE_PATTERN);class CommonJSFileDetector extends AbstractFileDetector{duplicateModuleCheckSet=new Map;async run(Z,ct){if(this.getType()==="commonjs"){return this.loadSync(Z,ct)}else{return this.loadAsync(Z,ct)}}loadSync(Z,ct){this.options=this.options||{};const ut=[].concat(this.options.loadDir??Z.get("baseDir"));for(const _t of ut){const ut=(0,dt.run)(bt.concat(this.options.pattern||[]),{cwd:_t,ignore:xt.concat(this.options.ignore||[])});St(`[core]: load file from ${_t}, files: ${ut}`);const checkDuplicatedHandler=(Z,ct)=>{if(this.options.conflictCheck&&pt.Types.isClass(Z)){const ut=ht.DecoratorManager.getProviderName(Z);if(ut){if(this.duplicateModuleCheckSet.has(ut)){throw new ft.MidwayDuplicateClassNameError(ut,ct.srcPath,this.duplicateModuleCheckSet.get(ut))}else{this.duplicateModuleCheckSet.set(ut,ct.srcPath)}}}};for(const pt of ut){const ut=require(pt);Z.bindClass(ut,{namespace:ct,srcPath:pt,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}async loadAsync(Z,ct){this.options=this.options||{};const ut=Z.hasObject(_t.MODULE_LOADER_KEY)?Z.getObject(_t.MODULE_LOADER_KEY):mt.loadModule;const yt=[].concat(this.options.loadDir??Z.get("baseDir"));let $t;const Et=process.env.MIDWAY_HMR_IMPORT_QUERY==="1";const Ct=process.env.MIDWAY_HMR_IMPORT_QUERY_FILE;if(typeof this.options.importQuery==="function"){$t=this.options.importQuery()}else if(typeof this.options.importQuery==="string"){$t=this.options.importQuery}else if(this.options.importQuery){$t=`${Date.now()}_${Math.random()}`}else if(Et&&!Ct){$t=`${Date.now()}_${Math.random()}`}for(const _t of yt){const mt=(0,dt.run)(bt.concat(this.options.pattern||[]),{cwd:_t,ignore:xt.concat(this.options.ignore||[])});St(`[core]: load file from ${_t}, files: ${mt}`);const checkDuplicatedHandler=(Z,ct)=>{if(this.options.conflictCheck&&pt.Types.isClass(Z)){const ut=ht.DecoratorManager.getProviderName(Z);if(ut){if(this.duplicateModuleCheckSet.has(ut)){throw new ft.MidwayDuplicateClassNameError(ut,ct.srcPath,this.duplicateModuleCheckSet.get(ut))}else{this.duplicateModuleCheckSet.set(ut,ct.srcPath)}}}};for(const pt of mt){let dt=$t;if(!this.options.importQuery&&Et&&Ct){dt=(0,vt.resolve)(pt)===(0,vt.resolve)(Ct)?`${Date.now()}_${Math.random()}`:undefined}const ft=await ut(pt,{loadMode:"esm",importQuery:dt});Z.bindClass(ft,{namespace:ct,srcPath:pt,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}getType(){return"commonjs"}runSync(Z,ct){if(this.getType()==="commonjs"){return this.loadSync(Z,ct)}}}ct.CommonJSFileDetector=CommonJSFileDetector;class ESModuleFileDetector extends CommonJSFileDetector{getType(){return"module"}}ct.ESModuleFileDetector=ESModuleFileDetector;class CustomModuleDetector extends AbstractFileDetector{async run(Z){this.runSync(Z,this.options.namespace)}runSync(Z,ct){for(const ct of this.options.modules){Z.bindClass(ct,{namespace:this.options.namespace,createFrom:"module"})}}}ct.CustomModuleDetector=CustomModuleDetector},8470:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.FilterManager=void 0;const pt=ut(25923);const dt=ut(53386);const ft=ut(88067);class FilterManager{errFilterList=[];successFilterList=[];exceptionMap=new WeakMap;defaultErrFilter=undefined;matchFnList=[];protoMatchList=[];useFilter(Z){if(!Array.isArray(Z)){Z=[Z]}for(const ct of Z){if(ft.MetadataManager.getOwnMetadata(pt.CATCH_KEY,ct)){this.errFilterList.push(ct)}if(ft.MetadataManager.getOwnMetadata(pt.MATCH_KEY,ct)){this.successFilterList.push(ct)}}}async init(Z){for(const ct of this.errFilterList){const ut=await Z.getAsync(ct);const dt=ft.MetadataManager.getOwnMetadata(pt.CATCH_KEY,ct);if(dt&&dt.catchTargets){dt.catchOptions=dt.catchOptions||{};for(const Z of dt.catchTargets){this.exceptionMap.set(Z,{filter:ut,catchOptions:dt.catchOptions});if(dt.catchOptions["matchPrototype"]){this.protoMatchList.push((ct=>{if(ct instanceof Z){return Z}else{return false}}))}}}else{this.defaultErrFilter=ut}}for(const ct of this.successFilterList){const ut=await Z.getAsync(ct);const _t=ft.MetadataManager.getOwnMetadata(pt.MATCH_KEY,ct);if(_t&&_t.matchPattern){this.matchFnList.push({matchFn:(0,dt.toPathMatch)(_t.matchPattern),target:ut})}}}async runErrorFilter(Z,ct,ut,pt){let dt,ft;let _t=false;if(this.exceptionMap.has(Z.constructor)){_t=true;const ft=this.exceptionMap.get(Z.constructor);dt=await ft.filter.catch(Z,ct,ut,pt)}if(!_t&&this.protoMatchList.length){let ft;for(const ct of this.protoMatchList){ft=ct(Z);if(ft){break}}if(ft){_t=true;const mt=this.exceptionMap.get(ft);dt=await mt.filter.catch(Z,ct,ut,pt)}}if(!_t&&this.defaultErrFilter){_t=true;dt=await this.defaultErrFilter.catch(Z,ct,ut,pt)}if(!_t){ft=Z}return{result:dt,error:ft}}async runResultFilter(Z,ct,ut,pt){let dt=Z;for(const Z of this.matchFnList){if(Z.matchFn(ct,ut)){dt=await Z.target.match(dt,ct,ut,pt)}}return{result:dt,error:undefined}}}ct.FilterManager=FilterManager},55319:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.GuardManager=void 0;const pt=ut(25923);const dt=ut(88067);class GuardManager extends Array{addGlobalGuard(Z){if(!Array.isArray(Z)){this.push(Z)}else{this.push(...Z)}}async runGuard(Z,ct,ut){for(const pt of this){const dt=await Z.requestContext.getAsync(pt);const ft=await dt.canActivate(Z,ct,ut);if(!ft){return false}}const ft=dt.MetadataManager.getOwnMetadata(pt.GUARD_KEY,ct);if(ft){for(const pt of ft){const dt=await Z.requestContext.getAsync(pt);const ft=await dt.canActivate(Z,ct,ut);if(!ft){return false}}}const _t=dt.MetadataManager.getOwnMetadata(pt.GUARD_KEY,ct,ut);if(_t){for(const pt of _t){const dt=await Z.requestContext.getAsync(pt);const ft=await dt.canActivate(Z,ct,ut);if(!ft){return false}}}return true}}ct.GuardManager=GuardManager},47369:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.DefaultConsoleLoggerFactory=ct.LoggerFactory=void 0;class LoggerFactory{}ct.LoggerFactory=LoggerFactory;class DefaultConsoleLoggerFactory{instance=new Map;createLogger(Z,ct){this.instance.set(Z,console);return console}getLogger(Z){return this.instance.get(Z)}close(Z){}removeLogger(Z){}getDefaultMidwayLoggerConfig(){return{midwayLogger:{default:{},clients:{coreLogger:{},appLogger:{}}}}}createContextLogger(Z,ct,ut){return ct}getClients(){return this.instance}getClientKeys(){return Array.from(this.instance.keys())}}ct.DefaultConsoleLoggerFactory=DefaultConsoleLoggerFactory},45984:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ContextMiddlewareManager=void 0;ct.createMiddleware=createMiddleware;class ContextMiddlewareManager extends Array{insertFirst(Z){if(Array.isArray(Z)){this.unshift(...Z)}else{this.unshift(Z)}}insertLast(Z){if(Array.isArray(Z)){this.push(...Z)}else{this.push(Z)}}insertBefore(Z,ct){if(typeof ct!=="number"){ct=this.findItemIndex(ct)}if(Array.isArray(Z)){this.splice(ct,0,...Z)}else{this.splice(ct,0,Z)}}insertAfter(Z,ct){if(typeof ct!=="number"){ct=this.findItemIndex(ct)}if(Array.isArray(Z)){this.splice(ct+1,0,...Z)}else{this.splice(ct+1,0,Z)}}findAndInsertAfter(Z,ct){Z=this.findItem(Z);ct=this.findItem(ct);if(!Z||!ct||Z===ct){return}if(ct){const ut=this.remove(Z);if(ut){this.insertAfter(ut,ct)}}}findAndInsertBefore(Z,ct){Z=this.findItem(Z);ct=this.findItem(ct);if(!Z||!ct||Z===ct){return}if(ct){const ut=this.remove(Z);if(ut){this.insertBefore(ut,ct)}}}findAndInsertFirst(Z){const ct=this.remove(Z);if(ct){this.insertFirst(ct)}}findAndInsertLast(Z){const ct=this.remove(Z);if(ct){this.insertLast(ct)}}findItemIndex(Z){if(typeof Z==="number"){return Z}else if(typeof Z==="string"){return this.findIndex((ct=>this.getMiddlewareName(ct)===Z))}else{return this.findIndex((ct=>ct===Z))}}findItem(Z){if(typeof Z==="number"){if(Z>=0&&Z<=this.length-1){return this[Z]}}else if(typeof Z==="string"){return this.find((ct=>this.getMiddlewareName(ct)===Z))}else{return Z}}getMiddlewareName(Z){if(Z["middleware"]){return Z.name??this.getMiddlewareName(Z["middleware"])}return(Z.getName&&Z.getName())??Z._name??Z.name}remove(Z){if(typeof Z==="number"&&Z!==-1){return this.splice(Z,1)[0]}else{const ct=this.findItemIndex(Z);if(ct!==-1){return this.splice(ct,1)[0]}}}push(...Z){Z.forEach((Z=>{if(typeof Z!=="string"&&!this.getMiddlewareName(Z)){Z._name="anonymous"}}));return super.push(...Z)}unshift(...Z){Z.forEach((Z=>{if(typeof Z!=="string"&&!this.getMiddlewareName(Z)){Z._name="anonymous"}}));return super.unshift(...Z)}getNames(){return this.map((Z=>this.getMiddlewareName(Z)))}}ct.ContextMiddlewareManager=ContextMiddlewareManager;function createMiddleware(Z,ct,ut){return{middleware:Z,options:ct,name:ut}}},11386:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayInitializerPerformanceManager=ct.MidwayPerformanceManager=void 0;const pt=ut(82987);class MidwayPerformanceManager{group;static instances=new Map;static DEFAULT_GROUP={INITIALIZE:"MidwayInitialize"};observer=null;marks=new Set;measures=new Set;constructor(Z){this.group=Z}static getInstance(Z){if(!this.instances.has(Z)){this.instances.set(Z,new MidwayPerformanceManager(Z))}return this.instances.get(Z)}formatKey(Z,ct){return`${this.group}:${Z}-${ct}`}markStart(Z){const ct=this.formatKey(Z,"start");pt.performance.mark(ct);this.marks.add(ct)}markEnd(Z){const ct=this.formatKey(Z,"start");const ut=this.formatKey(Z,"end");const dt=`${this.group}:${Z}`;pt.performance.mark(ut);this.marks.add(ut);pt.performance.measure(dt,ct,ut);this.measures.add(dt)}observeMeasure(Z){if(this.observer){return}this.observer=new pt.PerformanceObserver((ct=>{const ut=ct.getEntries().filter((Z=>Z.name.startsWith(`${this.group}:`)));if(ut.length>0){Z({getEntries:()=>ut})}}));this.observer.observe({entryTypes:["measure"]});return this.observer}disconnect(){if(this.observer){this.observer.disconnect();this.observer=null}}clean(){this.marks.forEach((Z=>{try{pt.performance.clearMarks(Z)}catch(ct){console.warn(`Failed to clear mark ${Z}: ${ct}`)}}));this.marks.clear();this.measures.forEach((Z=>{try{pt.performance.clearMeasures(Z)}catch(ct){console.warn(`Failed to clear measure ${Z}: ${ct}`)}}));this.measures.clear();this.disconnect()}static cleanAll(){this.instances.forEach((Z=>Z.clean()));this.instances.clear()}static getInitialPerformanceEntries(){const Z=[];pt.performance?.getEntries().forEach((ct=>{if(ct.name.startsWith(this.DEFAULT_GROUP.INITIALIZE)){Z.push(ct.toJSON())}}));return Z}}ct.MidwayPerformanceManager=MidwayPerformanceManager;class MidwayInitializerPerformanceManager{static 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"};static markStart(Z){const ct=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);ct.markStart(Z)}static markEnd(Z){const ct=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);ct.markEnd(Z)}static frameworkInitializeStart(Z){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${Z}`)}static frameworkInitializeEnd(Z){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${Z}`)}static frameworkRunStart(Z){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${Z}`)}static frameworkRunEnd(Z){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${Z}`)}static lifecycleStart(Z,ct){this.markStart(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${Z}:${ct}`)}static lifecycleEnd(Z,ct){this.markEnd(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${Z}:${ct}`)}}ct.MidwayInitializerPerformanceManager=MidwayInitializerPerformanceManager},53656:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayPriorityManager=ct.DEFAULT_PRIORITY=void 0;const dt=ut(25923);const ft=ut(77866);ct.DEFAULT_PRIORITY={L1:"High",L2:"Medium",L3:"Low"};let _t=class MidwayPriorityManager{priorityList=ct.DEFAULT_PRIORITY;defaultPriority=ct.DEFAULT_PRIORITY.L2;getCurrentPriorityList(){return this.priorityList}getDefaultPriority(){return this.defaultPriority}isHighPriority(Z=ct.DEFAULT_PRIORITY.L2){return Z===ct.DEFAULT_PRIORITY.L1}isMediumPriority(Z=ct.DEFAULT_PRIORITY.L2){return Z===ct.DEFAULT_PRIORITY.L2}isLowPriority(Z=ct.DEFAULT_PRIORITY.L2){return Z===ct.DEFAULT_PRIORITY.L3}getPriority(Z){return Z||this.getDefaultPriority()}};ct.MidwayPriorityManager=_t;ct.MidwayPriorityManager=_t=pt([(0,dt.Provide)(),(0,dt.Scope)(ft.ScopeEnum.Singleton)],_t)},3145:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.LoadBalancerFactory=ct.RoundRobinLoadBalancer=ct.RandomLoadBalance=void 0;const pt=ut(77866);class RandomLoadBalance{select(Z){if(!Z.length){throw new Error("No available instances")}const ct=Math.floor(Math.random()*Z.length);return Z[ct]}}ct.RandomLoadBalance=RandomLoadBalance;class RoundRobinLoadBalancer{currentIndex=0;select(Z){if(!Z.length){throw new Error("No available instances")}const ct=Z[this.currentIndex];this.currentIndex=(this.currentIndex+1)%Z.length;return ct}}ct.RoundRobinLoadBalancer=RoundRobinLoadBalancer;class LoadBalancerFactory{static create(Z){switch(Z){case pt.LoadBalancerType.RANDOM:return new RandomLoadBalance;case pt.LoadBalancerType.ROUND_ROBIN:return new RoundRobinLoadBalancer;default:throw new Error(`Unsupported load balancer type: ${Z}`)}}}ct.LoadBalancerFactory=LoadBalancerFactory},81248:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.ServiceDiscovery=ct.ServiceDiscoveryClient=void 0;const ft=ut(25923);const _t=ut(3145);const mt=ut(77866);const ht=ut(27192);const yt=ut(5904);class ServiceDiscoveryClient{options;instance;client;constructor(Z,ct){this.client=Z;this.options=ct??{}}_defaultMeta;get defaultMeta(){if(!this._defaultMeta){this._defaultMeta=this.getDefaultInstanceMeta()}return this._defaultMeta}getDefaultInstanceMeta(){return{id:`${ht.NetworkUtils.getHostname()}-${process.pid}`,serviceName:`${ht.NetworkUtils.getHostname()}`,host:ht.NetworkUtils.getIpv4Address(),port:0,metadata:{}}}getSelfInstance(){return this.instance}async stop(){await this.beforeStop();if(this.instance){return this.deregister()}}}ct.ServiceDiscoveryClient=ServiceDiscoveryClient;class ServiceDiscovery{serviceDiscoveryClientStore=new Set;loadBalancer;createClient(Z){const ct=(0,yt.extend)({},Z,this.getDefaultServiceDiscoveryOptions());const ut=this.createServiceDiscoverClientImpl(ct);this.serviceDiscoveryClientStore.add(ut);return ut}async beforeStop(){}async getInstance(Z){const ct=await this.getInstances(Z);if(!this.loadBalancer){this.setLoadBalancer(this.getDefaultServiceDiscoveryOptions()?.loadBalancer??mt.LoadBalancerType.ROUND_ROBIN)}return this.loadBalancer.select(ct)}setLoadBalancer(Z){if(typeof Z==="string"){this.loadBalancer=_t.LoadBalancerFactory.create(Z)}else{this.loadBalancer=Z}}async destroy(){await this.beforeStop();for(const Z of this.serviceDiscoveryClientStore){await Z.stop()}this.serviceDiscoveryClientStore.clear()}}ct.ServiceDiscovery=ServiceDiscovery;pt([(0,ft.Destroy)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],ServiceDiscovery.prototype,"destroy",null)},71888:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.ServiceFactory=void 0;const ft=ut(5904);const _t=ut(53656);const mt=ut(25923);const ht=ut(35175);class ServiceFactory{clients=new Map;clientPriority;options={};priorityManager;creatingClients=new Map;async initClients(Z={},ct={}){this.options=Z;if(Z.client){Z.clients=Z.clients||{};Z.clients["default"]=Z.clients["default"]||{};(0,ft.extend)(true,Z.clients["default"],Z.client)}if(Z.clients){const ut=Object.entries(Z.clients);if(ct.concurrent){await Promise.all(ut.map((([Z,ct])=>this.createInstance(ct,Z))))}else{for(const[Z,ct]of ut){await this.createInstance(ct,Z)}}}this.clientPriority=Z.priority||{}}get(Z="default"){return this.clients.get(Z)}has(Z){return this.clients.has(Z)}async createInstance(Z,ct){if(ct){if(this.has(ct)){return this.get(ct)}if(this.creatingClients.has(ct)){return this.creatingClients.get(ct)}}Z=(0,ft.extend)(true,{},this.options["default"],Z);const ut=this.createClient(Z,ct);if(ut&&ht.Types.isPromise(ut)){if(ct){this.creatingClients.set(ct,ut)}return ut.then((Z=>{if(ct){this.clients.set(ct,Z)}return Z})).finally((()=>{if(ct){this.creatingClients.delete(ct)}}))}if(ct){this.clients.set(ct,ut)}return ut}async destroyClient(Z,ct){}async stop(){for(const[Z,ct]of this.clients.entries()){await this.destroyClient(ct,Z)}this.clients.clear()}getDefaultClientName(){return this.options["defaultClientName"]}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}getClientPriority(Z){return this.priorityManager.getPriority(this.clientPriority[Z])}isHighPriority(Z){return this.priorityManager.isHighPriority(this.clientPriority[Z])}isMediumPriority(Z){return this.priorityManager.isMediumPriority(this.clientPriority[Z])}isLowPriority(Z){return this.priorityManager.isLowPriority(this.clientPriority[Z])}}ct.ServiceFactory=ServiceFactory;pt([(0,mt.Inject)(),dt("design:type",_t.MidwayPriorityManager)],ServiceFactory.prototype,"priorityManager",void 0)},40360:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.TypedResourceManager=void 0;class TypedResourceManager{typedResourceInitializerOptions;resourceMap=new Map;resourceBindingMap=new Map;constructor(Z){this.typedResourceInitializerOptions=Z}async createResource(Z,ct){const ut=await this.typedResourceInitializerOptions.resourceInitialize(ct,Z);this.resourceMap.set(Z,ut);return ut}async init(){for(const Z of Object.keys(this.typedResourceInitializerOptions.initializeValue)){const ct=this.typedResourceInitializerOptions.initializeValue[Z];const ut=this.typedResourceInitializerOptions.initializeClzProvider[Z];const pt=await this.createResource(Z,ct);const dt=await this.typedResourceInitializerOptions.resourceBinding(ut,ct,pt,Z);if(dt){this.resourceBindingMap.set(Z,dt)}}}async startParallel(){const Z=[];for(const[ct,ut]of this.resourceMap.entries()){Z.push(this.typedResourceInitializerOptions.resourceStart(ut,this.typedResourceInitializerOptions.initializeValue[ct],this.resourceBindingMap.get(ct)))}await Promise.all(Z)}async start(){for(const[Z,ct]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceStart(ct,this.typedResourceInitializerOptions.initializeValue[Z],this.resourceBindingMap.get(Z))}}async destroyParallel(){const Z=[];for(const[ct,ut]of this.resourceMap.entries()){Z.push(this.typedResourceInitializerOptions.resourceDestroy(ut,this.typedResourceInitializerOptions.initializeValue[ct]))}await Promise.all(Z)}async destroy(){for(const[Z,ct]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceDestroy(ct,this.typedResourceInitializerOptions.initializeValue[Z])}this.resourceMap.clear();this.resourceBindingMap.clear()}getResource(Z){return this.resourceMap.get(Z)}}ct.TypedResourceManager=TypedResourceManager},59972:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.WebControllerGenerator=void 0;const pt=ut(25923);const dt=ut(39023);const ft=ut(28068);const _t=ut(22546);const mt=dt.debuglog("midway:debug");class WebControllerGenerator{app;midwayWebRouterService;constructor(Z,ct){this.app=Z;this.midwayWebRouterService=ct}generateKoaController(Z){return async(ct,ut)=>{if(Z.controllerClz&&typeof Z.method==="string"){const ut=await this.app.getFramework().runGuard(ct,Z.controllerClz,Z.method);if(!ut){throw new ft.httpError.ForbiddenError}}const dt=[ct,ut];let _t;if(typeof Z.method!=="string"){_t=await Z.method(ct,ut)}else{const ut=await ct.requestContext.getAsync(Z.id);_t=await ut[Z.method].apply(ut,dt)}if(_t!==undefined){if(_t===null){ct.response._body=null;ct.response._midwayControllerNullBody=true}else{ct.body=_t}}if(Array.isArray(Z.responseMetadata)&&Z.responseMetadata.length){for(const ut of Z.responseMetadata){switch(ut.type){case pt.WEB_RESPONSE_HTTP_CODE:ct.status=ut.code;break;case pt.WEB_RESPONSE_HEADER:for(const Z in ut?.setHeaders||{}){ct.set(Z,ut.setHeaders[Z])}break;case pt.WEB_RESPONSE_CONTENT_TYPE:ct.type=ut.contentType;break;case pt.WEB_RESPONSE_REDIRECT:ct.status=ut.code;ct.redirect(ut.url);return}}}}}async loadMidwayController(Z){const ct=await this.midwayWebRouterService.getRouterTable();const ut=await this.midwayWebRouterService.getRoutePriorityList();const pt=this.app.getApplicationContext();const dt=this.app.getCoreLogger();const ft=pt.get(_t.MidwayMiddlewareService);for(const _t of ut){pt.bindClass(_t.routerModule);dt.debug(`Load Controller "${_t.controllerId}", prefix=${_t.prefix}`);mt(`[core]: Load Controller "${_t.controllerId}", prefix=${_t.prefix}`);const ut=this.createRouter({prefix:_t.prefix,..._t.routerOptions});_t.middleware=_t.middleware??[];if(_t.middleware.length){const Z=await ft.compose(_t.middleware,this.app);ut.use(Z)}const ht=ct.get(_t.prefix);for(const Z of ht){const ct=[];Z.middleware=Z.middleware??[];if(Z.middleware.length){const ut=await ft.compose(Z.middleware,this.app);ct.push(ut)}if(this.app.getNamespace()==="koa"){if(typeof Z.url==="string"&&/\*$/.test(Z.url)){Z.url=Z.url.replace("*","(.*)")}}const pt=[Z.routerName,Z.url,...ct,this.generateController(Z)];dt.debug(`Load Router "${Z.requestMethod.toUpperCase()} ${Z.url}"`);mt(`[core]: Load Router "${Z.requestMethod.toUpperCase()} ${Z.url}"`);ut[Z.requestMethod.toLowerCase()].apply(ut,pt)}if(Z){Z(ut)}}}}ct.WebControllerGenerator=WebControllerGenerator},98727:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});const pt=ut(53386);ct["default"]=()=>{const Z=(0,pt.isDevelopmentEnvironment)((0,pt.getCurrentEnvironment)());return{core:{healthCheckTimeout:1e3,configLoadTimeout:1e4,readyTimeout:3e4,serverReadyTimeout:3e4},asyncContextManager:{enable:true},tracing:{enable:true,onError:"ignore",logOnError:false},midwayLogger:{default:{level:"info"},clients:{coreLogger:{level:Z?"info":"warn"},appLogger:{aliasName:"logger"}}},debug:{recordConfigMergeOrder:Z}}}},81680:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.SINGLETON_CONTAINER_CTX=ct.IGNORE_PATTERN=ct.DEFAULT_PATTERN=ct.MODULE_LOADER_KEY=ct.ASYNC_CONTEXT_MANAGER_KEY=ct.ASYNC_CONTEXT_KEY=ct.REQUEST_CTX_UNIQUE_KEY=ct.REQUEST_CTX_LOGGER_CACHE_KEY=ct.HTTP_SERVER_KEY=ct.CONTAINER_OBJ_SCOPE=ct.REQUEST_OBJ_CTX_KEY=ct.REQUEST_CTX_KEY=ct.MIDWAY_LOGGER_WRITEABLE_DIR=ct.FUNCTION_INJECT_KEY=ct.KEYS=void 0;ct.KEYS={REF_ELEMENT:"ref",REF_CUSTOM:"ref_custom"};ct.FUNCTION_INJECT_KEY="midway:function_inject_key";ct.MIDWAY_LOGGER_WRITEABLE_DIR="MIDWAY_LOGGER_WRITEABLE_DIR";ct.REQUEST_CTX_KEY="ctx";ct.REQUEST_OBJ_CTX_KEY="_req_ctx";ct.CONTAINER_OBJ_SCOPE="_obj_scope";ct.HTTP_SERVER_KEY="_midway_http_server";ct.REQUEST_CTX_LOGGER_CACHE_KEY="_midway_ctx_logger_cache";ct.REQUEST_CTX_UNIQUE_KEY="_midway_ctx_unique_key";ct.ASYNC_CONTEXT_KEY=Symbol("ASYNC_CONTEXT_KEY");ct.ASYNC_CONTEXT_MANAGER_KEY="MIDWAY_ASYNC_CONTEXT_MANAGER_KEY";ct.MODULE_LOADER_KEY="MIDWAY_MODULE_LOADER_KEY";ct.DEFAULT_PATTERN=["**/**.ts","**/**.js","**/**.mts","**/**.mjs","**/**.cts","**/**.cjs"];ct.IGNORE_PATTERN=["**/**.d.ts","**/**.d.mts","**/**.d.cts"];ct.SINGLETON_CONTAINER_CTX={_MAIN_CTX_:true}},84237:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ComponentConfigurationLoader=void 0;const pt=ut(25923);const dt=ut(88067);const ft=ut(12692);const _t=ut(1565);const mt=ut(39023);const ht=ut(53386);const yt=mt.debuglog("midway:debug");class ComponentConfigurationLoader{container;loadedMap=new WeakMap;namespaceList=[];constructor(Z){this.container=Z}async load(Z){let ct=pt.MAIN_MODULE_KEY;const ut=this.getConfigurationExport(Z);if(!ut.length)return;for(let Z=0;Z<ut.length;Z++){const ft=ut[Z];if(this.loadedMap.get(ft)){continue}let _t;if(dt.MetadataManager.hasOwnMetadata(pt.CONFIGURATION_OBJECT_KEY,ft)){_t=dt.MetadataManager.getOwnMetadata(pt.CONFIGURATION_OBJECT_KEY,ft)}else{_t=dt.MetadataManager.getOwnMetadata(pt.CONFIGURATION_KEY,ft)}this.loadedMap.set(ft,true);if(_t){if(_t.namespace!==undefined){ct=_t.namespace;this.namespaceList.push(ct)}yt(`[core]: load configuration in namespace="${ct}"`);this.addImports(_t.imports);this.addImportObjects(_t.importObjects);this.addImportConfigs(_t.importConfigs);this.addImportConfigFilter(_t.importConfigFilter);if(_t.detector){await _t.detector.run(this.container,ct)}pt.DecoratorManager.saveModule(pt.CONFIGURATION_KEY,{target:ft,namespace:ct})}}this.container.bindClass(Z,{namespace:ct})}loadSync(Z){let ct=pt.MAIN_MODULE_KEY;const ut=this.getConfigurationExport(Z);if(!ut.length)return;for(let Z=0;Z<ut.length;Z++){const ft=ut[Z];if(this.loadedMap.get(ft)){continue}let _t;if(dt.MetadataManager.hasOwnMetadata(pt.CONFIGURATION_OBJECT_KEY,ft)){_t=dt.MetadataManager.getOwnMetadata(pt.CONFIGURATION_OBJECT_KEY,ft)}else{_t=dt.MetadataManager.getOwnMetadata(pt.CONFIGURATION_KEY,ft)}this.loadedMap.set(ft,true);if(_t){if(_t.namespace!==undefined){ct=_t.namespace;this.namespaceList.push(ct)}yt(`[core]: load configuration in namespace="${ct}"`);this.addImports(_t.imports);this.addImportObjects(_t.importObjects);this.addImportConfigs(_t.importConfigs);this.addImportConfigFilter(_t.importConfigFilter);if(_t.detector){_t.detector.runSync(this.container,ct)}pt.DecoratorManager.saveModule(pt.CONFIGURATION_KEY,{target:ft,namespace:ct})}}this.container.bindClass(Z,{namespace:ct})}addImportConfigs(Z){if(Z){if(Array.isArray(Z)){this.container.get(ft.MidwayConfigService).add(Z)}else{this.container.get(ft.MidwayConfigService).addObject(Z)}}}addImportConfigFilter(Z){if(Z){this.container.get(ft.MidwayConfigService).addFilter(Z)}}addImports(Z=[]){for(let ct of Z){if(!ct)continue;if(typeof ct==="string"){ct=require(ct)}if("Configuration"in ct){this.load(ct)}else if("component"in ct){if(ct?.enabledEnvironment){if(ct?.enabledEnvironment?.includes(this.container.get(_t.MidwayEnvironmentService).getCurrentEnvironment())){this.load(ct.component)}}else{this.load(ct.component)}}else{this.load(ct)}}}addImportObjects(Z){if(Z){const ct=Object.keys(Z);for(const ut of ct){if(typeof Z[ut]!=="undefined"){this.container.registerObject(ut,Z[ut])}}}}getConfigurationExport(Z){const ct=[];if((0,ht.isConfigurationExport)(Z)){ct.push(Z)}else{for(const ut in Z){const pt=Z[ut];if((0,ht.isConfigurationExport)(pt)){ct.push(pt)}}}return ct}getNamespaceList(){return this.namespaceList}}ct.ComponentConfigurationLoader=ComponentConfigurationLoader},90494:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayContainer=void 0;const pt=ut(25923);const dt=ut(39023);const ft=ut(53743);const _t=ut(77866);const mt=ut(81680);const ht=ut(99648);const yt=ut(57211);const vt=ut(68454);const St=ut(24434);const bt=ut(35175);const xt=ut(53386);const $t=ut(88067);const Et=ut(4458);const Ct=dt.debuglog("midway:debug");const Tt=dt.debuglog("midway:bind");const wt=9;class MidwayContainer{_resolverFactory=null;_registry=null;_identifierMapping=null;_objectCreateEventTarget;ctx=mt.SINGLETON_CONTAINER_CTX;attrMap=new Map;namespaceSet=new Set;_id=xt.Utils.generateRandomId();get id(){return this._id}constructor(){this.registerObject(mt.REQUEST_CTX_KEY,this.ctx)}get objectCreateEventTarget(){if(!this._objectCreateEventTarget){this._objectCreateEventTarget=new St.EventEmitter}return this._objectCreateEventTarget}get registry(){if(!this._registry){this._registry=new ft.ObjectDefinitionRegistry}return this._registry}set registry(Z){this._registry=Z}get identifierMapping(){if(!this._identifierMapping){this._identifierMapping=this.registry.getIdentifierRelation()}return this._identifierMapping}addNamespace(Z){this.namespaceSet.add(Z)}bindClass(Z,ct){if(bt.Types.isClass(Z)||bt.Types.isFunction(Z)){this.bindModule(Z,ct)}else{for(const ut in Z){const pt=Z[ut];if(bt.Types.isClass(pt)||bt.Types.isFunction(pt)){this.bindModule(pt,ct)}else if(pt&&typeof pt==="object"){const Z=$t.MetadataManager.getOwnMetadata(Et.FUNCTIONAL_API_CONTROLLER_CLASS_KEY,pt)||pt[Et.FUNCTIONAL_API_CONTROLLER_CLASS_KEY];if(bt.Types.isClass(Z)){this.bindModule(Z,ct)}}}}}bind(Z,ct,ut){if(bt.Types.isClass(Z)||bt.Types.isFunction(Z)){return this.bindModule(Z,ct)}if(this.registry.hasDefinition(Z)){return}if(ut?.bindHook){ut.bindHook(ct,ut)}let dt;if(bt.Types.isClass(ct)){dt=new ht.ObjectDefinition;dt.name=pt.DecoratorManager.getProviderName(ct)}else{dt=new yt.FunctionDefinition;if(!bt.Types.isAsyncFunction(ct)){dt.asynchronous=false}dt.name=dt.id}dt.path=ct;dt.id=Z;dt.srcPath=ut?.srcPath||null;dt.namespace=ut?.namespace||"";dt.scope=ut?.scope||_t.ScopeEnum.Request;dt.createFrom=ut?.createFrom;if(dt.srcPath){Ct(`[core]: bind id "${dt.name} (${dt.srcPath}) ${Z}"`)}else{Ct(`[core]: bind id "${dt.name}" ${Z}`)}const ft=$t.MetadataManager.getPropertiesWithMetadata(pt.CONSTRUCTOR_INJECT_KEY,ct);if(ft["default"]){const Z=ft["default"].length;const ct=new Array(Z);for(const Z of ft["default"]){Tt(`${" ".repeat(wt)}inject constructor => [${JSON.stringify(Z)}]`);ct[Z.parameterIndex]=Z}dt.constructorArgs=ct}const mt=$t.MetadataManager.getPropertiesWithMetadata(pt.PROPERTY_INJECT_KEY,ct);for(const Z in mt){const ct=mt[Z];Tt(`${" ".repeat(wt)}inject properties => [${JSON.stringify(ct)}]`);dt.properties.set(ct.targetKey,ct)}const vt=$t.MetadataManager.getPropertiesWithMetadata(pt.CUSTOM_PROPERTY_INJECT_KEY,ct);for(const Z in vt){for(const ct of vt[Z]){dt.handlerProps.push(ct)}}const St=$t.MetadataManager.getPropertiesWithMetadata(pt.OBJECT_DEFINITION_KEY,ct);const xt={};for(const Z in St){Object.assign(xt,St[Z][0])}if(xt.initMethod){Tt(`${" ".repeat(wt)}register initMethod = ${xt.initMethod}`);dt.initMethod=xt.initMethod}if(xt.destroyMethod){Tt(`${" ".repeat(wt)}register destroyMethod = ${xt.destroyMethod}`);dt.destroyMethod=xt.destroyMethod}const Et=$t.MetadataManager.getOwnMetadata(pt.SCOPE_KEY,ct);if(Et){const{scope:Z,allowDowngrade:ct}=Et;Tt(`${" ".repeat(wt)}register scope = ${Z}`);dt.scope=Z;Tt(`${" ".repeat(wt)}register allowDowngrade = ${ct}`);dt.allowDowngrade=ct}this.objectCreateEventTarget.emit(_t.ObjectLifeCycleEvent.BEFORE_BIND,ct,{context:this,definition:dt,replaceCallback:Z=>{dt=Z}});if(dt){this.registry.registerDefinition(dt.id,dt)}return dt}bindModule(Z,ct){if(bt.Types.isClass(Z)){const ut=pt.DecoratorManager.getProviderUUId(Z);if(ut){this.identifierMapping.saveClassRelation(Z,ct?.namespace);return this.bind(ut,Z,ct)}else{}}else{const ut=Z[mt.FUNCTION_INJECT_KEY];if(ut&&ut.id){if(!ut.scope){ut.scope=_t.ScopeEnum.Request}const pt=xt.Utils.generateRandomId();this.identifierMapping.saveFunctionRelation(ut.id,pt);return this.bind(pt,Z,{scope:ut.scope,namespace:ct.namespace,srcPath:ct.srcPath,createFrom:ct.createFrom})}}}setAttr(Z,ct){this.attrMap.set(Z,ct)}getAttr(Z){return this.attrMap.get(Z)}getIdentifier(Z){if(typeof Z!=="string"){Z=pt.DecoratorManager.getProviderUUId(Z)}return Z}getManagedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new vt.ManagedResolverFactory(this)}return this._resolverFactory}async stop(){await this.getManagedResolverFactory().destroyCache();this.registry.clearAll();this.attrMap.clear()}get(Z,ct){return this.getManagedResolverFactory().create(Z,ct,this)}async getAsync(Z,ct){return this.getManagedResolverFactory().createAsync(Z,ct,this)}registerObject(Z,ct){this.registry.registerObject(Z,ct)}removeObject(Z){this.registry.removeObject(Z)}onBeforeBind(Z){this.objectCreateEventTarget.on(_t.ObjectLifeCycleEvent.BEFORE_BIND,Z)}onBeforeObjectCreated(Z){this.objectCreateEventTarget.on(_t.ObjectLifeCycleEvent.BEFORE_CREATED,Z)}onObjectCreated(Z){this.objectCreateEventTarget.on(_t.ObjectLifeCycleEvent.AFTER_CREATED,Z)}onObjectInit(Z){this.objectCreateEventTarget.on(_t.ObjectLifeCycleEvent.AFTER_INIT,Z)}onBeforeObjectDestroy(Z){this.objectCreateEventTarget.on(_t.ObjectLifeCycleEvent.BEFORE_DESTROY,Z)}hasNamespace(Z){return this.namespaceSet.has(Z)}getNamespaceList(){return Array.from(this.namespaceSet)}hasDefinition(Z){return this.registry.hasDefinition(Z)}getDefinition(Z){return this.registry.getDefinition(Z)}hasObject(Z){return this.registry.hasObject(Z)}getObject(Z){return this.registry.getObject(Z)}getInstanceScope(Z){if(Z[mt.CONTAINER_OBJ_SCOPE]){return Z[mt.CONTAINER_OBJ_SCOPE]}return undefined}}ct.MidwayContainer=MidwayContainer},53743:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ObjectDefinitionRegistry=void 0;const pt=ut(25923);class LegacyIdentifierRelation extends Map{saveClassRelation(Z,ct){const ut=pt.DecoratorManager.getProviderUUId(Z);this.set(ut,ut);if(ut){const dt=pt.DecoratorManager.getProviderId(Z);if(dt){this.set(dt,ut)}this.set(pt.DecoratorManager.getProviderName(Z),ut);if(ct){this.set(ct+":"+pt.DecoratorManager.getProviderName(Z),ut)}}}saveFunctionRelation(Z,ct){this.set(ct,ct);this.set(Z,ct)}hasRelation(Z){return this.has(Z)}getRelation(Z){return this.get(Z)}}class ObjectDefinitionRegistry extends Map{singletonIds=[];_identifierRelation=new LegacyIdentifierRelation;objectCache=new Map;get identifierRelation(){if(!this._identifierRelation){this._identifierRelation=new LegacyIdentifierRelation}return this._identifierRelation}set identifierRelation(Z){this._identifierRelation=Z}get identifiers(){return Array.from(this.keys())}get count(){return this.size}getSingletonDefinitionIds(){return this.singletonIds}getDefinitionByName(Z){const ct=[];for(const ut of this.values()){const pt=ut;if(pt.name===Z){ct.push(pt)}}return ct}registerDefinition(Z,ct){if(ct.isSingletonScope()){this.singletonIds.push(Z)}this.set(Z,ct)}getDefinition(Z){Z=this.identifierRelation.getRelation(Z)??Z;return this.get(Z)}removeDefinition(Z){this.delete(Z)}hasDefinition(Z){Z=this.identifierRelation.getRelation(Z)??Z;return this.has(Z)}clearAll(){this.singletonIds=[];this.objectCache.clear();this.clear()}hasObject(Z){Z=this.identifierRelation.getRelation(Z)??Z;return this.objectCache.has(Z)}registerObject(Z,ct){this.objectCache.set(Z,ct)}removeObject(Z){this.objectCache.delete(Z)}getObject(Z){Z=this.identifierRelation.getRelation(Z)??Z;return this.objectCache.get(Z)}getIdentifierRelation(){return this.identifierRelation}setIdentifierRelation(Z){this.identifierRelation=Z}}ct.ObjectDefinitionRegistry=ObjectDefinitionRegistry},3281:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.DynamicMidwayContainer=void 0;const pt=ut(90494);const dt=ut(1565);const ft=ut(53386);const _t=ut(35175);const mt=ut(25923);const ht=ut(39023);const yt=(0,ht.debuglog)("midway:container");class DynamicMidwayContainer extends pt.MidwayContainer{moduleType;modifyClassMapping=new Map;idRefMapping=new Map;constructor(){super();this.onBeforeBind(((Z,ct)=>{const ut=ct.definition;if(ut){if(ut.properties){for(const Z of ut.properties.values()){if(typeof Z.id==="string"){if(this.idRefMapping.has(Z.id)){this.idRefMapping.get(Z.id).push(ut.id)}else{this.idRefMapping.set(Z.id,[ut.id])}}}}if(ut.constructorArgs){for(const Z of ut.constructorArgs){if(typeof Z.id==="string"){if(this.idRefMapping.has(Z.id)){this.idRefMapping.get(Z.id).push(ut.id)}else{this.idRefMapping.set(Z.id,[ut.id])}}}}}}))}async updateDefinition(Z){yt("updateDefinition %s",Z);if(!this.moduleType){const Z=await this.getAsync(dt.MidwayEnvironmentService);this.moduleType=Z.getModuleLoadType()}const ct=this.findDefinitionByPath(Z);yt("oldDefinitionList size %s",ct.length);if(!ct.length){return}const ut={};for(const Z of ct){ut[Z.name]=Z.id}yt("nameList %j",ut);const pt=this.findRequireCacheAndClear(Z);for(const Z of ct){if(this.idRefMapping.has(Z.id)){for(const ct of this.idRefMapping.get(Z.id)){if(this.hasObject(ct)){this.removeObject(ct)}}}else if(this.idRefMapping.has(Z.name)){for(const ct of this.idRefMapping.get(Z.name)){if(this.hasObject(ct)){this.removeObject(ct)}}}this.removeObject(Z.id)}yt("ready to load module %s",Z);const ht=await(0,ft.loadModule)(Z,{loadMode:this.moduleType});const vt=[];if(_t.Types.isClass(ht)||_t.Types.isFunction(ht)){vt.push(ht)}else{for(const Z in ht){const ct=ht[Z];vt.push(ct)}}yt("newClassList size %s",vt.length);let St=false;if(_t.Types.isClass(ht)||_t.Types.isFunction(ht)){const ct=mt.DecoratorManager.getProviderUUId(ht);const pt=mt.DecoratorManager.getProviderName(ht);if(ut[pt]){yt("find old class name %s and will be remapping",pt);this.remapping(ut[pt],ct)}yt("bindModule %s",ct);St=true;this.bindModule(ht,{namespace:mt.MAIN_MODULE_KEY,srcPath:Z,createFrom:"file"})}else{for(const ct in ht){const pt=ht[ct];if(_t.Types.isClass(pt)||_t.Types.isFunction(pt)){const ct=mt.DecoratorManager.getProviderUUId(pt);const dt=mt.DecoratorManager.getProviderName(pt);if(ut[dt]!==ct){if(ut[dt]){yt("find old class name %s and will be remapping",dt);this.remapping(ut[dt],ct)}yt("bindModule %s",ct);St=true;this.bindModule(pt,{namespace:mt.MAIN_MODULE_KEY,srcPath:Z,createFrom:"file"})}}}}return pt&&ct.length>0&&vt.length>0&&St}getIdentifier(Z){let ct="unknown";if(typeof Z!=="string"){ct=mt.DecoratorManager.getProviderName(Z);Z=mt.DecoratorManager.getProviderUUId(Z)}yt("check identifier from %s %s",ct,Z);if(this.modifyClassMapping.has(Z)){yt("getIdentifier from modifyClassMapping %s -> %s",Z,this.modifyClassMapping.get(Z));return this.modifyClassMapping.get(Z)}return Z}findDefinitionByPath(Z){const ct=[];for(const ut of this.registry.values()){if(ut.srcPath===Z){ct.push(ut)}}return ct}findRequireCacheAndClear(Z){let ct=false;const ut=require.resolve(Z);const pt=require.cache[ut];if(pt){yt("clear cache %s",ut);delete require.cache[ut];ct=true}return ct}remapping(Z,ct){for(const[ut,pt]of this.modifyClassMapping.entries()){if(pt===Z){yt("remapping key = %s, %s -> %s",ut,Z,ct);this.modifyClassMapping.set(ut,ct)}}yt("new remapping key = %s, value = %s",Z,ct);this.modifyClassMapping.set(Z,ct)}}ct.DynamicMidwayContainer=DynamicMidwayContainer},68454:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ManagedResolverFactory=void 0;const pt=ut(81680);const dt=ut(77866);const ft=ut(39023);const _t=ut(28068);const mt=ut(57211);const ht=ft.debuglog("midway:debug");function createProxy(Z){let ct;return new Proxy({},{get(ut,pt){if(!ct){ct=Z()}return ct[pt]}})}function formatObjectIdentifier(Z){if(typeof Z==="function"){return Z()}return Z}class ManagedResolverFactory{creating=new Map;context;constructor(Z){this.context=Z}create(Z,ct=[],ut){const pt=typeof Z==="string"?Z:Z.name;Z=ut.getIdentifier(Z);ht('[core]: create "%s(%s)"',Z,pt);if(ut.hasObject(Z)){return ut.getObject(Z)}const dt=this.getObjectDefinition(Z);if(!dt&&ut!==this.context&&this.context.hasObject(Z)){return this.context.getObject(Z)}if(!dt){throw new _t.MidwayDefinitionNotFoundError(Z,pt)}const ft=[];const mt=new Map;const yt=this.createInstance(Z,pt,ct,dt,false,false,ut,mt,ft);mt.clear();const vt=this.initializeInstance(yt,dt,ft);return vt??yt}async createAsync(Z,ct=[],ut){const pt=typeof Z==="string"?Z:Z.name;Z=ut.getIdentifier(Z);ht('[core]: createAsync "%s(%s)"',Z,pt);if(ut.hasObject(Z)){return ut.getObject(Z)}const dt=this.getObjectDefinition(Z);if(!dt&&ut!==this.context&&this.context.hasObject(Z)){return this.context.getObject(Z)}if(!dt){throw new _t.MidwayDefinitionNotFoundError(Z,pt)}const ft=[];const mt=new Map;const yt=this.createInstance(Z,dt?.name??pt,ct,dt,true,false,ut,mt,ft);mt.clear();const vt=await this.initializeInstanceAsync(yt,dt,ft);return vt??yt}async destroyCache(){for(const Z of this.context.registry.getSingletonDefinitionIds()){const ct=this.getObjectDefinition(Z);if(ct.creator){const ut=this.context.getObject(Z);this.getObjectEventTarget().emit(dt.ObjectLifeCycleEvent.BEFORE_DESTROY,ut,{context:this.context,definition:ct});await ct.creator.doDestroyAsync(ut)}this.context.removeObject(Z)}this.creating.clear()}getObjectEventTarget(){return this.context.objectCreateEventTarget}checkSingletonInvokeRequest(Z,ct,ut){if(Z.isSingletonScope()){const pt=Z.properties.get(ct);if(ut.hasDefinition(pt?.id)){const ct=ut.getDefinition(pt.id);if(ct.isRequestScope()&&!ct.allowDowngrade){throw new _t.MidwaySingletonInjectRequestError(Z.path.name,ct.path.name)}}}return true}setInstanceScope(Z,ct){if(typeof Z==="object"){if(ct===dt.ScopeEnum.Request&&Z[pt.REQUEST_OBJ_CTX_KEY]===pt.SINGLETON_CONTAINER_CTX){ct=dt.ScopeEnum.Singleton}Object.defineProperty(Z,pt.CONTAINER_OBJ_SCOPE,{value:ct,writable:false,enumerable:false,configurable:false})}}createInstance(Z,ct,ut=[],ft,mt,yt,vt,St,bt,xt=new Set,$t){Z=vt.getIdentifier(Z);if(vt.hasObject(Z)){return vt.getObject(Z)}ft=ft??vt.getDefinition(Z);if(!ft&&vt!==this.context&&this.context.hasObject(Z)){return this.context.getObject(Z)}if(!ft){throw new _t.MidwayDefinitionNotFoundError(Z,ct,this.translateIdentifiers(Array.from(xt)))}if(ft.isSingletonScope()){vt=this.context;if(this.context.hasObject(ft.id)){ht(`[core]: "${ft.id}(${ft.name})" get from singleton cache.`);return this.context.getObject(ft.id)}}if(xt.has(ft.id)){if(yt){return createProxy((()=>vt.get(ft.id)))}else{const Z=Array.from(xt).concat(ft.id);throw new _t.MidwayCommonError(`Circular dependency detected: ${this.translateIdentifiers(Z).join(" -> ")}`)}}if(St.has(ft.id)){return St.get(ft.id)}xt.add(ft.id);if(ft.hasDependsOn()){for(const Z of ft.dependsOn){ht("[core]: id = %s init depend %s.",ft.id,Z);this.createInstance(Z,Z,[],undefined,mt,false,vt,St,bt,new Set(xt))}}const Et=ft.creator.load();let Ct=new Array(ft.constructorArgs.length);if(ut&&Array.isArray(ut)&&ut.length>0){Ct=ut}else{for(let Z=0;Z<ft.constructorArgs.length;Z++){const ut=ft.constructorArgs[Z];if(ut===undefined)continue;ut.id=formatObjectIdentifier(ut.id);ht('[core]: constructor arg "%s(%s)", pos=%s, in "%s".',ut.id,ut.name,ut.parameterIndex,ct);Ct[Z]=this.createInstance(ut.id,ut.name,[],undefined,mt,ut.isLazyInject,vt,St,bt,new Set(xt))}}this.getObjectEventTarget().emit(dt.ObjectLifeCycleEvent.BEFORE_CREATED,Et,{constructorArgs:Ct,context:vt});let Tt=ft.creator.doConstruct(Et,Ct);if(!Tt){throw new _t.MidwayCommonError(`${ft.id} construct return undefined`)}if(ft.isRequestScope()&&ft.constructor.name==="ObjectDefinition"){ht('[core]: "%s(%s)" inject ctx',ft.id,ft.name);Object.defineProperty(Tt,pt.REQUEST_OBJ_CTX_KEY,{value:vt.get(pt.REQUEST_CTX_KEY),writable:false,enumerable:false})}St.set(ft.id,Tt);if(ft.properties){const Z=Array.from(ft.properties.keys());for(const ut of Z){this.checkSingletonInvokeRequest(ft,ut,vt);const Z=ft.properties.get(ut);Z.id=formatObjectIdentifier(Z.id);ht('[core]: property "%s(%s)", in "%s".',Z.id||Z.name,Z.name,ct);Tt[ut]=this.createInstance(Z.id||Z.name,Z.name,Z.args,undefined,mt,Z.isLazyInject,vt,St,bt,new Set(xt),(Z=>{Tt[ut]=Z}))}}this.getObjectEventTarget().emit(dt.ObjectLifeCycleEvent.AFTER_CREATED,Tt,{context:vt,definition:ft,replaceCallback:Z=>{Tt=Z}});ht('[core]: put "%s(%s)" to pending init queue.',ft.id,ft.name);if(mt){bt.push([Tt,ft,()=>ft.creator.doInitAsync(Tt,vt),$t])}else{bt.push([Tt,ft,()=>ft.creator.doInit(Tt,vt),$t])}return Tt}initializeInstance(Z,ct,ut){const pt=new Map;const ft=new Map;for(const[ct,_t,yt,vt]of ut){if(!ft.has(_t.id)){pt.set(_t.id,ct);ht('[core]: load "%s(%s)" from pending init queue and ready to init.',_t.id,_t.name);const ut=yt?.();if(_t instanceof mt.FunctionDefinition){ft.set(_t.id,ut);vt?.(ut)}else{ft.set(_t.id,ct)}this.storeInstanceScope(ct,_t);this.getObjectEventTarget().emit(dt.ObjectLifeCycleEvent.AFTER_INIT,Z,{context:this.getCurrentMatchedContext(Z),definition:_t});pt.delete(_t.id)}}return ft.get(ct.id)}async initializeInstanceAsync(Z,ct,ut){const pt=new Map;const ft=new Map;for(const[ct,_t,yt,vt]of ut){if(!ft.has(_t.id)){pt.set(_t.id,ct);ht('[core]: load "%s(%s)" from pending init queue and ready to init.',_t.id,_t.name);const ut=await yt();if(_t instanceof mt.FunctionDefinition){ft.set(_t.id,ut);vt?.(ut)}else{ft.set(_t.id,ct)}this.storeInstanceScope(ct,_t);this.getObjectEventTarget().emit(dt.ObjectLifeCycleEvent.AFTER_INIT,Z,{context:this.getCurrentMatchedContext(Z),definition:_t});pt.delete(_t.id)}}return ft.get(ct.id)}storeInstanceScope(Z,ct){if(ct.id){if(ct.isSingletonScope()){ht(`[core]: "${ct.id}(${ct.name})" set to singleton cache`);this.context.registerObject(ct.id,Z);this.setInstanceScope(Z,dt.ScopeEnum.Singleton)}else if(ct.isRequestScope()){ht(`[core]: "${ct.id}(${ct.name})" set to register object`);this.getCurrentMatchedContext(Z).registerObject(ct.id,Z);this.setInstanceScope(Z,dt.ScopeEnum.Request)}else{this.setInstanceScope(Z,dt.ScopeEnum.Prototype)}}}getObjectDefinition(Z){return this.context.getDefinition(Z)}getCurrentMatchedContext(Z){if(Z[pt.REQUEST_OBJ_CTX_KEY]){return Z[pt.REQUEST_OBJ_CTX_KEY]?.[pt.REQUEST_CTX_UNIQUE_KEY]??this.context}return this.context}translateIdentifiers(Z){return Z.map((Z=>{const ct=this.context.getDefinition(Z);return ct.path?.name??ct.name??ct.id}))}}ct.ManagedResolverFactory=ManagedResolverFactory},22837:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.providerWrapper=providerWrapper;const pt=ut(81680);function providerWrapper(Z){for(const ct of Z){Object.defineProperty(ct.provider,pt.FUNCTION_INJECT_KEY,{value:ct,writable:false})}}},33569:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayRequestContainer=void 0;const pt=ut(81680);const dt=ut(53743);class MidwayRequestContainer{ctx;applicationContext;parent;registry=new dt.ObjectDefinitionRegistry;attrMap=new Map;constructor(Z,ct){this.ctx=Z;this.applicationContext=ct;this.parent=ct;this.registry.setIdentifierRelation(this.applicationContext.registry.getIdentifierRelation());this.registerObject(pt.REQUEST_CTX_KEY,Z);this.registerObject("res",{});if(Z.logger){this.registerObject("logger",Z.logger)}Z[pt.REQUEST_CTX_UNIQUE_KEY]=this}get(Z,ct){return this.parent.getManagedResolverFactory().create(Z,ct,this)}async getAsync(Z,ct){return this.parent.getManagedResolverFactory().createAsync(Z,ct,this)}getContext(){return this.ctx}hasDefinition(Z){return this.parent.hasDefinition(Z)}getDefinition(Z){return this.parent.getDefinition(Z)}registerObject(Z,ct){this.registry.registerObject(Z,ct)}removeObject(Z){this.registry.removeObject(Z)}hasObject(Z){return this.registry.hasObject(Z)}getObject(Z){return this.registry.getObject(Z)}setAttr(Z,ct){this.attrMap.set(Z,ct)}getAttr(Z){return this.attrMap.get(Z)}getIdentifier(Z){return this.parent.getIdentifier(Z)}getInstanceScope(Z){return this.parent.getInstanceScope(Z)}hasNamespace(Z){return this.parent.hasNamespace(Z)}}ct.MidwayRequestContainer=MidwayRequestContainer},88725:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Aspect=Aspect;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function Aspect(Z,ct,ut){return function(_t){pt.DecoratorManager.saveModule(pt.ASPECT_KEY,_t);const mt=[].concat(Z);for(const Z of mt){ft.MetadataManager.attachMetadata(pt.ASPECT_KEY,{aspectTarget:Z,match:ct,priority:ut},_t)}(0,pt.Scope)(dt.ScopeEnum.Singleton)(_t);(0,pt.Provide)()(_t)}}},70914:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Autoload=Autoload;const pt=ut(40635);const dt=ut(71652);function Autoload(){return function(Z){pt.DecoratorManager.savePreStartModule(Z);(0,dt.Provide)()(Z)}}},73567:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Configuration=Configuration;const pt=ut(25923);const dt=ut(88067);const ft=ut(77866);function Configuration(Z={}){return ct=>{Z.namespace=Z.namespace??pt.MAIN_MODULE_KEY;dt.MetadataManager.defineMetadata(pt.CONFIGURATION_KEY,Z,ct);(0,pt.Scope)(ft.ScopeEnum.Singleton)(ct);(0,pt.Provide)()(ct)}}},75227:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Catch=Catch;ct.Match=Match;const pt=ut(57347);const dt=ut(71652);const ft=ut(77866);const _t=ut(88067);const mt=ut(28017);function Catch(Z,ct={}){return function(ut){const ht=Z?[].concat(Z):undefined;_t.MetadataManager.defineMetadata(pt.CATCH_KEY,{catchTargets:ht,catchOptions:ct},ut);(0,mt.Scope)(ft.ScopeEnum.Singleton)(ut);(0,dt.Provide)()(ut)}}function Match(Z=true){return function(ct){_t.MetadataManager.defineMetadata(pt.MATCH_KEY,{matchPattern:Z},ct);(0,mt.Scope)(ft.ScopeEnum.Singleton)(ct);(0,dt.Provide)()(ct)}}},61841:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Framework=Framework;ct.Plugin=Plugin;ct.Config=Config;ct.AllConfig=AllConfig;ct.App=App;ct.MainApp=MainApp;ct.Logger=Logger;ct.ApplicationContext=ApplicationContext;const pt=ut(25923);const dt=ut(77866);function Framework(){return Z=>{pt.DecoratorManager.saveModule(pt.FRAMEWORK_KEY,Z);(0,pt.Scope)(dt.ScopeEnum.Singleton)(Z);(0,pt.Provide)()(Z)}}function Plugin(Z){return pt.DecoratorManager.createCustomPropertyDecorator(pt.PLUGIN_KEY,{identifier:Z})}function Config(Z){return pt.DecoratorManager.createCustomPropertyDecorator(pt.CONFIG_KEY,{identifier:Z})}function AllConfig(){return pt.DecoratorManager.createCustomPropertyDecorator(pt.CONFIG_KEY,{identifier:pt.ALL_VALUE_KEY})}function App(Z){return pt.DecoratorManager.createCustomPropertyDecorator(pt.APPLICATION_KEY,{type:Z})}function MainApp(){return pt.DecoratorManager.createCustomPropertyDecorator(pt.MAIN_APPLICATION_KEY,{})}function Logger(Z){return pt.DecoratorManager.createCustomPropertyDecorator(pt.LOGGER_KEY,{identifier:Z})}function ApplicationContext(){return pt.DecoratorManager.createCustomPropertyDecorator(pt.APPLICATION_CONTEXT_KEY,{})}},82056:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.UseGuard=UseGuard;ct.Guard=Guard;const pt=ut(77866);const dt=ut(57347);const ft=ut(71652);const _t=ut(88067);const mt=ut(28017);function UseGuard(Z){return(ct,ut,pt)=>{if(!Array.isArray(Z)){Z=[Z]}_t.MetadataManager.defineMetadata(dt.GUARD_KEY,Z,ct,ut)}}function Guard(){return Z=>{(0,ft.Provide)()(Z);(0,mt.Scope)(pt.ScopeEnum.Singleton)(Z)}}},35572:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.saveInjectMetadata=saveInjectMetadata;ct.Inject=Inject;ct.LazyInject=LazyInject;ct.InjectClient=InjectClient;const pt=ut(40635);const dt=ut(77866);const ft=ut(57347);const _t=ut(35175);const mt=ut(88067);const ht=ut(53386);function getConstructParamNames(Z){let ct=mt.MetadataManager.getOwnMetadata("constructorParamNames",Z);if(!ct){ct=(0,ht.getParamNames)(Z);mt.MetadataManager.defineMetadata("constructorParamNames",ct,Z)}return ct}function saveInjectMetadata(Z,ct,ut,ht=false,yt){let vt=dt.InjectModeEnum.Identifier;let St=Z;const bt=yt!==undefined;if(bt){const Z=getConstructParamNames(ct);if(!St){const ft=mt.MetadataManager.getMethodParamTypes(ct,ut);const ht=mt.MetadataManager.transformTypeFromTSDesign(ft[yt]);if(!ht.isBaseType&&(0,_t.isClass)(ht.originDesign)&&pt.DecoratorManager.isProvide(ht.originDesign)){St=pt.DecoratorManager.getProviderUUId(ht.originDesign);vt=dt.InjectModeEnum.Class}if(!St){St=Z[yt];vt=dt.InjectModeEnum.SelfName}}mt.MetadataManager.attachMetadata(ft.CONSTRUCTOR_INJECT_KEY,{targetKey:ut,id:St,name:Z[yt],injectMode:vt,isLazyInject:ht,parameterIndex:yt},ct,"default")}else{if(!St){const Z=mt.MetadataManager.transformTypeFromTSDesign(mt.MetadataManager.getPropertyType(ct,ut));if(!Z.isBaseType&&(0,_t.isClass)(Z.originDesign)&&pt.DecoratorManager.isProvide(Z.originDesign)){St=pt.DecoratorManager.getProviderUUId(Z.originDesign);vt=dt.InjectModeEnum.Class}if(!St){St=ut;vt=dt.InjectModeEnum.SelfName}}mt.MetadataManager.defineMetadata(ft.PROPERTY_INJECT_KEY,{targetKey:ut,id:St,name:ut,isLazyInject:ht,injectMode:vt},ct,ut)}}function Inject(Z){return function(ct,ut,pt){return saveInjectMetadata(Z,ct,ut,false,pt)}}function LazyInject(Z){let ct=Z;if(ct&&typeof ct!=="function"){ct=()=>Z}return function(Z,ut,pt){return saveInjectMetadata(ct,Z,ut,true,pt)}}function InjectClient(Z,ct){return pt.DecoratorManager.createCustomPropertyDecorator(ft.FACTORY_SERVICE_CLIENT_KEY,{serviceFactoryClz:Z,clientName:ct})}},16741:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Middleware=Middleware;const pt=ut(25923);const dt=ut(77866);function Middleware(){return Z=>{(0,pt.Scope)(dt.ScopeEnum.Singleton)(Z);(0,pt.Provide)()(Z)}}},35467:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Mock=Mock;const pt=ut(25923);const dt=ut(77866);function Mock(){return Z=>{pt.DecoratorManager.saveModule(pt.MOCK_KEY,Z);(0,pt.Scope)(dt.ScopeEnum.Singleton)(Z);(0,pt.Provide)()(Z)}}},13631:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Init=Init;ct.Destroy=Destroy;const pt=ut(88067);const dt=ut(57347);function Init(){return function(Z,ct){pt.MetadataManager.attachMetadata(dt.OBJECT_DEFINITION_KEY,{initMethod:ct},Z,ct)}}function Destroy(){return function(Z,ct){pt.MetadataManager.attachMetadata(dt.OBJECT_DEFINITION_KEY,{destroyMethod:ct},Z,ct)}}},88561:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Pipe=Pipe;const pt=ut(25923);const dt=ut(77866);function Pipe(){return Z=>{(0,pt.Scope)(dt.ScopeEnum.Singleton)(Z);(0,pt.Provide)()(Z)}}},71652:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Provide=Provide;const pt=ut(40635);function Provide(Z){return function(ct){pt.DecoratorManager.saveProviderId(Z,ct)}}},28017:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Scope=Scope;ct.Singleton=Singleton;const pt=ut(57347);const dt=ut(77866);const ft=ut(88067);const _t=ut(71652);function Scope(Z,ct){return function(ut){ft.MetadataManager.defineMetadata(pt.SCOPE_KEY,{scope:Z,...ct},ut)}}function Singleton(){return function(Z){Scope(dt.ScopeEnum.Singleton)(Z);(0,_t.Provide)()(Z)}}},5228:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.TRACE_KEY=void 0;ct.Trace=Trace;const pt=ut(40635);ct.TRACE_KEY="decorator:open_telemetry_key";function Trace(Z){return pt.DecoratorManager.createCustomMethodDecorator(ct.TRACE_KEY,{spanName:Z})}},57347:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MAIN_APPLICATION_KEY=ct.APPLICATION_KEY=ct.LOGGER_KEY=ct.PLUGIN_KEY=ct.CONFIG_KEY=ct.MS_HSF_METHOD_KEY=ct.MS_DUBBO_METHOD_KEY=ct.MS_GRPC_METHOD_KEY=ct.MS_PROVIDER_KEY=ct.MS_PRODUCER_KEY=ct.MS_CONSUMER_KEY=ct.WS_EVENT_KEY=ct.WS_CONTROLLER_KEY=ct.MODULE_TASK_QUEUE_OPTIONS=ct.MODULE_TASK_QUEUE_KEY=ct.MODULE_TASK_TASK_LOCAL_OPTIONS=ct.MODULE_TASK_TASK_LOCAL_KEY=ct.MODULE_TASK_METADATA=ct.MODULE_TASK_KEY=ct.WEB_RESPONSE_RENDER=ct.WEB_RESPONSE_CONTENT_TYPE=ct.WEB_RESPONSE_HEADER=ct.WEB_RESPONSE_REDIRECT=ct.WEB_RESPONSE_HTTP_CODE=ct.WEB_RESPONSE_KEY=ct.WEB_ROUTER_PARAM_KEY=ct.WEB_ROUTER_KEY=ct.CONTROLLER_KEY=ct.SERVERLESS_FUNC_KEY=ct.FUNC_KEY=ct.CUSTOM_PARAM_INJECT_KEY=ct.CUSTOM_METHOD_INJECT_KEY=ct.CUSTOM_PROPERTY_INJECT_KEY=ct.CONSTRUCTOR_INJECT_KEY=ct.PROPERTY_INJECT_KEY=ct.SCOPE_KEY=ct.PROVIDE_KEY=ct.OBJECT_DEFINITION_KEY=ct.PRE_START_MODULE_KEY=ct.FACTORY_SERVICE_CLIENT_KEY=ct.MOCK_KEY=ct.GUARD_KEY=ct.MATCH_KEY=ct.CATCH_KEY=ct.ASPECT_KEY=ct.FRAMEWORK_KEY=ct.CONFIGURATION_OBJECT_KEY=ct.CONFIGURATION_KEY=ct.SCHEDULE_KEY=ct.ALL_VALUE_KEY=void 0;ct.MAIN_MODULE_KEY=ct.CLASS_KEY_CONSTRUCTOR=ct.FUNCTIONAL_API_CONTROLLER_KEY=ct.APPLICATION_CONTEXT_KEY=void 0;ct.ALL_VALUE_KEY="common:all_value_key";ct.SCHEDULE_KEY="common:schedule";ct.CONFIGURATION_KEY="common:configuration";ct.CONFIGURATION_OBJECT_KEY="common:configuration_object";ct.FRAMEWORK_KEY="common:framework";ct.ASPECT_KEY="common:aspect";ct.CATCH_KEY="common:catch";ct.MATCH_KEY="common:match";ct.GUARD_KEY="common:guard";ct.MOCK_KEY="common:mock";ct.FACTORY_SERVICE_CLIENT_KEY="common:service_factory:client";ct.PRE_START_MODULE_KEY="common:pre_start_module";ct.OBJECT_DEFINITION_KEY="common:object_definition";ct.PROVIDE_KEY="common:provide";ct.SCOPE_KEY="common:scope";ct.PROPERTY_INJECT_KEY="common:property_inject";ct.CONSTRUCTOR_INJECT_KEY="common:constructor_inject";ct.CUSTOM_PROPERTY_INJECT_KEY="common:custom_property_inject";ct.CUSTOM_METHOD_INJECT_KEY="common:custom_method_inject";ct.CUSTOM_PARAM_INJECT_KEY="common:custom_param_inject";ct.FUNC_KEY="faas:func";ct.SERVERLESS_FUNC_KEY="faas:serverless:function";ct.CONTROLLER_KEY="web:controller";ct.WEB_ROUTER_KEY="web:router";ct.WEB_ROUTER_PARAM_KEY="web:router_param";ct.WEB_RESPONSE_KEY="web:response";ct.WEB_RESPONSE_HTTP_CODE="web:response_http_code";ct.WEB_RESPONSE_REDIRECT="web:response_redirect";ct.WEB_RESPONSE_HEADER="web:response_header";ct.WEB_RESPONSE_CONTENT_TYPE="web:response_content_type";ct.WEB_RESPONSE_RENDER="web:response_render";ct.MODULE_TASK_KEY="task:task";ct.MODULE_TASK_METADATA="task:task:options";ct.MODULE_TASK_TASK_LOCAL_KEY="task:task:task_local";ct.MODULE_TASK_TASK_LOCAL_OPTIONS="task:task:task_local:options";ct.MODULE_TASK_QUEUE_KEY="task:task:queue";ct.MODULE_TASK_QUEUE_OPTIONS="task:task:queue:options";ct.WS_CONTROLLER_KEY="ws:controller";ct.WS_EVENT_KEY="ws:event";ct.MS_CONSUMER_KEY="ms:consumer";ct.MS_PRODUCER_KEY="ms:producer";ct.MS_PROVIDER_KEY="ms:provider";ct.MS_GRPC_METHOD_KEY="ms:grpc:method";ct.MS_DUBBO_METHOD_KEY="ms:dubbo:method";ct.MS_HSF_METHOD_KEY="ms:hsf:method";ct.CONFIG_KEY="config";ct.PLUGIN_KEY="plugin";ct.LOGGER_KEY="logger";ct.APPLICATION_KEY="common:application";ct.MAIN_APPLICATION_KEY="common:main_application";ct.APPLICATION_CONTEXT_KEY="common:application_context";ct.FUNCTIONAL_API_CONTROLLER_KEY="functional:api_controller";ct.CLASS_KEY_CONSTRUCTOR="midway:class_key_constructor";ct.MAIN_MODULE_KEY="__main__"},40635:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.DecoratorManager=void 0;const pt=ut(57347);const dt=ut(44540);const ft=ut(53386);const _t=ut(53073);const mt=ut(88067);const ht=ut(35175);const yt=ut(28068);const vt=ut(39023).debuglog("midway:debug");class DecoratorManager{static moduleStore=new Map;static saveModule(Z,ct){if((0,ht.isClass)(ct)){this.saveProviderId(undefined,ct)}if(!this.moduleStore.has(Z)){this.moduleStore.set(Z,new Set)}this.moduleStore.get(Z).add(ct)}static listModule(Z,ct){const ut=[...this.moduleStore.get(Z)||[]];if(ct){return ut.filter(ct)}else{return ut}}static savePreStartModule(Z){this.saveModule(pt.PRE_START_MODULE_KEY,Z)}static listPreStartModule(){return this.listModule(pt.PRE_START_MODULE_KEY)}static resetModule(Z){this.moduleStore.set(Z,new Set)}static clearAllModule(){this.moduleStore.clear()}static saveProviderId(Z,ct){if(this.isProvide(ct)){if(Z){const ut=mt.MetadataManager.getOwnMetadata(pt.PROVIDE_KEY,ct);if(ut.id!==Z){ut.id=Z;mt.MetadataManager.defineMetadata(pt.PROVIDE_KEY,ut,ct);vt(`[core]: Update provide: ${ct.name} -> ${ut.uuid}`)}}}else{const ut=(0,ft.generateRandomId)();mt.MetadataManager.defineMetadata(pt.PROVIDE_KEY,{id:Z,originName:ct.name,uuid:ut,name:(0,dt.camelCase)(ct.name)},ct);vt(`[core]: Save provide: ${ct.name} -> ${ut}`)}return ct}static getProviderId(Z){const ct=mt.MetadataManager.getOwnMetadata(pt.PROVIDE_KEY,Z);if(ct&&ct.id){return ct.id}}static getProviderName(Z){const ct=mt.MetadataManager.getOwnMetadata(pt.PROVIDE_KEY,Z);if(ct&&ct.name){return ct.name}}static getProviderUUId(Z){const ct=mt.MetadataManager.getOwnMetadata(pt.PROVIDE_KEY,Z);if(ct&&ct.uuid){return ct.uuid}}static isProvide(Z){return!!mt.MetadataManager.getOwnMetadata(pt.PROVIDE_KEY,Z)}static createCustomPropertyDecorator(Z,ct,ut={impl:true}){const dt=typeof ut==="boolean"?{impl:ut}:ut;dt.impl=dt.impl??true;return function(ut,ft){mt.MetadataManager.attachMetadata(pt.CUSTOM_PROPERTY_INJECT_KEY,{propertyName:ft,key:Z,metadata:ct,options:dt},ut,ft)}}static createCustomMethodDecorator(Z,ct,ut={impl:true}){const dt=typeof ut==="boolean"?{impl:ut}:ut;dt.impl=dt.impl??true;return function(ut,ft){mt.MetadataManager.attachMetadata(pt.CUSTOM_METHOD_INJECT_KEY,{propertyName:ft,key:Z,metadata:ct,options:dt},ut)}}static createCustomParamDecorator(Z,ct,ut={impl:true}){if(typeof ut==="boolean"){ut={impl:ut}}if(ut.impl===undefined){ut.impl=true}return function(dt,ft,_t){mt.MetadataManager.attachMetadata(pt.CUSTOM_PARAM_INJECT_KEY,{key:Z,parameterIndex:_t,propertyName:ft,metadata:ct,options:ut},dt,ft)}}}ct.DecoratorManager=DecoratorManager;if(typeof globalThis==="object"&&globalThis["MIDWAY_GLOBAL_DECORATOR_MANAGER"]){console.warn('DecoratorManager not singleton and please check @midwayjs/core version by "npm ls @midwayjs/core"');const Z=(0,_t.getModuleRequirePathList)("@midwayjs/core");if(Z.length){console.info("The module may be located in:");Z.forEach(((Z,ct)=>{console.info(`${ct+1}. ${Z}`)}))}throw new yt.MidwayInconsistentVersionError}else{globalThis["MIDWAY_GLOBAL_DECORATOR_MANAGER"]=DecoratorManager}},6555:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ServerlessFunction=ServerlessFunction;ct.ServerlessTrigger=ServerlessTrigger;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function ServerlessFunction(Z){return(ct,ut,dt)=>{ft.MetadataManager.defineMetadata(pt.SERVERLESS_FUNC_KEY,Z,ct,ut)}}function ServerlessTrigger(Z,ct={}){return(ut,_t,mt)=>{if(Z===dt.ServerlessTriggerType.HTTP||Z===dt.ServerlessTriggerType.API_GATEWAY){ct["method"]=ct["method"]??"get"}pt.DecoratorManager.saveModule(pt.FUNC_KEY,ut.constructor);ct=ct||{};ft.MetadataManager.attachMetadata(pt.FUNC_KEY,{type:Z,methodName:_t,metadata:ct},ut)}}},25923:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.LazyInject=ct.InjectClient=ct.Inject=void 0;dt(ut(71652),ct);var ft=ut(35572);Object.defineProperty(ct,"Inject",{enumerable:true,get:function(){return ft.Inject}});Object.defineProperty(ct,"InjectClient",{enumerable:true,get:function(){return ft.InjectClient}});Object.defineProperty(ct,"LazyInject",{enumerable:true,get:function(){return ft.LazyInject}});dt(ut(28017),ct);dt(ut(88725),ct);dt(ut(70914),ct);dt(ut(73567),ct);dt(ut(13631),ct);dt(ut(61841),ct);dt(ut(75227),ct);dt(ut(16741),ct);dt(ut(82056),ct);dt(ut(88561),ct);dt(ut(35467),ct);dt(ut(5228),ct);dt(ut(6555),ct);dt(ut(68356),ct);dt(ut(75193),ct);dt(ut(35621),ct);dt(ut(84639),ct);dt(ut(57347),ct);dt(ut(40635),ct);dt(ut(35171),ct);dt(ut(63862),ct);dt(ut(32681),ct);dt(ut(49013),ct);dt(ut(2418),ct);dt(ut(77720),ct);dt(ut(27237),ct);dt(ut(61072),ct);dt(ut(78473),ct);dt(ut(30453),ct)},88067:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MetadataManager=void 0;ut(37159);const pt=ut(35175);const dt=" ";var ft;(function(Z){Z["Class"]="class";Z["Instance"]="instance";Z["Object"]="object"})(ft||(ft={}));class MetadataManager{static _metadataStore=new WeakMap;static metadataClassSymbol=Symbol.for("midway.metadata.class");static metadataPropertySymbol=Symbol.for("midway.metadata.property");static cacheSymbol=Symbol.for("midway.metadata.cache");static cleanHooksSymbol=Symbol.for("midway.clean.hooks");static isClassSymbol=Symbol.for("midway.metadata.isClass");static ObjectType=ft;static emptyValueSymbol=Symbol.for("midway.metadata.empty");static defineMetadata(Z,ct,ut,pt){ut=this.formatTarget(ut);this.setMetadata(Z,ct,ut,pt);this.invalidateCache(Z,ut,pt)}static attachMetadata(Z,ct,ut,pt){ut=this.formatTarget(ut);const dt=this.getOwnMetadata(Z,ut,pt);if(Array.isArray(dt)){dt.push(ct);this.defineMetadata(Z,dt,ut,pt)}else{this.defineMetadata(Z,[ct],ut,pt)}}static getMetadata(Z,ct,ut){ct=this.formatTarget(ct);const pt=this.getCache(Z,ct,ut);if(pt===this.emptyValueSymbol){return undefined}if(pt!==undefined){return pt}let dt=ct;while(dt){const pt=this.getOwnMetadata(Z,dt,ut);if(pt!==undefined){this.setCache(Z,ct,dt,pt,ut);return pt}dt=Object.getPrototypeOf(dt)}this.setCache(Z,ct,ct,this.emptyValueSymbol,ut);return undefined}static getOwnMetadata(Z,ct,ut){ct=this.formatTarget(ct);const pt=this.getOrCreateMetaObject(ct);if(ut){return pt[this.metadataPropertySymbol][ut]?.[Z]}else{return pt[this.metadataClassSymbol][Z]}}static hasMetadata(Z,ct,ut){ct=this.formatTarget(ct);return this.getMetadata(Z,ct,ut)!==undefined}static hasOwnMetadata(Z,ct,ut){return this.getOwnMetadata(Z,ct,ut)!==undefined}static deleteMetadata(Z,ct,ut){ct=this.formatTarget(ct);const pt=this.getOrCreateMetaObject(ct);if(ut){delete pt[this.metadataPropertySymbol][ut]?.[Z]}else{delete pt[this.metadataClassSymbol][Z]}this.invalidateCache(Z,ct,ut)}static getMetadataKeys(Z,ct){Z=this.formatTarget(Z);const ut=new Set;let pt=Z;while(pt){const Z=this.getOwnMetadataKeys(pt,ct);Z.forEach((Z=>ut.add(Z)));pt=Object.getPrototypeOf(pt)}return Array.from(ut)}static getOwnMetadataKeys(Z,ct){Z=this.formatTarget(Z);const ut=this.getOrCreateMetaObject(Z);if(ct){return Object.keys(ut[this.metadataPropertySymbol][ct]||{})}else{return Object.keys(ut[this.metadataClassSymbol])}}static copyMetadata(Z,ct,ut){const{metadataFilter:pt,overwrite:dt=true}=ut||{};const ft={};const _t={};let mt=Z;while(mt){const Z=this.getOrCreateMetaObject(mt);const ct=Z?.[this.metadataClassSymbol];for(const Z in ct){if(ft[Z]===undefined){ft[Z]=ct[Z]}}const ut=Z?.[this.metadataPropertySymbol];for(const Z in ut){if(!_t[Z]){_t[Z]={}}const ct=Object.keys(ut[Z]);for(const pt of ct){if(_t[Z][pt]===undefined){_t[Z][pt]=ut[Z][pt]}}}mt=Object.getPrototypeOf(mt)}this.copyClassAndPropertyMetadata(ct,pt,dt,ft,_t)}static copyOwnMetadata(Z,ct,ut){const{metadataFilter:pt,overwrite:dt=true}=ut||{};const ft=this.getOrCreateMetaObject(Z);const _t=ft?.[this.metadataClassSymbol];const mt=ft?.[this.metadataPropertySymbol];this.copyClassAndPropertyMetadata(ct,pt,dt,_t,mt)}static getOwnPropertiesWithMetadata(Z,ct){ct=this.formatTarget(ct);const ut=this.getOrCreateMetaObject(ct);return Object.keys(ut[this.metadataPropertySymbol]).reduce(((ct,pt)=>{const dt=ut[this.metadataPropertySymbol][pt]?.[Z];if(dt!==undefined){ct[pt]=dt}return ct}),{})}static getPropertiesWithMetadata(Z,ct){const ut={};let pt=this.formatTarget(ct);while(pt){const ct=this.getOrCreateMetaObject(pt);Object.keys(ct[this.metadataPropertySymbol]).forEach((pt=>{const dt=ct[this.metadataPropertySymbol][pt]?.[Z];if(dt!==undefined&&ut[pt]===undefined){ut[pt]=dt}}));pt=Object.getPrototypeOf(pt)}return ut}static getMethodReturnTypes(Z,ct){if((0,pt.isClass)(Z)){Z=Z.prototype}return Reflect.getMetadata("design:returntype",Z,ct)}static getMethodParamTypes(Z,ct,ut){if(ct&&(0,pt.isClass)(Z)){Z=Z.prototype}const dt=Reflect.getMetadata("design:paramtypes",Z,ct);if(ut!==undefined&&dt){return dt[ut]}return dt}static getPropertyType(Z,ct){if((0,pt.isClass)(Z)){Z=Z.prototype}return Reflect.getMetadata("design:type",Z,ct)}static transformTypeFromTSDesign(Z){if((0,pt.isNullOrUndefined)(Z)){return{name:"undefined",isBaseType:true,originDesign:Z}}switch(Z.name){case"String":return{name:"string",isBaseType:true,originDesign:Z};case"Number":return{name:"number",isBaseType:true,originDesign:Z};case"Boolean":return{name:"boolean",isBaseType:true,originDesign:Z};case"Symbol":return{name:"symbol",isBaseType:true,originDesign:Z};case"Object":return{name:"object",isBaseType:true,originDesign:Z};case"Function":return{name:"function",isBaseType:true,originDesign:Z};default:return{name:Z.name,isBaseType:false,originDesign:Z}}}static copyClassAndPropertyMetadata(Z,ct,ut,pt,dt){for(const dt in pt){if(!ct||ct(dt)){const ct=pt[dt];if(!ut&&this.hasOwnMetadata(dt,Z))continue;this.defineMetadata(dt,ct,Z)}}for(const pt in dt){const ft=Object.keys(dt[pt]);for(const _t of ft){if(!ct||ct(_t,pt)){const ct=dt[pt][_t];if(!ut&&this.hasOwnMetadata(_t,Z,pt))continue;this.defineMetadata(_t,ct,Z,pt)}}}}static setMetadata(Z,ct,ut,pt){const dt=this.getOrCreateMetaObject(ut);const ft=pt?dt[this.metadataPropertySymbol][pt]||={}:dt[this.metadataClassSymbol];ft[Z]=ct}static getOrCreateMetaObject(Z){if(!this._metadataStore.has(Z)){this._metadataStore.set(Z,{[this.metadataClassSymbol]:Object.create(null),[this.metadataPropertySymbol]:Object.create(null)})}return this._metadataStore.get(Z)}static invalidateCache(Z,ct,ut){const pt=this.getUnionKey(Z,ut);if(this.hasOwnProperty(ct,this.cacheSymbol)){delete this.getOwnProperty(ct,this.cacheSymbol)?.[pt]}const dt=this.getOwnProperty(ct,this.cleanHooksSymbol);if(dt){this.setOwnProperty(ct,this.cleanHooksSymbol,dt.filter((Z=>!Z(pt))))}}static setCache(Z,ct,ut,pt,dt){this.validCacheConstruct(ct);const ft=this.getUnionKey(Z,dt);if(ct!==ut){this.validCacheConstruct(ut);this.getOwnProperty(ut,this.cleanHooksSymbol).push((Z=>{if(Z===ft){delete this.getOwnProperty(ct,this.cacheSymbol)?.[ft];return true}return false}))}this.getOwnProperty(ct,this.cacheSymbol)[ft]=pt}static validCacheConstruct(Z){const ct=this.getOrCreateMetaObject(Z);if(!ct[this.cacheSymbol]){ct[this.cacheSymbol]=Object.create(null)}if(!ct[this.cleanHooksSymbol]){ct[this.cleanHooksSymbol]=[]}}static getCache(Z,ct,ut){return this.getOwnProperty(ct,this.cacheSymbol)?.[this.getUnionKey(Z,ut)]}static getUnionKey(Z,ct){return ct?`${ct.toString()}${dt}${Z.toString()}`:Z.toString()}static formatTarget(Z){let ct=this.getOwnProperty(Z,this.isClassSymbol);if(!ct){const ut=(0,pt.isClass)(Z);if(ut){ct=ft.Class}else if((0,pt.isClass)(Z.constructor)){ct=ft.Instance}else{ct=ft.Object}this.setOwnProperty(Z,this.isClassSymbol,ct)}return ct===ft.Instance?Z.constructor:Z}static ensureTargetType(Z,ct){const ut=this.getOwnProperty(Z,this.isClassSymbol);if(!ut){this.setOwnProperty(Z,this.isClassSymbol,ct)}}static getOwnProperty(Z,ct){const ut=this.getOrCreateMetaObject(Z);return ut[ct]??undefined}static hasOwnProperty(Z,ct){if(!this._metadataStore.has(Z)){return false}const ut=this._metadataStore.get(Z);return ut[ct]!==undefined}static setOwnProperty(Z,ct,ut){const pt=this.getOrCreateMetaObject(Z);pt[ct]=ut}static clear(){this._metadataStore=new WeakMap}}ct.MetadataManager=MetadataManager},35171:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Consumer=Consumer;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function Consumer(Z,ct={}){return ut=>{pt.DecoratorManager.saveModule(pt.MS_CONSUMER_KEY,ut);ft.MetadataManager.defineMetadata(pt.MS_CONSUMER_KEY,{type:Z,metadata:ct},ut);(0,pt.Scope)(dt.ScopeEnum.Request)(ut);(0,pt.Provide)()(ut)}}},49013:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.KafkaListener=KafkaListener;const pt=ut(25923);const dt=ut(32673);function KafkaListener(Z,ct={}){return(ut,ft)=>{ct.topic=Z;ct.propertyKey=ft;(0,dt.attachPropertyDataToClass)(pt.MS_CONSUMER_KEY,ct,ut,ft)}}},63862:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.GrpcStreamTypeEnum=void 0;ct.Provider=Provider;ct.GrpcMethod=GrpcMethod;ct.DubboMethod=DubboMethod;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function Provider(Z,ct={}){return ut=>{pt.DecoratorManager.saveModule(pt.MS_PROVIDER_KEY,ut);ft.MetadataManager.defineMetadata(pt.MS_PROVIDER_KEY,{type:Z,metadata:ct},ut);(0,pt.Scope)(dt.ScopeEnum.Request)(ut);(0,pt.Provide)()(ut)}}var _t;(function(Z){Z["BASE"]="base";Z["DUPLEX"]="ServerDuplexStream";Z["READABLE"]="ServerReadableStream";Z["WRITEABLE"]="ServerWritableStream"})(_t||(ct.GrpcStreamTypeEnum=_t={}));function GrpcMethod(Z={}){return(ct,ut,dt)=>{if(!Z.type){Z.type=_t.BASE}ft.MetadataManager.defineMetadata(pt.MS_GRPC_METHOD_KEY,{methodName:Z.methodName||ut,type:Z.type,onEnd:Z.onEnd},ct,ut);return dt}}function DubboMethod(Z){return(ct,ut,dt)=>{ft.MetadataManager.attachMetadata(pt.MS_DUBBO_METHOD_KEY,{methodName:Z||ut},ct);return dt}}},32681:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.RabbitMQListener=RabbitMQListener;const pt=ut(25923);const dt=ut(32673);function RabbitMQListener(Z,ct={}){return(ut,ft)=>{ct.queueName=Z;ct.propertyKey=ft;(0,dt.attachPropertyDataToClass)(pt.MS_CONSUMER_KEY,ct,ut,ft)}}},2418:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Queue=Queue;const pt=ut(25923);const dt=ut(57347);const ft=ut(88067);function Queue(Z){return function(ct){pt.DecoratorManager.saveModule(dt.MODULE_TASK_QUEUE_KEY,ct);ft.MetadataManager.defineMetadata(dt.MODULE_TASK_QUEUE_OPTIONS,{options:Z,name:ct.name},ct);(0,pt.Provide)()(ct)}}},61072:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Schedule=Schedule;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function Schedule(Z){return function(ct){pt.DecoratorManager.saveModule(pt.SCHEDULE_KEY,ct);ft.MetadataManager.defineMetadata(pt.SCHEDULE_KEY,Z,ct);(0,pt.Scope)(dt.ScopeEnum.Request)(ct);(0,pt.Provide)()(ct)}}},77720:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Task=Task;const pt=ut(57347);const dt=ut(40635);const ft=ut(88067);function Task(Z){return function(ct,ut,_t){dt.DecoratorManager.saveModule(pt.MODULE_TASK_KEY,ct.constructor);ft.MetadataManager.attachMetadata(pt.MODULE_TASK_METADATA,{options:Z,propertyKey:ut,value:_t.value,name:ct.constructor.name},ct)}}},27237:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.TaskLocal=TaskLocal;const pt=ut(57347);const dt=ut(40635);const ft=ut(88067);function TaskLocal(Z){return function(ct,ut,_t){dt.DecoratorManager.saveModule(pt.MODULE_TASK_TASK_LOCAL_KEY,ct.constructor);ft.MetadataManager.attachMetadata(pt.MODULE_TASK_TASK_LOCAL_OPTIONS,{options:Z,propertyKey:ut,value:_t.value},ct)}}},68356:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Controller=Controller;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function Controller(Z="/",ct={middleware:[],sensitive:true}){return ut=>{pt.DecoratorManager.saveModule(pt.CONTROLLER_KEY,ut);if(Z)ft.MetadataManager.defineMetadata(pt.CONTROLLER_KEY,{prefix:Z,routerOptions:ct},ut);(0,pt.Scope)(dt.ScopeEnum.Request)(ut);(0,pt.Provide)()(ut)}}},75193:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Fields=ct.Queries=ct.RequestIP=ct.RequestPath=ct.Files=ct.File=ct.Headers=ct.Param=ct.Query=ct.Body=ct.Session=ct.createRequestParamDecorator=ct.RouteParamTypes=void 0;const pt=ut(25923);var dt;(function(Z){Z["QUERY"]="query";Z["BODY"]="body";Z["PARAM"]="param";Z["HEADERS"]="headers";Z["SESSION"]="session";Z["FILESTREAM"]="file_stream";Z["FILESSTREAM"]="files_stream";Z["NEXT"]="next";Z["REQUEST_PATH"]="request_path";Z["REQUEST_IP"]="request_ip";Z["QUERIES"]="queries";Z["FIELDS"]="fields";Z["CUSTOM"]="custom"})(dt||(ct.RouteParamTypes=dt={}));const createParamMapping=function(Z){return(ct,ut={})=>{let dt=ct;if(Array.isArray(ct)&&ut.pipes===undefined){ut.pipes=ct;dt=undefined}return pt.DecoratorManager.createCustomParamDecorator(pt.WEB_ROUTER_PARAM_KEY,{type:Z,propertyData:dt},ut)}};const createRequestParamDecorator=function(Z,ct){ct=ct||{};if(Array.isArray(ct)){ct={pipes:ct}}return createParamMapping(dt.CUSTOM)(Z,ct)};ct.createRequestParamDecorator=createRequestParamDecorator;const Session=(Z,ct)=>createParamMapping(dt.SESSION)(Z,{pipes:ct});ct.Session=Session;const Body=(Z,ct)=>createParamMapping(dt.BODY)(Z,{pipes:ct});ct.Body=Body;const Query=(Z,ct)=>createParamMapping(dt.QUERY)(Z,{pipes:ct});ct.Query=Query;const Param=(Z,ct)=>createParamMapping(dt.PARAM)(Z,{pipes:ct});ct.Param=Param;const Headers=(Z,ct)=>createParamMapping(dt.HEADERS)(Z,{pipes:ct});ct.Headers=Headers;const File=(Z,ct)=>createParamMapping(dt.FILESTREAM)(Z,{pipes:ct});ct.File=File;const Files=(Z,ct)=>createParamMapping(dt.FILESSTREAM)(Z,{pipes:ct});ct.Files=Files;const RequestPath=Z=>createParamMapping(dt.REQUEST_PATH)(undefined,{pipes:Z});ct.RequestPath=RequestPath;const RequestIP=Z=>createParamMapping(dt.REQUEST_IP)(undefined,{pipes:Z});ct.RequestIP=RequestIP;const Queries=(Z,ct)=>createParamMapping(dt.QUERIES)(Z,{pipes:ct});ct.Queries=Queries;const Fields=(Z,ct)=>createParamMapping(dt.FIELDS)(Z,{pipes:ct});ct.Fields=Fields},35621:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.All=ct.Head=ct.Options=ct.Patch=ct.Put=ct.Del=ct.Get=ct.Post=ct.RequestMapping=ct.RequestMethod=void 0;const pt=ut(25923);const dt=ut(88067);ct.RequestMethod={GET:"get",POST:"post",PUT:"put",DELETE:"delete",PATCH:"patch",ALL:"all",OPTIONS:"options",HEAD:"head"};const ft={path:"/",requestMethod:ct.RequestMethod.GET,routerName:null,middleware:[]};const RequestMapping=(Z=ft)=>{const ut=Z.path||"/";const _t=Z.requestMethod||ct.RequestMethod.GET;const mt=Z.routerName;const ht=Z.middleware;return(ct,ft,yt)=>{const vt=Object.prototype.hasOwnProperty.call(Z,"ignoreGlobalPrefix")&&Z?.ignoreGlobalPrefix!==undefined;const St={path:ut,requestMethod:_t,routerName:mt,method:ft,middleware:ht,summary:Z?.summary||"",description:Z?.description||"",ignoreGlobalPrefix:vt?Z?.ignoreGlobalPrefix:false};Object.defineProperty(St,"__ignoreGlobalPrefixConfigured",{value:vt,enumerable:false,configurable:false,writable:false});dt.MetadataManager.attachMetadata(pt.WEB_ROUTER_KEY,St,ct);return yt}};ct.RequestMapping=RequestMapping;const createMappingDecorator=Z=>(ut,pt={middleware:[]})=>(0,ct.RequestMapping)(Object.assign(pt,{requestMethod:Z,path:ut}));ct.Post=createMappingDecorator(ct.RequestMethod.POST);ct.Get=createMappingDecorator(ct.RequestMethod.GET);ct.Del=createMappingDecorator(ct.RequestMethod.DELETE);ct.Put=createMappingDecorator(ct.RequestMethod.PUT);ct.Patch=createMappingDecorator(ct.RequestMethod.PATCH);ct.Options=createMappingDecorator(ct.RequestMethod.OPTIONS);ct.Head=createMappingDecorator(ct.RequestMethod.HEAD);ct.All=createMappingDecorator(ct.RequestMethod.ALL)},84639:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Redirect=Redirect;ct.HttpCode=HttpCode;ct.SetHeader=SetHeader;ct.ContentType=ContentType;ct.createRender=createRender;const pt=ut(25923);const dt=ut(88067);function Redirect(Z,ct=302){return(ut,ft,_t)=>{dt.MetadataManager.attachMetadata(pt.WEB_RESPONSE_KEY,{type:pt.WEB_RESPONSE_REDIRECT,url:Z,code:ct},ut,ft);return _t}}function HttpCode(Z){return(ct,ut,ft)=>{dt.MetadataManager.attachMetadata(pt.WEB_RESPONSE_KEY,{type:pt.WEB_RESPONSE_HTTP_CODE,code:Z},ct,ut);return ft}}function SetHeader(Z,ct){return(ut,ft,_t)=>{let mt={};if(ct){mt[Z]=ct}else{mt=Z}dt.MetadataManager.attachMetadata(pt.WEB_RESPONSE_KEY,{type:pt.WEB_RESPONSE_HEADER,setHeaders:mt},ut,ft);return _t}}function ContentType(Z){return(ct,ut,ft)=>{dt.MetadataManager.attachMetadata(pt.WEB_RESPONSE_KEY,{type:pt.WEB_RESPONSE_CONTENT_TYPE,contentType:Z},ct,ut);return ft}}function createRender(Z){return Z=>(ct,ut,ft)=>{dt.MetadataManager.attachMetadata(pt.WEB_RESPONSE_KEY,{type:pt.WEB_RESPONSE_RENDER,templateName:Z},ct,ut);return ft}}},78473:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.WSController=WSController;const pt=ut(25923);const dt=ut(77866);const ft=ut(88067);function WSController(Z="/",ct={middleware:[],connectionMiddleware:[]}){return ut=>{pt.DecoratorManager.saveModule(pt.WS_CONTROLLER_KEY,ut);ft.MetadataManager.defineMetadata(pt.WS_CONTROLLER_KEY,{namespace:Z,routerOptions:ct},ut);(0,pt.Scope)(dt.ScopeEnum.Request)(ut);(0,pt.Provide)()(ut)}}},30453:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.OnConnection=ct.OnDisConnection=ct.Emit=ct.OnMessage=ct.WSEventTypeEnum=void 0;ct.OnWSConnection=OnWSConnection;ct.OnWSDisConnection=OnWSDisConnection;ct.OnWSMessage=OnWSMessage;ct.WSEmit=WSEmit;ct.WSBroadCast=WSBroadCast;const pt=ut(25923);const dt=ut(88067);var ft;(function(Z){Z["ON_CONNECTION"]="ws:onConnection";Z["ON_DISCONNECTION"]="ws:onDisconnection";Z["ON_MESSAGE"]="ws:onMessage";Z["ON_SOCKET_ERROR"]="ws:onSocketError";Z["EMIT"]="ws:Emit";Z["BROADCAST"]="ws:broadcast"})(ft||(ct.WSEventTypeEnum=ft={}));function OnWSConnection(Z={}){return(ct,ut,_t)=>{dt.MetadataManager.attachMetadata(pt.WS_EVENT_KEY,{eventType:ft.ON_CONNECTION,propertyName:ut,eventOptions:Z,descriptor:_t},ct.constructor)}}function OnWSDisConnection(){return(Z,ct,ut)=>{dt.MetadataManager.attachMetadata(pt.WS_EVENT_KEY,{eventType:ft.ON_DISCONNECTION,propertyName:ct,descriptor:ut},Z.constructor)}}function OnWSMessage(Z,ct={}){return(ut,_t,mt)=>{dt.MetadataManager.attachMetadata(pt.WS_EVENT_KEY,{eventType:ft.ON_MESSAGE,messageEventName:Z,propertyName:_t,eventOptions:ct,descriptor:mt},ut.constructor)}}function WSEmit(Z,ct=[]){return(ut,_t,mt)=>{dt.MetadataManager.attachMetadata(pt.WS_EVENT_KEY,{eventType:ft.EMIT,propertyName:_t,messageEventName:Z,roomName:[].concat(ct),descriptor:mt},ut.constructor)}}function WSBroadCast(Z="",ct=[]){return(ut,_t,mt)=>{dt.MetadataManager.attachMetadata(pt.WS_EVENT_KEY,{eventType:ft.BROADCAST,propertyName:_t,messageEventName:Z,roomName:[].concat(ct),descriptor:mt},ut.constructor)}}ct.OnMessage=OnWSMessage;ct.Emit=WSEmit;ct.OnDisConnection=OnWSDisConnection;ct.OnConnection=OnWSConnection},57211:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.FunctionDefinition=void 0;const pt=ut(77866);const dt=ut(35289);class FunctionWrapperCreator extends dt.ObjectCreator{type="function";doConstruct(Z,ct){return Z}doInit(Z,ct){return Z(ct)}async doInitAsync(Z,ct){return Z(ct)}}class FunctionDefinition{constructor(){this.creator=new FunctionWrapperCreator(this)}constructMethod;constructorArgs=[];creator;dependsOn;destroyMethod;export;id;name;initMethod;srcPath;path;properties;namespace="";asynchronous=true;handlerProps=[];createFrom;allowDowngrade=false;innerAutowire=false;innerScope=pt.ScopeEnum.Singleton;getAttr(Z){}hasAttr(Z){return false}hasConstructorArgs(){return false}hasDependsOn(){return false}isAsync(){return this.asynchronous}isDirect(){return false}isExternal(){return false}set scope(Z){this.innerScope=Z}isSingletonScope(){return this.innerScope===pt.ScopeEnum.Singleton}isRequestScope(){return this.innerScope===pt.ScopeEnum.Request}setAttr(Z,ct){}}ct.FunctionDefinition=FunctionDefinition},35289:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ObjectCreator=void 0;const pt=ut(28068);const dt=ut(35175);class ObjectCreator{definition;type="object";constructor(Z){this.definition=Z}load(){let Z=null;if(typeof this.definition.path==="string"){if(!this.definition.path){return Z}const ct=this.definition.path;if(this.definition.export){Z=require(ct)[this.definition.export]}else{Z=require(ct)}}else{Z=this.definition.path}return Z}doConstruct(Z,ct){if(!Z){return Object.create(null)}let ut;if(this.definition.constructMethod){ut=Z[this.definition.constructMethod].apply(Z,ct)}else{ut=Reflect.construct(Z,ct)}return ut}doInit(Z,ct){const ut=Z;if(this.definition.initMethod&&ut[this.definition.initMethod]){if(dt.Types.isGeneratorFunction(ut[this.definition.initMethod])||dt.Types.isAsyncFunction(ut[this.definition.initMethod])){throw new pt.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}else{const Z=ut[this.definition.initMethod].call(ut);if(dt.Types.isPromise(Z)){throw new pt.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}}}}async doInitAsync(Z,ct){const ut=Z;if(this.definition.initMethod&&ut[this.definition.initMethod]){const Z=ut[this.definition.initMethod];if(dt.Types.isAsyncFunction(Z)){await Z.call(ut)}else{if(Z.length===1){await new Promise((ct=>{Z.call(ut,ct)}))}else{Z.call(ut)}}}}doDestroy(Z){if(this.definition.destroyMethod&&Z[this.definition.destroyMethod]){Z[this.definition.destroyMethod].call(Z)}}async doDestroyAsync(Z){if(Z&&this.definition.destroyMethod&&Z[this.definition.destroyMethod]){const ct=Z[this.definition.destroyMethod];if(dt.Types.isAsyncFunction(ct)){await ct.call(Z)}else{if(ct.length===1){await new Promise((ut=>{ct.call(Z,ut)}))}else{ct.call(Z)}}}}}ct.ObjectCreator=ObjectCreator},99648:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ObjectDefinition=void 0;const pt=ut(77866);const dt=ut(35289);class ObjectDefinition{_attrs=new Map;_asynchronous=false;scope=pt.ScopeEnum.Singleton;creator=null;id=null;name=null;initMethod=null;destroyMethod=null;constructMethod=null;constructorArgs=[];srcPath;path=null;export=null;dependsOn=[];properties=new Map;namespace="";handlerProps=[];createFrom;allowDowngrade=false;constructor(){this.creator=new dt.ObjectCreator(this)}set asynchronous(Z){this._asynchronous=Z}isAsync(){return this._asynchronous}isSingletonScope(){return this.scope===pt.ScopeEnum.Singleton}isRequestScope(){return this.scope===pt.ScopeEnum.Request}hasDependsOn(){return this.dependsOn.length>0}hasConstructorArgs(){return this.constructorArgs.length>0}getAttr(Z){return this._attrs.get(Z)}hasAttr(Z){return this._attrs.has(Z)}setAttr(Z,ct){this._attrs.set(Z,ct)}}ct.ObjectDefinition=ObjectDefinition},16683:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayHttpError=ct.MidwayError=void 0;ct.registerErrorCode=registerErrorCode;const pt=ut(58611);const dt=new Set;function registerErrorCode(Z,ct){if(dt.has(Z)){throw new MidwayError(`Error group ${Z} is duplicated, please check before adding.`)}else{dt.add(Z)}const ut={};for(const pt in ct){ut[pt]=Z.toUpperCase()+"_"+String(ct[pt]).toUpperCase()}return ut}class MidwayError extends Error{code;cause;constructor(Z,ct,ut){super(Z);if(!ct||typeof ct==="object"){ut=ct;ct="MIDWAY_10000"}this.name=this.constructor.name;this.code=ct;this.cause=ut?.cause}}ct.MidwayError=MidwayError;class MidwayHttpError extends MidwayError{status;constructor(Z,ct,ut,dt){super(Z?typeof Z==="string"?Z:Z.message:pt.STATUS_CODES[ct],ut??String(ct),dt);if(Z&&Z["stack"]){this.stack=Z["stack"]}this.status=ct}}ct.MidwayHttpError=MidwayHttpError},70084:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayEmptyValueError=ct.MidwayInvalidConfigPropertyError=ct.MidwayMainFrameworkMissingError=ct.MidwayCodeInvokeTimeoutError=ct.MidwayInvokeForbiddenError=ct.MidwayRetryExceededMaxTimesError=ct.MidwayDuplicateControllerOptionsError=ct.MidwayDuplicateClassNameError=ct.MidwayInconsistentVersionError=ct.MidwayUtilHttpClientTimeoutError=ct.MidwayMissingImportComponentError=ct.MidwaySingletonInjectRequestError=ct.MidwayUseWrongMethodError=ct.MidwayDuplicateRouteError=ct.MidwayInvalidConfigError=ct.MidwayConfigMissingError=ct.MidwayFeatureNotImplementedError=ct.MidwayFeatureNoLongerSupportedError=ct.MidwayDefinitionNotFoundError=ct.MidwayParameterError=ct.MidwayCommonError=ct.FrameworkErrorEnum=void 0;const pt=ut(16683);ct.FrameworkErrorEnum=(0,pt.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 pt.MidwayError{constructor(Z){super(Z,ct.FrameworkErrorEnum.COMMON)}}ct.MidwayCommonError=MidwayCommonError;class MidwayParameterError extends pt.MidwayError{constructor(Z){super(Z??"Parameter type not match",ct.FrameworkErrorEnum.PARAM_TYPE)}}ct.MidwayParameterError=MidwayParameterError;class MidwayDefinitionNotFoundError extends pt.MidwayError{constructor(Z,ut,pt){super(pt?`Definition for "${ut??Z}" not found in current context. Detection path: "${pt.join(" -> ")}"`:`Definition for "${ut??Z}" not found in current context.`,ct.FrameworkErrorEnum.DEFINITION_NOT_FOUND)}}ct.MidwayDefinitionNotFoundError=MidwayDefinitionNotFoundError;class MidwayFeatureNoLongerSupportedError extends pt.MidwayError{constructor(Z){super("This feature no longer supported \n"+Z,ct.FrameworkErrorEnum.FEATURE_NO_LONGER_SUPPORTED)}}ct.MidwayFeatureNoLongerSupportedError=MidwayFeatureNoLongerSupportedError;class MidwayFeatureNotImplementedError extends pt.MidwayError{constructor(Z){super("This feature not implemented \n"+Z,ct.FrameworkErrorEnum.FEATURE_NOT_IMPLEMENTED)}}ct.MidwayFeatureNotImplementedError=MidwayFeatureNotImplementedError;class MidwayConfigMissingError extends pt.MidwayError{constructor(Z){super(`Can't found config key "${Z}" in your config, please set it first`,ct.FrameworkErrorEnum.MISSING_CONFIG)}}ct.MidwayConfigMissingError=MidwayConfigMissingError;class MidwayInvalidConfigError extends pt.MidwayError{constructor(Z){super("Invalid config file \n"+Z,ct.FrameworkErrorEnum.INVALID_CONFIG)}}ct.MidwayInvalidConfigError=MidwayInvalidConfigError;class MidwayDuplicateRouteError extends pt.MidwayError{payload;constructor(Z,ut,pt,dt){super(`Duplicate router "${Z}" at "${ut}" and "${pt}"`,ct.FrameworkErrorEnum.DUPLICATE_ROUTER);this.payload=dt}}ct.MidwayDuplicateRouteError=MidwayDuplicateRouteError;class MidwayUseWrongMethodError extends pt.MidwayError{constructor(Z,ut,pt){const dt=pt?`${pt} not valid by ${Z}, Use ${ut} instead!`:`You should not invoked by ${Z}, Use ${ut} instead!`;super(dt,ct.FrameworkErrorEnum.USE_WRONG_METHOD)}}ct.MidwayUseWrongMethodError=MidwayUseWrongMethodError;class MidwaySingletonInjectRequestError extends pt.MidwayError{constructor(Z,ut){const pt=`${Z} with singleton scope can't implicitly inject ${ut} with request scope directly, please add "@Scope(ScopeEnum.Request, { allowDowngrade: true })" in ${ut} or use "ctx.requestContext.getAsync(${ut})".`;super(pt,ct.FrameworkErrorEnum.SINGLETON_INJECT_REQUEST)}}ct.MidwaySingletonInjectRequestError=MidwaySingletonInjectRequestError;class MidwayMissingImportComponentError extends pt.MidwayError{constructor(Z){const ut=`"${Z}" can't inject and maybe forgot add "{imports: [***]}" in @Configuration.`;super(ut,ct.FrameworkErrorEnum.MISSING_IMPORTS)}}ct.MidwayMissingImportComponentError=MidwayMissingImportComponentError;class MidwayUtilHttpClientTimeoutError extends pt.MidwayError{constructor(Z){super(Z,ct.FrameworkErrorEnum.UTIL_HTTP_TIMEOUT)}}ct.MidwayUtilHttpClientTimeoutError=MidwayUtilHttpClientTimeoutError;class MidwayInconsistentVersionError extends pt.MidwayError{constructor(){const Z='We find a different "@midwayjs/core" package installed, please remove the lock file and use "(p)npm update" to upgrade all dependencies first.';super(Z,ct.FrameworkErrorEnum.INCONSISTENT_VERSION)}}ct.MidwayInconsistentVersionError=MidwayInconsistentVersionError;class MidwayDuplicateClassNameError extends pt.MidwayError{constructor(Z,ut,pt){super(`"${Z}" duplicated between "${ut}" and "${pt}"`,ct.FrameworkErrorEnum.DUPLICATE_CLASS_NAME)}}ct.MidwayDuplicateClassNameError=MidwayDuplicateClassNameError;class MidwayDuplicateControllerOptionsError extends pt.MidwayError{constructor(Z,ut,pt){super(`"Prefix ${Z}" with duplicated controller options between "${ut}" and "${pt}"`,ct.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS)}}ct.MidwayDuplicateControllerOptionsError=MidwayDuplicateControllerOptionsError;class MidwayRetryExceededMaxTimesError extends pt.MidwayError{constructor(Z,ut,pt){super(`Invoke "${Z}" retries exceeded the maximum number of times(${ut}), error: ${pt.message}`,ct.FrameworkErrorEnum.RETRY_OVER_MAX_TIME,{cause:pt})}}ct.MidwayRetryExceededMaxTimesError=MidwayRetryExceededMaxTimesError;class MidwayInvokeForbiddenError extends pt.MidwayError{constructor(Z,ut){super(`Invoke "${ut?ut.name:"unknown"}.${Z}" is forbidden.`,ct.FrameworkErrorEnum.INVOKE_METHOD_FORBIDDEN)}}ct.MidwayInvokeForbiddenError=MidwayInvokeForbiddenError;class MidwayCodeInvokeTimeoutError extends pt.MidwayError{constructor(Z,ut,pt){super(pt?`Function "${Z}" of "${pt}" call more than ${ut}ms`:`Function "${Z}" call more than ${ut}ms`,ct.FrameworkErrorEnum.CODE_INVOKE_TIMEOUT)}}ct.MidwayCodeInvokeTimeoutError=MidwayCodeInvokeTimeoutError;class MidwayMainFrameworkMissingError extends pt.MidwayError{constructor(){super("Main framework missing, please check your configuration.",ct.FrameworkErrorEnum.MAIN_FRAMEWORK_MISSING)}}ct.MidwayMainFrameworkMissingError=MidwayMainFrameworkMissingError;class MidwayInvalidConfigPropertyError extends pt.MidwayError{constructor(Z,ut){super(`Invalid config property "${Z}", ${ut?`only ${ut.join(",")} can be set`:"please check your configuration"}.`,ct.FrameworkErrorEnum.INVALID_CONFIG_PROPERTY)}}ct.MidwayInvalidConfigPropertyError=MidwayInvalidConfigPropertyError;class MidwayEmptyValueError extends pt.MidwayError{constructor(Z){super(Z??"There is an empty value got and it is not allowed.",ct.FrameworkErrorEnum.EMPTY_VALUE)}}ct.MidwayEmptyValueError=MidwayEmptyValueError},87642:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.httpError=ct.GatewayTimeoutError=ct.ServiceUnavailableError=ct.BadGatewayError=ct.NotImplementedError=ct.InternalServerErrorError=ct.TooManyRequestsError=ct.UnprocessableEntityError=ct.UnsupportedMediaTypeError=ct.PayloadTooLargeError=ct.GoneError=ct.ConflictError=ct.RequestTimeoutError=ct.NotAcceptableError=ct.ForbiddenError=ct.NotFoundError=ct.UnauthorizedError=ct.BadRequestError=ct.HttpStatus=void 0;const pt=ut(16683);var dt;(function(Z){Z[Z["CONTINUE"]=100]="CONTINUE";Z[Z["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";Z[Z["PROCESSING"]=102]="PROCESSING";Z[Z["EARLYHINTS"]=103]="EARLYHINTS";Z[Z["OK"]=200]="OK";Z[Z["CREATED"]=201]="CREATED";Z[Z["ACCEPTED"]=202]="ACCEPTED";Z[Z["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";Z[Z["NO_CONTENT"]=204]="NO_CONTENT";Z[Z["RESET_CONTENT"]=205]="RESET_CONTENT";Z[Z["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";Z[Z["AMBIGUOUS"]=300]="AMBIGUOUS";Z[Z["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";Z[Z["FOUND"]=302]="FOUND";Z[Z["SEE_OTHER"]=303]="SEE_OTHER";Z[Z["NOT_MODIFIED"]=304]="NOT_MODIFIED";Z[Z["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";Z[Z["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";Z[Z["BAD_REQUEST"]=400]="BAD_REQUEST";Z[Z["UNAUTHORIZED"]=401]="UNAUTHORIZED";Z[Z["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";Z[Z["FORBIDDEN"]=403]="FORBIDDEN";Z[Z["NOT_FOUND"]=404]="NOT_FOUND";Z[Z["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";Z[Z["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";Z[Z["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";Z[Z["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";Z[Z["CONFLICT"]=409]="CONFLICT";Z[Z["GONE"]=410]="GONE";Z[Z["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";Z[Z["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";Z[Z["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";Z[Z["URI_TOO_LONG"]=414]="URI_TOO_LONG";Z[Z["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";Z[Z["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";Z[Z["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";Z[Z["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";Z[Z["MISDIRECTED"]=421]="MISDIRECTED";Z[Z["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";Z[Z["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";Z[Z["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";Z[Z["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";Z[Z["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";Z[Z["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";Z[Z["BAD_GATEWAY"]=502]="BAD_GATEWAY";Z[Z["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";Z[Z["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";Z[Z["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(dt||(ct.HttpStatus=dt={}));class BadRequestError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.BAD_REQUEST)}}ct.BadRequestError=BadRequestError;class UnauthorizedError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.UNAUTHORIZED)}}ct.UnauthorizedError=UnauthorizedError;class NotFoundError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.NOT_FOUND)}}ct.NotFoundError=NotFoundError;class ForbiddenError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.FORBIDDEN)}}ct.ForbiddenError=ForbiddenError;class NotAcceptableError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.NOT_ACCEPTABLE)}}ct.NotAcceptableError=NotAcceptableError;class RequestTimeoutError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.REQUEST_TIMEOUT)}}ct.RequestTimeoutError=RequestTimeoutError;class ConflictError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.CONFLICT)}}ct.ConflictError=ConflictError;class GoneError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.GONE)}}ct.GoneError=GoneError;class PayloadTooLargeError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.PAYLOAD_TOO_LARGE)}}ct.PayloadTooLargeError=PayloadTooLargeError;class UnsupportedMediaTypeError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.UNSUPPORTED_MEDIA_TYPE)}}ct.UnsupportedMediaTypeError=UnsupportedMediaTypeError;class UnprocessableEntityError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.UNPROCESSABLE_ENTITY)}}ct.UnprocessableEntityError=UnprocessableEntityError;class TooManyRequestsError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.TOO_MANY_REQUESTS)}}ct.TooManyRequestsError=TooManyRequestsError;class InternalServerErrorError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.INTERNAL_SERVER_ERROR)}}ct.InternalServerErrorError=InternalServerErrorError;class NotImplementedError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.NOT_IMPLEMENTED)}}ct.NotImplementedError=NotImplementedError;class BadGatewayError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.BAD_GATEWAY)}}ct.BadGatewayError=BadGatewayError;class ServiceUnavailableError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.SERVICE_UNAVAILABLE)}}ct.ServiceUnavailableError=ServiceUnavailableError;class GatewayTimeoutError extends pt.MidwayHttpError{constructor(Z){super(Z,dt.GATEWAY_TIMEOUT)}}ct.GatewayTimeoutError=GatewayTimeoutError;ct.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}},28068:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.httpError=ct.HttpStatus=void 0;dt(ut(16683),ct);var ft=ut(87642);Object.defineProperty(ct,"HttpStatus",{enumerable:true,get:function(){return ft.HttpStatus}});Object.defineProperty(ct,"httpError",{enumerable:true,get:function(){return ft.httpError}});dt(ut(70084),ct)},4458:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.FUNCTIONAL_API_CONTROLLER_CLASS_KEY=ct.FUNCTIONAL_API_MODULE_META_KEY=void 0;ct.FUNCTIONAL_API_MODULE_META_KEY="__midwayApiMeta";ct.FUNCTIONAL_API_CONTROLLER_CLASS_KEY="__midwayApiControllerClass"},31049:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.DynamicMidwayContainer=ct.MidwayPerformanceManager=ct.TypedResourceManager=ct.HttpServerResponse=ct.ServerResponse=ct.NetworkUtils=ct.FORMAT=ct.FileUtils=ct.PathFileUtils=ct.Types=ct.retryWith=ct.retryWithAsync=ct.extend=ct.Utils=ct.sleep=ct.isTypeScriptEnvironment=ct.wrapAsync=ct.wrapMiddleware=ct.pathMatching=ct.transformRequestObjectByType=ct.deprecatedOutput=ct.delegateTargetAllPrototypeMethod=ct.delegateTargetProperties=ct.delegateTargetMethod=ct.delegateTargetPrototypeMethod=ct.loadModule=ct.safeRequire=ct.safelyGet=ct.ASYNC_ROOT_CONTEXT=ct.MidwayPriorityManager=ct.DEFAULT_PRIORITY=ct.DataSourceManager=ct.MidwayTraceService=ct.MidwayServerlessFunctionService=ct.MidwayWebRouterService=ct.MidwayHealthService=ct.MidwayMockService=ct.MidwayDecoratorService=ct.MidwayMiddlewareService=ct.MidwayLifeCycleService=ct.MidwayAspectService=ct.MidwayFrameworkService=ct.MidwayLoggerService=ct.MidwayInformationService=ct.MidwayEnvironmentService=ct.MidwayConfigService=ct.BaseFramework=ct.MidwayRequestContainer=void 0;dt(ut(77866),ct);dt(ut(90494),ct);var ft=ut(33569);Object.defineProperty(ct,"MidwayRequestContainer",{enumerable:true,get:function(){return ft.MidwayRequestContainer}});var _t=ut(82170);Object.defineProperty(ct,"BaseFramework",{enumerable:true,get:function(){return _t.BaseFramework}});dt(ut(22837),ct);dt(ut(81680),ct);var mt=ut(12692);Object.defineProperty(ct,"MidwayConfigService",{enumerable:true,get:function(){return mt.MidwayConfigService}});var ht=ut(1565);Object.defineProperty(ct,"MidwayEnvironmentService",{enumerable:true,get:function(){return ht.MidwayEnvironmentService}});var yt=ut(7260);Object.defineProperty(ct,"MidwayInformationService",{enumerable:true,get:function(){return yt.MidwayInformationService}});var vt=ut(26966);Object.defineProperty(ct,"MidwayLoggerService",{enumerable:true,get:function(){return vt.MidwayLoggerService}});var St=ut(52590);Object.defineProperty(ct,"MidwayFrameworkService",{enumerable:true,get:function(){return St.MidwayFrameworkService}});var bt=ut(6850);Object.defineProperty(ct,"MidwayAspectService",{enumerable:true,get:function(){return bt.MidwayAspectService}});var xt=ut(10822);Object.defineProperty(ct,"MidwayLifeCycleService",{enumerable:true,get:function(){return xt.MidwayLifeCycleService}});var $t=ut(22546);Object.defineProperty(ct,"MidwayMiddlewareService",{enumerable:true,get:function(){return $t.MidwayMiddlewareService}});var Et=ut(97685);Object.defineProperty(ct,"MidwayDecoratorService",{enumerable:true,get:function(){return Et.MidwayDecoratorService}});var Ct=ut(62724);Object.defineProperty(ct,"MidwayMockService",{enumerable:true,get:function(){return Ct.MidwayMockService}});var Tt=ut(67056);Object.defineProperty(ct,"MidwayHealthService",{enumerable:true,get:function(){return Tt.MidwayHealthService}});var wt=ut(95919);Object.defineProperty(ct,"MidwayWebRouterService",{enumerable:true,get:function(){return wt.MidwayWebRouterService}});var At=ut(84766);Object.defineProperty(ct,"MidwayServerlessFunctionService",{enumerable:true,get:function(){return At.MidwayServerlessFunctionService}});var kt=ut(48757);Object.defineProperty(ct,"MidwayTraceService",{enumerable:true,get:function(){return kt.MidwayTraceService}});var It=ut(59679);Object.defineProperty(ct,"DataSourceManager",{enumerable:true,get:function(){return It.DataSourceManager}});var Nt=ut(53656);Object.defineProperty(ct,"DEFAULT_PRIORITY",{enumerable:true,get:function(){return Nt.DEFAULT_PRIORITY}});Object.defineProperty(ct,"MidwayPriorityManager",{enumerable:true,get:function(){return Nt.MidwayPriorityManager}});dt(ut(47369),ct);dt(ut(71888),ct);dt(ut(98771),ct);dt(ut(19835),ct);dt(ut(59972),ct);dt(ut(45984),ct);dt(ut(8470),ct);dt(ut(89746),ct);dt(ut(86052),ct);dt(ut(28068),ct);var Pt=ut(45213);Object.defineProperty(ct,"ASYNC_ROOT_CONTEXT",{enumerable:true,get:function(){return Pt.ASYNC_ROOT_CONTEXT}});dt(ut(25923),ct);dt(ut(40635),ct);dt(ut(57347),ct);var Ot=ut(53386);Object.defineProperty(ct,"safelyGet",{enumerable:true,get:function(){return Ot.safelyGet}});Object.defineProperty(ct,"safeRequire",{enumerable:true,get:function(){return Ot.safeRequire}});Object.defineProperty(ct,"loadModule",{enumerable:true,get:function(){return Ot.loadModule}});Object.defineProperty(ct,"delegateTargetPrototypeMethod",{enumerable:true,get:function(){return Ot.delegateTargetPrototypeMethod}});Object.defineProperty(ct,"delegateTargetMethod",{enumerable:true,get:function(){return Ot.delegateTargetMethod}});Object.defineProperty(ct,"delegateTargetProperties",{enumerable:true,get:function(){return Ot.delegateTargetProperties}});Object.defineProperty(ct,"delegateTargetAllPrototypeMethod",{enumerable:true,get:function(){return Ot.delegateTargetAllPrototypeMethod}});Object.defineProperty(ct,"deprecatedOutput",{enumerable:true,get:function(){return Ot.deprecatedOutput}});Object.defineProperty(ct,"transformRequestObjectByType",{enumerable:true,get:function(){return Ot.transformRequestObjectByType}});Object.defineProperty(ct,"pathMatching",{enumerable:true,get:function(){return Ot.pathMatching}});Object.defineProperty(ct,"wrapMiddleware",{enumerable:true,get:function(){return Ot.wrapMiddleware}});Object.defineProperty(ct,"wrapAsync",{enumerable:true,get:function(){return Ot.wrapAsync}});Object.defineProperty(ct,"isTypeScriptEnvironment",{enumerable:true,get:function(){return Ot.isTypeScriptEnvironment}});Object.defineProperty(ct,"sleep",{enumerable:true,get:function(){return Ot.sleep}});Object.defineProperty(ct,"Utils",{enumerable:true,get:function(){return Ot.Utils}});var Dt=ut(5904);Object.defineProperty(ct,"extend",{enumerable:true,get:function(){return Dt.extend}});dt(ut(9420),ct);dt(ut(9177),ct);dt(ut(57095),ct);dt(ut(38291),ct);var Ft=ut(34112);Object.defineProperty(ct,"retryWithAsync",{enumerable:true,get:function(){return Ft.retryWithAsync}});Object.defineProperty(ct,"retryWith",{enumerable:true,get:function(){return Ft.retryWith}});var Mt=ut(35175);Object.defineProperty(ct,"Types",{enumerable:true,get:function(){return Mt.Types}});var Lt=ut(53073);Object.defineProperty(ct,"PathFileUtils",{enumerable:true,get:function(){return Lt.PathFileUtils}});var Rt=ut(32587);Object.defineProperty(ct,"FileUtils",{enumerable:true,get:function(){return Rt.FileUtils}});var Bt=ut(62107);Object.defineProperty(ct,"FORMAT",{enumerable:true,get:function(){return Bt.FORMAT}});var Vt=ut(27192);Object.defineProperty(ct,"NetworkUtils",{enumerable:true,get:function(){return Vt.NetworkUtils}});var jt=ut(32525);Object.defineProperty(ct,"ServerResponse",{enumerable:true,get:function(){return jt.ServerResponse}});Object.defineProperty(ct,"HttpServerResponse",{enumerable:true,get:function(){return jt.HttpServerResponse}});var Ut=ut(40360);Object.defineProperty(ct,"TypedResourceManager",{enumerable:true,get:function(){return Ut.TypedResourceManager}});var Jt=ut(11386);Object.defineProperty(ct,"MidwayPerformanceManager",{enumerable:true,get:function(){return Jt.MidwayPerformanceManager}});var zt=ut(3281);Object.defineProperty(ct,"DynamicMidwayContainer",{enumerable:true,get:function(){return zt.DynamicMidwayContainer}});dt(ut(81248),ct);dt(ut(3145),ct);dt(ut(88067),ct);dt(ut(32673),ct)},77866:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ServiceDiscoveryHealthCheckType=ct.LoadBalancerType=ct.MidwayProcessTypeEnum=ct.ObjectLifeCycleEvent=ct.ServerlessTriggerType=ct.MSListenerType=ct.MSProviderType=ct.InjectModeEnum=ct.ScopeEnum=void 0;var ut;(function(Z){Z["Singleton"]="Singleton";Z["Request"]="Request";Z["Prototype"]="Prototype"})(ut||(ct.ScopeEnum=ut={}));var pt;(function(Z){Z["Identifier"]="Identifier";Z["Class"]="Class";Z["SelfName"]="SelfName"})(pt||(ct.InjectModeEnum=pt={}));var dt;(function(Z){Z["DUBBO"]="dubbo";Z["GRPC"]="gRPC"})(dt||(ct.MSProviderType=dt={}));var ft;(function(Z){Z["RABBITMQ"]="rabbitmq";Z["MQTT"]="mqtt";Z["KAFKA"]="kafka";Z["REDIS"]="redis"})(ft||(ct.MSListenerType=ft={}));var _t;(function(Z){Z["EVENT"]="event";Z["HTTP"]="http";Z["API_GATEWAY"]="apigw";Z["OS"]="os";Z["CDN"]="cdn";Z["LOG"]="log";Z["TIMER"]="timer";Z["MQ"]="mq";Z["KAFKA"]="kafka";Z["HSF"]="hsf";Z["MTOP"]="mtop";Z["SSR"]="ssr"})(_t||(ct.ServerlessTriggerType=_t={}));var mt;(function(Z){Z["BEFORE_BIND"]="beforeBind";Z["BEFORE_CREATED"]="beforeObjectCreated";Z["AFTER_CREATED"]="afterObjectCreated";Z["AFTER_INIT"]="afterObjectInit";Z["BEFORE_DESTROY"]="beforeObjectDestroy"})(mt||(ct.ObjectLifeCycleEvent=mt={}));var ht;(function(Z){Z["APPLICATION"]="APPLICATION";Z["AGENT"]="AGENT"})(ht||(ct.MidwayProcessTypeEnum=ht={}));ct.LoadBalancerType={RANDOM:"random",ROUND_ROBIN:"roundRobin"};ct.ServiceDiscoveryHealthCheckType={SELF:"self",TTL:"ttl",HTTP:"http",TCP:"tcp",CUSTOM:"custom"}},88136:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.TAGGED_CLS=ct.INJECT_CUSTOM_PARAM=ct.INJECT_CUSTOM_METHOD=ct.INJECT_CUSTOM_PROPERTY=ct.ALL=ct.INJECT_TAG=ct.OBJ_DEF_CLS=void 0;const pt=ut(25923);ct.OBJ_DEF_CLS=pt.OBJECT_DEFINITION_KEY;ct.INJECT_TAG=pt.PROPERTY_INJECT_KEY;ct.ALL=pt.ALL_VALUE_KEY;ct.INJECT_CUSTOM_PROPERTY=pt.CUSTOM_PROPERTY_INJECT_KEY;ct.INJECT_CUSTOM_METHOD=pt.CUSTOM_METHOD_INJECT_KEY;ct.INJECT_CUSTOM_PARAM=pt.CUSTOM_PARAM_INJECT_KEY;ct.TAGGED_CLS=pt.PROVIDE_KEY},64788:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.saveClassMetadata=saveClassMetadata;ct.attachClassMetadata=attachClassMetadata;ct.getClassExtendedMetadata=getClassExtendedMetadata;ct.getClassMetadata=getClassMetadata;ct.savePropertyDataToClass=savePropertyDataToClass;ct.attachPropertyDataToClass=attachPropertyDataToClass;ct.getPropertyDataFromClass=getPropertyDataFromClass;ct.listPropertyDataFromClass=listPropertyDataFromClass;ct.savePropertyMetadata=savePropertyMetadata;ct.attachPropertyMetadata=attachPropertyMetadata;ct.getPropertyMetadata=getPropertyMetadata;ct.savePreloadModule=savePreloadModule;ct.listPreloadModule=listPreloadModule;ct.saveModule=saveModule;ct.listModule=listModule;ct.resetModule=resetModule;ct.clearAllModule=clearAllModule;ct.saveProviderId=saveProviderId;ct.getProviderId=getProviderId;ct.getProviderName=getProviderName;ct.getProviderUUId=getProviderUUId;ct.isProvide=isProvide;ct.createCustomPropertyDecorator=createCustomPropertyDecorator;ct.createCustomMethodDecorator=createCustomMethodDecorator;ct.createCustomParamDecorator=createCustomParamDecorator;ct.getPropertyType=getPropertyType;ct.getMethodParamTypes=getMethodParamTypes;ct.savePropertyInject=savePropertyInject;ct.getPropertyInject=getPropertyInject;ct.saveObjectDefinition=saveObjectDefinition;ct.getObjectDefinition=getObjectDefinition;const pt=ut(88067);const dt=ut(25923);const ft=ut(35572);const _t=ut(88136);const mt="LEGACY_LIST_PROPERTY_DATA_KEY";function getDecoratorClsMethodPrefix(Z){return Z.toString()+"_CLS_METHOD"}function getDecoratorClsMethodKey(Z,ct){return getDecoratorClsMethodPrefix(Z)+":"+ct.toString()}function saveClassMetadata(Z,ct,ut,dt){if(dt&&typeof ct==="object"){const dt=pt.MetadataManager.getMetadata(Z,ut);if(!dt){return pt.MetadataManager.defineMetadata(Z,ct,ut)}if(Array.isArray(dt)){return pt.MetadataManager.defineMetadata(Z,dt.concat(ct),ut)}else{return pt.MetadataManager.defineMetadata(Z,Object.assign(dt,ct),ut)}}return pt.MetadataManager.defineMetadata(Z,ct,ut)}function attachClassMetadata(Z,ct,ut,dt){return pt.MetadataManager.attachMetadata(Z,ct,ut,dt)}function _getClassExtendedMetadata(Z,ct,ut,dt){const ft=pt.MetadataManager.getPropertiesWithMetadata(Z,ct);const _t={};for(const Z in ft){const ct=ft[Z];if(Array.isArray(ct)&&ct.length){_t[Z]=ct[ct.length-1]}else{_t[Z]=ct}}return _t}function getClassExtendedMetadata(Z,ct,ut,dt){const ft=pt.MetadataManager.getMetadata(Z,ct);if(ft===undefined){const pt=_getClassExtendedMetadata(Z,ct,ut,dt);if(pt){return pt}}return ft}function getClassMetadata(Z,ct){return pt.MetadataManager.getOwnMetadata(Z,ct)}function savePropertyDataToClass(Z,ct,ut,dt){const ft=getDecoratorClsMethodKey(Z,dt);const _t=pt.MetadataManager.getOwnMetadata(mt,ut)||new Map;_t.set(ft,ct);return pt.MetadataManager.defineMetadata(mt,_t,ut)}function attachPropertyDataToClass(Z,ct,ut,dt){const ft=getDecoratorClsMethodKey(Z,dt);const _t=pt.MetadataManager.getOwnMetadata(mt,ut)||new Map;if(_t.has(ft)){const Z=_t.get(ft);Z.push(ct);_t.set(ft,Z)}else{_t.set(ft,[ct])}return pt.MetadataManager.defineMetadata(mt,_t,ut)}function getPropertyDataFromClass(Z,ct,ut){const dt=getDecoratorClsMethodKey(Z,ut);const ft=pt.MetadataManager.getOwnMetadata(mt,ct);return ft&&ft.get(dt)}function listPropertyDataFromClass(Z,ct){const ut=pt.MetadataManager.getOwnMetadata(mt,ct);const dt=[];const ft=getDecoratorClsMethodPrefix(Z);for(const[Z,ct]of ut){if(Z.indexOf(ft)!==-1){dt.push(ct)}}return dt}function savePropertyMetadata(Z,ct,ut,dt){return pt.MetadataManager.defineMetadata(Z,ct,ut,dt)}function attachPropertyMetadata(Z,ct,ut,dt){return pt.MetadataManager.attachMetadata(Z,ct,ut,dt)}function getPropertyMetadata(Z,ct,ut){return pt.MetadataManager.getOwnMetadata(Z,ct,ut)}function savePreloadModule(Z){return dt.DecoratorManager.savePreStartModule(Z)}function listPreloadModule(){return dt.DecoratorManager.listPreStartModule()}function saveModule(Z,ct){return dt.DecoratorManager.saveModule(Z,ct)}function listModule(Z,ct){return dt.DecoratorManager.listModule(Z,ct)}function resetModule(Z){return dt.DecoratorManager.resetModule(Z)}function clearAllModule(){return dt.DecoratorManager.clearAllModule()}function saveProviderId(Z,ct){return dt.DecoratorManager.saveProviderId(Z,ct)}function getProviderId(Z){return dt.DecoratorManager.getProviderId(Z)}function getProviderName(Z){return dt.DecoratorManager.getProviderName(Z)}function getProviderUUId(Z){return dt.DecoratorManager.getProviderUUId(Z)}function isProvide(Z){return dt.DecoratorManager.isProvide(Z)}function createCustomPropertyDecorator(Z,ct,ut=true){return dt.DecoratorManager.createCustomPropertyDecorator(Z,ct,ut)}function createCustomMethodDecorator(Z,ct,ut={impl:true}){return dt.DecoratorManager.createCustomMethodDecorator(Z,ct,ut)}function createCustomParamDecorator(Z,ct,ut={impl:true}){return dt.DecoratorManager.createCustomParamDecorator(Z,ct,ut)}function getPropertyType(Z,ct){return pt.MetadataManager.transformTypeFromTSDesign(pt.MetadataManager.getPropertyType(Z,ct))}function getMethodParamTypes(Z,ct){return pt.MetadataManager.getMethodParamTypes(Z,ct)}function savePropertyInject(Z){(0,ft.saveInjectMetadata)(Z.identifier,Z.target,Z.targetKey)}function getPropertyInject(Z,ct){const ut=_getClassExtendedMetadata(dt.PROPERTY_INJECT_KEY,Z,undefined,ct);for(const Z in ut){const ct=ut[Z];if(Array.isArray(ct)&&ct.length){ut[Z]=ct[ct.length-1]}}return ut}function saveObjectDefinition(Z,ct={}){pt.MetadataManager.attachMetadata(_t.OBJ_DEF_CLS,ct,Z,"__fake_object_def_method");return Z}function getObjectDefinition(Z){const ct=_getClassExtendedMetadata(_t.OBJ_DEF_CLS,Z);const ut=pt.MetadataManager.getOwnMetadata(dt.SCOPE_KEY,Z);if(Array.isArray(ct)){const Z={};for(const ut of ct){Object.assign(Z,ut)}return Z}else{const Z={};for(const ut in ct){const pt=ct[ut];if(Array.isArray(pt)){for(const ct of pt){Object.assign(Z,ct)}}else{Object.assign(Z,pt)}}return Object.assign(Z,ut)}}},32673:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});dt(ut(64788),ct);dt(ut(88136),ct)},59080:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ServerResponse=void 0;class ServerResponse{ctx;isSuccess=true;constructor(Z){this.ctx=Z}static TEXT_TPL=(Z,ct,ut)=>Z;static JSON_TPL=(Z,ct,ut)=>{if(ct){return{success:"true",data:Z}}else{return{success:"false",message:Z||"fail"}}};static BLOB_TPL=(Z,ct,ut)=>Z;json(Z){return Object.getPrototypeOf(this).constructor.JSON_TPL(Z,this.isSuccess,this.ctx)}text(Z){return Object.getPrototypeOf(this).constructor.TEXT_TPL(Z,this.isSuccess,this.ctx)}blob(Z){return Object.getPrototypeOf(this).constructor.BLOB_TPL(Z,this.isSuccess,this.ctx)}success(){this.isSuccess=true;return this}fail(){this.isSuccess=false;return this}}ct.ServerResponse=ServerResponse},75801:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.HttpServerResponse=void 0;const pt=ut(79896);const dt=ut(59080);const ft=ut(61080);const _t=ut(4745);const mt=ut(16928);class HttpServerResponse extends dt.ServerResponse{constructor(Z){super(Z)}static FILE_TPL=(Z,ct,ut)=>Z;static SSE_TPL=(Z,ct)=>Z;static STREAM_TPL=(Z,ct)=>Z;static HTML_TPL=(Z,ct,ut)=>Z;status(Z){this.ctx.res.statusCode=Z;return this}header(Z,ct){this.ctx.res.setHeader(Z,ct);return this}headers(Z){if(this.ctx.res.setHeaders){this.ctx.res.setHeaders(new Map(Object.entries(Z)))}else{for(const ct in Z){this.header(ct,Z[ct])}}return this}json(Z){this.header("Content-Type","application/json");return Object.getPrototypeOf(this).constructor.JSON_TPL(Z,this.isSuccess,this.ctx)}text(Z){this.header("Content-Type","text/plain");return Object.getPrototypeOf(this).constructor.TEXT_TPL(Z,this.isSuccess,this.ctx)}file(Z,ct){this.header("Content-Type",ct||"application/octet-stream");this.header("Content-Disposition",`attachment; filename=${(0,mt.basename)(Z)}`);return Object.getPrototypeOf(this).constructor.FILE_TPL(typeof Z==="string"?(0,pt.createReadStream)(Z):Z,this.isSuccess,this.ctx)}blob(Z,ct){this.header("Content-Type",ct||"application/octet-stream");return Object.getPrototypeOf(this).constructor.BLOB_TPL(Z,this.isSuccess,this.ctx)}html(Z){this.header("Content-Type","text/html");return Object.getPrototypeOf(this).constructor.HTML_TPL(Z,this.isSuccess,this.ctx)}redirect(Z,ct=302){this.status(ct);if(this.ctx.redirect){return this.ctx.redirect(Z)}else if(this.ctx.res.redirect){return this.ctx.res.redirect(Z)}else{this.header("Location",Z)}}sse(Z={}){return new ft.ServerSendEventStream(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.SSE_TPL,...Z})}stream(Z={}){return new _t.HttpStreamResponse(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.STREAM_TPL,...Z})}}ct.HttpServerResponse=HttpServerResponse},32525:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.HttpServerResponse=ct.ServerResponse=void 0;var pt=ut(59080);Object.defineProperty(ct,"ServerResponse",{enumerable:true,get:function(){return pt.ServerResponse}});var dt=ut(75801);Object.defineProperty(ct,"HttpServerResponse",{enumerable:true,get:function(){return dt.HttpServerResponse}})},61080:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ServerSendEventStream=void 0;const pt=ut(2203);class ServerSendEventStream extends pt.Transform{ctx;isActive=false;closeEvent;options;closeHandlers=new Set;constructor(Z,ct={}){super({objectMode:true,...ct});this.ctx=Z;this.closeEvent=ct.closeEvent||"close";this.options=ct;this.ctx.req.on("close",this.handleClose.bind(this))}_transform(Z,ct,ut){try{let ct,pt="data: ";const dt=/^\s*:\s*/;const ft=[];if(!this.isActive){this.isActive=true;const Z={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(const ct in Z){this.ctx.res.setHeader(ct,Z[ct])}this.ctx.req.socket.setTimeout(0);this.ctx.req.socket.setNoDelay(true);this.ctx.req.socket.setKeepAlive(true);ft.push(": ok")}const _t=Z;if(_t.event)ft.push("event: "+_t.event);if(_t.retry)ft.push("retry: "+_t.retry);if(_t.id)ft.push("id: "+_t.id);if(typeof _t.data==="object"){ct=JSON.stringify(_t.data);ft.push(pt+ct)}else if(typeof _t.data==="undefined"){ft.push(pt)}else{_t.data=String(_t.data);if(_t.data.search(dt)!==-1){_t.data=_t.data.replace(dt,"");pt=": "}_t.data=_t.data.replace(/(\r\n|\r|\n)/g,"\n");ct=_t.data.split(/\n/);for(let Z=0,ut=ct.length;Z<ut;++Z){const dt=ct[Z];if(Z+1===ut){ft.push(pt+dt)}else{ft.push(pt+dt)}}}this.push(ft.join("\n")+"\n\n");ut()}catch(Z){this.ctx.logger.error(Z);this.sendError(Z);this.end();ut(Z)}}sendError(Z){this.send({event:"error",data:Z.message||"An error occurred"})}sendEnd(Z={}){Z.event=this.closeEvent;this.send(Z)}send(Z){super.write(this.options.tpl(Z,this.ctx))}async forward(Z,ct={}){const ut=ct.protocol||"eventsource";const abort=()=>{ct.abortController?.abort()};this.closeHandlers.add(abort);try{for await(const pt of Z){if(!this.writable||this.destroyed){break}const Z=ct.transform?await ct.transform(pt,this.ctx):pt;if(Z===null){continue}this.send(this.createForwardMessage(Z,ut))}this.sendForwardEnd(ut,ct.closeEvent)}catch(Z){if(ct.abortController?.signal.aborted||!this.writable){this.end();return}this.ctx.logger.error(Z);this.sendError(Z);this.end()}finally{this.closeHandlers.delete(abort)}}createForwardMessage(Z,ct){if(ct==="anthropic"){return{event:this.getChunkType(Z),data:this.getForwardData(Z)}}return{data:this.getForwardData(Z)}}sendForwardEnd(Z,ct){if(!this.writable||this.destroyed){return}if(Z==="openai"){this.send({data:"[DONE]"});this.end();return}if(Z==="eventsource"&&ct!==false){this.send({event:ct||this.closeEvent,data:""})}this.end()}getChunkType(Z){if(Z&&typeof Z==="object"){const ct=Z.type;if(typeof ct==="string"){return ct}}}getForwardData(Z){if(typeof Z==="string"){return Z}if(Buffer.isBuffer(Z)){return Z.toString()}if(Z&&typeof Z==="object"){return Z}return String(Z)}handleClose(){for(const Z of this.closeHandlers){Z()}this.end()}}ct.ServerSendEventStream=ServerSendEventStream},4745:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.HttpStreamResponse=void 0;const pt=ut(2203);class HttpStreamResponse extends pt.Transform{ctx;isActive=false;options;constructor(Z,ct={}){super({objectMode:true,...ct});this.ctx=Z;this.options=ct}_transform(Z,ct,ut){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 Z==="string"){this.ctx.res.write(Z)}else{this.ctx.res.write(JSON.stringify(Z))}ut()}catch(Z){this.ctx.logger.error(Z);this.end();this.ctx.res.end();ut(Z)}}send(Z){if(!this.writable){return}this.write(this.options.tpl(Z,this.ctx))}sendError(Z){this.ctx.logger.error(Z);this.end();this.ctx.res.end()}_flush(Z){this.ctx.res.end();Z()}}ct.HttpStreamResponse=HttpStreamResponse},6850:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayAspectService=void 0;const ft=ut(63268);const _t=ut(77866);const mt=ut(25923);const ht=ut(35175);const yt=ut(88067);let vt=class MidwayAspectService{applicationContext;constructor(Z){this.applicationContext=Z}async loadAspect(){const Z=mt.DecoratorManager.listModule(mt.ASPECT_KEY);let ct=[];for(const ut of Z){const Z=yt.MetadataManager.getOwnMetadata(mt.ASPECT_KEY,ut);ct=ct.concat(Z.map((Z=>{Z.aspectModule=ut;return Z})))}ct.sort(((Z,ct)=>(ct.priority||0)-(Z.priority||0)));for(const Z of ct){const ct=await this.applicationContext.getAsync(Z.aspectModule);await this.addAspect(ct,Z)}}async addAspect(Z,ct){const ut=ct.aspectTarget;const pt=Object.getOwnPropertyNames(ut.prototype);const dt=ct.match?ft(ct.match):()=>true;for(const ct of pt){if(ct==="constructor"||!dt(ct)){continue}const pt=Object.getOwnPropertyDescriptor(ut.prototype,ct);if(!pt||pt.writable===false){continue}this.interceptPrototypeMethod(ut,ct,Z)}}interceptPrototypeMethod(Z,ct,ut){const pt=Z.prototype[ct];if(ht.Types.isAsyncFunction(Z.prototype[ct])){Z.prototype[ct]=async function(...Z){let dt,ft;const newProceed=(...Z)=>pt.apply(this,Z);const _t={methodName:ct,target:this,args:Z,proceed:newProceed,proceedIsAsyncFunction:true};if(typeof ut==="function"){ut=ut()}try{await(ut.before?.(_t));if(ut.around){ft=await ut.around(_t)}else{ft=await pt.call(this,..._t.args)}_t.proceed=undefined;const Z=await(ut.afterReturn?.(_t,ft));ft=typeof Z==="undefined"?ft:Z;return ft}catch(Z){_t.proceed=undefined;dt=Z;if(ut.afterThrow){await ut.afterThrow(_t,dt)}else{throw Z}}finally{await(ut.after?.(_t,ft,dt))}}}else{Z.prototype[ct]=function(...Z){let dt,ft;const newProceed=(...Z)=>pt.apply(this,Z);const _t={methodName:ct,target:this,args:Z,proceed:newProceed,proceedIsAsyncFunction:false};if(typeof ut==="function"){ut=ut()}try{ut.before?.(_t);if(ut.around){ft=ut.around(_t)}else{ft=pt.call(this,..._t.args)}_t.proceed=undefined;const Z=ut.afterReturn?.(_t,ft);ft=typeof Z==="undefined"?ft:Z;return ft}catch(Z){_t.proceed=undefined;dt=Z;if(ut.afterThrow){ut.afterThrow(_t,dt)}else{throw Z}}finally{ut.after?.(_t,ft,dt)}}}}};ct.MidwayAspectService=vt;ct.MidwayAspectService=vt=pt([(0,mt.Provide)(),(0,mt.Scope)(_t.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],vt)},12692:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayConfigService=void 0;const ft=ut(16928);const _t=ut(77866);const mt=ut(53386);const ht=ut(79896);const yt=ut(39023);const vt=ut(1565);const St=ut(7260);const bt=ut(5904);const xt=ut(28068);const $t=ut(25923);const Et=ut(35175);const Ct=yt.debuglog("midway:debug");let Tt=class MidwayConfigService{envDirMap=new Map;aliasMap={prod:"production",unittest:"test"};configMergeOrder=[];configuration={};isReady=false;externalObject=[];appInfo;configFilterList=[];environmentService;informationService;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(Z){for(const ct of Z){if(typeof ct==="string"){if(/\.\w+$/.test(ct)){const Z=this.getConfigEnv(ct);const ut=this.getEnvSet(Z);ut.add(ct);if(this.aliasMap[Z]){this.getEnvSet(this.aliasMap[Z]).add(ct)}}else{const Z=(0,ht.statSync)(ct);if(Z.isDirectory()){const Z=(0,ht.readdirSync)(ct);this.add(Z.map((Z=>(0,ft.join)(ct,Z))))}}}else{for(const Z in ct){this.getEnvSet(Z).add(ct[Z]);if(this.aliasMap[Z]){this.getEnvSet(this.aliasMap[Z]).add(ct[Z])}}}}}addObject(Z,ct=false){if(this.isReady){Z=this.runWithFilter(Z);if(!Z){Ct("[config]: Filter config and got undefined will be drop it");return}this.configMergeOrder.push({env:"default",extraPath:"",value:Z});if(ct){this.configuration=(0,bt.extend)(true,Z,this.configuration)}else{(0,bt.extend)(true,this.configuration,Z)}}else{this.externalObject.push(Z)}}getEnvSet(Z){if(!this.envDirMap.has(Z)){this.envDirMap.set(Z,new Set)}return this.envDirMap.get(Z)}getConfigEnv(Z){const ct=(0,ft.basename)(Z);const ut=ct.split(".");const pt=ut.pop();if(pt!=="js"&&pt!=="ts"){return pt}return ut.pop()}load(){if(this.isReady)return;const Z=this.getEnvSet("default");const ct=this.getEnvSet(this.environmentService.getCurrentEnvironment());const ut={};const pt=Z.size;for(const[dt,ft]of[...Z,...ct].entries()){let Z=this.loadConfig(ft);if(Et.Types.isFunction(Z)){Z=Z.apply(null,[this.appInfo,ut])}if(!Z){continue}Z=this.runWithFilter(Z);if(!Z){Ct("[config]: Filter config and got undefined will be drop it");continue}if(typeof ft==="string"){Ct("[config]: Loaded config %s, %j",ft,Z)}else{Ct("[config]: Loaded config %j",Z)}this.configMergeOrder.push({env:dt<pt?"default":this.environmentService.getCurrentEnvironment(),extraPath:ft,value:Z});(0,bt.extend)(true,ut,Z)}if(this.externalObject.length){for(let Z of this.externalObject){if(Z){Z=this.runWithFilter(Z);if(!Z){Ct("[config]: Filter config and got undefined will be drop it");continue}Ct("[config]: Loaded external object %j",Z);(0,bt.extend)(true,ut,Z);this.configMergeOrder.push({env:"default",extraPath:"",value:Z})}}}this.configuration=ut;this.isReady=true}getConfiguration(Z,ct){if(Z){const ut=(0,mt.safelyGet)(Z,this.configuration);return ut===undefined?ct:ut}return this.configuration}getConfigMergeOrder(){return this.configMergeOrder}loadConfig(Z){let ct=typeof Z==="string"?require(Z):Z;if(ct&&ct.__esModule){if(ct&&ct.default){if(Object.keys(ct).length>1){throw new xt.MidwayInvalidConfigError(`${Z} should not have both a default export and named export`)}ct=ct.default}}return ct}clearAllConfig(){this.configuration={}}clearConfigMergeOrder(){this.configMergeOrder.length=0}addFilter(Z){this.configFilterList.push(Z)}runWithFilter(Z){for(const ct of this.configFilterList){Ct(`[config]: Filter config by filter = "${ct.name||"anonymous filter"}"`);Z=ct(Z);Ct("[config]: Filter config result = %j",Z)}return Z}getAppInfo(){return this.appInfo}};ct.MidwayConfigService=Tt;pt([(0,$t.Inject)(),dt("design:type",vt.MidwayEnvironmentService)],Tt.prototype,"environmentService",void 0);pt([(0,$t.Inject)(),dt("design:type",St.MidwayInformationService)],Tt.prototype,"informationService",void 0);pt([(0,$t.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",void 0)],Tt.prototype,"init",null);ct.MidwayConfigService=Tt=pt([(0,$t.Provide)(),(0,$t.Scope)(_t.ScopeEnum.Singleton)],Tt)},97685:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayDecoratorService=void 0;const ft=ut(25923);const _t=ut(77866);const mt=ut(6850);const ht=ut(28068);const yt=ut(39023);const vt=ut(35175);const St=ut(88067);const bt=yt.debuglog("midway:debug");let xt=class MidwayDecoratorService{applicationContext;propertyHandlerMap=new Map;methodDecoratorMap=new Map;parameterDecoratorMap=new Map;parameterDecoratorPipes=new Map;aspectService;constructor(Z){this.applicationContext=Z}init(){this.applicationContext.onBeforeBind((Z=>{bt(`[core]: Bind class ${Z.name} in decorator service`);const ct=St.MetadataManager.getMetadata(ft.CUSTOM_METHOD_INJECT_KEY,Z);if(ct){bt(`[core]: Find method decorator metadata in ${Z.name}`);for(const ut of ct){const{propertyName:ct,key:pt,metadata:dt,options:ft}=ut;if(!ft||!ft.impl){continue}this.aspectService.interceptPrototypeMethod(Z,ct,(()=>{const ut=this.methodDecoratorMap.get(pt);if(!ut){throw new ht.MidwayCommonError(`Method Decorator "${pt}" handler not found, please register first.`)}return ut({target:Z,propertyName:ct,metadata:dt})}))}}const ut=St.MetadataManager.getOwnPropertiesWithMetadata(ft.CUSTOM_PARAM_INJECT_KEY,Z);if(ut){bt(`[core]: Find parameter decorator metadata in ${Z.name}`);for(const ct of Object.keys(ut)){this.aspectService.interceptPrototypeMethod(Z,ct,(()=>({before:async pt=>{const dt=[...pt.args];for(const ft of ut[ct]){const{propertyName:ct,key:ut,metadata:_t,parameterIndex:mt,options:yt}=ft;let xt;if(yt&&yt.impl){xt=this.parameterDecoratorMap.get(ut);if(!xt){throw new ht.MidwayCommonError(`Parameter Decorator "${ut}" handler not found, please register first.`)}}else{xt=async({parameterIndex:Z,originArgs:ct})=>ct[Z]}const $t=St.MetadataManager.getMethodParamTypes(Z,ct);let Et=false;try{dt[mt]=await xt({metadata:_t,propertyName:ct,parameterIndex:mt,target:Z,originArgs:dt,originParamType:$t[mt],instance:pt.target})}catch(Z){Et=true;if(yt?.throwError===true){throw Z}else{bt(`[core]: Parameter decorator throw error and use origin args, ${Z.stack}`)}}if(Et){continue}const Ct=[...this.parameterDecoratorPipes.get(ut)||[],...yt?.pipes||[]];for(const Z of Ct){let ct;if("transform"in Z){ct=Z["transform"].bind(Z)}else if((0,vt.isClass)(Z)){const ut=await this.applicationContext.getAsync(Z);ct=ut.transform.bind(ut)}else if(typeof Z==="function"){ct=Z}else{throw new ht.MidwayParameterError("Pipe must be a function or implement PipeTransform interface")}dt[mt]=await ct(dt[mt],{metaType:St.MetadataManager.transformTypeFromTSDesign($t[mt]),metadata:_t,target:pt.target,methodName:pt.methodName})}}pt.args=dt}})))}}}));this.applicationContext.onObjectCreated(((Z,ct)=>{if(this.propertyHandlerMap.size>0&&Array.isArray(ct.definition.handlerProps)){for(const ut of ct.definition.handlerProps){this.defineGetterPropertyValue(ut,Z,this.getHandler(ut.key))}}}));this.registerPropertyHandler(ft.APPLICATION_CONTEXT_KEY,((Z,ct)=>this.applicationContext))}registerPropertyHandler(Z,ct){bt(`[core]: Register property decorator key="${Z}"`);this.propertyHandlerMap.set(Z,ct)}registerMethodHandler(Z,ct){bt(`[core]: Register method decorator key="${Z}"`);this.methodDecoratorMap.set(Z,ct)}registerParameterHandler(Z,ct){bt(`[core]: Register parameter decorator key="${Z}"`);this.parameterDecoratorMap.set(Z,ct)}registerParameterPipes(Z,ct){if(!this.parameterDecoratorPipes.has(Z)){this.parameterDecoratorPipes.set(Z,[])}this.parameterDecoratorPipes.set(Z,this.parameterDecoratorPipes.get(Z).concat(ct))}defineGetterPropertyValue(Z,ct,ut){if(Z&&ut){if(Z.propertyName){Object.defineProperty(ct,Z.propertyName,{get:()=>ut(Z.propertyName,Z.metadata??{},ct),configurable:true,enumerable:true})}}}getHandler(Z){if(this.propertyHandlerMap.has(Z)){return this.propertyHandlerMap.get(Z)}}};ct.MidwayDecoratorService=xt;pt([(0,ft.Inject)(),dt("design:type",mt.MidwayAspectService)],xt.prototype,"aspectService",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",void 0)],xt.prototype,"init",null);ct.MidwayDecoratorService=xt=pt([(0,ft.Provide)(),(0,ft.Scope)(_t.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],xt)},1565:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayEnvironmentService=void 0;const dt=ut(77866);const ft=ut(53386);const _t=ut(25923);let mt=class MidwayEnvironmentService{environment;moduleLoadType="commonjs";getCurrentEnvironment(){if(!this.environment){this.environment=(0,ft.getCurrentEnvironment)()}return this.environment}setCurrentEnvironment(Z){this.environment=Z}isDevelopmentEnvironment(){return(0,ft.isDevelopmentEnvironment)(this.environment)}setModuleLoadType(Z){this.moduleLoadType=Z}getModuleLoadType(){return this.moduleLoadType}isPkgEnvironment(){return typeof process["pkg"]!=="undefined"}};ct.MidwayEnvironmentService=mt;ct.MidwayEnvironmentService=mt=pt([(0,_t.Provide)(),(0,_t.Scope)(dt.ScopeEnum.Singleton)],mt)},52590:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayFrameworkService=void 0;const ft=ut(25923);const _t=ut(77866);const mt=ut(12692);const ht=ut(26966);const yt=ut(82170);const vt=ut(97685);const St=ut(6850);const bt=ut(89746);const xt=ut(39023);const $t=ut(28068);const Et=ut(11386);const Ct=xt.debuglog("midway:debug");let Tt=class MidwayFrameworkService{applicationContext;globalOptions;configService;loggerService;aspectService;decoratorService;applicationManager;constructor(Z,ct){this.applicationContext=Z;this.globalOptions=ct}mainFramework;globalFrameworkList=[];async init(){this.decoratorService.registerPropertyHandler(ft.CONFIG_KEY,((Z,ct)=>{if(ct.identifier===ft.ALL_VALUE_KEY){return this.configService.getConfiguration()}else{return this.configService.getConfiguration(ct.identifier??Z)}}));this.decoratorService.registerPropertyHandler(ft.LOGGER_KEY,((Z,ct)=>this.loggerService.getLogger(ct.identifier??Z)));this.decoratorService.registerPropertyHandler(ft.APPLICATION_KEY,((Z,ct)=>{if(ct.type){const Z=this.applicationManager.getApplication(ct.type);if(!Z){throw new $t.MidwayCommonError(`Framework ${ct.type} not Found`)}return Z}else{return this.getMainApp()}}));this.decoratorService.registerPropertyHandler(ft.MAIN_APPLICATION_KEY,((Z,ct)=>this.getMainApp()));this.decoratorService.registerPropertyHandler(ft.PLUGIN_KEY,((Z,ct)=>this.getMainApp()[ct.identifier??Z]));this.decoratorService.registerPropertyHandler(ft.FACTORY_SERVICE_CLIENT_KEY,((Z,ct)=>{const ut=this.applicationContext.get(ct.serviceFactoryClz);const pt=ct.clientName||ut.getDefaultClientName();if(pt&&ut.has(pt)){return ut.get(pt)}else{if(!pt){throw new $t.MidwayParameterError(`Please set clientName or options.defaultClientName for ${ct.serviceFactoryClz.name}).`)}else{throw new $t.MidwayParameterError(`ClientName(${pt} not found in ${ct.serviceFactoryClz.name}).`)}}}));let Z=ft.DecoratorManager.listModule(ft.FRAMEWORK_KEY);Z=filterProtoFramework(Z);Ct(`[core]: Found Framework length = ${Z.length}`);if(Z.length){for(const ct of Z){if(!this.applicationContext.hasDefinition(ft.DecoratorManager.getProviderUUId(ct))){Ct(`[core]: Found Framework "${ct.name}" but missing definition, skip initialize.`);continue}const Z=await this.applicationContext.getAsync(ct,[this.applicationContext]);if(Z.isEnable()){Et.MidwayInitializerPerformanceManager.frameworkInitializeStart(Z.getFrameworkName());await Z.initialize({applicationContext:this.applicationContext,namespace:Z.getNamespace(),...this.globalOptions});Et.MidwayInitializerPerformanceManager.frameworkInitializeEnd(Z.getFrameworkName());Ct(`[core]: Found Framework "${Z.getFrameworkName()}" and initialize.`)}else{Ct(`[core]: Found Framework "${Z.getFrameworkName()}" and delay initialize.`)}const ut=this.applicationContext.registry.getDefinition(ft.DecoratorManager.getProviderUUId(ct));Z.setNamespace(ut?.namespace);this.applicationManager.addFramework(Z.getFrameworkName()??ut?.namespace,Z);if(ut?.namespace&&!this.applicationManager.hasFramework(ut.namespace)){this.applicationManager.addFramework(ut.namespace,Z)}this.globalFrameworkList.push(Z)}let ct;const ut=this.applicationContext.getNamespaceList();for(const Z of ut){const ut=this.applicationManager.getApplication(Z);if(ut){ct=Z;break}}global["MIDWAY_MAIN_FRAMEWORK"]=this.mainFramework=this.applicationManager.getFramework(ct)??this.globalFrameworkList[0];Ct(`[core]: Current main Framework is "${ct}".`)}await this.aspectService.loadAspect()}getMainApp(){return this.mainFramework?.getApplication()}setMainApp(Z){this.mainFramework=this.applicationManager.getFramework(Z)}getMainFramework(){return this.mainFramework}getFramework(Z){return this.applicationManager.getFramework(Z)}async runFramework(){const Z=this.applicationContext.getNamespaceList();this.globalFrameworkList=this.globalFrameworkList.sort(((ct,ut)=>Z.indexOf(ct.getNamespace())-Z.indexOf(ut.getNamespace())));for(const Z of this.globalFrameworkList){if(Z.isEnable()){Et.MidwayInitializerPerformanceManager.frameworkRunStart(Z.getFrameworkName());await Z.run();Ct(`[core]: Found Framework "${Z.getFrameworkName()}" and run.`);Et.MidwayInitializerPerformanceManager.frameworkRunEnd(Z.getFrameworkName())}}}async stopFramework(){await Promise.all(Array.from(this.globalFrameworkList).map((Z=>Z.stop())))}};ct.MidwayFrameworkService=Tt;pt([(0,ft.Inject)(),dt("design:type",mt.MidwayConfigService)],Tt.prototype,"configService",void 0);pt([(0,ft.Inject)(),dt("design:type",ht.MidwayLoggerService)],Tt.prototype,"loggerService",void 0);pt([(0,ft.Inject)(),dt("design:type",St.MidwayAspectService)],Tt.prototype,"aspectService",void 0);pt([(0,ft.Inject)(),dt("design:type",vt.MidwayDecoratorService)],Tt.prototype,"decoratorService",void 0);pt([(0,ft.Inject)(),dt("design:type",bt.MidwayApplicationManager)],Tt.prototype,"applicationManager",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],Tt.prototype,"init",null);ct.MidwayFrameworkService=Tt=pt([(0,ft.Provide)(),(0,ft.Scope)(_t.ScopeEnum.Singleton),dt("design:paramtypes",[Object,Object])],Tt);function filterProtoFramework(Z){const ct=[];for(const ut of Z){let Z=Object.getPrototypeOf(ut);while(Z.name&&Z.name!==yt.BaseFramework.name){ct.push(Z);Z=Object.getPrototypeOf(Z)}}return Z.filter((Z=>!ct.includes(Z)))}},67056:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayHealthService=void 0;const ft=ut(25923);const _t=ut(77866);const mt=ut(12692);const ht=ut(22041);const yt=ut(52590);let vt=class MidwayHealthService{configService;frameworkService;applicationContext;healthCheckTimeout=1e3;healthCheckMethods=[];async init(Z){const ct=this.configService.getConfiguration("core.healthCheckTimeout")||1e3;this.setCheckTimeout(ct);for(const ct of Z){if(ct.instance&&ct.instance["onHealthCheck"]){this.healthCheckMethods.push({item:ct.instance["onHealthCheck"].bind(ct.instance),meta:{namespace:ct.namespace}})}}}async getStatus(){const Z=await(0,ht.createPromiseTimeoutInvokeChain)({promiseItems:this.healthCheckMethods.map((Z=>({item:ct=>Z.item(this.applicationContext,this.frameworkService.getMainApp(),{abortController:ct,timeout:this.healthCheckTimeout}),meta:Z.meta,itemName:Z.meta.namespace}))),itemTimeout:this.healthCheckTimeout,methodName:"configuration.onHealthCheck",onSuccess:(Z,ct)=>{if(Z["status"]!==undefined){return{namespace:ct.namespace,...Z}}else{return{status:false,namespace:ct.namespace,reason:"configuration.onHealthCheck return value must be object and contain status field"}}},onFail:(Z,ct)=>({status:false,namespace:ct.namespace,reason:Z.message})});const ct=Z.find((Z=>!Z.status));return{status:!ct,namespace:ct?.namespace,reason:ct?.reason,results:Z}}setCheckTimeout(Z){this.healthCheckTimeout=Z}};ct.MidwayHealthService=vt;pt([(0,ft.Inject)(),dt("design:type",mt.MidwayConfigService)],vt.prototype,"configService",void 0);pt([(0,ft.Inject)(),dt("design:type",yt.MidwayFrameworkService)],vt.prototype,"frameworkService",void 0);pt([(0,ft.ApplicationContext)(),dt("design:type",Object)],vt.prototype,"applicationContext",void 0);ct.MidwayHealthService=vt=pt([(0,ft.Provide)(),(0,ft.Scope)(_t.ScopeEnum.Singleton)],vt)},7260:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayInformationService=void 0;const ft=ut(77866);const _t=ut(53386);const mt=ut(16928);const ht=ut(25923);const yt=ut(79896);const vt=ut(27192);let St=class MidwayInformationService{pkg;appDir;baseDir;init(){if(this.baseDir){if(!this.appDir){this.appDir=(0,mt.dirname)(this.baseDir)}const Z=(0,mt.join)(this.appDir,"package.json");if((0,yt.existsSync)(Z)){const ct=(0,yt.readFileSync)(Z,{encoding:"utf-8"});this.pkg=JSON.parse(ct)}else{this.pkg={}}}else{this.pkg={}}}getAppDir(){return this.appDir}getBaseDir(){return this.baseDir}getHome(){return(0,_t.getUserHome)()}getPkg(){return this.pkg}getProjectName(){return this.pkg?.["name"]||""}getRoot(){const Z=(0,_t.isDevelopmentEnvironment)((0,_t.getCurrentEnvironment)());return Z?this.getAppDir():this.getHome()}getHostname(){return vt.NetworkUtils.getHostname()}getIpv4Address(){return vt.NetworkUtils.getIpv4Address()}getIpv6Address(){return vt.NetworkUtils.getIpv6Address()}};ct.MidwayInformationService=St;pt([(0,ht.Inject)(),dt("design:type",String)],St.prototype,"appDir",void 0);pt([(0,ht.Inject)(),dt("design:type",String)],St.prototype,"baseDir",void 0);pt([(0,ht.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",void 0)],St.prototype,"init",null);ct.MidwayInformationService=St=pt([(0,ht.Provide)(),(0,ht.Scope)(ft.ScopeEnum.Singleton)],St)},10822:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayLifeCycleService=void 0;const ft=ut(77866);const _t=ut(25923);const mt=ut(52590);const ht=ut(12692);const yt=ut(39023);const vt=ut(62724);const St=ut(67056);const bt=ut(88067);const xt=ut(11386);const $t=ut(22041);const Et=(0,yt.debuglog)("midway:debug");let Ct=class MidwayLifeCycleService{applicationContext;frameworkService;configService;mockService;healthService;lifecycleInstanceList=[];constructor(Z){this.applicationContext=Z}async init(){await this.mockService.initSimulation();const Z=_t.DecoratorManager.listModule(_t.CONFIGURATION_KEY);Et(`[core]: Found Configuration length = ${Z.length}`);for(const ct of Z){if(bt.MetadataManager.hasOwnMetadata(_t.CONFIGURATION_OBJECT_KEY,ct.target)){ct.instance=ct.target}else{Et(`[core]: Lifecycle run ${ct.namespace} init`);ct.instance=await this.applicationContext.getAsync(ct.target)}if(ct.instance){this.lifecycleInstanceList.push(ct)}}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",{resultHandler:Z=>{if(Z){this.configService.addObject(Z)}},timeout:this.configService.getConfiguration("core.configLoadTimeout")});await this.mockService.runSimulatorSetup();await this.runContainerLifeCycle(this.lifecycleInstanceList,"onReady",{timeout:this.configService.getConfiguration("core.readyTimeout")});await this.frameworkService.runFramework();await this.runContainerLifeCycle(this.lifecycleInstanceList,"onServerReady",{timeout:this.configService.getConfiguration("core.serverReadyTimeout")});if(!this.configService.getConfiguration("debug.recordConfigMergeOrder")){this.configService.clearConfigMergeOrder()}}async stop(){await this.mockService.runSimulatorTearDown();await this.runContainerLifeCycle(this.lifecycleInstanceList.reverse(),"onStop",{timeout:this.configService.getConfiguration("core.stopTimeout")});await this.frameworkService.stopFramework()}async runContainerLifeCycle(Z,ct,ut){await(0,$t.createPromiseTimeoutInvokeChain)({promiseItems:Z.map((Z=>({item:async pt=>this.runLifeCycle(Z,ct,{...ut,abortController:pt}),meta:{namespace:Z.namespace},itemName:Z.namespace}))),itemTimeout:ut?.timeout,isConcurrent:false,methodName:`configuration.${ct}`})}async runLifeCycle(Z,ct,ut){if(typeof Z.instance[ct]==="function"){Et(`[core]: Lifecycle run ${Z.instance.constructor.name} ${ct}`);xt.MidwayInitializerPerformanceManager.lifecycleStart(Z.namespace,ct);const pt=await Z.instance[ct](this.applicationContext,this.frameworkService.getMainApp(),{timeout:ut.timeout,abortController:ut.abortController});if(ut?.resultHandler){ut.resultHandler(pt)}xt.MidwayInitializerPerformanceManager.lifecycleEnd(Z.namespace,ct);return pt}}async runObjectLifeCycle(Z,ct){for(const ut of Z){if(typeof ut.instance[ct]==="function"){Et(`[core]: Lifecycle run ${ut.instance.constructor.name} ${ct}`);return await this.applicationContext[ct](ut.instance[ct].bind(ut.instance))}}}getLifecycleInstanceList(){return this.lifecycleInstanceList}};ct.MidwayLifeCycleService=Ct;pt([(0,_t.Inject)(),dt("design:type",mt.MidwayFrameworkService)],Ct.prototype,"frameworkService",void 0);pt([(0,_t.Inject)(),dt("design:type",ht.MidwayConfigService)],Ct.prototype,"configService",void 0);pt([(0,_t.Inject)(),dt("design:type",vt.MidwayMockService)],Ct.prototype,"mockService",void 0);pt([(0,_t.Inject)(),dt("design:type",St.MidwayHealthService)],Ct.prototype,"healthService",void 0);pt([(0,_t.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],Ct.prototype,"init",null);ct.MidwayLifeCycleService=Ct=pt([(0,_t.Provide)(),(0,_t.Scope)(ft.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],Ct)},26966:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayLoggerService=void 0;const ft=ut(25923);const _t=ut(12692);const mt=ut(71888);const ht=ut(77866);const yt=ut(47369);const vt=ut(28068);let St=class MidwayLoggerService extends mt.ServiceFactory{applicationContext;globalOptions;configService;loggerFactory;lazyLoggerConfigMap=new Map;aliasLoggerMap=new Map;constructor(Z,ct={}){super();this.applicationContext=Z;this.globalOptions=ct}init(){const Z=this.configService.getConfiguration("loggerFactory");this.loggerFactory=Z||this.globalOptions["loggerFactory"]||new yt.DefaultConsoleLoggerFactory;if(!this.loggerFactory.getDefaultMidwayLoggerConfig){throw new vt.MidwayFeatureNoLongerSupportedError("please upgrade your @midwayjs/logger to latest version")}const ct=this.loggerFactory.getDefaultMidwayLoggerConfig(this.configService.getAppInfo());this.configService.addObject(ct,true);this.initClients(this.configService.getConfiguration("midwayLogger"));this.applicationContext?.registerObject("logger",this.getLogger("appLogger"))}createClient(Z,ct){if(Z.aliasName){this.aliasLoggerMap.set(Z.aliasName,ct)}if(!Z.lazyLoad){this.loggerFactory.createLogger(ct,Z)}else{delete Z["lazyLoad"];this.lazyLoggerConfigMap.set(ct,Z)}}getName(){return"logger"}createLogger(Z,ct){delete ct["aliasName"];return this.loggerFactory.createLogger(Z,ct)}getLogger(Z){if(this.aliasLoggerMap.has(Z)){Z=this.aliasLoggerMap.get(Z)}const ct=this.loggerFactory.getLogger(Z);if(ct){return ct}if(this.lazyLoggerConfigMap.has(Z)){this.createClient(this.lazyLoggerConfigMap.get(Z),Z);this.lazyLoggerConfigMap.delete(Z)}return this.loggerFactory.getLogger(Z)}getCurrentLoggerFactory(){return this.loggerFactory}createContextLogger(Z,ct,ut){return this.loggerFactory.createContextLogger(Z,ct,ut)}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}};ct.MidwayLoggerService=St;pt([(0,ft.Inject)(),dt("design:type",_t.MidwayConfigService)],St.prototype,"configService",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",void 0)],St.prototype,"init",null);ct.MidwayLoggerService=St=pt([(0,ft.Provide)(),(0,ft.Scope)(ht.ScopeEnum.Singleton),dt("design:paramtypes",[Object,Object])],St)},22546:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayMiddlewareService=void 0;const ft=ut(25923);const _t=ut(77866);const mt=ut(28068);const ht=ut(53386);const yt=ut(35175);const vt=ut(39023);const St=(0,vt.debuglog)("midway:debug");let bt=class MidwayMiddlewareService{applicationContext;constructor(Z){this.applicationContext=Z}async compose(Z,ct,ut){if(!Array.isArray(Z)){throw new mt.MidwayParameterError("Middleware stack must be an array")}const pt=[];for(let ut of Z){if(yt.Types.isClass(ut)||typeof ut==="string"||ut?.["middleware"]){let Z=ut?.["middleware"]??ut;const dt=ut?.["options"];let ft=ut?.["name"];if(typeof Z==="string"&&!this.applicationContext.hasDefinition(Z)){throw new mt.MidwayCommonError(`Middleware definition of "${Z}" not found in midway container`)}const _t=await this.applicationContext.getAsync(Z);if(_t){ft=ft??_t.constructor.name;Z=await _t.resolve(ct,dt);if(!Z){continue}if(!_t.match&&!_t.ignore){if(!Z.name){Z._name=ft}pt.push(Z)}else{const ct=(0,ht.pathMatching)({match:_t.match,ignore:_t.ignore,thisResolver:_t});ut=(ut,pt,dt)=>{if(!ct(ut))return pt();return Z(ut,pt,dt)};ut._name=ft;pt.push(ut)}}else{throw new mt.MidwayCommonError("Middleware must have resolve method!")}}else{pt.push(ut)}}const composeFn=(Z,ct)=>{const dt=(0,ht.isIncludeProperty)(Z,"body");let ft=-1;return dispatch(0);function dispatch(_t){if(_t<=ft)return Promise.reject(new mt.MidwayCommonError("next() called multiple times"));ft=_t;let ht=pt[_t];if(_t===pt.length)ht=ct;if(!ht)return Promise.resolve();const yt=`${ut?`${ut}.`:""}${ft} ${ht._name||ht.name||"anonymous"}`;const vt=Date.now();St(`[middleware]: in ${yt} +0`);try{if(dt){return Promise.resolve(ht(Z,dispatch.bind(null,_t+1),{index:ft})).then((ct=>{if(ct!==undefined&&ct!==Z["body"]){Z["body"]=ct}else if(Z["body"]!==undefined){ct=Z["body"]}St(`[middleware]: out ${yt} +${Date.now()-vt} with body`);return ct}))}else{return Promise.resolve(ht(Z,dispatch.bind(null,_t+1),{index:ft})).then((Z=>{St(`[middleware]: out ${yt} +${Date.now()-vt}`);return Z}))}}catch(Z){St(`[middleware]: out ${yt} +${Date.now()-vt} with err ${Z.message}`);return Promise.reject(Z)}}};if(ut){composeFn._name=ut}return composeFn}};ct.MidwayMiddlewareService=bt;ct.MidwayMiddlewareService=bt=pt([(0,ft.Provide)(),(0,ft.Scope)(_t.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],bt)},62724:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};var ft;Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayMockService=void 0;const _t=ut(77866);const mt=ut(25923);const ht=ut(35175);let yt=class MidwayMockService{static{ft=this}applicationContext;mocks=new Map;contextMocks=new Map;cache=new Map;simulatorList=[];constructor(Z){this.applicationContext=Z}async init(){if(ft.prepareMocks.length>0){for(const Z of ft.prepareMocks){this.mockProperty(Z.obj,Z.key,Z.value,Z.group)}ft.prepareMocks=[]}}static prepareMocks=[];static mockClassProperty(Z,ct,ut,pt="default"){this.mockProperty(Z.prototype,ct,ut,pt)}static mockProperty(Z,ct,ut,pt="default"){this.prepareMocks.push({obj:Z,key:ct,value:ut,group:pt})}mockClassProperty(Z,ct,ut,pt="default"){return this.mockProperty(Z.prototype,ct,ut,pt)}mockProperty(Z,ct,ut,pt="default"){const dt=Z.hasOwnProperty(ct);const ft={obj:Z,key:ct,descriptor:Object.getOwnPropertyDescriptor(Z,ct),hasOwnProperty:dt};if(!this.mocks.has(pt)){this.mocks.set(pt,[])}this.mocks.get(pt).push(ft);if(dt){delete Z[ct]}let _t=this.cache.get(pt);if(!_t){_t=new Map;this.cache.set(pt,_t)}let mt=_t.get(Z);if(!mt){mt=new Set;_t.set(Z,mt)}mt.add(ct);const ht=this.overridePropertyDescriptor(ut);Object.defineProperty(Z,ct,ht)}mockContext(Z,ct,ut,pt="default"){if(!this.contextMocks.has(pt)){this.contextMocks.set(pt,[])}this.contextMocks.get(pt).push({app:Z,key:ct,value:ut})}restore(Z="default"){this.restoreGroup(Z)}restoreAll(){const Z=new Set([...this.mocks.keys(),...this.contextMocks.keys(),...this.cache.keys()]);for(const ct of Z){this.restoreGroup(ct)}this.simulatorList=[]}restoreGroup(Z){const ct=this.mocks.get(Z)||[];for(let Z=ct.length-1;Z>=0;Z--){const ut=ct[Z];if(!ut.hasOwnProperty){delete ut.obj[ut.key]}else{Object.defineProperty(ut.obj,ut.key,ut.descriptor)}}this.mocks.delete(Z);this.contextMocks.delete(Z);this.cache.delete(Z);this.simulatorList=this.simulatorList.filter((ct=>ct["group"]!==Z))}isMocked(Z,ct,ut="default"){if((0,ht.isClass)(Z)){Z=Z.prototype}const pt=this.cache.get(ut);const dt=pt?pt.get(Z):undefined;return dt?dt.has(ct):false}applyContextMocks(Z,ct){for(const[,ut]of this.contextMocks){for(const pt of ut){if(pt.app===Z){const Z=this.overridePropertyDescriptor(pt.value);if(typeof pt.key==="string"){Object.defineProperty(ct,pt.key,Z)}else{pt.key(ct)}}}}}getContextMocksSize(){return Array.from(this.contextMocks.values()).reduce(((Z,ct)=>Z+ct.length),0)}overridePropertyDescriptor(Z){const ct={configurable:true,enumerable:true};if(Z&&(Z.get||Z.set)){ct.get=Z.get;ct.set=Z.set}else{ct.value=Z;ct.writable=true}return ct}async initSimulation(Z="default"){const ct=mt.DecoratorManager.listModule(mt.MOCK_KEY);for(const ut of ct){const ct=await this.applicationContext.getAsync(ut);if(await ct.enableCondition()){ct["group"]=Z;this.simulatorList.push(ct)}}}async runSimulatorSetup(){for(const Z of this.simulatorList){await(Z.setup?.())}}async runSimulatorTearDown(){for(let Z=this.simulatorList.length-1;Z>=0;Z--){const ct=this.simulatorList[Z];await(ct.tearDown?.())}}async runSimulatorAppSetup(Z){for(const ct of this.simulatorList){await(ct.appSetup?.(Z))}}async runSimulatorAppTearDown(Z){for(let ct=this.simulatorList.length-1;ct>=0;ct--){const ut=this.simulatorList[ct];await(ut.appTearDown?.(Z))}}async runSimulatorContextSetup(Z,ct){for(const ut of this.simulatorList){await(ut.contextSetup?.(Z,ct))}}async runSimulatorContextTearDown(Z,ct){for(let ut=this.simulatorList.length-1;ut>=0;ut--){const pt=this.simulatorList[ut];await(pt?.contextTearDown?.(Z,ct))}}};ct.MidwayMockService=yt;pt([(0,mt.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],yt.prototype,"init",null);pt([(0,mt.Destroy)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",void 0)],yt.prototype,"restoreAll",null);ct.MidwayMockService=yt=ft=pt([(0,mt.Provide)(),(0,mt.Scope)(_t.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],yt)},84766:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayServerlessFunctionService=void 0;const ft=ut(25923);const _t=ut(95919);const mt=ut(77866);const ht=ut(88067);let yt=class MidwayServerlessFunctionService extends _t.MidwayWebRouterService{options;constructor(Z={}){super(Object.assign({},Z,{includeFunctionRouter:true}));this.options=Z}async analyze(){this.analyzeController();this.analyzeFunction();this.sortPrefixAndRouter();for(const Z of this.routes.values()){for(const ct of Z){if(ct.requestMethod==="all"){ct.functionTriggerMetadata=ct.functionTriggerMetadata||{};ct.functionTriggerMetadata.method=["get","post","put","delete","head","patch","options"]}}}}analyzeFunction(){const Z=ft.DecoratorManager.listModule(ft.FUNC_KEY);for(const ct of Z){this.collectFunctionRoute(ct)}}collectFunctionRoute(Z){const ct=ht.MetadataManager.getOwnMetadata(ft.FUNC_KEY,Z);const ut=ft.DecoratorManager.getProviderName(Z);const pt=ft.DecoratorManager.getProviderUUId(Z);const dt="/";if(!this.routes.has(dt)){this.routes.set(dt,[]);this.routesPriority.push({prefix:dt,priority:-999,middleware:[],routerOptions:{},controllerId:ut,routerModule:Z})}for(const _t of ct){if(_t["metadata"]?.["path"]){const ct=ht.MetadataManager.getOwnMetadata(ft.WEB_ROUTER_PARAM_KEY,Z,_t["methodName"])||[];const mt=ht.MetadataManager.getOwnMetadata(ft.WEB_RESPONSE_KEY,Z,_t["methodName"])||[];const yt={id:pt,prefix:dt,routerName:"",url:_t["metadata"]["path"],requestMethod:_t["metadata"]?.["method"]??"get",method:_t["methodName"],description:"",summary:"",handlerName:`${ut}.${_t["methodName"]}`,funcHandlerName:`${ut}.${_t["methodName"]}`,controllerId:ut,middleware:_t["metadata"]?.["middleware"]||[],controllerMiddleware:[],requestMetadata:ct,responseMetadata:mt};const vt=ht.MetadataManager.getOwnMetadata(ft.SERVERLESS_FUNC_KEY,Z,_t["methodName"])||{};const St=vt["functionName"]??_t?.["metadata"]?.["functionName"]??createFunctionName(Z,_t["methodName"]);const bt=vt["handlerName"]??_t?.["metadata"]?.["handlerName"]??yt.funcHandlerName;yt.functionName=St;yt.funcHandlerName=bt;yt.functionTriggerName=_t["type"];yt.functionTriggerMetadata=_t["metadata"];yt.functionMetadata={functionName:St,...vt};this.checkDuplicateAndPush(dt,yt)}else{const ct=ht.MetadataManager.getOwnMetadata(ft.SERVERLESS_FUNC_KEY,Z,_t["methodName"])||{};const mt=ct["functionName"]??_t?.["metadata"]?.["functionName"]??createFunctionName(Z,_t["methodName"]);const yt=ct["handlerName"]??_t?.["metadata"]?.["handlerName"]??`${ut}.${_t["methodName"]}`;this.checkDuplicateAndPush(dt,{id:pt,prefix:dt,routerName:"",url:"",requestMethod:"",method:_t["methodName"],description:"",summary:"",handlerName:`${ut}.${_t["methodName"]}`,funcHandlerName:yt,controllerId:ut,middleware:_t["metadata"]?.["middleware"]||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:mt,functionTriggerName:_t["type"],functionTriggerMetadata:_t["metadata"],functionMetadata:{functionName:mt,...ct}})}}}async getFunctionList(){return this.getFlattenRouterTable({compileUrlPattern:true})}addServerlessFunction(Z,ct,ut={}){const pt="";if(!this.routes.has(pt)){this.routes.set(pt,[]);this.routesPriority.push({prefix:pt,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}const dt=ct.functionName??ut.functionName;this.checkDuplicateAndPush(pt,{id:null,method:Z,url:ct.metadata["path"]||"",requestMethod:ct.metadata["method"]||"",description:"",summary:"",handlerName:"",funcHandlerName:ct.handlerName||ut.handlerName,controllerId:"",middleware:ct.metadata?.middleware||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:dt,functionTriggerName:ct.metadata.name,functionTriggerMetadata:ct.metadata,functionMetadata:{functionName:dt,...ut}})}};ct.MidwayServerlessFunctionService=yt;ct.MidwayServerlessFunctionService=yt=pt([(0,ft.Provide)(),(0,ft.Scope)(mt.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],yt);function createFunctionName(Z,ct){return ft.DecoratorManager.getProviderName(Z).replace(/[:#]/g,"-")+"-"+ct}},48757:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayTraceService=void 0;const ft=ut(80794);const _t=ut(25923);const mt=ut(77866);const ht=ut(5228);const yt=ut(97685);let vt=class MidwayTraceService{currentTracerName="midway";tracingConfig;app;decoratorService;tracingOptions;logger;init(){this.currentTracerName=this.app?.getProjectName?.()??"unknown_project";this.tracingConfig={enable:true,onError:"ignore",logOnError:false,...this.tracingOptions??{}};this.decoratorService.registerMethodHandler(ht.TRACE_KEY,(Z=>({around:async ct=>this.createSpan(Z.metadata["spanName"],(async Z=>{try{const ut=await ct.proceed(...ct.args);Z.setStatus({code:ft.SpanStatusCode.OK});Z.end();return ut}catch(ct){Z.setStatus({code:ft.SpanStatusCode.ERROR});Z.recordException(ct);Z.end();throw ct}}))})))}getCurrentSpan(){return ft.trace.getSpan(ft.context.active())}getTraceId(){return this.getCurrentSpan()?.spanContext().traceId}createSpan(Z,ct){return ft.trace.getTracer(this.currentTracerName).startActiveSpan(Z,{kind:ft.SpanKind.CLIENT},ct)}defaultGetter={get(Z,ct){if(!Z||!ct){return undefined}if(typeof Z.get==="function"){return Z.get(ct)}const ut=ct.toLowerCase();const pt=Object.keys(Z).find((Z=>Z.toLowerCase()===ut));return pt?Z[pt]:undefined},keys(Z){if(!Z){return[]}return Object.keys(Z)}};defaultSetter={set(Z,ct,ut){if(!Z||!ct){return}if(typeof Z.setHeader==="function"){Z.setHeader(ct,ut);return}if(typeof Z.set==="function"){Z.set(ct,ut);return}Z[ct]=ut}};getProtocolFromAttributes(Z){const ct=Z?.["midway.protocol"];if(!ct||typeof ct!=="string"){return"default"}return ct}isProtocolEnabled(){return this.tracingConfig?.enable!==false}handleTraceError(Z,ct){if(this.tracingConfig?.logOnError){this.logger?.warn?.(`[midway:trace] ${ct} failed: ${Z?.message||Z}`)}if(this.tracingConfig?.onError==="throw"){throw Z}}pickTraceMetaValue(Z){if(!Z||typeof Z!=="object"){return{}}const ct={};for(const[ut,pt]of Object.entries(Z)){if(pt===null||pt===undefined){continue}if(typeof pt==="string"||typeof pt==="number"||typeof pt==="boolean"){ct[ut]=pt}}return ct}resolveTraceMeta(Z,ct){if(!Z){return{}}const mergeMeta=(Z,ut)=>{if(!ut){return}const pt=typeof ut==="function"?ut(ct):ut;Object.assign(Z,this.pickTraceMetaValue(pt))};if(typeof Z==="function"){return this.pickTraceMetaValue(Z(ct))}const ut=Z;if(ut.common!==undefined||ut.entry!==undefined||ut.exit!==undefined){const Z={};mergeMeta(Z,ut.common);mergeMeta(Z,ut[ct.direction]);return Z}return this.pickTraceMetaValue(Z)}runWithEntrySpan(Z,ct,ut){const pt=this.getProtocolFromAttributes(ct.attributes);const dt=this.resolveTraceMeta(ct.meta,{direction:"entry",protocol:pt,spanName:Z,...ct.metaArgs??{}});const _t={...ct.attributes??{},...dt};if(!this.isProtocolEnabled()||ct.enable===false){return Promise.resolve(ut(undefined))}const mt=ct.getter??this.defaultGetter;const ht=ct.setter??this.defaultSetter;let yt=ft.context.active();if(ct.carrier){try{yt=ft.propagation.extract(ft.context.active(),ct.carrier,mt)}catch(Z){this.handleTraceError(Z,"extract entry context")}}return ft.trace.getTracer(this.currentTracerName).startActiveSpan(Z,{kind:ct.kind??ft.SpanKind.SERVER,attributes:_t},yt,(async Z=>{try{const pt=await ut(Z);Z.setStatus({code:ft.SpanStatusCode.OK});if(ct.responseCarrier){try{ft.propagation.inject(ft.context.active(),ct.responseCarrier,ht)}catch(Z){this.handleTraceError(Z,"inject entry response context")}}return pt}catch(ct){Z.setStatus({code:ft.SpanStatusCode.ERROR});Z.recordException(ct);throw ct}finally{Z.end()}}))}runWithExitSpan(Z,ct,ut){const pt=this.getProtocolFromAttributes(ct.attributes);const dt=this.resolveTraceMeta(ct.meta,{direction:"exit",protocol:pt,spanName:Z,...ct.metaArgs??{}});const _t={...ct.attributes??{},...dt};if(!this.isProtocolEnabled()||ct.enable===false){return Promise.resolve(ut(undefined))}const mt=ct.setter??this.defaultSetter;const ht=ct.carrier??{};return ft.trace.getTracer(this.currentTracerName).startActiveSpan(Z,{kind:ct.kind??ft.SpanKind.CLIENT,attributes:_t},(async Z=>{try{try{ft.propagation.inject(ft.context.active(),ht,mt)}catch(Z){this.handleTraceError(Z,"inject exit context")}const ct=await ut(Z);Z.setStatus({code:ft.SpanStatusCode.OK});return ct}catch(ct){Z.setStatus({code:ft.SpanStatusCode.ERROR});Z.recordException(ct);throw ct}finally{Z.end()}}))}injectContext(Z,ct){try{ft.propagation.inject(ft.context.active(),Z,ct??this.defaultSetter)}catch(Z){this.handleTraceError(Z,"inject context")}return Z}};ct.MidwayTraceService=vt;pt([(0,_t.MainApp)(),dt("design:type",Object)],vt.prototype,"app",void 0);pt([(0,_t.Inject)(),dt("design:type",yt.MidwayDecoratorService)],vt.prototype,"decoratorService",void 0);pt([(0,_t.Config)("tracing"),dt("design:type",Object)],vt.prototype,"tracingOptions",void 0);pt([(0,_t.Logger)("coreLogger"),dt("design:type",Object)],vt.prototype,"logger",void 0);pt([(0,_t.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",void 0)],vt.prototype,"init",null);ct.MidwayTraceService=vt=pt([(0,_t.Provide)(),(0,_t.Scope)(mt.ScopeEnum.Singleton)],vt)},95919:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayWebRouterService=void 0;const ft=ut(25923);const _t=ut(53386);const mt=ut(28068);const ht=ut(39023);const yt=ut(57095);const vt=ut(35175);const St=ut(77866);const bt=ut(88067);const xt=ut(26966);const $t=ht.debuglog("midway:debug");let Et=class MidwayWebRouterService{options;isReady=false;routes=new Map;routesPriority=[];loggerService;constructor(Z={}){this.options=Z}async analyze(){this.analyzeController();this.sortPrefixAndRouter()}analyzeController(){const Z=ft.DecoratorManager.listModule(ft.CONTROLLER_KEY);const ct=[];const ut=new Map;for(const pt of Z){const Z=!!bt.MetadataManager.getOwnMetadata(ft.FUNCTIONAL_API_CONTROLLER_KEY,pt);if(!Z){ct.push(pt);continue}const dt=bt.MetadataManager.getOwnMetadata(ft.CONTROLLER_KEY,pt);const _t=bt.MetadataManager.getOwnMetadata(ft.WEB_ROUTER_KEY,pt);if(!dt||!_t){ct.push(pt);continue}const mt=_t.map((Z=>`${(Z.requestMethod||"").toLowerCase()}|${String(Z.path||"/")}|${Z.routerName||""}|${Z.method||""}`)).sort().join(";");const ht=`${dt.prefix||"/"}::${mt}`;const yt=ut.get(ht);if(typeof yt==="number"){ct[yt]=pt}else{ut.set(ht,ct.length);ct.push(pt)}}for(const Z of ct){const ct=bt.MetadataManager.getOwnMetadata(ft.CONTROLLER_KEY,Z);this.addController(Z,ct,this.options.includeFunctionRouter)}}sortPrefixAndRouter(){this.routesPriority=this.routesPriority.filter((Z=>{const ct=this.routes.get(Z.prefix);if(ct.length>0){return true}else{this.routes.delete(Z.prefix);return false}}));for(const Z of this.routes.keys()){const ct=this.routes.get(Z);this.routes.set(Z,this.sortRouter(ct))}this.routesPriority=this.routesPriority.sort(((Z,ct)=>ct.prefix.length-Z.prefix.length))}addController(Z,ct,ut={},pt=false){if(ut&&typeof ut==="boolean"){pt=ut;ut=undefined}if(!ut){ut={}}const dt=ft.DecoratorManager.getProviderName(Z);$t(`[core]: Found Controller ${dt}.`);const ht=ft.DecoratorManager.getProviderUUId(Z);ct.routerOptions=ct.routerOptions||{};const yt=ct.routerOptions.middleware;const vt=!!ct.routerOptions?.ignoreGlobalPrefix;const xt=ct.routerOptions?.version;const Et=xt?ct.routerOptions?.versionType||"URI":undefined;const Ct=Et==="URI"?ct.routerOptions?.versionPrefix||"v":ct.routerOptions?.versionPrefix;let Tt=(0,_t.joinURLPath)(this.options.globalPrefix,ct.prefix||"/");const wt=ct.prefix||"/";let At=wt;if(xt&&Et==="URI"){const Z=Array.isArray(xt)?xt[0]:xt;const ut=`/${Ct}${Z}`;Tt=(0,_t.joinURLPath)(this.options.globalPrefix,ut,ct.prefix||"/");At=(0,_t.joinURLPath)(ut,wt)}if(/\*/.test(Tt)){throw new mt.MidwayCommonError(`Router prefix ${Tt} can't set string with *`)}if(!this.routes.has(Tt)){this.routes.set(Tt,[]);this.routesPriority.push({prefix:Tt,priority:Tt==="/"?-999:0,middleware:yt,routerOptions:ct.routerOptions,controllerId:dt,routerModule:Z})}else{if(yt&&yt.length>0){const Z=this.routesPriority.filter((Z=>Z.prefix===Tt))[0];throw new mt.MidwayDuplicateControllerOptionsError(Tt,dt,Z.controllerId)}}const kt=bt.MetadataManager.getOwnMetadata(ft.WEB_ROUTER_KEY,Z);const It=!!kt&&kt.some((Z=>Z?.ignoreGlobalPrefix===true));if(vt||It){if(!this.routes.has(At)){this.routes.set(At,[]);this.routesPriority.push({prefix:At,priority:At==="/"?-999:0,middleware:yt,routerOptions:ct.routerOptions,controllerId:dt,routerModule:Z})}}if(kt&&typeof kt[Symbol.iterator]==="function"){for(const ct of kt){const mt=ct.__ignoreGlobalPrefixConfigured===true;const $t=bt.MetadataManager.getOwnMetadata(ft.WEB_ROUTER_PARAM_KEY,Z,ct.method)||[];const wt=bt.MetadataManager.getOwnMetadata(ft.WEB_RESPONSE_KEY,Z,ct.method)||[];const kt={id:ht,prefix:mt?ct.ignoreGlobalPrefix?At:Tt:vt?At:Tt,routerName:ct.routerName||"",url:ct.path,requestMethod:ct.requestMethod,method:ct.method,description:ct.description||"",summary:ct.summary||"",handlerName:`${dt}.${ct.method}`,funcHandlerName:`${dt}.${ct.method}`,controllerId:dt,controllerClz:Z,middleware:ct.middleware||[],controllerMiddleware:yt||[],requestMetadata:$t,responseMetadata:wt};const It=!!bt.MetadataManager.getOwnMetadata(ft.FUNCTIONAL_API_CONTROLLER_KEY,Z);if(It){kt.source="functional"}if(mt||vt){const Z=mt?!!ct.ignoreGlobalPrefix:vt;if(Z){kt.ignoreGlobalPrefix=true}}if(xt){kt.version=xt;kt.versionType=Et;kt.versionPrefix=Ct}if(pt){kt.functionName=dt+"-"+ct.method;kt.functionTriggerName=St.ServerlessTriggerType.HTTP;kt.functionTriggerMetadata={path:(0,_t.joinURLPath)(kt.prefix,ct.path.toString()),method:ct.requestMethod};kt.functionMetadata={functionName:kt.functionName}}if(ut.resourceFilter&&!ut.resourceFilter(kt)){continue}this.checkDuplicateAndPush(kt.prefix,kt)}}}addRouter(Z,ct){const ut=ct.prefix||"";ct.requestMethod=(ct.requestMethod||"GET").toUpperCase();if(!this.routes.has(ut)){this.routes.set(ut,[]);this.routesPriority.push({prefix:ut,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}this.checkDuplicateAndPush(ut,Object.assign(ct,{method:Z}));this.sortPrefixAndRouter()}sortRouter(Z){return Z.map((Z=>{const ct=Z.url.toString();const ut=vt.Types.isRegExp(Z.url)?ct.split("\\/"):ct.split("/");let pt=0;for(const Z of ut){if(Z===""||Z.includes(":")||Z.includes("*")){pt+=0}else{pt+=1}}let dt=2;const ft=ct.includes(":")?ct.replace(/:.+$/,""):"";if(ft){dt=1}if(ct.includes("*")){dt=0}return{...Z,_pureRouter:ct.replace(/\**$/,"").replace(/:\w+/,"123"),_level:ct.split("/").length-1,_paramString:ft,_category:dt,_weight:pt}})).sort(((Z,ct)=>{if(Z._category!==ct._category){return ct._category-Z._category}if(Z._weight!==ct._weight){return ct._weight-Z._weight}if(Z._level===ct._level){if(ct._pureRouter===Z._pureRouter){return Z.url.toString().length-ct.url.toString().length}return ct._pureRouter.length-Z._pureRouter.length}return ct._level-Z._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(Z={}){if(!this.isReady){await this.analyze();this.isReady=true}let ct=[];for(const Z of this.routesPriority){ct=ct.concat(this.routes.get(Z.prefix))}if(Z.compileUrlPattern){for(const Z of ct){if(Z.fullUrlFlattenString){Z.fullUrlCompiledRegexp=yt.PathToRegexpUtil.toRegexp(Z.fullUrlFlattenString)}}}return ct}async getMatchedRouterInfo(Z,ct){const ut=await this.getFlattenRouterTable({compileUrlPattern:true});let pt;for(const dt of ut){if(dt.fullUrlCompiledRegexp){const ut=dt["requestMethod"].toUpperCase();if(("ALL"===ut||ct.toUpperCase()===ut)&&dt.fullUrlCompiledRegexp.test(Z)){pt=dt;break}}}return pt}async getRouteManifest(){const Z=await this.getFlattenRouterTable();const ct=Z.map((Z=>({source:Z.source??"decorator",operationId:this.getOperationId(Z),controllerId:Z.controllerId,controllerPrefix:Z.prefix||"",method:Z.requestMethod,path:Z.url?.toString()||"",fullPath:Z.fullUrl||"",routerName:Z.routerName,middlewareCount:(Z.middleware?.length||0)+(Z.controllerMiddleware?.length||0),ignoreGlobalPrefix:!!Z.ignoreGlobalPrefix,version:Z.version,versionType:Z.versionType,versionPrefix:Z.versionPrefix,summary:Z.summary,description:Z.description})));this.checkDuplicateOperationId(ct);return ct}checkDuplicateAndPush(Z,ct){const ut=this.routes.get(Z);const pt=ut.filter((Z=>ct.url&&ct.requestMethod&&Z.url===ct.url&&Z.requestMethod===ct.requestMethod));if(pt&&pt.length){const ut=pt[0];const dt=ut.fullUrl||(typeof ct.url==="string"?(0,_t.joinURLPath)(Z,ct.url):`${Z}${ct.url?.toString()||""}`);const ft={code:"MIDWAY_DUPLICATE_ROUTE",method:(ct.requestMethod||"").toUpperCase(),fullPath:dt,existing:{source:ut.source??"decorator",handler:this.getRouterHandlerIdentity(ut)},current:{source:ct.source??"decorator",handler:this.getRouterHandlerIdentity(ct)}};throw new mt.MidwayDuplicateRouteError(`${ct.requestMethod} ${ct.url}`,ft.existing.handler,ft.current.handler,ft)}if(!ct.fullUrlFlattenString&&ct.url&&typeof ct.url==="string"){ct.fullUrl=(0,_t.joinURLPath)(Z,ct.url);if(/\*$/.test(ct.fullUrl)){ct.fullUrlFlattenString=ct.fullUrl.replace("*","(.*)")}else{ct.fullUrlFlattenString=ct.fullUrl}}ut.push(ct);this.logRouteLoaded(ct)}logRouteLoaded(Z){const ct=Z.fullUrl||(typeof Z.url==="string"?(0,_t.joinURLPath)(Z.prefix||"",Z.url):`${Z.prefix||""}${Z.url?.toString()||""}`);const ut=this.loggerService?.getLogger("appLogger");if(!ut||typeof ut.info!=="function"){return}ut.info("[midway:router] loaded route %s %s -> %s (%s)",(Z.requestMethod||"ALL").toUpperCase(),ct,this.getRouterHandlerIdentity(Z),Z.source??"decorator")}getRouterHandlerIdentity(Z){if(Z.handlerName){return Z.handlerName}if(typeof Z.method==="string"){return Z.controllerId?`${Z.controllerId}.${Z.method}`:Z.method}if(typeof Z.method==="function"){return Z.method.name||"anonymous"}return"unknown"}getOperationId(Z){if(Z.routerName){return Z.routerName}const ct=Z.fullUrl||Z.url?.toString()||"/";return`${(Z.requestMethod||"all").toLowerCase()}_${ct.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}`}checkDuplicateOperationId(Z){const ct=new Map;for(const ut of Z){const Z=ct.get(ut.operationId);if(Z){throw new mt.MidwayCommonError(`Duplicate operationId "${ut.operationId}" between "${Z.method.toUpperCase()} ${Z.fullPath}" and "${ut.method.toUpperCase()} ${ut.fullPath}"`)}ct.set(ut.operationId,ut)}}};ct.MidwayWebRouterService=Et;pt([(0,ft.Inject)(),dt("design:type",xt.MidwayLoggerService)],Et.prototype,"loggerService",void 0);ct.MidwayWebRouterService=Et=pt([(0,ft.Provide)(),(0,ft.Scope)(St.ScopeEnum.Singleton),dt("design:paramtypes",[Object])],Et)},86052:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.initializeGlobalApplicationContext=initializeGlobalApplicationContext;ct.destroyGlobalApplicationContext=destroyGlobalApplicationContext;ct.prepareGlobalApplicationContextAsync=prepareGlobalApplicationContextAsync;ct.prepareGlobalApplicationContext=prepareGlobalApplicationContext;const pt=ut(31049);const dt=ut(98727);const ft=ut(39023);const _t=ut(84766);const mt=ut(67056);const ht=ut(48757);const yt=ut(84237);const vt=ut(53386);const St=ut(45213);const bt=ut(81680);const xt=ut(11386);const $t=ft.debuglog("midway:debug");let Et=1;let Ct=1;function printStepDebugInfo(Z){$t(`\n\nProject ${Ct} - Step ${Et++}: ${Z}\n`)}async function initializeGlobalApplicationContext(Z){xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);const ct=await prepareGlobalApplicationContextAsync(Z);printStepDebugInfo("Init logger");xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);const ut=await ct.getAsync(pt.MidwayLoggerService,[ct,Z]);if(ut.getLogger("appLogger")){ct.registerObject("logger",ut.getLogger("appLogger"))}xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);printStepDebugInfo("Init MidwayMockService");await ct.getAsync(pt.MidwayMockService,[ct]);printStepDebugInfo("Init framework");xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);await ct.getAsync(pt.MidwayFrameworkService,[ct,Z]);printStepDebugInfo("Init tracing");await ct.getAsync(ht.MidwayTraceService);xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);printStepDebugInfo("Init lifecycle");xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);await ct.getAsync(pt.MidwayLifeCycleService,[ct]);xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);printStepDebugInfo("Init pre-start modules");xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);const dt=pt.DecoratorManager.listPreStartModule();for(const Z of dt){await ct.getAsync(Z)}xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);printStepDebugInfo("End of initialize and start");xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);return ct}async function destroyGlobalApplicationContext(Z){printStepDebugInfo("Ready to destroy applicationContext");const ct=await Z.getAsync(pt.MidwayLoggerService);const ut=ct.getCurrentLoggerFactory();printStepDebugInfo("Stopping lifecycle");const dt=await Z.getAsync(pt.MidwayLifeCycleService);await dt.stop();printStepDebugInfo("Stopping applicationContext");await Z.stop();printStepDebugInfo("Closing loggerFactory");ut.close();printStepDebugInfo("Cleaning performance manager");xt.MidwayPerformanceManager.cleanAll();global["MIDWAY_APPLICATION_CONTEXT"]=undefined;global["MIDWAY_MAIN_FRAMEWORK"]=undefined;Et=1;Ct++}async function prepareGlobalApplicationContextAsync(Z){printStepDebugInfo("Ready to create applicationContext");$t('[core]: start "initializeGlobalApplicationContext"');$t(`[core]: bootstrap options = ${ft.inspect(Z)}`);const ct=Z.appDir??"";const ut=Z.baseDir??"";xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const Et=Z.applicationContext??new pt.MidwayContainer;global["MIDWAY_APPLICATION_CONTEXT"]=Et;Et.registerObject("baseDir",ut);Et.registerObject("appDir",ct);if(Z.moduleLoader){Et.registerObject(bt.MODULE_LOADER_KEY,Z.moduleLoader)}if(!Z.asyncContextManager){Z.asyncContextManager=new St.AsyncLocalStorageContextManager}$t("[core]: set default module load type and entry file");xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);$t("[core]: set default file detector");xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Ready module detector");if(!Z.moduleLoadType){Z.moduleLoadType="commonjs"}Z.imports=[...Z.imports??[],await(0,vt.findProjectEntryFile)(ct,ut,Z.moduleLoadType,Z.moduleLoader)];xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding built-in service");Et.bindClass(pt.MidwayEnvironmentService);Et.bindClass(pt.MidwayInformationService);Et.bindClass(pt.MidwayAspectService);Et.bindClass(pt.MidwayDecoratorService);Et.bindClass(pt.MidwayConfigService);Et.bindClass(pt.MidwayLoggerService);Et.bindClass(pt.MidwayApplicationManager);Et.bindClass(pt.MidwayFrameworkService);Et.bindClass(pt.MidwayMiddlewareService);Et.bindClass(pt.MidwayLifeCycleService);Et.bindClass(pt.MidwayMockService);Et.bindClass(pt.MidwayWebRouterService);Et.bindClass(_t.MidwayServerlessFunctionService);Et.bindClass(mt.MidwayHealthService);Et.bindClass(pt.MidwayPriorityManager);Et.bindClass(ht.MidwayTraceService);printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const Ct=Et.get(pt.MidwayEnvironmentService);Ct.setModuleLoadType(Z.moduleLoadType);const Tt=Et.get(pt.MidwayConfigService);Tt.add([{default:dt.default}]);Et.get(pt.MidwayAspectService,[Et]);Et.get(pt.MidwayDecoratorService,[Et]);printStepDebugInfo("Binding preload module");if(Z.preloadModules&&Z.preloadModules.length){for(const ct of Z.preloadModules){Et.bindClass(ct)}}printStepDebugInfo("Load imports(component) and user code configuration module");xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);const wt=new yt.ComponentConfigurationLoader(Et);const At=[...Z.imports??[]];for(const Z of At){if(Z){await wt.load(Z)}}for(const Z of wt.getNamespaceList()){Et.addNamespace(Z);$t(`[core]: load configuration in namespace="${Z}" complete`)}xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(Z.globalConfig){if(Array.isArray(Z.globalConfig)){Tt.add(Z.globalConfig)}else{Tt.addObject(Z.globalConfig)}}printStepDebugInfo("Load config file");Tt.load();$t("[core]: Current config = %j",Tt.getConfiguration());xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);Et.get(pt.MidwayMiddlewareService,[Et]);return Et}function prepareGlobalApplicationContext(Z){printStepDebugInfo("Ready to create applicationContext");$t('[core]: start "initializeGlobalApplicationContext"');$t(`[core]: bootstrap options = ${ft.inspect(Z)}`);const ct=Z.appDir??"";const ut=Z.baseDir??"";xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const ht=Z.applicationContext??new pt.MidwayContainer;global["MIDWAY_APPLICATION_CONTEXT"]=ht;ht.registerObject("baseDir",ut);ht.registerObject("appDir",ct);if(Z.moduleLoader){ht.registerObject(bt.MODULE_LOADER_KEY,Z.moduleLoader)}if(!Z.asyncContextManager){Z.asyncContextManager=new St.AsyncLocalStorageContextManager}xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);$t("[core]: set default module load type and entry file");if(!Z.moduleLoadType){Z.moduleLoadType="commonjs"}Z.imports=[...Z.imports??[],(0,vt.findProjectEntryFileSync)(ct,ut)];printStepDebugInfo("Binding built-in service");ht.bindClass(pt.MidwayEnvironmentService);ht.bindClass(pt.MidwayInformationService);ht.bindClass(pt.MidwayAspectService);ht.bindClass(pt.MidwayDecoratorService);ht.bindClass(pt.MidwayConfigService);ht.bindClass(pt.MidwayLoggerService);ht.bindClass(pt.MidwayApplicationManager);ht.bindClass(pt.MidwayFrameworkService);ht.bindClass(pt.MidwayMiddlewareService);ht.bindClass(pt.MidwayLifeCycleService);ht.bindClass(pt.MidwayMockService);ht.bindClass(pt.MidwayWebRouterService);ht.bindClass(_t.MidwayServerlessFunctionService);ht.bindClass(mt.MidwayHealthService);ht.bindClass(pt.MidwayPriorityManager);printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const Et=ht.get(pt.MidwayEnvironmentService);Et.setModuleLoadType(Z.moduleLoadType);const Ct=ht.get(pt.MidwayConfigService);Ct.add([{default:dt.default}]);ht.get(pt.MidwayAspectService,[ht]);ht.get(pt.MidwayDecoratorService,[ht]);printStepDebugInfo("Binding preload module");if(Z.preloadModules&&Z.preloadModules.length){for(const ct of Z.preloadModules){ht.bindClass(ct)}}printStepDebugInfo("Load imports(component) and user code configuration module");const Tt=new yt.ComponentConfigurationLoader(ht);const wt=[...Z.imports??[]];xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);for(const Z of wt){if(Z){Tt.loadSync(Z)}}for(const Z of Tt.getNamespaceList()){ht.addNamespace(Z);$t(`[core]: load configuration in namespace="${Z}" complete`)}xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);xt.MidwayInitializerPerformanceManager.markStart(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(Z.globalConfig){if(Array.isArray(Z.globalConfig)){Ct.add(Z.globalConfig)}else{Ct.addObject(Z.globalConfig)}}printStepDebugInfo("Load config file");Ct.load();$t("[core]: Current config = %j",Ct.getConfiguration());xt.MidwayInitializerPerformanceManager.markEnd(xt.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);ht.get(pt.MidwayMiddlewareService,[ht]);return ht}},44540:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.camelCase=camelCase;ct.pascalCase=pascalCase;const ut=/[\p{Lu}]/u;const pt=/[\p{Ll}]/u;const dt=/([\p{Alpha}\p{N}_]|$)/u;const ft=/[_.\- ]+/;const _t=new RegExp("^"+ft.source);const mt=new RegExp(ft.source+dt.source,"gu");const ht=new RegExp("\\d+"+dt.source,"gu");const preserveCamelCase=(Z,ct,dt)=>{let ft=false;let _t=false;let mt=false;for(let ht=0;ht<Z.length;ht++){const yt=Z[ht];if(ft&&ut.test(yt)){Z=Z.slice(0,ht)+"-"+Z.slice(ht);ft=false;mt=_t;_t=true;ht++}else if(_t&&mt&&pt.test(yt)){Z=Z.slice(0,ht-1)+"-"+Z.slice(ht-1);mt=_t;_t=false;ft=true}else{ft=ct(yt)===yt&&dt(yt)!==yt;mt=_t;_t=dt(yt)===yt&&ct(yt)!==yt}}return Z};const postProcess=(Z,ct)=>{mt.lastIndex=0;ht.lastIndex=0;return Z.replace(mt,((Z,ut)=>ct(ut))).replace(ht,(Z=>ct(Z)))};function camelCaseOrigin(Z,ct){ct={pascalCase:false,...ct};Z=Z.trim();if(Z.length===0){return""}const toLowerCase=Z=>Z.toLowerCase();const toUpperCase=Z=>Z.toUpperCase();if(Z.length===1){if(ft.test(Z)){return""}return ct.pascalCase?toUpperCase(Z):toLowerCase(Z)}const ut=Z!==toLowerCase(Z);if(ut){Z=preserveCamelCase(Z,toLowerCase,toUpperCase)}Z=Z.replace(_t,"");Z=toLowerCase(Z);if(ct.pascalCase){Z=toUpperCase(Z.charAt(0))+Z.slice(1)}return postProcess(Z,toUpperCase)}function camelCase(Z){return camelCaseOrigin(Z,{pascalCase:false})}function pascalCase(Z){return camelCaseOrigin(Z,{pascalCase:true})}},9177:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.getCurrentAsyncContextManager=ct.getCurrentMainApp=ct.getCurrentMainFramework=ct.getCurrentApplicationContext=void 0;const pt=ut(81680);const getCurrentApplicationContext=()=>global["MIDWAY_APPLICATION_CONTEXT"];ct.getCurrentApplicationContext=getCurrentApplicationContext;const getCurrentMainFramework=()=>global["MIDWAY_MAIN_FRAMEWORK"];ct.getCurrentMainFramework=getCurrentMainFramework;const getCurrentMainApp=()=>{const Z=(0,ct.getCurrentMainFramework)();if(Z){return Z.getApplication()}return undefined};ct.getCurrentMainApp=getCurrentMainApp;const getCurrentAsyncContextManager=()=>(0,ct.getCurrentApplicationContext)().get(pt.ASYNC_CONTEXT_MANAGER_KEY);ct.getCurrentAsyncContextManager=getCurrentAsyncContextManager},5904:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.extend=extend;const pt=ut(35175);function extend(...Z){let ct,ut,dt,ft,_t;let mt=Z[0];let ht=1;const yt=Z.length;let vt=false;if(typeof mt==="boolean"){vt=mt;mt=Z[1]||{};ht=2}else if(typeof mt!=="object"&&typeof mt!=="function"||mt==null){mt={}}for(;ht<yt;++ht){ct=Z[ht];if(ct==null)continue;for(ut in ct){if(ut==="__proto__")continue;dt=mt[ut];ft=ct[ut];if(mt===ft)continue;if(vt&&ft&&pt.Types.isPlainObject(ft)){_t=dt&&pt.Types.isPlainObject(dt)?dt:{};mt[ut]=extend(vt,_t,ft)}else if(typeof ft!=="undefined"){mt[ut]=ft}}}return mt}},17658:(Z,ct)=>{"use strict";
|
|
2
2
|
/*! (c) 2020 Andrea Giammarchi */Object.defineProperty(ct,"__esModule",{value:true});ct.safeParse=safeParse;ct.safeStringify=safeStringify;const{parse:ut,stringify:pt}=JSON;const{keys:dt}=Object;const ft=String;const _t="string";const mt={};const ht="object";const noop=(Z,ct)=>ct;const primitives=Z=>Z instanceof ft?ft(Z):Z;const Primitives=(Z,ct)=>typeof ct===_t?new ft(ct):ct;const revive=(Z,ct,ut,pt)=>{const _t=[];for(let yt=dt(ut),{length:vt}=yt,St=0;St<vt;St++){const dt=yt[St];const vt=ut[dt];if(vt instanceof ft){const ft=Z[vt];if(typeof ft===ht&&!ct.has(ft)){ct.add(ft);ut[dt]=mt;_t.push({k:dt,a:[Z,ct,ft,pt]})}else ut[dt]=pt.call(ut,dt,ft)}else if(ut[dt]!==mt)ut[dt]=pt.call(ut,dt,vt)}for(let{length:Z}=_t,ct=0;ct<Z;ct++){const{k:Z,a:dt}=_t[ct];ut[Z]=pt.call(ut,Z,revive.apply(null,dt))}return ut};const set=(Z,ct,ut)=>{const pt=ft(ct.push(ut)-1);Z.set(ut,pt);return pt};function safeParse(Z,ct){const pt=ut(Z,Primitives).map(primitives);const dt=pt[0];const ft=ct||noop;const _t=typeof dt===ht&&dt?revive(pt,new Set,dt,ft):dt;return ft.call({"":_t},"",_t)}function safeStringify(Z,ct,ut){const dt=ct&&typeof ct===ht?(Z,ut)=>Z===""||-1<ct.indexOf(Z)?ut:void 0:ct||noop;const ft=new Map;const mt=[];const yt=[];let vt=+set(ft,mt,dt.call({"":Z},"",Z));let St=!vt;while(vt<mt.length){St=true;yt[vt]=pt(mt[vt++],replace,ut)}return"["+yt.join(",")+"]";function replace(Z,ct){if(St){St=!St;return ct}const ut=dt.call(this,Z,ct);switch(typeof ut){case ht:if(ut===null)return ut;case _t:return ft.get(ut)||set(ft,mt,ut)}return ut}}},62107:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.FORMAT=void 0;const ut=1e3;const pt=ut*60;const dt=pt*60;const ft=dt*24;const _t=ft*7;const mt=ft*365.25;const ht={ONE_SECOND:ut,ONE_MINUTE:pt,ONE_HOUR:dt,ONE_DAY:ft,ONE_WEEK:_t,ONE_YEAR:mt};const yt={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 * * * *"};ct.FORMAT={MS:ht,CRONTAB:yt}},32587:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.FileUtils=void 0;ct.exists=exists;const pt=ut(79896);async function exists(Z){return pt.promises.access(Z,pt.constants.F_OK).then((()=>true)).catch((()=>false))}ct.FileUtils={exists:exists}},38291:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.HttpClient=void 0;ct.makeHttpRequest=makeHttpRequest;const pt=ut(58611);const dt=ut(65692);const ft=ut(87016);const _t=ut(39023);const mt=ut(28068);const ht=(0,_t.debuglog)("request-client");const yt=ft.URL;const vt={text:"application/text",json:"application/json",octet:"application/octet-stream"};function isHeaderExists(Z,ct){return Z[ct]||Z[ct.toLowerCase()]||Z[ct.toUpperCase()]}async function makeHttpRequest(Z,ct={}){ht(`request '${Z}'`);const ut=new yt(Z);const ft=ut.protocol==="https:"?dt:pt;ct.method=(ct.method||"GET").toUpperCase();const{contentType:_t,dataType:St,method:bt,timeout:xt=5e3,headers:$t,...Et}=ct;const Ct={Accept:vt[St]||vt.octet,...$t};let Tt;if(bt==="GET"&&ct.data){for(const Z of Object.keys(ct.data)){ut.searchParams.set(Z,ct.data[Z])}Ct["Content-Length"]=0}else if(ct.data){Tt=Buffer.from(JSON.stringify(ct.data));if(!isHeaderExists(Ct,"Content-Type")){Ct["Content-Type"]=vt[_t]||vt.octet}if(!isHeaderExists(Ct,"Content-Length")){Ct["Content-Length"]=Tt.byteLength}}return new Promise(((ct,pt)=>{const dt=ft.request(ut.toString(),{method:bt,headers:Ct,...Et},(ut=>{ut.setTimeout(xt,(()=>{ut.destroy(new Error("Response Timeout"))}));ut.on("error",(Z=>{pt(Z)}));const dt=[];ut.on("data",(Z=>{dt.push(Z)}));ut.on("end",(()=>{let ft=Buffer.concat(dt);if(St==="text"||St==="json"){ft=ft.toString("utf8")}if(St==="json"){try{ft=JSON.parse(ft)}catch(Z){return pt(new Error("[httpclient] Unable to parse response data"))}}Object.assign(ut,{status:ut.statusCode,data:ft});ht(`request '${Z}' resolved with status ${ut.statusCode}`);ct(ut)}))}));dt.setTimeout(xt,(()=>{dt.destroy(new mt.MidwayUtilHttpClientTimeoutError("Request Timeout"))}));dt.on("error",(Z=>{pt(Z)}));if(bt!=="GET"){dt.end(Tt)}else{dt.end()}}))}class HttpClient{defaultOptions;constructor(Z={}){this.defaultOptions=Z}async request(Z,ct){return makeHttpRequest(Z,Object.assign({},this.defaultOptions,ct))}}ct.HttpClient=HttpClient},53386:(Z,ct,ut)=>{"use strict";Z=ut.nmd(Z);Object.defineProperty(ct,"__esModule",{value:true});ct.Utils=ct.transformRequestObjectByType=ct.deprecatedOutput=ct.getCurrentDateString=ct.loadModuleSync=ct.loadModule=ct.safeRequire=ct.getCurrentEnvironment=ct.isDevelopmentEnvironment=void 0;ct.safelyGet=safelyGet;ct.parsePrefix=parsePrefix;ct.getUserHome=getUserHome;ct.joinURLPath=joinURLPath;ct.delegateTargetPrototypeMethod=delegateTargetPrototypeMethod;ct.delegateTargetAllPrototypeMethod=delegateTargetAllPrototypeMethod;ct.delegateTargetMethod=delegateTargetMethod;ct.delegateTargetProperties=delegateTargetProperties;ct.toPathMatch=toPathMatch;ct.pathMatching=pathMatching;ct.wrapMiddleware=wrapMiddleware;ct.isIncludeProperty=isIncludeProperty;ct.wrapAsync=wrapAsync;ct.sleep=sleep;ct.getParamNames=getParamNames;ct.generateRandomId=generateRandomId;ct.merge=merge;ct.toAsyncFunction=toAsyncFunction;ct.isTypeScriptEnvironment=isTypeScriptEnvironment;ct.isConfigurationExport=isConfigurationExport;ct.findProjectEntryFile=findProjectEntryFile;ct.findProjectEntryFileSync=findProjectEntryFileSync;const pt=ut(16928);const dt=ut(79896);const ft=ut(39023);const _t=ut(57095);const mt=ut(28068);const ht=ut(44540);const yt=ut(23839);const vt=ut(17658);const St=ut(76982);const bt=ut(35175);const xt=ut(87016);const $t=ut(53073);const Et=ut(88067);const Ct=ut(25923);const Tt=(0,ft.debuglog)("midway:debug");const isDevelopmentEnvironment=Z=>["local","test","unittest"].includes(Z);ct.isDevelopmentEnvironment=isDevelopmentEnvironment;const getCurrentEnvironment=()=>process.env["MIDWAY_SERVER_ENV"]||process.env["NODE_ENV"]||"prod";ct.getCurrentEnvironment=getCurrentEnvironment;const safeRequire=(ct,ft=true)=>{if(ct.startsWith(`.${pt.sep}`)||ct.startsWith(`..${pt.sep}`)){ct=(0,pt.resolve)((0,pt.dirname)(Z.parent.filename),ct)}try{if(ft){return ut(61242)(ct)}else{const Z=(0,dt.readFileSync)(ct,{encoding:"utf-8"});return JSON.parse(Z)}}catch(Z){Tt(`[core]: SafeRequire Warning\n\n${Z.message}\n`);return undefined}};ct.safeRequire=safeRequire;const loadModule=async(ct,ft={})=>{ft.enableCache=ft.enableCache??true;ft.safeLoad=ft.safeLoad??false;ft.loadMode=ft.loadMode??"commonjs";if(ct.startsWith(`.${pt.sep}`)||ct.startsWith(`..${pt.sep}`)){ct=(0,pt.resolve)((0,pt.dirname)(Z.parent.filename),ct)}Tt(`[core]: load module ${ct}, cache: ${ft.enableCache}, mode: ${ft.loadMode}, safeLoad: ${ft.safeLoad}`);try{if(ft.enableCache){if(ft.loadMode==="commonjs"){try{return ut(61242)(ct)}catch{for(const Z of[process.cwd(),...ft.extraModuleRoot||[]]){try{return ut(61242)(ut(61242).resolve(ct,{paths:[Z]}))}catch{}}}}else{if(ct.endsWith(".json")){return(await ut(34286)(ct)).default}else{const Z=(0,xt.pathToFileURL)(ct);if(ft.importQuery){Z.searchParams.set("mwImportQuery",ft.importQuery)}return await ut(34286)(Z.href)}}}else{const Z=(0,dt.readFileSync)(ct,{encoding:"utf-8"});return JSON.parse(Z)}}catch(Z){if(!ft.safeLoad){throw Z}else{if(ft.warnOnLoadError&&Z.code!=="MODULE_NOT_FOUND"){console.warn(Z)}Tt(`[core]: SafeLoadModule Warning\n\n${Z.message}\n`);return undefined}}};ct.loadModule=loadModule;const loadModuleSync=(ct,ft={})=>{ft.enableCache=ft.enableCache??true;ft.safeLoad=ft.safeLoad??false;if(ct.startsWith(`.${pt.sep}`)||ct.startsWith(`..${pt.sep}`)){ct=(0,pt.resolve)((0,pt.dirname)(Z.parent.filename),ct)}try{if(ft.enableCache){return ut(61242)(ct)}else{const Z=(0,dt.readFileSync)(ct,{encoding:"utf-8"});return JSON.parse(Z)}}catch(Z){if(!ft.safeLoad){throw Z}else{if(ft.warnOnLoadError&&Z.code!=="MODULE_NOT_FOUND"){console.warn(Z)}Tt(`[core]: SafeLoadModule Warning\n\n${Z.message}\n`);return undefined}}};ct.loadModuleSync=loadModuleSync;function safelyGet(Z,ct){if(arguments.length===1){return ct=>safelyGet(Z,ct)}if(typeof ct==="undefined"||typeof ct!=="object"||ct===null){return void 0}const ut=typeof Z==="string"?Z.split("."):Z;let pt=ct;for(const Z of ut){if(typeof pt==="undefined"||pt===null){return void 0}else if(typeof pt!=="object"){return void 0}pt=pt[Z]}return pt}function parsePrefix(Z){if(Z.includes("@")){return Z.slice(1)}return Z}function getUserHome(){return process.env[process.platform==="win32"?"USERPROFILE":"HOME"]}function joinURLPath(...Z){Z=Z.filter((Z=>!!Z));if(Z.length===0){return""}let ct=pt.posix.join(...Z);ct=ct.replace(/\/+$/,"");if(!/^\//.test(ct)){ct="/"+ct}return ct}function delegateTargetPrototypeMethod(Z,ct,ut){ct.forEach((ct=>{if(ct.prototype){Object.getOwnPropertyNames(ct.prototype).forEach((ct=>{if(ct!=="constructor"&&!/^_/.test(ct)&&!Z.prototype[ct]){Z.prototype[ct]=function(...Z){return this.instance[ct](...Z)}}}))}}));if(ut){delegateTargetMethod(Z,ut)}}function delegateTargetAllPrototypeMethod(Z,ct){do{delegateTargetPrototypeMethod(Z,[ct]);ct=Object.getPrototypeOf(ct)}while(ct)}function delegateTargetMethod(Z,ct){ct.forEach((ct=>{Z.prototype[ct]=function(...Z){return this.instance[ct](...Z)}}))}function delegateTargetProperties(Z,ct){ct.forEach((ct=>{Object.defineProperty(Z.prototype,ct,{get(){return this.instance[ct]}})}))}const getCurrentDateString=(Z=Date.now())=>{const ct=new Date(Z);return`${ct.getFullYear()}-${(ct.getMonth()+1).toString().padStart(2,"0")}-${ct.getDate().toString().padStart(2,"0")}`};ct.getCurrentDateString=getCurrentDateString;const deprecatedOutput=Z=>{console.warn("DeprecationWarning: "+Z)};ct.deprecatedOutput=deprecatedOutput;const transformRequestObjectByType=(Z,ct)=>{if(ct===undefined||ct===null||ct===Object||typeof Z==="undefined"){return Z}switch(ct){case Number:return Number(Z);case String:return String(Z);case Boolean:if(Z==="0"||Z==="false"){return false}return Boolean(Z);default:return Z}};ct.transformRequestObjectByType=transformRequestObjectByType;function toPathMatch(Z){if(typeof Z==="boolean"){return()=>Z}if(typeof Z==="string"){const ct=_t.PathToRegexpUtil.toRegexp(Z.replace("*","(.*)"));if(ct.global)ct.lastIndex=0;return Z=>ct.test(Z.path)}if(Z instanceof RegExp){return ct=>{if(Z.global)Z.lastIndex=0;return Z.test(ct.path)}}if(typeof Z==="function")return Z;if(Array.isArray(Z)){const ct=Z.map((Z=>toPathMatch(Z)));return Z=>ct.some((ct=>ct(Z)))}throw new mt.MidwayCommonError("match/ignore pattern must be RegExp, Array or String, but got "+Z)}function pathMatching(Z){Z=Z||{};if(Z.match&&Z.ignore)throw new mt.MidwayCommonError("options.match and options.ignore can not both present");if(!Z.match&&!Z.ignore)return()=>true;if(Z.match&&!Array.isArray(Z.match)){Z.match=[Z.match]}if(Z.ignore&&!Array.isArray(Z.ignore)){Z.ignore=[Z.ignore]}const createMatch=ct=>{const ut=ct.map((ct=>{if(Z.thisResolver){return toPathMatch(ct).bind(Z.thisResolver)}return toPathMatch(ct)}));return Z=>{for(let ct=0;ct<ut.length;ct++){const pt=ut[ct](Z);if(pt){return true}}return false}};const ct=Z.match?createMatch(Z.match):createMatch(Z.ignore);return function pathMatch(ut){const pt=ct(ut);return Z.match?pt:!pt}}function wrapMiddleware(Z,ct){if(ct.enable===false)return null;if(!ct.match&&!ct.ignore)return Z;const ut=pathMatching(ct);const fn=(ct,pt)=>{if(!ut(ct))return pt();return Z(ct,pt)};fn._name=Z._name+"middlewareWrapper";return fn}function isOwnPropertyWritable(Z,ct){if(Z==null)return false;const ut=typeof Z;if(ut!=="object"&&ut!=="function")return false;return!!Object.getOwnPropertyDescriptor(Z,ct)}function isIncludeProperty(Z,ct){while(Z){if(isOwnPropertyWritable(Z,ct))return true;Z=Object.getPrototypeOf(Z)}return false}function wrapAsync(Z){return(...ct)=>{if(typeof ct[ct.length-1]==="function"){const ut=ct.pop();if(Z.constructor.name!=="AsyncFunction"){const Z=new TypeError("Must be an AsyncFunction");return ut(Z)}return Z.apply(Z,ct).then((Z=>{ut(null,Z)}),(Z=>{ut(Z)}))}else{return Z.apply(Z,ct)}}}function sleep(Z=1e3,ct){return new Promise((ut=>{const pt=setTimeout((()=>{ut()}),Z);if(ct){ct.signal.addEventListener("abort",(()=>{clearTimeout(pt)}))}}))}const wt=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function getParamNames(Z){const ct=Z.toString().replace(wt,"");let ut=ct.slice(ct.indexOf("(")+1,ct.indexOf(")")).split(",").map((Z=>Z.trim().replace(/\s?=.*$/,"")));if(ut.length===1&&ut[0]===""){ut=[]}return ut}function generateRandomId(){return St.randomBytes(16).toString("hex")}function merge(Z,ct){if(!Z){Z=ct;ct=null}if(!Z){return null}if(Array.isArray(Z)){return Z.concat(ct||[])}if(typeof Z==="object"){return Object.assign({},Z,ct)}throw new Error("can not merge meta that type of "+typeof Z)}function toAsyncFunction(Z){if(bt.Types.isAsyncFunction(Z)){return Z}else{return async function(...ct){return Promise.resolve(Z.call(this,...ct))}}}function isTypeScriptEnvironment(){const Z=process.env.MIDWAY_TS_MODE;if("false"===Z){return false}return Z==="true"||!!ut(61242).extensions[".ts"]}function getFileNameWithSuffix(Z){return isTypeScriptEnvironment()?`${Z}.ts`:`${Z}.js`}function isConfigurationExport(Z){return bt.Types.isClass(Z)&&Et.MetadataManager.hasOwnMetadata(Ct.CONFIGURATION_KEY,Z)||bt.Types.isObject(Z)&&Et.MetadataManager.hasOwnMetadata(Ct.CONFIGURATION_OBJECT_KEY,Z)}async function findProjectEntryFile(Z,ut,dt,ft=ct.loadModule){async function containsConfiguration(Z){const ct=await ft(Z,{safeLoad:true,loadMode:dt,warnOnLoadError:true});if(ct&&isConfigurationExport(ct)){Tt(`[core]: find configuration file ${Z}`);return ct}else{for(const ut in ct){const pt=ct[ut];if(isConfigurationExport(pt)){Tt(`[core]: find configuration file ${Z}`);return ct}}}}const _t=await containsConfiguration((0,pt.join)(ut,getFileNameWithSuffix("configuration")));if(_t){return _t}const mt=await containsConfiguration((0,pt.join)(ut,getFileNameWithSuffix("index")));if(mt){return mt}if(Z){const ut=await(0,ct.loadModule)((0,pt.join)(Z,"package.json"),{safeLoad:true,enableCache:false});if(ut?.["main"]){const ct=await containsConfiguration((0,$t.normalizePath)(Z,ut["main"]));if(ct){return ct}}}}function findProjectEntryFileSync(Z,ut){function containsConfiguration(Z){const ut=(0,ct.loadModuleSync)(Z,{safeLoad:true,warnOnLoadError:true});if(ut&&isConfigurationExport(ut)){Tt(`[core]: find configuration file ${Z}`);return ut}else{for(const ct in ut){const pt=ut[ct];if(isConfigurationExport(pt)){Tt(`[core]: find configuration file ${Z}`);return ut}}}}const dt=containsConfiguration((0,pt.join)(ut,getFileNameWithSuffix("configuration")));if(dt){return dt}const ft=containsConfiguration((0,pt.join)(ut,getFileNameWithSuffix("index")));if(ft){return ft}if(Z){const ut=(0,ct.loadModuleSync)((0,pt.join)(Z,"package.json"),{safeLoad:true,enableCache:false});if(ut?.["main"]){const ct=containsConfiguration((0,$t.normalizePath)(Z,ut["main"]));if(ct){return ct}}}}ct.Utils={sleep:sleep,getParamNames:getParamNames,camelCase:ht.camelCase,pascalCase:ht.pascalCase,randomUUID:yt.randomUUID,generateRandomId:generateRandomId,toAsyncFunction:toAsyncFunction,safeStringify:vt.safeStringify,safeParse:vt.safeParse,isTypeScriptEnvironment:isTypeScriptEnvironment}},27192:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.NetworkUtils=void 0;const pt=ut(70857);function getIpv4Address(){const Z=pt.networkInterfaces();for(const ct in Z){if(Z[ct]){for(const ut of Z[ct]){if(ut.family==="IPv4"&&!ut.internal){return ut.address}}}}return""}function getIpv6Address(){const Z=pt.networkInterfaces();for(const ct in Z){if(Z[ct]){for(const ut of Z[ct]){if(ut.family==="IPv6"&&!ut.internal){return ut.address}}}}return""}function getHostname(){return pt.hostname()}ct.NetworkUtils={getIpv4Address:getIpv4Address,getIpv6Address:getIpv6Address,getHostname:getHostname}},53073:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.PathFileUtils=void 0;ct.isPath=isPath;ct.isPathEqual=isPathEqual;ct.getFileContentSync=getFileContentSync;ct.normalizePath=normalizePath;ct.getModuleRequirePathList=getModuleRequirePathList;const pt=ut(16928);const dt=ut(79896);function isPath(Z){if(/(^[\.\/])|:|\\/.test(Z)){return true}return false}function isPathEqual(Z,ct){if(!Z||!ct){return false}const ut=(0,pt.extname)(Z);return Z.replace(ut,"")===ct}function getFileContentSync(Z,ct){return typeof Z==="string"?(0,dt.readFileSync)(Z,{encoding:ct}):Z}function normalizePath(Z,ct){if((0,pt.isAbsolute)(ct)){return ct}else{return(0,pt.resolve)(Z,ct)}}function getModuleRequirePathList(Z){const ct=[Z,Z.replace(/\//g,"_")];let ut={};const pt=[];Object.keys(require.cache||{}).forEach((Z=>{let dt=-1;for(const Z of ct){const ct=Z.indexOf(Z);if(ct!==-1){dt=ct;break}}if(dt===-1){return}const ft=Z.slice(0,dt);if(ut[ft]){return}ut[ft]=true;pt.push(ft)}));ut=undefined;return pt}ct.PathFileUtils={isPath:isPath,isPathEqual:isPathEqual,getFileContentSync:getFileContentSync}},57095:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.PathToRegexpUtil=void 0;function lexer(Z){const ct=[];let ut=0;while(ut<Z.length){const pt=Z[ut];if(pt==="*"||pt==="+"||pt==="?"){ct.push({type:"MODIFIER",index:ut,value:Z[ut++]});continue}if(pt==="\\"){ct.push({type:"ESCAPED_CHAR",index:ut++,value:Z[ut++]});continue}if(pt==="{"){ct.push({type:"OPEN",index:ut,value:Z[ut++]});continue}if(pt==="}"){ct.push({type:"CLOSE",index:ut,value:Z[ut++]});continue}if(pt===":"){let pt="";let dt=ut+1;while(dt<Z.length){const ct=Z.charCodeAt(dt);if(ct>=48&&ct<=57||ct>=65&&ct<=90||ct>=97&&ct<=122||ct===95){pt+=Z[dt++];continue}break}if(!pt)throw new TypeError(`Missing parameter name at ${ut}`);ct.push({type:"NAME",index:ut,value:pt});ut=dt;continue}if(pt==="("){let pt=1;let dt="";let ft=ut+1;if(Z[ft]==="?"){throw new TypeError(`Pattern cannot start with "?" at ${ft}`)}while(ft<Z.length){if(Z[ft]==="\\"){dt+=Z[ft++]+Z[ft++];continue}if(Z[ft]===")"){pt--;if(pt===0){ft++;break}}else if(Z[ft]==="("){pt++;if(Z[ft+1]!=="?"){throw new TypeError(`Capturing groups are not allowed at ${ft}`)}}dt+=Z[ft++]}if(pt)throw new TypeError(`Unbalanced pattern at ${ut}`);if(!dt)throw new TypeError(`Missing pattern at ${ut}`);ct.push({type:"PATTERN",index:ut,value:dt});ut=ft;continue}ct.push({type:"CHAR",index:ut,value:Z[ut++]})}ct.push({type:"END",index:ut,value:""});return ct}function parse(Z,ct={}){const ut=lexer(Z);const{prefixes:pt="./"}=ct;const dt=`[^${escapeString(ct.delimiter||"/#?")}]+?`;const ft=[];let _t=0;let mt=0;let ht="";const tryConsume=Z=>{if(mt<ut.length&&ut[mt].type===Z)return ut[mt++].value};const mustConsume=Z=>{const ct=tryConsume(Z);if(ct!==undefined)return ct;const{type:pt,index:dt}=ut[mt];throw new TypeError(`Unexpected ${pt} at ${dt}, expected ${Z}`)};const consumeText=()=>{let Z="";let ct;while(ct=tryConsume("CHAR")||tryConsume("ESCAPED_CHAR")){Z+=ct}return Z};while(mt<ut.length){const Z=tryConsume("CHAR");const ct=tryConsume("NAME");const ut=tryConsume("PATTERN");if(ct||ut){let mt=Z||"";if(pt.indexOf(mt)===-1){ht+=mt;mt=""}if(ht){ft.push(ht);ht=""}ft.push({name:ct||_t++,prefix:mt,suffix:"",pattern:ut||dt,modifier:tryConsume("MODIFIER")||""});continue}const mt=Z||tryConsume("ESCAPED_CHAR");if(mt){ht+=mt;continue}if(ht){ft.push(ht);ht=""}const yt=tryConsume("OPEN");if(yt){const Z=consumeText();const ct=tryConsume("NAME")||"";const ut=tryConsume("PATTERN")||"";const pt=consumeText();mustConsume("CLOSE");ft.push({name:ct||(ut?_t++:""),pattern:ct&&!ut?dt:ut,prefix:Z,suffix:pt,modifier:tryConsume("MODIFIER")||""});continue}mustConsume("END")}return ft}function compile(Z,ct){return tokensToFunction(parse(Z,ct),ct)}function tokensToFunction(Z,ct={}){const ut=flags(ct);const{encode:pt=Z=>Z,validate:dt=true}=ct;const ft=Z.map((Z=>{if(typeof Z==="object"){return new RegExp(`^(?:${Z.pattern})$`,ut)}}));return ct=>{let ut="";for(let _t=0;_t<Z.length;_t++){const mt=Z[_t];if(typeof mt==="string"){ut+=mt;continue}const ht=ct?ct[mt.name]:undefined;const yt=mt.modifier==="?"||mt.modifier==="*";const vt=mt.modifier==="*"||mt.modifier==="+";if(Array.isArray(ht)){if(!vt){throw new TypeError(`Expected "${mt.name}" to not repeat, but got an array`)}if(ht.length===0){if(yt)continue;throw new TypeError(`Expected "${mt.name}" to not be empty`)}for(let Z=0;Z<ht.length;Z++){const ct=pt(ht[Z],mt);if(dt&&!ft[_t].test(ct)){throw new TypeError(`Expected all "${mt.name}" to match "${mt.pattern}", but got "${ct}"`)}ut+=mt.prefix+ct+mt.suffix}continue}if(typeof ht==="string"||typeof ht==="number"){const Z=pt(String(ht),mt);if(dt&&!ft[_t].test(Z)){throw new TypeError(`Expected "${mt.name}" to match "${mt.pattern}", but got "${Z}"`)}ut+=mt.prefix+Z+mt.suffix;continue}if(yt)continue;const St=vt?"an array":"a string";throw new TypeError(`Expected "${mt.name}" to be ${St}`)}return ut}}function match(Z,ct){const ut=[];const pt=toRegexp(Z,ut,ct);return regexpToFunction(pt,ut,ct)}function regexpToFunction(Z,ct,ut={}){const{decode:pt=Z=>Z}=ut;return function(ut){const dt=Z.exec(ut);if(!dt)return false;const{0:ft,index:_t}=dt;const mt=Object.create(null);for(let Z=1;Z<dt.length;Z++){if(dt[Z]===undefined)continue;const ut=ct[Z-1];if(ut.modifier==="*"||ut.modifier==="+"){mt[ut.name]=dt[Z].split(ut.prefix+ut.suffix).map((Z=>pt(Z,ut)))}else{mt[ut.name]=pt(dt[Z],ut)}}return{path:ft,index:_t,params:mt}}}function escapeString(Z){return Z.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function flags(Z){return Z&&Z.sensitive?"":"i"}function regexpToRegexp(Z,ct){if(!ct)return Z;const ut=/\((?:\?<(.*?)>)?(?!\?)/g;let pt=0;let dt=ut.exec(Z.source);while(dt){ct.push({name:dt[1]||pt++,prefix:"",suffix:"",modifier:"",pattern:""});dt=ut.exec(Z.source)}return Z}function arrayToRegexp(Z,ct,ut){const pt=Z.map((Z=>toRegexp(Z,ct,ut).source));return new RegExp(`(?:${pt.join("|")})`,flags(ut))}function stringToRegexp(Z,ct,ut){return tokensToRegexp(parse(Z,ut),ct,ut)}function tokensToRegexp(Z,ct,ut={}){const{strict:pt=false,start:dt=true,end:ft=true,encode:_t=Z=>Z,delimiter:mt="/#?",endsWith:ht=""}=ut;const yt=`[${escapeString(ht)}]|$`;const vt=`[${escapeString(mt)}]`;let St=dt?"^":"";for(const ut of Z){if(typeof ut==="string"){St+=escapeString(_t(ut))}else{const Z=escapeString(_t(ut.prefix));const pt=escapeString(_t(ut.suffix));if(ut.pattern){if(ct)ct.push(ut);if(Z||pt){if(ut.modifier==="+"||ut.modifier==="*"){const ct=ut.modifier==="*"?"?":"";St+=`(?:${Z}((?:${ut.pattern})(?:${pt}${Z}(?:${ut.pattern}))*)${pt})${ct}`}else{St+=`(?:${Z}(${ut.pattern})${pt})${ut.modifier}`}}else{if(ut.modifier==="+"||ut.modifier==="*"){St+=`((?:${ut.pattern})${ut.modifier})`}else{St+=`(${ut.pattern})${ut.modifier}`}}}else{St+=`(?:${Z}${pt})${ut.modifier}`}}}if(ft){if(!pt)St+=`${vt}?`;St+=!ut.endsWith?"$":`(?=${yt})`}else{const ct=Z[Z.length-1];const ut=typeof ct==="string"?vt.indexOf(ct[ct.length-1])>-1:ct===undefined;if(!pt){St+=`(?:${vt}(?=${yt}))?`}if(!ut){St+=`(?=${vt}|${yt})`}}return new RegExp(St,flags(ut))}function toRegexp(Z,ct,ut){if(Z instanceof RegExp)return regexpToRegexp(Z,ct);if(Array.isArray(Z))return arrayToRegexp(Z,ct,ut);return stringToRegexp(Z,ct,ut)}ct.PathToRegexpUtil={toRegexp:toRegexp,compile:compile,parse:parse,match:match}},34112:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.retryWithAsync=retryWithAsync;ct.retryWith=retryWith;const pt=ut(53386);const dt=ut(28068);function retryWithAsync(Z,ct=1,ut={}){let ft=ct;let _t;return async(...mt)=>{do{try{return await Z.bind(ut.receiver||this)(...mt)}catch(Z){_t=Z}if(ut.retryInterval>=0){await(0,pt.sleep)(ut.retryInterval)}}while(ft-- >0);if(ut.throwOriginError){throw _t}else{throw new dt.MidwayRetryExceededMaxTimesError(Z.name||"anonymous",ct,_t)}}}function retryWith(Z,ct=1,ut={}){let pt=ct;let ft;return(..._t)=>{do{try{return Z.bind(ut.receiver||this)(..._t)}catch(Z){ft=Z}}while(pt-- >0);if(ut.throwOriginError){throw ft}else{throw new dt.MidwayRetryExceededMaxTimesError(Z.name||"anonymous",ct,ft)}}}},22041:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.createPromiseTimeoutInvokeChain=createPromiseTimeoutInvokeChain;const pt=ut(28068);async function createPromiseTimeoutInvokeChain(Z){if(!Z.onSuccess){Z.onSuccess=async Z=>Z}Z.isConcurrent=Z.isConcurrent??true;const ct=Z.abortController??new AbortController;let ut;const dt=[];let ft;if(Z.timeout){ft=new Promise(((ct,dt)=>{ut=setTimeout((()=>{dt(new pt.MidwayCodeInvokeTimeoutError(Z.methodName,Z.timeout))}),Z.timeout)}))}ct.signal.addEventListener("abort",(()=>{dt.forEach((Z=>{clearTimeout(Z)}));if(ut){clearTimeout(ut)}}));const _t=Z.promiseItems.filter((Z=>typeof Z["item"]==="function"));if(Z.isConcurrent){const ut=_t.map((ut=>{const ft=ut["timeout"]??Z.itemTimeout;const _t=ft?new Promise(((ct,_t)=>{dt.push(setTimeout((()=>_t(new pt.MidwayCodeInvokeTimeoutError(Z.methodName,ft,ut["itemName"]))),ft))})):null;return Promise.race([Promise.resolve(ut["item"](ct)),_t]).then((ct=>Z.onSuccess(ct,ut["meta"]))).catch((ct=>{if(Z.onFail){return Z.onFail?.(ct,ut["meta"])}else{throw ct}}))}));if(ft){return Promise.race([Promise.all(ut),ft]).finally((()=>{ct.abort()})).then((Z=>Z)).finally((()=>{ct.abort()}))}else{return Promise.all(ut).finally((()=>{ct.abort()})).then((Z=>Z))}}else{const ut=[];const serialExecution=async()=>{for(const ft of _t){const _t=ft["timeout"]??Z.itemTimeout;const mt=_t?new Promise(((ct,ut)=>{dt.push(setTimeout((()=>ut(new pt.MidwayCodeInvokeTimeoutError(Z.methodName,_t,ft["itemName"]))),_t))})):null;try{const pt=await Promise.race([Promise.resolve(ft["item"](ct)),mt].filter(Boolean));ut.push(await Z.onSuccess(pt,ft["meta"]))}catch(ct){if(Z.onFail){ut.push(await Z.onFail(ct,ft["meta"]));break}else{throw ct}}}return ut};if(ft){return Promise.race([serialExecution(),ft]).then((Z=>Z)).finally((()=>{ct.abort()}))}else{return serialExecution().then((Z=>Z)).finally((()=>{ct.abort()}))}}}},35175:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Types=void 0;ct.isString=isString;ct.isClass=isClass;ct.isAsyncFunction=isAsyncFunction;ct.isGeneratorFunction=isGeneratorFunction;ct.isPromise=isPromise;ct.isFunction=isFunction;ct.isObject=isObject;ct.isPlainObject=isPlainObject;ct.isNumber=isNumber;ct.isProxy=isProxy;ct.isMap=isMap;ct.isSet=isSet;ct.isRegExp=isRegExp;ct.isUndefined=isUndefined;ct.isNull=isNull;ct.isNullOrUndefined=isNullOrUndefined;const pt=ut(39023);const dt=Function.prototype.toString;const ft=Object.prototype.hasOwnProperty;const _t=Object.prototype.toString;function isString(Z){return typeof Z==="string"}function isClass(Z){if(typeof Z!=="function"){return false}const ct=dt.call(Z);if(/^class[\s{]/.test(ct)){return true}const ut=Object.getOwnPropertyDescriptor(Z,"prototype");if(ut&&ut.writable===false&&!/\[native code\]/.test(ct)){return true}return false}function isAsyncFunction(Z){return pt.types.isAsyncFunction(Z)}function isGeneratorFunction(Z){return pt.types.isGeneratorFunction(Z)}function isPromise(Z){return pt.types.isPromise(Z)}function isFunction(Z){return typeof Z==="function"}function isObject(Z){return Z!==null&&typeof Z==="object"}function isPlainObject(Z){if(!Z||_t.call(Z)!=="[object Object]"){return false}const ct=ft.call(Z,"constructor");const ut=Z.constructor&&Z.constructor.prototype&&ft.call(Z.constructor.prototype,"isPrototypeOf");if(Z.constructor&&!ct&&!ut){return false}let pt;for(pt in Z){}return typeof pt==="undefined"||ft.call(Z,pt)}function isNumber(Z){return typeof Z==="number"}function isProxy(Z){return pt.types.isProxy(Z)}function isMap(Z){return pt.types.isMap(Z)}function isSet(Z){return pt.types.isSet(Z)}function isRegExp(Z){return pt.types.isRegExp(Z)}function isUndefined(Z){return Z===undefined}function isNull(Z){return Z===null}function isNullOrUndefined(Z){return isUndefined(Z)||isNull(Z)}ct.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}},23839:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.randomUUID=randomUUID;const pt=ut(76982);const dt=new Uint8Array(256);let ft=dt.length;function rng(){if(ft>dt.length-16){pt.randomFillSync(dt);ft=0}return dt.slice(ft,ft+=16)}const _t=[];for(let Z=0;Z<256;++Z){_t.push((Z+256).toString(16).slice(1))}function unsafeStringify(Z,ct=0){return(_t[Z[ct+0]]+_t[Z[ct+1]]+_t[Z[ct+2]]+_t[Z[ct+3]]+"-"+_t[Z[ct+4]]+_t[Z[ct+5]]+"-"+_t[Z[ct+6]]+_t[Z[ct+7]]+"-"+_t[Z[ct+8]]+_t[Z[ct+9]]+"-"+_t[Z[ct+10]]+_t[Z[ct+11]]+_t[Z[ct+12]]+_t[Z[ct+13]]+_t[Z[ct+14]]+_t[Z[ct+15]]).toLowerCase()}function randomUUID(Z){if(!Z&&pt["randomUUID"]){return pt["randomUUID"]()}const ct=rng();ct[6]=ct[6]&15|64;ct[8]=ct[8]&63|128;return unsafeStringify(ct)}},9420:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.extractExpressLikeValue=ct.extractKoaLikeValue=void 0;const pt=ut(25923);const dt=ut(53386);const extractKoaLikeValue=(Z,ct,ut)=>{if(pt.ALL_VALUE_KEY===ct){ct=undefined}return function(ft,_t){switch(Z){case pt.RouteParamTypes.NEXT:return _t;case pt.RouteParamTypes.BODY:return(0,dt.transformRequestObjectByType)(ct&&ft.request.body?ft.request.body[ct]:ft.request.body,ut);case pt.RouteParamTypes.PARAM:return(0,dt.transformRequestObjectByType)(ct?ft.params[ct]:ft.params,ut);case pt.RouteParamTypes.QUERY:return(0,dt.transformRequestObjectByType)(ct?ft.query[ct]:ft.query,ut);case pt.RouteParamTypes.HEADERS:return(0,dt.transformRequestObjectByType)(ct?ft.get(ct):ft.headers,ut);case pt.RouteParamTypes.SESSION:return(0,dt.transformRequestObjectByType)(ct?ft.session[ct]:ft.session,ut);case pt.RouteParamTypes.FILESTREAM:if(ft.getFileStream){return ft.getFileStream(ct)}else if(ft.files){if(Array.isArray(ft.files)){return ft.files[0]}else{return ft.files}}else{return undefined}case pt.RouteParamTypes.FILESSTREAM:if(ft.multipart){return ft.multipart(ct)}else if(ft.files){return ft.files}else{return undefined}case pt.RouteParamTypes.REQUEST_PATH:return ft["path"];case pt.RouteParamTypes.REQUEST_IP:return ft["ip"];case pt.RouteParamTypes.QUERIES:if(ft.queries){return(0,dt.transformRequestObjectByType)(ct?ft.queries[ct]:ft.queries,ut)}else{return(0,dt.transformRequestObjectByType)(ct?ft.query[ct]:ft.query,ut)}case pt.RouteParamTypes.FIELDS:return ct?ft.fields[ct]:ft.fields;case pt.RouteParamTypes.CUSTOM:return ct?ct(ft):undefined;default:return null}}};ct.extractKoaLikeValue=extractKoaLikeValue;const extractExpressLikeValue=(Z,ct,ut)=>{if(pt.ALL_VALUE_KEY===ct){ct=undefined}return function(ft,_t,mt){switch(Z){case pt.RouteParamTypes.NEXT:return mt;case pt.RouteParamTypes.BODY:return(0,dt.transformRequestObjectByType)(ct&&ft.body?ft.body[ct]:ft.body,ut);case pt.RouteParamTypes.PARAM:return(0,dt.transformRequestObjectByType)(ct?ft.params[ct]:ft.params,ut);case pt.RouteParamTypes.QUERY:return(0,dt.transformRequestObjectByType)(ct?ft.query[ct]:ft.query,ut);case pt.RouteParamTypes.HEADERS:return(0,dt.transformRequestObjectByType)(ct?ft.get(ct):ft.headers,ut);case pt.RouteParamTypes.SESSION:return(0,dt.transformRequestObjectByType)(ct?ft.session[ct]:ft.session,ut);case pt.RouteParamTypes.FILESTREAM:return ft.files?ft.files[0]:undefined;case pt.RouteParamTypes.FILESSTREAM:return ft.files;case pt.RouteParamTypes.REQUEST_PATH:return ft["baseUrl"];case pt.RouteParamTypes.REQUEST_IP:return ft["ip"];case pt.RouteParamTypes.QUERIES:if(ft.queries){return(0,dt.transformRequestObjectByType)(ct?ft.queries[ct]:ft.queries,ut)}else{return(0,dt.transformRequestObjectByType)(ct?ft.query[ct]:ft.query,ut)}case pt.RouteParamTypes.FIELDS:return ct?ft.fields[ct]:ft.fields;case pt.RouteParamTypes.CUSTOM:return ct?ct(ft,_t):undefined;default:return null}}};ct.extractExpressLikeValue=extractExpressLikeValue},73317:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.AbstractEventBus=ct.AckResponder=ct.createWaitHandler=void 0;const pt=ut(48001);const dt=ut(39023);const ft=ut(68108);const _t="_default_";const mt=null;function revertError(Z){const ct=new Error;ct.name=Z.name;ct.message=Z.message;ct.stack=Z.stack;return ct}class MessageLimitSet extends Set{constructor(Z){super();this.limit=Z}add(Z){if(this.size<this.limit){return super.add(Z)}}}async function createWaitHandler(Z,ct={}){await new Promise(((ut,pt)=>{const dt=setTimeout((()=>{clearInterval(_t);clearTimeout(dt);pt(new ft.EventBusTimeoutError)}),ct.timeout||5e3);const _t=setInterval((()=>{if(Z()){clearInterval(_t);clearTimeout(dt);ut(true)}}),ct.timeoutCheckInterval||500)}))}ct.createWaitHandler=createWaitHandler;class ChunkIterator{constructor(Z){this.debugLogger=Z;this.buffer=[]}publish(Z){this.buffer.push(Z);if(this.waitingPromiseDeferred){const Z=this.waitingPromiseDeferred;this.waitingPromiseDeferred=null;Z.resolve(this.buffer.shift())}}error(Z){if(this.waitingPromiseDeferred){const ct=this.waitingPromiseDeferred;this.waitingPromiseDeferred=null;ct.reject(Z)}else{this.errorRisen=Z}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 Z={};Z.promise=new Promise(((ct,ut)=>{Z.resolve=ct;Z.reject=ut}));this.waitingPromiseDeferred=Z;return Z.promise}}async next(){this.debugLogger("1 ChunkIterator run next and wait data");const{data:Z,isEnd:ct}=await this.tryToGetNextData();this.debugLogger("2 ChunkIterator get data",Z,ct);if(ct){this.clear();return{value:undefined,done:true}}else{return{value:Z,done:false}}}clear(){this.buffer.length=0}}class AckResponder{constructor(){this.isEndFlag=false}onData(Z){this.dataHandler=Z}onError(Z){this.errorHandler=Z}end(Z){if(!this.isEndFlag){this.isEndFlag=true;if(Z){this.sendData(Z)}this.sendData(mt)}}sendData(Z){if(this.dataHandler){this.dataHandler(Z)}}send(Z){if(!this.isEndFlag){this.sendData(Z)}}error(Z){if(!this.isEndFlag){if(this.errorHandler){this.errorHandler(Z)}}}isEnd(){return this.isEndFlag}}ct.AckResponder=AckResponder;class AbstractEventBus{constructor(Z={}){this.options=Z;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(pt.ListenerType.Error,(Z=>{console.error(Z)}));this.listener=(Z,ct)=>{var ut,dt;const ft=this.topicListener.get(((ut=Z.messageOptions)===null||ut===void 0?void 0:ut.topic)||_t);if(ft){for(const ut of ft){if(ut["_subscribeOnce"]){ft.delete(ut)}new Promise((async(pt,dt)=>{try{await pt(ut(Z,ct))}catch(Z){dt(Z)}})).catch((Z=>{if(ct){ct.error(Z)}else{this.eventListenerMap.get(pt.ListenerType.Error)(Z)}}))}}else{const ut=((dt=Z.messageOptions)===null||dt===void 0?void 0:dt.topic)||_t;if(!this.topicMessageCache.has(ut)){this.topicMessageCache.set(ut,new MessageLimitSet(10))}this.topicMessageCache.get(ut).add({message:Z,responder:ct})}};this.setupEventBind()}createDebugger(){return(0,dt.debuglog)(`midway:event-bus:${this.isWorker()?"worker":"main "}`)}debugDataflow(Z){if(Z.messageCategory===pt.MessageCategory.IN){if(this.isMain()){return`${Z.message.type}|${Z.messageCategory}: worker => main(△)`}else{return`${Z.message.type}|${Z.messageCategory}: main => worker(△)`}}else{if(this.isMain()){return`${Z.message.type}|${Z.messageCategory}: main(△) => worker`}else{return`${Z.message.type}|${Z.messageCategory}: worker(△) => main`}}}async start(Z){this.isInited=true;if(this.isMain()){await createWaitHandler((()=>this.isAllWorkerReady()),{timeout:this.options.initTimeout,timeoutCheckInterval:this.options.initTimeoutCheckInterval})}else{this.workerSubscribeMessage((Z=>{this.transit({messageCategory:pt.MessageCategory.IN,message:Z})}));this.transit({messageCategory:pt.MessageCategory.OUT,message:{messageId:this.generateMessageId(),workerId:this.getWorkerId(),type:pt.MessageType.Inited,body:this.isInited,error:Z?{name:Z.name,message:Z.message,stack:Z.stack}:undefined}})}}addWorker(Z){this.debugLogger(`Add worker(${this.getWorkerId(Z)})`);if(!this.workerReady.has(this.getWorkerId(Z))){this.debugLogger(`Init worker(${this.getWorkerId(Z)}) status = false`);this.workerReady.set(this.getWorkerId(Z),{worker:Z,ready:false})}else{this.debugLogger(`Skip init worker(${this.getWorkerId(Z)}) status`)}Z===null||Z===void 0?void 0:Z["on"]("exit",(async ct=>{if(!this.stopping){this.workerReady.delete(this.getWorkerId(Z));const ct=this.workers.findIndex((ct=>this.getWorkerId(ct)===this.getWorkerId(Z)));this.workers.splice(ct,1)}}));this.workerListenMessage(Z,(Z=>{this.transit({messageCategory:pt.MessageCategory.IN,message:Z})}));this.workers.push(Z)}isAllWorkerReady(){for(const[Z,ct]of this.workerReady){if(!ct||!ct.ready){this.debugLogger(`Worker(${Z}) not ready.`);return false}}if(this.workerReady.size>0){this.debugLogger(`All worker(size=${this.workerReady.size}) is ready.`)}return true}setupEventBind(){this.messageReceiver=Z=>{var ct,ut,dt,ft,_t,ht,yt,vt,St,bt,xt,$t,Et,Ct,Tt;if(!Z.message||!Z.message.messageId){return}this.debugLogger("EventCenter(%s) message = %j",this.debugDataflow(Z),Z);const wt=Z.message;if(Z.messageCategory===pt.MessageCategory.OUT){if(wt.type===pt.MessageType.Invoke||wt.type===pt.MessageType.Request||wt.type===pt.MessageType.Response||wt.type===pt.MessageType.Broadcast){this.postMessage(wt);(ct=this.eventListenerMap.get(pt.ListenerType.Request))===null||ct===void 0?void 0:ct(wt)}else if(wt.type===pt.MessageType.Inited){this.postMessage(wt);(ut=this.eventListenerMap.get(pt.ListenerType.Inited))===null||ut===void 0?void 0:ut(wt)}}else if(Z.messageCategory===pt.MessageCategory.IN){if(wt.type===pt.MessageType.Invoke){const Z=((dt=wt.messageOptions)===null||dt===void 0?void 0:dt["isChunk"])===true;const ct=new AckResponder;ct.onData((ut=>{var dt;this.transit({messageCategory:pt.MessageCategory.OUT,message:{messageId:this.generateMessageId(),workerId:this.getWorkerId(),type:pt.MessageType.Response,body:ut,messageOptions:{relatedMessageId:wt.messageId,isChunk:Z,topic:(dt=wt.messageOptions)===null||dt===void 0?void 0:dt.topic}}});if(!Z){ct.end()}}));ct.onError((ut=>{this.publish(ut,{relatedMessageId:wt.messageId,isChunk:Z});ct.end()}));(ft=this.listener)===null||ft===void 0?void 0:ft.call(this,wt,ct);(_t=this.eventListenerMap.get(pt.ListenerType.Subscribe))===null||_t===void 0?void 0:_t(wt)}else if(wt.type===pt.MessageType.Request){(ht=this.listener)===null||ht===void 0?void 0:ht.call(this,wt);(yt=this.eventListenerMap.get(pt.ListenerType.Subscribe))===null||yt===void 0?void 0:yt(wt)}else if(wt.type===pt.MessageType.Broadcast){if(this.isMain()){if(wt.messageOptions["includeMainFromWorker"]===true){(vt=this.listener)===null||vt===void 0?void 0:vt.call(this,wt);(St=this.eventListenerMap.get(pt.ListenerType.Subscribe))===null||St===void 0?void 0:St(wt)}this.broadcast(wt.body,{...wt.messageOptions,relatedMessageId:wt.messageId,relatedWorkerId:wt.workerId})}else{(bt=this.listener)===null||bt===void 0?void 0:bt.call(this,wt);(xt=this.eventListenerMap.get(pt.ListenerType.Subscribe))===null||xt===void 0?void 0:xt(wt)}}else if(wt.type===pt.MessageType.Response){if(($t=wt.messageOptions)===null||$t===void 0?void 0:$t.relatedMessageId){const Z=this.asyncMessageMap.get(wt.messageOptions.relatedMessageId);const ct=wt.messageOptions["isChunk"]===true;if(Z){if(!ct||ct&&wt.body===mt){this.asyncMessageMap.delete(wt.messageOptions.relatedMessageId)}Z(wt.error?revertError(wt.error):undefined,wt.body,ct?wt.body===mt:true)}else{}}else{(Et=this.listener)===null||Et===void 0?void 0:Et.call(this,wt);(Ct=this.eventListenerMap.get(pt.ListenerType.Subscribe))===null||Ct===void 0?void 0:Ct(wt)}}else if(wt.type===pt.MessageType.Inited){if(this.isMain()){if(wt.error){this.debugLogger(`got worker ${wt.workerId} ready failed`);this.eventListenerMap.get(pt.ListenerType.Error)(revertError(wt.error))}else{(Tt=this.eventListenerMap.get(pt.ListenerType.Inited))===null||Tt===void 0?void 0:Tt(wt);this.workerReady.get(wt.workerId).ready=true;this.debugLogger(`got worker ${wt.workerId} ready`)}}else{}}}}}transit(Z){this.messageReceiver(Z)}subscribe(Z,ct={}){const ut=ct.topic||_t;if(!this.topicListener.has(ut)){this.topicListener.set(ut,new Set)}if(ct.subscribeOnce){Z["_subscribeOnce"]=true}this.topicListener.get(ut).add(Z);Z["_abortController"]={abort:()=>{this.topicListener.get(ut).delete(Z)}};if(this.topicMessageCache.has(ut)&&this.topicMessageCache.get(ut).size>0){for(const Z of this.topicMessageCache.get(ut)){this.listener(Z.message,Z.responder);if(ct.subscribeOnce){break}}this.topicMessageCache.get(ut).clear()}return Z["_abortController"]}subscribeOnce(Z,ct={}){ct.subscribeOnce=true;return this.subscribe(Z,ct)}publish(Z,ct={}){if(Z instanceof Error){this.transit({messageCategory:pt.MessageCategory.OUT,message:{messageId:ct.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:this.isMain()?pt.MessageType.Request:pt.MessageType.Response,body:undefined,error:{name:Z.name,message:Z.message,stack:Z.stack},messageOptions:ct}})}else{this.transit({messageCategory:pt.MessageCategory.OUT,message:{messageId:ct.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:this.isMain()?pt.MessageType.Request:pt.MessageType.Response,body:Z,messageOptions:ct}})}}publishAsync(Z,ct={}){return new Promise(((ut,dt)=>{const ft=ct.relatedMessageId||this.generateMessageId();this.useTimeout(ft,ct.timeout,ut,dt);this.transit({messageCategory:pt.MessageCategory.OUT,message:{messageId:ft,workerId:this.getWorkerId(),type:pt.MessageType.Invoke,body:Z,messageOptions:{topic:ct.topic,dispatchToken:ct.dispatchToken}}})}))}publishChunk(Z,ct={}){const ut=ct.relatedMessageId||this.generateMessageId();const dt=new ChunkIterator(this.debugLogger);this.useTimeout(ut,ct.timeout,((Z,ct)=>{dt.publish({data:Z,isEnd:ct})}),(Z=>{dt.error(Z)}));this.transit({messageCategory:pt.MessageCategory.OUT,message:{messageId:ut,workerId:this.getWorkerId(),type:this.isMain()?pt.MessageType.Invoke:pt.MessageType.Response,body:Z,messageOptions:{isChunk:true,topic:ct.topic}}});return dt}useTimeout(Z,ct=5e3,ut,pt){const dt=setTimeout((()=>{clearTimeout(dt);this.asyncMessageMap.delete(Z);pt(new ft.EventBusPublishTimeoutError(Z))}),ct);this.asyncMessageMap.set(Z,((Z,ct,ft)=>{if(ft||Z){clearTimeout(dt)}if(Z){pt(Z)}else{ut(ct,ft)}}))}broadcast(Z,ct={}){if(this.isWorker()){ct={includeMainFromWorker:false,includeSelfFromWorker:false,...ct}}this.transit({messageCategory:pt.MessageCategory.OUT,message:{messageId:ct.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:pt.MessageType.Broadcast,body:Z,messageOptions:ct}})}postMessage(Z){var ct,ut,dt,_t,mt,ht,yt,vt;if(this.isMain()){if(this.workers.length>0){if(Z.type===pt.MessageType.Broadcast){if(Z.messageOptions&&Z.messageOptions["relatedWorkerId"]){this.workers.forEach((ct=>{if(Z.messageOptions["includeSelfFromWorker"]===false&&this.getWorkerId(ct)===Z.messageOptions["relatedWorkerId"]){return}else{this.mainSendMessage(ct,Z)}}))}else{this.workers.forEach((ct=>this.mainSendMessage(ct,Z)))}}else if((ct=Z.messageOptions)===null||ct===void 0?void 0:ct["targetWorkerId"]){const ct=(dt=this.workerReady.get((ut=Z.messageOptions)===null||ut===void 0?void 0:ut["targetWorkerId"]))===null||dt===void 0?void 0:dt.worker;if(!ct){throw new ft.EventBusPublishSpecifyWorkerError((_t=Z.messageOptions)===null||_t===void 0?void 0:_t["targetWorkerId"])}this.mainSendMessage(ct,Z)}else{if(this.options.dispatchStrategy){const ct=this.options.dispatchStrategy(this.workers,(mt=Z.messageOptions)===null||mt===void 0?void 0:mt.dispatchToken);if(ct){try{this.mainSendMessage(ct,Z)}catch(ct){(ht=this.eventListenerMap.get(pt.ListenerType.Error))===null||ht===void 0?void 0:ht(new ft.EventBusMainPostError(Z,ct))}}else{throw new ft.EventBusDispatchStrategyError}}else{const[ct,...ut]=this.workers;try{this.mainSendMessage(ct,Z)}catch(ct){(yt=this.eventListenerMap.get(pt.ListenerType.Error))===null||yt===void 0?void 0:yt(new ft.EventBusMainPostError(Z,ct))}this.workers=[...ut,ct]}}}}else{try{this.workerSendMessage(Z)}catch(ct){(vt=this.eventListenerMap.get(pt.ListenerType.Error))===null||vt===void 0?void 0:vt(new ft.EventBusWorkerPostError(Z,ct))}}}onInited(Z){this.eventListenerMap.set(pt.ListenerType.Inited,Z)}onPublish(Z){this.eventListenerMap.set(pt.ListenerType.Request,Z)}onSubscribe(Z){this.eventListenerMap.set(pt.ListenerType.Subscribe,Z)}onError(Z){this.eventListenerMap.set(pt.ListenerType.Error,Z)}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)}}ct.AbstractEventBus=AbstractEventBus},4779:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ChildProcessEventBus=void 0;const pt=ut(73317);const dt=ut(29907);const ft=ut(932);class ChildProcessEventBus extends pt.AbstractEventBus{workerSubscribeMessage(Z){ft.on("message",Z)}workerListenMessage(Z,ct){Z.on("message",ct)}workerSendMessage(Z){ft.send(Z)}mainSendMessage(Z,ct){Z.send(ct)}isMain(){return!this.isWorker()}isWorker(){var Z;return(Z=this.options.isWorker)!==null&&Z!==void 0?Z:dt.isWorker}getWorkerId(Z){var ct;return String(Z?(ct=Z.pid)!==null&&ct!==void 0?ct:Z===null||Z===void 0?void 0:Z["process"].pid:ft.pid)}}ct.ChildProcessEventBus=ChildProcessEventBus},68108:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.EventBusDispatchStrategyError=ct.EventBusPublishSpecifyWorkerError=ct.EventBusWorkerPostError=ct.EventBusMainPostError=ct.EventBusTimeoutError=ct.EventBusPublishTimeoutError=void 0;const pt=ut(39023);class EventBusPublishTimeoutError extends Error{constructor(Z){super(`Message(${Z}) publish timeout.`);this.name="EventBusPublishTimeoutError"}}ct.EventBusPublishTimeoutError=EventBusPublishTimeoutError;class EventBusTimeoutError extends Error{constructor(){super("Waiting for ready timeout throws this error.");this.name="EventBusTimeoutError"}}ct.EventBusTimeoutError=EventBusTimeoutError;class EventBusMainPostError extends Error{constructor(Z,ct){super((0,pt.format)("Main thread post message [%j] error => %s.",Z,ct.stack));this.name="EventBusMainPostError"}}ct.EventBusMainPostError=EventBusMainPostError;class EventBusWorkerPostError extends Error{constructor(Z,ct){super((0,pt.format)("Worker post message [%j] error => %j.",Z,ct.stack));this.name="EventBusWorkerPostError"}}ct.EventBusWorkerPostError=EventBusWorkerPostError;class EventBusPublishSpecifyWorkerError extends Error{constructor(Z){super((0,pt.format)("Worker(%s) not find in ready map, maybe it is a wrong pid.",Z));this.name="EventBusPublishSpecifyWorkerError"}}ct.EventBusPublishSpecifyWorkerError=EventBusPublishSpecifyWorkerError;class EventBusDispatchStrategyError extends Error{constructor(){super("Dispatch strategy not found a worker and stop post.");this.name="EventBusDispatchStrategyError"}}ct.EventBusDispatchStrategyError=EventBusDispatchStrategyError},5982:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});dt(ut(41836),ct);dt(ut(4779),ct);dt(ut(97633),ct);dt(ut(68108),ct);dt(ut(48001),ct)},48001:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MessageCategory=ct.ListenerType=ct.MessageType=void 0;var ut;(function(Z){Z["Inited"]="inited";Z["Request"]="request";Z["Response"]="response";Z["Invoke"]="invoke";Z["Broadcast"]="broadcast"})(ut=ct.MessageType||(ct.MessageType={}));var pt;(function(Z){Z["Inited"]="inited";Z["Request"]="request";Z["Subscribe"]="Subscribe";Z["WorkerChanged"]="worker_changed";Z["Error"]="error"})(pt=ct.ListenerType||(ct.ListenerType={}));var dt;(function(Z){Z["IN"]="in";Z["OUT"]="out"})(dt=ct.MessageCategory||(ct.MessageCategory={}))},97633:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.LocalEventBus=void 0;const pt=ut(73317);class LocalDispatcher{constructor(){this.pidIdx=0;this.initMessageQueue=[]}clear(){this.mainWorker=null;this.childWorker=null;this.pidIdx=0}generatePid(){return this.pidIdx++}}const dt=new LocalDispatcher;class LocalWorker{constructor(Z){this.pid=Z}onMessage(Z){this.handler=Z}on(){}getWorkerId(){return this.pid}terminate(){}}class LocalEventBus extends pt.AbstractEventBus{constructor(Z={}){super(Z);this.worker=new LocalWorker(dt.generatePid());if(this.isMain()){this.debugLogger(`Main id=${this.worker.getWorkerId()}`);dt.mainWorker=this.worker}else{this.debugLogger(`Child id=${this.worker.getWorkerId()}`);dt.childWorker=this.worker}}workerSubscribeMessage(Z){if(this.isWorker()){dt.childWorker.onMessage(Z)}}workerListenMessage(Z,ct){if(this.isMain()){dt.mainWorker.onMessage(ct)}}workerSendMessage(Z){if(dt.mainWorker.handler){dt.mainWorker.handler(Z)}else{dt.initMessageQueue.push({to:"main",message:Z})}}mainSendMessage(Z,ct){if(dt.childWorker.handler){dt.childWorker.handler(ct)}else{dt.initMessageQueue.push({to:"worker",message:ct})}}getWorkerId(Z){return String((Z||this.worker).getWorkerId())}isMain(){return!this.isWorker()}isWorker(){return this.options.isWorker}async start(Z){if(this.isMain()){await(0,pt.createWaitHandler)((()=>dt.childWorker!=null),{timeout:this.options.waitWorkerTimeout,timeoutCheckInterval:this.options.waitWorkerCheckInterval||200});this.addWorker(dt.childWorker);if(dt.initMessageQueue.length){dt.initMessageQueue.forEach((({to:Z,message:ct})=>{if(Z==="worker"){this.mainSendMessage(dt.childWorker,ct)}else{this.workerSendMessage(ct)}}));dt.initMessageQueue=[]}}await super.start(Z)}async stop(){dt.clear();await super.stop()}}ct.LocalEventBus=LocalEventBus},41836:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ThreadEventBus=void 0;const pt=ut(28167);const dt=ut(73317);class ThreadEventBus extends dt.AbstractEventBus{constructor(Z={}){super(Z);if(!this.options.encoder){this.options.encoder=Z=>Z}if(!this.options.decoder){this.options.decoder=Z=>Z}}workerSubscribeMessage(Z){pt.parentPort.on("message",(ct=>{Z(this.options.decoder(ct))}))}workerListenMessage(Z,ct){Z.on("message",(Z=>{ct(this.options.decoder(Z))}))}workerSendMessage(Z){pt.parentPort.postMessage(this.options.encoder(Z))}mainSendMessage(Z,ct){Z.postMessage(this.options.encoder(ct))}isMain(){return!this.isWorker()}isWorker(){var Z;return(Z=this.options.isWorker)!==null&&Z!==void 0?Z:!pt.isMainThread}getWorkerId(Z){return String(Z?Z.threadId:pt.threadId)}}ct.ThreadEventBus=ThreadEventBus},62525:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.run=void 0;const pt=ut(79896);const dt=ut(16928);const ft=ut(63268);const _t=ut(39023);const mt=ut(70857);const ht=(0,_t.debuglog)("midway:glob");function formatWindowsPath(Z){if(mt.platform()==="win32"&&Z){return Z.map((Z=>Z.split(dt.sep).join(dt.posix.sep)))}return Z}const run=(Z,ct={cwd:process.cwd(),ignore:[]})=>{ht(`midway glob pattern = ${Z}, options = ${JSON.stringify(ct)}`);const ut=Date.now();const _t=ct.cwd;Z=formatWindowsPath(Z)||[];ht(`after format pattern = ${Z}`);const mt=ft(Z,{ignore:formatWindowsPath(ct.ignore)||[]});const yt=ft("**",{ignore:formatWindowsPath(ct.ignore)||[]});function globDirectory(Z,ct,ut,ft){if(!(0,pt.existsSync)(Z)){return[]}const mt=(0,pt.readdirSync)(Z);const yt=[];for(let vt of mt){const mt=(0,dt.resolve)(Z,vt);ht(`resolvePath = ${mt}`);const St=(0,pt.statSync)(mt);if(St.isDirectory()&&ut(mt.replace(_t,""))){const Z=globDirectory(mt,ct,ut,ft);yt.push(...Z)}else if(St.isFile()&&ct(mt.replace(_t,""))){yt.push(mt)}}return yt}const vt=globDirectory(_t,mt,yt,ct);ht(`midway glob timing ${Date.now()-ut}ms`);return vt};ct.run=run},22843:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.httpProxy=void 0;ct.httpProxy={enable:true}},47331:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.HttpProxyConfiguration=void 0;const ft=ut(31049);const _t=ut(22843);const mt=ut(96617);let ht=class HttpProxyConfiguration{applicationManager;httpProxy;async onReady(){if(this.httpProxy.enable){this.applicationManager.getApplications(["koa","faas","express","egg"]).forEach((Z=>{Z.useMiddleware(mt.HttpProxyMiddleware)}))}}};ct.HttpProxyConfiguration=ht;pt([(0,ft.Inject)(),dt("design:type",ft.MidwayApplicationManager)],ht.prototype,"applicationManager",void 0);pt([(0,ft.Config)("httpProxy"),dt("design:type",Object)],ht.prototype,"httpProxy",void 0);ct.HttpProxyConfiguration=ht=pt([(0,ft.Configuration)({namespace:"http-proxy",importConfigs:[{default:_t}]})],ht)},98085:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.Configuration=void 0;var ft=ut(47331);Object.defineProperty(ct,"Configuration",{enumerable:true,get:function(){return ft.HttpProxyConfiguration}});dt(ut(28198),ct);dt(ut(96617),ct)},28198:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},96617:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.HttpProxyMiddleware=void 0;const ft=ut(31049);const _t=ut(12593);let mt=class HttpProxyMiddleware{httpProxy;logger;resolve(Z){if(Z.getNamespace()==="express"){return async(Z,ct,ut)=>this.execProxy(Z,Z,ct,ut,false)}else{const ct=Z.getNamespace()==="faas";return async(Z,ut)=>{const pt=Z.request?.req||Z.request;return this.execProxy(Z,pt,Z,ut,ct)}}}async execProxy(Z,ct,ut,pt,dt){const ft=this.getProxyList(Z.url);if(!ft){return pt()}const{proxy:mt,url:ht}=ft;const yt={};for(const ut of Object.keys(ct.headers)){if(mt.ignoreHeaders?.[ut]||Z.header[ut]===undefined){continue}yt[ut.toLowerCase()]=Z.header[ut]}const vt=ct.headers["x-forwarded-for"];yt["x-forwarded-for"]=vt?`${vt}, ${Z.ip}`:Z.ip;yt["host"]=ht.host;delete yt["content-length"];const St=ct.method.toUpperCase();const bt=ut.res||ut;const xt=!dt&&bt.on&&bt.writable;const $t={method:St,url:ht.href,headers:yt,responseType:xt?"stream":"arrayBuffer",timeout:this.httpProxy.proxyTimeout||0};if(St==="POST"||St==="PUT"){$t.data=ct.body??Z.request?.body;if(ct.headers["content-type"]==="application/x-www-form-urlencoded"&&typeof $t.data!=="string"){$t.data=Object.keys($t.data).map((Z=>`${encodeURIComponent(Z)}=${encodeURIComponent($t.data[Z])}`)).join("&")}}const Et=await _t($t).catch((Z=>{if(!Z||!Z.response){throw Z||new Error("proxy unknown error")}return Z.response}));ut.type=Et.headers["content-type"];const Ct={"transfer-encoding":true};if(xt){Ct["content-length"]=true}Object.keys(Et.headers).forEach((Z=>{if(Ct[Z.toLowerCase()]){return}ut.set(Z,Et.headers[Z])}));ut.status=Et.status;if(xt){await new Promise((Z=>{bt.on("finish",(()=>{if(bt.end){bt.end()}Z(void 0)}));Et.data.pipe(bt)}))}else{ut.body=Et.data}}getProxyList(Z){if(!this.httpProxy){return}this.httpProxy.default=this.httpProxy.default||{};const ct=this.httpProxy.match?[this.httpProxy]:this.httpProxy.strategy?Object.values(this.httpProxy.strategy).map((Z=>Object.assign({},this.httpProxy.default,Z))):[];for(const ut of ct){if(!ut.match){continue}if(!ut.match.test(Z)){continue}if(ut.host){if(Z[0]==="/"){Z=ut.host+Z}const ct=new URL(Z);return{proxy:ut,url:ct}}else if(ut.target){const ct=Z.replace(ut.match,ut.target);return{proxy:ut,url:new URL(ct)}}}}static getName(){return"http-proxy"}};ct.HttpProxyMiddleware=mt;pt([(0,ft.Config)("httpProxy"),dt("design:type",Object)],mt.prototype,"httpProxy",void 0);pt([(0,ft.Logger)(),dt("design:type",Object)],mt.prototype,"logger",void 0);ct.HttpProxyMiddleware=mt=pt([(0,ft.Middleware)()],mt)},15491:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.i18n=void 0;const pt=ut(31049);ct.i18n={defaultLocale:"en_US",localeTable:{en_US:{}},fallbacks:{},writeCookie:true,resolver:{queryField:"locale",cookieField:{fieldName:"locale",cookieDomain:"",cookieMaxAge:pt.FORMAT.MS.ONE_YEAR}},localsField:"i18n",missingKeyHandler:Z=>Z}},29595:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.I18nConfiguration=void 0;const ft=ut(31049);const _t=ut(15491);const mt=ut(17825);let ht=class I18nConfiguration{applicationManager;async onReady(){this.applicationManager.getApplications(["koa","egg","faas","express"]).forEach((Z=>{Z.useMiddleware(mt.I18nMiddleware)}))}};ct.I18nConfiguration=ht;pt([(0,ft.Inject)(),dt("design:type",ft.MidwayApplicationManager)],ht.prototype,"applicationManager",void 0);ct.I18nConfiguration=ht=pt([(0,ft.Configuration)({namespace:"i18n",importConfigs:[{default:_t}]})],ht)},72606:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayI18nService=ct.MidwayI18nServiceSingleton=void 0;const ft=ut(31049);const _t=ut(96542);const mt=ut(63268);const ht=ut(3704);let yt=class MidwayI18nServiceSingleton{i18nConfig;localeTextMap=new Map;localeJSONMap=new Map;defaultLocale;fallbackMatch=[];localeMatchCache={};async init(){this.defaultLocale=(0,ht.formatLocale)(this.i18nConfig.defaultLocale);for(const Z in this.i18nConfig.localeTable){this.addLocale(Z,getES6Object(this.i18nConfig.localeTable[Z]))}for(const Z in this.i18nConfig.fallbacks){this.fallbackMatch.push({pattern:mt((0,ht.formatLocale)(Z)),locale:(0,ht.formatLocale)(this.i18nConfig.fallbacks[Z])})}}addLocale(Z,ct){Z=(0,ht.formatLocale)(Z);const ut=getMap(this.localeTextMap,Z);for(const Z in ct){if(typeof ct[Z]==="string"){getMap(ut,"default").set(Z,ct[Z])}else{for(const pt in ct[Z]){getMap(ut,Z).set(pt,ct[Z][pt])}}}this.localeJSONMap.set(Z,ct)}translate(Z,ct={}){const ut=(0,ht.formatLocale)(ct.locale??this.defaultLocale);const pt=ct.args??[];const dt=ct.group??"default";let ft=this.getLocaleMappingText(ut,Z,dt,pt);if(!ft&&ut!==this.defaultLocale){if(this.fallbackMatch.length){const ct=this.fallbackMatch.find((Z=>{if(Z.pattern(ut)){return true}}));if(ct){ft=this.getLocaleMappingText(ct.locale,Z,dt,pt)}}if(!ft){ft=this.getLocaleMappingText(this.defaultLocale,Z,dt,pt)}}if(!ft&&this.i18nConfig.missingKeyHandler){ft=this.i18nConfig.missingKeyHandler(Z,ct)}return ft}getAvailableLocale(Z,ct="default"){Z=(0,ht.formatLocale)(Z);if(this.localeMatchCache[Z+"_"+ct]){return this.localeMatchCache[Z+"_"+ct]}if(this.localeTextMap.has(Z)&&this.localeTextMap.get(Z).has(ct)){this.localeMatchCache[Z+"_"+ct]=Z;return Z}if(this.fallbackMatch.length){const ut=this.fallbackMatch.find((ut=>{if(ut.pattern(Z)){if(this.localeTextMap.has(ut.locale)&&this.localeTextMap.get(ut.locale).has(ct)){this.localeMatchCache[Z+"_"+ct]=ut.locale;return true}}}));if(ut){return ut.locale}}this.localeMatchCache[Z+"_"+ct]=this.defaultLocale;return this.defaultLocale}hasAvailableLocale(Z){Z=(0,ht.formatLocale)(Z);if(this.localeTextMap.has(Z)){return true}if(this.fallbackMatch.length){const ct=this.fallbackMatch.find((ct=>{if(ct.pattern(Z)){if(this.localeTextMap.has(ct.locale)){return true}}}));if(ct){return true}}return false}getLocaleMapping(Z,ct="default"){Z=(0,ht.formatLocale)(Z);const ut=this.localeTextMap.get(Z);if(ut&&ut.size>0){return ut.get(ct)}}getLocaleList(Z="default"){const ct=[];for(const ut of this.localeTextMap.keys()){if(this.localeTextMap.get(ut).has(Z)){ct.push(ut)}}return ct}getOriginLocaleJSON(Z,ct="default"){Z=(0,ht.formatLocale)(Z);return this.localeJSONMap.get(Z)?.[ct]}getDefaultLocale(){return this.defaultLocale}getLocaleMappingText(Z,ct,ut,pt){const dt=this.localeTextMap.get(Z);if(dt){const Z=dt.get(ut);if(Z){const ut=Z.get(ct);if(ut){return formatText(ut,pt)}}}}};ct.MidwayI18nServiceSingleton=yt;pt([(0,ft.Config)("i18n"),dt("design:type",Object)],yt.prototype,"i18nConfig",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],yt.prototype,"init",null);ct.MidwayI18nServiceSingleton=yt=pt([(0,ft.Provide)(),(0,ft.Scope)(ft.ScopeEnum.Singleton)],yt);let vt=class MidwayI18nService{i18nServiceSingleton;ctx;translate(Z,ct={}){if(!ct.locale){ct.locale=this.ctx.getAttr&&this.ctx.getAttr(_t.I18N_ATTR_KEY)}return this.i18nServiceSingleton.translate(Z,ct)}addLocale(Z,ct){this.i18nServiceSingleton.addLocale(Z,ct)}getLocaleMapping(Z,ct="default"){return this.i18nServiceSingleton.getLocaleMapping(Z,ct)}getDefaultLocale(){return this.i18nServiceSingleton.getDefaultLocale()}saveRequestLocale(Z){if(Z){this.ctx?.setAttr(_t.I18N_ATTR_KEY,(0,ht.formatLocale)(Z))}else{this.ctx?.setAttr(_t.I18N_ATTR_KEY,(0,ht.formatLocale)(this.getDefaultLocale()))}}getAvailableLocale(Z,ct="default"){return this.i18nServiceSingleton.getAvailableLocale(Z,ct)}hasAvailableLocale(Z){return this.i18nServiceSingleton.hasAvailableLocale(Z)}};ct.MidwayI18nService=vt;pt([(0,ft.Inject)(),dt("design:type",yt)],vt.prototype,"i18nServiceSingleton",void 0);pt([(0,ft.Inject)(),dt("design:type",Object)],vt.prototype,"ctx",void 0);ct.MidwayI18nService=vt=pt([(0,ft.Provide)()],vt);function formatText(Z,ct){if(Array.isArray(ct)){return(0,ht.formatWithArray)(Z,ct)}else{return(0,ht.formatWithObject)(Z,ct)}}function getES6Object(Z){for(const ct in Z){if(Z[ct]["default"]&&Object.keys(Z[ct]).length===1){Z[ct]=Z[ct].default}}return Z}function getMap(Z,ct){if(!Z.has(ct)){Z.set(ct,new Map)}return Z.get(ct)}},67213:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.formatLocale=ct.Configuration=void 0;var ft=ut(29595);Object.defineProperty(ct,"Configuration",{enumerable:true,get:function(){return ft.I18nConfiguration}});dt(ut(72606),ct);dt(ut(17825),ct);dt(ut(96542),ct);var _t=ut(3704);Object.defineProperty(ct,"formatLocale",{enumerable:true,get:function(){return _t.formatLocale}})},96542:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.I18N_ATTR_KEY=void 0;ct.I18N_ATTR_KEY="i18n:locale"},17825:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.I18nMiddleware=ct.I18nFilter=void 0;const ft=ut(31049);const _t=ut(96542);const mt=ut(72606);const ht=ut(3704);let yt=class I18nFilter{resolverConfig;i18nConfig;match(Z,ct,ut){const pt=ct.getAttr(_t.I18N_ATTR_KEY);if(this.resolverConfig){if(this.i18nConfig.writeCookie&&pt&&this.resolverConfig.cookieField){const Z={httpOnly:false,maxAge:this.resolverConfig.cookieField.cookieMaxAge,signed:false,domain:this.resolverConfig.cookieField.cookieDomain};ut.cookie(this.resolverConfig.cookieField.fieldName,pt,Z)}}return Z}};ct.I18nFilter=yt;pt([(0,ft.Config)("i18n.resolver"),dt("design:type",Object)],yt.prototype,"resolverConfig",void 0);pt([(0,ft.Config)("i18n"),dt("design:type",Object)],yt.prototype,"i18nConfig",void 0);ct.I18nFilter=yt=pt([(0,ft.Match)()],yt);let vt=class I18nMiddleware{resolverConfig;i18nConfig;resolve(Z){if("express"===Z.getNamespace()){Z.useFilter(yt);return async(Z,ct,ut)=>{const pt=await Z.requestContext.getAsync(mt.MidwayI18nService);let dt;if(this.resolverConfig){dt=Z.query[this.resolverConfig.queryField]||Z.cookies[this.resolverConfig.cookieField.fieldName];if(!dt){let ct=Z.acceptsLanguages();if(ct){if(Array.isArray(ct)){if(ct[0]==="*"){ct=ct.slice(1)}if(ct.length>0){for(let Z=0;Z<ct.length;Z++){const ut=(0,ht.formatLocale)(ct[Z]);if(pt.hasAvailableLocale(ut)){dt=ut;break}}}}else{dt=ct}}}}if(dt){pt.saveRequestLocale(dt)}else{pt.saveRequestLocale()}ct.locals[this.i18nConfig.localsField]=(Z,ct)=>pt.translate(Z,{args:ct});return ut()}}else{return async(Z,ct)=>{if(this.resolverConfig){let ct=Z.query[this.resolverConfig.queryField]||Z.cookies.get(this.resolverConfig.cookieField.fieldName,{signed:false});const ut=await Z.requestContext.getAsync(mt.MidwayI18nService);if(!ct){let pt=Z.acceptsLanguages();if(pt){if(Array.isArray(pt)){if(pt[0]==="*"){pt=pt.slice(1)}if(pt.length>0){for(let Z=0;Z<pt.length;Z++){const dt=(0,ht.formatLocale)(pt[Z]);if(ut.hasAvailableLocale(dt)){ct=dt;break}}}}else{ct=pt}}}if(ct){ut.saveRequestLocale(ct)}else{ut.saveRequestLocale()}if(Z.locals){Z.locals[this.i18nConfig.localsField]=(Z,ct)=>ut.translate(Z,{args:ct})}}await ct();const ut=Z.getAttr(_t.I18N_ATTR_KEY);if(this.resolverConfig){if(this.i18nConfig.writeCookie&&ut&&this.resolverConfig.cookieField){const ct={httpOnly:false,maxAge:this.resolverConfig.cookieField.cookieMaxAge,signed:false,domain:this.resolverConfig.cookieField.cookieDomain,overwrite:true};Z.cookies.set(this.resolverConfig.cookieField.fieldName,ut,ct)}}}}}static getName(){return"i18n"}};ct.I18nMiddleware=vt;pt([(0,ft.Config)("i18n.resolver"),dt("design:type",Object)],vt.prototype,"resolverConfig",void 0);pt([(0,ft.Config)("i18n"),dt("design:type",Object)],vt.prototype,"i18nConfig",void 0);ct.I18nMiddleware=vt=pt([(0,ft.Middleware)()],vt)},3704:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.formatWithArray=formatWithArray;ct.formatWithObject=formatWithObject;ct.formatLocale=formatLocale;const ut=/\{(\d+)\}/g;function formatWithArray(Z,ct){return Z.replace(ut,((Z,ut)=>{const pt=parseInt(ut);if(pt<ct.length){return ct[pt]}return Z}))}const pt=/\{(.+?)\}/g;function formatWithObject(Z,ct){return Z.replace(pt,((Z,ut)=>{const pt=ct[ut];if(pt){return pt}return Z}))}function formatLocale(Z){if(!Z)return Z;return Z.replace("_","-").toLowerCase()}},96252:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.info=void 0;const pt=ut(49710);ct.info={title:"Midway Info",infoPath:"/_info",hiddenKey:pt.DefaultHiddenKey,ignoreKey:[]}},96555:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.InfoConfiguration=void 0;const ft=ut(31049);const _t=ut(71240);const mt=ut(96252);let ht=class InfoConfiguration{applicationManager;async onReady(){this.applicationManager.getApplications(["koa","faas","express","egg"]).forEach((Z=>{Z.useMiddleware(_t.InfoMiddleware)}))}};ct.InfoConfiguration=ht;pt([(0,ft.Inject)(),dt("design:type",ft.MidwayApplicationManager)],ht.prototype,"applicationManager",void 0);ct.InfoConfiguration=ht=pt([(0,ft.Configuration)({namespace:"info",importConfigs:[{default:mt}]})],ht)},66909:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.Configuration=void 0;var ft=ut(96555);Object.defineProperty(ct,"Configuration",{enumerable:true,get:function(){return ft.InfoConfiguration}});dt(ut(39190),ct);dt(ut(71240),ct);dt(ut(49710),ct)},39190:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.InfoService=void 0;const ft=ut(31049);const _t=ut(31049);const mt=ut(49710);const ht=ut(14376);const yt=ut(70857);const vt=ut(16928);const St=ut(63268);let bt=class InfoService{midwayInformationService;configService;environment;titleConfig;defaultHiddenKey;ignoreKey;secretMatchList;container;async init(){this.secretMatchList=Array.from(new Set(this.defaultHiddenKey)).map((Z=>St(Z)))}info(Z){const ct=[];ct.push(this.projectInfo());ct.push(this.systemInfo());ct.push(this.resourceOccupationInfo());ct.push(this.softwareInfo());ct.push(this.midwayConfig());ct.push(this.midwayService());ct.push(this.timeInfo());ct.push(this.envInfo());ct.push(this.dependenciesInfo());ct.push(this.networkInfo());const ut=ct.map((({type:Z,info:ct})=>{const ut=Object.keys(ct);const pt=ut.filter((Z=>!this.ignoreKey.includes(Z)));const dt={};for(const Z of pt){dt[Z]=ct[Z]}return{type:Z,info:dt}}));if(Z==="html"){return(0,ht.renderToHtml)(ut,this.titleConfig)}return ut}projectInfo(){return{type:mt.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 Z=process.platform;return{type:mt.InfoType.SYSTEM,info:{Platform:Z==="win32"?"Windows":Z,Node:process.versions.node,V8:process.versions.v8,ProcessId:process.pid,Arch:process.arch,Hostname:(0,yt.hostname)(),HomeDir:(0,yt.homedir)(),CWD:process.cwd(),ExecCommand:[].concat(process.argv,process.execArgv).join(" ")}}}resourceOccupationInfo(){const Z=process.memoryUsage();const ct=(0,yt.cpus)();return{type:mt.InfoType.MEMORY_CPU,info:{"Memory Total Occupy":(0,ht.bitToMB)(Z.rss),"Heap Total Occupy":(0,ht.bitToMB)(Z.heapTotal),"Heap Used":(0,ht.bitToMB)(Z.heapUsed),"V8 C++ Object Memory":(0,ht.bitToMB)(Z.external),"System Total Memory":(0,ht.bitToMB)((0,yt.totalmem)()),CPU:`${ct[0]?`${ct[0].model} ${ct[0].speed}MHz`:""} ${ct.length} core `,"CPU Usage":ct.map((Z=>{const ct=Z.times;return((1-ct.idle/(ct.idle+ct.user+ct.nice+ct.sys+ct.irq))*100).toFixed(2)+"%"})).join(" / ")}}}softwareInfo(){const Z=["@midwayjs/core","@midwayjs/decorator","@midwayjs/faas"];const ct={};for(const ut of Z){const Z=this.midwayInformationService.getPkg();if(Z){ct[ut]=Z.version}}return{type:mt.InfoType.SOFTWARE,info:ct}}envInfo(){const Z={};Object.keys(process.env).forEach((ct=>{Z[ct]=this.filterSecretContent(ct,process.env[ct])}));return{type:mt.InfoType.ENVIRONMENT_VARIABLE,info:Z}}timeInfo(){const Z=(new Date).toString().split(" ");return{type:mt.InfoType.TIME,info:{Current:Date.now(),Uptime:(0,yt.uptime)(),Timezone:Z.length>=7?Z[5]:"",TimezoneName:Z.length>=7?Z.slice(6).join(" ").replace(/\(/g,"").replace(/\)/g,""):""}}}networkInfo(){const Z=(0,yt.networkInterfaces)();const ct={};Object.keys(Z).forEach((ut=>{const pt=Z[ut];let dt=ut;if(ut[ut.length-1]==="0"){dt=ut.slice(0,-1)}if(dt==="lo"){return}ct[dt]=pt.sort((Z=>{if(Z.family==="IPv4"){return-1}return 1})).map((Z=>`${Z.family} ${Z.address}`)).join(" / ")}));return{type:mt.InfoType.NETWORK,info:ct}}dependenciesInfo(){const Z=this.midwayInformationService.getPkg();const ct=Z.dependencies||{};const ut={};Object.keys(ct).forEach((Z=>{const pt=(0,ht.safeRequire)((0,vt.join)(Z,"package.json"),{});ut[Z]=`${pt.version||"Not Found"}(${ct[Z]})`}));return{type:mt.InfoType.DEPENDENCIES,info:ut}}midwayService(){const Z={};if(this.container?.registry){for(const ct of this.container.registry){const[ut,pt]=ct;const dt=pt?pt?.name||pt:typeof pt;Z[ut]=`${pt?.namespace?`${pt?.namespace}:`:""}${dt}${pt?.scope?` [${pt?.scope}]`:""}`}}return{type:mt.InfoType.MIDWAY_SERVICE,info:Z}}midwayConfig(){const Z={};const ct=this.configService.getConfiguration()||{};Object.keys(ct).forEach((ut=>{Z[ut]=this.safeJson(this.filterSecretContent(ut,ct[ut]))}));return{type:mt.InfoType.MIDWAY_CONFIG,info:Z}}filterSecretContent(Z,ct){if(typeof ct==="string"){const ut=this.secretMatchList.some((ct=>ct(Z.toLowerCase())));if(ut){return(0,ht.safeContent)(ct)}}else if(Array.isArray(ct)){return ct.map((ct=>this.filterSecretContent(Z,ct)))}return ct}safeJson(Z){switch(typeof Z){case"string":return`"${Z}"`;case"number":return`${Z}`;case"boolean":return String(Z);case"object":if(!Z){return"null"}if(Array.isArray(Z)){return`[${Z.map((Z=>this.safeJson(Z))).join(",")}]`}if(Z instanceof RegExp){return`"${Z.toString()}"`}const ct=[];for(const ut in Z){ct.push(`"${ut}":${this.safeJson(this.filterSecretContent(ut,Z[ut]))}`)}return`{${ct.join(",")}}`;case"function":return`function ${Z.name}(${Z.length} args)`}return""}};ct.InfoService=bt;pt([(0,ft.Inject)(),dt("design:type",_t.MidwayInformationService)],bt.prototype,"midwayInformationService",void 0);pt([(0,ft.Inject)(),dt("design:type",_t.MidwayConfigService)],bt.prototype,"configService",void 0);pt([(0,ft.Inject)(),dt("design:type",_t.MidwayEnvironmentService)],bt.prototype,"environment",void 0);pt([(0,ft.Config)("info.title"),dt("design:type",String)],bt.prototype,"titleConfig",void 0);pt([(0,ft.Config)("info.hiddenKey"),dt("design:type",Array)],bt.prototype,"defaultHiddenKey",void 0);pt([(0,ft.Config)("info.ignoreKey"),dt("design:type",Array)],bt.prototype,"ignoreKey",void 0);pt([(0,ft.ApplicationContext)(),dt("design:type",Object)],bt.prototype,"container",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],bt.prototype,"init",null);ct.InfoService=bt=pt([(0,ft.Provide)(),(0,ft.Scope)(ft.ScopeEnum.Singleton)],bt)},49710:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.InfoType=ct.DefaultHiddenKey=void 0;ct.DefaultHiddenKey=["keys","*key","*token","*secret*","pass*"];var ut;(function(Z){Z["PROJECT"]="Project";Z["SYSTEM"]="System";Z["MEMORY_CPU"]="Memory & CPU";Z["SOFTWARE"]="Software";Z["ENVIRONMENT_VARIABLE"]="Environment Variable";Z["TIME"]="Time";Z["NETWORK"]="Network";Z["RESOURCE"]="Resource";Z["DEPENDENCIES"]="Dependencies";Z["MIDWAY_SERVICE"]="Midway Service";Z["MIDWAY_CONFIG"]="Midway Config"})(ut||(ct.InfoType=ut={}))},71240:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.InfoMiddleware=void 0;const ft=ut(31049);const _t=ut(39190);let mt=class InfoMiddleware{infoPath;infoService;resolve(Z){if("express"===Z.getNamespace()){return async(Z,ct,ut)=>{if(Z.path===this.infoPath){ct.type("html");ct.send(this.infoService.info("html"))}else{ut()}}}else{return async(Z,ct)=>{if(Z.path===this.infoPath){return this.infoService.info("html")}return await ct()}}}static getName(){return"info"}};ct.InfoMiddleware=mt;pt([(0,ft.Config)("info.infoPath"),dt("design:type",String)],mt.prototype,"infoPath",void 0);pt([(0,ft.Inject)(),dt("design:type",_t.InfoService)],mt.prototype,"infoService",void 0);ct.InfoMiddleware=mt=pt([(0,ft.Middleware)()],mt)},14376:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.safeRequire=safeRequire;ct.bitToMB=bitToMB;ct.renderToHtml=renderToHtml;ct.safeContent=safeContent;const pt=ut(79896);function safeRequire(Z,ct){try{if(!(0,pt.existsSync)(Z)){return ct}return JSON.parse((0,pt.readFileSync)(Z,"utf8"))}catch(Z){return ct}}function bitToMB(Z){return Number((Z||0)/1024/1024).toFixed(2)+" MB"}function renderToHtml(Z,ct){let ut=`<div style="padding: 24px; font-size: 36px;background: #9999cb;font-weight: bold;">${ct}</div>`;ut+=Z.map((Z=>{const ct=Object.keys(Z.info||{});return`<div class="infoType">${Z.type}</div>\n <table style="border-collapse: collapse;width: 100%;">${ct.map((ct=>`<tr style="border: 1px solid #666;"><td class="infoName">${ct}</td><td class="infoValue">${Z.info[ct]}</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;">${ut}</div>`}function safeContent(Z=""){if(Z.length<3){return"*".repeat(Z.length)}else if(Z.length<6){return Z[0]+"*".repeat(Z.length-1)}else if(Z.length<10){return Z[0]+"*".repeat(Z.length-2)+Z[Z.length-1]}else if(Z.length<15){return Z.slice(0,2)+"*".repeat(Z.length-4)+Z.slice(-2)}else{return Z.slice(0,3)+"*".repeat(Z.length-6)+Z.slice(-3)}}},63045:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.siteFile=ct.bodyParser=ct.onerror=ct.cookiesExtra=ct.cookies=ct.keys=ct.midwayLogger=ct.koa=void 0;ct.koa={serverTimeout:2*60*1e3};ct.midwayLogger={clients:{appLogger:{contextLoggerFormat:Z=>{const ct=Z.ctx;const ut=ct.userId||"-";const pt=ct.traceId??ct.tracer?.traceId??"-";const dt=Date.now()-ct.startTime;const ft=ut+"/"+ct.ip+"/"+pt+"/"+dt+"ms "+ct.method+" "+ct.url;return`${Z.timestamp} ${Z.LEVEL} ${Z.pid} [${ft}] ${Z.message}`}}}};ct.keys="";ct.cookies={};ct.cookiesExtra={defaultGetOptions:{}};ct.onerror={};ct.bodyParser={enable:true,encoding:"utf8",formLimit:"1mb",jsonLimit:"1mb",textLimit:"1mb",strict:true,queryString:{arrayLimit:100,depth:5,parameterLimit:1e3},onerror(Z){Z.message+=", check bodyParser config";throw Z}};ct.siteFile={enable:true,favicon:undefined}},90521:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.KoaConfiguration=void 0;const ft=ut(31049);const _t=ut(98333);const mt=ut(619);const ht=ut(63045);const yt=ut(6455);const vt=ut(70951);let St=class KoaConfiguration{decoratorService;koaFramework;configService;init(){this.decoratorService.registerParameterHandler(ft.WEB_ROUTER_PARAM_KEY,(Z=>(0,ft.extractKoaLikeValue)(Z.metadata.type,Z.metadata.propertyData,Z.originParamType)(Z.originArgs[0],Z.originArgs[1])))}async onReady(){this.koaFramework.useMiddleware([vt.SiteFileMiddleware,yt.BodyParserMiddleware])}};ct.KoaConfiguration=St;pt([(0,ft.Inject)(),dt("design:type",ft.MidwayDecoratorService)],St.prototype,"decoratorService",void 0);pt([(0,ft.Inject)(),dt("design:type",mt.MidwayKoaFramework)],St.prototype,"koaFramework",void 0);pt([(0,ft.Inject)(),dt("design:type",ft.MidwayConfigService)],St.prototype,"configService",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",void 0)],St.prototype,"init",null);ct.KoaConfiguration=St=pt([(0,ft.Configuration)({namespace:"koa",imports:[_t],importConfigs:[{default:ht}]})],St)},619:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayKoaFramework=void 0;const dt=ut(31049);const ft=ut(60990);const _t=ut(53777);const mt=ut(76207);const ht=ut(42914);const yt=ut(35906);const vt=ut(83480);const St=ut(65986);const bt=Symbol("context#cookies");class KoaControllerGenerator extends dt.WebControllerGenerator{app;webRouterService;constructor(Z,ct){super(Z,ct);this.app=Z;this.webRouterService=ct}createRouter(Z){const ct=new _t(Z);ct.prefix(Z.prefix);return ct}generateController(Z){return this.generateKoaController(Z)}}let xt=class MidwayKoaFramework extends dt.BaseFramework{server;generator;webRouterService;configure(){return this.configService.getConfiguration("koa")}async applicationInitialize(Z){const ct=this.configService.getConfiguration("keys")||this.configurationOptions["keys"];if(!ct){throw new dt.MidwayConfigMissingError("config.keys")}const ut=this.configService.getConfiguration("cookies");const pt=this.configService.getConfiguration("cookiesExtra.defaultGetOptions");this.app=new mt({keys:[].concat(ct),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[bt]){this[bt]=new ft.Cookies(this,this.app.keys,ut,pt)}return this[bt]},enumerable:true});Object.defineProperty(this.app.context,"locals",{get(){return this.state},set(Z){this.state=Z}});Object.defineProperty(this.app.context,"forward",{get(){return async function(Z){const ct=this.requestContext.get(dt.MidwayWebRouterService);const ut=await ct.getMatchedRouterInfo(Z,this.method);if(ut){if(ut.controllerClz){const Z=await this.requestContext.getAsync(ut.controllerClz);return Z[ut.method](this)}else if(typeof ut.method==="function"){return ut.method(this)}}else{throw new dt.httpError.NotFoundError(`Forward url ${Z} Not Found`)}}}});const _t=this.configurationOptions.queryParseMode==="strict"?function(Z){return!Array.isArray(Z)?[Z]:Z}:this.configurationOptions.queryParseMode==="first"?function(Z){return Array.isArray(Z)?Z[0]:Z}:undefined;const St=this;Object.defineProperty(this.app.request,"query",{get(){const Z=this.querystring;const ct=this._querycache=this._querycache||{};if(ct[Z])return ct[Z];if(St.configurationOptions.queryParseMode){const ut={...St.configurationOptions.queryParseOptions,...St.configurationOptions.queryParseMode==="first"?{duplicates:"first"}:{}};ct[Z]=yt.parse(Z,ut)}else{ct[Z]=vt.parse(Z)}if(_t){for(const ut in ct[Z]){ct[Z][ut]=_t(ct[Z][ut])}}return ct[Z]},set(Z){this._querycache=this._querycache||{};this._querycache[this.querystring]=Z}});const xt=this.configService.getConfiguration("onerror");(0,ht.setupOnError)(this.app,xt,this.logger);const notFound=async(Z,ct)=>{await ct();if(!Z._matchedRoute&&Z.body===undefined){throw new dt.httpError.NotFoundError(`${Z.path} Not Found`)}};const $t=[notFound];const Et=this.configurationOptions.versioning;if(Et?.enabled){$t.push(this.createVersioningMiddleware(Et))}const midwayRootMiddleware=async(Z,ct)=>{this.app.createAnonymousContext(Z);const ut=this.applicationContext.get(dt.MidwayTraceService);const pt=`${Z.method} ${Z.path||"/"}`;const ft=this.configurationOptions?.tracing?.meta;const _t=this.configurationOptions?.tracing?.enable!==false;const mt=this.configurationOptions?.tracing?.extractor;const ht=this.configurationOptions?.tracing?.injector;const yt=typeof mt==="function"?mt({ctx:Z,request:Z.request,response:Z.response}):Z.headers;const vt=typeof ht==="function"?ht({ctx:Z,request:Z.request,response:Z.response}):Z.response.res;await ut.runWithEntrySpan(pt,{enable:_t,carrier:yt,responseCarrier:vt,attributes:{"midway.protocol":"http"},meta:ft,metaArgs:{ctx:Z,carrier:yt,request:Z.request,response:Z.response}},(async()=>{await(await this.applyMiddleware($t))(Z,ct);if(Z.body===undefined&&!Z.response._explicitStatus&&Z._matchedRoute){Z.body=undefined}}))};this.app.use(midwayRootMiddleware);this.webRouterService=await this.applicationContext.getAsync(dt.MidwayWebRouterService,[{globalPrefix:this.configurationOptions.globalPrefix}]);this.generator=new KoaControllerGenerator(this.app,this.webRouterService);this.defineApplicationProperties({generateController:this.generateController.bind(this),getPort:this.getPort.bind(this)});this.app.originUse=this.app.use;this.app.use=this.app.useMiddleware}async loadMidwayController(){await this.generator.loadMidwayController((Z=>{const ct=Z.middleware();ct._name=`midwayController(${Z?.opts?.prefix||"/"})`;this.app.use(ct)}))}generateController(Z){return this.generator.generateKoaController(Z)}async run(){await this.loadMidwayController();this.app.use=this.app.originUse;const Z={...this.configurationOptions,...this.configurationOptions.serverOptions};if(Z.key&&Z.cert){Z.key=dt.PathFileUtils.getFileContentSync(Z.key);Z.cert=dt.PathFileUtils.getFileContentSync(Z.cert);Z.ca=dt.PathFileUtils.getFileContentSync(Z.ca);process.env.MIDWAY_HTTP_SSL="true";if(Z.http2){this.server=ut(85675).createSecureServer(Z,this.app.callback())}else{this.server=ut(65692).createServer(Z,this.app.callback())}}else{if(Z.http2){this.server=ut(85675).createServer(Z,this.app.callback())}else{this.server=ut(58611).createServer(Z,this.app.callback())}}this.applicationContext.registerObject(dt.HTTP_SERVER_KEY,this.server);if(dt.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 ct=process.env.MIDWAY_HTTP_PORT||this.configurationOptions.listenOptions.port;if(ct===0||ct==="0"){ct=await(0,St.getFreePort)();this.logger.info(`[midway:koa] server has auto-assigned port ${ct}`)}this.configurationOptions.listenOptions.port=Number(ct);if(this.configurationOptions.listenOptions.port){new Promise((Z=>{this.server.listen(this.configurationOptions.listenOptions,(()=>{Z()}));process.env.MIDWAY_HTTP_PORT=String(this.configurationOptions.listenOptions.port)}));this.logger.debug(`[midway:koa] server is listening on port ${ct}`)}}async beforeStop(){if(this.server){new Promise((Z=>{this.server.close(Z);process.env.MIDWAY_HTTP_PORT=""}));this.logger.debug("[midway:koa] server is stopped!")}}getFrameworkName(){return"koa"}getServer(){return this.server}getPort(){return process.env.MIDWAY_HTTP_PORT}useMiddleware(Z){this.middlewareManager.insertLast(Z)}useFilter(Z){this.filterManager.useFilter(Z)}createVersioningMiddleware(Z){return async(ct,ut)=>{const pt=this.extractVersion(ct,Z);ct.apiVersion=pt;if(Z.type==="URI"&&pt){const ut=`/${Z.prefix||"v"}${pt}`;if(ct.path.startsWith(ut)){ct.originalPath=ct.path;ct.path=ct.path.replace(ut,"")||"/"}}await ut()}}extractVersion(Z,ct){if(ct.extractVersionFn){return ct.extractVersionFn(Z)}const ut=ct.type||"URI";switch(ut){case"HEADER":{const ut=ct.header||"x-api-version";const pt=Z.headers[ut];if(typeof pt==="string"){return pt.replace(/^v/,"")}return undefined}case"MEDIA_TYPE":{const ut=Z.headers.accept;const pt=ct.mediaTypeParam||"version";const dt=ut?.match(new RegExp(`${pt}=(\\d+)`));return dt?dt[1]:undefined}case"URI":{const ut=ct.prefix||"v";const pt=Z.path.match(new RegExp(`^/${ut}(\\d+)`));return pt?pt[1]:undefined}default:return ct.defaultVersion}}};ct.MidwayKoaFramework=xt;ct.MidwayKoaFramework=xt=pt([(0,dt.Framework)()],xt)},58647:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.Configuration=ct.Framework=void 0;var ft=ut(619);Object.defineProperty(ct,"Framework",{enumerable:true,get:function(){return ft.MidwayKoaFramework}});dt(ut(44028),ct);var _t=ut(90521);Object.defineProperty(ct,"Configuration",{enumerable:true,get:function(){return _t.KoaConfiguration}});dt(ut(70951),ct);dt(ut(6455),ct)},44028:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},6455:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.BodyParserMiddleware=void 0;const ft=ut(36952);const _t=ut(31049);let mt=class BodyParserMiddleware{bodyparserConfig;resolve(){if(this.bodyparserConfig.enable){return ft(this.bodyparserConfig)}}static getName(){return"bodyParser"}};ct.BodyParserMiddleware=mt;pt([(0,_t.Config)("bodyParser"),dt("design:type",Object)],mt.prototype,"bodyparserConfig",void 0);ct.BodyParserMiddleware=mt=pt([(0,_t.Middleware)()],mt)},70951:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.SiteFileMiddleware=void 0;const ft=ut(31049);const _t=ut(16928);const mt="public, max-age=2592000";let ht=class SiteFileMiddleware{siteFileConfig;resolve(){if(this.siteFileConfig.enable){return async(Z,ct)=>{if(Z.method!=="HEAD"&&Z.method!=="GET")return ct();if(Z.path[0]!=="/")return ct();if(Z.path!=="/favicon.ico"){return ct()}let ut=this.siteFileConfig["favicon"];if(ut===undefined){ut=Buffer.from("")}if(!ut)return ct();if(typeof ut==="string")return Z.redirect(ut);if(Buffer.isBuffer(ut)){Z.set("cache-control",mt);Z.body=ut;Z.type=_t.extname(Z.path);return}return ct()}}}static getName(){return"siteFile"}};ct.SiteFileMiddleware=ht;pt([(0,ft.Config)("siteFile"),dt("design:type",Object)],ht.prototype,"siteFileConfig",void 0);ct.SiteFileMiddleware=ht=pt([(0,ft.Middleware)()],ht)},42914:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.setupOnError=setupOnError;const pt=ut(58611);const dt=ut(65986);const ft=ut(31049);function setupOnError(Z,ct,ut){const _t=Object.assign({accepts(){const Z=ct.accepts||dt.accepts;return Z(this)},text(ct,ut){ut.res._headers={};ut.set(ct.headers);if((0,dt.isProduction)(Z)){ut.body=pt.STATUS_CODES[ut.status]}else{ut.body=ct.message}},html(ct,ut){const ft=(0,dt.detectStatus)(ct);if((0,dt.isProduction)(Z)){if(ft>=500){ut.status=500;ut.body=`<h2>Internal Server Error, real status: ${ft}</h2>`;return}else{ut.status=ft;ut.body=`<h2>${ft} ${pt.STATUS_CODES[ft]}</h2>`;return}}if(Z.getEnv()==="unittest"||Z.getEnv()==="test"){ut.status=ft;ut.body=`${ct.name}: ${ct.message}\n${ct.stack}`;return}ut.body=dt.tpl.replace("{{status}}",(0,dt.escapeHtml)(ct.status)).replace("{{errorCode}}",(0,dt.escapeHtml)(ct.code)).replace("{{stack}}",(0,dt.escapeHtml)(ct.stack));ut.type="html"},json(ct,ut){const ft=(0,dt.detectStatus)(ct);const _t=ct.code||ct.type;if((0,dt.isProduction)(Z)){if(ft>=500){ut.body={code:_t,message:pt.STATUS_CODES[ft]}}else{ut.body={code:_t,message:ct.message}}}else{ut.body={code:_t,message:ct.message,stack:ct.stack}}}},ct);Z.on("error",((ct,pt)=>{pt=pt||Z.createAnonymousContext();const ft=(0,dt.detectStatus)(ct);if(ft>=500){try{pt.logger.error(ct)}catch(Z){ut.error(ct);ut.error(Z)}return}try{pt.logger.warn(ct)}catch(Z){ut.warn(ct);ut.error(Z)}}));Z.context.onerror=function(ct){if(ct==null)return;if(this.req)(0,dt.sendToWormhole)(this.req);if(!(ct instanceof Error)){let Z=ct;if(typeof ct==="object"){try{Z=ft.Utils.safeStringify(ct)}catch(Z){}}const ut=new Error("non-error thrown: "+Z);if(ct){if(ct.name)ut.name=ct.name;if(ct.message)ut.message=ct.message;if(ct.stack)ut.stack=ct.stack;if(ct.status)ut["status"]=ct.status;if(ct.headers)ut["headers"]=ct.headers}ct=ut}const ut=this.headerSent||!this.writable;if(ut)ct.headerSent=true;Z.emit("error",ct,this);if(ut)return;if(ct.code==="ENOENT")ct.status=404;if(typeof ct.status!=="number"||!pt.STATUS_CODES[ct.status]){ct.status=500}this.status=ct.status;this.set(ct.headers);let mt;if(_t.accepts){mt=_t.accepts.call(this,"html","text","json")}else{mt=this.accepts("html","text","json")}mt=mt||"text";if(_t.all){_t.all.call(this,ct,this)}else{if(_t.redirect&&mt!=="json"){this.redirect(_t.redirect)}else{_t[mt].call(this,ct,this);this.type=mt}}if(mt==="json"){this.body=JSON.stringify(this.body)}this.res.end(this.body)}}},65986:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.tpl=void 0;ct.detectStatus=detectStatus;ct.accepts=accepts;ct.sendToWormhole=sendToWormhole;ct.isProduction=isProduction;ct.escapeHtml=escapeHtml;ct.getFreePort=getFreePort;const pt=ut(69278);function detectStatus(Z){let ct=Z.status||500;if(ct<200){ct=500}return ct}function accepts(Z){if(acceptJSON(Z))return"json";return"html"}function acceptJSON(Z){if(Z.path.endsWith(".json"))return true;if(Z.response.type&&Z.response.type.indexOf("json")>=0)return true;if(Z.accepts("html","text","json")==="json")return true;return false}function sendToWormhole(Z){return new Promise((ct=>{if(typeof Z.resume!=="function"){return ct()}if(Z.unpipe){Z.unpipe()}Z.resume();if(Z._readableState&&Z._readableState.ended){return ct()}if(!Z.readable||Z.destroyed){return ct()}function cleanup(){Z.removeListener("end",onEnd);Z.removeListener("close",onEnd);Z.removeListener("error",onError)}function onEnd(){cleanup();ct()}function onError(){cleanup();ct()}Z.on("end",onEnd);Z.on("close",onEnd);Z.on("error",onError)}))}function isProduction(Z){return Z.getEnv()!=="local"&&Z.getEnv()!=="unittest"}ct.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 dt=/["'&<>]/;function escapeHtml(Z){const ct=""+Z;const ut=dt.exec(ct);if(!ut){return ct}let pt;let ft="";let _t;let mt=0;for(_t=ut.index;_t<ct.length;_t++){switch(ct.charCodeAt(_t)){case 34:pt=""";break;case 38:pt="&";break;case 39:pt="'";break;case 60:pt="<";break;case 62:pt=">";break;default:continue}if(mt!==_t){ft+=ct.substring(mt,_t)}mt=_t+1;ft+=pt}return mt!==_t?ft+ct.substring(mt,_t):ft}async function getFreePort(){return new Promise(((Z,ct)=>{const ut=(0,pt.createServer)();ut.listen(0,(()=>{try{const ct=ut.address().port;ut.close();Z(ct)}catch(Z){ct(Z)}}))}))}},28520:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.LEVEL=ct.DefaultLogLevels=void 0;ct.DefaultLogLevels={none:0,error:1,trace:2,warn:3,info:4,verbose:5,debug:6,silly:7,all:8};ct.LEVEL={none:"NONE",error:"ERROR",trace:"TRACE",warn:"WARN",info:"INFO",verbose:"VERBOSE",debug:"DEBUG",silly:"SILLY",all:"ALL"}},62379:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.LoggerFactory=void 0;const pt=ut(8481);const dt=ut(39023);const ft=ut(16928);const _t=ut(4002);const mt=dt.debuglog("midway:debug");class LoggerFactory extends Map{constructor(Z={}){super();this.factoryOptions=Z}createLogger(Z,ct){if(!this.has(Z)){mt('[logger]: Create logger "%s" with options %j',Z,ct);const ut=new pt.MidwayLogger(Object.assign(ct,this.factoryOptions));this.addLogger(Z,ut);return ut}return this.getLogger(Z)}addLogger(Z,ct,ut=true){if(!ut||!this.has(Z)){if(this.get(Z)!==ct){if(ct["onClose"]){ct["onClose"]((()=>{this.delete(Z)}))}if(ct["on"]){ct.on("close",(()=>this.delete(Z)))}this.set(Z,ct)}}else{throw new Error(`logger id ${Z} has duplicate`)}return this.get(Z)}getLogger(Z){return this.get(Z)}removeLogger(Z){const ct=this.get(Z);ct===null||ct===void 0?void 0:ct["close"]();this.delete(Z)}get(Z){return super.get(Z)}close(Z){if(Z){return this.removeLogger(Z)}Array.from(this.keys()).forEach((Z=>this.removeLogger(Z)))}getDefaultMidwayLoggerConfig(Z){var ct;const ut=(0,_t.isDevelopmentEnvironment)(Z.env);const pt=(ct=process.env["MIDWAY_LOGGER_WRITEABLE_DIR"])!==null&&ct!==void 0?ct:Z.root;if(!pt){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,ft.join)(pt,"logs",Z.name),auditFileDir:".audit",transports:{console:ut?{autoColors:ut}:false,file:{bufferWrite:!ut},error:{bufferWrite:!ut}}},clients:{coreLogger:{fileLogName:"midway-core.log"},appLogger:{}}}}}createContextLogger(Z,ct,ut={}){return ct.createContextLogger(Z,ut)}}ct.LoggerFactory=LoggerFactory},51169:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayBaseLogger=ct.MidwayLoggerContainer=ct.createConsoleLogger=ct.createFileLogger=ct.createLogger=ct.clearAllLoggers=ct.loggers=void 0;const ft=ut(62379);const _t=ut(8481);dt(ut(51314),ct);dt(ut(8481),ct);dt(ut(19870),ct);dt(ut(3993),ct);dt(ut(96242),ct);dt(ut(53828),ct);dt(ut(62379),ct);dt(ut(4002),ct);ct.loggers=new ft.LoggerFactory;const clearAllLoggers=()=>{ct.loggers.close()};ct.clearAllLoggers=clearAllLoggers;const createLogger=(Z,ut={})=>ct.loggers.createLogger(Z,ut);ct.createLogger=createLogger;const createFileLogger=(Z,ut)=>ct.loggers.createLogger(Z,{transports:{file:{dir:__dirname,fileLogName:"custom-logger.log",...ut}}});ct.createFileLogger=createFileLogger;const createConsoleLogger=(Z,ut={})=>ct.loggers.createLogger(Z,{transports:{console:ut}});ct.createConsoleLogger=createConsoleLogger;ct.MidwayLoggerContainer=ft.LoggerFactory;ct.MidwayBaseLogger=_t.MidwayLogger},51314:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},8481:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayChildLogger=ct.MidwayContextLogger=ct.MidwayLogger=ct.TransportManager=void 0;const pt=ut(4002);const dt=ut(70857);const ft=ut(19870);const _t=ut(96242);const mt=ut(3993);ct.TransportManager=new Map;ct.TransportManager.set("console",_t.ConsoleTransport);ct.TransportManager.set("file",mt.FileTransport);ct.TransportManager.set("error",mt.ErrorTransport);ct.TransportManager.set("json",mt.JSONTransport);class MidwayLogger{constructor(Z={}){this.transports=new Map;this.closeHandlers=[];Z=(0,pt.formatLegacyLoggerOptions)(Z);this.options=Z;this.options.level=this.options.level||"silly";this.options.eol=this.options.eol||dt.EOL;if(this.options.transports){for(const Z in this.options.transports){this.add(Z,this.options.transports[Z])}}}get level(){return this.options.level}set level(Z){this.options.level=Z}log(Z,...ct){this.transit(Z,{},...ct)}debug(...Z){this.transit("debug",{},...Z)}info(...Z){this.transit("info",{},...Z)}warn(...Z){this.transit("warn",{},...Z)}error(...Z){this.transit("error",{},...Z)}verbose(...Z){this.transit("verbose",{},...Z)}write(...Z){this.transit(false,{},...Z)}silly(...Z){this.transit("silly",{},...Z)}add(Z,ut){if(ut){let pt;if(!(ut instanceof ft.Transport)){if(!ct.TransportManager.has(Z)){throw new Error(`Transport ${Z} is not supported`)}else{pt=new(ct.TransportManager.get(Z))(ut)}}else{pt=ut}pt.setLoggerOptions(this.options);this.transports.set(Z,pt)}}get(Z){return this.transports.get(Z)}remove(Z,ct={}){if(this.transports.has(Z)){if(ct.close===undefined||ct.close){this.transports.get(Z).close()}this.transports.delete(Z)}}close(){for(const Z of this.transports.keys()){this.remove(Z,{close:true})}for(const Z of this.closeHandlers){Z()}}onClose(Z){this.closeHandlers.push(Z)}createContextLogger(Z,ct={}){return new MidwayContextLogger(Z,this,ct)}transit(Z,ct={},...ut){if(Z!==false&&!(0,pt.isEnableLevel)(Z,this.level)){return}for(const pt of this.transports.values()){pt.log(Z,ct,...ut)}}getChild(Z={}){return new MidwayChildLogger(this,Z)}}ct.MidwayLogger=MidwayLogger;class MidwayContextLogger{constructor(Z,ct,ut={}){this.ctx=Z;this.parentLogger=ct;this.options=ut}debug(...Z){this.transit("debug",...Z)}info(...Z){this.transit("info",...Z)}warn(...Z){this.transit("warn",...Z)}error(...Z){this.transit("error",...Z)}verbose(...Z){this.transit("verbose",...Z)}write(...Z){this.transit(false,...Z)}transit(Z,...ct){this.parentLogger.transit(Z,{ctx:this.ctx,contextFormat:this.options.contextFormat},...ct)}getContext(){return this.ctx}}ct.MidwayContextLogger=MidwayContextLogger;class MidwayChildLogger{constructor(Z,ct={}){this.parentLogger=Z;this.meta=ct}debug(...Z){this.transit("debug",...Z)}info(...Z){this.transit("info",...Z)}warn(...Z){this.transit("warn",...Z)}error(...Z){this.transit("error",...Z)}verbose(...Z){this.transit("verbose",...Z)}write(...Z){this.transit(false,...Z)}transit(Z,...ct){this.parentLogger.transit(Z,this.meta,...ct)}}ct.MidwayChildLogger=MidwayChildLogger},96242:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ConsoleTransport=void 0;const pt=ut(19870);const dt=ut(4002);const ft=ut(78997);const _t=ft.supportsColor.stdout;class ConsoleTransport extends pt.Transport{log(Z,ct,...ut){if(!(0,dt.isEnableLevel)(Z,this.options.level)){return}let pt=this.format(Z,ct,ut);if(process.env.FORCE_ENABLE_COLOR||this.options.autoColors&&_t){const ct=this.getColor(Z);pt=(0,ft.colorizeAll)(pt,ct)}pt+=this.options.eol;if(Z==="error"){process.stderr.write(pt)}else{process.stdout.write(pt)}}getColor(Z){switch(Z){case"debug":return ft.Color.blue;case"info":return ft.Color.green;case"warn":return ft.Color.yellow;case"error":return ft.Color.red;default:return ft.Color.white}}close(){}}ct.ConsoleTransport=ConsoleTransport},3993:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.JSONTransport=ct.ErrorTransport=ct.FileTransport=void 0;const pt=ut(19870);const dt=ut(53828);const ft=ut(16928);const _t=ut(43106);const mt=ut(79896);const ht=ut(4002);const yt=ut(61256);const vt=ut(74450);class FileTransport extends pt.Transport{constructor(Z={}){super(Z);this.options=Z;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,ht.isValidFileName)(this.options.fileLogName)||!(0,ht.isValidDirName)(this.options.dir)){throw new Error("Your path or filename contain an invalid character.")}const ct={frequency:"custom",dateFormat:"YYYY-MM-DD",endStream:true,fileOptions:{flags:"a"},utc:false,extension:"",createSymlink:!(0,ht.isWin32)(),maxFiles:"7d",zippedArchive:false};if(!this.options.auditFileDir){Z.auditFileDir=this.options.dir}if(!ft.isAbsolute(this.options.auditFileDir)){Z.auditFileDir=ft.join(this.options.dir,Z.auditFileDir)}this.logStream=dt.FileStreamRotatorManager.getStream({...ct,filename:ft.join(this.options.dir,this.options.fileLogName),size:(0,ht.getMaxSize)(this.options.maxSize||"200m"),symlinkName:this.options.fileLogName,auditFile:ft.join(Z.auditFileDir,"."+(0,yt.hash)(this.options)+"-audit.json"),...Z});this.logStream.on("logRemoved",(ct=>{if(Z.zippedArchive){const Z=ct.name+".gz";if(mt.existsSync(Z)){try{mt.unlinkSync(Z)}catch(Z){console.error(Z)}return}}}));if(Z.zippedArchive){this.logStream.on("rotate",(Z=>{const ct=mt.existsSync(Z);const ut=mt.existsSync(Z+".gz");if(!ct||ut){return}const pt=_t.createGzip();const dt=mt.createReadStream(Z);const ft=mt.createWriteStream(Z+".gz");dt.pipe(pt).pipe(ft).on("finish",(()=>{if(mt.existsSync(Z)){mt.unlinkSync(Z)}}))}))}}log(Z,ct,...ut){if(!(0,ht.isEnableLevel)(Z,this.options.level)){return}let pt=this.format(Z,ct,ut);pt+=this.options.eol;if(this.options.bufferWrite){this.bufSize+=pt.length;this.buf.push(pt);if(this.buf.length>this.options.bufferMaxLength){this.flush()}}else{this.logStream.write(pt)}}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){dt.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()}}ct.FileTransport=FileTransport;class ErrorTransport extends FileTransport{constructor(Z){Z.level="error";super(Z)}}ct.ErrorTransport=ErrorTransport;class JSONTransport extends FileTransport{log(Z,ct,...ut){if(!(0,ht.isEnableLevel)(Z,this.options.level)){return}let pt=this.format(Z,ct,ut);if(typeof pt==="string"||Buffer.isBuffer(pt)){pt=(0,vt.stringify)({message:pt.toString()})}else{pt=(0,vt.stringify)(pt)}pt+=this.options.eol;if(this.options.bufferWrite){this.bufSize+=pt.length;this.buf.push(pt);if(this.buf.length>this.options.bufferMaxLength){this.flush()}}else{this.logStream.write(pt)}}}ct.JSONTransport=JSONTransport},53828:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.FileStreamRotatorManager=ct.FileStreamRotator=void 0;const pt=ut(79896);const dt=ut(16928);const ft=ut(76982);const _t=ut(24434);const mt=ut(39023);const ht=ut(24403);const yt=ut(35888);const vt=ut(42613);const St=ut(4002);const bt=(0,mt.debuglog)("midway-logger");const xt=["daily","test","s","m","h","custom"];const $t="YYYYMMDDHHmm";ht.extend(yt);class FileStreamRotator{getFrequency(Z){const ct=Z.toLowerCase().match(/^(\d+)([smh])$/);if(ct){return(0,St.checkNumAndType)(ct[2],parseInt(ct[1]))}const ut=(0,St.checkDailyAndTest)(Z);if(ut){return ut}return false}parseFileSize(Z){if(Z&&typeof Z==="string"){const ct=Z.toLowerCase().match(/^((?:0\.)?\d+)([kmg])$/);if(ct){switch(ct[2]){case"k":return ct[1]*1024;case"m":return ct[1]*1024*1024;case"g":return ct[1]*1024*1024*1024}}}return null}getDate(Z,ct,ut){ct=ct||$t;const pt=ut?ht.utc():ht().local();if(Z&&xt.indexOf(Z.type)!==-1){switch(Z.type){case"s":const ut=Math.floor(pt.second()/Z.digit)*Z.digit;return pt.second(ut).format(ct);case"m":const dt=Math.floor(pt.minute()/Z.digit)*Z.digit;return pt.minute(dt).format(ct);case"h":const ft=Math.floor(pt.hour()/Z.digit)*Z.digit;return pt.hour(ft).format(ct);case"daily":case"custom":case"test":return pt.format(ct)}}return pt.format(ct)}setAuditLog(Z,ct,ut){let ft=null;if(Z){const _t=Z.toString().substr(-1);const mt=Z.toString().match(/^(\d+)/);if(Number(mt[1])>0){const Z=dt.dirname(ut.replace(/%DATE%.+/,"_filename"));try{if(ct){const Z=dt.resolve(ct);ft=JSON.parse(pt.readFileSync(Z,{encoding:"utf-8"}))}else{const ct=dt.resolve(Z+"/"+".audit.json");ft=JSON.parse(pt.readFileSync(ct,{encoding:"utf-8"}))}}catch(ut){if(ut.code!=="ENOENT"){return null}ft={keep:{days:false,amount:Number(mt[1])},auditLog:ct||Z+"/"+".audit.json",files:[]}}ft.keep={days:_t==="d",amount:Number(mt[1])}}}return ft}writeAuditLog(Z){try{(0,St.mkDirForFile)(Z.auditLog);pt.writeFileSync(Z.auditLog,JSON.stringify(Z,null,2))}catch(ct){bt((new Date).toLocaleString(),"[FileStreamRotator] Failed to store log audit at:",Z.auditLog,"Error:",ct)}}addLogToAudit(Z,ct,ut){if(ct&&ct.files){const pt=ct.files.findIndex((ct=>ct.name===Z));if(pt!==-1){return ct}const dt=Date.now();ct.files.push({date:dt,name:Z,hash:ft.createHash(ct.hashType).update(Z+"LOG_FILE"+dt).digest("hex")});if(ct.keep.days){const Z=ht().subtract(ct.keep.amount,"days").valueOf();ct.files=ct.files.filter((pt=>{if(pt.date>Z){return true}pt.hashType=ct.hashType;(0,St.removeFile)(pt);ut.emit("logRemoved",pt);return false}))}else{const Z=ct.files.splice(-ct.keep.amount);if(ct.files.length>0){ct.files.filter((Z=>{Z.hashType=ct.hashType;(0,St.removeFile)(Z);ut.emit("logRemoved",Z);return false}))}ct.files=Z}this.writeAuditLog(ct)}return ct}getStream(Z){let ct=null;let ut=null;vt(Z.filename,"options.filename must be supplied");if(Z.frequency){ct=this.getFrequency(Z.frequency)}const dt=this.setAuditLog(Z.maxFiles,Z.auditFile,Z.filename);if(dt!=null){dt.hashType=Z.auditHashType!==undefined?Z.auditHashType:"md5"}let ft=null;let yt=0;let Et=0;if(Z.size){ft=this.parseFileSize(Z.size)}let Ct=Z.dateFormat||$t;if(ct&&ct.type==="daily"){if(!Z.dateFormat){Ct="YYYY-MM-DD"}if(ht().format(Ct)!==ht().endOf("day").format(Ct)||ht().format(Ct)===ht().add(1,"day").format(Ct)){bt((new Date).toLocaleString(),"[FileStreamRotator] Changing type to custom as date format changes more often than once a day or not every day");ct.type="custom"}}if(ct){ut=Z.frequency?this.getDate(ct,Ct,Z.utc):""}Z.createSymlink=Z.createSymlink||false;Z.extension=Z.extension||"";const Tt=Z.filename;let wt=null;let At=Tt+(ut?"."+ut:"");if(Tt.match(/%DATE%/)){At=Tt.replace(/%DATE%/g,ut?ut:this.getDate(null,Ct,Z.utc))}if(ft){let ct=null;let ut=At;if(dt&&dt.files&&dt.files instanceof Array&&dt.files.length>0){const Z=dt.files[dt.files.length-1].name;if(Z.match(ut)){const ct=Z.match(ut+"\\.(\\d+)");if(ct){ut=Z;yt=ct[1]}}}if(yt===0&&ut===At){ut+=Z.extension}while(pt.existsSync(ut)){ct=ut;yt++;ut=At+"."+yt+Z.extension}if(ct){const Z=pt.statSync(ct);if(Z.size<ft){ut=ct;yt--;Et=Z.size}}At=ut}else{At+=Z.extension}bt((new Date).toLocaleString(),"[FileStreamRotator] Logging to: ",At);(0,St.mkDirForFile)(At);const kt=Z.fileOptions||{flags:"a"};let It=pt.createWriteStream(At,kt);if(ut&&ct&&xt.indexOf(ct.type)>-1||ft>0){bt((new Date).toLocaleString(),"[FileStreamRotator] Rotating file: ",ct?ct.type:"",ft?"size: "+ft:"");const ht=new _t;ht.auditLog=dt;ht.filename=Z.filename;ht.end=(...Z)=>{It.end(...Z);vt.clear()};ht.canWrite=()=>!It.closed&&It.writable&&!It.destroyed;(0,St.BubbleEvents)(It,ht);ht.on("new",(ct=>{ht.auditLog=this.addLogToAudit(ct,ht.auditLog,ht);if(Z.createSymlink){(0,St.createCurrentSymLink)(ct,Z.symlinkName)}}));const vt=(0,St.debounce)((()=>{let Z=false;try{const Z=pt.statSync(At);if(Z.size>Et){Et=Z.size}}catch(ct){Z=true}return Z}),1e3);ht.write=(dt,_t)=>{const xt=vt();const $t=ct?this.getDate(ct,Ct,Z.utc):ut;if(xt||ut&&$t!==ut||ft&&Et>ft){let dt=Tt+(ut&&ct?"."+$t:"");if(Tt.match(/%DATE%/)&&ut){dt=Tt.replace(/%DATE%/g,$t)}if(ft&&Et>ft){yt++;dt+="."+yt+Z.extension}else{yt=0;dt+=Z.extension}Et=0;bt((new Date).toLocaleString(),(0,mt.format)("[FileStreamRotator] Changing logs from %s to %s",At,dt));ut=$t;wt=At;At=dt;if(Z.endStream===true){It.end()}else{It.destroy()}(0,St.mkDirForFile)(At);It=pt.createWriteStream(dt,kt);ht.emit("new",dt);ht.emit("rotate",wt,dt);(0,St.BubbleEvents)(It,ht)}It.write(dt,_t);Et+=Buffer.byteLength(dt,_t)};process.nextTick((()=>{ht.emit("new",At)}));ht.emit("new",At);return ht}else{bt((new Date).toLocaleString(),"[FileStreamRotator] File won't be rotated: ",Z.frequency,Z.size);process.nextTick((()=>{It.emit("new",At)}));return It}}}ct.FileStreamRotator=FileStreamRotator;class FileStreamRotatorManager{static getStream(Z){let ct;if(this.enabled){if(!this.streamPool.has(Z.filename)){const ct=(new FileStreamRotator).getStream(Z);this.streamPool.set(Z.filename,ct);this.loggerRef.set(ct,0)}ct=this.streamPool.get(Z.filename);let ut=this.loggerRef.get(ct);this.loggerRef.set(ct,ut++)}else{ct=(new FileStreamRotator).getStream(Z)}return ct}static close(Z){if(this.enabled){if(this.loggerRef.has(Z)){let ct=this.loggerRef.get(Z);ct--;if(ct===0){Z.end();this.streamPool.delete(Z.filename);this.loggerRef.delete(Z)}else if(ct>0){this.loggerRef.set(Z,ct)}else{}}}else{Z.end()}}static clear(){for(const Z of this.streamPool.values()){Z.end();if(this.loggerRef.has(Z)){this.loggerRef.delete(Z)}}this.streamPool.clear();this.loggerRef=new WeakMap}}ct.FileStreamRotatorManager=FileStreamRotatorManager;FileStreamRotatorManager.streamPool=new Map;FileStreamRotatorManager.loggerRef=new WeakMap;FileStreamRotatorManager.enabled=true},19870:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.EmptyTransport=ct.Transport=void 0;const pt=ut(39023);const dt=ut(4002);const ft=ut(28520);class Transport{constructor(Z={}){this.options=Z;this.pid=process.pid}setLoggerOptions(Z){this.loggerOptions=Z;this.options.level=this.options.level||Z.level;this.options.format=this.options.format||Z.format;this.options.contextFormat=this.options.contextFormat||Z.contextFormat;this.options.eol=this.options.eol||Z.eol}format(Z,ct,ut){const dt=this.getLoggerInfo(Z,ct,ut);if(Buffer.isBuffer(dt.args[0])){return dt.args[0]}if(Z===false){return(0,pt.format)(dt.message)}const ft=ct.contextFormat||this.options.contextFormat;if(ct.ctx&&ft){return ft(dt)}const _t=ct.format||this.options.format;if(_t){return _t(dt)}if(Z){return(0,pt.format)("%s %s %s %s",dt.timestamp,dt.LEVEL,dt.pid,dt.message)}else{return(0,pt.format)(dt.message)}}getLoggerInfo(Z,ct,ut){const _t=Z||"";const mt={level:_t,pid:this.pid};Object.defineProperties(mt,{timestamp:{get(){return(0,dt.getFormatDate)(new Date)},enumerable:false},LEVEL:{get(){return ft.LEVEL[_t]||""},enumerable:false},args:{get(){return ut},enumerable:false},originArgs:{get(){return ut},enumerable:false},message:{get(){return(0,pt.format)(...ut)},enumerable:false},ctx:{get(){return ct.ctx},enumerable:false},originError:{get(){return ut.find((Z=>Z instanceof Error))},enumerable:false},meta:{get(){return ct},enumerable:false}});return mt}get level(){return this.options.level}set level(Z){this.options.level=Z}}ct.Transport=Transport;class EmptyTransport extends Transport{log(Z,...ct){}close(){}}ct.EmptyTransport=EmptyTransport},78997:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.supportsColor=ct.colorizeAll=ct.colorize=ct.Color=void 0;const pt=ut(932);const dt=ut(70857);const ft=ut(52018);ct.Color={red:Z=>`[31m${Z}[39m`,green:Z=>`[32m${Z}[39m`,yellow:Z=>`[33m${Z}[39m`,blue:Z=>`[34m${Z}[39m`,magenta:Z=>`[35m${Z}[39m`,cyan:Z=>`[36m${Z}[39m`,white:Z=>`[37m${Z}[39m`,gray:Z=>`[90m${Z}[39m`,grey:Z=>`[90m${Z}[39m`,black:Z=>`[30m${Z}[39m`,bgRed:Z=>`[41m${Z}[49m`,bgGreen:Z=>`[42m${Z}[49m`,bgYellow:Z=>`[43m${Z}[49m`,bgBlue:Z=>`[44m${Z}[49m`,bgMagenta:Z=>`[45m${Z}[49m`,bgCyan:Z=>`[46m${Z}[49m`,bgWhite:Z=>`[47m${Z}[49m`,bgBlack:Z=>`[40m${Z}[49m`,bold:Z=>`[1m${Z}[22m`,dim:Z=>`[2m${Z}[22m`,italic:Z=>`[3m${Z}[23m`,underline:Z=>`[4m${Z}[24m`,inverse:Z=>`[7m${Z}[27m`,hidden:Z=>`[8m${Z}[28m`,strikethrough:Z=>`[9m${Z}[29m`};const colorize=(Z,ut)=>{if(typeof ut==="function"){return ut(Z)}else{return ct.Color[ut](Z)}};ct.colorize=colorize;const colorizeAll=(Z,ut)=>Z.replace(/([^\s]+)/g,(Z=>(0,ct.colorize)(Z,ut)));ct.colorizeAll=colorizeAll;function hasFlag(Z,ct=process.argv){const ut=Z.startsWith("-")?"":Z.length===1?"-":"--";const pt=ct.indexOf(ut+Z);const dt=ct.indexOf("--");return pt!==-1&&(dt===-1||pt<dt)}let _t;if(hasFlag("no-color")||hasFlag("no-colors")||hasFlag("color=false")||hasFlag("color=never")){_t=0}else if(hasFlag("color")||hasFlag("colors")||hasFlag("color=true")||hasFlag("color=always")){_t=1}function envForceColor(){if("FORCE_COLOR"in pt.env){if(pt.env.FORCE_COLOR==="true"){return 1}if(pt.env.FORCE_COLOR==="false"){return 0}return pt.env.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(pt.env.FORCE_COLOR,10),3)}}function translateLevel(Z){if(Z===0){return false}return{level:Z,hasBasic:true,has256:Z>=2,has16m:Z>=3}}function _supportsColor(Z,ct){const ut=ct.streamIsTTY;const ft=true;const mt=envForceColor();if(mt!==undefined){_t=mt}const ht=ft?_t:mt;if(ht===0){return 0}if(ft){if(hasFlag("color=16m")||hasFlag("color=full")||hasFlag("color=truecolor")){return 3}if(hasFlag("color=256")){return 2}}if("TF_BUILD"in pt.env&&"AGENT_NAME"in pt.env){return 1}if(Z&&!ut&&ht===undefined){return 0}const yt=ht||0;if(pt.env.TERM==="dumb"){return yt}if(pt.platform==="win32"){const Z=dt.release().split(".");if(Number(Z[0])>=10&&Number(Z[2])>=10586){return Number(Z[2])>=14931?3:2}return 1}if("CI"in pt.env){if("GITHUB_ACTIONS"in pt.env||"GITEA_ACTIONS"in pt.env){return 3}if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((Z=>Z in pt.env))||pt.env.CI_NAME==="codeship"){return 1}return yt}if("TEAMCITY_VERSION"in pt.env){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(pt.env.TEAMCITY_VERSION)?1:0}if(pt.env.COLORTERM==="truecolor"){return 3}if(pt.env.TERM==="xterm-kitty"){return 3}if("TERM_PROGRAM"in pt.env){const Z=Number.parseInt((pt.env.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(pt.env.TERM_PROGRAM){case"iTerm.app":{return Z>=3?3:2}case"Apple_Terminal":{return 2}}}if(/-256(color)?$/i.test(pt.env.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(pt.env.TERM)){return 1}if("COLORTERM"in pt.env){return 1}return yt}function createSupportsColor(Z){const ct=_supportsColor(true,{streamIsTTY:Z.isTTY});return translateLevel(ct)}ct.supportsColor={stdout:createSupportsColor({isTTY:ft.isatty(1)}),stderr:createSupportsColor({isTTY:ft.isatty(2)})}},61256:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.hash=void 0;const pt=ut(76982);const dt=ut(2203);function hash(Z){const ct={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 ut=pt.createHash(ct.algorithm);const dt=typeHasher(ct,ut);dt.dispatch(Z);if(!ut.update){ut.end("")}return ut.digest(ct.encoding)}ct.hash=hash;function typeHasher(Z,ct,ut){ut=ut||[];const write=function(Z){if(ct.update){return ct.update(Z,"utf8")}else{return ct.write(Z,"utf8")}};return{dispatch:function(ct){if(Z.replacer){ct=Z.replacer(ct)}let ut=typeof ct;if(ct===null){ut="null"}return this["_"+ut](ct)},_object:function(ct){const pt=/\[object (.*)\]/i;const dt=Object.prototype.toString.call(ct);let ft=pt.exec(dt);if(!ft){ft="unknown:["+dt+"]"}else{ft=ft[1]}ft=ft.toLowerCase();let _t=null;if((_t=ut.indexOf(ct))>=0){return this.dispatch("[CIRCULAR:"+_t+"]")}else{ut.push(ct)}if(typeof Buffer!=="undefined"&&Buffer.isBuffer&&Buffer.isBuffer(ct)){write("buffer:");return write(ct)}if(ft!=="object"&&ft!=="function"&&ft!=="asyncfunction"){if(this["_"+ft]){this["_"+ft](ct)}else if(Z.ignoreUnknown){return write("["+ft+"]")}else{throw new Error('Unknown object type "'+ft+'"')}}else{let ut=Object.keys(ct);if(Z.unorderedObjects){ut=ut.sort()}if(Z.respectType!==false&&!isNativeFunction(ct)){ut.splice(0,0,"prototype","__proto__","constructor")}if(Z.excludeKeys){ut=ut.filter((ct=>!Z.excludeKeys(ct)))}write("object:"+ut.length+":");const pt=this;return ut.forEach((ut=>{pt.dispatch(ut);write(":");if(!Z.excludeValues){pt.dispatch(ct[ut])}write(",")}))}},_array:function(ct,pt){pt=typeof pt!=="undefined"?pt:Z.unorderedArrays!==false;const ft=this;write("array:"+ct.length+":");if(!pt||ct.length<=1){return ct.forEach((Z=>ft.dispatch(Z)))}let _t=[];const mt=ct.map((ct=>{const pt=new dt.PassThrough;const ft=ut.slice();const mt=typeHasher(Z,pt,ft);mt.dispatch(ct);_t=_t.concat(ft.slice(ut.length));return pt.read().toString()}));ut=ut.concat(_t);mt.sort();return this._array(mt,false)},_date:function(Z){return write("date:"+Z.toJSON())},_symbol:function(Z){return write("symbol:"+Z.toString())},_error:function(Z){return write("error:"+Z.toString())},_boolean:function(Z){return write("bool:"+Z.toString())},_string:function(Z){write("string:"+Z.length+":");write(Z.toString())},_function:function(ct){write("fn:");if(isNativeFunction(ct)){this.dispatch("[native]")}else{this.dispatch(ct.toString())}if(Z.respectFunctionNames!==false){this.dispatch("function-name:"+String(ct.name))}if(Z.respectFunctionProperties){this._object(ct)}},_number:function(Z){return write("number:"+Z.toString())},_xml:function(Z){return write("xml:"+Z.toString())},_null:function(){return write("Null")},_undefined:function(){return write("Undefined")},_regexp:function(Z){return write("regex:"+Z.toString())},_uint8array:function(Z){write("uint8array:");return this.dispatch(Array.prototype.slice.call(Z))},_uint8clampedarray:function(Z){write("uint8clampedarray:");return this.dispatch(Array.prototype.slice.call(Z))},_int8array:function(Z){write("int8array:");return this.dispatch(Array.prototype.slice.call(Z))},_uint16array:function(Z){write("uint16array:");return this.dispatch(Array.prototype.slice.call(Z))},_int16array:function(Z){write("int16array:");return this.dispatch(Array.prototype.slice.call(Z))},_uint32array:function(Z){write("uint32array:");return this.dispatch(Array.prototype.slice.call(Z))},_int32array:function(Z){write("int32array:");return this.dispatch(Array.prototype.slice.call(Z))},_float32array:function(Z){write("float32array:");return this.dispatch(Array.prototype.slice.call(Z))},_float64array:function(Z){write("float64array:");return this.dispatch(Array.prototype.slice.call(Z))},_arraybuffer:function(Z){write("arraybuffer:");return this.dispatch(new Uint8Array(Z))},_url:function(Z){return write("url:"+Z.toString())},_map:function(ct){write("map:");const ut=Array.from(ct);return this._array(ut,Z.unorderedSets!==false)},_set:function(ct){write("set:");const ut=Array.from(ct);return this._array(ut,Z.unorderedSets!==false)},_file:function(Z){write("file:");return this.dispatch([Z.name,Z.size,Z.type,Z.lastModfied])},_blob:function(){if(Z.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(Z){return write("bigint:"+Z.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(Z){if(typeof Z!=="function"){return false}const ct=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;return ct.exec(Function.prototype.toString.call(Z))!=null}},4002:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.getFormatDate=ct.isWin32=ct.BubbleEvents=ct.formatLegacyLoggerOptions=ct.formatLoggerOptions=ct.isDevelopmentEnvironment=ct.debounce=ct.throwIf=ct.getMaxSize=ct.isValidDirName=ct.isValidFileName=ct.removeFile=ct.createCurrentSymLink=ct.mkDirForFile=ct.checkDailyAndTest=ct.checkNumAndType=ct.isEnableLevel=void 0;const pt=ut(28520);const dt=ut(79896);const ft=ut(16928);const _t=ut(76982);const mt=ut(16928);const ht=ut(70857);const yt=ut(19870);function isEnableLevel(Z,ct){if(!Z||!ct){return true}return pt.DefaultLogLevels[Z]<=pt.DefaultLogLevels[ct]}ct.isEnableLevel=isEnableLevel;function checkNumAndType(Z,ct){if(typeof ct==="number"){switch(Z){case"s":case"m":if(ct<0||ct>60){return false}break;case"h":if(ct<0||ct>24){return false}break}return{type:Z,digit:ct}}}ct.checkNumAndType=checkNumAndType;function checkDailyAndTest(Z){switch(Z){case"custom":case"daily":return{type:Z,digit:undefined};case"test":return{type:Z,digit:0}}return false}ct.checkDailyAndTest=checkDailyAndTest;function mkDirForFile(Z){const ct=mt.dirname(Z);ct.split(mt.sep).reduce(((Z,ct)=>{Z+=ct+mt.sep;if(!dt.existsSync(Z)){try{dt.mkdirSync(Z)}catch(Z){if(Z.code!=="EEXIST"){throw Z}}}return Z}),"")}ct.mkDirForFile=mkDirForFile;function createCurrentSymLink(Z,ct){const ut=ct||"current.log";const pt=(0,ft.dirname)(Z);const _t=(0,ft.basename)(Z);const mt=pt+"/"+ut;try{const Z=dt.lstatSync(mt);if(Z.isSymbolicLink()){dt.unlinkSync(mt);dt.symlinkSync(_t,mt)}}catch(Z){if(Z&&Z.code==="ENOENT"){try{dt.symlinkSync(_t,mt)}catch(Z){console.error((new Date).toLocaleString(),"[FileStreamRotator] Could not create symlink file: ",mt," -> ",_t)}}}}ct.createCurrentSymLink=createCurrentSymLink;function removeFile(Z){if(Z.hash===_t.createHash(Z.hashType).update(Z.name+"LOG_FILE"+Z.date).digest("hex")){try{if(dt.existsSync(Z.name)){dt.unlinkSync(Z.name)}}catch(ct){console.error((new Date).toLocaleString(),"[FileStreamRotator] Could not remove old log file: ",Z.name)}}}ct.removeFile=removeFile;function isValidFileName(Z){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(Z)}ct.isValidFileName=isValidFileName;function isValidDirName(Z){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(Z)}ct.isValidDirName=isValidDirName;function getMaxSize(Z){if(Z&&typeof Z==="string"){const ct=Z.toLowerCase().match(/^((?:0\.)?\d+)([k|m|g])$/);if(ct){return Z}}else if(Z&&Number.isInteger(Z)){const ct=Math.round(Z/1024);return ct===0?"1k":ct+"k"}return null}ct.getMaxSize=getMaxSize;function throwIf(Z,...ct){Array.prototype.slice.call(ct,1).forEach((ut=>{if(Z[ut]){throw new Error("Cannot set "+ut+" and "+ct[0]+" together")}}))}ct.throwIf=throwIf;function debounce(Z,ct,ut){let pt,dt,ft,_t,mt;if(null==ct)ct=100;function later(){const ht=Date.now()-_t;if(ht<ct&&ht>=0){pt=setTimeout(later,ct-ht)}else{pt=null;if(!ut){mt=Z.apply(ft,dt);ft=dt=null}}}const debounced=(...dt)=>{ft=this;_t=Date.now();const ht=ut&&!pt;if(!pt)pt=setTimeout(later,ct);if(ht){mt=Z.apply(ft,dt);ft=dt=null}return mt};debounced.clear=()=>{if(pt){clearTimeout(pt);pt=null}};debounced.flush=()=>{if(pt){mt=Z.apply(ft,dt);ft=dt=null;clearTimeout(pt);pt=null}};return debounced}ct.debounce=debounce;const isDevelopmentEnvironment=Z=>["local","test","unittest"].includes(Z);ct.isDevelopmentEnvironment=isDevelopmentEnvironment;const vt={enableConsole:true,disableConsole:true,enableFile:true,enableError:true,enableJSON:true,disableFile:true,disableError:true};function formatLoggerOptions(Z){if(Object.keys(Z).some((Z=>vt[Z]))){const ct={transports:{}};for(const ut of Object.keys(Z)){if(!vt[ut]){ct[ut]=Z[ut]}}if(ct.transports["console"]&&(Z["enableConsole"]===false||Z["disableConsole"]===true)){ct.transports["console"]=false}if(ct.transports["file"]&&(Z["enableFile"]===false||Z["disableFile"]===true)){ct.transports["file"]=false}if(ct.transports["error"]&&(Z["enableError"]===false||Z["disableError"]===true)){ct.transports["error"]=false}if(ct.transports["json"]&&Z["enableJSON"]===false){ct.transports["json"]=false}return ct}return Z}ct.formatLoggerOptions=formatLoggerOptions;const St={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 bt=Object.prototype.hasOwnProperty;const xt=Object.prototype.toString;function formatLegacyLoggerOptions(Z){var ct,ut,pt,dt,ft,_t;function isPlainObject(Z){if(!Z||xt.call(Z)!=="[object Object]"){return false}const ct=bt.call(Z,"constructor");const ut=Z.constructor&&Z.constructor.prototype&&bt.call(Z.constructor.prototype,"isPrototypeOf");if(Z.constructor&&!ct&&!ut){return false}let pt;for(pt in Z){}return typeof pt==="undefined"||bt.call(Z,pt)}function deepMerge(Z,ct){if(!Z){return ct}if(ct&&!isPlainObject(ct)){return ct}for(const ut of Object.keys(ct)){if(ct[ut]instanceof Object){Object.assign(ct[ut],deepMerge(Z[ut],ct[ut]))}}Object.assign(Z||{},ct);return Z}function setTransportOptions(ct,ut,pt,dt=false){var ft,_t;if(!ct.transports[pt]){ct.transports[pt]={}}const mt=(ft=St[ut].mappingKey)!==null&&ft!==void 0?ft:ut;if(dt){ct.transports[pt][mt]=Z[ut]}else{ct.transports[pt][mt]=(_t=ct.transports[pt][mt])!==null&&_t!==void 0?_t:Z[ut]}}function isValidTransport(Z){return Z&&(Z instanceof yt.Transport||typeof Z==="object"&&Z["dir"]&&Z["fileLogName"])}if(Object.keys(Z).some((Z=>{var ct;return(ct=St[Z])===null||ct===void 0?void 0:ct.isOld}))){const mt={transports:{}};for(const ut of Object.keys(Z)){if(!St[ut]){continue}else{if(St[ut].ignore){continue}St[ut].category=[].concat(St[ut].category);for(const pt of St[ut].category){if(pt==="all"){for(const Z of Object.keys(mt.transports)){setTransportOptions(mt,ut,Z,St[ut].overwriteIfExists)}}else if(pt==="top"){mt[ut]=(ct=mt[ut])!==null&&ct!==void 0?ct:Z[St[ut].mappingKey]}else{setTransportOptions(mt,ut,pt,St[ut].overwriteIfExists)}}}}for(const ct of Object.keys(Z)){if(!St[ct]){deepMerge(mt[ct],Z[ct])}}if(Z["enableConsole"]===false||Z["disableConsole"]===true){mt.transports["console"]=false}else{mt.transports["console"]=(ut=mt.transports["console"])!==null&&ut!==void 0?ut:{}}if(Z["enableFile"]===false||Z["disableFile"]===true){mt.transports["file"]=false}else{mt.transports["file"]=(pt=mt.transports["file"])!==null&&pt!==void 0?pt:{}}if(Z["enableError"]===false||Z["disableError"]===true){mt.transports["error"]=false}else{mt.transports["error"]=(dt=mt.transports["error"])!==null&&dt!==void 0?dt:{}}if(((ft=Z===null||Z===void 0?void 0:Z.transports)===null||ft===void 0?void 0:ft["json"])===undefined&&(Z["enableJSON"]===undefined||Z["enableJSON"]===false)){mt.transports["json"]=false}else{}for(const Z of["file","error","json"]){if((_t=mt===null||mt===void 0?void 0:mt.transports)===null||_t===void 0?void 0:_t[Z]){if(!isValidTransport(mt.transports[Z])){delete mt.transports[Z]}}}return mt}return Z}ct.formatLegacyLoggerOptions=formatLegacyLoggerOptions;function BubbleEvents(Z,ct){Z.on("close",(()=>{ct.emit("close")}));Z.on("finish",(()=>{ct.emit("finish")}));Z.on("error",(Z=>{ct.emit("error",Z)}));Z.on("open",(Z=>{ct.emit("open",Z)}))}ct.BubbleEvents=BubbleEvents;function isWin32(){return ht.platform()==="win32"}ct.isWin32=isWin32;function getFormatDate(Z){function pad(Z,ct=2){const ut=Z+"";return ut.padStart(ct,"0")}const ct=Z.getFullYear();const ut=Z.getMonth()+1;const pt=Z.getDate();const dt=Z.getHours();const ft=Z.getMinutes();const _t=Z.getSeconds();const mt=Z.getMilliseconds();return`${ct}-${pad(ut)}-${pad(pt)} ${pad(dt)}:${pad(ft)}:${pad(_t)}.${pad(mt,3)}`}ct.getFormatDate=getFormatDate},98131:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.session=void 0;ct.session={enable:true,maxAge:24*3600*1e3,key:"MW_SESS",httpOnly:true,logValue:true}},811:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.SessionConfiguration=void 0;const ft=ut(31049);const _t=ut(98131);const mt=ut(71526);let ht=class SessionConfiguration{applicationManager;logger;sessionConfig;async onReady(){if(this.sessionConfig.enable){this.applicationManager.getApplications(["koa","faas"]).forEach((Z=>{if(Z.on){Z.on("session:missed",(({ctx:Z,key:ct})=>{this.logger.warn("[session][missed] key(%s)",ct)}));Z.on("session:expired",(({ctx:Z,key:ct,value:ut})=>{this.logger.warn("[session][expired] key(%s) value(%j)",ct,this.sessionConfig.logValue?ut:"")}));Z.on("session:invalid",(({ctx:Z,key:ct,value:ut})=>{this.logger.warn("[session][invalid] key(%s) value(%j)",ct,this.sessionConfig.logValue?ut:"")}))}Z.useMiddleware(mt.SessionMiddleware)}))}}};ct.SessionConfiguration=ht;pt([(0,ft.Inject)(),dt("design:type",ft.MidwayApplicationManager)],ht.prototype,"applicationManager",void 0);pt([(0,ft.Logger)("coreLogger"),dt("design:type",Object)],ht.prototype,"logger",void 0);pt([(0,ft.Config)("session"),dt("design:type",Object)],ht.prototype,"sessionConfig",void 0);ct.SessionConfiguration=ht=pt([(0,ft.Configuration)({namespace:"session",importConfigs:[{default:_t}]})],ht)},98333:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.Configuration=void 0;dt(ut(23694),ct);var ft=ut(811);Object.defineProperty(ct,"Configuration",{enumerable:true,get:function(){return ft.SessionConfiguration}});dt(ut(71526),ct);dt(ut(9788),ct)},23694:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.SessionStore=void 0;class SessionStore{}ct.SessionStore=SessionStore},55154:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ContextSession=void 0;const pt=ut(39023);const dt=ut(48149);const ft=ut(37013);const _t=(0,pt.debuglog)("session:context");class ContextSession{ctx;app;opts;session;externalKey;prevHash;store;constructor(Z,ct){this.ctx=Z;this.app=Z.app;this.opts=Object.assign({},ct);this.store=this.opts.ContextStore?new this.opts.ContextStore(Z):this.opts.store}get(){const Z=this.session;if(Z)return Z;if(Z===false)return null;if(this.store){this.create()}else{this.initFromCookie()}return this.session}set(Z){if(Z===null){this.session=false;return}if(typeof Z==="object"){this.create(Z,this.externalKey);return}throw new Error("this.session can only be set as null or an object.")}async initFromExternal(){_t("init from external");const Z=this.ctx;const ct=this.opts;let ut;if(ct.externalKey){ut=ct.externalKey.get(Z);_t("get external key from custom %s",ut)}else{ut=Z.cookies.get(ct.key,ct);_t("get external key from cookie %s",ut)}if(!ut){this.create();return}const pt=await this.store.get(ut,ct.maxAge,{ctx:Z,rolling:ct.rolling});if(!this.valid(pt,ut)){this.create();return}this.create(pt,ut);this.prevHash=(0,dt.hash)(this.session.toJSON())}initFromCookie(){_t("init from cookie");const Z=this.ctx;const ct=this.opts;const ut=Z.cookies.get(ct.key,ct);if(!ut){this.create();return}let pt;_t("parse %s",ut);try{pt=ct.decode(ut)}catch(pt){_t("decode %j error: %s",ut,pt);if(!(pt instanceof SyntaxError)){Z.cookies.set(ct.key,"",ct);pt.headers={"set-cookie":Z.response.get("set-cookie")};throw pt}this.create();return}_t("parsed %j",pt);if(!this.valid(pt)){this.create();return}this.create(pt);this.prevHash=(0,dt.hash)(this.session.toJSON())}valid(Z,ct){const ut=this.ctx;if(!Z){this.emit("missed",{key:ct,value:Z,ctx:ut});return false}if(Z._expire&&Z._expire<Date.now()){_t("expired session");this.emit("expired",{key:ct,value:Z,ctx:ut});return false}const pt=this.opts.valid;if(typeof pt==="function"&&!pt(ut,Z)){_t("invalid session");this.emit("invalid",{key:ct,value:Z,ctx:ut});return false}return true}emit(Z,ct){setImmediate((()=>{this.app.emit(`session:${Z}`,ct)}))}create(Z,ct){_t("create session with val: %j externalKey: %s",Z,ct);if(this.store){this.externalKey=ct||this.opts.genid&&this.opts.genid(this.ctx)}this.session=new ft.Session(this,Z,this.externalKey)}async commit({save:Z=false,regenerate:ct=false}={}){const ut=this.session;const pt=this.opts;const dt=this.ctx;if(undefined===ut)return;if(ut===false){await this.remove();return}if(ct){await this.remove();if(this.store)this.externalKey=pt.genid&&pt.genid(dt)}const ft=Z||ct||ut._requireSave?"force":this._shouldSaveSession();_t("should save session: %s",ft);if(!ft)return;if(typeof pt.beforeSave==="function"){_t("before save");pt.beforeSave(dt,ut)}const mt=ft==="changed";await this.save(mt)}_shouldSaveSession(){const Z=this.prevHash;const ct=this.session;const ut=ct.toJSON();if(!Z&&!Object.keys(ut).length)return"";const pt=Z!==(0,dt.hash)(ut);if(pt)return"changed";if(this.opts.rolling)return"rolling";if(this.opts.renew){const Z=ct._expire;const ut=ct.maxAge;if(Z&&ut&&Z-Date.now()<ut/2)return"renew"}return""}async remove(){const Z=Object.assign({},this.opts,{expires:dt.COOKIE_EXP_DATE,maxAge:false});const ct=this.ctx;const ut=Z.key;const pt=this.externalKey;if(pt){await this.store.destroy(pt,{ctx:ct})}ct.cookies.set(ut,"",Z)}async save(Z){const ct=this.opts;const ut=ct.key;const pt=this.externalKey;let ft=this.session.toJSON();let mt=ct.maxAge?ct.maxAge:dt.ONE_DAY;if(mt==="session"){ct.maxAge=undefined;ft._session=true}else{ft._expire=mt+Date.now();ft._maxAge=mt}if(pt){_t("save %j to external key %s",ft,pt);if(typeof mt==="number"){mt+=1e4}await this.store.set(pt,ft,mt,{changed:Z,ctx:this.ctx,rolling:ct.rolling});if(ct.externalKey){ct.externalKey.set(this.ctx,pt)}else{this.ctx.cookies.set(ut,pt,ct)}return}_t("save %j to cookie",ft);ft=ct.encode(ft);_t("save %s",ft);this.ctx.cookies.set(ut,ft,ct)}}ct.ContextSession=ContextSession},2771:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.crc32=crc32;const ut=[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(Z,ct=false){let pt=~0;for(let ct=0,dt=Z.length;ct<dt;ct++){pt=pt>>>8^ut[(pt^Z.charCodeAt(ct))&255]}pt=Math.abs(pt^-1);return ct?pt.toString(16):pt}},37013:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Session=void 0;class Session{_sessCtx;_ctx;_externalKey;_requireSave;isNew=true;constructor(Z,ct,ut){this._sessCtx=Z;this._ctx=Z.ctx;this._externalKey=ut;if(!ct){this.isNew=true}else{for(const Z in ct){if(Z==="_maxAge")this._ctx.sessionOptions.maxAge=ct._maxAge;else if(Z==="_session")this._ctx.sessionOptions.maxAge="session";else this[Z]=ct[Z]}}}toJSON(){const Z={};Object.keys(this).forEach((ct=>{if(ct==="isNew")return;if(ct[0]==="_")return;Z[ct]=this[ct]}));return Z}get length(){return Object.keys(this.toJSON()).length}get populated(){return!!this.length}get maxAge(){return this._ctx.sessionOptions.maxAge}set maxAge(Z){this._ctx.sessionOptions.maxAge=Z;this._requireSave=true}get externalKey(){return this._externalKey}save(Z){return this.commit({save:true},Z)}regenerate(Z){return this.commit({regenerate:true},Z)}manuallyCommit(){return this.commit()}commit(Z,ct){if(typeof Z==="function"){ct=Z;Z={}}const ut=this._sessCtx.commit(Z);if(ct){ut.then((()=>ct()),ct)}else{return ut}}}ct.Session=Session},9788:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.SessionStoreManager=void 0;const dt=ut(31049);let ft=class SessionStoreManager{sessionStore;setSessionStore(Z){this.sessionStore=Z}getSessionStore(){return this.sessionStore}};ct.SessionStoreManager=ft;ct.SessionStoreManager=ft=pt([(0,dt.Provide)(),(0,dt.Scope)(dt.ScopeEnum.Singleton)],ft)},48149:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ONE_DAY=ct.COOKIE_EXP_DATE=void 0;ct.decode=decode;ct.encode=encode;ct.hash=hash;const pt=ut(2771);function decode(Z){const ct=Buffer.from(Z,"base64").toString("utf8");return JSON.parse(ct)}function encode(Z){Z=JSON.stringify(Z);return Buffer.from(Z).toString("base64")}function hash(Z){return(0,pt.crc32)(JSON.stringify(Z))}ct.COOKIE_EXP_DATE=new Date("Thu, 01 Jan 1970 00:00:00 GMT");ct.ONE_DAY=24*60*60*1e3},71526:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.SessionMiddleware=void 0;const ft=ut(31049);const _t=ut(9788);const mt=ut(48149);const ht=ut(42613);const yt=ut(55154);const vt=Symbol("context#contextSession");const St=Symbol("context#_contextSession");function formatOpts(Z){Z=Z||{};Z.key=Z.key||"koa.sess";if(!("maxAge"in Z))Z.maxAge=Z.maxage;if(Z.overwrite==null)Z.overwrite=true;if(Z.httpOnly==null)Z.httpOnly=true;if(Z.sameSite==null)delete Z.sameSite;if(Z.signed==null)Z.signed=true;if(Z.autoCommit==null)Z.autoCommit=true;if(typeof Z.encode!=="function"){Z.encode=mt.encode}if(typeof Z.decode!=="function"){Z.decode=mt.decode}const ct=Z.store;if(ct){ht.ok(ft.Types.isFunction(ct.get),"store.get must be function");ht.ok(ft.Types.isFunction(ct.set),"store.set must be function");ht.ok(ft.Types.isFunction(ct.destroy),"store.destroy must be function")}const ut=Z.externalKey;if(ut){ht.ok(ft.Types.isFunction(ut.get),"externalKey.get must be function");ht.ok(ft.Types.isFunction(ut.set),"externalKey.set must be function")}const pt=Z.ContextStore;if(pt){ht.ok(ft.Types.isClass(pt),"ContextStore must be a class");ht.ok(ft.Types.isFunction(pt.prototype.get),"ContextStore.prototype.get must be function");ht.ok(ft.Types.isFunction(pt.prototype.set),"ContextStore.prototype.set must be function");ht.ok(ft.Types.isFunction(pt.prototype.destroy),"ContextStore.prototype.destroy must be function")}if(!Z.genid){if(Z.prefix){Z.genid=()=>`${Z.prefix}${ft.Utils.randomUUID()}`}else{Z.genid=ft.Utils.randomUUID}}return Z}function extendContext(Z,ct){if(Z.hasOwnProperty(vt)){return}Object.defineProperties(Z,{[vt]:{get(){if(this[St]){return this[St]}this[St]=new yt.ContextSession(this,ct);return this[St]}},session:{get(){return this[vt].get()},set(Z){this[vt].set(Z)},configurable:true},sessionOptions:{get(){return this[vt].opts}}})}let bt=class SessionMiddleware{sessionConfig;logger;sessionStoreManager;resolve(Z){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 ct=this.sessionStoreManager.getSessionStore();if(ct){this.sessionConfig.store=ct}const ut=formatOpts(this.sessionConfig);extendContext(Z.context,ut);return async function session(Z,ct){const pt=Z[vt];if(pt.store){await pt.initFromExternal()}try{await ct()}finally{if(ut.autoCommit){await pt.commit()}}}}static getName(){return"session"}};ct.SessionMiddleware=bt;pt([(0,ft.Config)("session"),dt("design:type",Object)],bt.prototype,"sessionConfig",void 0);pt([(0,ft.Logger)(),dt("design:type",Object)],bt.prototype,"logger",void 0);pt([(0,ft.Inject)(),dt("design:type",_t.SessionStoreManager)],bt.prototype,"sessionStoreManager",void 0);ct.SessionMiddleware=bt=pt([(0,ft.Middleware)()],bt)},21991:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.SocketIOConfiguration=void 0;const dt=ut(31049);let ft=class SocketIOConfiguration{};ct.SocketIOConfiguration=ft;ct.SocketIOConfiguration=ft=pt([(0,dt.Configuration)({namespace:"socketIO"})],ft)},37769:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};Object.defineProperty(ct,"__esModule",{value:true});ct.MidwaySocketIOFramework=void 0;const dt=ut(31049);const ft=ut(39023);const _t=(0,ft.debuglog)("midway:socket.io");const mt=ut(46966);const ht=ut(31049);const yt=ut(28700);let vt=class MidwaySocketIOFramework extends dt.BaseFramework{namespaceList=[];connectionMiddlewareManager=this.createMiddlewareManager();socketServerPort;configure(){return this.configService.getConfiguration("socketIO")}async applicationInitialize(){this.app=new mt.Server(this.configurationOptions);this.defineApplicationProperties({useConnectionMiddleware:Z=>this.useConnectionMiddleware(Z),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(typeof this.configurationOptions.port==="number"){let Z=this.configurationOptions.port;if(Z===0){Z=await(0,yt.getFreePort)();this.logger.info(`[midway:socketio] server has auto-assigned port ${Z}`)}this.app.listen(Z,this.configurationOptions);this.socketServerPort=Z;this.logger.info(`[midway:socketio] Socket.io server port = ${Z} start success`)}else if(this.applicationContext.hasObject(dt.HTTP_SERVER_KEY)){this.app.attach(this.applicationContext.get(dt.HTTP_SERVER_KEY),this.configurationOptions);this.logger.info("[midway:socketio] Socket.io server start success and attach to web server")}}getSocketServerPort(){return this.socketServerPort}async beforeStop(){return new Promise((Z=>{this.app.close((()=>{setTimeout((()=>{Z()}),1e3)}))}))}async loadMidwayController(){const Z=dt.DecoratorManager.listModule(ht.WS_CONTROLLER_KEY);for(const ct of Z){await this.addNamespace(ct)}}async addNamespace(Z){const ct=this.applicationContext.get(dt.MidwayTraceService);const ut=this.configurationOptions?.tracing?.meta;const pt=this.configurationOptions?.tracing?.enable!==false;const ft=this.configurationOptions?.tracing?.extractor;const mt=dt.MetadataManager.getOwnMetadata(ht.WS_CONTROLLER_KEY,Z);const yt=this.app.of(mt.namespace);this.namespaceList.push(mt.namespace);const vt=mt.routerOptions.middleware??[];const St=mt.routerOptions.connectionMiddleware??[];yt.use(((Z,dt)=>{const _t=Z?.handshake?.headers??{};const ht=typeof ft==="function"?ft({ctx:Z,carrier:_t,request:Z?.handshake,custom:{namespace:mt.namespace||"/",eventName:"connect"}}):_t;ct.runWithEntrySpan(`socketio.connect ${mt.namespace||"/"}`,{enable:pt,carrier:ht??_t,attributes:{"midway.protocol":"socketio","midway.socketio.namespace":mt.namespace||"/"},meta:ut,metaArgs:{ctx:Z,carrier:ht??_t,custom:{namespace:mt.namespace||"/",eventName:"connect"}}},(async()=>{this.app.createAnonymousContext(Z);Z.requestContext.registerObject("socket",Z);Z.app=this.app;dt()})).catch((Z=>dt(Z)))}));yt.on("connect",(mt=>{let yt=this.middlewareService.compose([...this.connectionMiddlewareManager,...St],this.app).then((Z=>Z(mt)));const bt=dt.MetadataManager.getMetadata(ht.WS_EVENT_KEY,Z);const xt={};const $t=bt.filter((Z=>Z.eventType===ht.WSEventTypeEnum.ON_CONNECTION));if($t.length){yt=yt.then((()=>Promise.all($t.map((async dt=>{xt[dt.propertyName]=xt[dt.propertyName]||{responseEvents:[]};const _t=await mt.requestContext.getAsync(Z);try{const Z=mt?.handshake?.headers??{};const ht=typeof ft==="function"?ft({ctx:mt,carrier:Z,custom:{eventName:dt.propertyName}}):Z;const yt=await ct.runWithEntrySpan(`socketio.event ${dt.propertyName}`,{enable:pt,carrier:ht??Z,attributes:{"midway.protocol":"socketio","midway.socketio.event":dt.propertyName},meta:ut,metaArgs:{ctx:mt,carrier:ht??Z,custom:{eventName:dt.propertyName}}},(async()=>{const Z=await this.middlewareService.compose([...dt?.eventOptions?.middleware||[],async(Z,ct)=>_t[dt.propertyName].apply(_t,[mt])],this.app);return await Z(mt)}));await this.bindSocketResponse(yt,mt,dt.propertyName,xt)}catch(Z){this.logger.error(Z)}})))))}const Et=bt.filter((Z=>Z.eventType!==ht.WSEventTypeEnum.ON_CONNECTION));if(Et.length){for(const St of Et){xt[St.propertyName]=xt[St.propertyName]||{responseEvents:[]};if(St.eventType===ht.WSEventTypeEnum.ON_MESSAGE){mt.on(St.messageEventName,(async(...ht)=>{await yt;const bt=await mt.requestContext.getAsync(Z);_t("got message",St.messageEventName,ht);try{const _t=mt?.handshake?.headers??{};const yt=typeof ft==="function"?ft({ctx:mt,carrier:_t,custom:{eventName:St.messageEventName}}):_t;const $t=await ct.runWithEntrySpan(`socketio.message ${St.messageEventName}`,{enable:pt,carrier:yt??_t,attributes:{"midway.protocol":"socketio","midway.socketio.event":St.messageEventName},meta:ut,metaArgs:{ctx:mt,carrier:yt??_t,custom:{eventName:St.messageEventName}}},(async()=>await(await this.applyMiddleware((async(ct,ut)=>{const pt=await this.middlewareService.compose([...vt,...St?.eventOptions?.middleware||[],async(ct,ut)=>{const pt=await this.app.getFramework().runGuard(ct,Z,St.propertyName);if(!pt){throw new dt.MidwayInvokeForbiddenError(St.propertyName,Z)}return bt[St.propertyName].apply(bt,ht)}],this.app);return await pt(ct,ut)})))(mt)));if(typeof ht[ht.length-1]==="function"){ht[ht.length-1]($t)}else{await this.bindSocketResponse($t,mt,St.propertyName,xt)}}catch(Z){this.logger.error(Z)}}))}else if(St.eventType===ht.WSEventTypeEnum.ON_DISCONNECTION){mt.on("disconnect",(async dt=>{const _t=await mt.requestContext.getAsync(Z);try{const Z=mt?.handshake?.headers??{};const ht=typeof ft==="function"?ft({ctx:mt,carrier:Z,custom:{eventName:"disconnect"}}):Z;const yt=await ct.runWithEntrySpan(`socketio.disconnect ${St.propertyName}`,{enable:pt,carrier:ht??Z,attributes:{"midway.protocol":"socketio","midway.socketio.event":"disconnect"},meta:ut,metaArgs:{ctx:mt,carrier:ht??Z,custom:{eventName:"disconnect"}}},(async()=>await _t[St.propertyName].apply(_t,[dt])));await this.bindSocketResponse(yt,mt,St.propertyName,xt)}catch(Z){this.logger.error(Z)}}))}else{xt[St.propertyName].responseEvents.push(St)}}}}));if(yt.adapter&&yt.adapter.on){yt.adapter.on("error",(Z=>{this.logger.error(Z)}))}yt.on("error",(Z=>{this.logger.error(Z)}))}async bindSocketResponse(Z,ct,ut,pt){const ft=this.applicationContext.get(dt.MidwayTraceService);const _t=this.configurationOptions?.tracing?.meta;const mt=this.configurationOptions?.tracing?.enable!==false;const yt=this.configurationOptions?.tracing?.injector;if(Z&&pt[ut]){for(const dt of pt[ut].responseEvents){if(dt.eventType===ht.WSEventTypeEnum.EMIT){if(dt.roomName.length){ct=dt.roomName.reduce(((Z,ct)=>Z.to(ct)),ct)}const ut=typeof yt==="function"?yt({ctx:ct,request:Z,custom:{eventName:dt.messageEventName}})||{}:{};await ft.runWithExitSpan(`socketio.emit ${dt.messageEventName}`,{enable:mt,carrier:ut,attributes:{"midway.protocol":"socketio","midway.socketio.event":dt.messageEventName},meta:_t,metaArgs:{ctx:ct,carrier:ut,custom:{eventName:dt.messageEventName}}},(async()=>{ct.emit.apply(ct,[dt.messageEventName].concat(Z))}))}else if(dt.eventType===ht.WSEventTypeEnum.BROADCAST){const pt=typeof yt==="function"?yt({ctx:ct,request:Z,custom:{eventName:ut}})||{}:{};await ft.runWithExitSpan(`socketio.broadcast ${ut}`,{enable:mt,carrier:pt,attributes:{"midway.protocol":"socketio","midway.socketio.event":ut},meta:_t,metaArgs:{ctx:ct,carrier:pt,custom:{eventName:ut}}},(async()=>{ct.nsp.emit.apply(ct.nsp,[].concat(Z))}))}}}}getFrameworkName(){return"socketIO"}useConnectionMiddleware(Z){this.connectionMiddlewareManager.insertLast(Z)}getConnectionMiddleware(){return this.connectionMiddlewareManager}};ct.MidwaySocketIOFramework=vt;ct.MidwaySocketIOFramework=vt=pt([(0,ht.Framework)()],vt)},59537:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.Configuration=ct.Framework=void 0;var ft=ut(37769);Object.defineProperty(ct,"Framework",{enumerable:true,get:function(){return ft.MidwaySocketIOFramework}});dt(ut(63522),ct);var _t=ut(21991);Object.defineProperty(ct,"Configuration",{enumerable:true,get:function(){return _t.SocketIOConfiguration}})},63522:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},28700:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.getFreePort=getFreePort;const pt=ut(69278);async function getFreePort(){return new Promise(((Z,ct)=>{const ut=(0,pt.createServer)();ut.listen(0,(()=>{try{const ct=ut.address().port;ut.close();Z(ct)}catch(Z){ct(Z)}}))}))}},6249:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});const pt=ut(16928);ct["default"]=Z=>({staticFile:{dirs:{default:{prefix:"/public",dir:(0,pt.join)(Z.appDir,"public")}},dynamic:true,preload:false,buffer:false,maxFiles:1e3}})},35421:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.StaticFileConfiguration=void 0;const ft=ut(31049);const _t=ut(14060);const mt=ut(6249);let ht=class StaticFileConfiguration{applicationManager;async onConfigLoad(){if(this.applicationManager.getApplication("faas")){return{staticFile:{buffer:true}}}}async onReady(Z){this.applicationManager.getApplications(["koa","faas","egg"]).forEach((ct=>{if(Z.hasNamespace("cross-domain")){ct.getMiddleware().insertAfter(_t.StaticMiddleware,"cors")}else{ct.getMiddleware().insertFirst(_t.StaticMiddleware)}}))}};ct.StaticFileConfiguration=ht;pt([(0,ft.Inject)(),dt("design:type",ft.MidwayApplicationManager)],ht.prototype,"applicationManager",void 0);ct.StaticFileConfiguration=ht=pt([(0,ft.Configuration)({namespace:"static-file",importConfigs:[{default:mt}]})],ht)},71753:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.DirectoryNotFoundError=ct.StaticFileErrorEnum=void 0;const pt=ut(31049);ct.StaticFileErrorEnum=(0,pt.registerErrorCode)("static_file",{DIRECTORY_NOT_EXISTS:1e4});class DirectoryNotFoundError extends pt.MidwayError{constructor(Z){super(`Path ${Z} not exist, please check it.`,ct.StaticFileErrorEnum.DIRECTORY_NOT_EXISTS)}}ct.DirectoryNotFoundError=DirectoryNotFoundError},25027:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.Configuration=void 0;var ft=ut(35421);Object.defineProperty(ct,"Configuration",{enumerable:true,get:function(){return ft.StaticFileConfiguration}});dt(ut(14060),ct);dt(ut(93176),ct);dt(ut(71753),ct)},93176:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},14060:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.StaticMiddleware=void 0;const ft=ut(31049);const _t=ut(42613);const mt=ut(4239);const ht=ut(91404);const yt=ut(93546);const vt=ut(71753);const St=ut(79896);let bt=class StaticMiddleware{staticFileConfig;middlewareService;environmentService;logger;async resolve(Z){const ct=Object.values(this.staticFileConfig.dirs);if(this.staticFileConfig.dir){ct.push(this.staticFileConfig.dir)}const ut=[];function rangeMiddleware(Z,ct){const pt=ut.some((ct=>Z.path.startsWith(ct)));if(pt){return yt(Z,ct)}return ct()}const pt=[rangeMiddleware];for(const Z of ct){_t.ok(ft.Types.isObject(Z)||ft.Types.isString(Z),"`config.static.dir` must be `string | Array<string|object>`.");const ct=Object.assign({},this.staticFileConfig,Z);if(ct.dynamic&&!ct.files){ct.files=new ht(ct.maxFiles)}if(ct.prefix){ut.push(ct.prefix)}if(this.environmentService.isPkgEnvironment()){if(!St.existsSync(ct.dir)){throw new vt.DirectoryNotFoundError(ct.dir)}}else{if(!await ft.FileUtils.exists(ct.dir)){throw new vt.DirectoryNotFoundError(ct.dir)}}this.logger.info("[midway:static] starting static serve %s -> %s",ct.prefix,ct.dir);pt.push(mt(ct))}return await this.middlewareService.compose(pt,Z,"staticFile")}static getName(){return"staticFile"}};ct.StaticMiddleware=bt;pt([(0,ft.Config)("staticFile"),dt("design:type",Object)],bt.prototype,"staticFileConfig",void 0);pt([(0,ft.Inject)(),dt("design:type",ft.MidwayMiddlewareService)],bt.prototype,"middlewareService",void 0);pt([(0,ft.Inject)(),dt("design:type",ft.MidwayEnvironmentService)],bt.prototype,"environmentService",void 0);pt([(0,ft.Logger)("coreLogger"),dt("design:type",Object)],bt.prototype,"logger",void 0);ct.StaticMiddleware=bt=pt([(0,ft.Middleware)()],bt)},71317:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.isEnumMetadata=ct.isEnumDefined=ct.isEnumArray=void 0;ct.getEnumValues=getEnumValues;ct.getEnumType=getEnumType;ct.addEnumArraySchema=addEnumArraySchema;ct.addEnumSchema=addEnumSchema;function getEnumValues(Z){if(Array.isArray(Z)){return Z}if(typeof Z!=="object"){return[]}const ct=Object.keys(Z).filter((Z=>isNaN(Number(Z)))).map((ct=>Z[ct]));return Array.from(new Set(ct))}function getEnumType(Z){const ct=Z.filter((Z=>typeof Z==="string")).length>0;return ct?"string":"number"}function addEnumArraySchema(Z,ct){const ut=Z.schema||{};Z.schema=ut;ut.type="array";delete Z.isArray;const pt=getEnumValues(ct.enum);ut.items={type:getEnumType(pt),enum:pt};if(ct.enumName){Z.enumName=ct.enumName}}function addEnumSchema(Z,ct){const ut=Z.schema||{};const pt=getEnumValues(ct.enum);Z.schema=ut;ut.enum=pt;ut.type=getEnumType(pt);if(ct.enumName){Z.enumName=ct.enumName}}const isEnumArray=Z=>Z.isArray&&Z.enum;ct.isEnumArray=isEnumArray;const isEnumDefined=Z=>Z.enum;ct.isEnumDefined=isEnumDefined;const isEnumMetadata=Z=>Z.enum||Z.isArray&&Z.items?.["enum"];ct.isEnumMetadata=isEnumMetadata},45949:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.HttpStatus=void 0;var ut;(function(Z){Z[Z["CONTINUE"]=100]="CONTINUE";Z[Z["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";Z[Z["PROCESSING"]=102]="PROCESSING";Z[Z["EARLYHINTS"]=103]="EARLYHINTS";Z[Z["OK"]=200]="OK";Z[Z["CREATED"]=201]="CREATED";Z[Z["ACCEPTED"]=202]="ACCEPTED";Z[Z["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";Z[Z["NO_CONTENT"]=204]="NO_CONTENT";Z[Z["RESET_CONTENT"]=205]="RESET_CONTENT";Z[Z["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";Z[Z["AMBIGUOUS"]=300]="AMBIGUOUS";Z[Z["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";Z[Z["FOUND"]=302]="FOUND";Z[Z["SEE_OTHER"]=303]="SEE_OTHER";Z[Z["NOT_MODIFIED"]=304]="NOT_MODIFIED";Z[Z["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";Z[Z["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";Z[Z["BAD_REQUEST"]=400]="BAD_REQUEST";Z[Z["UNAUTHORIZED"]=401]="UNAUTHORIZED";Z[Z["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";Z[Z["FORBIDDEN"]=403]="FORBIDDEN";Z[Z["NOT_FOUND"]=404]="NOT_FOUND";Z[Z["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";Z[Z["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";Z[Z["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";Z[Z["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";Z[Z["CONFLICT"]=409]="CONFLICT";Z[Z["GONE"]=410]="GONE";Z[Z["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";Z[Z["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";Z[Z["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";Z[Z["URI_TOO_LONG"]=414]="URI_TOO_LONG";Z[Z["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";Z[Z["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";Z[Z["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";Z[Z["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";Z[Z["MISDIRECTED"]=421]="MISDIRECTED";Z[Z["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";Z[Z["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";Z[Z["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";Z[Z["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";Z[Z["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";Z[Z["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";Z[Z["BAD_GATEWAY"]=502]="BAD_GATEWAY";Z[Z["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";Z[Z["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";Z[Z["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(ut||(ct.HttpStatus=ut={}))},3459:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.swagger=void 0;const pt=ut(31582);const dt=ut(31049);const ft=(0,dt.safeRequire)("swagger-ui-dist");ct.swagger={title:"My Project",description:"This is a swagger-ui for midwayjs project",version:"1.0.0",swaggerPath:"/swagger-ui",swaggerUIRender:ft&&ft.getAbsoluteFSPath?pt.renderSwaggerUIDist:pt.renderSwaggerUIRemote,swaggerUIRenderOptions:{},isGenerateTagForController:true,useValidationSchema:true}},97435:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.SwaggerConfiguration=void 0;const ft=ut(31049);const _t=ut(90381);const mt=ut(3459);let ht=class SwaggerConfiguration{applicationManager;configService;async onReady(Z){const ct=this.applicationManager.getApplications(["express","koa","egg","faas"]);if(ct.length){const ut=await Z.getAsync(_t.SwaggerExplorer);ut.scanApp();let pt=this.configService.getConfiguration("globalPrefix")||this.configService.getConfiguration("koa.globalPrefix")||this.configService.getConfiguration("express.globalPrefix")||this.configService.getConfiguration("egg.globalPrefix");if(pt){if(!/^\//.test(pt)){pt="/"+pt}ut.addGlobalPrefix(pt)}ct.forEach((Z=>{Z.useMiddleware(_t.SwaggerMiddleware)}))}}};ct.SwaggerConfiguration=ht;pt([(0,ft.Inject)(),dt("design:type",ft.MidwayApplicationManager)],ht.prototype,"applicationManager",void 0);pt([(0,ft.Inject)(),dt("design:type",ft.MidwayConfigService)],ht.prototype,"configService",void 0);ct.SwaggerConfiguration=ht=pt([(0,ft.Configuration)({importConfigs:[{default:mt}],namespace:"swagger"})],ht)},37860:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.DECORATORS=ct.DECORATORS_METHOD_METADATA=ct.DECORATORS_CLASS_METADATA=ct.DECORATORS_PREFIX=void 0;ct.DECORATORS_PREFIX="swagger";ct.DECORATORS_CLASS_METADATA="swagger:class_metadata";ct.DECORATORS_METHOD_METADATA="swagger:method_metadata";ct.DECORATORS={API_OPERATION:`${ct.DECORATORS_PREFIX}/apiOperation`,API_RESPONSE:`${ct.DECORATORS_PREFIX}/apiResponse`,API_TAGS:`${ct.DECORATORS_PREFIX}/apiUseTags`,API_PARAMETERS:`${ct.DECORATORS_PREFIX}/apiParameters`,API_HEADERS:`${ct.DECORATORS_PREFIX}/apiHeaders`,API_MODEL_PROPERTIES:`${ct.DECORATORS_PREFIX}/apiModelProperties`,API_EXTRA_MODEL:`${ct.DECORATORS_PREFIX}/apiExtraModel`,API_MODEL_PROPERTIES_ARRAY:`${ct.DECORATORS_PREFIX}/apiModelPropertiesArray`,API_SECURITY:`${ct.DECORATORS_PREFIX}/apiSecurity`,API_EXCLUDE_SECURITY:`${ct.DECORATORS_PREFIX}/apiExcludeSecurity`,API_EXCLUDE_ENDPOINT:`${ct.DECORATORS_PREFIX}/apiExcludeEndpoint`,API_EXCLUDE_CONTROLLER:`${ct.DECORATORS_PREFIX}/apiExcludeController`,API_EXTENSION:`${ct.DECORATORS_PREFIX}/apiExtension`}},70888:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiBasicAuth=ApiBasicAuth;const pt=ut(64036);function ApiBasicAuth(Z="basic"){return(0,pt.ApiSecurity)(Z)}},25439:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiBearerAuth=ApiBearerAuth;const pt=ut(64036);function ApiBearerAuth(Z="bearer"){return(0,pt.ApiSecurity)(Z)}},47218:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.BodyContentType=void 0;ct.ApiBody=ApiBody;const pt=ut(71317);const dt=ut(96069);var ft;(function(Z){Z["FormUrlEncoded"]="application/x-www-form-urlencoded";Z["JSON"]="application/json";Z["Multipart"]="multipart/form-data";Z["MultipartMixed"]="multipart/mixed";Z["OctetStream"]="application/octet-stream"})(ft||(ct.BodyContentType=ft={}));const _t={type:String,required:true};function ApiBody(Z){const[ct,ut]=(0,dt.getTypeIsArrayTuple)(Z.type,Z.isArray);const ft={in:"body",...Z,type:ct,isArray:ut};if((0,pt.isEnumArray)(Z)){(0,pt.addEnumArraySchema)(ft,Z)}else if((0,pt.isEnumDefined)(Z)){(0,pt.addEnumSchema)(ft,Z)}return(0,dt.createParamDecorator)(ft,_t)}},78736:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiCookieAuth=ApiCookieAuth;const pt=ut(64036);function ApiCookieAuth(Z="cookie"){return(0,pt.ApiSecurity)(Z)}},40927:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiExcludeController=ApiExcludeController;const pt=ut(31049);const dt=ut(37860);function ApiExcludeController(Z=true){return ct=>{pt.MetadataManager.defineMetadata(dt.DECORATORS.API_EXCLUDE_CONTROLLER,{disable:Z},ct)}}},83746:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiExcludeEndpoint=ApiExcludeEndpoint;const pt=ut(37860);const dt=ut(96069);function ApiExcludeEndpoint(Z=true){return(0,dt.createMixedDecorator)(pt.DECORATORS.API_EXCLUDE_ENDPOINT,true)}},76651:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiExtension=ApiExtension;const pt=ut(37860);const dt=ut(96069);function ApiExtension(Z,ct){if(!Z.startsWith("x-")){throw new Error("Extension key is not prefixed. Please ensure you prefix it with `x-`.")}const ut={[Z]:JSON.parse(JSON.stringify(ct))};return(0,dt.createMixedDecorator)(pt.DECORATORS.API_EXTENSION,ut)}},89212:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiExtraModel=ApiExtraModel;const pt=ut(37860);const dt=ut(96069);function ApiExtraModel(Z){return(0,dt.createMixedDecorator)(pt.DECORATORS.API_EXTRA_MODEL,Z)}},57267:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiHeaders=void 0;ct.ApiHeader=ApiHeader;const pt=ut(37860);const dt=ut(71317);const ft=ut(96069);const _t={name:""};function ApiHeader(Z){const ct={name:!Z.name?_t.name:Z.name,in:"header",description:Z.description,required:Z.required,schema:{...Z.schema||{},type:"string"}};if(Z.enum){const ut=(0,dt.getEnumValues)(Z.enum);ct.schema={enum:ut,type:(0,dt.getEnumType)(ut)}}return(Z,ut,dt)=>{if(dt){return(0,ft.createMixedDecorator)(pt.DECORATORS.API_HEADERS,ct)(Z,ut,dt)}return(0,ft.createMixedDecorator)(pt.DECORATORS.API_HEADERS,ct)(Z,undefined,undefined)}}const ApiHeaders=Z=>(ct,ut,pt)=>{Z.forEach((Z=>ApiHeader(Z)(ct,ut,pt)))};ct.ApiHeaders=ApiHeaders},34909:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiOAuth2=ApiOAuth2;const pt=ut(64036);function ApiOAuth2(Z,ct="oauth2"){return(0,pt.ApiSecurity)(ct,Z)}},58551:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiOperation=ApiOperation;const pt=ut(37860);const dt=ut(96069);const ft={summary:""};function ApiOperation(Z){return(0,dt.createMixedDecorator)(pt.DECORATORS.API_OPERATION,{...ft,...Z})}},97931:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiParam=ApiParam;const pt=ut(96069);const dt=ut(71317);const ft={name:"",required:true};function ApiParam(Z){const ct={name:!Z.name?ft.name:Z.name,in:"path",...Z};const ut=Z;if(ut.enum){ct.schema=ct.schema||{};const Z=ct.schema;const pt=(0,dt.getEnumValues)(ut.enum);Z.type=(0,dt.getEnumType)(pt);Z.enum=pt;if(ut.enumName){ct.enumName=ut.enumName}}return(0,pt.createParamDecorator)(ct,ft)}},30327:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiProperty=ApiProperty;ct.createApiPropertyDecorator=createApiPropertyDecorator;ct.ApiPropertyOptional=ApiPropertyOptional;ct.ApiResponseProperty=ApiResponseProperty;const pt=ut(37860);const dt=ut(71317);const ft=ut(96069);const isEnumArray=Z=>Z.isArray&&!!Z.enum;function ApiProperty(Z={}){return createApiPropertyDecorator(Z)}function createApiPropertyDecorator(Z={}){const[ct,ut]=(0,ft.getTypeIsArrayTuple)(Z.type,Z.isArray);Z={...Z,type:ct};if(isEnumArray(Z)){Z.type="array";const ct=(0,dt.getEnumValues)(Z.enum);Z.items={type:(0,dt.getEnumType)(ct),enum:ct};delete Z.enum}else if(Z.enum){const ct=(0,dt.getEnumValues)(Z.enum);Z.enum=ct;Z.type=(0,dt.getEnumType)(ct)}if(ut){Z.type="array";Z.items={type:ct}}return(0,ft.createPropertyDecorator)(pt.DECORATORS.API_MODEL_PROPERTIES,Z)}function ApiPropertyOptional(Z={}){return ApiProperty({...Z,required:false})}function ApiResponseProperty(Z={}){return ApiProperty({readOnly:true,...Z})}},81642:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiQuery=ApiQuery;const pt=ut(71317);const dt=ut(96069);const ft={name:"",required:true};function ApiQuery(Z){const ct=Z;const[ut,_t]=(0,dt.getTypeIsArrayTuple)(ct.type,ct.isArray);const mt={name:!Z.name?ft.name:Z.name,in:"query",...Z,type:ut};if((0,pt.isEnumArray)(Z)){(0,pt.addEnumArraySchema)(mt,Z)}else if((0,pt.isEnumDefined)(Z)){(0,pt.addEnumSchema)(mt,Z)}if(_t){mt.isArray=_t}return(0,dt.createParamDecorator)(mt,ft)}},54225:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiDefaultResponse=ct.ApiUnsupportedMediaTypeResponse=ct.ApiUnprocessableEntityResponse=ct.ApiServiceUnavailableResponse=ct.ApiRequestTimeoutResponse=ct.ApiPayloadTooLargeResponse=ct.ApiPreconditionFailedResponse=ct.ApiNotImplementedResponse=ct.ApiNotAcceptableResponse=ct.ApiMethodNotAllowedResponse=ct.ApiGoneResponse=ct.ApiGatewayTimeoutResponse=ct.ApiForbiddenResponse=ct.ApiConflictResponse=ct.ApiBadGatewayResponse=ct.ApiInternalServerErrorResponse=ct.ApiNotFoundResponse=ct.ApiTooManyRequestsResponse=ct.ApiUnauthorizedResponse=ct.ApiBadRequestResponse=ct.ApiFoundResponse=ct.ApiMovedPermanentlyResponse=ct.ApiNoContentResponse=ct.ApiAcceptedResponse=ct.ApiCreatedResponse=ct.ApiOkResponse=void 0;ct.ApiResponse=ApiResponse;const pt=ut(37860);const dt=ut(96069);const ft=ut(45949);function ApiResponse(Z){const[ct,ut]=(0,dt.getTypeIsArrayTuple)(Z.type,Z.isArray);Z.type=ct;Z.isArray=ut;Z.description=Z.description?Z.description:"";const ft={[Z.status||"default"]:Z};return(0,dt.createMixedDecorator)(pt.DECORATORS.API_RESPONSE,ft)}const ApiOkResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.OK});ct.ApiOkResponse=ApiOkResponse;const ApiCreatedResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.CREATED});ct.ApiCreatedResponse=ApiCreatedResponse;const ApiAcceptedResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.ACCEPTED});ct.ApiAcceptedResponse=ApiAcceptedResponse;const ApiNoContentResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.NO_CONTENT});ct.ApiNoContentResponse=ApiNoContentResponse;const ApiMovedPermanentlyResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.MOVED_PERMANENTLY});ct.ApiMovedPermanentlyResponse=ApiMovedPermanentlyResponse;const ApiFoundResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.FOUND});ct.ApiFoundResponse=ApiFoundResponse;const ApiBadRequestResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.BAD_REQUEST});ct.ApiBadRequestResponse=ApiBadRequestResponse;const ApiUnauthorizedResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.UNAUTHORIZED});ct.ApiUnauthorizedResponse=ApiUnauthorizedResponse;const ApiTooManyRequestsResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.TOO_MANY_REQUESTS});ct.ApiTooManyRequestsResponse=ApiTooManyRequestsResponse;const ApiNotFoundResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.NOT_FOUND});ct.ApiNotFoundResponse=ApiNotFoundResponse;const ApiInternalServerErrorResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.INTERNAL_SERVER_ERROR});ct.ApiInternalServerErrorResponse=ApiInternalServerErrorResponse;const ApiBadGatewayResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.BAD_GATEWAY});ct.ApiBadGatewayResponse=ApiBadGatewayResponse;const ApiConflictResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.CONFLICT});ct.ApiConflictResponse=ApiConflictResponse;const ApiForbiddenResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.FORBIDDEN});ct.ApiForbiddenResponse=ApiForbiddenResponse;const ApiGatewayTimeoutResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.GATEWAY_TIMEOUT});ct.ApiGatewayTimeoutResponse=ApiGatewayTimeoutResponse;const ApiGoneResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.GONE});ct.ApiGoneResponse=ApiGoneResponse;const ApiMethodNotAllowedResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.METHOD_NOT_ALLOWED});ct.ApiMethodNotAllowedResponse=ApiMethodNotAllowedResponse;const ApiNotAcceptableResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.NOT_ACCEPTABLE});ct.ApiNotAcceptableResponse=ApiNotAcceptableResponse;const ApiNotImplementedResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.NOT_IMPLEMENTED});ct.ApiNotImplementedResponse=ApiNotImplementedResponse;const ApiPreconditionFailedResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.PRECONDITION_FAILED});ct.ApiPreconditionFailedResponse=ApiPreconditionFailedResponse;const ApiPayloadTooLargeResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.PAYLOAD_TOO_LARGE});ct.ApiPayloadTooLargeResponse=ApiPayloadTooLargeResponse;const ApiRequestTimeoutResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.REQUEST_TIMEOUT});ct.ApiRequestTimeoutResponse=ApiRequestTimeoutResponse;const ApiServiceUnavailableResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.SERVICE_UNAVAILABLE});ct.ApiServiceUnavailableResponse=ApiServiceUnavailableResponse;const ApiUnprocessableEntityResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.UNPROCESSABLE_ENTITY});ct.ApiUnprocessableEntityResponse=ApiUnprocessableEntityResponse;const ApiUnsupportedMediaTypeResponse=(Z={})=>ApiResponse({...Z,status:ft.HttpStatus.UNSUPPORTED_MEDIA_TYPE});ct.ApiUnsupportedMediaTypeResponse=ApiUnsupportedMediaTypeResponse;const ApiDefaultResponse=(Z={})=>ApiResponse({...Z,status:"default"});ct.ApiDefaultResponse=ApiDefaultResponse},64036:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiSecurity=ApiSecurity;ct.ApiExcludeSecurity=ApiExcludeSecurity;const pt=ut(37860);const dt=ut(96069);function ApiSecurity(Z,ct=[]){let ut;if(typeof Z==="string"){ut={[Z]:ct||[]}}else{ut=Z}return(0,dt.createMixedDecorator)(pt.DECORATORS.API_SECURITY,ut)}function ApiExcludeSecurity(){return(0,dt.createMixedDecorator)(pt.DECORATORS.API_EXCLUDE_SECURITY,true)}},45299:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ApiTags=ApiTags;const pt=ut(37860);const dt=ut(96069);function ApiTags(Z){return(0,dt.createMixedDecorator)(pt.DECORATORS.API_TAGS,Z)}},96069:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.createPropertyDecorator=createPropertyDecorator;ct.createMixedDecorator=createMixedDecorator;ct.createParamDecorator=createParamDecorator;ct.getTypeIsArrayTuple=getTypeIsArrayTuple;ct.getSchemaPath=getSchemaPath;const pt=ut(31049);const dt=ut(37860);function createPropertyDecorator(Z,ct){return pt.DecoratorManager.createCustomPropertyDecorator(Z,ct,false)}function createMixedDecorator(Z,ct){return(ut,ft)=>{if(ft){pt.MetadataManager.attachMetadata(dt.DECORATORS_METHOD_METADATA,{key:Z,propertyName:ft,metadata:ct},ut,ft)}else{pt.MetadataManager.attachMetadata(dt.DECORATORS_CLASS_METADATA,{key:Z,metadata:ct},ut)}}}function createParamDecorator(Z,ct){return createMixedDecorator(dt.DECORATORS.API_PARAMETERS,{...ct,...Z})}function getTypeIsArrayTuple(Z,ct){if(!Z){return[Z,ct]}if(ct){return[Z,ct]}const ut=Array.isArray(Z);const pt=ut?Z[0]:Z;return[pt,ut]}function getSchemaPath(Z){let ct=Z;if(typeof Z!=="string"){ct=Z?Z.name:Z}return`#/components/schemas/${ct}`}},42168:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.getSchemaPath=ct.ApiResponseProperty=ct.ApiPropertyOptional=ct.ApiProperty=void 0;dt(ut(47218),ct);dt(ut(83746),ct);dt(ut(40927),ct);dt(ut(57267),ct);dt(ut(58551),ct);dt(ut(97931),ct);var ft=ut(30327);Object.defineProperty(ct,"ApiProperty",{enumerable:true,get:function(){return ft.ApiProperty}});Object.defineProperty(ct,"ApiPropertyOptional",{enumerable:true,get:function(){return ft.ApiPropertyOptional}});Object.defineProperty(ct,"ApiResponseProperty",{enumerable:true,get:function(){return ft.ApiResponseProperty}});dt(ut(81642),ct);dt(ut(54225),ct);dt(ut(45299),ct);dt(ut(76651),ct);dt(ut(70888),ct);dt(ut(25439),ct);dt(ut(78736),ct);dt(ut(34909),ct);dt(ut(64036),ct);dt(ut(89212),ct);var _t=ut(96069);Object.defineProperty(ct,"getSchemaPath",{enumerable:true,get:function(){return _t.getSchemaPath}})},36573:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.DocumentBuilder=void 0;class DocumentBuilder{document={openapi:"3.0.1",info:{title:"",description:"",version:"1.0.0",contact:{}},tags:[],servers:[],components:{},paths:{}};setTitle(Z){this.document.info.title=Z;return this}setDescription(Z){this.document.info.description=Z;return this}setVersion(Z){this.document.info.version=Z;return this}setTermsOfService(Z){this.document.info.termsOfService=Z;return this}setContact(Z,ct,ut){this.document.info.contact={name:Z,url:ct,email:ut};return this}setLicense(Z,ct){this.document.info.license={name:Z,url:ct};return this}addServer(Z,ct,ut){this.document.servers.push({url:Z,description:ct,variables:ut});return this}setExternalDoc(Z,ct){this.document.externalDocs={description:Z,url:ct};return this}addPaths(Z){Object.assign(this.document.paths,Z);return this}getPaths(){return this.document.paths}setPaths(Z){this.document.paths=Z;return this}addSchema(Z){if(!this.document.components.schemas){this.document.components.schemas={}}Object.assign(this.document.components.schemas,Z);return this}getSchema(Z){if(this.document.components?.schemas){return this.document.components?.schemas[Z]}return undefined}addTag(Z,ct="",ut){const pt=this.document.tags||[];if(Array.isArray(Z)){const ct=Z;for(const ut of ct){if(!pt.find((ct=>ct.name===Z))){pt.push({name:ut,description:""})}}return this}if(!pt.find((ct=>ct.name===Z))){pt.push({name:Z,description:ct,externalDocs:ut})}else{pt.forEach((pt=>{if(pt.name===Z){if(ct){pt.description=ct}if(ut){pt.externalDocs=ut}}}))}this.document.tags=pt;return this}addSecurity(Z,ct){this.document.components.securitySchemes={...this.document.components.securitySchemes||{},[Z]:ct};return this}addSecurityRequirements(Z,ct=[]){let ut;if(typeof Z==="string"){ut={[Z]:ct}}else{ut=Z}this.document.security=(this.document.security||[]).concat({...ut});return this}addBearerAuth(Z={type:"http"},ct="bearer"){this.addSecurity(ct,{type:"http",scheme:"bearer",bearerFormat:"JWT",...Z});return this}addOAuth2(Z={type:"oauth2"},ct="oauth2"){if(!ct){ct="oauth2"}this.addSecurity(ct,{type:"oauth2",flows:{...Z?.flows}});return this}addApiKey(Z={type:"apiKey"},ct="api_key"){if(!ct){ct="api_key"}this.addSecurity(ct,{type:"apiKey",in:"header",name:ct,...Z});return this}addBasicAuth(Z={type:"http"},ct="basic"){if(!ct){ct="basic"}this.addSecurity(ct,{type:"http",scheme:"basic",...Z});return this}addCookieAuth(Z="connect.sid",ct={type:"apiKey"},ut="cookie"){if(!Z){Z="connect.sid"}if(!ut){ut="cookie"}this.addSecurity(ut,{type:"apiKey",in:"cookie",name:Z,...ct});return this}sortTags(){const Z=this.document.tags;this.document.tags=Z.sort(((Z,ct)=>{const ut=Z.name;const pt=ct.name;const dt=ut.length>pt.length?pt.length:ut.length;for(let Z=0;Z<dt;Z++){if(ut.charCodeAt(Z)>pt.charCodeAt(Z)){return 1}else if(ut.charCodeAt(Z)<pt.charCodeAt(Z)){return-1}}return 0}))}build(){return this.document}}ct.DocumentBuilder=DocumentBuilder},90381:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.renderJSON=ct.renderSwaggerUIDist=ct.renderSwaggerUIRemote=ct.SwaggerMiddleware=ct.SwaggerExplorer=ct.Configuration=void 0;dt(ut(42168),ct);dt(ut(93566),ct);var ft=ut(97435);Object.defineProperty(ct,"Configuration",{enumerable:true,get:function(){return ft.SwaggerConfiguration}});var _t=ut(90198);Object.defineProperty(ct,"SwaggerExplorer",{enumerable:true,get:function(){return _t.SwaggerExplorer}});var mt=ut(69557);Object.defineProperty(ct,"SwaggerMiddleware",{enumerable:true,get:function(){return mt.SwaggerMiddleware}});var ht=ut(31582);Object.defineProperty(ct,"renderSwaggerUIRemote",{enumerable:true,get:function(){return ht.renderSwaggerUIRemote}});Object.defineProperty(ct,"renderSwaggerUIDist",{enumerable:true,get:function(){return ht.renderSwaggerUIDist}});Object.defineProperty(ct,"renderJSON",{enumerable:true,get:function(){return ht.renderJSON}});dt(ut(37860),ct)},93566:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true})},90198:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.SwaggerExplorer=void 0;const ft=ut(31049);const _t=ut(37860);const mt=ut(36573);const ht=ut(90381);const yt=ut(71317);const vt="validation:rules";const St="common:rules";let bt=class SwaggerExplorer{swaggerConfig={};documentBuilder=new mt.DocumentBuilder;operationIdFactory=(Z,ct)=>`${Z.toLowerCase()}_${ct.method.toLocaleLowerCase()}`;async init(){this.documentBuilder.setTitle(this.swaggerConfig.title);this.documentBuilder.setVersion(this.swaggerConfig.version);this.documentBuilder.setDescription(this.swaggerConfig.description);if(this.swaggerConfig?.contact&&typeof this.swaggerConfig?.contact==="object"){this.documentBuilder.setContact(this.swaggerConfig?.contact?.name,this.swaggerConfig?.contact?.url,this.swaggerConfig?.contact?.email)}if(this.swaggerConfig?.license&&typeof this.swaggerConfig?.license==="object"){this.documentBuilder.setLicense(this.swaggerConfig?.license?.name,this.swaggerConfig?.license?.url)}if(this.swaggerConfig.termsOfService){this.documentBuilder.setTermsOfService(this.swaggerConfig.termsOfService)}if(this.swaggerConfig?.externalDocs&&typeof this.swaggerConfig?.externalDocs==="object"){this.documentBuilder.setExternalDoc(this.swaggerConfig?.externalDocs?.description,this.swaggerConfig?.externalDocs?.url)}const Z=this.swaggerConfig?.servers;if(Array.isArray(Z)){for(const ct of Z){this.documentBuilder.addServer(ct?.url,ct?.description,ct?.variables)}}const ct=this.swaggerConfig?.tags;if(Array.isArray(ct)){for(const Z of ct){this.documentBuilder.addTag(Z.name,Z.description,Z.externalDocs)}}if(this.swaggerConfig?.documentOptions?.operationIdFactory){this.operationIdFactory=this.swaggerConfig.documentOptions.operationIdFactory}const ut=this.swaggerConfig?.auth;if(Array.isArray(ut)){for(const Z of ut){this.setAuth(Z)}}else if(ut){this.setAuth(ut)}}addGlobalPrefix(Z){if(!Z){return}const ct=this.documentBuilder.getPaths();const ut={};for(const[pt,dt]of Object.entries(ct)){if(!/^\//.test(pt)){ut[`${Z}/${pt}`]=dt}else{ut[`${Z}${pt}`]=dt}}this.documentBuilder.setPaths(ut)}scanApp(){const Z=ft.DecoratorManager.listModule(ft.CONTROLLER_KEY);for(const ct of Z){this.generatePath(ct)}if(this.swaggerConfig?.tagSortable){this.documentBuilder.sortTags()}}getData(){return this.documentBuilder.build()}getDocumentBuilder(){return this.documentBuilder}generatePath(Z){const ct=ft.MetadataManager.getOwnMetadata(_t.DECORATORS.API_EXCLUDE_CONTROLLER,Z);if(ct&&ct.disable){return}const ut=this.swaggerConfig.isGenerateTagForController??true;this.parseExtraModel(Z);const pt=ft.MetadataManager.getOwnMetadata(_t.DECORATORS_CLASS_METADATA,Z)||[];const dt=ft.MetadataManager.getPropertiesWithMetadata(ft.CUSTOM_PARAM_INJECT_KEY,Z)||{};const mt=ft.MetadataManager.getOwnMetadata(ft.CONTROLLER_KEY,Z);const ht=mt.prefix;const yt=pt.filter((Z=>Z.key===_t.DECORATORS.API_TAGS));let vt=[];const St=[];if(yt.length>0){vt=parseTags(yt);vt.forEach((Z=>{addTag(Z,St)}))}else{if(ut){const Z={name:"",description:""};if(ht!=="/"){Z.name=mt?.routerOptions.tagName||(/^\//.test(ht)?ht.split("/")[1]:ht);Z.description=mt?.routerOptions.description||Z.name}else{Z.name=mt?.routerOptions.tagName;Z.description=mt?.routerOptions.description||Z.name}if(Z.name){vt.push(Z.name);addTag([Z.name,Z.description],St)}}else{}}const bt=ft.MetadataManager.getMetadata(ft.WEB_ROUTER_KEY,Z);let xt=pt.filter((Z=>Z.key===_t.DECORATORS.API_HEADERS));if(xt.length>0){xt=xt.map((Z=>Z.metadata))}const $t=pt.filter((Z=>Z.key===_t.DECORATORS.API_SECURITY));const Et={};if(bt&&typeof bt[Symbol.iterator]==="function"){for(const ct of bt){let ut=(ht+ct.path).replace("//","/");ut=replaceUrl(ut,parseParamsInPath(ut));const mt=ft.MetadataManager.getMetadata(_t.DECORATORS_METHOD_METADATA,Z,ct.method)||[];const yt=mt.filter((Z=>Z.key===_t.DECORATORS.API_SECURITY));const bt=mt.filter((Z=>Z.key===_t.DECORATORS.API_EXCLUDE_ENDPOINT&&Z.propertyName===ct.method));if(bt[0]){continue}if(this.swaggerConfig.routerFilter){const Z=this.swaggerConfig.routerFilter(ut,ct);if(Z){continue}}const Ct=dt[ct.method]||[];const Tt=Ct.filter((Z=>Z.key===ft.WEB_ROUTER_PARAM_KEY&&Z?.metadata?.type===ft.RouteParamTypes.BODY));if(Tt.length>1){continue}this.generateRouteMethod(ut,ct,Et,mt,Ct,xt,Z);if(Et[ut][ct.requestMethod].tags.length===0){Et[ut][ct.requestMethod].tags=vt}else{Et[ut][ct.requestMethod].tags.forEach((Z=>{addTag(Z,St)}))}const wt=mt.filter((Z=>Z.key===_t.DECORATORS.API_EXTENSION&&Z.propertyName===ct.method));for(const Z of wt){if(Z.metadata){Object.assign(Et[ut][ct.requestMethod],Z.metadata)}}const At=mt.find((Z=>Z.key===_t.DECORATORS.API_EXCLUDE_SECURITY));const kt=yt.length>0;const It=pt.find((Z=>Z.key===_t.DECORATORS.API_EXCLUDE_SECURITY));const Nt=$t.length>0;if(At){Et[ut][ct.requestMethod].security=[]}else if(kt){Et[ut][ct.requestMethod].security=yt.map((Z=>Z.metadata)).filter(Boolean)}else if(It){Et[ut][ct.requestMethod].security=[]}else if(Nt){Et[ut][ct.requestMethod].security=$t.map((Z=>Z.metadata)).filter(Boolean)}}}this.documentBuilder.addPaths(Et);if(Object.keys(Et).length>0){St.forEach((Z=>{if(Array.isArray(Z)){this.documentBuilder.addTag(Z[0],Z[1])}else{this.documentBuilder.addTag(Z)}}))}}generateRouteMethod(Z,ct,ut,pt,dt,mt,yt){const vt=pt.filter((Z=>Z.key===_t.DECORATORS.API_OPERATION&&Z.propertyName===ct.method))[0];const St=pt.filter((Z=>Z.key===_t.DECORATORS.API_TAGS&&Z.propertyName===ct.method));const bt=parseTags(St);let xt=ut[Z];if(!xt){xt={}}const $t=this.normalizeOperationParameters(vt?.metadata?.parameters);const Et=this.normalizeOperationRequestBody(vt?.metadata?.requestBody);const Ct=this.normalizeOperationResponses(vt?.metadata?.responses);const Tt=[...$t];let wt=!!Et;xt[ct.requestMethod]={summary:getNotEmptyValue(vt?.metadata?.summary,ct.summary),description:getNotEmptyValue(vt?.metadata?.description,ct.description),operationId:vt?.metadata?.operationId||this.getOperationId(yt.name,ct),tags:bt.length?bt:vt?.metadata?.tags??[],...Et?{requestBody:Et}:{},...Ct?{responses:Ct}:{}};if(vt?.metadata?.deprecated!=null){xt[ct.requestMethod].deprecated=!!vt?.metadata?.deprecated}const At=dt.filter((Z=>Z.key===ft.WEB_ROUTER_PARAM_KEY&&Z?.metadata?.type!==ft.RouteParamTypes.CUSTOM));const kt=ft.MetadataManager.getMethodParamTypes(yt,ct.method);const It=pt.filter((Z=>Z.key===_t.DECORATORS.API_PARAMETERS&&Z.propertyName===ct.method));for(const Z of It){if(Z.metadata.schema===undefined){Z.metadata.schema={};if(Z.metadata.type){Z.metadata.schema["type"]=Z.metadata.type;delete Z.metadata.type}if(Z.metadata.isArray){Z.metadata.schema["items"]={type:Z.metadata.schema["type"]};Z.metadata.schema["type"]="array";delete Z.metadata.isArray}if(Z.metadata.enum!==undefined){Z.metadata.schema.enum=Z.metadata.enum;delete Z.metadata.enum}}else{delete Z.metadata.type;delete Z.metadata.isArray;delete Z.metadata.enum}const ut=Z.metadata;ut.schema=this.formatType(Z.metadata.schema);if(ut.in==="query"||ut.in==="path"||ut.in==="header"){this.upsertOperationParameter(Tt,ut)}else if(ut.in==="body"){ut.content=ut.content??{};if(Object.keys(ut.content).length===0){ut.content[ut.contentType||"application/json"]=ut.content[ut.contentType||"application/json"]??{schema:ut.schema}}for(const Z in ut.content){ut.content[Z].schema=this.formatType(ut.content[Z].schema)}xt[ct.requestMethod].requestBody=xt[ct.requestMethod].requestBody??{};if(wt){if(ut.description!==undefined){xt[ct.requestMethod].requestBody.description=ut.description}if(ut.content!==undefined){xt[ct.requestMethod].requestBody.content=ut.content}if(ut.required!==undefined){xt[ct.requestMethod].requestBody.required=ut.required}wt=false}else{xt[ct.requestMethod].requestBody.description=xt[ct.requestMethod].requestBody.description??ut.description;xt[ct.requestMethod].requestBody.content=xt[ct.requestMethod].requestBody.content??ut.content;xt[ct.requestMethod].requestBody.required=xt[ct.requestMethod].requestBody.required??ut.required}}}for(const ut of At){const pt=kt[ut.parameterIndex];const dt={name:ut?.metadata?.propertyData,in:convertTypeToString(ut.metadata?.type),required:false};const _t=Tt.find((Z=>Z.name===ut?.metadata?.propertyData&&Z.in===dt.in));if(_t){continue}if(dt.in==="path"){dt.required=true;if(Z.indexOf("{"+dt.name+"}")===-1){continue}}if(ft.Types.isClass(pt)){this.parseClzz(pt)}if(dt.in==="query"||dt.in==="path"){if(ft.Types.isClass(pt)){const Z=this.documentBuilder.getSchema(pt.name);Object.keys(Z.properties).forEach((ct=>{const ut={name:ct,in:dt.in,description:Z.properties[ct]?.description,schema:Z.properties[ct],required:Z.required?.includes(ct)||false};this.upsertOperationParameter(Tt,ut)}));continue}else{if(!dt.name){continue}dt.schema={type:convertSchemaType(pt?.name??pt)}}}else if(dt.in==="body"){if(ct.requestMethod===ft.RequestMethod.GET){continue}if(xt[ct.requestMethod].requestBody){continue}if(ut.metadata?.type===ft.RouteParamTypes.FILESSTREAM){dt.content={};dt.content[ht.BodyContentType.Multipart]={schema:{type:"object",properties:{files:{type:"array",items:{type:"string",format:"binary"},description:dt.description}}}}}else if(ut.metadata?.type===ft.RouteParamTypes.FILESTREAM){dt.content={};dt.content[ht.BodyContentType.Multipart]={schema:{type:"object",properties:{file:{type:"string",format:"binary",description:dt.description}}}}}else{if(ft.Types.isClass(pt)){dt.content={"application/json":{schema:{$ref:"#/components/schemas/"+pt.name}}}}else{dt.content={"text/plain":{schema:{type:convertSchemaType(pt?.name??pt)}}}}}xt[ct.requestMethod].requestBody={required:true,description:dt.description||dt.name,content:dt.content};continue}this.upsertOperationParameter(Tt,dt)}if(mt&&mt.length){mt.forEach((Z=>this.upsertOperationParameter(Tt,Z,true)))}const Nt=pt.filter((Z=>Z.key===_t.DECORATORS.API_HEADERS));if(Nt.length>0){Nt.forEach((Z=>this.upsertOperationParameter(Tt,Z.metadata,true)))}xt[ct.requestMethod].parameters=Tt;const Pt=pt.filter((Z=>Z.key===_t.DECORATORS.API_RESPONSE&&Z.propertyName===ct.method));const Ot=Ct??{};for(const Z of Pt){const ct=this.normalizeOperationResponses(Z.metadata);Object.assign(Ot,ct)}if(Object.keys(Ot).length>0){xt[ct.requestMethod].responses=Ot}else{xt[ct.requestMethod].responses={200:{description:"OK"}}}ut[Z]=xt}upsertOperationParameter(Z,ct,ut=false){const pt=Z.findIndex((Z=>Z?.name===ct?.name&&Z?.in===ct?.in));if(pt>=0){Z.splice(pt,1)}if(ut){Z.unshift(ct)}else{Z.push(ct)}}cloneOpenAPIValue(Z){if(Array.isArray(Z)){return Z.map((Z=>this.cloneOpenAPIValue(Z)))}if(Z&&typeof Z==="object"){const ct={};for(const ut in Z){ct[ut]=this.cloneOpenAPIValue(Z[ut])}return ct}return Z}normalizeContentSchemas(Z){if(!Z){return Z}for(const ct in Z){if(Z[ct]?.schema){Z[ct].schema=this.formatType(Z[ct].schema)}}return Z}normalizeOperationParameters(Z){if(!Array.isArray(Z)){return[]}return Z.map((Z=>{const ct=this.cloneOpenAPIValue(Z);if(ct?.schema){ct.schema=this.formatType(ct.schema)}if(ct.content){ct.content=this.normalizeContentSchemas(ct.content)}return ct}))}normalizeOperationRequestBody(Z){if(!Z){return undefined}const ct=this.cloneOpenAPIValue(Z);if(ct.content){ct.content=this.normalizeContentSchemas(ct.content)}return ct}normalizeOperationResponse(Z){const ct=this.cloneOpenAPIValue(Z);if(ct.schema){ct.content={"application/json":{schema:this.formatType(ct.schema)}};delete ct.schema}else if(ct.type){if(ft.Types.isClass(ct.type)){this.parseClzz(ct.type);if(ct.isArray){ct.content={"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/"+ct.type.name}}}}}else{ct.content={"application/json":{schema:{$ref:"#/components/schemas/"+ct.type.name}}}}}else{ct.content={"text/plain":{schema:{type:convertSchemaType(ct.type)}}}}}else if(ct.content){ct.content=this.normalizeContentSchemas(ct.content)}delete ct.status;delete ct.type;delete ct.isArray;delete ct.format;return ct}normalizeOperationResponses(Z){if(!Z){return undefined}const ct=this.cloneOpenAPIValue(Z);for(const Z in ct){ct[Z]=this.normalizeOperationResponse(ct[Z])}return ct}getOperationId(Z,ct){return this.operationIdFactory(Z,ct)}parseExtraModel(Z){const ct=ft.MetadataManager.getOwnMetadata(_t.DECORATORS_CLASS_METADATA,Z)||[];const ut=ct.filter((Z=>Z.key===_t.DECORATORS.API_EXTRA_MODEL));for(const Z of ut){if(Array.isArray(Z.metadata)){for(const ct of Z.metadata){this.parseClzz(ct)}}else{this.parseClzz(Z.metadata)}}}parseSubPropertyType(Z){let ct;if(Z?.enum){ct={type:Z?.type,enum:Z?.enum,default:Z?.default};if(Z?.description){ct.description=Z?.description}return ct}if(Z?.items?.enum){ct={type:Z?.type,items:Z?.items,default:Z?.default};if(Z?.description){ct.description=Z?.description}return ct}let ut=false;let pt=parseTypeSchema(Z?.type);delete Z?.type;if(pt==="array"){ut=true;pt=parseTypeSchema(Z?.items?.type);delete Z?.items.type}if(Z?.oneOf){ct={oneOf:[]};Z?.oneOf.forEach((Z=>{ct.push(this.parseSubPropertyType(Z))}));delete Z?.oneOf}if(ft.Types.isClass(pt)){this.parseClzz(pt);if(ut){ct={type:"array",items:{$ref:"#/components/schemas/"+pt?.name}}}else{ct={$ref:"#/components/schemas/"+pt?.name}}delete Z.items}else{if(ut){if(!pt){if(Z?.items?.["$ref"]){Z.items["$ref"]=parseTypeSchema(Z.items["$ref"])}ct={type:"array",items:Z?.items}}else{ct={type:"array",items:{type:convertSchemaType(pt?.name||pt)}}}delete Z.items}else{ct={type:pt,format:Z?.format};if(ct.type==="Date"){ct.type="string";if(!ct.format){ct.format="date"}}delete Z.format}}return Object.assign(ct,Z)}formatType(Z){if(Z===null){return null}if(Z.enum){if(Array.isArray(Z.enum)){Z.enum.map((Z=>this.formatType(Z)))}else{Z.enum=(0,yt.getEnumValues)(Z.enum)}}if(Z.not){Z.not=this.formatType(Z.not)}if(Z["$ref"]&&typeof Z["$ref"]==="function"){Z["$ref"]=Z["$ref"]()}if(Z.oneOf){Z.oneOf=Z.oneOf.map((Z=>this.formatType(Z)))}else if(Z.anyOf){Z.anyOf=Z.anyOf.map((Z=>this.formatType(Z)))}else if(Z.allOf){Z.allOf=Z.allOf.map((Z=>this.formatType(Z)))}["not","$ref","oneOf","anyOf","allOf"].forEach((ct=>{if(Z[ct]){delete Z["type"]}}));if(Z.properties){const ct={};for(const ut in Z.properties){ct[ut]=this.formatType(Z.properties[ut])}Z.properties=ct}if(Z.additionalProperties){Z.additionalProperties=this.formatType(Z.additionalProperties)}if(["string","number","boolean","integer"].includes(Z.type)){}else if(Z.type===Number){Z.type="number"}else if(Z.type===String){Z.type="string"}else if(Z.type===Boolean){Z.type="boolean"}else if(Z.type==="date"||Z.type==="Date"||Z.type===Date){Z.type="string";Z.format="date-time"}else if(Z.type===Array||Z.type==="array"){Z.type="array";if(Z.items){Z.items=this.formatType(Z.items)}}else if(Array.isArray(Z.type)){Z.items=this.formatType({type:Z.type[0]});Z.type="array"}else if(Z.type===Object||Z.type==="object"){Z.type="object"}else if(ft.Types.isClass(Z.type)){this.parseClzz(Z.type);Z["$ref"]="#/components/schemas/"+Z.type.name;delete Z["type"]}else if(Z.type instanceof Function){Z.type=Z.type();this.formatType(Z)}return Z}parseClzz(Z){if(this.documentBuilder.getSchema(Z.name)){return this.documentBuilder.getSchema(Z.name)}this.parseExtraModel(Z);const ct=ft.MetadataManager.getPropertiesWithMetadata(ft.CUSTOM_PROPERTY_INJECT_KEY,Z)||{};for(const Z in ct){ct[Z]=ct[Z][ct[Z].length-1]}if(this.swaggerConfig?.useValidationSchema){const ut=this.inferValidationProperties(Z);for(const Z of Object.keys(ut)){if(!ct[Z]){ct[Z]=ut[Z];continue}const pt=ct[Z].metadata||{};const dt=ut[Z].metadata||{};ct[Z].metadata=this.mergePropertyMetadata(pt,dt)}}const ut={type:"object",properties:{}};this.documentBuilder.addSchema({[Z.name]:ut});if(ct){for(const pt of Object.keys(ct)){const dt=ct[pt].metadata||{};if(!dt.type){dt.type=ft.MetadataManager.transformTypeFromTSDesign(ft.MetadataManager.getPropertyType(Z.prototype,pt)).name}ut.properties[pt]=ut.properties[pt]||{};for(const Z in dt){if(Z==="required"&&dt["required"]){if(!ut.required){ut.required=[]}ut.required.push(pt)}else if(["oneOf","anyOf","allOf"].includes(Z)){ut.properties[pt][Z]=[];dt[Z].forEach((ct=>{ut.properties[pt][Z].push(this.formatType(ct))}))}else if(Z==="not"){ut.properties[pt][Z]=this.formatType(dt[Z])}else if(Z==="type"){this.formatType(dt);if(dt.type){ut.properties[pt].type=dt.type}if(dt["$ref"]){ut.properties[pt].$ref=dt["$ref"]}if(dt.items){ut.properties[pt].items=dt.items}if(dt.format){ut.properties[pt].format=dt.format}if(dt.pattern){ut.properties[pt].pattern=dt.pattern}if(dt.enum){ut.properties[pt].enum=dt.enum}}else if(Z==="items"||Z==="pattern"||Z==="format"||Z==="enum"||Z==="$ref"){}else{ut.properties[pt][Z]=dt[Z]}}}}return ut}mergePropertyMetadata(Z,ct){const ut={...Z};const pt=["type","items","format","enum","$ref","pattern","default"];for(const Z of pt){if(ut[Z]===undefined&&ct[Z]!==undefined){ut[Z]=ct[Z]}}if(ut.required===undefined&&ct.required!==undefined){ut.required=ct.required}return ut}getValidationSchemaHelper(){try{const Z=(0,ft.safeRequire)("@midwayjs/validation");const ct=Z?.registry;if(!ct?.getDefaultValidator){return}return ct.getDefaultValidator()?.schemaHelper}catch{return}}inferValidationProperties(Z){const ct=ft.MetadataManager.getPropertiesWithMetadata(vt,Z)||{};const ut=Object.keys(ct).length>0;const pt=ft.MetadataManager.getPropertiesWithMetadata(St,Z)||{};const dt=Object.keys(pt).length>0;const _t=this.hasClassValidatorMetadata(Z);if(!ut&&!_t&&!dt){return{}}const mt={};if(ut||_t){const ct=this.getValidationSchemaHelper();if(ct&&typeof ct.getSwaggerPropertyKeys==="function"&&typeof ct.getSwaggerPropertyMetadata==="function"){const ut=ct.getSwaggerPropertyKeys(Z)||[];for(const pt of ut){const ut=ct.getSwaggerPropertyMetadata(Z,pt);if(ut){mt[pt]={metadata:ut}}}}}if(dt){const ct=this.inferValidateProperties(Z);for(const[Z,ut]of Object.entries(ct)){if(!mt[Z]){mt[Z]=ut;continue}const ct=this.mergePropertyMetadata(mt[Z].metadata||{},ut.metadata||{});mt[Z]={metadata:ct}}}return mt}inferValidateProperties(Z){const ct={};const ut=ft.MetadataManager.getPropertiesWithMetadata(St,Z)||{};for(const Z of Object.keys(ut)){let pt=ut[Z];if(typeof pt==="function"){pt=pt()}const dt=inferJoiPropertyMetadata(pt);if(dt){ct[Z]={metadata:dt}}}return ct}hasClassValidatorMetadata(Z){try{const ct=(0,ft.safeRequire)("class-validator-multi-lang-lite");const ut=ct?.getMetadataStorage?.();if(!ut?.getTargetValidationMetadatas){return false}const pt=ut.getTargetValidationMetadatas(Z,"",false,false)||[];return pt.length>0}catch{return false}}setAuth(Z){if(!Z){return}const{authType:ct,name:ut="",addSecurityRequirements:pt=false,...dt}=Z;if(!ct){return}switch(ct){case"basic":{this.documentBuilder.addBasicAuth(dt,ut);break}case"bearer":{this.documentBuilder.addBearerAuth(dt,ut);break}case"cookie":{const{cookieName:Z,securityName:ct,...ut}=dt;this.documentBuilder.addCookieAuth(Z,ut,ct);break}case"oauth2":{this.documentBuilder.addOAuth2(dt,ut);break}case"apikey":{this.documentBuilder.addApiKey(dt,ut);break}case"custom":{this.documentBuilder.addSecurity(ut,dt);break}}if(pt){this.documentBuilder.addSecurityRequirements(ut)}}};ct.SwaggerExplorer=bt;pt([(0,ft.Config)("swagger"),dt("design:type",Object)],bt.prototype,"swaggerConfig",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],bt.prototype,"init",null);ct.SwaggerExplorer=bt=pt([(0,ft.Provide)(),(0,ft.Scope)(ft.ScopeEnum.Singleton)],bt);function parseParamsInPath(Z){const ct=[];Z.split("/").forEach((Z=>{if(Z.startsWith(":")){const ut=Z.slice(1);ct.push(ut)}}));return ct}function replaceUrl(Z,ct){ct.forEach((ct=>{Z=Z.replace(`:${ct}`,`{${ct}}`)}));return Z}function convertTypeToString(Z){switch(Z){case ft.RouteParamTypes.HEADERS:return"header";case ft.RouteParamTypes.QUERY:return"query";case ft.RouteParamTypes.PARAM:return"path";case ft.RouteParamTypes.BODY:case ft.RouteParamTypes.FIELDS:case ft.RouteParamTypes.FILESSTREAM:case ft.RouteParamTypes.FILESTREAM:return"body";default:return"header"}}function convertSchemaType(Z){switch(Z){case"Object":return"object";case"Boolean":return"boolean";case"Number":return"number";case"String":return"string";default:return"object"}}function inferJoiPropertyMetadata(Z){if(!Z||typeof Z.describe!=="function"){return null}const ct=Z.describe();if(!ct||typeof ct!=="object"){return null}const ut={string:"string",number:"number",boolean:"boolean",array:"array",date:"string",object:"object"};const pt={type:ut[ct.type]||"object"};if(ct?.flags?.presence==="required"){pt.required=true}else if(ct?.flags?.presence==="optional"||!ct?.flags?.presence){pt.required=false}if(ct.type==="array"&&Array.isArray(ct.items)){pt.items={type:ut[ct.items[0]?.type]||"object"}}if(ct.type==="date"){pt.format="date-time"}if(Array.isArray(ct.allow)){const Z=ct.allow.filter((Z=>Z!==""&&Z!==null&&Z!==undefined));if(Z.length>0){pt.enum=Z}}return pt}function getNotEmptyValue(...Z){for(const ct of Z){if(ct){return ct}}}function parseTypeSchema(Z){switch(Z){case String:return"string";case Number:return"number";case Boolean:return"boolean";default:if(typeof Z==="function"&&!ft.Types.isClass(Z)){Z=Z()}return Z}}function parseTags(Z){let ct=[];if(Z.length>0){for(const ut of Z){ct=ct.concat(ut.metadata)}}return ct}function addTag(Z,ct=[]){if(ct.find((ct=>{if(Array.isArray(Z)){return ct===Z[0]}else{return ct===Z}}))){}else{ct.push(Z)}}},69557:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.SwaggerMiddleware=void 0;const ft=ut(31049);const _t=ut(90198);let mt=class SwaggerMiddleware{swaggerConfig;swaggerRender;swaggerExplorer;environmentService;async init(){if(typeof this.swaggerConfig.swaggerUIRender!=="function"){throw new ft.MidwayInvalidConfigPropertyError("swagger.swaggerRender")}this.swaggerRender=this.swaggerConfig.swaggerUIRender(this.swaggerConfig,this.swaggerExplorer)}resolve(Z){if(Z.getNamespace()==="express"){return async(Z,ct,ut)=>{const pt=Z.path;const dt=await this.swaggerRender(pt);if(dt){const{ext:Z,content:ut}=dt;if(Z===".js"){ct.type("application/javascript")}else if(Z===".map"){ct.type("application/json")}else if(Z===".css"){ct.type("text/css")}else if(Z===".png"){ct.type("image/png")}ct.send(ut)}else{return ut()}}}else{return async(Z,ct)=>{const ut=Z.path;const pt=await this.swaggerRender(ut);if(pt){const{ext:ct,content:ut}=pt;if(ct===".js"){Z.set("Content-Type","application/javascript")}else if(ct===".map"){Z.set("Content-Type","application/json")}else if(ct===".css"){Z.set("Content-Type","text/css")}else if(ct===".png"){Z.set("Content-Type","image/png")}Z.body=ut}else{return ct()}}}}static getName(){return"swagger"}};ct.SwaggerMiddleware=mt;pt([(0,ft.Config)("swagger"),dt("design:type",Object)],mt.prototype,"swaggerConfig",void 0);pt([(0,ft.Inject)(),dt("design:type",_t.SwaggerExplorer)],mt.prototype,"swaggerExplorer",void 0);pt([(0,ft.Inject)(),dt("design:type",ft.MidwayEnvironmentService)],mt.prototype,"environmentService",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],mt.prototype,"init",null);ct.SwaggerMiddleware=mt=pt([(0,ft.Provide)(),(0,ft.Scope)(ft.ScopeEnum.Singleton)],mt)},31582:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.renderSwaggerUIDist=renderSwaggerUIDist;ct.renderJSON=renderJSON;ct.renderSwaggerUIRemote=renderSwaggerUIRemote;const pt=ut(31049);const dt=ut(79896);const ft=ut(16928);function renderSwaggerUIDist(Z,ct){const{getAbsoluteFSPath:ut}=(0,pt.safeRequire)("swagger-ui-dist");if(!ut){throw new pt.MidwayCommonError("swagger-ui-dist is not installed")}const _t=Z.swaggerUIRenderOptions||{};if(_t.customInitializer){if((0,ft.isAbsolute)(_t.customInitializer)){_t.customInitializer=(0,dt.readFileSync)(_t.customInitializer)}else{throw new pt.MidwayInvalidConfigPropertyError("swagger.swaggerRenderOptions.customInitializer",["Buffer","String"])}}function replaceInfo(ct){let ut=`location.href.replace('${Z.swaggerPath}/index.html', '${Z.swaggerPath}/index.json'),\n validatorUrl: null,`;if(Z.displayOptions){Object.entries(Z.displayOptions).forEach((([Z,ct])=>{const pt=typeof ct==="string"?`'${ct}'`:ct;ut+=`\n${Z}: ${pt},`}))}return ct.replace('"https://petstore.swagger.io/v2/swagger.json",',ut)}const mt=ut();return async ut=>{if(!mt||ut.indexOf(Z.swaggerPath)===-1){return}const pt=ut.split("/");let ht=pt.pop();if(ht==="index.json"){return{ext:"json",content:ct.getData()}}if(!ht){ht="index.html"}let yt=(0,dt.readFileSync)((0,ft.join)(mt,ht));if(ht==="swagger-initializer.js"&&_t?.customInitializer){return{ext:"js",content:_t.customInitializer}}if(ht==="index.html"||ht==="swagger-initializer.js"){yt=yt.toString("utf8");yt=replaceInfo(yt)}const vt=(0,ft.extname)(ht);return{ext:vt,content:yt}}}function renderJSON(Z,ct){return async ut=>{if(ut.indexOf(Z.swaggerPath)===-1){return}const pt=ut.split("/");const dt=pt.pop();if(dt==="index.json"){return{ext:"json",content:ct.getData()}}return}}function renderSwaggerUIRemote(Z,ct){const ut=Z.swaggerUIRenderOptions||{};const pt=ut?.indexPagePath||(0,ft.join)(__dirname,"../../index.html");return async ut=>{if(ut.indexOf(Z.swaggerPath)===-1){return}const ft=ut.split("/");let _t=ft.pop();if(_t==="index.json"){return{ext:"json",content:ct.getData()}}if(!_t){_t="index.html"}if(_t==="index.html"){const Z=(0,dt.readFileSync)(pt,"utf8");return{ext:"html",content:Z}}return}}},43639:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.i18n=ct.validate=void 0;ct.validate={validationOptions:{},errorStatus:422};ct.i18n={localeTable:{en_US:{validate:ut(27782)},zh_CN:{validate:ut(80572)}}}},19135:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.ValidateConfiguration=void 0;const ft=ut(31049);const _t=ut(43639);const mt=ut(71882);const ht=ut(67213);const yt=ut(46289);const vt=ut(18016);let St=class ValidateConfiguration{decoratorService;validateService;async init(){this.decoratorService.registerParameterHandler(vt.VALID_KEY,(({parameterIndex:Z,originParamType:ct,originArgs:ut,metadata:pt})=>{if(!pt.schema){pt.schema=this.validateService.getSchema(ct)}return ut[Z]}))}async onReady(Z){await Z.getAsync(yt.ValidationPipe);await Z.getAsync(yt.ParseIntPipe);await Z.getAsync(yt.ParseBoolPipe);await Z.getAsync(yt.ParseFloatPipe);await Z.getAsync(yt.DecoratorValidPipe);this.decoratorService.registerParameterPipes(ft.WEB_ROUTER_PARAM_KEY,[yt.ValidationPipe])}};ct.ValidateConfiguration=St;pt([(0,ft.Inject)(),dt("design:type",ft.MidwayDecoratorService)],St.prototype,"decoratorService",void 0);pt([(0,ft.Inject)(),dt("design:type",mt.ValidateService)],St.prototype,"validateService",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],St.prototype,"init",null);ct.ValidateConfiguration=St=pt([(0,ft.Configuration)({namespace:"validate",imports:[ht],importConfigs:[{default:_t}]})],St)},18016:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.VALID_KEY=ct.VALIDATE_KEY=ct.RULES_CLASS_KEY=ct.RULES_KEY=void 0;ct.RULES_KEY="common:rules";ct.RULES_CLASS_KEY="common:class_rules";ct.VALIDATE_KEY="common:validate";ct.VALID_KEY="validate:valid"},69745:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.RuleType=void 0;ct.Rule=Rule;const pt=ut(15192);ct.RuleType=pt;const dt=ut(31049);const ft=ut(18016);function Rule(Z){return function(ct,ut){if(ut){dt.MetadataManager.defineMetadata(ft.RULES_KEY,Z,ct,ut)}}}},71765:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Valid=Valid;const pt=ut(31049);const dt=ut(18016);const ft=ut(46289);function Valid(Z,ct){if(Array.isArray(Z)){ct=Z;Z=undefined}else{ct=ct||[]}return pt.DecoratorManager.createCustomParamDecorator(dt.VALID_KEY,{schema:Z},{pipes:[ft.DecoratorValidPipe,...ct]})}},37513:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.Validate=Validate;const pt=ut(31049);const dt=ut(18016);function Validate(Z={}){return(ct,ut,ft)=>{pt.MetadataManager.defineMetadata(dt.VALIDATE_KEY,Z,ct,ut)}}},82744:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.PickDto=PickDto;ct.OmitDto=OmitDto;const pt=ut(31049);const dt=ut(18016);function PickDto(Z,ct){const pickedDto=function(){};pickedDto.prototype=Z.prototype;pt.MetadataManager.copyMetadata(Z,pickedDto,{metadataFilter:(Z,ut)=>Z===dt.RULES_KEY&&ct.includes(ut)});return pickedDto}function OmitDto(Z,ct){const pickedDto=function(){};pickedDto.prototype=Z.prototype;pt.MetadataManager.copyMetadata(Z,pickedDto,{metadataFilter:(Z,ut)=>Z===dt.RULES_KEY&&!ct.includes(ut)});return pickedDto}},12299:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MidwayValidationError=void 0;const pt=ut(31049);const dt=(0,pt.registerErrorCode)("validate",{VALIDATE_FAIL:1e4});class MidwayValidationError extends pt.MidwayHttpError{constructor(Z,ct,ut){super(Z,ct,dt.VALIDATE_FAIL,{cause:ut})}}ct.MidwayValidationError=MidwayValidationError},18649:function(Z,ct,ut){"use strict";var pt=this&&this.__createBinding||(Object.create?function(Z,ct,ut,pt){if(pt===undefined)pt=ut;var dt=Object.getOwnPropertyDescriptor(ct,ut);if(!dt||("get"in dt?!ct.__esModule:dt.writable||dt.configurable)){dt={enumerable:true,get:function(){return ct[ut]}}}Object.defineProperty(Z,pt,dt)}:function(Z,ct,ut,pt){if(pt===undefined)pt=ut;Z[pt]=ct[ut]});var dt=this&&this.__exportStar||function(Z,ct){for(var ut in Z)if(ut!=="default"&&!Object.prototype.hasOwnProperty.call(ct,ut))pt(ct,Z,ut)};Object.defineProperty(ct,"__esModule",{value:true});ct.Configuration=void 0;var ft=ut(19135);Object.defineProperty(ct,"Configuration",{enumerable:true,get:function(){return ft.ValidateConfiguration}});dt(ut(69745),ct);dt(ut(37513),ct);dt(ut(71765),ct);dt(ut(82744),ct);dt(ut(71882),ct);dt(ut(12299),ct);dt(ut(46289),ct)},46289:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.DefaultValuePipe=ct.ParseFloatPipe=ct.ParseBoolPipe=ct.ParseIntPipe=ct.DecoratorValidPipe=ct.ParsePipe=ct.ValidationPipe=ct.AbstractValidationPipe=void 0;const ft=ut(31049);const _t=ut(71882);const mt=ut(67213);const ht=ut(18016);const yt=ut(15192);class AbstractValidationPipe{validateService;validateWithSchema(Z,ct,ut){const pt=this.parseValidationOptions(ct);const dt=this.validateService.validateWithSchema(ut,Z,pt);if(dt&&dt.value!==undefined){return dt.value}return Z}validate(Z,ct){const ut=this.parseValidationOptions(ct);if(ct.metaType.isBaseType||!ct.metaType.originDesign||ct.metadata?.type==="files_stream"||ct.metadata?.type==="file_stream"){return Z}const pt=this.validateService.validate(ct.metaType.originDesign,Z,ut);if(pt&&pt.value){return pt.value}return Z}parseValidationOptions(Z){const ct=ft.MetadataManager.getMetadata(ht.VALIDATE_KEY,Z.target,Z.methodName)||{};if(!ct.locale){const ut=Z.target[ft.REQUEST_OBJ_CTX_KEY];if(ut&&ut.getAttr){ct.locale=ut.getAttr(mt.I18N_ATTR_KEY)}}return ct}getSchema(){return undefined}}ct.AbstractValidationPipe=AbstractValidationPipe;pt([(0,ft.Inject)(),dt("design:type",_t.ValidateService)],AbstractValidationPipe.prototype,"validateService",void 0);let vt=class ValidationPipe extends AbstractValidationPipe{transform(Z,ct){return this.validate(Z,ct)}};ct.ValidationPipe=vt;ct.ValidationPipe=vt=pt([(0,ft.Pipe)()],vt);class ParsePipe extends AbstractValidationPipe{transform(Z,ct){return this.validateWithSchema(Z,ct,ct.metadata["schema"]||this.getSchema())}}ct.ParsePipe=ParsePipe;let St=class DecoratorValidPipe extends ParsePipe{};ct.DecoratorValidPipe=St;ct.DecoratorValidPipe=St=pt([(0,ft.Pipe)()],St);let bt=class ParseIntPipe extends ParsePipe{getSchema(){return yt.number().integer().required()}};ct.ParseIntPipe=bt;ct.ParseIntPipe=bt=pt([(0,ft.Pipe)()],bt);let xt=class ParseBoolPipe extends ParsePipe{getSchema(){return yt.boolean().required()}};ct.ParseBoolPipe=xt;ct.ParseBoolPipe=xt=pt([(0,ft.Pipe)()],xt);let $t=class ParseFloatPipe extends ParsePipe{getSchema(){return yt.number().required()}};ct.ParseFloatPipe=$t;ct.ParseFloatPipe=$t=pt([(0,ft.Pipe)()],$t);class DefaultValuePipe{defaultValue;constructor(Z){this.defaultValue=Z}transform(Z,ct){if(Z===undefined||Z===null||typeof Z==="number"&&isNaN(Z)){return this.defaultValue}return Z}}ct.DefaultValuePipe=DefaultValuePipe},71882:function(Z,ct,ut){"use strict";var pt=this&&this.__decorate||function(Z,ct,ut,pt){var dt=arguments.length,ft=dt<3?ct:pt===null?pt=Object.getOwnPropertyDescriptor(ct,ut):pt,_t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ft=Reflect.decorate(Z,ct,ut,pt);else for(var mt=Z.length-1;mt>=0;mt--)if(_t=Z[mt])ft=(dt<3?_t(ft):dt>3?_t(ct,ut,ft):_t(ct,ut))||ft;return dt>3&&ft&&Object.defineProperty(ct,ut,ft),ft};var dt=this&&this.__metadata||function(Z,ct){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Z,ct)};Object.defineProperty(ct,"__esModule",{value:true});ct.ValidateService=void 0;ct.getSchema=getSchema;const ft=ut(31049);const _t=ut(43639);const mt=ut(18016);const ht=ut(15192);const yt=ut(67213);const vt=ut(12299);let St=class ValidateService{validateConfig;i18nConfig;i18nService;messages={};async init(){const Z=Object.keys(_t.i18n.localeTable);Z.forEach((Z=>{this.messages[(0,yt.formatLocale)(Z)]=Object.fromEntries(this.i18nService.getLocaleMapping(Z,"validate"))}))}validate(Z,ct,ut={}){const pt=this.getSchema(Z);return this.validateWithSchema(pt,ct,ut)}validateWithSchema(Z,ct,ut={}){if(!Z){return undefined}ut.validationOptions=ut.validationOptions||{};ut.validationOptions.errors=ut.validationOptions.errors||{};ut.validationOptions.errors.language=(0,yt.formatLocale)(this.i18nService.getAvailableLocale(ut.validationOptions.errors.language||ut.locale||this.i18nConfig.defaultLocale,"validate"));const pt=Z.validate(ct,Object.assign({},this.validateConfig.validationOptions??{},{messages:this.messages},ut.validationOptions??{}));if(pt.error){throw new vt.MidwayValidationError(pt.error.message,ut?.errorStatus??this.validateConfig.errorStatus,pt.error)}else{return pt}}getSchema(Z){return getSchema(Z)}};ct.ValidateService=St;pt([(0,ft.Config)("validate"),dt("design:type",Object)],St.prototype,"validateConfig",void 0);pt([(0,ft.Config)("i18n"),dt("design:type",Object)],St.prototype,"i18nConfig",void 0);pt([(0,ft.Inject)(),dt("design:type",yt.MidwayI18nServiceSingleton)],St.prototype,"i18nService",void 0);pt([(0,ft.Init)(),dt("design:type",Function),dt("design:paramtypes",[]),dt("design:returntype",Promise)],St.prototype,"init",null);ct.ValidateService=St=pt([(0,ft.Provide)(),(0,ft.Scope)(ft.ScopeEnum.Singleton)],St);function getSchema(Z){const ct=ft.MetadataManager.getPropertiesWithMetadata(mt.RULES_KEY,Z);if(ct){return ht.object(ct)}}},51878:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ContextAPI=void 0;const pt=ut(61522);const dt=ut(76867);const ft=ut(11422);const _t="context";const mt=new pt.NoopContextManager;class ContextAPI{constructor(){}static getInstance(){if(!this._instance){this._instance=new ContextAPI}return this._instance}setGlobalContextManager(Z){return(0,dt.registerGlobal)(_t,Z,ft.DiagAPI.instance())}active(){return this._getContextManager().active()}with(Z,ct,ut,...pt){return this._getContextManager().with(Z,ct,ut,...pt)}bind(Z,ct){return this._getContextManager().bind(Z,ct)}_getContextManager(){return(0,dt.getGlobal)(_t)||mt}disable(){this._getContextManager().disable();(0,dt.unregisterGlobal)(_t,ft.DiagAPI.instance())}}ct.ContextAPI=ContextAPI},11422:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.DiagAPI=void 0;const pt=ut(56043);const dt=ut(94730);const ft=ut(71741);const _t=ut(76867);const mt="diag";class DiagAPI{static instance(){if(!this._instance){this._instance=new DiagAPI}return this._instance}constructor(){function _logProxy(Z){return function(...ct){const ut=(0,_t.getGlobal)("diag");if(!ut)return;return ut[Z](...ct)}}const Z=this;const setLogger=(ct,ut={logLevel:ft.DiagLogLevel.INFO})=>{var pt,mt,ht;if(ct===Z){const ct=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");Z.error((pt=ct.stack)!==null&&pt!==void 0?pt:ct.message);return false}if(typeof ut==="number"){ut={logLevel:ut}}const yt=(0,_t.getGlobal)("diag");const vt=(0,dt.createLogLevelDiagLogger)((mt=ut.logLevel)!==null&&mt!==void 0?mt:ft.DiagLogLevel.INFO,ct);if(yt&&!ut.suppressOverrideMessage){const Z=(ht=(new Error).stack)!==null&&ht!==void 0?ht:"<failed to generate stacktrace>";yt.warn(`Current logger will be overwritten from ${Z}`);vt.warn(`Current logger will overwrite one already registered from ${Z}`)}return(0,_t.registerGlobal)("diag",vt,Z,true)};Z.setLogger=setLogger;Z.disable=()=>{(0,_t.unregisterGlobal)(mt,Z)};Z.createComponentLogger=Z=>new pt.DiagComponentLogger(Z);Z.verbose=_logProxy("verbose");Z.debug=_logProxy("debug");Z.info=_logProxy("info");Z.warn=_logProxy("warn");Z.error=_logProxy("error")}}ct.DiagAPI=DiagAPI},56436:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.MetricsAPI=void 0;const pt=ut(8240);const dt=ut(76867);const ft=ut(11422);const _t="metrics";class MetricsAPI{constructor(){}static getInstance(){if(!this._instance){this._instance=new MetricsAPI}return this._instance}setGlobalMeterProvider(Z){return(0,dt.registerGlobal)(_t,Z,ft.DiagAPI.instance())}getMeterProvider(){return(0,dt.getGlobal)(_t)||pt.NOOP_METER_PROVIDER}getMeter(Z,ct,ut){return this.getMeterProvider().getMeter(Z,ct,ut)}disable(){(0,dt.unregisterGlobal)(_t,ft.DiagAPI.instance())}}ct.MetricsAPI=MetricsAPI},39415:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.PropagationAPI=void 0;const pt=ut(76867);const dt=ut(88161);const ft=ut(23641);const _t=ut(36148);const mt=ut(86030);const ht=ut(11422);const yt="propagation";const vt=new dt.NoopTextMapPropagator;class PropagationAPI{constructor(){this.createBaggage=mt.createBaggage;this.getBaggage=_t.getBaggage;this.getActiveBaggage=_t.getActiveBaggage;this.setBaggage=_t.setBaggage;this.deleteBaggage=_t.deleteBaggage}static getInstance(){if(!this._instance){this._instance=new PropagationAPI}return this._instance}setGlobalPropagator(Z){return(0,pt.registerGlobal)(yt,Z,ht.DiagAPI.instance())}inject(Z,ct,ut=ft.defaultTextMapSetter){return this._getGlobalPropagator().inject(Z,ct,ut)}extract(Z,ct,ut=ft.defaultTextMapGetter){return this._getGlobalPropagator().extract(Z,ct,ut)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,pt.unregisterGlobal)(yt,ht.DiagAPI.instance())}_getGlobalPropagator(){return(0,pt.getGlobal)(yt)||vt}}ct.PropagationAPI=PropagationAPI},4044:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.TraceAPI=void 0;const pt=ut(76867);const dt=ut(14440);const ft=ut(73103);const _t=ut(53075);const mt=ut(11422);const ht="trace";class TraceAPI{constructor(){this._proxyTracerProvider=new dt.ProxyTracerProvider;this.wrapSpanContext=ft.wrapSpanContext;this.isSpanContextValid=ft.isSpanContextValid;this.deleteSpan=_t.deleteSpan;this.getSpan=_t.getSpan;this.getActiveSpan=_t.getActiveSpan;this.getSpanContext=_t.getSpanContext;this.setSpan=_t.setSpan;this.setSpanContext=_t.setSpanContext}static getInstance(){if(!this._instance){this._instance=new TraceAPI}return this._instance}setGlobalTracerProvider(Z){const ct=(0,pt.registerGlobal)(ht,this._proxyTracerProvider,mt.DiagAPI.instance());if(ct){this._proxyTracerProvider.setDelegate(Z)}return ct}getTracerProvider(){return(0,pt.getGlobal)(ht)||this._proxyTracerProvider}getTracer(Z,ct){return this.getTracerProvider().getTracer(Z,ct)}disable(){(0,pt.unregisterGlobal)(ht,mt.DiagAPI.instance());this._proxyTracerProvider=new dt.ProxyTracerProvider}}ct.TraceAPI=TraceAPI},36148:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.deleteBaggage=ct.setBaggage=ct.getActiveBaggage=ct.getBaggage=void 0;const pt=ut(51878);const dt=ut(98089);const ft=(0,dt.createContextKey)("OpenTelemetry Baggage Key");function getBaggage(Z){return Z.getValue(ft)||undefined}ct.getBaggage=getBaggage;function getActiveBaggage(){return getBaggage(pt.ContextAPI.getInstance().active())}ct.getActiveBaggage=getActiveBaggage;function setBaggage(Z,ct){return Z.setValue(ft,ct)}ct.setBaggage=setBaggage;function deleteBaggage(Z){return Z.deleteValue(ft)}ct.deleteBaggage=deleteBaggage},72746:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.BaggageImpl=void 0;class BaggageImpl{constructor(Z){this._entries=Z?new Map(Z):new Map}getEntry(Z){const ct=this._entries.get(Z);if(!ct){return undefined}return Object.assign({},ct)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(Z,ct){const ut=new BaggageImpl(this._entries);ut._entries.set(Z,ct);return ut}removeEntry(Z){const ct=new BaggageImpl(this._entries);ct._entries.delete(Z);return ct}removeEntries(...Z){const ct=new BaggageImpl(this._entries);for(const ut of Z){ct._entries.delete(ut)}return ct}clear(){return new BaggageImpl}}ct.BaggageImpl=BaggageImpl},64909:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.baggageEntryMetadataSymbol=void 0;ct.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")},86030:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.baggageEntryMetadataFromString=ct.createBaggage=void 0;const pt=ut(11422);const dt=ut(72746);const ft=ut(64909);const _t=pt.DiagAPI.instance();function createBaggage(Z={}){return new dt.BaggageImpl(new Map(Object.entries(Z)))}ct.createBaggage=createBaggage;function baggageEntryMetadataFromString(Z){if(typeof Z!=="string"){_t.error(`Cannot create baggage metadata from unknown type: ${typeof Z}`);Z=""}return{__TYPE__:ft.baggageEntryMetadataSymbol,toString(){return Z}}}ct.baggageEntryMetadataFromString=baggageEntryMetadataFromString},31252:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.context=void 0;const pt=ut(51878);ct.context=pt.ContextAPI.getInstance()},61522:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.NoopContextManager=void 0;const pt=ut(98089);class NoopContextManager{active(){return pt.ROOT_CONTEXT}with(Z,ct,ut,...pt){return ct.call(ut,...pt)}bind(Z,ct){return ct}enable(){return this}disable(){return this}}ct.NoopContextManager=NoopContextManager},98089:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ROOT_CONTEXT=ct.createContextKey=void 0;function createContextKey(Z){return Symbol.for(Z)}ct.createContextKey=createContextKey;class BaseContext{constructor(Z){const ct=this;ct._currentContext=Z?new Map(Z):new Map;ct.getValue=Z=>ct._currentContext.get(Z);ct.setValue=(Z,ut)=>{const pt=new BaseContext(ct._currentContext);pt._currentContext.set(Z,ut);return pt};ct.deleteValue=Z=>{const ut=new BaseContext(ct._currentContext);ut._currentContext.delete(Z);return ut}}}ct.ROOT_CONTEXT=new BaseContext},81318:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.diag=void 0;const pt=ut(11422);ct.diag=pt.DiagAPI.instance()},56043:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.DiagComponentLogger=void 0;const pt=ut(76867);class DiagComponentLogger{constructor(Z){this._namespace=Z.namespace||"DiagComponentLogger"}debug(...Z){return logProxy("debug",this._namespace,Z)}error(...Z){return logProxy("error",this._namespace,Z)}info(...Z){return logProxy("info",this._namespace,Z)}warn(...Z){return logProxy("warn",this._namespace,Z)}verbose(...Z){return logProxy("verbose",this._namespace,Z)}}ct.DiagComponentLogger=DiagComponentLogger;function logProxy(Z,ct,ut){const dt=(0,pt.getGlobal)("diag");if(!dt){return}return dt[Z](ct,...ut)}},10817:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.DiagConsoleLogger=ct._originalConsoleMethods=void 0;const ut=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];ct._originalConsoleMethods={};if(typeof console!=="undefined"){const Z=["error","warn","info","debug","trace","log"];for(const ut of Z){if(typeof console[ut]==="function"){ct._originalConsoleMethods[ut]=console[ut]}}}class DiagConsoleLogger{constructor(){function _consoleFunc(Z){return function(...ut){let pt=ct._originalConsoleMethods[Z];if(typeof pt!=="function"){pt=ct._originalConsoleMethods["log"]}if(typeof pt!=="function"&&console){pt=console[Z];if(typeof pt!=="function"){pt=console.log}}if(typeof pt==="function"){return pt.apply(console,ut)}}}for(let Z=0;Z<ut.length;Z++){this[ut[Z].n]=_consoleFunc(ut[Z].c)}}}ct.DiagConsoleLogger=DiagConsoleLogger},94730:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.createLogLevelDiagLogger=void 0;const pt=ut(71741);function createLogLevelDiagLogger(Z,ct){if(Z<pt.DiagLogLevel.NONE){Z=pt.DiagLogLevel.NONE}else if(Z>pt.DiagLogLevel.ALL){Z=pt.DiagLogLevel.ALL}ct=ct||{};function _filterFunc(ut,pt){const dt=ct[ut];if(typeof dt==="function"&&Z>=pt){return dt.bind(ct)}return function(){}}return{error:_filterFunc("error",pt.DiagLogLevel.ERROR),warn:_filterFunc("warn",pt.DiagLogLevel.WARN),info:_filterFunc("info",pt.DiagLogLevel.INFO),debug:_filterFunc("debug",pt.DiagLogLevel.DEBUG),verbose:_filterFunc("verbose",pt.DiagLogLevel.VERBOSE)}}ct.createLogLevelDiagLogger=createLogLevelDiagLogger},71741:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.DiagLogLevel=void 0;var ut;(function(Z){Z[Z["NONE"]=0]="NONE";Z[Z["ERROR"]=30]="ERROR";Z[Z["WARN"]=50]="WARN";Z[Z["INFO"]=60]="INFO";Z[Z["DEBUG"]=70]="DEBUG";Z[Z["VERBOSE"]=80]="VERBOSE";Z[Z["ALL"]=9999]="ALL"})(ut=ct.DiagLogLevel||(ct.DiagLogLevel={}))},80794:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.trace=ct.propagation=ct.metrics=ct.diag=ct.context=ct.INVALID_SPAN_CONTEXT=ct.INVALID_TRACEID=ct.INVALID_SPANID=ct.isValidSpanId=ct.isValidTraceId=ct.isSpanContextValid=ct.createTraceState=ct.TraceFlags=ct.SpanStatusCode=ct.SpanKind=ct.SamplingDecision=ct.ProxyTracerProvider=ct.ProxyTracer=ct.defaultTextMapSetter=ct.defaultTextMapGetter=ct.ValueType=ct.createNoopMeter=ct.DiagLogLevel=ct.DiagConsoleLogger=ct.ROOT_CONTEXT=ct.createContextKey=ct.baggageEntryMetadataFromString=void 0;var pt=ut(86030);Object.defineProperty(ct,"baggageEntryMetadataFromString",{enumerable:true,get:function(){return pt.baggageEntryMetadataFromString}});var dt=ut(98089);Object.defineProperty(ct,"createContextKey",{enumerable:true,get:function(){return dt.createContextKey}});Object.defineProperty(ct,"ROOT_CONTEXT",{enumerable:true,get:function(){return dt.ROOT_CONTEXT}});var ft=ut(10817);Object.defineProperty(ct,"DiagConsoleLogger",{enumerable:true,get:function(){return ft.DiagConsoleLogger}});var _t=ut(71741);Object.defineProperty(ct,"DiagLogLevel",{enumerable:true,get:function(){return _t.DiagLogLevel}});var mt=ut(70809);Object.defineProperty(ct,"createNoopMeter",{enumerable:true,get:function(){return mt.createNoopMeter}});var ht=ut(26886);Object.defineProperty(ct,"ValueType",{enumerable:true,get:function(){return ht.ValueType}});var yt=ut(23641);Object.defineProperty(ct,"defaultTextMapGetter",{enumerable:true,get:function(){return yt.defaultTextMapGetter}});Object.defineProperty(ct,"defaultTextMapSetter",{enumerable:true,get:function(){return yt.defaultTextMapSetter}});var vt=ut(3121);Object.defineProperty(ct,"ProxyTracer",{enumerable:true,get:function(){return vt.ProxyTracer}});var St=ut(14440);Object.defineProperty(ct,"ProxyTracerProvider",{enumerable:true,get:function(){return St.ProxyTracerProvider}});var bt=ut(13122);Object.defineProperty(ct,"SamplingDecision",{enumerable:true,get:function(){return bt.SamplingDecision}});var xt=ut(49339);Object.defineProperty(ct,"SpanKind",{enumerable:true,get:function(){return xt.SpanKind}});var $t=ut(52036);Object.defineProperty(ct,"SpanStatusCode",{enumerable:true,get:function(){return $t.SpanStatusCode}});var Et=ut(12613);Object.defineProperty(ct,"TraceFlags",{enumerable:true,get:function(){return Et.TraceFlags}});var Ct=ut(81257);Object.defineProperty(ct,"createTraceState",{enumerable:true,get:function(){return Ct.createTraceState}});var Tt=ut(73103);Object.defineProperty(ct,"isSpanContextValid",{enumerable:true,get:function(){return Tt.isSpanContextValid}});Object.defineProperty(ct,"isValidTraceId",{enumerable:true,get:function(){return Tt.isValidTraceId}});Object.defineProperty(ct,"isValidSpanId",{enumerable:true,get:function(){return Tt.isValidSpanId}});var wt=ut(12016);Object.defineProperty(ct,"INVALID_SPANID",{enumerable:true,get:function(){return wt.INVALID_SPANID}});Object.defineProperty(ct,"INVALID_TRACEID",{enumerable:true,get:function(){return wt.INVALID_TRACEID}});Object.defineProperty(ct,"INVALID_SPAN_CONTEXT",{enumerable:true,get:function(){return wt.INVALID_SPAN_CONTEXT}});const At=ut(31252);Object.defineProperty(ct,"context",{enumerable:true,get:function(){return At.context}});const kt=ut(81318);Object.defineProperty(ct,"diag",{enumerable:true,get:function(){return kt.diag}});const It=ut(71618);Object.defineProperty(ct,"metrics",{enumerable:true,get:function(){return It.metrics}});const Nt=ut(31957);Object.defineProperty(ct,"propagation",{enumerable:true,get:function(){return Nt.propagation}});const Pt=ut(36718);Object.defineProperty(ct,"trace",{enumerable:true,get:function(){return Pt.trace}});ct["default"]={context:At.context,diag:kt.diag,metrics:It.metrics,propagation:Nt.propagation,trace:Pt.trace}},76867:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.unregisterGlobal=ct.getGlobal=ct.registerGlobal=void 0;const pt=ut(75918);const dt=ut(95856);const ft=pt.VERSION.split(".")[0];const _t=Symbol.for(`opentelemetry.js.api.${ft}`);const mt=typeof globalThis==="object"?globalThis:typeof self==="object"?self:typeof window==="object"?window:typeof global==="object"?global:{};function registerGlobal(Z,ct,ut,dt=false){var ft;const ht=mt[_t]=(ft=mt[_t])!==null&&ft!==void 0?ft:{version:pt.VERSION};if(!dt&&ht[Z]){const ct=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${Z}`);ut.error(ct.stack||ct.message);return false}if(ht.version!==pt.VERSION){const ct=new Error(`@opentelemetry/api: Registration of version v${ht.version} for ${Z} does not match previously registered API v${pt.VERSION}`);ut.error(ct.stack||ct.message);return false}ht[Z]=ct;ut.debug(`@opentelemetry/api: Registered a global for ${Z} v${pt.VERSION}.`);return true}ct.registerGlobal=registerGlobal;function getGlobal(Z){var ct,ut;const pt=(ct=mt[_t])===null||ct===void 0?void 0:ct.version;if(!pt||!(0,dt.isCompatible)(pt)){return}return(ut=mt[_t])===null||ut===void 0?void 0:ut[Z]}ct.getGlobal=getGlobal;function unregisterGlobal(Z,ct){ct.debug(`@opentelemetry/api: Unregistering a global for ${Z} v${pt.VERSION}.`);const ut=mt[_t];if(ut){delete ut[Z]}}ct.unregisterGlobal=unregisterGlobal},95856:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.isCompatible=ct._makeCompatibilityCheck=void 0;const pt=ut(75918);const dt=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function _makeCompatibilityCheck(Z){const ct=new Set([Z]);const ut=new Set;const pt=Z.match(dt);if(!pt){return()=>false}const ft={major:+pt[1],minor:+pt[2],patch:+pt[3],prerelease:pt[4]};if(ft.prerelease!=null){return function isExactmatch(ct){return ct===Z}}function _reject(Z){ut.add(Z);return false}function _accept(Z){ct.add(Z);return true}return function isCompatible(Z){if(ct.has(Z)){return true}if(ut.has(Z)){return false}const pt=Z.match(dt);if(!pt){return _reject(Z)}const _t={major:+pt[1],minor:+pt[2],patch:+pt[3],prerelease:pt[4]};if(_t.prerelease!=null){return _reject(Z)}if(ft.major!==_t.major){return _reject(Z)}if(ft.major===0){if(ft.minor===_t.minor&&ft.patch<=_t.patch){return _accept(Z)}return _reject(Z)}if(ft.minor<=_t.minor){return _accept(Z)}return _reject(Z)}}ct._makeCompatibilityCheck=_makeCompatibilityCheck;ct.isCompatible=_makeCompatibilityCheck(pt.VERSION)},71618:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.metrics=void 0;const pt=ut(56436);ct.metrics=pt.MetricsAPI.getInstance()},26886:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ValueType=void 0;var ut;(function(Z){Z[Z["INT"]=0]="INT";Z[Z["DOUBLE"]=1]="DOUBLE"})(ut=ct.ValueType||(ct.ValueType={}))},70809:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.createNoopMeter=ct.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=ct.NOOP_OBSERVABLE_GAUGE_METRIC=ct.NOOP_OBSERVABLE_COUNTER_METRIC=ct.NOOP_UP_DOWN_COUNTER_METRIC=ct.NOOP_HISTOGRAM_METRIC=ct.NOOP_GAUGE_METRIC=ct.NOOP_COUNTER_METRIC=ct.NOOP_METER=ct.NoopObservableUpDownCounterMetric=ct.NoopObservableGaugeMetric=ct.NoopObservableCounterMetric=ct.NoopObservableMetric=ct.NoopHistogramMetric=ct.NoopGaugeMetric=ct.NoopUpDownCounterMetric=ct.NoopCounterMetric=ct.NoopMetric=ct.NoopMeter=void 0;class NoopMeter{constructor(){}createGauge(Z,ut){return ct.NOOP_GAUGE_METRIC}createHistogram(Z,ut){return ct.NOOP_HISTOGRAM_METRIC}createCounter(Z,ut){return ct.NOOP_COUNTER_METRIC}createUpDownCounter(Z,ut){return ct.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(Z,ut){return ct.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(Z,ut){return ct.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(Z,ut){return ct.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(Z,ct){}removeBatchObservableCallback(Z){}}ct.NoopMeter=NoopMeter;class NoopMetric{}ct.NoopMetric=NoopMetric;class NoopCounterMetric extends NoopMetric{add(Z,ct){}}ct.NoopCounterMetric=NoopCounterMetric;class NoopUpDownCounterMetric extends NoopMetric{add(Z,ct){}}ct.NoopUpDownCounterMetric=NoopUpDownCounterMetric;class NoopGaugeMetric extends NoopMetric{record(Z,ct){}}ct.NoopGaugeMetric=NoopGaugeMetric;class NoopHistogramMetric extends NoopMetric{record(Z,ct){}}ct.NoopHistogramMetric=NoopHistogramMetric;class NoopObservableMetric{addCallback(Z){}removeCallback(Z){}}ct.NoopObservableMetric=NoopObservableMetric;class NoopObservableCounterMetric extends NoopObservableMetric{}ct.NoopObservableCounterMetric=NoopObservableCounterMetric;class NoopObservableGaugeMetric extends NoopObservableMetric{}ct.NoopObservableGaugeMetric=NoopObservableGaugeMetric;class NoopObservableUpDownCounterMetric extends NoopObservableMetric{}ct.NoopObservableUpDownCounterMetric=NoopObservableUpDownCounterMetric;ct.NOOP_METER=new NoopMeter;ct.NOOP_COUNTER_METRIC=new NoopCounterMetric;ct.NOOP_GAUGE_METRIC=new NoopGaugeMetric;ct.NOOP_HISTOGRAM_METRIC=new NoopHistogramMetric;ct.NOOP_UP_DOWN_COUNTER_METRIC=new NoopUpDownCounterMetric;ct.NOOP_OBSERVABLE_COUNTER_METRIC=new NoopObservableCounterMetric;ct.NOOP_OBSERVABLE_GAUGE_METRIC=new NoopObservableGaugeMetric;ct.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new NoopObservableUpDownCounterMetric;function createNoopMeter(){return ct.NOOP_METER}ct.createNoopMeter=createNoopMeter},8240:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.NOOP_METER_PROVIDER=ct.NoopMeterProvider=void 0;const pt=ut(70809);class NoopMeterProvider{getMeter(Z,ct,ut){return pt.NOOP_METER}}ct.NoopMeterProvider=NoopMeterProvider;ct.NOOP_METER_PROVIDER=new NoopMeterProvider},31957:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.propagation=void 0;const pt=ut(39415);ct.propagation=pt.PropagationAPI.getInstance()},88161:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.NoopTextMapPropagator=void 0;class NoopTextMapPropagator{inject(Z,ct){}extract(Z,ct){return Z}fields(){return[]}}ct.NoopTextMapPropagator=NoopTextMapPropagator},23641:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.defaultTextMapSetter=ct.defaultTextMapGetter=void 0;ct.defaultTextMapGetter={get(Z,ct){if(Z==null){return undefined}return Z[ct]},keys(Z){if(Z==null){return[]}return Object.keys(Z)}};ct.defaultTextMapSetter={set(Z,ct,ut){if(Z==null){return}Z[ct]=ut}}},36718:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.trace=void 0;const pt=ut(4044);ct.trace=pt.TraceAPI.getInstance()},86480:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.NonRecordingSpan=void 0;const pt=ut(12016);class NonRecordingSpan{constructor(Z=pt.INVALID_SPAN_CONTEXT){this._spanContext=Z}spanContext(){return this._spanContext}setAttribute(Z,ct){return this}setAttributes(Z){return this}addEvent(Z,ct){return this}addLink(Z){return this}addLinks(Z){return this}setStatus(Z){return this}updateName(Z){return this}end(Z){}isRecording(){return false}recordException(Z,ct){}}ct.NonRecordingSpan=NonRecordingSpan},65195:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.NoopTracer=void 0;const pt=ut(51878);const dt=ut(53075);const ft=ut(86480);const _t=ut(73103);const mt=pt.ContextAPI.getInstance();class NoopTracer{startSpan(Z,ct,ut=mt.active()){const pt=Boolean(ct===null||ct===void 0?void 0:ct.root);if(pt){return new ft.NonRecordingSpan}const ht=ut&&(0,dt.getSpanContext)(ut);if(isSpanContext(ht)&&(0,_t.isSpanContextValid)(ht)){return new ft.NonRecordingSpan(ht)}else{return new ft.NonRecordingSpan}}startActiveSpan(Z,ct,ut,pt){let ft;let _t;let ht;if(arguments.length<2){return}else if(arguments.length===2){ht=ct}else if(arguments.length===3){ft=ct;ht=ut}else{ft=ct;_t=ut;ht=pt}const yt=_t!==null&&_t!==void 0?_t:mt.active();const vt=this.startSpan(Z,ft,yt);const St=(0,dt.setSpan)(yt,vt);return mt.with(St,ht,undefined,vt)}}ct.NoopTracer=NoopTracer;function isSpanContext(Z){return Z!==null&&typeof Z==="object"&&"spanId"in Z&&typeof Z["spanId"]==="string"&&"traceId"in Z&&typeof Z["traceId"]==="string"&&"traceFlags"in Z&&typeof Z["traceFlags"]==="number"}},63162:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.NoopTracerProvider=void 0;const pt=ut(65195);class NoopTracerProvider{getTracer(Z,ct,ut){return new pt.NoopTracer}}ct.NoopTracerProvider=NoopTracerProvider},3121:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ProxyTracer=void 0;const pt=ut(65195);const dt=new pt.NoopTracer;class ProxyTracer{constructor(Z,ct,ut,pt){this._provider=Z;this.name=ct;this.version=ut;this.options=pt}startSpan(Z,ct,ut){return this._getTracer().startSpan(Z,ct,ut)}startActiveSpan(Z,ct,ut,pt){const dt=this._getTracer();return Reflect.apply(dt.startActiveSpan,dt,arguments)}_getTracer(){if(this._delegate){return this._delegate}const Z=this._provider.getDelegateTracer(this.name,this.version,this.options);if(!Z){return dt}this._delegate=Z;return this._delegate}}ct.ProxyTracer=ProxyTracer},14440:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.ProxyTracerProvider=void 0;const pt=ut(3121);const dt=ut(63162);const ft=new dt.NoopTracerProvider;class ProxyTracerProvider{getTracer(Z,ct,ut){var dt;return(dt=this.getDelegateTracer(Z,ct,ut))!==null&&dt!==void 0?dt:new pt.ProxyTracer(this,Z,ct,ut)}getDelegate(){var Z;return(Z=this._delegate)!==null&&Z!==void 0?Z:ft}setDelegate(Z){this._delegate=Z}getDelegateTracer(Z,ct,ut){var pt;return(pt=this._delegate)===null||pt===void 0?void 0:pt.getTracer(Z,ct,ut)}}ct.ProxyTracerProvider=ProxyTracerProvider},13122:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.SamplingDecision=void 0;var ut;(function(Z){Z[Z["NOT_RECORD"]=0]="NOT_RECORD";Z[Z["RECORD"]=1]="RECORD";Z[Z["RECORD_AND_SAMPLED"]=2]="RECORD_AND_SAMPLED"})(ut=ct.SamplingDecision||(ct.SamplingDecision={}))},53075:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.getSpanContext=ct.setSpanContext=ct.deleteSpan=ct.setSpan=ct.getActiveSpan=ct.getSpan=void 0;const pt=ut(98089);const dt=ut(86480);const ft=ut(51878);const _t=(0,pt.createContextKey)("OpenTelemetry Context Key SPAN");function getSpan(Z){return Z.getValue(_t)||undefined}ct.getSpan=getSpan;function getActiveSpan(){return getSpan(ft.ContextAPI.getInstance().active())}ct.getActiveSpan=getActiveSpan;function setSpan(Z,ct){return Z.setValue(_t,ct)}ct.setSpan=setSpan;function deleteSpan(Z){return Z.deleteValue(_t)}ct.deleteSpan=deleteSpan;function setSpanContext(Z,ct){return setSpan(Z,new dt.NonRecordingSpan(ct))}ct.setSpanContext=setSpanContext;function getSpanContext(Z){var ct;return(ct=getSpan(Z))===null||ct===void 0?void 0:ct.spanContext()}ct.getSpanContext=getSpanContext},78847:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.TraceStateImpl=void 0;const pt=ut(60626);const dt=32;const ft=512;const _t=",";const mt="=";class TraceStateImpl{constructor(Z){this._internalState=new Map;if(Z)this._parse(Z)}set(Z,ct){const ut=this._clone();if(ut._internalState.has(Z)){ut._internalState.delete(Z)}ut._internalState.set(Z,ct);return ut}unset(Z){const ct=this._clone();ct._internalState.delete(Z);return ct}get(Z){return this._internalState.get(Z)}serialize(){return Array.from(this._internalState.keys()).reduceRight(((Z,ct)=>{Z.push(ct+mt+this.get(ct));return Z}),[]).join(_t)}_parse(Z){if(Z.length>ft)return;this._internalState=Z.split(_t).reduceRight(((Z,ct)=>{const ut=ct.trim();const dt=ut.indexOf(mt);if(dt!==-1){const ft=ut.slice(0,dt);const _t=ut.slice(dt+1,ct.length);if((0,pt.validateKey)(ft)&&(0,pt.validateValue)(_t)){Z.set(ft,_t)}else{}}return Z}),new Map);if(this._internalState.size>dt){this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,dt))}}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const Z=new TraceStateImpl;Z._internalState=new Map(this._internalState);return Z}}ct.TraceStateImpl=TraceStateImpl},60626:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.validateValue=ct.validateKey=void 0;const ut="[_0-9a-z-*/]";const pt=`[a-z]${ut}{0,255}`;const dt=`[a-z0-9]${ut}{0,240}@[a-z]${ut}{0,13}`;const ft=new RegExp(`^(?:${pt}|${dt})$`);const _t=/^[ -~]{0,255}[!-~]$/;const mt=/,|=/;function validateKey(Z){return ft.test(Z)}ct.validateKey=validateKey;function validateValue(Z){return _t.test(Z)&&!mt.test(Z)}ct.validateValue=validateValue},81257:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.createTraceState=void 0;const pt=ut(78847);function createTraceState(Z){return new pt.TraceStateImpl(Z)}ct.createTraceState=createTraceState},12016:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.INVALID_SPAN_CONTEXT=ct.INVALID_TRACEID=ct.INVALID_SPANID=void 0;const pt=ut(12613);ct.INVALID_SPANID="0000000000000000";ct.INVALID_TRACEID="00000000000000000000000000000000";ct.INVALID_SPAN_CONTEXT={traceId:ct.INVALID_TRACEID,spanId:ct.INVALID_SPANID,traceFlags:pt.TraceFlags.NONE}},49339:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.SpanKind=void 0;var ut;(function(Z){Z[Z["INTERNAL"]=0]="INTERNAL";Z[Z["SERVER"]=1]="SERVER";Z[Z["CLIENT"]=2]="CLIENT";Z[Z["PRODUCER"]=3]="PRODUCER";Z[Z["CONSUMER"]=4]="CONSUMER"})(ut=ct.SpanKind||(ct.SpanKind={}))},73103:(Z,ct,ut)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.wrapSpanContext=ct.isSpanContextValid=ct.isValidSpanId=ct.isValidTraceId=void 0;const pt=ut(12016);const dt=ut(86480);const ft=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function isValidHex(Z,ct){if(typeof Z!=="string"||Z.length!==ct)return false;let ut=0;for(let ct=0;ct<Z.length;ct+=4){ut+=(ft[Z.charCodeAt(ct)]|0)+(ft[Z.charCodeAt(ct+1)]|0)+(ft[Z.charCodeAt(ct+2)]|0)+(ft[Z.charCodeAt(ct+3)]|0)}return ut===ct}function isValidTraceId(Z){return isValidHex(Z,32)&&Z!==pt.INVALID_TRACEID}ct.isValidTraceId=isValidTraceId;function isValidSpanId(Z){return isValidHex(Z,16)&&Z!==pt.INVALID_SPANID}ct.isValidSpanId=isValidSpanId;function isSpanContextValid(Z){return isValidTraceId(Z.traceId)&&isValidSpanId(Z.spanId)}ct.isSpanContextValid=isSpanContextValid;function wrapSpanContext(Z){return new dt.NonRecordingSpan(Z)}ct.wrapSpanContext=wrapSpanContext},52036:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.SpanStatusCode=void 0;var ut;(function(Z){Z[Z["UNSET"]=0]="UNSET";Z[Z["OK"]=1]="OK";Z[Z["ERROR"]=2]="ERROR"})(ut=ct.SpanStatusCode||(ct.SpanStatusCode={}))},12613:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.TraceFlags=void 0;var ut;(function(Z){Z[Z["NONE"]=0]="NONE";Z[Z["SAMPLED"]=1]="SAMPLED"})(ut=ct.TraceFlags||(ct.TraceFlags={}))},75918:(Z,ct)=>{"use strict";Object.defineProperty(ct,"__esModule",{value:true});ct.VERSION=void 0;ct.VERSION="1.9.1"},6647:(Z,ct,ut)=>{"use strict";const pt=ut(87016);const dt=ut(16480);const ft={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:pt.URL||URL};ct.analyze=function(Z,ct={}){if(!Z){return dt.code("DOMAIN_NON_EMPTY_STRING")}if(typeof Z!=="string"){throw new Error("Invalid input: domain must be a string")}if(Z.length>256){return dt.code("DOMAIN_TOO_LONG")}const ut=!ft.nonAsciiRx.test(Z);if(!ut){if(ct.allowUnicode===false){return dt.code("DOMAIN_INVALID_UNICODE_CHARS")}Z=Z.normalize("NFC")}if(ft.domainControlRx.test(Z)){return dt.code("DOMAIN_INVALID_CHARS")}Z=ft.punycode(Z);if(ct.allowFullyQualified&&Z[Z.length-1]==="."){Z=Z.slice(0,-1)}const pt=ct.minDomainSegments||ft.minDomainSegments;const _t=Z.split(".");if(_t.length<pt){return dt.code("DOMAIN_SEGMENTS_COUNT")}if(ct.maxDomainSegments){if(_t.length>ct.maxDomainSegments){return dt.code("DOMAIN_SEGMENTS_COUNT_MAX")}}const mt=ct.tlds;if(mt){const Z=_t[_t.length-1].toLowerCase();if(mt.deny&&mt.deny.has(Z)||mt.allow&&!mt.allow.has(Z)){return dt.code("DOMAIN_FORBIDDEN_TLDS")}}for(let Z=0;Z<_t.length;++Z){const ct=_t[Z];if(!ct.length){return dt.code("DOMAIN_EMPTY_SEGMENT")}if(ct.length>63){return dt.code("DOMAIN_LONG_SEGMENT")}if(Z<_t.length-1){if(!ft.domainSegmentRx.test(ct)){return dt.code("DOMAIN_INVALID_CHARS")}}else{if(!ft.tldSegmentRx.test(ct)){return dt.code("DOMAIN_INVALID_TLDS_CHARS")}}}return null};ct.isValid=function(Z,ut){return!ct.analyze(Z,ut)};ft.punycode=function(Z){if(Z.includes("%")){Z=Z.replace(/%/g,"%25")}try{return new ft.URL(`http://${Z}`).host}catch(ct){return Z}}},71099:(Z,ct,ut)=>{"use strict";const pt=ut(39023);const dt=ut(6647);const ft=ut(16480);const _t={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(pt.TextEncoder||TextEncoder)};ct.analyze=function(Z,ct){return _t.email(Z,ct)};ct.isValid=function(Z,ct){return!_t.email(Z,ct)};_t.email=function(Z,ct={}){if(typeof Z!=="string"){throw new Error("Invalid input: email must be a string")}if(!Z){return ft.code("EMPTY_STRING")}const ut=!_t.nonAsciiRx.test(Z);if(!ut){if(ct.allowUnicode===false){return ft.code("FORBIDDEN_UNICODE")}Z=Z.normalize("NFC")}const pt=Z.split("@");if(pt.length!==2){return pt.length>2?ft.code("MULTIPLE_AT_CHAR"):ft.code("MISSING_AT_CHAR")}const[mt,ht]=pt;if(!mt){return ft.code("EMPTY_LOCAL")}if(!ct.ignoreLength){if(Z.length>254){return ft.code("ADDRESS_TOO_LONG")}if(_t.encoder.encode(mt).length>64){return ft.code("LOCAL_TOO_LONG")}}return _t.local(mt,ut)||dt.analyze(ht,ct)};_t.local=function(Z,ct){const ut=Z.split(".");for(const Z of ut){if(!Z.length){return ft.code("EMPTY_LOCAL_SEGMENT")}if(ct){if(!_t.atextRx.test(Z)){return ft.code("INVALID_LOCAL_CHARS")}continue}for(const ct of Z){if(_t.atextRx.test(ct)){continue}const Z=_t.binary(ct);if(!_t.atomRx.test(Z)){return ft.code("INVALID_LOCAL_CHARS")}}}};_t.binary=function(Z){return Array.from(_t.encoder.encode(Z)).map((Z=>String.fromCharCode(Z))).join("")};_t.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/;_t.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:(Z,ct)=>{"use strict";ct.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"};ct.code=function(Z){return{code:Z,error:ct.codes[Z]}}},54990:(Z,ct,ut)=>{"use strict";const pt=ut(99583);const dt=ut(63377);const ft={};ct.regex=function(Z={}){pt(Z.cidr===undefined||typeof Z.cidr==="string","options.cidr must be a string");const ct=Z.cidr?Z.cidr.toLowerCase():"optional";pt(["required","optional","forbidden"].includes(ct),"options.cidr must be one of required, optional, forbidden");pt(Z.version===undefined||typeof Z.version==="string"||Array.isArray(Z.version),"options.version must be a string or an array of string");let ut=Z.version||["ipv4","ipv6","ipvfuture"];if(!Array.isArray(ut)){ut=[ut]}pt(ut.length>=1,"options.version must have at least 1 version specified");for(let Z=0;Z<ut.length;++Z){pt(typeof ut[Z]==="string","options.version must only contain strings");ut[Z]=ut[Z].toLowerCase();pt(["ipv4","ipv6","ipvfuture"].includes(ut[Z]),"options.version contains unknown version "+ut[Z]+" - must be one of ipv4, ipv6, ipvfuture")}ut=Array.from(new Set(ut));const ft=ut.map((Z=>{if(ct==="forbidden"){return dt.ip[Z]}const ut=`\\/${Z==="ipv4"?dt.ip.v4Cidr:dt.ip.v6Cidr}`;if(ct==="required"){return`${dt.ip[Z]}${ut}`}return`${dt.ip[Z]}(?:${ut})?`}));const _t=`(?:${ft.join("|")})`;const mt=new RegExp(`^${_t}$`);return{cidr:ct,versions:ut,regex:mt,raw:_t}}},33618:Z=>{"use strict";const ct={};ct.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"];Z.exports=new Set(ct.tlds.map((Z=>Z.toLowerCase())))},63377:(Z,ct,ut)=>{"use strict";const pt=ut(99583);const dt=ut(43935);const ft={};ft.generate=function(){const Z={};const ct="\\dA-Fa-f";const ut="["+ct+"]";const pt="\\w-\\.~";const dt="!\\$&'\\(\\)\\*\\+,;=";const ft="%"+ct;const _t=pt+ft+dt+":@";const mt="["+_t+"]";const ht="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";Z.ipv4address="(?:"+ht+"\\.){3}"+ht;const yt=ut+"{1,4}";const vt="(?:"+yt+":"+yt+"|"+Z.ipv4address+")";const St="(?:"+yt+":){6}"+vt;const bt="::(?:"+yt+":){5}"+vt;const xt="(?:"+yt+")?::(?:"+yt+":){4}"+vt;const $t="(?:(?:"+yt+":){0,1}"+yt+")?::(?:"+yt+":){3}"+vt;const Et="(?:(?:"+yt+":){0,2}"+yt+")?::(?:"+yt+":){2}"+vt;const Ct="(?:(?:"+yt+":){0,3}"+yt+")?::"+yt+":"+vt;const Tt="(?:(?:"+yt+":){0,4}"+yt+")?::"+vt;const wt="(?:(?:"+yt+":){0,5}"+yt+")?::"+yt;const At="(?:(?:"+yt+":){0,6}"+yt+")?::";Z.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])";Z.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])";Z.ipv6address="(?:"+St+"|"+bt+"|"+xt+"|"+$t+"|"+Et+"|"+Ct+"|"+Tt+"|"+wt+"|"+At+")";Z.ipvFuture="v"+ut+"+\\.["+pt+dt+":]+";Z.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*";Z.schemeRegex=new RegExp(Z.scheme);const kt="["+pt+ft+dt+":]*";const It="\\[(?:"+Z.ipv6address+"|"+Z.ipvFuture+")\\]";const Nt="["+pt+ft+dt+"]{1,255}";const Pt="(?:"+It+"|"+Z.ipv4address+"|"+Nt+")";const Ot="\\d*";const Dt="(?:"+kt+"@)?"+Pt+"(?::"+Ot+")?";const Ft="(?:"+kt+"@)?("+Pt+")(?::"+Ot+")?";const Mt=mt+"*";const Lt=mt+"+";const Rt="["+pt+ft+dt+"@"+"]+";const Bt="";const Vt="(?:\\/"+Mt+")*";const jt="\\/(?:"+Lt+Vt+")?";const Ut=Lt+Vt;const Jt=Rt+Vt;const zt="(?:\\/\\/\\/"+Mt+Vt+")";Z.hierPart="(?:"+"(?:\\/\\/"+Dt+Vt+")"+"|"+jt+"|"+Ut+"|"+zt+")";Z.hierPartCapture="(?:"+"(?:\\/\\/"+Ft+Vt+")"+"|"+jt+"|"+Ut+")";Z.relativeRef="(?:"+"(?:\\/\\/"+Dt+Vt+")"+"|"+jt+"|"+Jt+"|"+Bt+")";Z.relativeRefCapture="(?:"+"(?:\\/\\/"+Ft+Vt+")"+"|"+jt+"|"+Jt+"|"+Bt+")";Z.query="["+_t+"\\/\\?]*(?=#|$)";Z.queryWithSquareBrackets="["+_t+"\\[\\]\\/\\?]*(?=#|$)";Z.fragment="["+_t+"\\/\\?]*";return Z};ft.rfc3986=ft.generate();ct.ip={v4Cidr:ft.rfc3986.ipv4Cidr,v6Cidr:ft.rfc3986.ipv6Cidr,ipv4:ft.rfc3986.ipv4address,ipv6:ft.rfc3986.ipv6address,ipvfuture:ft.rfc3986.ipvFuture};ft.createRegex=function(Z){const ct=ft.rfc3986;const ut=Z.allowQuerySquareBrackets?ct.queryWithSquareBrackets:ct.query;const _t="(?:\\?"+ut+")?"+"(?:#"+ct.fragment+")?";const mt=Z.domain?ct.relativeRefCapture:ct.relativeRef;if(Z.relativeOnly){return ft.wrap(mt+_t)}let ht="";if(Z.scheme){pt(Z.scheme instanceof RegExp||typeof Z.scheme==="string"||Array.isArray(Z.scheme),"scheme must be a RegExp, String, or Array");const ut=[].concat(Z.scheme);pt(ut.length>=1,"scheme must have at least 1 scheme specified");const ft=[];for(let Z=0;Z<ut.length;++Z){const _t=ut[Z];pt(_t instanceof RegExp||typeof _t==="string","scheme at position "+Z+" must be a RegExp or String");if(_t instanceof RegExp){ft.push(_t.source.toString())}else{pt(ct.schemeRegex.test(_t),"scheme at position "+Z+" must be a valid scheme");ft.push(dt(_t))}}ht=ft.join("|")}const yt=ht?"(?:"+ht+")":ct.scheme;const vt="(?:"+yt+":"+(Z.domain?ct.hierPartCapture:ct.hierPart)+")";const St=Z.allowRelative?"(?:"+vt+"|"+mt+")":vt;return ft.wrap(St+_t,ht)};ft.wrap=function(Z,ct){Z=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${Z}`;return{raw:Z,regex:new RegExp(`^${Z}$`),scheme:ct}};ft.uriRegex=ft.createRegex({});ct.regex=function(Z={}){if(Z.scheme||Z.allowRelative||Z.relativeOnly||Z.allowQuerySquareBrackets||Z.domain){return ft.createRegex(Z)}return ft.uriRegex}},25673:(Z,ct)=>{"use strict";const ut={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};ct.Parser=class{constructor(Z,ct={}){if(!ct[ut.settings]&&ct.constants){for(const Z in ct.constants){const ut=ct.constants[Z];if(ut!==null&&!["boolean","number","string"].includes(typeof ut)){throw new Error(`Formula constant ${Z} contains invalid ${typeof ut} value type`)}}}this.settings=ct[ut.settings]?ct:Object.assign({[ut.settings]:true,constants:{},functions:{}},ct);this.single=null;this._parts=null;this._parse(Z)}_parse(Z){let pt=[];let dt="";let ft=0;let _t=false;const flush=Z=>{if(ft){throw new Error("Formula missing closing parenthesis")}const mt=pt.length?pt[pt.length-1]:null;if(!_t&&!dt&&!Z){return}if(mt&&mt.type==="reference"&&Z===")"){mt.type="function";mt.value=this._subFormula(dt,mt.value);dt="";return}if(Z===")"){const Z=new ct.Parser(dt,this.settings);pt.push({type:"segment",value:Z})}else if(_t){if(_t==="]"){pt.push({type:"reference",value:dt});dt="";return}pt.push({type:"literal",value:dt})}else if(ut.operatorCharacters.includes(dt)){if(mt&&mt.type==="operator"&&ut.operators.includes(mt.value+dt)){mt.value+=dt}else{pt.push({type:"operator",value:dt})}}else if(dt.match(ut.numberRx)){pt.push({type:"constant",value:parseFloat(dt)})}else if(this.settings.constants[dt]!==undefined){pt.push({type:"constant",value:this.settings.constants[dt]})}else{if(!dt.match(ut.tokenRx)){throw new Error(`Formula contains invalid token: ${dt}`)}pt.push({type:"reference",value:dt})}dt=""};for(const ct of Z){if(_t){if(ct===_t){flush();_t=false}else{dt+=ct}}else if(ft){if(ct==="("){dt+=ct;++ft}else if(ct===")"){--ft;if(!ft){flush(ct)}else{dt+=ct}}else{dt+=ct}}else if(ct in ut.literals){_t=ut.literals[ct]}else if(ct==="("){flush();++ft}else if(ut.operatorCharacters.includes(ct)){flush();dt=ct;flush()}else if(ct!==" "){dt+=ct}else{flush()}}flush();pt=pt.map(((Z,ct)=>{if(Z.type!=="operator"||Z.value!=="-"||ct&&pt[ct-1].type!=="operator"){return Z}return{type:"operator",value:"n"}}));let mt=false;for(const Z of pt){if(Z.type==="operator"){if(ut.operatorsPrefix.includes(Z.value)){continue}if(!mt){throw new Error("Formula contains an operator in invalid position")}if(!ut.operators.includes(Z.value)){throw new Error(`Formula contains an unknown operator ${Z.value}`)}}else if(mt){throw new Error("Formula missing expected operator")}mt=!mt}if(!mt){throw new Error("Formula contains invalid trailing operator")}if(pt.length===1&&["reference","literal","constant"].includes(pt[0].type)){this.single={type:pt[0].type==="reference"?"reference":"value",value:pt[0].value}}this._parts=pt.map((Z=>{if(Z.type==="operator"){return ut.operatorsPrefix.includes(Z.value)?Z:Z.value}if(Z.type!=="reference"){return Z.value}if(this.settings.tokenRx&&!this.settings.tokenRx.test(Z.value)){throw new Error(`Formula contains invalid reference ${Z.value}`)}if(this.settings.reference){return this.settings.reference(Z.value)}return ut.reference(Z.value)}))}_subFormula(Z,pt){const dt=this.settings.functions[pt];if(typeof dt!=="function"){throw new Error(`Formula contains unknown function ${pt}`)}let ft=[];if(Z){let ct="";let dt=0;let _t=false;const flush=()=>{if(!ct){throw new Error(`Formula contains function ${pt} with invalid arguments ${Z}`)}ft.push(ct);ct=""};for(let pt=0;pt<Z.length;++pt){const ft=Z[pt];if(_t){ct+=ft;if(ft===_t){_t=false}}else if(ft in ut.literals&&!dt){ct+=ft;_t=ut.literals[ft]}else if(ft===","&&!dt){flush()}else{ct+=ft;if(ft==="("){++dt}else if(ft===")"){--dt}}}flush()}ft=ft.map((Z=>new ct.Parser(Z,this.settings)));return function(Z){const ct=[];for(const ut of ft){ct.push(ut.evaluate(Z))}return dt.call(Z,...ct)}}evaluate(Z){const ct=this._parts.slice();for(let pt=ct.length-2;pt>=0;--pt){const dt=ct[pt];if(dt&&dt.type==="operator"){const ft=ct[pt+1];ct.splice(pt+1,1);const _t=ut.evaluate(ft,Z);ct[pt]=ut.single(dt.value,_t)}}ut.operatorsOrder.forEach((pt=>{for(let dt=1;dt<ct.length-1;){if(pt.includes(ct[dt])){const pt=ct[dt];const ft=ut.evaluate(ct[dt-1],Z);const _t=ut.evaluate(ct[dt+1],Z);ct.splice(dt,2);const mt=ut.calculate(pt,ft,_t);ct[dt-1]=mt===0?0:mt}else{dt+=2}}}));return ut.evaluate(ct[0],Z)}};ct.Parser.prototype[ut.symbol]=true;ut.reference=function(Z){return function(ct){return ct&&ct[Z]!==undefined?ct[Z]:null}};ut.evaluate=function(Z,ct){if(Z===null){return null}if(typeof Z==="function"){return Z(ct)}if(Z[ut.symbol]){return Z.evaluate(ct)}return Z};ut.single=function(Z,ct){if(Z==="!"){return ct?false:true}const ut=-ct;if(ut===0){return 0}return ut};ut.calculate=function(Z,ct,pt){if(Z==="??"){return ut.exists(ct)?ct:pt}if(typeof ct==="string"||typeof pt==="string"){if(Z==="+"){ct=ut.exists(ct)?ct:"";pt=ut.exists(pt)?pt:"";return ct+pt}}else{switch(Z){case"^":return Math.pow(ct,pt);case"*":return ct*pt;case"/":return ct/pt;case"%":return ct%pt;case"+":return ct+pt;case"-":return ct-pt}}switch(Z){case"<":return ct<pt;case"<=":return ct<=pt;case">":return ct>pt;case">=":return ct>=pt;case"==":return ct===pt;case"!=":return ct!==pt;case"&&":return ct&&pt;case"||":return ct||pt}return null};ut.exists=function(Z){return Z!==null&&Z!==undefined}},533:(Z,ct)=>{"use strict";const ut={};ct.location=function(Z=0){const ct=Error.prepareStackTrace;Error.prepareStackTrace=(Z,ct)=>ct;const ut={};Error.captureStackTrace(ut,this);const pt=ut.stack[Z+1];Error.prepareStackTrace=ct;return{filename:pt.getFileName(),line:pt.getLineNumber()}}},44547:(Z,ct,ut)=>{"use strict";
|
|
3
3
|
/**
|
|
4
4
|
* @vue/compiler-core v3.5.34
|