@cyberskill/shared 1.97.0 → 1.98.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/configs/config.util.cjs +1 -1
  2. package/dist/configs/config.util.js +1 -1
  3. package/dist/configs/env/env.util.cjs +1 -1
  4. package/dist/configs/env/env.util.js +1 -1
  5. package/dist/configs/env/index.cjs +1 -1
  6. package/dist/configs/env/index.js +1 -1
  7. package/dist/configs/index.cjs +1 -1
  8. package/dist/configs/index.js +1 -1
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/nodejs/apollo-server/apollo-server.util.cjs +1 -1
  12. package/dist/nodejs/apollo-server/apollo-server.util.js +1 -1
  13. package/dist/nodejs/apollo-server/index.cjs +1 -1
  14. package/dist/nodejs/apollo-server/index.js +1 -1
  15. package/dist/nodejs/cli/cli.util.cjs +1 -1
  16. package/dist/nodejs/cli/cli.util.js +1 -1
  17. package/dist/nodejs/cli/index.cjs +1 -1
  18. package/dist/nodejs/cli/index.js +1 -1
  19. package/dist/nodejs/command/command.util.cjs +1 -1
  20. package/dist/nodejs/command/command.util.js +1 -1
  21. package/dist/nodejs/command/index.cjs +1 -1
  22. package/dist/nodejs/command/index.js +1 -1
  23. package/dist/nodejs/index.cjs +1 -1
  24. package/dist/nodejs/index.js +1 -1
  25. package/dist/nodejs/log/index.cjs +1 -1
  26. package/dist/nodejs/log/index.js +1 -1
  27. package/dist/nodejs/log/log.util.cjs +1 -1
  28. package/dist/nodejs/log/log.util.js +1 -1
  29. package/dist/nodejs/package/index.cjs +1 -1
  30. package/dist/nodejs/package/index.js +1 -1
  31. package/dist/nodejs/package/package.util.cjs +1 -1
  32. package/dist/nodejs/package/package.util.js +1 -1
  33. package/dist/nodejs/path/index.cjs +1 -1
  34. package/dist/nodejs/path/index.js +1 -1
  35. package/dist/nodejs/path/path.constant.cjs +1 -1
  36. package/dist/nodejs/path/path.constant.js +1 -1
  37. package/dist/nodejs/path/path.util.cjs +1 -1
  38. package/dist/nodejs/path/path.util.js +1 -1
  39. package/dist/nodejs/storage/index.cjs +1 -1
  40. package/dist/nodejs/storage/index.js +1 -1
  41. package/dist/nodejs/storage/storage.util.cjs +1 -1
  42. package/dist/nodejs/storage/storage.util.js +1 -1
  43. package/dist/react/index.cjs +1 -1
  44. package/dist/react/index.js +1 -1
  45. package/dist/react/vitest/index.cjs +1 -1
  46. package/dist/react/vitest/index.js +1 -1
  47. package/dist/react/vitest/vitest.unit.cjs +1 -1
  48. package/dist/react/vitest/vitest.unit.js +1 -1
  49. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,n,r,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,s)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,c,"next",e)}function c(e){s(o,r,i,a,c,"throw",e)}a(undefined)})}}function o(e,t,n){t=d(t);return C(e,M()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function u(e,t,n){if(t)c(e.prototype,t);if(n)c(e,n);return e}function l(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function d(e){d=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return d(e)}function f(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)I(e,t)}function p(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function E(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function g(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,a;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw a}}return r}function h(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){l(e,t,n[t])})}return e}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(t){r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}n.push.apply(n,r)}return n}function _(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{y(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function S(e,t){if(e==null)return{};var n=O(e,t);var r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){r=i[s];if(t.indexOf(r)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;n[r]=e[r]}}return n}function O(e,t){if(e==null)return{};var n={};var r=Object.keys(e);var s,i;for(i=0;i<r.length;i++){s=r[i];if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function C(e,t){if(t&&(R(t)==="object"||typeof t==="function")){return t}return r(e)}function I(e,t){I=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return I(e,t)}function A(e,n){return t(e)||g(e,n)||N(e,n)||h()}function T(e){return n(e)||E(e)||N(e)||v()}function R(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function N(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(M=function(){return!!e})()}function L(e,t){var n,r,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(n=1,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var D=Object.create;var b=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var j=function(e,t,n){return t in e?b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n};var k=function(e,t){return b(e,"name",{value:t,configurable:!0})};var U=function(e,t){for(var n in t)b(e,n,{get:t[n],enumerable:!0})},q=function(e,t,n,r){var s=true,i=false,o=undefined;if(t&&(typeof t==="undefined"?"undefined":R(t))=="object"||typeof t=="function")try{var a=function(){var s=u.value;!x.call(e,s)&&s!==n&&b(e,s,{get:function(){return t[s]},enumerable:!(r=P(t,s))||r.enumerable})};for(var c=G(t)[Symbol.iterator](),u;!(s=(u=c.next()).done);s=true)a()}catch(e){i=true;o=e}finally{try{if(!s&&c.return!=null){c.return()}}finally{if(i){throw o}}}return e};var K=function(e,t,n){return n=e!=null?D(w(e)):{},q(t||!e||!e.__esModule?b(n,"default",{value:e,enumerable:!0}):n,e)},F=function(e){return q(b({},"__esModule",{value:!0}),e)};var H=function(e,t,n){return j(e,(typeof t==="undefined"?"undefined":R(t))!="symbol"?t+"":t,n)};var Y={};U(Y,{BUILD_DIRECTORY:function(){return ej},CHECK_PACKAGE_EMPTY_RESULT:function(){return e_},COMMIT_LINT_CLI:function(){return e1},COMMIT_LINT_PACKAGE_NAME:function(){return e0},CYBERSKILL_CLI:function(){return eV},CYBERSKILL_CLI_PATH:function(){return eJ},CYBERSKILL_DIRECTORY:function(){return eW},CYBERSKILL_PACKAGE_NAME:function(){return ew},C_Collection:function(){return n0},C_Db:function(){return nJ},C_Document:function(){return n$},C_Model:function(){return nz},ESLINT_CLI:function(){return e$},ESLINT_INSPECT_CLI:function(){return tr},ESLINT_INSPECT_PACKAGE_NAME:function(){return tn},ESLINT_PACKAGE_NAME:function(){return eQ},E_CommandType:function(){return eh},E_IssueType:function(){return Q},GIT_CLI:function(){return e6},GIT_COMMIT_EDITMSG:function(){return eB},GIT_HOOK:function(){return eY},GIT_IGNORE:function(){return eK},HOOK:function(){return tu},LINT_STAGED_CLI:function(){return e4},LINT_STAGED_PACKAGE_NAME:function(){return e2},MIGRATE_MONGO_CLI:function(){return ta},MIGRATE_MONGO_PACKAGE_NAME:function(){return to},MongoController:function(){return nF},MongooseController:function(){return nY},NODE_MODULES:function(){return ex},NODE_MODULES_INSPECT_CLI:function(){return ti},NODE_MODULES_INSPECT_PACKAGE_NAME:function(){return ts},PACKAGE_JSON:function(){return ek},PACKAGE_LOCK_JSON:function(){return eU},PATH:function(){return tc},PLAYWRIGHT_PACKAGE_NAME:function(){return ez},PNPM_CLI:function(){return e9},PNPM_EXEC_CLI:function(){return e7},PNPM_LOCK_YAML:function(){return eH},SIMPLE_GIT_HOOKS_PACKAGE_NAME:function(){return te},SIMPLE_GIT_HOOK_CLI:function(){return tt},SIMPLE_GIT_HOOK_JSON:function(){return eF},TSCONFIG_JSON:function(){return eq},TSC_CLI:function(){return e5},TSC_PACKAGE_NAME:function(){return e3},TSX_CLI:function(){return e8},VITEST_CLI:function(){return eZ},VITEST_PACKAGE_NAME:function(){return eX},WORKING_DIRECTORY:function(){return eG},aggregatePaginate:function(){return nD.default},appendFileSync:function(){return eT},checkPackage:function(){return tm},clearAllErrorLists:function(){return tx},command:function(){return tp},createApolloServer:function(){return ed},createCors:function(){return nA},createExpress:function(){return nT},createWSServer:function(){return n4},existsSync:function(){return eC},express:function(){return nO.default},expressMiddleware:function(){return W.expressMiddleware},formatCommand:function(){return tY},getLatestPackageVersion:function(){return th},getPackage:function(){return tg},getStoredErrorLists:function(){return tG},initGraphQLWS:function(){return n3},installDependencies:function(){return t_},join:function(){return eb},logNodeJS:function(){return el},mongo:function(){return nq},mongoosePaginate:function(){return nb.default},rawCommand:function(){return tF},readFileSync:function(){return eI},resolve:function(){return eD},resolveCommands:function(){return tB},resolveWorkingPath:function(){return eL},rmSync:function(){return eR},runCommand:function(){return tV},setMongoMigrateConfig:function(){return nN},setupPackages:function(){return tO},storageNodeJS:function(){return tN},throwError:function(){return ec},writeFileSync:function(){return eA}});module.exports=F(Y);var B=require("@apollo/server"),W=require("@apollo/server/express4"),V=require("@apollo/server/plugin/drainHttpServer"),J=require("@apollo/server/plugin/landingPage/default");var Q=function(e){return e.Error="error",e.Warning="warning",e}({});var $=K(require("chalk"),1),X=K(require("consola"),1),z=require("graphql");var Z=".cyberskill-storage";var ee=K(require("dotenv"),1),et=require("envalid"),en=K(require("os"),1),er=K(require("path"),1),es=K(require("process"),1);ee.default.config();function ei(){var e={DEBUG:es.default.env.DEBUG||!1,CWD:es.default.env.CWD,CYBERSKILL_STORAGE_DIRECTORY:es.default.env.CYBERSKILL_STORAGE_DIRECTORY||Z};return(0,et.cleanEnv)(e,{DEBUG:(0,et.bool)(),CWD:(0,et.str)({default:es.default.cwd()}),CYBERSKILL_STORAGE_DIRECTORY:(0,et.str)({default:er.default.join(en.default.homedir(),Z)})})}k(ei,"getEnv");var eo={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var ea=ei();function ec(e){var t=e.message,n=e.status,r=n===void 0?eo.INTERNAL_SERVER_ERROR:n,s=e.type,i=s===void 0?"graphql":s;var o;var a=(o=t!==null&&t!==void 0?t:r.MESSAGE)!==null&&o!==void 0?o:"Internal server error";throw i==="graphql"?new z.GraphQLError(a,{extensions:{code:r.CODE}}):new Error(a)}k(ec,"throwError");ea.DEBUG||(X.default.level=4);function eu(e){var t=$.default[e];return typeof t=="function"?t:$.default.green}k(eu,"chalkKeyword");var el={silent:X.default.silent,level:X.default.level,fatal:X.default.fatal,error:X.default.error,warn:X.default.warn,log:X.default.log,info:X.default.info,success:X.default.success,ready:X.default.ready,start:X.default.start,box:X.default.box,debug:X.default.debug,trace:X.default.trace,verbose:X.default.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){X.default.box($.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;X.default.log("".concat($.default.gray("File:")," ").concat($.default.blue("".concat(t).concat(r?":".concat(r):"")))),s&&X.default.log(" ".concat(eu(n)("Rule:")," ").concat(s)),X.default.log(" ".concat(eu(n)("Message:")," ").concat(i))}),X.default.box(eu(n)("".concat(e," : ").concat(t.length))),X.default.log($.default.gray("─".repeat(40)))}};function ed(e){return new B.ApolloServer(m({schema:e.schema,plugins:[e.isDev?(0,J.ApolloServerPluginLandingPageLocalDefault)():(0,J.ApolloServerPluginLandingPageProductionDefault)(),(0,V.ApolloServerPluginDrainHttpServer)({httpServer:e.server})].concat(T(e.drainServer?[{serverWillStart:function t(){return i(function(){return L(this,function(t){return[2,{drainServer:function t(){return i(function(){var t;return L(this,function(n){(t=e.drainServer)===null||t===void 0?void 0:t.call(e),el.info("Apollo Server drainServer hook called");return[2]})})()}}]})})()}}]:[]))},e.isDev&&{introspection:!0,includeStacktraceInErrorResponses:!0}))}k(ed,"createApolloServer");var ef=K(require("process"),1),ep=require("yargs/helpers"),eE=K(require("yargs/yargs"),1);var eg={name:"@cyberskill/shared",type:"module",version:"1.96.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.8","@apollo/server":"4.12.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.4","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.4","@next/eslint-plugin-next":"15.3.1","@swc/core":"1.11.21","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0",dotenv:"16.5.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.0",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.52.0","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.2",vitest:"3.1.1","vitest-browser-react":"0.1.1",ws:"8.18.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/compression":"1.7.5","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.0","lint-staged":"15.5.1","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var eh=function(e){return e.CLI="CLI",e.RAW="RAW",e}({});var ev=require("child_process"),em=K(require("process"),1),ey=K(require("util"),1);var e_={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var eS=K(require("node-fetch"),1);var eO=K(require("fs"),1);function eC(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return eO.existsSync(e)})}k(eC,"existsSync");function eI(e,t){var n=eO.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":R(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}k(eI,"readFileSync");function eA(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":R(t))=="object"?JSON.stringify(t,null,4):String(t);eO.writeFileSync(e,i,"utf-8")}k(eA,"writeFileSync");function eT(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":R(t))=="object"?JSON.stringify(t,null,4):String(t);eO.appendFileSync(e,i,"utf-8")}k(eT,"appendFileSync");function eR(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){eC(e)&&eO.rmSync(e,{recursive:!0,force:!0})})}k(eR,"rmSync");var eN=K(require("path"),1);var eM=ei();function eL(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eN).resolve.apply(r,[eM.CWD].concat(T(t)))}k(eL,"resolveWorkingPath");function eD(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eN).resolve.apply(r,T(t))}k(eD,"resolve");function eb(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eN).join.apply(r,T(t))}k(eb,"join");var eP=ei(),eG=eP.CWD,ew="@cyberskill/shared",ex="node_modules",ej="dist",ek="package.json",eU="package-lock.json",eq="tsconfig.json",eK=".gitignore",eF=".simple-git-hooks.json",eH="pnpm-lock.yaml",eY=".git/hooks/",eB=".git/COMMIT_EDITMSG",eW=eb(eG,ex,ew,ej),eV="cyberskill",eJ="src/nodejs/cli/index.ts",eQ="eslint",e$="eslint",eX="vitest",ez="playwright",eZ="vitest",e0="@commitlint/cli",e1="commitlint",e2="lint-staged",e4="lint-staged",e3="typescript",e5="tsc",e8="tsx",e6="git",e9="pnpm",e7="pnpm exec",te="simple-git-hooks",tt="simple-git-hooks",tn="@eslint/config-inspector",tr="eslint-config-inspector",ts="node-modules-inspector",ti="node-modules-inspector",to="migrate-mongo",ta="migrate-mongo",tc={CYBERSKILL_DIRECTORY:eW,WORKING_DIRECTORY:eG,TS_CONFIG:eL(eq),GIT_IGNORE:eL(eK),GIT_HOOK:eL(eY),GIT_COMMIT_MSG:eL(eB),SIMPLE_GIT_HOOKS_JSON:eL(eF),PACKAGE_JSON:eL(ek),PACKAGE_LOCK_JSON:eL(eU),PNPM_LOCK_YAML:eL(eH),NODE_MODULES:eL(ex),LINT_STAGED_CONFIG:eL("".concat(eW,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:eL("".concat(eW,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:eL("".concat(eW,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eL("".concat(eW,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eL("".concat(eW,"/react/vitest/vitest.e2e.js"))};function tu(e){var t=e.isCurrentProject;return m({"pre-commit":e4,"commit-msg":e1},t&&{"pre-push":tF("".concat(e6," pull"))})}k(tu,"HOOK");function tl(e){return td.apply(this,arguments)}function td(){td=i(function(e){var t,n,r,s,i,o;var a=arguments;return L(this,function(c){switch(c.label){case 0:for(t=a.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=a[r]}s=A(n,2),i=s[0],o=s[1];if(!i)throw new Error("'first' argument is undefined");switch(e){case eh.CLI:return[3,1];case eh.RAW:return[3,3]}return[3,4];case 1:return[4,tO(i.split(" "),{update:!0})];case 2:return[2,(c.sent(),tY(tF("".concat(e7," ").concat(o))))];case 3:return[2,tY(tF(i))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return td.apply(this,arguments)}k(tl,"buildCommand");function tf(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/i(function(){return L(this,function(t){return[2,tl.apply(void 0,[e].concat(T(n)))]})})}k(tf,"commandFactory");var tp={simpleGitHooks:tf(eh.CLI,te,tt),eslintInspect:tf(eh.CLI,tn,tr),nodeModulesInspect:tf(eh.CLI,ts,ti),eslintCheck:tf(eh.CLI,eQ,"".concat(e$," ").concat(tc.WORKING_DIRECTORY)),eslintFix:tf(eh.CLI,eQ,"".concat(e$," ").concat(tc.WORKING_DIRECTORY," --fix")),typescriptCheck:tf(eh.CLI,e3,"".concat(e5," -p ").concat(tc.TS_CONFIG," --noEmit")),configureGitHook:tf(eh.RAW,"".concat(e6," config core.hooksPath ").concat(tc.GIT_HOOK)),testUnit:tf(eh.CLI,eX,"".concat(eZ," --config ").concat(tc.UNIT_TEST_CONFIG)),testE2e:tf(eh.CLI,"".concat(eX," ").concat(ez),"".concat(eZ," --config ").concat(tc.E2E_TEST_CONFIG)),mongoMigrateCreate:k(function(e){return tf(eh.CLI,"".concat(to),"".concat(ta," create ").concat(e))()},"mongoMigrateCreate"),mongoMigrateUp:tf(eh.CLI,"".concat(to),"".concat(ta," up")),mongoMigrateDown:tf(eh.CLI,"".concat(to),"".concat(ta," down")),commitLint:tf(eh.CLI,e0,"".concat(e1," --edit ").concat(tc.GIT_COMMIT_MSG," --config ").concat(tc.COMMITLINT_CONFIG)),lintStaged:tf(eh.CLI,e2,"".concat(e4," --config ").concat(tc.LINT_STAGED_CONFIG)),stageBuildDirectory:tf(eh.RAW,"".concat(e6," add ").concat(ej)),build:tf(eh.RAW,"".concat(e9," run build")),pnpmInstallStandard:tf(eh.RAW,"".concat(e9," install")),pnpmInstallLegacy:tf(eh.RAW,"".concat(e9," install --legacy-peer-deps")),pnpmInstallForce:tf(eh.RAW,"".concat(e9," install --force"))};var tE=ei();function tg(e){var t=eb(tE.CWD,ek);if(!eC(t))return!1;try{var n=eI(t,{asJson:!0}),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,a=o===void 0?{}:o,c=r===e,u=e in i,l=e in a;return c||u||l?{path:t,file:n,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return el.warn("Failed to read package.json: ".concat(e.message)),!1}}k(tg,"getPackage");function th(e){return tv.apply(this,arguments)}function tv(){tv=i(function(e){var t,n,r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,(0,eS.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw el.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})});return tv.apply(this,arguments)}k(th,"getLatestPackageVersion");function tm(e,t){return ty.apply(this,arguments)}function ty(){ty=i(function(e,t){var n,r,s,i,o,a,c,u,l,d,f,p,E,g,h,v,y,_,S,O,C;return L(this,function(I){switch(I.label){case 0:I.trys.push([0,4,,5]);n=tg(e);if(!n)return[2,m({},e_)];c=n.path,u=n.file,l=n.isCurrentProject,d=n.isDepend,f=n.isDevDepend,p=(r=u.dependencies)!==null&&r!==void 0?r:{},E=(s=u.devDependencies)!==null&&s!==void 0?s:{},g=l?(i=u.version)!==null&&i!==void 0?i:"0.0.0":d?(o=p[e])!==null&&o!==void 0?o:"0.0.0":f?(a=E[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!l)return[3,1];y=g;return[3,3];case 1:return[4,th(e)];case 2:y=I.sent();I.label=3;case 3:h=y,v=l||g===h;if(!v&&(t===null||t===void 0?void 0:t.update)){;S=d?"dependencies":f?"devDependencies":null;S&&((_=u[S])===null||_===void 0?void 0:_[e])!==h&&(u[S]=(O=u[S])!==null&&O!==void 0?O:{},u[S][e]=h,eA(c,u,{isJson:!0}),el.info('Updated "'.concat(e,'" to version ').concat(h)))}return[2,{isCurrentProject:l,installedPath:c,file:u,isUpToDate:v}];case 4:C=I.sent();return[2,(el.error('Error checking package "'.concat(e,'": ').concat(C.message)),m({},e_))];case 5:return[2]}})});return ty.apply(this,arguments)}k(tm,"checkPackage");function t_(){return tS.apply(this,arguments)}function tS(){tS=i(function(){var e,t,n,r,s,i,o,a,c,u,l,d;return L(this,function(f){switch(f.label){case 0:e=[{command:k(function(){return tp.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:k(function(){return tp.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:k(function(){return tp.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);s=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,a()];case 4:u=f.sent();return[4,tV("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();el.warn("Installation attempt failed: ".concat(c)),el.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return tS.apply(this,arguments)}k(t_,"installDependencies");function tO(e,t){return tC.apply(this,arguments)}function tC(){tC=i(function(e,t){var n,r,s,i,o,a,c,u,l,d,f;return L(this,function(p){switch(p.label){case 0:if(!eC(tc.PACKAGE_JSON)){el.error("package.json not found. Aborting setup.");return[2]}p.label=1;case 1:p.trys.push([1,13,,14]);n=T(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return tm(e,m({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=p.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,t_()];case 3:r=p.sent();p.label=4;case 4:r;i=true,o=false,a=undefined;p.label=5;case 5:p.trys.push([5,10,11,12]);c=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();p.label=6;case 6:if(!!(i=(u=c.next()).done))return[3,9];l=u.value;return[4,l()];case 7:p.sent();p.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=p.sent();o=true;a=d;return[3,12];case 11:try{if(!i&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:f=p.sent();throw el.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})});return tC.apply(this,arguments)}k(tO,"setupPackages");var tI=K(require("node-persist"),1);var tA=ei();function tT(){return tR.apply(this,arguments)}function tR(){tR=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=tI.default.defaultInstance;if(e)return[3,2];return[4,tI.default.init({dir:tA.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return tR.apply(this,arguments)}k(tT,"initNodePersist");var tN={get:function e(e){return i(function(){var t,n;return L(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tT()];case 1:r.sent();return[4,tI.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(el.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return L(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tT()];case 1:r.sent();return[4,tI.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();el.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return L(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tT()];case 1:n.sent();return[4,tI.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();el.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return L(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tT()];case 1:n.sent();return[4,tI.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(el.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(el.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return L(this,function(t){try{return[2,"".concat(tA.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(el.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var tM=ei(),tL=ey.promisify(ev.exec);function tD(e){return"error_list:".concat(e)}k(tD,"getErrorListKey");function tb(e){return tP.apply(this,arguments)}function tP(){tP=i(function(e){var t,n,r;return L(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=tD(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,tN.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return L(this,function(t){switch(t.label){case 0:return[4,tN.getLogLink(n)];case 1:e=t.sent();e&&el.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=s.sent();el.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return tP.apply(this,arguments)}k(tb,"saveErrorListToStorage");function tG(){return tw.apply(this,arguments)}function tw(){tw=i(function(){var e,t,n;return L(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tN.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=i(function(e){var t;return L(this,function(n){switch(n.label){case 0:return[4,tN.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(el.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return tw.apply(this,arguments)}k(tG,"getStoredErrorLists");function tx(){return tj.apply(this,arguments)}function tj(){tj=i(function(){var e,t,n;return L(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tN.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return tN.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();el.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return tj.apply(this,arguments)}k(tx,"clearAllErrorLists");function tk(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var a,c,u,l,d;var f=s.exec(e)||[],p=i.exec(e)||[],E=o.exec(e)||[];var g,h,v,m,y,_;f.length&&r?t.push({file:r,position:"".concat(f[1],":").concat(f[2]),type:f[3]===Q.Error?Q.Error:Q.Warning,message:(g=f===null||f===void 0?void 0:(a=f[4])===null||a===void 0?void 0:a.trim())!==null&&g!==void 0?g:"",rule:(h=f===null||f===void 0?void 0:(c=f[5])===null||c===void 0?void 0:c.trim())!==null&&h!==void 0?h:""}):p.length?t.push({file:(v=p===null||p===void 0?void 0:p[1])!==null&&v!==void 0?v:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===Q.Error?Q.Error:Q.Warning,message:(m=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&m!==void 0?m:""}):E.length?t.push({file:"commitlint",type:Q.Error,message:(y=E===null||E===void 0?void 0:(l=E[1])===null||l===void 0?void 0:l.trim())!==null&&y!==void 0?y:"",rule:(_=E===null||E===void 0?void 0:(d=E[2])===null||d===void 0?void 0:d.trim())!==null&&_!==void 0?_:""}):n.push(e.trim())}}),t.length&&tb(t),tM.DEBUG&&n.length&&(el.warn("Unmatched lines:"),n.forEach(function(e){return el.info(" ".concat(e))}))}k(tk,"parseTextErrors");function tU(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?Q.Error:Q.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),n.length&&tb(n)}catch(t){tk(e)}}k(tU,"parseCommandOutput");function tq(e){return tK.apply(this,arguments)}function tK(){tK=i(function(e){var t,n,r,s,i,o,a,c,u;var l=arguments;return L(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:tU;n=new AbortController;em.default.on("SIGINT",function(){el.warn("Process interrupted. Terminating..."),n.abort(),em.default.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,tL(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&el.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return tK.apply(this,arguments)}k(tq,"executeCommand");function tF(e){return{raw:!0,cmd:e}}k(tF,"rawCommand");function tH(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(e7," ").concat(ew," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(e7," ").concat(e8," ").concat(eJ," ").concat(e):"".concat(e7," ").concat(eV," ").concat(e)}k(tH,"formatCLI");function tY(e,t){return typeof e=="function"?tH(e(t),t):(typeof e==="undefined"?"undefined":R(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?tH(e,t):e}k(tY,"formatCommand");function tB(e){return tW.apply(this,arguments)}function tW(){tW=i(function(e){var t,n,r,s,i,o,a;var c=arguments;return L(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];a=!1;return[3,3];case 1:return[4,tm(ew)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:s=a,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=A(e,2),n=t[0],r=t[1];return[n,tY(r,i)]}))]}})});return tW.apply(this,arguments)}k(tB,"resolveCommands");function tV(e,t){return tJ.apply(this,arguments)}function tJ(){tJ=i(function(e,t){var n;return L(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);el.start("".concat(e)),tM.DEBUG&&el.info("→ ".concat(t));return[4,tq(t)];case 1:r.sent(),el.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw el.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return tJ.apply(this,arguments)}k(tV,"runCommand");function tQ(){return t$.apply(this,arguments)}function t$(){t$=i(function(){var e,t;return L(this,function(n){switch(n.label){case 0:if(!eC(tc.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,tp.typescriptCheck()];case 1:return[4,tV.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=el.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return t$.apply(this,arguments)}k(tQ,"checkTypescript");function tX(){return tz.apply(this,arguments)}function tz(){tz=i(function(){var e,t,n,r;var s=arguments;return L(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,tp.eslintFix()];case 1:return[4,tV.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,tp.eslintCheck()];case 4:return[4,tV.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})});return tz.apply(this,arguments)}k(tX,"checkEslint");function tZ(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";el.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}k(tZ,"printIssues");function t0(){return t1.apply(this,arguments)}function t1(){t1=i(function(){var e,t,n;return L(this,function(r){switch(r.label){case 0:return[4,tG()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===Q.Error}),n=e.filter(function(e){return e.type===Q.Warning});!t.length&&!n.length?el.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tZ("Warnings",n),tZ("Errors",t),(t.length>0||n.length>0)&&ef.default.exit(1));return[2]}})});return t1.apply(this,arguments)}k(t0,"showCheckResult");function t2(){return t4.apply(this,arguments)}function t4(){t4=i(function(){var e,t,n,r,s,i;return L(this,function(o){switch(o.label){case 0:return[4,tx()];case 1:o.sent();return[4,tm(ew)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(ew)];return[4,tp.build()];case 4:return[4,tV.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,tp.stageBuildDirectory()];case 6:return[4,tV.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw el.error("Error building and staging ".concat(ew,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,tp.lintStaged()];case 10:return[4,tV.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),t0();return[2]}})});return t4.apply(this,arguments)}k(t2,"lintStaged");function t3(){return t5.apply(this,arguments)}function t5(){t5=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,tp.eslintInspect()];case 1:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return t5.apply(this,arguments)}k(t3,"inspectLint");function t8(){return t6.apply(this,arguments)}function t6(){t6=i(function(){return L(this,function(e){switch(e.label){case 0:return[4,tx()];case 1:e.sent();return[4,Promise.all([tQ(),tX()])];case 2:e.sent(),t0();return[2]}})});return t6.apply(this,arguments)}k(t8,"lintCheck");function t9(){return t7.apply(this,arguments)}function t7(){t7=i(function(){return L(this,function(e){switch(e.label){case 0:return[4,tx()];case 1:e.sent();return[4,Promise.all([tQ(),tX(!0)])];case 2:e.sent(),t0();return[2]}})});return t7.apply(this,arguments)}k(t9,"lintFix");function ne(){return nt.apply(this,arguments)}function nt(){nt=i(function(){var e;return L(this,function(t){switch(t.label){case 0:return[4,tx()];case 1:t.sent();e=["Validating commit message"];return[4,tp.commitLint()];case 2:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),t0();return[2]}})});return nt.apply(this,arguments)}k(ne,"commitLint");function nn(){return nr.apply(this,arguments)}function nr(){nr=i(function(){var e,t,n,r;return L(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,tp.configureGitHook()];case 1:return[4,tV.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eR(tc.GIT_HOOK);return[4,tB(tu)];case 3:t=s.sent();eA(tc.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(eF,"\n");eC(tc.GIT_IGNORE)?eI(tc.GIT_IGNORE).split("\n").includes(eF)||eT(tc.GIT_IGNORE,n):eA(tc.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,tp.simpleGitHooks()];case 4:return[4,tV.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})});return nr.apply(this,arguments)}k(nn,"setupGitHook");function ns(){return ni.apply(this,arguments)}function ni(){ni=i(function(){return L(this,function(e){switch(e.label){case 0:return[4,tO([ew],{update:!0,postInstallActions:[nn]})];case 1:e.sent();return[2]}})});return ni.apply(this,arguments)}k(ns,"setup");function no(){return na.apply(this,arguments)}function na(){na=i(function(){return L(this,function(e){switch(e.label){case 0:eR(tc.NODE_MODULES,tc.PNPM_LOCK_YAML);return[4,t_()];case 1:e.sent();return[4,nn()];case 2:e.sent();return[2]}})});return na.apply(this,arguments)}k(no,"reset");function nc(){return nu.apply(this,arguments)}function nu(){nu=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,tp.nodeModulesInspect()];case 1:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return nu.apply(this,arguments)}k(nc,"inspect");function nl(){return nd.apply(this,arguments)}function nd(){nd=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,tp.testUnit()];case 1:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return nd.apply(this,arguments)}k(nl,"testUnit");function nf(){return np.apply(this,arguments)}function np(){np=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,tp.testE2e()];case 1:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return np.apply(this,arguments)}k(nf,"testE2E");function nE(e){return ng.apply(this,arguments)}function ng(){ng=i(function(e){var t;return L(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,tp.mongoMigrateCreate(e)];case 1:return[4,tV.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})});return ng.apply(this,arguments)}k(nE,"mongoMigrateCreate");function nh(){return nv.apply(this,arguments)}function nv(){nv=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,tp.mongoMigrateUp()];case 1:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return nv.apply(this,arguments)}k(nh,"mongoMigrateUp");function nm(){return ny.apply(this,arguments)}function ny(){ny=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,tp.mongoMigrateDown()];case 1:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return ny.apply(this,arguments)}k(nm,"mongoMigrateDown");i(function(){var e;return L(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,(0,eE.default)((0,ep.hideBin)(ef.default.argv)).scriptName(eV).usage("$0 <command> [options]").command("lint","Check code for linting issues",t8).command("lint:fix","Fix linting issues automatically",t9).command("lint:inspect","View active ESLint configuration",t3).command("lint-staged","Run lint checks on staged files",t2).command("commitlint","Validate commit message format",ne).command("setup","Initialize project setup and dependencies",ns).command("reset","Reset the project and reinstall dependencies",no).command("inspect","Analyze installed project dependencies",nc).command("test:unit","Run unit test suite",nl).command("test:e2e","Run end-to-end test suite",nf).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},/*#__PURE__*/function(){var e=i(function(e){return L(this,function(t){switch(t.label){case 0:if(!e.name){el.error("Migration name is required.");return[2]}return[4,nE(e.name)];case 1:t.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}()).command("mongo:migrate:up","Apply all MongoDB migrations",nh).command("mongo:migrate:down","Rollback last MongoDB migration",nm).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(eg.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();el.error("Fatal: ".concat(e.message)),ef.default.exit(1);return[3,3];case 3:return[2]}})})();var n_=K(require("compression"),1),nS=K(require("cors"),1),nO=K(require("express"),1),nC=K(require("express-device"),1),nI=K(require("express-session"),1);function nA(e){return(0,nS.default)({origin:k(function(t,n){var r;e.isDev||((r=e.whiteList)===null||r===void 0?void 0:r.includes(t!==null&&t!==void 0?t:""))?n(null,!0):n(null,!1)},"origin"),credentials:!0})}k(nA,"createCors");function nT(e){var t=(0,nO.default)();return t.set("trust proxy",1),t.use(nO.default.urlencoded({extended:!0})),t.use((0,n_.default)()),t.use(nC.default.capture()),e.staticFolder&&t.use(nO.default.static(e.staticFolder)),e.sessionOptions&&t.use((0,nI.default)(e.sessionOptions)),t}k(nT,"createExpress");var nR=require("migrate-mongo");function nN(e){nR.config.set(e)}k(nN,"setMongoMigrateConfig");var nM=require("date-fns"),nL=require("mongoose"),nD=K(require("mongoose-aggregate-paginate-v2"),1),nb=K(require("mongoose-paginate-v2"),1),nP=require("uuid");var nG=K(require("crypto-js"),1),nw=K(require("slugify"),1);var nx=nw.default.default||nw.default;function nj(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;var n=t||{},r=n.lower,s=r===void 0?!0:r,i=n.locale,o=i===void 0?"vi":i,a=S(n,["lower","locale"]);return nx(e,m({lower:s,locale:o},a))}k(nj,"generateSlug");function nk(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return nG.default.SHA256(e).toString(nG.default.enc.Hex).slice(0,t)}k(nk,"generateShortId");var nU={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":R(e))=="object"?p(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var nq={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return(0,nM.format)(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.returnDateAs,n=t===void 0?"string":t;var r=n==="string"?nq.getDateTime():new Date;return{id:(0,nP.v4)(),isDel:!1,createdAt:r,updatedAt:r}},applyPlugins:function e(e,t){t.filter(function(e){return typeof e=="function"}).forEach(function(t){return e.plugin(t)})},applyMiddlewares:function e(e,t){t.forEach(function(t){var n=t.method,r=t.pre,s=t.post;n&&r&&e.pre(n,r),n&&s&&e.post(n,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:nP.v4,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,n=e.schema,r=e.virtuals,s=r===void 0?[]:r,i=e.standalone,o=i===void 0?!1:i;var a=new t.Schema(n,{strict:!0});return s.forEach(function(e){var t=e.name,n=e.options,r=e.get;var s=a.virtual(t,n);r&&s.get(r)}),o||a.add(nq.createGenericSchema(t)),a},createModel:function e(e){var t=e.mongoose,n=e.name,r=e.schema,s=e.pagination,i=s===void 0?!1:s,o=e.aggregate,a=o===void 0?!1:o,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,d=l===void 0?[]:l;if(!n)throw new Error("Model name is required.");if(t.models[n])return t.models[n];var f=nq.createSchema({mongoose:t,schema:r,virtuals:u});return nq.applyPlugins(f,[i&&nb.default,a&&nD.default]),nq.applyMiddlewares(f,d),t.model(n,f)},createSlugQuery:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return _(m({},t,n&&{id:{$ne:n}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=i(function(e){return L(this,function(t){return[2,!nU.isEmpty(e)]})});return function(t){return e.apply(this,arguments)}}()},isUnique:function e(e){return /*#__PURE__*/function(){var t=i(function(t){var n;return L(this,function(r){switch(r.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");n={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.findOne(n)];case 1:return[2,!r.sent()]}})});return function(e){return t.apply(this,arguments)}}()},matchesRegex:function e(e){return /*#__PURE__*/function(){var t=i(function(t){return L(this,function(n){if(!Array.isArray(e)||e.some(function(e){return!p(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(t)})]})});return function(e){return t.apply(this,arguments)}}()}}},nK=/*#__PURE__*/function(){function e(t,n){a(this,e);H(this,"collection");this.collection=t.collection(n)}u(e,[{key:"createOne",value:function e(e){var t=this;return i(function(){var n,r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n=m({},nq.createGenericFields(),e);r={success:!0,message:"Document created successfully"};return[4,t.collection.insertOne(n)];case 1:return[2,(r.result=i.sent(),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=this;return i(function(){var n,r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n=e.map(function(e){return m({},nq.createGenericFields(),e)});return[4,t.collection.insertMany(n)];case 1:r=i.sent();return[2,r.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(r.insertedCount," documents created successfully"),result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"findOne",value:function e(e){var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.findOne(e)];case 1:n=s.sent();return[2,n?{success:!0,message:"Document found",result:n}:{success:!1,message:"Document not found"}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0,message:"Documents retrieved successfully"};return[4,t.collection.find(e).toArray()];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0,message:"Count retrieved successfully"};return[4,t.collection.countDocuments(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(e,t){var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.collection.updateOne(e,{$set:t})];case 1:r=i.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(e,t){var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.collection.updateMany(e,{$set:t})];case 1:r=i.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(e){var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.deleteOne(e)];case 1:n=s.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(e){var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.deleteMany(e)];case 1:n=s.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}}]);return e}();k(nK,"MongoController");var nF=nK,nH=/*#__PURE__*/function(){function e(t){a(this,e);H(this,"model");this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;var s=this;return i(function(){var i,o,a;return L(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);i=s.model.findOne(e,t,n);r&&i.populate(r);return[4,i.exec()];case 1:o=c.sent();return[2,o?{success:!0,result:o}:{success:!1,message:"No ".concat(s.getModelName()," found."),code:eo.NOT_FOUND.CODE}];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;var s=this;return i(function(){var i,o,a;return L(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);i=s.model.find(e,t,n);r&&i.populate(r);o={success:!0};return[4,i.exec()];case 1:return[2,(o.result=c.sent(),o)];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPaging",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r={success:!0};return[4,n.model.paginate(e,t)];case 1:return[2,(r.result=i.sent(),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPagingAggregate",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r={success:!0};return[4,n.model.aggregatePaginate(n.model.aggregate(e),t)];case 1:return[2,(r.result=i.sent(),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0};return[4,t.model.countDocuments(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createOne",value:function e(e){var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0};return[4,t.model.create(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r={success:!0};return[4,n.model.insertMany(e,t)];case 1:return[2,(r.result=i.sent().map(function(e){return p(e,nL.Document)?e.toObject():null}).filter(function(e){return e!==null}),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=this;return i(function(){var s,i;return L(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,r.model.findOneAndUpdate(e,t,m({new:!0},n)).exec()];case 1:s=o.sent();return[2,s?{success:!0,result:s}:{success:!1,message:"Failed to update ".concat(r.getModelName(),"."),code:eo.NOT_FOUND.CODE}];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=this;return i(function(){var s,i;return L(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);s={success:!0};return[4,r.model.updateMany(e,t,n).exec()];case 1:return[2,(s.result=o.sent(),s)];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.model.findOneAndDelete(e,t).exec()];case 1:r=i.sent();return[2,r?{success:!0,result:r}:{success:!1,message:"No ".concat(n.getModelName()," found to delete."),code:eo.NOT_FOUND.CODE}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.model.deleteMany(e,t).exec()];case 1:r=i.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents found to delete.",code:eo.NOT_FOUND.CODE}:{success:!0,result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;var n=this;return i(function(){var r,s,i,o;return L(this,function(a){switch(a.label){case 0:r=new Set;s=0;a.label=1;case 1:if(!(s<10))return[3,5];i=nk(e,s+t);o=!r.has(i);if(!o)return[3,3];r.add(i);return[4,n.model.exists({shortId:i})];case 2:o=!a.sent();a.label=3;case 3:if(o)return[2,{success:!0,result:i}];a.label=4;case 4:s++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:eo.INTERNAL_SERVER_ERROR.CODE}]}})})()}},{key:"createSlug",value:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=this;return i(function(){var s,o,a,c,u,l,d,f,p,E,g;return L(this,function(h){switch(h.label){case 0:h.trys.push([0,8,,9]);s=t[e],o=k(/*#__PURE__*/function(){var e=i(function(e){var s,i,o;return L(this,function(a){switch(a.label){case 0:return[4,r.model.findOne(nq.createSlugQuery(e,n,t.id))];case 1:s=a.sent();if(!s)return[2,e];i=1;a.label=2;case 2:o="".concat(e,"-").concat(i);return[4,r.model.findOne(nq.createSlugQuery(o,n,t.id))];case 3:s=a.sent(),i++;a.label=4;case 4:if(s)return[3,2];a.label=5;case 5:return[2,o]}})});return function(t){return e.apply(this,arguments)}}(),"createUniqueSlug");if(!((typeof s==="undefined"?"undefined":R(s))=="object"))return[3,5];a={};c=[];for(u in s)c.push(u);l=0;h.label=1;case 1:if(!(l<c.length))return[3,4];d=c[l];f=nj(s[d]);return[4,o(f)];case 2:a[d]=h.sent();h.label=3;case 3:l++;return[3,1];case 4:return[2,{success:!0,result:a}];case 5:p=nj(s);E={success:!0};return[4,o(p)];case 6:return[2,(E.result=h.sent(),E)];case 7:return[3,9];case 8:g=h.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(g.message),code:eo.INTERNAL_SERVER_ERROR.CODE}];case 9:return[2]}})})()}},{key:"aggregate",value:function e(e){var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0};return[4,t.model.aggregate(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}}]);return e}();k(nH,"MongooseController");var nY=nH;var nB=require("mongodb"),nW=require("mongoose");var nV=/*#__PURE__*/function(e){f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nB.Db);k(nV,"C_Db");var nJ=nV,nQ=/*#__PURE__*/function(e){f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nW.Document);k(nQ,"C_Document");var n$=nQ,nX=/*#__PURE__*/function(e){f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nW.Model);k(nX,"C_Model");var nz=nX,nZ=/*#__PURE__*/function(e){f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nB.Collection);k(nZ,"C_Collection");var n0=nZ;var n1=require("graphql-ws/use/ws"),n2=require("ws");function n4(e){return new n2.WebSocketServer({server:e.server,path:e.path})}k(n4,"createWSServer");function n3(e){return(0,n1.useServer)({schema:e.schema},e.server)}k(n3,"initGraphQLWS");0&&(module.exports={BUILD_DIRECTORY:BUILD_DIRECTORY,CHECK_PACKAGE_EMPTY_RESULT:CHECK_PACKAGE_EMPTY_RESULT,COMMIT_LINT_CLI:COMMIT_LINT_CLI,COMMIT_LINT_PACKAGE_NAME:COMMIT_LINT_PACKAGE_NAME,CYBERSKILL_CLI:CYBERSKILL_CLI,CYBERSKILL_CLI_PATH:CYBERSKILL_CLI_PATH,CYBERSKILL_DIRECTORY:CYBERSKILL_DIRECTORY,CYBERSKILL_PACKAGE_NAME:CYBERSKILL_PACKAGE_NAME,C_Collection:C_Collection,C_Db:C_Db,C_Document:C_Document,C_Model:C_Model,ESLINT_CLI:ESLINT_CLI,ESLINT_INSPECT_CLI:ESLINT_INSPECT_CLI,ESLINT_INSPECT_PACKAGE_NAME:ESLINT_INSPECT_PACKAGE_NAME,ESLINT_PACKAGE_NAME:ESLINT_PACKAGE_NAME,E_CommandType:E_CommandType,E_IssueType:E_IssueType,GIT_CLI:GIT_CLI,GIT_COMMIT_EDITMSG:GIT_COMMIT_EDITMSG,GIT_HOOK:GIT_HOOK,GIT_IGNORE:GIT_IGNORE,HOOK:HOOK,LINT_STAGED_CLI:LINT_STAGED_CLI,LINT_STAGED_PACKAGE_NAME:LINT_STAGED_PACKAGE_NAME,MIGRATE_MONGO_CLI:MIGRATE_MONGO_CLI,MIGRATE_MONGO_PACKAGE_NAME:MIGRATE_MONGO_PACKAGE_NAME,MongoController:MongoController,MongooseController:MongooseController,NODE_MODULES:NODE_MODULES,NODE_MODULES_INSPECT_CLI:NODE_MODULES_INSPECT_CLI,NODE_MODULES_INSPECT_PACKAGE_NAME:NODE_MODULES_INSPECT_PACKAGE_NAME,PACKAGE_JSON:PACKAGE_JSON,PACKAGE_LOCK_JSON:PACKAGE_LOCK_JSON,PATH:PATH,PLAYWRIGHT_PACKAGE_NAME:PLAYWRIGHT_PACKAGE_NAME,PNPM_CLI:PNPM_CLI,PNPM_EXEC_CLI:PNPM_EXEC_CLI,PNPM_LOCK_YAML:PNPM_LOCK_YAML,SIMPLE_GIT_HOOKS_PACKAGE_NAME:SIMPLE_GIT_HOOKS_PACKAGE_NAME,SIMPLE_GIT_HOOK_CLI:SIMPLE_GIT_HOOK_CLI,SIMPLE_GIT_HOOK_JSON:SIMPLE_GIT_HOOK_JSON,TSCONFIG_JSON:TSCONFIG_JSON,TSC_CLI:TSC_CLI,TSC_PACKAGE_NAME:TSC_PACKAGE_NAME,TSX_CLI:TSX_CLI,VITEST_CLI:VITEST_CLI,VITEST_PACKAGE_NAME:VITEST_PACKAGE_NAME,WORKING_DIRECTORY:WORKING_DIRECTORY,aggregatePaginate:aggregatePaginate,appendFileSync:appendFileSync,checkPackage:checkPackage,clearAllErrorLists:clearAllErrorLists,command:command,createApolloServer:createApolloServer,createCors:createCors,createExpress:createExpress,createWSServer:createWSServer,existsSync:existsSync,express:express,expressMiddleware:expressMiddleware,formatCommand:formatCommand,getLatestPackageVersion:getLatestPackageVersion,getPackage:getPackage,getStoredErrorLists:getStoredErrorLists,initGraphQLWS:initGraphQLWS,installDependencies:installDependencies,join:join,logNodeJS:logNodeJS,mongo:mongo,mongoosePaginate:mongoosePaginate,rawCommand:rawCommand,readFileSync:readFileSync,resolve:resolve,resolveCommands:resolveCommands,resolveWorkingPath:resolveWorkingPath,rmSync:rmSync,runCommand:runCommand,setMongoMigrateConfig:setMongoMigrateConfig,setupPackages:setupPackages,storageNodeJS:storageNodeJS,throwError:throwError,writeFileSync:writeFileSync});
1
+ "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,n,r,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,s)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,c,"next",e)}function c(e){s(o,r,i,a,c,"throw",e)}a(undefined)})}}function o(e,t,n){t=d(t);return C(e,M()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function u(e,t,n){if(t)c(e.prototype,t);if(n)c(e,n);return e}function l(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function d(e){d=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return d(e)}function f(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)I(e,t)}function p(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function E(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function g(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,a;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw a}}return r}function h(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){l(e,t,n[t])})}return e}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(t){r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}n.push.apply(n,r)}return n}function _(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{y(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function S(e,t){if(e==null)return{};var n=O(e,t);var r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){r=i[s];if(t.indexOf(r)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;n[r]=e[r]}}return n}function O(e,t){if(e==null)return{};var n={};var r=Object.keys(e);var s,i;for(i=0;i<r.length;i++){s=r[i];if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function C(e,t){if(t&&(R(t)==="object"||typeof t==="function")){return t}return r(e)}function I(e,t){I=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return I(e,t)}function A(e,n){return t(e)||g(e,n)||N(e,n)||h()}function T(e){return n(e)||E(e)||N(e)||v()}function R(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function N(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(M=function(){return!!e})()}function L(e,t){var n,r,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(n=1,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var D=Object.create;var b=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var j=function(e,t,n){return t in e?b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n};var k=function(e,t){return b(e,"name",{value:t,configurable:!0})};var U=function(e,t){for(var n in t)b(e,n,{get:t[n],enumerable:!0})},q=function(e,t,n,r){var s=true,i=false,o=undefined;if(t&&(typeof t==="undefined"?"undefined":R(t))=="object"||typeof t=="function")try{var a=function(){var s=u.value;!x.call(e,s)&&s!==n&&b(e,s,{get:function(){return t[s]},enumerable:!(r=P(t,s))||r.enumerable})};for(var c=G(t)[Symbol.iterator](),u;!(s=(u=c.next()).done);s=true)a()}catch(e){i=true;o=e}finally{try{if(!s&&c.return!=null){c.return()}}finally{if(i){throw o}}}return e};var K=function(e,t,n){return n=e!=null?D(w(e)):{},q(t||!e||!e.__esModule?b(n,"default",{value:e,enumerable:!0}):n,e)},F=function(e){return q(b({},"__esModule",{value:!0}),e)};var H=function(e,t,n){return j(e,(typeof t==="undefined"?"undefined":R(t))!="symbol"?t+"":t,n)};var Y={};U(Y,{BUILD_DIRECTORY:function(){return ej},CHECK_PACKAGE_EMPTY_RESULT:function(){return e_},COMMIT_LINT_CLI:function(){return e1},COMMIT_LINT_PACKAGE_NAME:function(){return e0},CYBERSKILL_CLI:function(){return eV},CYBERSKILL_CLI_PATH:function(){return eJ},CYBERSKILL_DIRECTORY:function(){return eW},CYBERSKILL_PACKAGE_NAME:function(){return ew},C_Collection:function(){return n0},C_Db:function(){return nJ},C_Document:function(){return n$},C_Model:function(){return nz},ESLINT_CLI:function(){return e$},ESLINT_INSPECT_CLI:function(){return tr},ESLINT_INSPECT_PACKAGE_NAME:function(){return tn},ESLINT_PACKAGE_NAME:function(){return eQ},E_CommandType:function(){return eh},E_IssueType:function(){return Q},GIT_CLI:function(){return e6},GIT_COMMIT_EDITMSG:function(){return eB},GIT_HOOK:function(){return eY},GIT_IGNORE:function(){return eK},HOOK:function(){return tu},LINT_STAGED_CLI:function(){return e4},LINT_STAGED_PACKAGE_NAME:function(){return e2},MIGRATE_MONGO_CLI:function(){return ta},MIGRATE_MONGO_PACKAGE_NAME:function(){return to},MongoController:function(){return nF},MongooseController:function(){return nY},NODE_MODULES:function(){return ex},NODE_MODULES_INSPECT_CLI:function(){return ti},NODE_MODULES_INSPECT_PACKAGE_NAME:function(){return ts},PACKAGE_JSON:function(){return ek},PACKAGE_LOCK_JSON:function(){return eU},PATH:function(){return tc},PLAYWRIGHT_PACKAGE_NAME:function(){return ez},PNPM_CLI:function(){return e9},PNPM_EXEC_CLI:function(){return e7},PNPM_LOCK_YAML:function(){return eH},SIMPLE_GIT_HOOKS_PACKAGE_NAME:function(){return te},SIMPLE_GIT_HOOK_CLI:function(){return tt},SIMPLE_GIT_HOOK_JSON:function(){return eF},TSCONFIG_JSON:function(){return eq},TSC_CLI:function(){return e5},TSC_PACKAGE_NAME:function(){return e3},TSX_CLI:function(){return e8},VITEST_CLI:function(){return eZ},VITEST_PACKAGE_NAME:function(){return eX},WORKING_DIRECTORY:function(){return eG},aggregatePaginate:function(){return nD.default},appendFileSync:function(){return eT},checkPackage:function(){return tm},clearAllErrorLists:function(){return tx},command:function(){return tp},createApolloServer:function(){return ed},createCors:function(){return nA},createExpress:function(){return nT},createWSServer:function(){return n4},existsSync:function(){return eC},express:function(){return nO.default},expressMiddleware:function(){return W.expressMiddleware},formatCommand:function(){return tY},getLatestPackageVersion:function(){return th},getPackage:function(){return tg},getStoredErrorLists:function(){return tG},initGraphQLWS:function(){return n3},installDependencies:function(){return t_},join:function(){return eb},logNodeJS:function(){return el},mongo:function(){return nq},mongoosePaginate:function(){return nb.default},rawCommand:function(){return tF},readFileSync:function(){return eI},resolve:function(){return eD},resolveCommands:function(){return tB},resolveWorkingPath:function(){return eL},rmSync:function(){return eR},runCommand:function(){return tV},setMongoMigrateConfig:function(){return nN},setupPackages:function(){return tO},storageNodeJS:function(){return tN},throwError:function(){return ec},writeFileSync:function(){return eA}});module.exports=F(Y);var B=require("@apollo/server"),W=require("@apollo/server/express4"),V=require("@apollo/server/plugin/drainHttpServer"),J=require("@apollo/server/plugin/landingPage/default");var Q=function(e){return e.Error="error",e.Warning="warning",e}({});var $=K(require("chalk"),1),X=K(require("consola"),1),z=require("graphql");var Z=".cyberskill-storage";var ee=K(require("dotenv"),1),et=require("envalid"),en=K(require("os"),1),er=K(require("path"),1),es=K(require("process"),1);ee.default.config();function ei(){var e={DEBUG:es.default.env.DEBUG||!1,CWD:es.default.env.CWD||es.default.cwd(),CYBERSKILL_STORAGE_DIRECTORY:es.default.env.CYBERSKILL_STORAGE_DIRECTORY||er.default.join(en.default.homedir(),Z)};return(0,et.cleanEnv)(e,{DEBUG:(0,et.bool)(),CWD:(0,et.str)(),CYBERSKILL_STORAGE_DIRECTORY:(0,et.str)()})}k(ei,"getEnv");var eo={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var ea=ei();function ec(e){var t=e.message,n=e.status,r=n===void 0?eo.INTERNAL_SERVER_ERROR:n,s=e.type,i=s===void 0?"graphql":s;var o;var a=(o=t!==null&&t!==void 0?t:r.MESSAGE)!==null&&o!==void 0?o:"Internal server error";throw i==="graphql"?new z.GraphQLError(a,{extensions:{code:r.CODE}}):new Error(a)}k(ec,"throwError");ea.DEBUG||(X.default.level=4);function eu(e){var t=$.default[e];return typeof t=="function"?t:$.default.green}k(eu,"chalkKeyword");var el={silent:X.default.silent,level:X.default.level,fatal:X.default.fatal,error:X.default.error,warn:X.default.warn,log:X.default.log,info:X.default.info,success:X.default.success,ready:X.default.ready,start:X.default.start,box:X.default.box,debug:X.default.debug,trace:X.default.trace,verbose:X.default.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){X.default.box($.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;X.default.log("".concat($.default.gray("File:")," ").concat($.default.blue("".concat(t).concat(r?":".concat(r):"")))),s&&X.default.log(" ".concat(eu(n)("Rule:")," ").concat(s)),X.default.log(" ".concat(eu(n)("Message:")," ").concat(i))}),X.default.box(eu(n)("".concat(e," : ").concat(t.length))),X.default.log($.default.gray("─".repeat(40)))}};function ed(e){return new B.ApolloServer(m({schema:e.schema,plugins:[e.isDev?(0,J.ApolloServerPluginLandingPageLocalDefault)():(0,J.ApolloServerPluginLandingPageProductionDefault)(),(0,V.ApolloServerPluginDrainHttpServer)({httpServer:e.server})].concat(T(e.drainServer?[{serverWillStart:function t(){return i(function(){return L(this,function(t){return[2,{drainServer:function t(){return i(function(){var t;return L(this,function(n){(t=e.drainServer)===null||t===void 0?void 0:t.call(e),el.info("Apollo Server drainServer hook called");return[2]})})()}}]})})()}}]:[]))},e.isDev&&{introspection:!0,includeStacktraceInErrorResponses:!0}))}k(ed,"createApolloServer");var ef=K(require("process"),1),ep=require("yargs/helpers"),eE=K(require("yargs/yargs"),1);var eg={name:"@cyberskill/shared",type:"module",version:"1.97.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.8","@apollo/server":"4.12.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.4","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.4","@next/eslint-plugin-next":"15.3.1","@swc/core":"1.11.21","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0",dotenv:"16.5.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.0",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.52.0","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.2",vitest:"3.1.1","vitest-browser-react":"0.1.1",ws:"8.18.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/compression":"1.7.5","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.0","lint-staged":"15.5.1","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var eh=function(e){return e.CLI="CLI",e.RAW="RAW",e}({});var ev=require("child_process"),em=K(require("process"),1),ey=K(require("util"),1);var e_={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var eS=K(require("node-fetch"),1);var eO=K(require("fs"),1);function eC(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return eO.existsSync(e)})}k(eC,"existsSync");function eI(e,t){var n=eO.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":R(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}k(eI,"readFileSync");function eA(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":R(t))=="object"?JSON.stringify(t,null,4):String(t);eO.writeFileSync(e,i,"utf-8")}k(eA,"writeFileSync");function eT(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":R(t))=="object"?JSON.stringify(t,null,4):String(t);eO.appendFileSync(e,i,"utf-8")}k(eT,"appendFileSync");function eR(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){eC(e)&&eO.rmSync(e,{recursive:!0,force:!0})})}k(eR,"rmSync");var eN=K(require("path"),1);var eM=ei();function eL(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eN).resolve.apply(r,[eM.CWD].concat(T(t)))}k(eL,"resolveWorkingPath");function eD(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eN).resolve.apply(r,T(t))}k(eD,"resolve");function eb(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eN).join.apply(r,T(t))}k(eb,"join");var eP=ei(),eG=eP.CWD,ew="@cyberskill/shared",ex="node_modules",ej="dist",ek="package.json",eU="package-lock.json",eq="tsconfig.json",eK=".gitignore",eF=".simple-git-hooks.json",eH="pnpm-lock.yaml",eY=".git/hooks/",eB=".git/COMMIT_EDITMSG",eW=eb(eG,ex,ew,ej),eV="cyberskill",eJ="src/nodejs/cli/index.ts",eQ="eslint",e$="eslint",eX="vitest",ez="playwright",eZ="vitest",e0="@commitlint/cli",e1="commitlint",e2="lint-staged",e4="lint-staged",e3="typescript",e5="tsc",e8="tsx",e6="git",e9="pnpm",e7="pnpm exec",te="simple-git-hooks",tt="simple-git-hooks",tn="@eslint/config-inspector",tr="eslint-config-inspector",ts="node-modules-inspector",ti="node-modules-inspector",to="migrate-mongo",ta="migrate-mongo",tc={CYBERSKILL_DIRECTORY:eW,WORKING_DIRECTORY:eG,TS_CONFIG:eL(eq),GIT_IGNORE:eL(eK),GIT_HOOK:eL(eY),GIT_COMMIT_MSG:eL(eB),SIMPLE_GIT_HOOKS_JSON:eL(eF),PACKAGE_JSON:eL(ek),PACKAGE_LOCK_JSON:eL(eU),PNPM_LOCK_YAML:eL(eH),NODE_MODULES:eL(ex),LINT_STAGED_CONFIG:eL("".concat(eW,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:eL("".concat(eW,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:eL("".concat(eW,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eL("".concat(eW,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eL("".concat(eW,"/react/vitest/vitest.e2e.js"))};function tu(e){var t=e.isCurrentProject;return m({"pre-commit":e4,"commit-msg":e1},t&&{"pre-push":tF("".concat(e6," pull"))})}k(tu,"HOOK");function tl(e){return td.apply(this,arguments)}function td(){td=i(function(e){var t,n,r,s,i,o;var a=arguments;return L(this,function(c){switch(c.label){case 0:for(t=a.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=a[r]}s=A(n,2),i=s[0],o=s[1];if(!i)throw new Error("'first' argument is undefined");switch(e){case eh.CLI:return[3,1];case eh.RAW:return[3,3]}return[3,4];case 1:return[4,tO(i.split(" "),{update:!0})];case 2:return[2,(c.sent(),tY(tF("".concat(e7," ").concat(o))))];case 3:return[2,tY(tF(i))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return td.apply(this,arguments)}k(tl,"buildCommand");function tf(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/i(function(){return L(this,function(t){return[2,tl.apply(void 0,[e].concat(T(n)))]})})}k(tf,"commandFactory");var tp={simpleGitHooks:tf(eh.CLI,te,tt),eslintInspect:tf(eh.CLI,tn,tr),nodeModulesInspect:tf(eh.CLI,ts,ti),eslintCheck:tf(eh.CLI,eQ,"".concat(e$," ").concat(tc.WORKING_DIRECTORY)),eslintFix:tf(eh.CLI,eQ,"".concat(e$," ").concat(tc.WORKING_DIRECTORY," --fix")),typescriptCheck:tf(eh.CLI,e3,"".concat(e5," -p ").concat(tc.TS_CONFIG," --noEmit")),configureGitHook:tf(eh.RAW,"".concat(e6," config core.hooksPath ").concat(tc.GIT_HOOK)),testUnit:tf(eh.CLI,eX,"".concat(eZ," --config ").concat(tc.UNIT_TEST_CONFIG)),testE2e:tf(eh.CLI,"".concat(eX," ").concat(ez),"".concat(eZ," --config ").concat(tc.E2E_TEST_CONFIG)),mongoMigrateCreate:k(function(e){return tf(eh.CLI,"".concat(to),"".concat(ta," create ").concat(e))()},"mongoMigrateCreate"),mongoMigrateUp:tf(eh.CLI,"".concat(to),"".concat(ta," up")),mongoMigrateDown:tf(eh.CLI,"".concat(to),"".concat(ta," down")),commitLint:tf(eh.CLI,e0,"".concat(e1," --edit ").concat(tc.GIT_COMMIT_MSG," --config ").concat(tc.COMMITLINT_CONFIG)),lintStaged:tf(eh.CLI,e2,"".concat(e4," --config ").concat(tc.LINT_STAGED_CONFIG)),stageBuildDirectory:tf(eh.RAW,"".concat(e6," add ").concat(ej)),build:tf(eh.RAW,"".concat(e9," run build")),pnpmInstallStandard:tf(eh.RAW,"".concat(e9," install")),pnpmInstallLegacy:tf(eh.RAW,"".concat(e9," install --legacy-peer-deps")),pnpmInstallForce:tf(eh.RAW,"".concat(e9," install --force"))};var tE=ei();function tg(e){var t=eb(tE.CWD,ek);if(!eC(t))return!1;try{var n=eI(t,{asJson:!0}),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,a=o===void 0?{}:o,c=r===e,u=e in i,l=e in a;return c||u||l?{path:t,file:n,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return el.warn("Failed to read package.json: ".concat(e.message)),!1}}k(tg,"getPackage");function th(e){return tv.apply(this,arguments)}function tv(){tv=i(function(e){var t,n,r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,(0,eS.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw el.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})});return tv.apply(this,arguments)}k(th,"getLatestPackageVersion");function tm(e,t){return ty.apply(this,arguments)}function ty(){ty=i(function(e,t){var n,r,s,i,o,a,c,u,l,d,f,p,E,g,h,v,y,_,S,O,C;return L(this,function(I){switch(I.label){case 0:I.trys.push([0,4,,5]);n=tg(e);if(!n)return[2,m({},e_)];c=n.path,u=n.file,l=n.isCurrentProject,d=n.isDepend,f=n.isDevDepend,p=(r=u.dependencies)!==null&&r!==void 0?r:{},E=(s=u.devDependencies)!==null&&s!==void 0?s:{},g=l?(i=u.version)!==null&&i!==void 0?i:"0.0.0":d?(o=p[e])!==null&&o!==void 0?o:"0.0.0":f?(a=E[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!l)return[3,1];y=g;return[3,3];case 1:return[4,th(e)];case 2:y=I.sent();I.label=3;case 3:h=y,v=l||g===h;if(!v&&(t===null||t===void 0?void 0:t.update)){;S=d?"dependencies":f?"devDependencies":null;S&&((_=u[S])===null||_===void 0?void 0:_[e])!==h&&(u[S]=(O=u[S])!==null&&O!==void 0?O:{},u[S][e]=h,eA(c,u,{isJson:!0}),el.info('Updated "'.concat(e,'" to version ').concat(h)))}return[2,{isCurrentProject:l,installedPath:c,file:u,isUpToDate:v}];case 4:C=I.sent();return[2,(el.error('Error checking package "'.concat(e,'": ').concat(C.message)),m({},e_))];case 5:return[2]}})});return ty.apply(this,arguments)}k(tm,"checkPackage");function t_(){return tS.apply(this,arguments)}function tS(){tS=i(function(){var e,t,n,r,s,i,o,a,c,u,l,d;return L(this,function(f){switch(f.label){case 0:e=[{command:k(function(){return tp.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:k(function(){return tp.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:k(function(){return tp.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);s=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,a()];case 4:u=f.sent();return[4,tV("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();el.warn("Installation attempt failed: ".concat(c)),el.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return tS.apply(this,arguments)}k(t_,"installDependencies");function tO(e,t){return tC.apply(this,arguments)}function tC(){tC=i(function(e,t){var n,r,s,i,o,a,c,u,l,d,f;return L(this,function(p){switch(p.label){case 0:if(!eC(tc.PACKAGE_JSON)){el.error("package.json not found. Aborting setup.");return[2]}p.label=1;case 1:p.trys.push([1,13,,14]);n=T(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return tm(e,m({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=p.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,t_()];case 3:r=p.sent();p.label=4;case 4:r;i=true,o=false,a=undefined;p.label=5;case 5:p.trys.push([5,10,11,12]);c=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();p.label=6;case 6:if(!!(i=(u=c.next()).done))return[3,9];l=u.value;return[4,l()];case 7:p.sent();p.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=p.sent();o=true;a=d;return[3,12];case 11:try{if(!i&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:f=p.sent();throw el.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})});return tC.apply(this,arguments)}k(tO,"setupPackages");var tI=K(require("node-persist"),1);var tA=ei();function tT(){return tR.apply(this,arguments)}function tR(){tR=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=tI.default.defaultInstance;if(e)return[3,2];return[4,tI.default.init({dir:tA.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return tR.apply(this,arguments)}k(tT,"initNodePersist");var tN={get:function e(e){return i(function(){var t,n;return L(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tT()];case 1:r.sent();return[4,tI.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(el.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return L(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tT()];case 1:r.sent();return[4,tI.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();el.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return L(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tT()];case 1:n.sent();return[4,tI.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();el.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return L(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tT()];case 1:n.sent();return[4,tI.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(el.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(el.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return L(this,function(t){try{return[2,"".concat(tA.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(el.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var tM=ei(),tL=ey.promisify(ev.exec);function tD(e){return"error_list:".concat(e)}k(tD,"getErrorListKey");function tb(e){return tP.apply(this,arguments)}function tP(){tP=i(function(e){var t,n,r;return L(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=tD(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,tN.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return L(this,function(t){switch(t.label){case 0:return[4,tN.getLogLink(n)];case 1:e=t.sent();e&&el.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=s.sent();el.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return tP.apply(this,arguments)}k(tb,"saveErrorListToStorage");function tG(){return tw.apply(this,arguments)}function tw(){tw=i(function(){var e,t,n;return L(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tN.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=i(function(e){var t;return L(this,function(n){switch(n.label){case 0:return[4,tN.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(el.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return tw.apply(this,arguments)}k(tG,"getStoredErrorLists");function tx(){return tj.apply(this,arguments)}function tj(){tj=i(function(){var e,t,n;return L(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tN.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return tN.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();el.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return tj.apply(this,arguments)}k(tx,"clearAllErrorLists");function tk(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var a,c,u,l,d;var f=s.exec(e)||[],p=i.exec(e)||[],E=o.exec(e)||[];var g,h,v,m,y,_;f.length&&r?t.push({file:r,position:"".concat(f[1],":").concat(f[2]),type:f[3]===Q.Error?Q.Error:Q.Warning,message:(g=f===null||f===void 0?void 0:(a=f[4])===null||a===void 0?void 0:a.trim())!==null&&g!==void 0?g:"",rule:(h=f===null||f===void 0?void 0:(c=f[5])===null||c===void 0?void 0:c.trim())!==null&&h!==void 0?h:""}):p.length?t.push({file:(v=p===null||p===void 0?void 0:p[1])!==null&&v!==void 0?v:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===Q.Error?Q.Error:Q.Warning,message:(m=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&m!==void 0?m:""}):E.length?t.push({file:"commitlint",type:Q.Error,message:(y=E===null||E===void 0?void 0:(l=E[1])===null||l===void 0?void 0:l.trim())!==null&&y!==void 0?y:"",rule:(_=E===null||E===void 0?void 0:(d=E[2])===null||d===void 0?void 0:d.trim())!==null&&_!==void 0?_:""}):n.push(e.trim())}}),t.length&&tb(t),tM.DEBUG&&n.length&&(el.warn("Unmatched lines:"),n.forEach(function(e){return el.info(" ".concat(e))}))}k(tk,"parseTextErrors");function tU(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?Q.Error:Q.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),n.length&&tb(n)}catch(t){tk(e)}}k(tU,"parseCommandOutput");function tq(e){return tK.apply(this,arguments)}function tK(){tK=i(function(e){var t,n,r,s,i,o,a,c,u;var l=arguments;return L(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:tU;n=new AbortController;em.default.on("SIGINT",function(){el.warn("Process interrupted. Terminating..."),n.abort(),em.default.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,tL(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&el.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return tK.apply(this,arguments)}k(tq,"executeCommand");function tF(e){return{raw:!0,cmd:e}}k(tF,"rawCommand");function tH(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(e7," ").concat(ew," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(e7," ").concat(e8," ").concat(eJ," ").concat(e):"".concat(e7," ").concat(eV," ").concat(e)}k(tH,"formatCLI");function tY(e,t){return typeof e=="function"?tH(e(t),t):(typeof e==="undefined"?"undefined":R(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?tH(e,t):e}k(tY,"formatCommand");function tB(e){return tW.apply(this,arguments)}function tW(){tW=i(function(e){var t,n,r,s,i,o,a;var c=arguments;return L(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];a=!1;return[3,3];case 1:return[4,tm(ew)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:s=a,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=A(e,2),n=t[0],r=t[1];return[n,tY(r,i)]}))]}})});return tW.apply(this,arguments)}k(tB,"resolveCommands");function tV(e,t){return tJ.apply(this,arguments)}function tJ(){tJ=i(function(e,t){var n;return L(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);el.start("".concat(e)),tM.DEBUG&&el.info("→ ".concat(t));return[4,tq(t)];case 1:r.sent(),el.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw el.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return tJ.apply(this,arguments)}k(tV,"runCommand");function tQ(){return t$.apply(this,arguments)}function t$(){t$=i(function(){var e,t;return L(this,function(n){switch(n.label){case 0:if(!eC(tc.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,tp.typescriptCheck()];case 1:return[4,tV.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=el.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return t$.apply(this,arguments)}k(tQ,"checkTypescript");function tX(){return tz.apply(this,arguments)}function tz(){tz=i(function(){var e,t,n,r;var s=arguments;return L(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,tp.eslintFix()];case 1:return[4,tV.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,tp.eslintCheck()];case 4:return[4,tV.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})});return tz.apply(this,arguments)}k(tX,"checkEslint");function tZ(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";el.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}k(tZ,"printIssues");function t0(){return t1.apply(this,arguments)}function t1(){t1=i(function(){var e,t,n;return L(this,function(r){switch(r.label){case 0:return[4,tG()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===Q.Error}),n=e.filter(function(e){return e.type===Q.Warning});!t.length&&!n.length?el.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tZ("Warnings",n),tZ("Errors",t),(t.length>0||n.length>0)&&ef.default.exit(1));return[2]}})});return t1.apply(this,arguments)}k(t0,"showCheckResult");function t2(){return t4.apply(this,arguments)}function t4(){t4=i(function(){var e,t,n,r,s,i;return L(this,function(o){switch(o.label){case 0:return[4,tx()];case 1:o.sent();return[4,tm(ew)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(ew)];return[4,tp.build()];case 4:return[4,tV.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,tp.stageBuildDirectory()];case 6:return[4,tV.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw el.error("Error building and staging ".concat(ew,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,tp.lintStaged()];case 10:return[4,tV.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),t0();return[2]}})});return t4.apply(this,arguments)}k(t2,"lintStaged");function t3(){return t5.apply(this,arguments)}function t5(){t5=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,tp.eslintInspect()];case 1:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return t5.apply(this,arguments)}k(t3,"inspectLint");function t8(){return t6.apply(this,arguments)}function t6(){t6=i(function(){return L(this,function(e){switch(e.label){case 0:return[4,tx()];case 1:e.sent();return[4,Promise.all([tQ(),tX()])];case 2:e.sent(),t0();return[2]}})});return t6.apply(this,arguments)}k(t8,"lintCheck");function t9(){return t7.apply(this,arguments)}function t7(){t7=i(function(){return L(this,function(e){switch(e.label){case 0:return[4,tx()];case 1:e.sent();return[4,Promise.all([tQ(),tX(!0)])];case 2:e.sent(),t0();return[2]}})});return t7.apply(this,arguments)}k(t9,"lintFix");function ne(){return nt.apply(this,arguments)}function nt(){nt=i(function(){var e;return L(this,function(t){switch(t.label){case 0:return[4,tx()];case 1:t.sent();e=["Validating commit message"];return[4,tp.commitLint()];case 2:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),t0();return[2]}})});return nt.apply(this,arguments)}k(ne,"commitLint");function nn(){return nr.apply(this,arguments)}function nr(){nr=i(function(){var e,t,n,r;return L(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,tp.configureGitHook()];case 1:return[4,tV.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eR(tc.GIT_HOOK);return[4,tB(tu)];case 3:t=s.sent();eA(tc.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(eF,"\n");eC(tc.GIT_IGNORE)?eI(tc.GIT_IGNORE).split("\n").includes(eF)||eT(tc.GIT_IGNORE,n):eA(tc.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,tp.simpleGitHooks()];case 4:return[4,tV.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})});return nr.apply(this,arguments)}k(nn,"setupGitHook");function ns(){return ni.apply(this,arguments)}function ni(){ni=i(function(){return L(this,function(e){switch(e.label){case 0:return[4,tO([ew],{update:!0,postInstallActions:[nn]})];case 1:e.sent();return[2]}})});return ni.apply(this,arguments)}k(ns,"setup");function no(){return na.apply(this,arguments)}function na(){na=i(function(){return L(this,function(e){switch(e.label){case 0:eR(tc.NODE_MODULES,tc.PNPM_LOCK_YAML);return[4,t_()];case 1:e.sent();return[4,nn()];case 2:e.sent();return[2]}})});return na.apply(this,arguments)}k(no,"reset");function nc(){return nu.apply(this,arguments)}function nu(){nu=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,tp.nodeModulesInspect()];case 1:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return nu.apply(this,arguments)}k(nc,"inspect");function nl(){return nd.apply(this,arguments)}function nd(){nd=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,tp.testUnit()];case 1:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return nd.apply(this,arguments)}k(nl,"testUnit");function nf(){return np.apply(this,arguments)}function np(){np=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,tp.testE2e()];case 1:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return np.apply(this,arguments)}k(nf,"testE2E");function nE(e){return ng.apply(this,arguments)}function ng(){ng=i(function(e){var t;return L(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,tp.mongoMigrateCreate(e)];case 1:return[4,tV.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})});return ng.apply(this,arguments)}k(nE,"mongoMigrateCreate");function nh(){return nv.apply(this,arguments)}function nv(){nv=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,tp.mongoMigrateUp()];case 1:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return nv.apply(this,arguments)}k(nh,"mongoMigrateUp");function nm(){return ny.apply(this,arguments)}function ny(){ny=i(function(){var e;return L(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,tp.mongoMigrateDown()];case 1:return[4,tV.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return ny.apply(this,arguments)}k(nm,"mongoMigrateDown");i(function(){var e;return L(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,(0,eE.default)((0,ep.hideBin)(ef.default.argv)).scriptName(eV).usage("$0 <command> [options]").command("lint","Check code for linting issues",t8).command("lint:fix","Fix linting issues automatically",t9).command("lint:inspect","View active ESLint configuration",t3).command("lint-staged","Run lint checks on staged files",t2).command("commitlint","Validate commit message format",ne).command("setup","Initialize project setup and dependencies",ns).command("reset","Reset the project and reinstall dependencies",no).command("inspect","Analyze installed project dependencies",nc).command("test:unit","Run unit test suite",nl).command("test:e2e","Run end-to-end test suite",nf).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},/*#__PURE__*/function(){var e=i(function(e){return L(this,function(t){switch(t.label){case 0:if(!e.name){el.error("Migration name is required.");return[2]}return[4,nE(e.name)];case 1:t.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}()).command("mongo:migrate:up","Apply all MongoDB migrations",nh).command("mongo:migrate:down","Rollback last MongoDB migration",nm).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(eg.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();el.error("Fatal: ".concat(e.message)),ef.default.exit(1);return[3,3];case 3:return[2]}})})();var n_=K(require("compression"),1),nS=K(require("cors"),1),nO=K(require("express"),1),nC=K(require("express-device"),1),nI=K(require("express-session"),1);function nA(e){return(0,nS.default)({origin:k(function(t,n){var r;e.isDev||((r=e.whiteList)===null||r===void 0?void 0:r.includes(t!==null&&t!==void 0?t:""))?n(null,!0):n(null,!1)},"origin"),credentials:!0})}k(nA,"createCors");function nT(e){var t=(0,nO.default)();return t.set("trust proxy",1),t.use(nO.default.urlencoded({extended:!0})),t.use((0,n_.default)()),t.use(nC.default.capture()),e.staticFolder&&t.use(nO.default.static(e.staticFolder)),e.sessionOptions&&t.use((0,nI.default)(e.sessionOptions)),t}k(nT,"createExpress");var nR=require("migrate-mongo");function nN(e){nR.config.set(e)}k(nN,"setMongoMigrateConfig");var nM=require("date-fns"),nL=require("mongoose"),nD=K(require("mongoose-aggregate-paginate-v2"),1),nb=K(require("mongoose-paginate-v2"),1),nP=require("uuid");var nG=K(require("crypto-js"),1),nw=K(require("slugify"),1);var nx=nw.default.default||nw.default;function nj(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;var n=t||{},r=n.lower,s=r===void 0?!0:r,i=n.locale,o=i===void 0?"vi":i,a=S(n,["lower","locale"]);return nx(e,m({lower:s,locale:o},a))}k(nj,"generateSlug");function nk(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return nG.default.SHA256(e).toString(nG.default.enc.Hex).slice(0,t)}k(nk,"generateShortId");var nU={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":R(e))=="object"?p(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var nq={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return(0,nM.format)(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.returnDateAs,n=t===void 0?"string":t;var r=n==="string"?nq.getDateTime():new Date;return{id:(0,nP.v4)(),isDel:!1,createdAt:r,updatedAt:r}},applyPlugins:function e(e,t){t.filter(function(e){return typeof e=="function"}).forEach(function(t){return e.plugin(t)})},applyMiddlewares:function e(e,t){t.forEach(function(t){var n=t.method,r=t.pre,s=t.post;n&&r&&e.pre(n,r),n&&s&&e.post(n,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:nP.v4,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,n=e.schema,r=e.virtuals,s=r===void 0?[]:r,i=e.standalone,o=i===void 0?!1:i;var a=new t.Schema(n,{strict:!0});return s.forEach(function(e){var t=e.name,n=e.options,r=e.get;var s=a.virtual(t,n);r&&s.get(r)}),o||a.add(nq.createGenericSchema(t)),a},createModel:function e(e){var t=e.mongoose,n=e.name,r=e.schema,s=e.pagination,i=s===void 0?!1:s,o=e.aggregate,a=o===void 0?!1:o,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,d=l===void 0?[]:l;if(!n)throw new Error("Model name is required.");if(t.models[n])return t.models[n];var f=nq.createSchema({mongoose:t,schema:r,virtuals:u});return nq.applyPlugins(f,[i&&nb.default,a&&nD.default]),nq.applyMiddlewares(f,d),t.model(n,f)},createSlugQuery:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return _(m({},t,n&&{id:{$ne:n}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=i(function(e){return L(this,function(t){return[2,!nU.isEmpty(e)]})});return function(t){return e.apply(this,arguments)}}()},isUnique:function e(e){return /*#__PURE__*/function(){var t=i(function(t){var n;return L(this,function(r){switch(r.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");n={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.findOne(n)];case 1:return[2,!r.sent()]}})});return function(e){return t.apply(this,arguments)}}()},matchesRegex:function e(e){return /*#__PURE__*/function(){var t=i(function(t){return L(this,function(n){if(!Array.isArray(e)||e.some(function(e){return!p(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(t)})]})});return function(e){return t.apply(this,arguments)}}()}}},nK=/*#__PURE__*/function(){function e(t,n){a(this,e);H(this,"collection");this.collection=t.collection(n)}u(e,[{key:"createOne",value:function e(e){var t=this;return i(function(){var n,r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n=m({},nq.createGenericFields(),e);r={success:!0,message:"Document created successfully"};return[4,t.collection.insertOne(n)];case 1:return[2,(r.result=i.sent(),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=this;return i(function(){var n,r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n=e.map(function(e){return m({},nq.createGenericFields(),e)});return[4,t.collection.insertMany(n)];case 1:r=i.sent();return[2,r.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(r.insertedCount," documents created successfully"),result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"findOne",value:function e(e){var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.findOne(e)];case 1:n=s.sent();return[2,n?{success:!0,message:"Document found",result:n}:{success:!1,message:"Document not found"}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0,message:"Documents retrieved successfully"};return[4,t.collection.find(e).toArray()];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0,message:"Count retrieved successfully"};return[4,t.collection.countDocuments(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(e,t){var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.collection.updateOne(e,{$set:t})];case 1:r=i.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(e,t){var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.collection.updateMany(e,{$set:t})];case 1:r=i.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(e){var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.deleteOne(e)];case 1:n=s.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(e){var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.deleteMany(e)];case 1:n=s.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}}]);return e}();k(nK,"MongoController");var nF=nK,nH=/*#__PURE__*/function(){function e(t){a(this,e);H(this,"model");this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;var s=this;return i(function(){var i,o,a;return L(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);i=s.model.findOne(e,t,n);r&&i.populate(r);return[4,i.exec()];case 1:o=c.sent();return[2,o?{success:!0,result:o}:{success:!1,message:"No ".concat(s.getModelName()," found."),code:eo.NOT_FOUND.CODE}];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;var s=this;return i(function(){var i,o,a;return L(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);i=s.model.find(e,t,n);r&&i.populate(r);o={success:!0};return[4,i.exec()];case 1:return[2,(o.result=c.sent(),o)];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPaging",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r={success:!0};return[4,n.model.paginate(e,t)];case 1:return[2,(r.result=i.sent(),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPagingAggregate",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r={success:!0};return[4,n.model.aggregatePaginate(n.model.aggregate(e),t)];case 1:return[2,(r.result=i.sent(),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0};return[4,t.model.countDocuments(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createOne",value:function e(e){var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0};return[4,t.model.create(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r={success:!0};return[4,n.model.insertMany(e,t)];case 1:return[2,(r.result=i.sent().map(function(e){return p(e,nL.Document)?e.toObject():null}).filter(function(e){return e!==null}),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=this;return i(function(){var s,i;return L(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,r.model.findOneAndUpdate(e,t,m({new:!0},n)).exec()];case 1:s=o.sent();return[2,s?{success:!0,result:s}:{success:!1,message:"Failed to update ".concat(r.getModelName(),"."),code:eo.NOT_FOUND.CODE}];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=this;return i(function(){var s,i;return L(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);s={success:!0};return[4,r.model.updateMany(e,t,n).exec()];case 1:return[2,(s.result=o.sent(),s)];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.model.findOneAndDelete(e,t).exec()];case 1:r=i.sent();return[2,r?{success:!0,result:r}:{success:!1,message:"No ".concat(n.getModelName()," found to delete."),code:eo.NOT_FOUND.CODE}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.model.deleteMany(e,t).exec()];case 1:r=i.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents found to delete.",code:eo.NOT_FOUND.CODE}:{success:!0,result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;var n=this;return i(function(){var r,s,i,o;return L(this,function(a){switch(a.label){case 0:r=new Set;s=0;a.label=1;case 1:if(!(s<10))return[3,5];i=nk(e,s+t);o=!r.has(i);if(!o)return[3,3];r.add(i);return[4,n.model.exists({shortId:i})];case 2:o=!a.sent();a.label=3;case 3:if(o)return[2,{success:!0,result:i}];a.label=4;case 4:s++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:eo.INTERNAL_SERVER_ERROR.CODE}]}})})()}},{key:"createSlug",value:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=this;return i(function(){var s,o,a,c,u,l,d,f,p,E,g;return L(this,function(h){switch(h.label){case 0:h.trys.push([0,8,,9]);s=t[e],o=k(/*#__PURE__*/function(){var e=i(function(e){var s,i,o;return L(this,function(a){switch(a.label){case 0:return[4,r.model.findOne(nq.createSlugQuery(e,n,t.id))];case 1:s=a.sent();if(!s)return[2,e];i=1;a.label=2;case 2:o="".concat(e,"-").concat(i);return[4,r.model.findOne(nq.createSlugQuery(o,n,t.id))];case 3:s=a.sent(),i++;a.label=4;case 4:if(s)return[3,2];a.label=5;case 5:return[2,o]}})});return function(t){return e.apply(this,arguments)}}(),"createUniqueSlug");if(!((typeof s==="undefined"?"undefined":R(s))=="object"))return[3,5];a={};c=[];for(u in s)c.push(u);l=0;h.label=1;case 1:if(!(l<c.length))return[3,4];d=c[l];f=nj(s[d]);return[4,o(f)];case 2:a[d]=h.sent();h.label=3;case 3:l++;return[3,1];case 4:return[2,{success:!0,result:a}];case 5:p=nj(s);E={success:!0};return[4,o(p)];case 6:return[2,(E.result=h.sent(),E)];case 7:return[3,9];case 8:g=h.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(g.message),code:eo.INTERNAL_SERVER_ERROR.CODE}];case 9:return[2]}})})()}},{key:"aggregate",value:function e(e){var t=this;return i(function(){var n,r;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0};return[4,t.model.aggregate(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message,code:eo.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}}]);return e}();k(nH,"MongooseController");var nY=nH;var nB=require("mongodb"),nW=require("mongoose");var nV=/*#__PURE__*/function(e){f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nB.Db);k(nV,"C_Db");var nJ=nV,nQ=/*#__PURE__*/function(e){f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nW.Document);k(nQ,"C_Document");var n$=nQ,nX=/*#__PURE__*/function(e){f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nW.Model);k(nX,"C_Model");var nz=nX,nZ=/*#__PURE__*/function(e){f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nB.Collection);k(nZ,"C_Collection");var n0=nZ;var n1=require("graphql-ws/use/ws"),n2=require("ws");function n4(e){return new n2.WebSocketServer({server:e.server,path:e.path})}k(n4,"createWSServer");function n3(e){return(0,n1.useServer)({schema:e.schema},e.server)}k(n3,"initGraphQLWS");0&&(module.exports={BUILD_DIRECTORY:BUILD_DIRECTORY,CHECK_PACKAGE_EMPTY_RESULT:CHECK_PACKAGE_EMPTY_RESULT,COMMIT_LINT_CLI:COMMIT_LINT_CLI,COMMIT_LINT_PACKAGE_NAME:COMMIT_LINT_PACKAGE_NAME,CYBERSKILL_CLI:CYBERSKILL_CLI,CYBERSKILL_CLI_PATH:CYBERSKILL_CLI_PATH,CYBERSKILL_DIRECTORY:CYBERSKILL_DIRECTORY,CYBERSKILL_PACKAGE_NAME:CYBERSKILL_PACKAGE_NAME,C_Collection:C_Collection,C_Db:C_Db,C_Document:C_Document,C_Model:C_Model,ESLINT_CLI:ESLINT_CLI,ESLINT_INSPECT_CLI:ESLINT_INSPECT_CLI,ESLINT_INSPECT_PACKAGE_NAME:ESLINT_INSPECT_PACKAGE_NAME,ESLINT_PACKAGE_NAME:ESLINT_PACKAGE_NAME,E_CommandType:E_CommandType,E_IssueType:E_IssueType,GIT_CLI:GIT_CLI,GIT_COMMIT_EDITMSG:GIT_COMMIT_EDITMSG,GIT_HOOK:GIT_HOOK,GIT_IGNORE:GIT_IGNORE,HOOK:HOOK,LINT_STAGED_CLI:LINT_STAGED_CLI,LINT_STAGED_PACKAGE_NAME:LINT_STAGED_PACKAGE_NAME,MIGRATE_MONGO_CLI:MIGRATE_MONGO_CLI,MIGRATE_MONGO_PACKAGE_NAME:MIGRATE_MONGO_PACKAGE_NAME,MongoController:MongoController,MongooseController:MongooseController,NODE_MODULES:NODE_MODULES,NODE_MODULES_INSPECT_CLI:NODE_MODULES_INSPECT_CLI,NODE_MODULES_INSPECT_PACKAGE_NAME:NODE_MODULES_INSPECT_PACKAGE_NAME,PACKAGE_JSON:PACKAGE_JSON,PACKAGE_LOCK_JSON:PACKAGE_LOCK_JSON,PATH:PATH,PLAYWRIGHT_PACKAGE_NAME:PLAYWRIGHT_PACKAGE_NAME,PNPM_CLI:PNPM_CLI,PNPM_EXEC_CLI:PNPM_EXEC_CLI,PNPM_LOCK_YAML:PNPM_LOCK_YAML,SIMPLE_GIT_HOOKS_PACKAGE_NAME:SIMPLE_GIT_HOOKS_PACKAGE_NAME,SIMPLE_GIT_HOOK_CLI:SIMPLE_GIT_HOOK_CLI,SIMPLE_GIT_HOOK_JSON:SIMPLE_GIT_HOOK_JSON,TSCONFIG_JSON:TSCONFIG_JSON,TSC_CLI:TSC_CLI,TSC_PACKAGE_NAME:TSC_PACKAGE_NAME,TSX_CLI:TSX_CLI,VITEST_CLI:VITEST_CLI,VITEST_PACKAGE_NAME:VITEST_PACKAGE_NAME,WORKING_DIRECTORY:WORKING_DIRECTORY,aggregatePaginate:aggregatePaginate,appendFileSync:appendFileSync,checkPackage:checkPackage,clearAllErrorLists:clearAllErrorLists,command:command,createApolloServer:createApolloServer,createCors:createCors,createExpress:createExpress,createWSServer:createWSServer,existsSync:existsSync,express:express,expressMiddleware:expressMiddleware,formatCommand:formatCommand,getLatestPackageVersion:getLatestPackageVersion,getPackage:getPackage,getStoredErrorLists:getStoredErrorLists,initGraphQLWS:initGraphQLWS,installDependencies:installDependencies,join:join,logNodeJS:logNodeJS,mongo:mongo,mongoosePaginate:mongoosePaginate,rawCommand:rawCommand,readFileSync:readFileSync,resolve:resolve,resolveCommands:resolveCommands,resolveWorkingPath:resolveWorkingPath,rmSync:rmSync,runCommand:runCommand,setMongoMigrateConfig:setMongoMigrateConfig,setupPackages:setupPackages,storageNodeJS:storageNodeJS,throwError:throwError,writeFileSync:writeFileSync});