@cyberskill/shared 1.127.0 → 1.129.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/_tsup-dts-rollup.d.cts +57 -44
- package/dist/_tsup-dts-rollup.d.ts +57 -44
- package/dist/configs/commitlint/index.cjs +1 -1
- package/dist/configs/commitlint/index.js +1 -1
- package/dist/configs/config.util.cjs +1 -1
- package/dist/configs/config.util.js +1 -1
- package/dist/configs/index.cjs +1 -1
- package/dist/configs/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +1 -1
- package/dist/{nodejs → node}/apollo-server/apollo-server.util.cjs +1 -1
- package/dist/{nodejs → node}/apollo-server/apollo-server.util.js +1 -1
- package/dist/{nodejs → node}/apollo-server/index.cjs +1 -1
- package/dist/{nodejs → node}/apollo-server/index.js +1 -1
- package/dist/node/cli/cli.util.cjs +2 -0
- package/dist/node/cli/cli.util.js +2 -0
- package/dist/node/cli/index.cjs +1 -0
- package/dist/node/cli/index.js +1 -0
- package/dist/node/command/command.util.cjs +1 -0
- package/dist/node/command/command.util.js +1 -0
- package/dist/node/command/index.cjs +1 -0
- package/dist/node/command/index.js +1 -0
- package/dist/{nodejs → node}/express/express.util.cjs +1 -1
- package/dist/{nodejs → node}/express/express.util.js +1 -1
- package/dist/{nodejs → node}/express/index.cjs +1 -1
- package/dist/{nodejs → node}/express/index.js +1 -1
- package/dist/node/fs/fs.util.cjs +1 -0
- package/dist/node/fs/fs.util.js +1 -0
- package/dist/node/fs/index.cjs +1 -0
- package/dist/node/fs/index.js +1 -0
- package/dist/node/index.cjs +1 -0
- package/dist/{nodejs → node}/index.d.cts +6 -5
- package/dist/{nodejs → node}/index.d.ts +6 -5
- package/dist/node/index.js +1 -0
- package/dist/node/mongo/index.cjs +1 -0
- package/dist/node/mongo/index.js +1 -0
- package/dist/node/mongo/mongo.util.cjs +1 -0
- package/dist/node/mongo/mongo.util.js +1 -0
- package/dist/node/package/index.cjs +1 -0
- package/dist/{nodejs → node}/package/index.d.cts +5 -5
- package/dist/{nodejs → node}/package/index.d.ts +5 -5
- package/dist/node/package/index.js +1 -0
- package/dist/node/package/package.type.cjs +1 -0
- package/dist/node/package/package.type.d.cts +4 -0
- package/dist/node/package/package.type.d.ts +4 -0
- package/dist/node/package/package.type.js +1 -0
- package/dist/node/package/package.util.cjs +1 -0
- package/dist/{nodejs → node}/package/package.util.d.cts +2 -2
- package/dist/{nodejs → node}/package/package.util.d.ts +2 -2
- package/dist/node/package/package.util.js +1 -0
- package/dist/node/path/index.cjs +1 -0
- package/dist/{nodejs → node}/path/index.d.cts +1 -0
- package/dist/{nodejs → node}/path/index.d.ts +1 -0
- package/dist/node/path/index.js +1 -0
- package/dist/node/path/path.constant.cjs +1 -0
- package/dist/{nodejs → node}/path/path.constant.d.cts +1 -0
- package/dist/{nodejs → node}/path/path.constant.d.ts +1 -0
- package/dist/node/path/path.constant.js +1 -0
- package/dist/node/storage/index.cjs +1 -0
- package/dist/node/storage/index.js +1 -0
- package/dist/node/storage/storage.util.cjs +1 -0
- package/dist/node/storage/storage.util.js +1 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/next-intl/index.cjs +1 -1
- package/dist/react/next-intl/index.js +1 -1
- package/dist/react/next-intl/next-intl.provider.cjs +1 -1
- package/dist/react/next-intl/next-intl.provider.js +1 -1
- package/dist/react/storage/index.cjs +1 -1
- package/dist/react/storage/index.js +1 -1
- package/dist/react/storage/storage.hook.cjs +1 -1
- package/dist/react/storage/storage.hook.js +1 -1
- package/dist/react/storage/storage.util.cjs +1 -1
- package/dist/react/storage/storage.util.js +1 -1
- package/dist/react/vitest/index.cjs +1 -1
- package/dist/react/vitest/index.js +1 -1
- package/dist/react/vitest/vitest.unit.cjs +1 -1
- package/dist/react/vitest/vitest.unit.js +1 -1
- package/package.json +75 -74
- package/public/wiki/convention.md +1 -1
- package/dist/nodejs/cli/cli.util.cjs +0 -2
- package/dist/nodejs/cli/cli.util.js +0 -2
- package/dist/nodejs/cli/index.cjs +0 -1
- package/dist/nodejs/cli/index.js +0 -1
- package/dist/nodejs/command/command.util.cjs +0 -1
- package/dist/nodejs/command/command.util.js +0 -1
- package/dist/nodejs/command/index.cjs +0 -1
- package/dist/nodejs/command/index.js +0 -1
- package/dist/nodejs/fs/fs.util.cjs +0 -1
- package/dist/nodejs/fs/fs.util.js +0 -1
- package/dist/nodejs/fs/index.cjs +0 -1
- package/dist/nodejs/fs/index.js +0 -1
- package/dist/nodejs/index.cjs +0 -1
- package/dist/nodejs/index.js +0 -1
- package/dist/nodejs/mongo/index.cjs +0 -1
- package/dist/nodejs/mongo/index.js +0 -1
- package/dist/nodejs/mongo/mongo.util.cjs +0 -1
- package/dist/nodejs/mongo/mongo.util.js +0 -1
- package/dist/nodejs/package/index.cjs +0 -1
- package/dist/nodejs/package/index.js +0 -1
- package/dist/nodejs/package/package.constant.cjs +0 -1
- package/dist/nodejs/package/package.constant.d.cts +0 -1
- package/dist/nodejs/package/package.constant.d.ts +0 -1
- package/dist/nodejs/package/package.constant.js +0 -1
- package/dist/nodejs/package/package.type.cjs +0 -1
- package/dist/nodejs/package/package.type.d.cts +0 -3
- package/dist/nodejs/package/package.type.d.ts +0 -3
- package/dist/nodejs/package/package.type.js +0 -0
- package/dist/nodejs/package/package.util.cjs +0 -1
- package/dist/nodejs/package/package.util.js +0 -1
- package/dist/nodejs/path/index.cjs +0 -1
- package/dist/nodejs/path/index.js +0 -1
- package/dist/nodejs/path/path.constant.cjs +0 -1
- package/dist/nodejs/path/path.constant.js +0 -1
- package/dist/nodejs/storage/index.cjs +0 -1
- package/dist/nodejs/storage/index.js +0 -1
- package/dist/nodejs/storage/storage.util.cjs +0 -1
- package/dist/nodejs/storage/storage.util.js +0 -1
- /package/dist/{nodejs → node}/apollo-server/apollo-server.type.cjs +0 -0
- /package/dist/{nodejs → node}/apollo-server/apollo-server.type.d.cts +0 -0
- /package/dist/{nodejs → node}/apollo-server/apollo-server.type.d.ts +0 -0
- /package/dist/{nodejs → node}/apollo-server/apollo-server.type.js +0 -0
- /package/dist/{nodejs → node}/apollo-server/apollo-server.util.d.cts +0 -0
- /package/dist/{nodejs → node}/apollo-server/apollo-server.util.d.ts +0 -0
- /package/dist/{nodejs → node}/apollo-server/index.d.cts +0 -0
- /package/dist/{nodejs → node}/apollo-server/index.d.ts +0 -0
- /package/dist/{nodejs → node}/cli/cli.util.d.cts +0 -0
- /package/dist/{nodejs → node}/cli/cli.util.d.ts +0 -0
- /package/dist/{nodejs → node}/cli/index.d.cts +0 -0
- /package/dist/{nodejs → node}/cli/index.d.ts +0 -0
- /package/dist/{nodejs → node}/command/command.type.cjs +0 -0
- /package/dist/{nodejs → node}/command/command.type.d.cts +0 -0
- /package/dist/{nodejs → node}/command/command.type.d.ts +0 -0
- /package/dist/{nodejs → node}/command/command.type.js +0 -0
- /package/dist/{nodejs → node}/command/command.util.d.cts +0 -0
- /package/dist/{nodejs → node}/command/command.util.d.ts +0 -0
- /package/dist/{nodejs → node}/command/index.d.cts +0 -0
- /package/dist/{nodejs → node}/command/index.d.ts +0 -0
- /package/dist/{nodejs → node}/express/express.type.cjs +0 -0
- /package/dist/{nodejs → node}/express/express.type.d.cts +0 -0
- /package/dist/{nodejs → node}/express/express.type.d.ts +0 -0
- /package/dist/{nodejs → node}/express/express.type.js +0 -0
- /package/dist/{nodejs → node}/express/express.util.d.cts +0 -0
- /package/dist/{nodejs → node}/express/express.util.d.ts +0 -0
- /package/dist/{nodejs → node}/express/index.d.cts +0 -0
- /package/dist/{nodejs → node}/express/index.d.ts +0 -0
- /package/dist/{nodejs → node}/fs/fs.type.cjs +0 -0
- /package/dist/{nodejs → node}/fs/fs.type.d.cts +0 -0
- /package/dist/{nodejs → node}/fs/fs.type.d.ts +0 -0
- /package/dist/{nodejs → node}/fs/fs.type.js +0 -0
- /package/dist/{nodejs → node}/fs/fs.util.d.cts +0 -0
- /package/dist/{nodejs → node}/fs/fs.util.d.ts +0 -0
- /package/dist/{nodejs → node}/fs/index.d.cts +0 -0
- /package/dist/{nodejs → node}/fs/index.d.ts +0 -0
- /package/dist/{nodejs → node}/log/index.cjs +0 -0
- /package/dist/{nodejs → node}/log/index.d.cts +0 -0
- /package/dist/{nodejs → node}/log/index.d.ts +0 -0
- /package/dist/{nodejs → node}/log/index.js +0 -0
- /package/dist/{nodejs → node}/log/log.type.cjs +0 -0
- /package/dist/{nodejs → node}/log/log.type.d.cts +0 -0
- /package/dist/{nodejs → node}/log/log.type.d.ts +0 -0
- /package/dist/{nodejs → node}/log/log.type.js +0 -0
- /package/dist/{nodejs → node}/log/log.util.cjs +0 -0
- /package/dist/{nodejs → node}/log/log.util.d.cts +0 -0
- /package/dist/{nodejs → node}/log/log.util.d.ts +0 -0
- /package/dist/{nodejs → node}/log/log.util.js +0 -0
- /package/dist/{nodejs → node}/mongo/index.d.cts +0 -0
- /package/dist/{nodejs → node}/mongo/index.d.ts +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.constant.cjs +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.constant.d.cts +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.constant.d.ts +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.constant.js +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.type.cjs +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.type.d.cts +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.type.d.ts +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.type.js +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.util.d.cts +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.util.d.ts +0 -0
- /package/dist/{nodejs → node}/path/path.util.cjs +0 -0
- /package/dist/{nodejs → node}/path/path.util.d.cts +0 -0
- /package/dist/{nodejs → node}/path/path.util.d.ts +0 -0
- /package/dist/{nodejs → node}/path/path.util.js +0 -0
- /package/dist/{nodejs → node}/storage/index.d.cts +0 -0
- /package/dist/{nodejs → node}/storage/index.d.ts +0 -0
- /package/dist/{nodejs → node}/storage/storage.util.d.cts +0 -0
- /package/dist/{nodejs → node}/storage/storage.util.d.ts +0 -0
- /package/dist/{nodejs → node}/ws/index.cjs +0 -0
- /package/dist/{nodejs → node}/ws/index.d.cts +0 -0
- /package/dist/{nodejs → node}/ws/index.d.ts +0 -0
- /package/dist/{nodejs → node}/ws/index.js +0 -0
- /package/dist/{nodejs → node}/ws/ts.util.cjs +0 -0
- /package/dist/{nodejs → node}/ws/ts.util.d.cts +0 -0
- /package/dist/{nodejs → node}/ws/ts.util.d.ts +0 -0
- /package/dist/{nodejs → node}/ws/ts.util.js +0 -0
- /package/dist/{nodejs → node}/ws/ws.type.cjs +0 -0
- /package/dist/{nodejs → node}/ws/ws.type.d.cts +0 -0
- /package/dist/{nodejs → node}/ws/ws.type.d.ts +0 -0
- /package/dist/{nodejs → node}/ws/ws.type.js +0 -0
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,r,n,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){r(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(n,s)}}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){s(o,n,i,a,c,"next",e)}function c(e){s(o,n,i,a,c,"throw",e)}a(undefined)})}}function o(e,t,r){t=d(t);return _(e,N()?Reflect.construct(t,r||[],d(e).constructor):t.apply(e,r))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function u(e,t,r){if(t)c(e.prototype,t);if(r)c(e,r);return e}function l(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}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)C(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 m(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function g(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var s=true;var i=false;var o,a;try{for(r=r.call(e);!(s=(o=r.next()).done);s=true){n.push(o.value);if(t&&n.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&r["return"]!=null)r["return"]()}finally{if(i)throw a}}return n}function v(){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 E(){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 h(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){l(e,t,r[t])})}return e}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function S(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{y(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function O(e,t){if(e==null)return{};var r=I(e,t);var n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){n=i[s];if(t.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;r[n]=e[n]}}return r}function I(e,t){if(e==null)return{};var r={};var n=Object.keys(e);var s,i;for(i=0;i<n.length;i++){s=n[i];if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function _(e,t){if(t&&(T(t)==="object"||typeof t==="function")){return t}return n(e)}function C(e,t){C=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return C(e,t)}function b(e,r){return t(e)||g(e,r)||R(e,r)||v()}function A(e){return r(e)||m(e)||R(e)||E()}function T(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function R(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}function w(e,t){var r,n,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(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(r=1,n&&(s=a[0]&2?n["return"]:a[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;if(n=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++;n=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];n=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var x=Object.defineProperty;var D=function(e,t,r){return t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var G=function(e,t){return x(e,"name",{value:t,configurable:!0})};var L=function(e,t,r){return D(e,(typeof t==="undefined"?"undefined":T(t))!="symbol"?t+"":t,r)};var M={extends:["@commitlint/config-conventional"]};var j=function(e){return e.ESLINT="eslint",e.COMMITLINT="commitlint",e.LINT_STAGED="lint-staged",e.VITEST_REACT_E2E="vitest-react-e2e",e.VITEST_REACT_UNIT="vitest-react-unit",e}({});import P from"@antfu/eslint-config";import k from"@vitejs/plugin-react-swc";import{defineConfig as U}from"vitest/config";function F(e){return U(h({plugins:[k()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}G(F,"vitestE2E");import q from"@vitejs/plugin-react-swc";import{defineConfig as B}from"vitest/config";var K=".cyberskill-storage";import H from"@dotenvx/dotenvx";import{bool as Y,cleanEnv as V,str as W}from"envalid";import Q from"node:os";import z from"node:path";import J from"node:process";var $=!1;function X(){$||(H.config(),$=!0)}G(X,"loadEnvFile");function Z(){X();var e=V(J.env,{CWD:W({default:J.cwd()}),DEBUG:Y({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:W({default:z.join(Q.homedir(),K)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}G(Z,"getEnv");var ee=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as et}from"node:child_process";import er from"node:process";import*as en from"node:util";var es=function(e){return e.Error="error",e.Warning="warning",e}({});import ei from"chalk";import eo from"consola";import{GraphQLError as ea}from"graphql";var ec={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 eu=Z();function el(e){var t=e.message,r=e.status,n=r===void 0?ec.INTERNAL_SERVER_ERROR:r,s=e.type,i=s===void 0?"graphql":s;var o;var a=(o=t!==null&&t!==void 0?t:n.MESSAGE)!==null&&o!==void 0?o:"Internal server error";throw i==="graphql"?new ea(a,{extensions:{code:n.CODE}}):new Error(a)}G(el,"throwError");eu.DEBUG||(eo.level=4);function ed(e){var t=ei[e];return typeof t=="function"?t:ei.green}G(ed,"chalkKeyword");var ef={silent:eo.silent,level:eo.level,fatal:eo.fatal,error:eo.error,warn:eo.warn,log:eo.log,info:eo.info,success:eo.success,ready:eo.ready,start:eo.start,box:eo.box,debug:eo.debug,trace:eo.trace,verbose:eo.verbose,printBoxedLog:function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){eo.box(ei.green(e));return}t.forEach(function(e){var t=e.file,n=e.position,s=e.rule,i=e.message;eo.log("".concat(ei.gray("File:")," ").concat(ei.blue("".concat(t).concat(n?":".concat(n):"")))),s&&eo.log(" ".concat(ed(r)("Rule:")," ").concat(s)),eo.log(" ".concat(ed(r)("Message:")," ").concat(i))}),eo.box(ed(r)("".concat(e," : ").concat(t.length))),eo.log(ei.gray("─".repeat(40)))}};var ep={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import em from"node-fetch";import eg from"fs-extra";var ev=eg,eE=eg.lstatSync,eh=eg.readdirSync,ey=eg.mkdirSync,eS=eg.readFileSync,eO=eg.unlinkSync,eI=eg.statSync,e_=eg.readJsonSync;function eC(e,t,r){eg.writeFileSync(e,t,r!==null&&r!==void 0?r:"utf-8")}G(eC,"writeFileSync");function eb(e,t,r){eg.appendFileSync(e,t,r!==null&&r!==void 0?r:"utf-8")}G(eb,"appendFileSync");function eA(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return t.every(function(e){return eg.pathExistsSync(e)})}G(eA,"pathExistsSync");function eT(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}t.forEach(function(e){eA(e)&&eg.removeSync(e)})}G(eT,"removeSync");function eR(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=r.extensions,s=O(r,["extensions"]);eg.copySync(e,t,h({filter:G(function(e){return eI(e).isDirectory()||!n||n.length===0?!0:n.includes(e1.extname(e))},"filter")},s))}G(eR,"copySync");var eN=Z();function ew(e){var t=e3(eN.CWD,te);if(!eA(t))return!1;try{var r=e_(t),n=r.name,s=r.dependencies,i=s===void 0?{}:s,o=r.devDependencies,a=o===void 0?{}:o,c=n===e,u=e in i,l=e in a;return c||u||l?{path:t,file:r,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return ef.warn("Failed to read package.json: ".concat(e.message)),!1}}G(ew,"getPackage");function ex(e){return i(function(){var t,r,n,s;return w(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,em("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:r=i.sent(),n=r.version;return[2,n];case 3:s=i.sent();throw ef.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}G(ex,"getLatestPackageVersion");function eD(e,t){return i(function(){var r,n,s,i,o,a,c,u,l,d,f,p,m,g,v,E,y,S,O,I,_;return w(this,function(C){switch(C.label){case 0:C.trys.push([0,4,,5]);r=ew(e);if(!r)return[2,h({},ep)];c=r.path,u=r.file,l=r.isCurrentProject,d=r.isDepend,f=r.isDevDepend,p=(n=u.dependencies)!==null&&n!==void 0?n:{},m=(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=m[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,ex(e)];case 2:y=C.sent();C.label=3;case 3:v=y,E=l||g===v;if(!E&&(t===null||t===void 0?void 0:t.update)){;O=d?"dependencies":f?"devDependencies":null;O&&((S=u[O])===null||S===void 0?void 0:S[e])!==v&&(u[O]=(I=u[O])!==null&&I!==void 0?I:{},u[O][e]=v,eC(c,JSON.stringify(u,null,4)),ef.info('Updated "'.concat(e,'" to version ').concat(v)))}return[2,{isCurrentProject:l,installedPath:c,file:u,isUpToDate:E}];case 4:_=C.sent();return[2,(ef.error('Error checking package "'.concat(e,'": ').concat(_.message)),h({},ep))];case 5:return[2]}})})()}G(eD,"checkPackage");function eG(){return i(function(){var e,t,r,n,s,i,o,a,c,u,l,d;return w(this,function(f){switch(f.label){case 0:e=[{command:G(function(){return tU.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:G(function(){return tU.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:G(function(){return tU.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,r=false,n=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,eX("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();ef.warn("Installation attempt failed: ".concat(c)),ef.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();r=true;n=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(r){throw n}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}G(eG,"installDependencies");function eL(e,t){return i(function(){var r,n,s,i,o,a,c,u,l,d,f;return w(this,function(p){switch(p.label){case 0:if(!eA(tM.PACKAGE_JSON)){ef.error("package.json not found. Aborting setup.");return[2]}p.label=1;case 1:p.trys.push([1,13,,14]);r=A(new Set(e)).sort();return[4,Promise.all(r.map(function(e){return eD(e,h({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:n=p.sent().every(function(e){return e.isUpToDate});if(n)return[3,4];return[4,eG()];case 3:n=p.sent();p.label=4;case 4:n;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 ef.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})})()}G(eL,"setupPackages");import eM from"node-persist";var ej=Z();function eP(){return i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=eM.defaultInstance;if(e)return[3,2];return[4,eM.init({dir:ej.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]}})})()}G(eP,"initNodePersist");var ek={get:function e(e){return i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eP()];case 1:n.sent();return[4,eM.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,(ef.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eP()];case 1:n.sent();return[4,eM.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();ef.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eP()];case 1:r.sent();return[4,eM.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();ef.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 w(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eP()];case 1:r.sent();return[4,eM.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:(ef.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,(ef.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return w(this,function(t){try{return[2,"".concat(ej.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(ef.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eU=Z(),eF=en.promisify(et);function eq(e){return"error_list:".concat(e)}G(eq,"getErrorListKey");function eB(e){return i(function(){var t,r,n;return w(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),r=eq(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,ek.set(r,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(function(){return i(function(){var e;return w(this,function(t){switch(t.label){case 0:return[4,ek.getLogLink(r)];case 1:e=t.sent();e&&ef.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:n=s.sent();ef.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})})()}G(eB,"saveErrorListToStorage");function eK(){return i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ek.keys()];case 1:e=n.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 i(function(){var t;return w(this,function(r){switch(r.label){case 0:return[4,ek.get(e)];case 1:return[2,((t=r.sent())===null||t===void 0?void 0:t.errors)||[]]}})})()}))];case 2:return[2,n.sent().flat()];case 3:r=n.sent();return[2,(ef.error("Failed to retrieve stored errors: ".concat(r.message)),[])];case 4:return[2]}})})()}G(eK,"getStoredErrorLists");function eH(){return i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ek.keys()];case 1:e=n.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 ek.remove(e)}))];case 2:n.sent();return[3,4];case 3:r=n.sent();ef.error("Failed to clear error lists: ".concat(r.message));return[3,4];case 4:return[2]}})})()}G(eH,"clearAllErrorLists");function eY(e){var t=[],r=[],n="",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("/"))n=e.trim();else{var a,c,u,l,d;var f=s.exec(e)||[],p=i.exec(e)||[],m=o.exec(e)||[];var g,v,E,h,y,S;f.length&&n?t.push({file:n,position:"".concat(f[1],":").concat(f[2]),type:f[3]===es.Error?es.Error:es.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:(v=f===null||f===void 0?void 0:(c=f[5])===null||c===void 0?void 0:c.trim())!==null&&v!==void 0?v:""}):p.length?t.push({file:(E=p===null||p===void 0?void 0:p[1])!==null&&E!==void 0?E:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===es.Error?es.Error:es.Warning,message:(h=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&h!==void 0?h:""}):m.length?t.push({file:"commitlint",type:es.Error,message:(y=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&y!==void 0?y:"",rule:(S=m===null||m===void 0?void 0:(d=m[2])===null||d===void 0?void 0:d.trim())!==null&&S!==void 0?S:""}):r.push(e.trim())}}),t.length&&eB(t),eU.DEBUG&&r.length&&(ef.warn("Unmatched lines:"),r.forEach(function(e){return ef.info(" ".concat(e))}))}G(eY,"parseTextErrors");function eV(e){try{var t=JSON.parse(e),r=[];t.forEach(function(e){var t=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;r.push({type:n===2?es.Error:es.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),r.length&&eB(r)}catch(t){eY(e)}}G(eV,"parseCommandOutput");function eW(e){return i(function(e){var t,r,n,s,i,o,a,c,u;var l=arguments;return w(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eV;r=new AbortController;er.on("SIGINT",function(){ef.warn("Process interrupted. Terminating..."),r.abort(),er.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,eF(e,{maxBuffer:0x6400000,signal:r.signal})];case 2:n=d.sent(),s=n.stdout,i=n.stderr;[s,i].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&ef.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}G(eW,"executeCommand");function eQ(e){return{raw:!0,cmd:e}}G(eQ,"rawCommand");function ez(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(tA," ").concat(e6," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(tA," ").concat(t_," ").concat(td," ").concat(e):"".concat(tA," ").concat(tl," ").concat(e)}G(ez,"formatCLI");function eJ(e,t){return typeof e=="function"?ez(e(t),t):(typeof e==="undefined"?"undefined":T(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?ez(e,t):e}G(eJ,"formatCommand");function e$(e){return i(function(e){var t,r,n,s,i,o,a;var c=arguments;return w(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};n=(r=t===null||t===void 0?void 0:t.isRemote)!==null&&r!==void 0?r:!1;if(!n)return[3,1];a=!1;return[3,3];case 1:return[4,eD(e6)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:s=a,i={isRemote:n,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=b(e,2),r=t[0],n=t[1];return[r,eJ(n,i)]}))]}})}).apply(this,arguments)}G(e$,"resolveCommands");function eX(e,t){return i(function(){var r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);ef.start("".concat(e)),eU.DEBUG&&ef.info("→ ".concat(t));return[4,eW(t)];case 1:n.sent(),ef.success("".concat(e," done."));return[3,3];case 2:r=n.sent();throw ef.error("".concat(e," failed: ").concat(r.message)),r;case 3:return[2]}})})()}G(eX,"runCommand");import eZ from"node:path";var e0=Z(),e1=eZ;function e2(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=e1).resolve.apply(n,[e0.CWD].concat(A(t)))}G(e2,"resolveWorkingPath");function e4(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=e1).resolve.apply(n,A(t))}G(e4,"resolve");function e3(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=e1).join.apply(n,A(t))}G(e3,"join");var e5=Z(),e8=e5.CWD,e6="@cyberskill/shared",e7="node_modules",e9="dist",te="package.json",tt="package-lock.json",tr="tsconfig.json",tn=".gitignore",ts=".simple-git-hooks.json",ti="pnpm-lock.yaml",to=".git/hooks/",ta=".git/COMMIT_EDITMSG",tc=".migrate-mongo.config.js",tu=e3(e8,e7,e6,e9),tl="cyberskill",td="src/nodejs/cli/index.ts",tf="eslint",tp="eslint",tm="vitest",tg="playwright",tv="vitest",tE="@commitlint/cli",th="commitlint",ty="lint-staged",tS="lint-staged",tO="typescript",tI="tsc",t_="tsx",tC="git",tb="pnpm",tA="pnpm exec",tT="simple-git-hooks",tR="simple-git-hooks",tN="@eslint/config-inspector",tw="eslint-config-inspector",tx="node-modules-inspector",tD="node-modules-inspector",tG="migrate-mongo",tL="./node_modules/migrate-mongo/bin/migrate-mongo",tM={CYBERSKILL_DIRECTORY:tu,WORKING_DIRECTORY:e8,TS_CONFIG:e2(tr),GIT_IGNORE:e2(tn),GIT_HOOK:e2(to),GIT_COMMIT_MSG:e2(ta),SIMPLE_GIT_HOOKS_JSON:e2(ts),PACKAGE_JSON:e2(te),PACKAGE_LOCK_JSON:e2(tt),PNPM_LOCK_YAML:e2(ti),NODE_MODULES:e2(e7),MIGRATE_MONGO_CONFIG:e2(tc),LINT_STAGED_CONFIG:e2("".concat(tu,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:e2("".concat(tu,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:e2("".concat(tu,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:e2("".concat(tu,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:e2("".concat(tu,"/react/vitest/vitest.e2e.js"))};function tj(e){var t=e.isCurrentProject;return h({"pre-commit":tS,"commit-msg":th},t&&{"pre-push":eQ("".concat(tC," pull"))})}G(tj,"createGitHooksConfig");function tP(e,t,r){return i(function(){return w(this,function(n){switch(n.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case ee.CLI:return[3,1];case ee.STRING:return[3,3]}return[3,4];case 1:return[4,eL(t.split(" "),{update:!0})];case 2:return[2,(n.sent(),eJ(eQ("".concat(tA," ").concat(r))))];case 3:return[2,eJ(eQ(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}G(tP,"buildCommand");function tk(e,t,r){return function(){return i(function(){return w(this,function(n){return[2,tP(e,t,r)]})})()}}G(tk,"commandFactory");var tU={simpleGitHooks:tk(ee.CLI,tT,tR),eslintInspect:tk(ee.CLI,tN,tw),nodeModulesInspect:tk(ee.CLI,tx,tD),eslintCheck:tk(ee.CLI,tf,"".concat(tp," ").concat(tM.WORKING_DIRECTORY," --no-cache")),eslintFix:tk(ee.CLI,tf,"".concat(tp," ").concat(tM.WORKING_DIRECTORY," --fix --no-cache")),typescriptCheck:tk(ee.CLI,tO,"".concat(tI," -p ").concat(tM.TS_CONFIG," --noEmit")),configureGitHook:tk(ee.STRING,"".concat(tC," config core.hooksPath ").concat(tM.GIT_HOOK)),testUnit:tk(ee.CLI,tm,"".concat(tv," --config ").concat(tM.UNIT_TEST_CONFIG)),testE2e:tk(ee.CLI,"".concat(tm," ").concat(tg),"".concat(tv," --config ").concat(tM.E2E_TEST_CONFIG)),mongoMigrateCreate:G(function(e){return tk(ee.CLI,tG,"".concat(t_," ").concat(tL," create ").concat(e," -f ").concat(tM.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:tk(ee.CLI,tG,"".concat(t_," ").concat(tL," up -f ").concat(tM.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:tk(ee.CLI,tG,"".concat(t_," ").concat(tL," down -f ").concat(tM.MIGRATE_MONGO_CONFIG)),commitLint:tk(ee.CLI,tE,"".concat(th," --edit ").concat(tM.GIT_COMMIT_MSG," --config ").concat(tM.COMMITLINT_CONFIG)),lintStaged:tk(ee.CLI,ty,"".concat(tS," --config ").concat(tM.LINT_STAGED_CONFIG)),stageBuildDirectory:tk(ee.STRING,"".concat(tC," add ").concat(e9)),build:tk(ee.STRING,"".concat(tb," run build")),pnpmInstallStandard:tk(ee.STRING,"".concat(tb," install")),pnpmInstallLegacy:tk(ee.STRING,"".concat(tb," install --legacy-peer-deps")),pnpmInstallForce:tk(ee.STRING,"".concat(tb," install --force"))};function tF(e){return B(h({plugins:[q()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tM.UNIT_TEST_SETUP_CONFIG]}},e))}G(tF,"vitestUnit");function tq(e){try{return JSON.parse(e),!0}catch(e){return!1}}G(tq,"isJson");function tB(e){return(typeof e==="undefined"?"undefined":T(e))=="object"&&e!==null&&!Array.isArray(e)}G(tB,"isObject");function tK(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n={};var s=true,i=false,o=undefined,a=true,c=false,u=undefined;try{for(var l=t.flat()[Symbol.iterator](),d;!(a=(d=l.next()).done);a=true){var f=d.value;try{for(var p=Object.entries(f)[Symbol.iterator](),m;!(s=(m=p.next()).done);s=true){var g=b(m.value,2),v=g[0],E=g[1];var h=n[v];if(Array.isArray(E)){var y=Array.isArray(h)?h:[];n[v]=A(new Set(A(y).concat(A(E))));continue}if(tB(E)){n[v]=tK(tB(h)?h:{},E);continue}n[v]=E}}catch(e){i=true;o=e}finally{try{if(!s&&p.return!=null){p.return()}}finally{if(i){throw o}}}}}catch(e){c=true;u=e}finally{try{if(!a&&l.return!=null){l.return()}}finally{if(c){throw u}}}return n}G(tK,"deepMerge");import*as tH from"globals";var tY=[{languageOptions:{globals:h({},tH.node,tH.browser)},rules:{"perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}],"dot-notation":"off"},ignores:["build","dist"]}];var tV;var tW=G(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=tK.apply(void 0,[tY].concat(A(t.map(function(e){return e})))),s=n.ignores,i=O(n,["ignores"]),o=Array.isArray(s)&&s.every(function(e){return typeof e=="string"})?{ignores:s}:void 0,a=[i].concat(A(o?[o]:[]));return P.apply(void 0,[{stylistic:{semi:!0,indent:4,quotes:"single"},formatters:{css:!0,html:!0,markdown:"prettier"},yaml:!1,react:!0}].concat(A(a)))},"handleESLint"),tQ=(tV={},l(tV,j.ESLINT,function(e){return tW(e)}),l(tV,j.COMMITLINT,function(e){return tK(e)}),l(tV,j.LINT_STAGED,function(e){return tK(e)}),l(tV,j.VITEST_REACT_UNIT,function(e){return tF(e)}),l(tV,j.VITEST_REACT_E2E,function(e){return F(e)}),tV);function tz(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}var s=tQ[e];if(!s)throw new Error("Unknown config type: ".concat(e));return s.apply(void 0,A(r))}G(tz,"mergeConfigs");import{defineConfig as tJ}from"@eddeee888/gcg-typescript-resolver-files";X();function t$(e){var t=e.uri,r=e.from,n=e.to,s=e.target,i=s===void 0?"client":s;var o=i==="client",a=i==="server";return S(h({schema:t,ignoreNoDocuments:!0,overwrite:!0},o&&{documents:[r]}),{generates:h({},o&&l({},n,{preset:"client",presetConfig:{fragmentMasking:!1,persistedDocuments:!0},config:{useTypeImports:!0}}),a&&l({},n,tJ()))})}G(t$,"createGraphqlCodegenConfig");var tX={"*":["eslint --fix"]};var tZ=(typeof window==="undefined"?"undefined":T(window))<"u";import{ApolloServer as t0}from"@apollo/server";import{expressMiddleware as t1}from"@apollo/server/express4";import{ApolloServerPluginDrainHttpServer as t2}from"@apollo/server/plugin/drainHttpServer";import{ApolloServerPluginLandingPageLocalDefault as t4,ApolloServerPluginLandingPageProductionDefault as t3}from"@apollo/server/plugin/landingPage/default";function t5(e){return new t0(h({schema:e.schema,plugins:[e.isDev?t4():t3(),t2({httpServer:e.server})].concat(A(e.drainServer?[{serverWillStart:function t(){return i(function(){return w(this,function(t){return[2,{drainServer:function t(){return i(function(){var t;return w(this,function(r){(t=e.drainServer)===null||t===void 0?void 0:t.call(e),ef.info("Apollo Server drainServer hook called");return[2]})})()}}]})})()}}]:[]))},e.isDev&&{introspection:!0,includeStacktraceInErrorResponses:!0}))}G(t5,"createApolloServer");import t8 from"node:process";import{hideBin as t6}from"yargs/helpers";import t7 from"yargs/yargs";var t9={name:"@cyberskill/shared",type:"module",version:"1.126.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/env":{types:"./dist/configs/env/index.d.ts",import:"./dist/configs/env/index.js",require:"./dist/configs/env/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:"tsup --watch",lint:"tsx src/nodejs/cli/index.ts lint","lint:fix":"tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"tsx src/nodejs/cli/index.ts lint:inspect",reset:"tsx src/nodejs/cli/index.ts reset",setup:"tsx src/nodejs/cli/index.ts setup",inspect:"tsx src/nodejs/cli/index.ts inspect","test:unit":"tsx src/nodejs/cli/index.ts test:unit","test:e2e":"tsx src/nodejs/cli/index.ts test:e2e",commitlint:"tsx src/nodejs/cli/index.ts commitlint","lint-staged":"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","@dotenvx/dotenvx":"1.41.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@nestjs/common":"11.1.0","@nestjs/core":"11.1.0","@next/eslint-plugin-next":"15.3.1","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.2","body-parser":"2.2.0",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.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.20",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.11.0","graphql-ws":"6.0.4",i18next:"25.0.2",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.16.0",mongoose:"8.14.1","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.1.0","node-fetch":"3.3.2","node-persist":"4.0.4",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.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.4",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.3",vitest:"3.1.2","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/body-parser":"1.19.5","@types/compression":"1.7.5","@types/cookie-parser":"1.4.8","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/express-useragent":"1.0.5","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node":"22.15.3","@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.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};function re(){return i(function(){var e,t;return w(this,function(r){switch(r.label){case 0:if(!eA(tM.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,tU.typescriptCheck()];case 1:return[4,eX.apply(void 0,t.concat([r.sent()]))];case 2:e=r.sent();return[3,4];case 3:e=ef.warn("No TypeScript configuration found. Skipping type check.");r.label=4;case 4:e;return[2]}})})()}G(re,"checkTypescript");function rt(){return i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];r=["Running ESLint with auto-fix"];return[4,tU.eslintFix()];case 1:return[4,eX.apply(void 0,r.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:n=["Running ESLint check"];return[4,tU.eslintCheck()];case 4:return[4,eX.apply(void 0,n.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}G(rt,"checkEslint");function rr(e,t){if(!t.length)return;var r=e==="Errors"?"red":"yellow";ef.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,r)}G(rr,"printIssues");function rn(){return i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:return[4,eK()];case 1:e=n.sent(),t=e.filter(function(e){return e.type===es.Error}),r=e.filter(function(e){return e.type===es.Warning});!t.length&&!r.length?ef.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(rr("Warnings",r),rr("Errors",t),(t.length>0||r.length>0)&&t8.exit(1));return[2]}})})()}G(rn,"showCheckResult");function rs(){return i(function(){var e,t,r,n,s,i;return w(this,function(o){switch(o.label){case 0:return[4,eH()];case 1:o.sent();return[4,eD(e6)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);r=["Building package: ".concat(e6)];return[4,tU.build()];case 4:return[4,eX.apply(void 0,r.concat([o.sent()]))];case 5:o.sent();n=["Staging build artifacts"];return[4,tU.stageBuildDirectory()];case 6:return[4,eX.apply(void 0,n.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw ef.error("Error building and staging ".concat(e6,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,tU.lintStaged()];case 10:return[4,eX.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),rn();return[2]}})})()}G(rs,"lintStaged");function ri(){return i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,tU.eslintInspect()];case 1:return[4,eX.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(ri,"inspectLint");function ro(){return i(function(){return w(this,function(e){switch(e.label){case 0:return[4,eH()];case 1:e.sent();return[4,Promise.all([re(),rt()])];case 2:e.sent(),rn();return[2]}})})()}G(ro,"lintCheck");function ra(){return i(function(){return w(this,function(e){switch(e.label){case 0:return[4,eH()];case 1:e.sent();return[4,Promise.all([re(),rt(!0)])];case 2:e.sent(),rn();return[2]}})})()}G(ra,"lintFix");function rc(){return i(function(){var e;return w(this,function(t){switch(t.label){case 0:return[4,eH()];case 1:t.sent();e=["Validating commit message"];return[4,tU.commitLint()];case 2:return[4,eX.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),rn();return[2]}})})()}G(rc,"commitLint");function ru(){return i(function(){var e,t,r,n;return w(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,tU.configureGitHook()];case 1:return[4,eX.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eT(tM.GIT_HOOK);return[4,e$(tj)];case 3:t=s.sent();eC(tM.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(t,null,4));r="\n".concat(ts,"\n");eA(tM.GIT_IGNORE)?eS(tM.GIT_IGNORE,"utf-8").split("\n").includes(ts)||eb(tM.GIT_IGNORE,r):eC(tM.GIT_IGNORE,r);n=["Setting up simple-git-hooks"];return[4,tU.simpleGitHooks()];case 4:return[4,eX.apply(void 0,n.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}G(ru,"setupGitHook");function rl(){return i(function(){return w(this,function(e){switch(e.label){case 0:return[4,eL([e6],{update:!0,postInstallActions:[ru]})];case 1:e.sent();return[2]}})})()}G(rl,"setup");function rd(){return i(function(){return w(this,function(e){switch(e.label){case 0:eT(tM.NODE_MODULES,tM.PNPM_LOCK_YAML);return[4,eG()];case 1:e.sent();return[4,ru()];case 2:e.sent();return[2]}})})()}G(rd,"reset");function rf(){return i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,tU.nodeModulesInspect()];case 1:return[4,eX.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(rf,"inspect");function rp(){return i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,tU.testUnit()];case 1:return[4,eX.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(rp,"testUnit");function rm(){return i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,tU.testE2e()];case 1:return[4,eX.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(rm,"testE2E");function rg(e){return i(function(){var t;return w(this,function(r){switch(r.label){case 0:t=["Creating MongoDB migration"];return[4,tU.mongoMigrateCreate(e)];case 1:return[4,eX.apply(void 0,t.concat([r.sent()]))];case 2:r.sent();return[2]}})})()}G(rg,"mongoMigrateCreate");function rv(){return i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,tU.mongoMigrateUp()];case 1:return[4,eX.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(rv,"mongoMigrateUp");function rE(){return i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,tU.mongoMigrateDown()];case 1:return[4,eX.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(rE,"mongoMigrateDown");(function(){return i(function(){var e;return w(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,t7(t6(t8.argv)).scriptName(tl).usage("$0 <command> [options]").command("lint","Check code for linting issues",ro).command("lint:fix","Fix linting issues automatically",ra).command("lint:inspect","View active ESLint configuration",ri).command("lint-staged","Run lint checks on staged files",rs).command("commitlint","Validate commit message format",rc).command("setup","Initialize project setup and dependencies",rl).command("reset","Reset the project and reinstall dependencies",rd).command("inspect","Analyze installed project dependencies",rf).command("test:unit","Run unit test suite",rp).command("test:e2e","Run end-to-end test suite",rm).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return i(function(){return w(this,function(t){switch(t.label){case 0:if(!e.name){ef.error("Migration name is required.");return[2]}return[4,rg(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",rv).command("mongo:migrate:down","Rollback last MongoDB migration",rE).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(t9.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();ef.error("Fatal: ".concat(e.message)),t8.exit(1);return[3,3];case 3:return[2]}})})()})();import{Router as rh}from"express";import{NestFactory as ry}from"@nestjs/core";import rS from"body-parser";import rO from"compression";import rI from"cookie-parser";import r_ from"cors";import rC from"express";import rb from"express-session";import rA from"express-useragent";function rT(e){var t=e.isDev,r=e.whiteList,n=O(e,["isDev","whiteList"]);return h({origin:G(function(e,n){t||(r===null||r===void 0?void 0:r.includes(e!==null&&e!==void 0?e:""))?n(null,!0):n(new Error("Not allowed by CORS"),!1)},"origin"),credentials:!0},n)}G(rT,"createCorsOptions");function rR(e){return r_(rT(e))}G(rR,"createCors");function rN(e){return rb(e)}G(rN,"createSession");function rw(e){var t=rC();return t.set("trust proxy",1),t.use(rI()),t.use(rC.urlencoded({extended:!0})),t.use(rO()),t.use(rA.express()),(e===null||e===void 0?void 0:e.staticFolder)&&t.use(rC.static(e.staticFolder)),t}G(rw,"createExpress");function rx(e){return i(function(){var t,r,n;return w(this,function(s){switch(s.label){case 0:return[4,ry.create(e.module)];case 1:n=s.sent();return[2,(n.getHttpAdapter().getInstance().set("trust proxy",1),n.use(rC.urlencoded({extended:!0})),n.use(rI()),n.use(rO()),n.use(rA.express()),e.staticFolder&&n.use(rC.static(e.staticFolder)),e.filters&&(t=n).useGlobalFilters.apply(t,A(e.filters)),e.pipes&&(r=n).useGlobalPipes.apply(r,A(e.pipes)),n)]}})})()}G(rx,"createNest");var rD="MONGO_MIGRATE_OPTIONS";import{Collection as rG,Db as rL}from"mongodb";import{Document as rM,Model as rj}from"mongoose";var rP=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rL);G(rP,"C_Db");var rk=rP,rU=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rM);G(rU,"C_Document");var rF=rU,rq=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rj);G(rq,"C_Model");var rB=rq,rK=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rG);G(rK,"C_Collection");var rH=rK;import{format as rY}from"date-fns";import rV from"migrate-mongo";import{Document as rW}from"mongoose";import rQ from"mongoose-aggregate-paginate-v2";import rz from"mongoose-paginate-v2";import{v4 as rJ}from"uuid";import r$ from"unorm";var rX={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},rZ=Object.entries(rX).reduce(function(e,t){var r=b(t,2),n=r[0],s=r[1];return e[n.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function r0(e){e=r$.nfkc(e);var t=h({},rX,rZ);var r=true,n=false,s=undefined;try{for(var i=Object.entries(t)[Symbol.iterator](),o;!(r=(o=i.next()).done);r=true){var a=b(o.value,2),c=a[0],u=a[1];var l="[".concat(c).concat(u.join(""),"]"),d="(".concat([c].concat(A(u)).join("|"),")");e=e.replace(new RegExp(l,"g"),d)}}catch(e){n=true;s=e}finally{try{if(!r&&i.return!=null){i.return()}}finally{if(n){throw s}}}return e}G(r0,"regexSearchMapper");function r1(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}G(r1,"removeAccent");var r2={Date:{is:G(function(e){return p(e,Date)},"is"),serialize:G(function(e){return{__type:"Date",value:e.toISOString()}},"serialize"),deserialize:G(function(e){return new Date(e)},"deserialize")},Map:{is:G(function(e){return p(e,Map)},"is"),serialize:G(function(e){return{__type:"Map",value:Array.from(e.entries())}},"serialize"),deserialize:G(function(e){return new Map(e)},"deserialize")},Set:{is:G(function(e){return p(e,Set)},"is"),serialize:G(function(e){return{__type:"Set",value:Array.from(e)}},"serialize"),deserialize:G(function(e){return new Set(e)},"deserialize")},RegExp:{is:G(function(e){return p(e,RegExp)},"is"),serialize:G(function(e){return{__type:"RegExp",value:{source:e.source,flags:e.flags}}},"serialize"),deserialize:G(function(e){var t=e.source,r=e.flags;return new RegExp(t,r)},"deserialize")},BigInt:{is:G(function(e){return(typeof e==="undefined"?"undefined":T(e))=="bigint"},"is"),serialize:G(function(e){return{__type:"BigInt",value:e.toString()}},"serialize"),deserialize:G(function(e){return BigInt(e)},"deserialize")}},r4={serialize:function e(e){return JSON.stringify(e,function(e,t){var r=true,n=false,s=undefined;try{for(var i=Object.keys(r2)[Symbol.iterator](),o;!(r=(o=i.next()).done);r=true){var a=o.value;var c=r2[a];if(c.is(t))return c.serialize(t)}}catch(e){n=true;s=e}finally{try{if(!r&&i.return!=null){i.return()}}finally{if(n){throw s}}}return t})},deserialize:function e(e){return JSON.parse(e,function(e,t){if(t&&(typeof t==="undefined"?"undefined":T(t))=="object"&&"__type"in t&&typeof t.__type=="string"){var r=t.__type,n=r2[r];if(n)return n.deserialize(t.value)}return t})}};import r3 from"crypto-js";import r5 from"slugify";var r8=r5.default||r5;function r6(e,t){var r=G(function(e){var r,n;return r8(e!==null&&e!==void 0?e:"",h({lower:(r=t===null||t===void 0?void 0:t.lower)!==null&&r!==void 0?r:!0,locale:(n=t===null||t===void 0?void 0:t.locale)!==null&&n!==void 0?n:"vi"},t))},"slugifyWithOptions");if(tB(e)){var n={};var s=true,i=false,o=undefined;try{for(var a=Object.entries(e)[Symbol.iterator](),c;!(s=(c=a.next()).done);s=true){var u=b(c.value,2),l=u[0],d=u[1];n[l]=r(d)}}catch(e){i=true;o=e}finally{try{if(!s&&a.return!=null){a.return()}}finally{if(i){throw o}}}return n}return r(e)}G(r6,"generateSlug");function r7(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return r3.SHA256(e).toString(r3.enc.Hex).slice(0,t)}G(r7,"generateShortId");function r9(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:8;var t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+[]{}|;:,.<>?",r="";for(var n=0;n<e;n++){var s=Math.floor(Math.random()*t.length);r+=t.charAt(s)}return r}G(r9,"generateRandomPassword");function ne(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;var r=e.split(/[?#]/)[0]||"",n=r.substring(r.lastIndexOf("/")+1);if(t)return n;var s=n.lastIndexOf(".");return s>0?n.slice(0,s):n}G(ne,"getFileName");function nt(e,t,r){var n=e.indexOf(t);if(n===-1)return"";var s=n+t.length,i=e.indexOf(r,s);return i===-1?"":e.slice(s,i)}G(nt,"substringBetween");var nr={isEmpty:function e(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":T(e))=="object"?p(e,Date)?!1:p(e,Map)||p(e,Set)?e.size===0:p(e,WeakMap)||p(e,WeakSet)?!0:ArrayBuffer.isView(e)?e.byteLength===0:Object.keys(e).length===0:!1},isValidIP:function e(e){var t=e.split(".");return t.length===4&&t.every(function(e){return/^\d+$/.test(e)&&Number(e)>=0&&Number(e)<=255})?!0:/^(([a-f\d]{1,4}:){7}[a-f\d]{1,4}|((?:[a-f\d]{1,4}:){1,7}:)|((?:[a-f\d]{1,4}:){1,6}:[a-f\d]{1,4})|::)$/i.test(e)}};var nn={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return rY(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,r=t===void 0?"string":t;var n=r==="string"?nn.getDateTime():new Date;return{id:rJ(),isDel:!1,createdAt:n,updatedAt:n}},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 r=t.method,n=t.pre,s=t.post;r&&n&&e.pre(r,n),r&&s&&e.post(r,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:rJ,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,r=e.schema,n=e.virtuals,s=n===void 0?[]:n,i=e.standalone,o=i===void 0?!1:i;var a=new t.Schema(r,{strict:!0});return s.forEach(function(e){var t=e.name,r=e.options,n=e.get;var s=a.virtual(t,r);n&&s.get(n)}),o||a.add(nn.createGenericSchema(t)),a},createModel:function e(e){var t=e.mongoose,r=e.name,n=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(!r)throw new Error("Model name is required.");if(t.models[r])return t.models[r];var f=nn.createSchema({mongoose:t,schema:n,virtuals:u});return nn.applyPlugins(f,[i&&rz,a&&rQ]),nn.applyMiddlewares(f,d),t.model(r,f)},validator:{isEmpty:function e(){return function(e){return i(function(){return w(this,function(t){return[2,!nr.isEmpty(e)]})})()}},isUnique:function e(e){return function(t){return i(function(){var r;return w(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");r={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.exists(r)];case 1:return[2,!n.sent()]}})}).call(this)}},matchesRegex:function e(e){return function(t){return i(function(){return w(this,function(r){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)})]})})()}}},migrate:S(h({},rV),{setConfig:G(function(e){var t="// This file is automatically generated by the Cyberskill CLI.\nmodule.exports = ".concat(JSON.stringify(e,null,4));eC(tM.MIGRATE_MONGO_CONFIG,t);var r="\n".concat(tc,"\n");eA(tM.GIT_IGNORE)?eS(tM.GIT_IGNORE,"utf-8").split("\n").includes(tc)||eb(tM.GIT_IGNORE,r):eC(tM.GIT_IGNORE,r)},"setConfig")})},ns=/*#__PURE__*/function(){"use strict";function e(t,r){a(this,e);L(this,"collection");this.collection=t.collection(r)}u(e,[{key:"createOne",value:function e(e){return i(function(){var t,r,n;return w(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=h({},nn.createGenericFields(),e);r={success:!0,message:"Document created successfully"};return[4,this.collection.insertOne(t)];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return i(function(){var t,r,n;return w(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=e.map(function(e){return h({},nn.createGenericFields(),e)});return[4,this.collection.insertMany(t)];case 1:r=s.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:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"findOne",value:function e(e){return i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,this.collection.findOne(e)];case 1:t=n.sent();return[2,t?{success:!0,message:"Document found",result:t}:{success:!1,message:"Document not found"}];case 2:r=n.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"findAll",value:function e(){return i(function(){var e,t,r;var n=arguments;return w(this,function(s){switch(s.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Documents retrieved successfully"};return[4,this.collection.find(e).toArray()];case 2:return[2,(t.result=s.sent(),t)];case 3:r=s.sent();return[2,{success:!1,message:r.message}];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return i(function(){var e,t,r;var n=arguments;return w(this,function(s){switch(s.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Count retrieved successfully"};return[4,this.collection.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:r=s.sent();return[2,{success:!1,message:r.message}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(e,t){return i(function(){var r,n;return w(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateOne(e,{$set:t})];case 1:r=s.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"updateMany",value:function e(e,t){return i(function(){var r,n;return w(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateMany(e,{$set:t})];case 1:r=s.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"deleteOne",value:function e(e){return i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,this.collection.deleteOne(e)];case 1:t=n.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:t}];case 2:r=n.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"deleteMany",value:function e(e){return i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,this.collection.deleteMany(e)];case 1:t=n.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:t}];case 2:r=n.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}}]);return e}();G(ns,"MongoController");var ni=ns,no=/*#__PURE__*/function(){"use strict";function e(t){a(this,e);L(this,"model");this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(e){return i(function(){var e,t,r,n,s,i,o;var a=arguments;return w(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},r=a.length>2&&a[2]!==void 0?a[2]:{},n=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.findOne(e,t,r);n&&s.populate(n);return[4,s.exec()];case 2:i=c.sent();return[2,i?{success:!0,result:i}:{success:!1,message:"No ".concat(this.getModelName()," found."),code:ec.NOT_FOUND.CODE}];case 3:o=c.sent();return[2,{success:!1,message:o.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findAll",value:function e(e){return i(function(){var e,t,r,n,s,i,o;var a=arguments;return w(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},r=a.length>2&&a[2]!==void 0?a[2]:{},n=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.find(e,t,r);n&&s.populate(n);i={success:!0};return[4,s.exec()];case 2:return[2,(i.result=c.sent(),i)];case 3:o=c.sent();return[2,{success:!1,message:o.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPaging",value:function e(){return i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);r={success:!0};return[4,this.model.paginate(e,t)];case 2:return[2,(r.result=i.sent(),r)];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPagingAggregate",value:function e(e){return i(function(e){var t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);r={success:!0};return[4,this.model.aggregatePaginate(this.model.aggregate(e),t)];case 2:return[2,(r.result=i.sent(),r)];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return i(function(){var e,t,r;var n=arguments;return w(this,function(s){switch(s.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0};return[4,this.model.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:r=s.sent();return[2,{success:!1,message:r.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"createOne",value:function e(e){return i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);t={success:!0};return[4,this.model.create(e)];case 1:return[2,(t.result=n.sent(),t)];case 2:r=n.sent();return[2,{success:!1,message:r.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return i(function(e){var t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);r={success:!0};return[4,this.model.insertMany(e,t)];case 2:return[2,(r.result=i.sent().map(function(e){return p(e,rW)?e.toObject():null}).filter(function(e){return e!==null}),r)];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(){return i(function(){var e,t,r,n,s;var i=arguments;return w(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},r=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);return[4,this.model.findOneAndUpdate(e,t,h({new:!0},r)).exec()];case 2:n=o.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"Failed to update ".concat(this.getModelName(),"."),code:ec.NOT_FOUND.CODE}];case 3:s=o.sent();return[2,{success:!1,message:s.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateMany",value:function e(){return i(function(){var e,t,r,n,s;var i=arguments;return w(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},r=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);n={success:!0};return[4,this.model.updateMany(e,t,r).exec()];case 2:return[2,(n.result=o.sent(),n)];case 3:s=o.sent();return[2,{success:!1,message:s.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteOne",value:function e(){return i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.findOneAndDelete(e,t).exec()];case 2:r=i.sent();return[2,r?{success:!0,result:r}:{success:!1,message:"No ".concat(this.getModelName()," found to delete."),code:ec.NOT_FOUND.CODE}];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteMany",value:function e(){return i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.deleteMany(e,t).exec()];case 2:r=i.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents found to delete.",code:ec.NOT_FOUND.CODE}:{success:!0,result:r}];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return i(function(){var r,n,s,i;return w(this,function(o){switch(o.label){case 0:r=new Set;n=0;o.label=1;case 1:if(!(n<10))return[3,5];s=r7(e,n+t);i=!r.has(s);if(!i)return[3,3];r.add(s);return[4,this.model.exists({shortId:s})];case 2:i=!o.sent();o.label=3;case 3:if(i)return[2,{success:!0,result:s}];o.label=4;case 4:n++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:ec.INTERNAL_SERVER_ERROR.CODE}]}})}).call(this)}},{key:"createSlug",value:function e(e,t,r){return i(function(){var n,s,o,a,c,u,d,f,p,m;return w(this,function(g){switch(g.label){case 0:n=this;g.label=1;case 1:g.trys.push([1,5,,6]);s=t[e],o=tB(s),a=G(function(t){var n=h({},r!==null&&r!==void 0?r:{});return o?S(h({},n),{$or:[l({},"slug.".concat(e),t),{slugHistory:{$elemMatch:l({},"slug.".concat(e),t)}}]}):S(h({},n),{$or:[{slug:t},{slugHistory:t}]})},"generateSlugQuery"),c=G(function(e){return i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:t=e,r=1;n.label=1;case 1:return[4,this.model.exists(a(t))];case 2:if(!n.sent())return[3,4];t="".concat(e,"-").concat(r++);n.label=3;case 3:return[3,1];case 4:return[2,t]}})}).call(n)},"generateUniqueSlug");if(!o)return[3,3];u={success:!0};d=Object.fromEntries;return[4,Promise.all(Object.entries(s).map(function(e){var t=b(e,2),r=t[0],n=t[1];return i(function(){var e,t;return w(this,function(s){switch(s.label){case 0:e=r6(n);t=[r];return[4,c(e)];case 1:return[2,t.concat([s.sent()])]}})})()}))];case 2:return[2,(u.result=d.apply(Object,[g.sent()]),u)];case 3:f=r6(s);p={success:!0};return[4,c(f)];case 4:return[2,(p.result=g.sent(),p)];case 5:m=g.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(m.message),code:ec.INTERNAL_SERVER_ERROR.CODE}];case 6:return[2]}})}).call(this)}},{key:"aggregate",value:function e(e){return i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);t={success:!0};return[4,this.model.aggregate(e)];case 1:return[2,(t.result=n.sent(),t)];case 2:r=n.sent();return[2,{success:!1,message:r.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})}).call(this)}}]);return e}();G(no,"MongooseController");var na=no;import{useServer as nc}from"graphql-ws/use/ws";import{WebSocketServer as nu}from"ws";function nl(e){return new nu({server:e.server,path:e.path})}G(nl,"createWSServer");function nd(e){return nc({schema:e.schema},e.server)}G(nd,"initGraphQLWS");import{ApolloClient as nf,ApolloError as np,ApolloLink as nm,ApolloProvider as ng,from as nv,HttpLink as nE,InMemoryCache as nh,split as ny}from"@apollo/client";import{onError as nS}from"@apollo/client/link/error";import{removeTypenameFromVariables as nO}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as nI}from"@apollo/client/link/subscriptions";import{getMainDefinition as n_}from"@apollo/client/utilities";import{createClient as nC}from"graphql-ws";import nb,{useMemo as nA}from"react";import{FaInfo as nT}from"react-icons/fa6";import nR,{use as nN}from"react";import{FaRepeat as nw}from"react-icons/fa6";import{createContext as nx}from"react";var nD=nx(void 0);import nG from"./react/apollo-error/apollo-error.module.scss";function nL(){var e=nN(nD),t=e===null||e===void 0?void 0:e.error;if(!t)return null;var r=G(function(e,t){return(t===null||t===void 0?void 0:t.length)?nR.createElement("div",null,nR.createElement("strong",null,e,":"),nR.createElement("ul",null,t.map(function(e){return nR.createElement("li",{key:e.message},e.message)}))):null},"renderErrorList");return nR.createElement("div",{className:nG["modal-backdrop"]},nR.createElement("div",{className:nG["modal-content"]},nR.createElement("button",{type:"button",className:nG["btn-close"],onClick:e.hideError},"✕"),nR.createElement("div",{className:nG["error-title"]},nR.createElement("button",{type:"button",className:nG["btn-retry"],onClick:G(function(){return window.location.reload()},"onClick")},nR.createElement(nw,null))," ",t.message),nR.createElement("div",{className:nG["error-details"]},t.networkError&&nR.createElement("pre",{className:"network"},nR.createElement("strong",null,"Network Error:")," ",t.networkError.message),r("GraphQL Errors",A(t.graphQLErrors)),r("Protocol Errors",A(t.protocolErrors)),r("Client Errors",A(t.clientErrors)),t.extraInfo&&nR.createElement("pre",{className:"extra"},nR.createElement("strong",null,"Extra Info:")," ",JSON.stringify(t.extraInfo,null,4)))))}G(nL,"ApolloError");import{use as nM}from"react";function nj(){var e=nM(nD);if(!e)throw new Error("useApolloError must be used within ApolloErrorProvider");return e}G(nj,"useApolloError");import nP,{useEffect as nk,useMemo as nU,useState as nF}from"react";var nq=null;function nB(e){nq=e}G(nB,"setGlobalApolloErrorCallback");function nK(e){nq===null||nq===void 0?void 0:nq(e)}G(nK,"showGlobalApolloError");function nH(e){var t=e.children;var r=b(nF(null),2),n=r[0],s=r[1];nk(function(){nB(s)},[]);var i=nU(function(){return{error:n,showError:s,hideError:G(function(){return s(null)},"hideError")}},[n]);return nP.createElement(nD,{value:i},t)}G(nH,"ApolloErrorProvider");import{consola as nY}from"consola/browser";var nV={silent:nY.silent,level:nY.level,fatal:nY.fatal,error:nY.error,warn:nY.warn,log:nY.log,info:nY.info,success:nY.success,ready:nY.ready,start:nY.start,box:nY.box,debug:nY.debug,trace:nY.trace,verbose:nY.verbose};import{toast as nW,Toaster as nQ}from"react-hot-toast";var nz="/graphql";var nJ,n$=(nJ=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);var e;e=o(this,t,arguments);L(e,"count",0);return e}u(t,[{key:"request",value:function e(e,t){var r=this;var n=Date.now();return this.count+=1,t(e).map(function(t){var s=Date.now()-n,i=e.operationName||"Unnamed";return nV.info("[Apollo] #".concat(r.count,": ").concat(i," (").concat(s,"ms)")),t})}}]);return t}(nm),G(nJ,"DevLoggerLink"),nJ);function nX(e){var t=e.uri,r=e.wsUrl,n=e.customLinks,s=new n$,i=nS(function(e){var t=e.graphQLErrors,r=e.networkError,n=e.protocolErrors,s=e.operation;var i=(s===null||s===void 0?void 0:s.operationName)||"Unknown";if(t&&t.forEach(function(e){var t=e.message,r=e.locations,n=e.path;nV.error("[GraphQL error] ".concat(i,": ").concat(t,", Location: ").concat(JSON.stringify(r,null,4),", Path: ").concat(n))}),n&&n.forEach(function(e){var t=e.message,r=e.extensions;nV.error("[Protocol error]: ".concat(t,", Extensions: ").concat(JSON.stringify(r,null,4)))}),r&&nV.error("[Network error]: ".concat(r)),t||n||r){var o,a;var c=(t===null||t===void 0?void 0:(o=t[0])===null||o===void 0?void 0:o.message)||(n===null||n===void 0?void 0:(a=n[0])===null||a===void 0?void 0:a.message)||(r===null||r===void 0?void 0:r.message)||"Unexpected error",u=new np({graphQLErrors:t||[],protocolErrors:n||[],clientErrors:[],networkError:r||null,errorMessage:c,extraInfo:{operation:s}});nW.error(function(e){return nb.createElement(nb.Fragment,null,c,"\xa0",nb.createElement(nT,{cursor:"pointer",onClick:G(function(){setTimeout(function(){nK(u)},0),nW.dismiss(e.id)},"onClick")}))})}}),o=nO();t||nV.warn('[Apollo] No GraphQL URI provided — using "'.concat(nz,'" as default'));var a=new nE({uri:t!==null&&t!==void 0?t:nz,credentials:"include"}),c=r?new nI(nC({url:r})):nm.empty(),u=p(c,nm)?ny(function(e){var t=e.query;var r=n_(t);return r.kind==="OperationDefinition"&&r.operation==="subscription"},c,a):a;return u===a&&r&&nV.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[s,i,o].concat(A(n!==null&&n!==void 0?n:[]),[u])}G(nX,"createApolloLinks");function nZ(e){var t=e.isNextJS,r=e.options,n=e.children,s=e.client,i=e.provider,o=e.cache;var a=r||{},c=a.uri,u=a.wsUrl,l=a.customLinks,d=O(a,["uri","wsUrl","customLinks"]),f=s!==null&&s!==void 0?s:nf;if(typeof f!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var m=i||ng,g=nA(function(){return nv(nX({uri:c!==null&&c!==void 0?c:nz,wsUrl:u!==null&&u!==void 0?u:"",customLinks:l!==null&&l!==void 0?l:[]}))},[c,u,l]),v=nA(function(){return p(o,nh)?o:new nh},[o]),E=nA(function(){return new f(h({link:g,cache:v},d))},[f,g,v,d]),y=t?nb.createElement(m,{makeClient:G(function(){return E},"makeClient")},n):nb.createElement(m,{client:E},n);return nb.createElement(nb.Fragment,null,nb.createElement(nH,null,y,nb.createElement(nL,null)),nb.createElement(nQ,{position:"top-right"}))}G(nZ,"ApolloProvider");import{useTranslation as n0}from"react-i18next";var n1=n0;import n2 from"i18next";import{initReactI18next as n4}from"react-i18next";function n3(e){return n2.use(n4).init(e)}G(n3,"initI18next");import n5 from"classnames";import n8 from"react";import n6 from"./react/loading/loading.module.scss";function n7(e){var t=e.full,r=t===void 0?!1:t,n=e.block,s=n===void 0?!1:n,i=e.className,o=i===void 0?"":i,a=e.message,c=a===void 0?"Loading":a,u=O(e,["full","block","className","message"]);function l(){return n8.createElement("div",h({className:n6.container},u),n8.createElement("div",{className:n6.ring}),n8.createElement("div",{className:n6.ring}),n8.createElement("div",{className:n6.ring}),n8.createElement("div",{className:n6.ring}),c&&n8.createElement("div",{className:n6.message},c))}return G(l,"_renderLoading"),r?n8.createElement("div",{className:n5(n6.fullscreen,o)},l()):s?n8.createElement("div",{className:n5(n6.block,o)},l()):l()}G(n7,"Loading");import{createContext as n9}from"react";var se=n9(void 0);import{use as st}from"react";function sr(){var e=st(se);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}G(sr,"useLoading");import sn,{useCallback as ss,useMemo as si,useState as so}from"react";function sa(e){var t=e.children;var r=b(so(!1),2),n=r[0],s=r[1],i=b(so(!1),2),o=i[0],a=i[1],c=ss(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;s(!0),a(e)},[]),u=ss(function(){s(!1),a(!1)},[]),l=si(function(){return{isLoading:n,isGlobalLoading:o,showLoading:c,hideLoading:u}},[n,o,c,u]);return sn.createElement(se,{value:l},n?sn.createElement(n7,{full:o}):t)}G(sa,"LoadingProvider");import{enUS as sc}from"date-fns/locale";var su={label:"English",value:"en",flag:"\uD83C\uDDFA\uD83C\uDDF8",adapterLocale:sc,icon:"flagpack:gb-nir",numberFormat:{code:"en-US",currency:"USD"},timezone:"America/New_York"};import{createContext as sl}from"react";var sd=sl(void 0);import{NextIntlClientProvider as sf}from"next-intl";import sp from"react";import{useTranslations as sm}from"next-intl";import{use as sg}from"react";function sv(){var e=sg(sd);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}G(sv,"useNextIntl");var sE=sm;function sh(e){var t=G(function(t){var r;var n;var s=sv(),i=s.currentLanguage,o=t.messages,a=t.languages,c="en",u=o[(i===null||i===void 0?void 0:i.value)||c],l=(n=(r=a.find(function(e){return e.value===(i===null||i===void 0?void 0:i.value)}))===null||r===void 0?void 0:r.timezone)!==null&&n!==void 0?n:su.timezone;return o?sp.createElement(sf,{locale:(i===null||i===void 0?void 0:i.value)||c,messages:u||null,timeZone:l},sp.createElement(e,t)):(nV.warn("Missing messages for language: ".concat((i===null||i===void 0?void 0:i.value)||c)),null)},"PageWithI18n");return t.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),t}G(sh,"withNextIntl");import sy,{useMemo as sS}from"react";import{useCallback as sO,useEffect as sI,useState as s_}from"react";import sC from"localforage";var sb={get:function e(e){return i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sC.getItem(e)];case 1:return[2,r.sent()];case 2:t=r.sent();return[2,(nV.error('[Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 3:return[2]}})})()},set:function e(e,t){return i(function(){var r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,sC.setItem(e,t)];case 1:n.sent();return[3,3];case 2:r=n.sent();nV.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},remove:function e(e){return i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sC.removeItem(e)];case 1:r.sent();return[3,3];case 2:t=r.sent();nV.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},keys:function e(){return i(function(){var e,t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sC.keys()];case 1:return[2,(e=r.sent())!==null&&e!==void 0?e:[]];case 2:t=r.sent();return[2,(nV.error("[Storage:keys] Error getting keys:",t),[])];case 3:return[2]}})})()}};function sA(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r4;var n=b(s_(t),2),s=n[0],o=n[1],a=b(s_(!1),2),c=a[0],u=a[1];sI(function(){var n=!0;return G(function(){return i(function(){var s,i,a,c;return w(this,function(l){switch(l.label){case 0:l.trys.push([0,6,7,8]);return[4,sb.get(e)];case 1:s=l.sent();if(!n)return[3,5];if(!(s!==null))return[3,2];i=r.deserialize(s);o(i);return[3,5];case 2:if(!(t!==void 0))return[3,4];a=r.serialize(t);return[4,sb.set(e,a)];case 3:l.sent(),o(t);return[3,5];case 4:o(void 0);l.label=5;case 5:return[3,8];case 6:c=l.sent();nV.error('Error loading value for key "'.concat(e,'":'),c),n&&o(t);return[3,8];case 7:n&&u(!0);return[7];case 8:return[2]}})})()},"loadValue")(),function(){n=!1,u(!1)}},[e,t,r]),sI(function(){if(!c)return;G(function(){return i(function(){var t,n;return w(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);if(!(s!==void 0))return[3,2];t=r.serialize(s);return[4,sb.set(e,t)];case 1:i.sent();i.label=2;case 2:return[3,4];case 3:n=i.sent();nV.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},"saveValue")()},[s,e,r,c]);var l=sO(function(e){o(function(t){return typeof e=="function"?e(t):e})},[]),d=sO(function(){return i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sb.remove(e)];case 1:r.sent(),o(void 0);return[3,3];case 2:t=r.sent();nV.error('Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},[e]);return{value:s,set:l,remove:d}}G(sA,"useStorage");function sT(e){var t=e.children;return sy.createElement(sy.Fragment,null,t)}G(sT,"LanguageWrapperBase");var sR=sh(sT);function sN(e){var t=e.children,r=e.languages,n=e.messages;var s=sA("lang",r[0]),i=s.value,o=s.set,a=sS(function(){return{languages:r,currentLanguage:i!==null&&i!==void 0?i:su,setCurrentLanguage:o}},[r,o,i]);return sy.createElement(sd,{value:a},sy.createElement(sR,{languages:r,messages:n},t))}G(sN,"NextIntlProvider");export{nL as ApolloError,nD as ApolloErrorContext,nH as ApolloErrorProvider,nZ as ApolloProvider,e9 as BUILD_DIRECTORY,ep as CHECK_PACKAGE_EMPTY_RESULT,th as COMMIT_LINT_CLI,tE as COMMIT_LINT_PACKAGE_NAME,tl as CYBERSKILL_CLI,td as CYBERSKILL_CLI_PATH,tu as CYBERSKILL_DIRECTORY,e6 as CYBERSKILL_PACKAGE_NAME,K as CYBERSKILL_STORAGE_DIRECTORY,rH as C_Collection,rk as C_Db,rF as C_Document,rB as C_Model,tp as ESLINT_CLI,tw as ESLINT_INSPECT_CLI,tN as ESLINT_INSPECT_PACKAGE_NAME,tf as ESLINT_PACKAGE_NAME,ee as E_CommandType,j as E_ConfigType,es as E_IssueType,tC as GIT_CLI,ta as GIT_COMMIT_EDITMSG,to as GIT_HOOK,tn as GIT_IGNORE,nz as GRAPHQL_URI_DEFAULT,tZ as IS_BROWSER,tS as LINT_STAGED_CLI,ty as LINT_STAGED_PACKAGE_NAME,n7 as Loading,se as LoadingContext,sa as LoadingProvider,tL as MIGRATE_MONGO_CLI,tc as MIGRATE_MONGO_CONFIG,tG as MIGRATE_MONGO_PACKAGE_NAME,rD as MONGO_MIGRATE_OPTIONS,ni as MongoController,na as MongooseController,su as NEXT_INTL_DEFAULT_LANGUAGE,e7 as NODE_MODULES,tD as NODE_MODULES_INSPECT_CLI,tx as NODE_MODULES_INSPECT_PACKAGE_NAME,sd as NextIntlContext,sN as NextIntlProvider,te as PACKAGE_JSON,tt as PACKAGE_LOCK_JSON,tM as PATH,tg as PLAYWRIGHT_PACKAGE_NAME,tb as PNPM_CLI,tA as PNPM_EXEC_CLI,ti as PNPM_LOCK_YAML,ec as RESPONSE_STATUS,rh as Router,tT as SIMPLE_GIT_HOOKS_PACKAGE_NAME,tR as SIMPLE_GIT_HOOK_CLI,ts as SIMPLE_GIT_HOOK_JSON,tr as TSCONFIG_JSON,tI as TSC_CLI,tO as TSC_PACKAGE_NAME,t_ as TSX_CLI,nQ as Toaster,tv as VITEST_CLI,tm as VITEST_PACKAGE_NAME,e8 as WORKING_DIRECTORY,rQ as aggregatePaginate,eb as appendFileSync,rS as bodyParser,eD as checkPackage,eH as clearAllErrorLists,tU as command,M as commitlintConfig,eR as copySync,t5 as createApolloServer,rR as createCors,rT as createCorsOptions,rw as createExpress,tj as createGitHooksConfig,t$ as createGraphqlCodegenConfig,rx as createNest,rN as createSession,nl as createWSServer,tK as deepMerge,tY as eslintConfig,rC as express,t1 as expressMiddleware,eJ as formatCommand,ev as fs,r9 as generateRandomPassword,r7 as generateShortId,r6 as generateSlug,Z as getEnv,ne as getFileName,ex as getLatestPackageVersion,ew as getPackage,eK as getStoredErrorLists,nd as initGraphQLWS,n3 as initI18next,eG as installDependencies,tq as isJson,tB as isObject,e3 as join,tX as lintStagedConfig,X as loadEnvFile,nV as log,ef as logNodeJS,eE as lstatSync,tz as mergeConfigs,ey as mkdirSync,nn as mongo,rz as mongoosePaginate,e1 as path,eA as pathExistsSync,eQ as rawCommand,eS as readFileSync,e_ as readJsonSync,eh as readdirSync,r0 as regexSearchMapper,r1 as removeAccent,eT as removeSync,e4 as resolve,e$ as resolveCommands,e2 as resolveWorkingPath,eX as runCommand,r4 as serializer,nB as setGlobalApolloErrorCallback,eL as setupPackages,nK as showGlobalApolloError,eI as statSync,sb as storage,ek as storageNodeJS,nt as substringBetween,el as throwError,nW as toast,eO as unlinkSync,nj as useApolloError,sr as useLoading,sv as useNextIntl,sA as useStorage,n1 as useTranslateI18next,sE as useTranslateNextIntl,nr as validate,F as vitestE2E,tF as vitestUnit,sh as withNextIntl,eC as writeFileSync};
|
|
1
|
+
function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,r,n,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){r(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(n,s)}}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){s(o,n,i,a,c,"next",e)}function c(e){s(o,n,i,a,c,"throw",e)}a(undefined)})}}function o(e,t,r){t=d(t);return R(e,A()?Reflect.construct(t,r||[],d(e).constructor):t.apply(e,r))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function u(e,t,r){if(t)c(e.prototype,t);if(r)c(e,r);return e}function l(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}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)C(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 m(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function E(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var s=true;var i=false;var o,a;try{for(r=r.call(e);!(s=(o=r.next()).done);s=true){n.push(o.value);if(t&&n.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&r["return"]!=null)r["return"]()}finally{if(i)throw a}}return n}function g(){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 _(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){l(e,t,r[t])})}return e}function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function y(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{h(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function S(e,t){if(e==null)return{};var r=O(e,t);var n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){n=i[s];if(t.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;r[n]=e[n]}}return r}function O(e,t){if(e==null)return{};var r={};var n=Object.keys(e);var s,i;for(i=0;i<n.length;i++){s=n[i];if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function R(e,t){if(t&&(D(t)==="object"||typeof t==="function")){return t}return n(e)}function C(e,t){C=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return C(e,t)}function N(e,r){return t(e)||E(e,r)||b(e,r)||g()}function I(e){return r(e)||m(e)||b(e)||v()}function D(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function b(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function A(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(A=function(){return!!e})()}function T(e,t){var r,n,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(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(r=1,n&&(s=a[0]&2?n["return"]:a[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;if(n=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++;n=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];n=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var P=Object.defineProperty;var w=function(e,t,r){return t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var x=function(e,t){return P(e,"name",{value:t,configurable:!0})};var G=function(e,t,r){return w(e,(typeof t==="undefined"?"undefined":D(t))!="symbol"?t+"":t,r)};var L={extends:["@commitlint/config-conventional"],ignores:[function(e){return e.includes("[\uD83D\uDE80 CI - Deploy]")}]};var M=function(e){return e.ESLINT="eslint",e.COMMITLINT="commitlint",e.LINT_STAGED="lint-staged",e.VITEST_REACT_E2E="vitest-react-e2e",e.VITEST_REACT_UNIT="vitest-react-unit",e}({});import U from"@antfu/eslint-config";import k from"@vitejs/plugin-react-swc";import{defineConfig as j}from"vitest/config";function F(e){return j(_({plugins:[k()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}x(F,"vitestE2E");import q from"@vitejs/plugin-react-swc";import{defineConfig as V}from"vitest/config";import Y from"fs-extra";var K=".cyberskill-storage";import B from"@dotenvx/dotenvx";import{bool as H,cleanEnv as W,str as Q}from"envalid";import J from"node:os";import z from"node:path";import $ from"node:process";var X=!1;function Z(){X||(B.config(),X=!0)}x(Z,"loadEnvFile");function ee(){Z();var e=W($.env,{CWD:Q({default:$.cwd()}),DEBUG:H({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:Q({default:z.join(J.homedir(),K)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}x(ee,"getEnv");var et=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as er}from"node:child_process";import en from"node:process";import*as es from"node:util";var ei=function(e){return e.Error="error",e.Warning="warning",e}({});import eo from"chalk";import ea from"consola";import{GraphQLError as ec}from"graphql";var eu={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 el=ee();function ed(e){var t=e.message,r=e.status,n=r===void 0?eu.INTERNAL_SERVER_ERROR:r,s=e.type,i=s===void 0?"graphql":s;var o;var a=(o=t!==null&&t!==void 0?t:n.MESSAGE)!==null&&o!==void 0?o:"Internal server error";throw i==="graphql"?new ec(a,{extensions:{code:n.CODE}}):new Error(a)}x(ed,"throwError");el.DEBUG||(ea.level=4);function ef(e){var t=eo[e];return typeof t=="function"?t:eo.green}x(ef,"chalkKeyword");var ep={silent:ea.silent,level:ea.level,fatal:ea.fatal,error:ea.error,warn:ea.warn,log:ea.log,info:ea.info,success:ea.success,ready:ea.ready,start:ea.start,box:ea.box,debug:ea.debug,trace:ea.trace,verbose:ea.verbose,printBoxedLog:function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){ea.box(eo.green(e));return}t.forEach(function(e){var t=e.file,n=e.position,s=e.rule,i=e.message;ea.log("".concat(eo.gray("File:")," ").concat(eo.blue("".concat(t).concat(n?":".concat(n):"")))),s&&ea.log(" ".concat(ef(r)("Rule:")," ").concat(s)),ea.log(" ".concat(ef(r)("Message:")," ").concat(i))}),ea.box(ef(r)("".concat(e," : ").concat(t.length))),ea.log(eo.gray("─".repeat(40)))}};var em=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});import eE from"node-fetch";import eg from"fs-extra";import ev from"node:path";var e_=eg,eh=eg.lstatSync,ey=eg.readdirSync,eS=eg.mkdirSync,eO=eg.readFileSync,eR=eg.unlinkSync,eC=eg.statSync,eN=eg.readJsonSync;function eI(e,t,r){eg.writeFileSync(e,t,r!==null&&r!==void 0?r:"utf-8")}x(eI,"writeFileSync");function eD(e,t,r){eg.appendFileSync(e,t,r!==null&&r!==void 0?r:"utf-8")}x(eD,"appendFileSync");function eb(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return t.every(function(e){return eg.pathExistsSync(e)})}x(eb,"pathExistsSync");function eA(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}t.forEach(function(e){eb(e)&&eg.removeSync(e)})}x(eA,"removeSync");function eT(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=r.extensions,s=S(r,["extensions"]);eg.copySync(e,t,_({filter:x(function(e){return eC(e).isDirectory()||!n||n.length===0?!0:n.includes(ev.extname(e))},"filter")},s))}x(eT,"copySync");var eP=ee();function ew(e){return /*#__PURE__*/i(function(){var t,r,n,s;return T(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,eE("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:r=i.sent(),n=r.version;return[2,n];case 3:s=i.sent();throw ep.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}x(ew,"getLatestPackageVersion");function ex(e){return /*#__PURE__*/i(function(){var t,r,n,s,i,o,a,c,u,l,d,f,p,m,E,g,v,_,h;return T(this,function(y){switch(y.label){case 0:y.trys.push([0,2,,3]);if(!eb(tk.PACKAGE_JSON))return[2,{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===em.DEPENDENCY,isDevDependency:e.type===em.DEV_DEPENDENCY,installedPath:"",file:{}}];t=eN(tk.PACKAGE_JSON),r=t.name,n=t.version,s=n===void 0?"":n,i=t.dependencies,o=i===void 0?{}:i,a=t.devDependencies,c=a===void 0?{}:a;if(e.name===r)return[2,{name:r,currentVersion:s,latestVersion:s,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===em.DEPENDENCY,isDevDependency:e.type===em.DEV_DEPENDENCY,installedPath:tk.PACKAGE_JSON,file:t}];u=e.name in o,l=e.name in c;return[4,ew(e.name)];case 1:d=y.sent();if(!u&&!l)return[2,{name:e.name,currentVersion:"",latestVersion:d,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===em.DEPENDENCY,isDevDependency:e.type===em.DEV_DEPENDENCY,installedPath:"",file:{}}];m=(p=(f=o[e.name])!==null&&f!==void 0?f:c[e.name])!==null&&p!==void 0?p:"",E=e8(eP.CWD,te,e.name,tr);if(!eb(E))return[2,{name:e.name,currentVersion:"",latestVersion:d,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:u,isDevDependency:l,installedPath:"",file:{}}];g=eN(E),v=g.version,_=v===void 0?"":v;return[2,m!==_?{name:e.name,currentVersion:_||m,latestVersion:d,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:u,isDevDependency:l,installedPath:E,file:g}:{name:e.name,currentVersion:m,latestVersion:d,isCurrentProject:!1,isInstalled:!0,isUpToDate:m===d,isDependency:u,isDevDependency:l,installedPath:E,file:g}];case 2:h=y.sent();throw ep.error('Error getting package "'.concat(e.name,'": ').concat(h.message)),h;case 3:return[2]}})})()}x(ex,"getPackage");function eG(e){return /*#__PURE__*/i(function(){var t,r,n,s,i;return T(this,function(o){try{;n=eN(tk.PACKAGE_JSON),s=(t=n.dependencies)!==null&&t!==void 0?t:{},i=(r=n.devDependencies)!==null&&r!==void 0?r:{};e.isDependency?s[e.name]=e.latestVersion:e.isDevDependency&&(i[e.name]=e.latestVersion),eI(tk.PACKAGE_JSON,JSON.stringify(n,null,4)),ep.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(t){throw ep.error('Error updating package "'.concat(e.name,'": ').concat(t.message)),t}return[2]})})()}x(eG,"updatePackage");function eL(){return /*#__PURE__*/i(function(){var e,t,r,n,s,i,o,a,c,u,l,d,f;return T(this,function(p){switch(p.label){case 0:p.trys.push([0,12,,13]);e=[{command:x(function(){return tq.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:x(function(){return tq.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:x(function(){return tq.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,r=false,n=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);s=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,a()];case 4:u=p.sent();return[4,e0("".concat(c," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();ep.warn("Installation attempt failed: ".concat(c)),ep.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();r=true;n=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(r){throw n}}return[7];case 11:return[3,13];case 12:f=p.sent();throw ep.error("Failed to install dependencies: ".concat(f.message)),f;case 13:return[2]}})})()}x(eL,"installDependencies");function eM(e,t){return /*#__PURE__*/i(function(){var r,n,s,i,o,a,c,u,l,d,f;return T(this,function(p){switch(p.label){case 0:if(!eb(tk.PACKAGE_JSON)){ep.error("package.json not found. Aborting setup.");return[2]}p.label=1;case 1:p.trys.push([1,14,,15]);return[4,Promise.all(e.map(ex))];case 2:r=p.sent().filter(function(e){return!e.isCurrentProject&&(!e.isInstalled||!e.isUpToDate)});n=r.length>0;if(!n)return[3,5];return[4,Promise.all(r.map(eG))];case 3:p.sent();return[4,eL()];case 4:n=p.sent();p.label=5;case 5:n;i=true,o=false,a=undefined;p.label=6;case 6:p.trys.push([6,11,12,13]);c=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();p.label=7;case 7:if(!!(i=(u=c.next()).done))return[3,10];l=u.value;return[4,l()];case 8:p.sent();p.label=9;case 9:i=true;return[3,7];case 10:return[3,13];case 11:d=p.sent();o=true;a=d;return[3,13];case 12:try{if(!i&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 13:return[3,15];case 14:f=p.sent();throw ep.error('Failed to setup "'.concat(e.map(function(e){return e.name}).join(", "),'": ').concat(f.message)),f;case 15:return[2]}})})()}x(eM,"setupPackages");import eU from"node-persist";var ek=ee();function ej(){return /*#__PURE__*/i(function(){var e;return T(this,function(t){switch(t.label){case 0:e=eU.defaultInstance;if(e)return[3,2];return[4,eU.init({dir:ek.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]}})})()}x(ej,"initNodePersist");var eF={get:function e(e){return /*#__PURE__*/i(function(){var t,r;return T(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ej()];case 1:n.sent();return[4,eU.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,(ep.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 4:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/i(function(){var r;return T(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ej()];case 1:n.sent();return[4,eU.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();ep.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/i(function(){var t;return T(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ej()];case 1:r.sent();return[4,eU.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();ep.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/i(function(){var e,t;return T(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ej()];case 1:r.sent();return[4,eU.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:(ep.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,(ep.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/i(function(){return T(this,function(t){try{return[2,"".concat(ek.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(ep.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eq=ee(),eV=es.promisify(er);function eY(e){return"error_list:".concat(e)}x(eY,"getErrorListKey");function eK(e){return /*#__PURE__*/i(function(){var t,r,n;return T(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),r=eY(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,eF.set(r,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(function(){return /*#__PURE__*/i(function(){var e;return T(this,function(t){switch(t.label){case 0:return[4,eF.getLogLink(r)];case 1:e=t.sent();e&&ep.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:n=s.sent();ep.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})})()}x(eK,"saveErrorListToStorage");function eB(){return /*#__PURE__*/i(function(){var e,t,r;return T(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eF.keys()];case 1:e=n.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 /*#__PURE__*/i(function(){var t;return T(this,function(r){switch(r.label){case 0:return[4,eF.get(e)];case 1:return[2,((t=r.sent())===null||t===void 0?void 0:t.errors)||[]]}})})()}))];case 2:return[2,n.sent().flat()];case 3:r=n.sent();return[2,(ep.error("Failed to retrieve stored errors: ".concat(r.message)),[])];case 4:return[2]}})})()}x(eB,"getStoredErrorLists");function eH(){return /*#__PURE__*/i(function(){var e,t,r;return T(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eF.keys()];case 1:e=n.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 eF.remove(e)}))];case 2:n.sent();return[3,4];case 3:r=n.sent();ep.error("Failed to clear error lists: ".concat(r.message));return[3,4];case 4:return[2]}})})()}x(eH,"clearAllErrorLists");function eW(e){var t=[],r=[],n="",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("/"))n=e.trim();else{var a,c,u,l,d;var f=s.exec(e)||[],p=i.exec(e)||[],m=o.exec(e)||[];var E,g,v,_,h,y;f.length&&n?t.push({file:n,position:"".concat(f[1],":").concat(f[2]),type:f[3]===ei.Error?ei.Error:ei.Warning,message:(E=f===null||f===void 0?void 0:(a=f[4])===null||a===void 0?void 0:a.trim())!==null&&E!==void 0?E:"",rule:(g=f===null||f===void 0?void 0:(c=f[5])===null||c===void 0?void 0:c.trim())!==null&&g!==void 0?g:""}):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]===ei.Error?ei.Error:ei.Warning,message:(_=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&_!==void 0?_:""}):m.length?t.push({file:"commitlint",type:ei.Error,message:(h=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&h!==void 0?h:"",rule:(y=m===null||m===void 0?void 0:(d=m[2])===null||d===void 0?void 0:d.trim())!==null&&y!==void 0?y:""}):r.push(e.trim())}}),t.length&&eK(t),eq.DEBUG&&r.length&&(ep.warn("Unmatched lines:"),r.forEach(function(e){return ep.info(" ".concat(e))}))}x(eW,"parseTextErrors");function eQ(e){try{var t=JSON.parse(e),r=[];t.forEach(function(e){var t=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;r.push({type:n===2?ei.Error:ei.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),r.length&&eK(r)}catch(t){eW(e)}}x(eQ,"parseCommandOutput");function eJ(e){return /*#__PURE__*/i(function(e){var t,r,n,s,i,o,a,c,u;var l=arguments;return T(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eQ;r=new AbortController;en.on("SIGINT",function(){ep.warn("Process interrupted. Terminating..."),r.abort(),en.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,eV(e,{maxBuffer:0x6400000,signal:r.signal})];case 2:n=d.sent(),s=n.stdout,i=n.stderr;[s,i].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&ep.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}x(eJ,"executeCommand");function ez(e){return{raw:!0,cmd:e}}x(ez,"rawCommand");function e$(e,t){return(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(tA," ").concat(tI," ").concat(tp," ").concat(e):"".concat(tA," ").concat(tf," ").concat(e)}x(e$,"formatCLI");function eX(e,t){return typeof e=="function"?e$(e(t),t):(typeof e==="undefined"?"undefined":D(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?e$(e,t):e}x(eX,"formatCommand");function eZ(e){return /*#__PURE__*/i(function(){var t,r,n,s;return T(this,function(i){switch(i.label){case 0:return[4,ex({name:e9})];case 1:t=i.sent(),r=t.isCurrentProject,n={isCurrentProject:r},s=typeof e=="function"?e(n):e;return[2,Object.fromEntries(Object.entries(s).map(function(e){var t=N(e,2),r=t[0],s=t[1];return[r,eX(s,n)]}))]}})})()}x(eZ,"resolveCommands");function e0(e,t){return /*#__PURE__*/i(function(){var r;return T(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);ep.start("".concat(e)),eq.DEBUG&&ep.info("→ ".concat(t));return[4,eJ(t)];case 1:n.sent(),ep.success("".concat(e," done."));return[3,3];case 2:r=n.sent();throw ep.error("".concat(e," failed: ").concat(r.message)),r;case 3:return[2]}})})()}x(e0,"runCommand");import e1 from"node:path";var e2=ee(),e4=e1;function e3(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=e4).resolve.apply(n,[e2.CWD].concat(I(t)))}x(e3,"resolveWorkingPath");function e5(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=e4).resolve.apply(n,I(t))}x(e5,"resolve");function e8(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=e4).join.apply(n,I(t))}x(e8,"join");var e6=ee(),e7=e6.CWD,e9="@cyberskill/shared",te="node_modules",tt="dist",tr="package.json",tn="package-lock.json",ts="tsconfig.json",ti=".gitignore",to=".simple-git-hooks.json",ta="pnpm-lock.yaml",tc=".git/hooks/",tu=".git/COMMIT_EDITMSG",tl=".migrate-mongo.config.js",td=function(){var e=Y.readJsonSync(e3(tr)).name===e9?e7:e8(e7,te,e9);return e8(e,tt)}(),tf="cyberskill",tp="src/node/cli/index.ts",tm="eslint",tE="eslint",tg="vitest",tv="playwright",t_="vitest",th="@commitlint/cli",ty="@commitlint/config-conventional",tS="commitlint",tO="lint-staged",tR="lint-staged",tC="typescript",tN="tsc",tI="tsx",tD="git",tb="pnpm",tA="pnpm exec",tT="simple-git-hooks",tP="simple-git-hooks",tw="@eslint/config-inspector",tx="eslint-config-inspector",tG="node-modules-inspector",tL="node-modules-inspector",tM="migrate-mongo",tU="./node_modules/migrate-mongo/bin/migrate-mongo",tk={CYBERSKILL_DIRECTORY:td,WORKING_DIRECTORY:e7,TS_CONFIG:e3(ts),GIT_IGNORE:e3(ti),GIT_HOOK:e3(tc),GIT_COMMIT_MSG:e3(tu),SIMPLE_GIT_HOOKS_JSON:e3(to),PACKAGE_JSON:e3(tr),PACKAGE_LOCK_JSON:e3(tn),PNPM_LOCK_YAML:e3(ta),NODE_MODULES:e3(te),MIGRATE_MONGO_CONFIG:e3(tl),LINT_STAGED_CONFIG:e3("".concat(td,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:e3("".concat(td,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:e3("".concat(td,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:e3("".concat(td,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:e3("".concat(td,"/react/vitest/vitest.e2e.js"))};function tj(e){var t=e.isCurrentProject;return _({"pre-commit":tR,"commit-msg":tS},t&&{"pre-push":ez("".concat(tD," pull"))})}x(tj,"createGitHooksConfig");function tF(e){var t=e.type,r=e.packages,n=e.command;var s=r===null||r===void 0?void 0:r.reduce(function(e,t){return e.some(function(e){return e.name===t.name})||e.push(t),e},[]);return function(){return /*#__PURE__*/i(function(){var e;return T(this,function(r){switch(r.label){case 0:switch(t){case et.CLI:return[3,1];case et.STRING:return[3,4]}return[3,5];case 1:e=s===null||s===void 0?void 0:s.length;if(!e)return[3,3];return[4,eM(s,{update:!0})];case 2:e=r.sent();r.label=3;case 3:return[2,(e,eX(ez("".concat(tA," ").concat(n))))];case 4:return[2,eX(ez(n))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}x(tF,"buildCommand");var tq={simpleGitHooks:tF({type:et.CLI,packages:[{name:tT,type:em.DEV_DEPENDENCY}],command:tP}),eslintInspect:tF({type:et.CLI,packages:[{name:tw,type:em.DEV_DEPENDENCY}],command:tx}),nodeModulesInspect:tF({type:et.CLI,packages:[{name:tG,type:em.DEV_DEPENDENCY}],command:tL}),eslintCheck:tF({type:et.CLI,packages:[{name:tm,type:em.DEV_DEPENDENCY}],command:"".concat(tE," ").concat(tk.WORKING_DIRECTORY," --no-cache")}),eslintFix:tF({type:et.CLI,packages:[{name:tm,type:em.DEV_DEPENDENCY}],command:"".concat(tE," ").concat(tk.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:tF({type:et.CLI,packages:[{name:tC,type:em.DEPENDENCY}],command:"".concat(tN," -p ").concat(tk.TS_CONFIG," --noEmit")}),testUnit:tF({type:et.CLI,packages:[{name:tg,type:em.DEV_DEPENDENCY}],command:"".concat(t_," --config ").concat(tk.UNIT_TEST_CONFIG)}),testE2e:tF({type:et.CLI,packages:[{name:tg,type:em.DEV_DEPENDENCY}],command:"".concat(t_," --config ").concat(tk.E2E_TEST_CONFIG)}),mongoMigrateCreate:x(function(e){return tF({type:et.CLI,packages:[{name:tM,type:em.DEPENDENCY}],command:"".concat(tI," ").concat(tU," create ").concat(e," -f ").concat(tk.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:tF({type:et.CLI,packages:[{name:tM,type:em.DEPENDENCY}],command:"".concat(tI," ").concat(tU," up -f ").concat(tk.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:tF({type:et.CLI,packages:[{name:tM,type:em.DEPENDENCY}],command:"".concat(tI," ").concat(tU," down -f ").concat(tk.MIGRATE_MONGO_CONFIG)}),commitLint:tF({type:et.CLI,packages:[{name:th,type:em.DEV_DEPENDENCY},{name:ty,type:em.DEV_DEPENDENCY}],command:"".concat(tS," --edit ").concat(tk.GIT_COMMIT_MSG," --config ").concat(tk.COMMITLINT_CONFIG)}),lintStaged:tF({type:et.CLI,packages:[{name:tO,type:em.DEV_DEPENDENCY}],command:"".concat(tR," --config ").concat(tk.LINT_STAGED_CONFIG)}),configureGitHook:tF({type:et.STRING,command:"".concat(tD," config core.hooksPath ").concat(tk.GIT_HOOK)}),stageBuildDirectory:tF({type:et.STRING,command:"".concat(tD," add ").concat(tt)}),build:tF({type:et.STRING,command:"".concat(tb," run build")}),pnpmInstallStandard:tF({type:et.STRING,command:"".concat(tb," install")}),pnpmInstallLegacy:tF({type:et.STRING,command:"".concat(tb," install --legacy-peer-deps")}),pnpmInstallForce:tF({type:et.STRING,command:"".concat(tb," install --force")})};function tV(e){return V(_({plugins:[q()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tk.UNIT_TEST_SETUP_CONFIG]}},e))}x(tV,"vitestUnit");function tY(e){try{return JSON.parse(e),!0}catch(e){return!1}}x(tY,"isJson");function tK(e){return(typeof e==="undefined"?"undefined":D(e))=="object"&&e!==null&&!Array.isArray(e)}x(tK,"isObject");function tB(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n={};var s=true,i=false,o=undefined,a=true,c=false,u=undefined;try{for(var l=t.flat()[Symbol.iterator](),d;!(a=(d=l.next()).done);a=true){var f=d.value;try{for(var p=Object.entries(f)[Symbol.iterator](),m;!(s=(m=p.next()).done);s=true){var E=N(m.value,2),g=E[0],v=E[1];var _=n[g];if(Array.isArray(v)){var h=Array.isArray(_)?_:[];n[g]=I(new Set(I(h).concat(I(v))));continue}if(tK(v)){n[g]=tB(tK(_)?_:{},v);continue}n[g]=v}}catch(e){i=true;o=e}finally{try{if(!s&&p.return!=null){p.return()}}finally{if(i){throw o}}}}}catch(e){c=true;u=e}finally{try{if(!a&&l.return!=null){l.return()}}finally{if(c){throw u}}}return n}x(tB,"deepMerge");import*as tH from"globals";var tW=[{languageOptions:{globals:_({},tH.node,tH.browser)},rules:{"perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}],"dot-notation":"off"},ignores:["build","dist"]}];var tQ;var tJ=x(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=tB.apply(void 0,[tW].concat(I(t.map(function(e){return e})))),s=n.ignores,i=S(n,["ignores"]),o=Array.isArray(s)&&s.every(function(e){return typeof e=="string"})?{ignores:s}:void 0,a=[i].concat(I(o?[o]:[]));return U.apply(void 0,[{stylistic:{semi:!0,indent:4,quotes:"single"},formatters:{css:!0,html:!0,markdown:"prettier"},yaml:!1,react:!0}].concat(I(a)))},"handleESLint"),tz=(tQ={},l(tQ,M.ESLINT,function(e){return tJ(e)}),l(tQ,M.COMMITLINT,function(e){return tB(e)}),l(tQ,M.LINT_STAGED,function(e){return tB(e)}),l(tQ,M.VITEST_REACT_UNIT,function(e){return tV(e)}),l(tQ,M.VITEST_REACT_E2E,function(e){return F(e)}),tQ);function t$(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}var s=tz[e];if(!r||r.length===0)return s({});if(!s)throw new Error("Unknown config type: ".concat(e));return s.apply(void 0,I(r))}x(t$,"mergeConfigs");import{defineConfig as tX}from"@eddeee888/gcg-typescript-resolver-files";Z();function tZ(e){var t=e.uri,r=e.from,n=e.to,s=e.target,i=s===void 0?"client":s;var o=i==="client",a=i==="server";return y(_({schema:t,ignoreNoDocuments:!0,overwrite:!0},o&&{documents:[r]}),{generates:_({},o&&l({},n,{preset:"client",presetConfig:{fragmentMasking:!1,persistedDocuments:!0},config:{useTypeImports:!0}}),a&&l({},n,tX()))})}x(tZ,"createGraphqlCodegenConfig");var t0={"*":["eslint --fix"]};var t1=(typeof window==="undefined"?"undefined":D(window))<"u";import{ApolloServer as t2}from"@apollo/server";import{expressMiddleware as t4}from"@apollo/server/express4";import{ApolloServerPluginDrainHttpServer as t3}from"@apollo/server/plugin/drainHttpServer";import{ApolloServerPluginLandingPageLocalDefault as t5,ApolloServerPluginLandingPageProductionDefault as t8}from"@apollo/server/plugin/landingPage/default";function t6(e){return new t2(_({schema:e.schema,plugins:[e.isDev?t5():t8(),t3({httpServer:e.server})].concat(I(e.drainServer?[{serverWillStart:function t(){return /*#__PURE__*/i(function(){return T(this,function(t){return[2,{drainServer:function t(){return /*#__PURE__*/i(function(){var t;return T(this,function(r){(t=e.drainServer)===null||t===void 0?void 0:t.call(e),ep.info("Apollo Server drainServer hook called");return[2]})})()}}]})})()}}]:[]))},e.isDev&&{introspection:!0,includeStacktraceInErrorResponses:!0}))}x(t6,"createApolloServer");import t7 from"node:process";import{hideBin as t9}from"yargs/helpers";import re from"yargs/yargs";var rt={name:"@cyberskill/shared",type:"module",version:"1.129.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/env":{types:"./dist/configs/env/index.d.ts",import:"./dist/configs/env/index.js",require:"./dist/configs/env/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"},"./node":{types:"./dist/node/index.d.ts",import:"./dist/node/index.js",require:"./dist/node/index.cjs"},"./node/apollo-server":{types:"./dist/node/apollo-server/index.d.ts",import:"./dist/node/apollo-server/index.js",require:"./dist/node/apollo-server/index.cjs"},"./node/cli":{types:"./dist/node/cli/index.d.ts",import:"./dist/node/cli/index.js",require:"./dist/node/cli/index.cjs"},"./node/command":{types:"./dist/node/command/index.d.ts",import:"./dist/node/command/index.js",require:"./dist/node/command/index.cjs"},"./node/express":{types:"./dist/node/express/index.d.ts",import:"./dist/node/express/index.js",require:"./dist/node/express/index.cjs"},"./node/fs":{types:"./dist/node/fs/index.d.ts",import:"./dist/node/fs/index.js",require:"./dist/node/fs/index.cjs"},"./node/log":{types:"./dist/node/log/index.d.ts",import:"./dist/node/log/index.js",require:"./dist/node/log/index.cjs"},"./node/mongo":{types:"./dist/node/mongo/index.d.ts",import:"./dist/node/mongo/index.js",require:"./dist/node/mongo/index.cjs"},"./node/package":{types:"./dist/node/package/index.d.ts",import:"./dist/node/package/index.js",require:"./dist/node/package/index.cjs"},"./node/path":{types:"./dist/node/path/index.d.ts",import:"./dist/node/path/index.js",require:"./dist/node/path/index.cjs"},"./node/storage":{types:"./dist/node/storage/index.d.ts",import:"./dist/node/storage/index.js",require:"./dist/node/storage/index.cjs"},"./node/ws":{types:"./dist/node/ws/index.d.ts",import:"./dist/node/ws/index.js",require:"./dist/node/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/node/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"tsup --watch",lint:"tsx src/node/cli/index.ts lint","lint:fix":"tsx src/node/cli/index.ts lint:fix","lint:inspect":"tsx src/node/cli/index.ts lint:inspect",reset:"tsx src/node/cli/index.ts reset",prepare:"tsx src/node/cli/index.ts prepare",inspect:"tsx src/node/cli/index.ts inspect","test:unit":"tsx src/node/cli/index.ts test:unit","test:e2e":"tsx src/node/cli/index.ts test:e2e",commitlint:"tsx src/node/cli/index.ts commitlint","lint-staged":"tsx src/node/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.8","@apollo/server":"4.12.0","@dotenvx/dotenvx":"1.42.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@nestjs/common":"11.1.0","@nestjs/core":"11.1.0","@next/eslint-plugin-next":"15.3.1","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.2","body-parser":"2.2.0",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.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.20",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.11.0","graphql-ws":"6.0.4",i18next:"25.0.2",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.16.0",mongoose:"8.14.1","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.1.0","node-fetch":"3.3.2","node-persist":"4.0.4",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.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.4",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.4",vitest:"3.1.2","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","@commitlint/config-conventional":"19.8.0","@eslint/config-inspector":"1.0.2","@types/body-parser":"1.19.5","@types/compression":"1.7.5","@types/cookie-parser":"1.4.8","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/express-useragent":"1.0.5","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node":"22.15.3","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.3","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};function rr(){return /*#__PURE__*/i(function(){var e,t;return T(this,function(r){switch(r.label){case 0:if(!eb(tk.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,tq.typescriptCheck()];case 1:return[4,e0.apply(void 0,t.concat([r.sent()]))];case 2:e=r.sent();return[3,4];case 3:e=ep.warn("No TypeScript configuration found. Skipping type check.");r.label=4;case 4:e;return[2]}})})()}x(rr,"checkTypescript");function rn(){return /*#__PURE__*/i(function(){var e,t,r,n;var s=arguments;return T(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];r=["Running ESLint with auto-fix"];return[4,tq.eslintFix()];case 1:return[4,e0.apply(void 0,r.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:n=["Running ESLint check"];return[4,tq.eslintCheck()];case 4:return[4,e0.apply(void 0,n.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}x(rn,"checkEslint");function rs(e,t){if(!t.length)return;var r=e==="Errors"?"red":"yellow";ep.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,r)}x(rs,"printIssues");function ri(){return /*#__PURE__*/i(function(){var e,t,r;return T(this,function(n){switch(n.label){case 0:return[4,eB()];case 1:e=n.sent(),t=e.filter(function(e){return e.type===ei.Error}),r=e.filter(function(e){return e.type===ei.Warning});!t.length&&!r.length?ep.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(rs("Warnings",r),rs("Errors",t),(t.length>0||r.length>0)&&t7.exit(1));return[2]}})})()}x(ri,"showCheckResult");function ro(){return /*#__PURE__*/i(function(){var e,t,r,n,s,i;return T(this,function(o){switch(o.label){case 0:return[4,eH()];case 1:o.sent();return[4,ex({name:e9})];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);r=["Building package: ".concat(e9)];return[4,tq.build()];case 4:return[4,e0.apply(void 0,r.concat([o.sent()]))];case 5:o.sent();n=["Staging build artifacts"];return[4,tq.stageBuildDirectory()];case 6:return[4,e0.apply(void 0,n.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw ep.error("Error building and staging ".concat(e9,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,tq.lintStaged()];case 10:return[4,e0.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),ri();return[2]}})})()}x(ro,"lintStaged");function ra(){return /*#__PURE__*/i(function(){var e;return T(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,tq.eslintInspect()];case 1:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}x(ra,"inspectLint");function rc(){return /*#__PURE__*/i(function(){return T(this,function(e){switch(e.label){case 0:return[4,eH()];case 1:e.sent();return[4,Promise.all([rr(),rn()])];case 2:e.sent(),ri();return[2]}})})()}x(rc,"lintCheck");function ru(){return /*#__PURE__*/i(function(){return T(this,function(e){switch(e.label){case 0:return[4,eH()];case 1:e.sent();return[4,Promise.all([rr(),rn(!0)])];case 2:e.sent(),ri();return[2]}})})()}x(ru,"lintFix");function rl(){return /*#__PURE__*/i(function(){var e;return T(this,function(t){switch(t.label){case 0:return[4,eH()];case 1:t.sent();e=["Validating commit message"];return[4,tq.commitLint()];case 2:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),ri();return[2]}})})()}x(rl,"commitLint");function rd(){return /*#__PURE__*/i(function(){var e,t,r,n;return T(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,tq.configureGitHook()];case 1:return[4,e0.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eA(tk.GIT_HOOK);return[4,eZ(tj)];case 3:t=s.sent();eI(tk.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(t,null,4));r="\n".concat(to,"\n");eb(tk.GIT_IGNORE)?eO(tk.GIT_IGNORE,"utf-8").split("\n").includes(to)||eD(tk.GIT_IGNORE,r):eI(tk.GIT_IGNORE,r);n=["Setting up simple-git-hooks"];return[4,tq.simpleGitHooks()];case 4:return[4,e0.apply(void 0,n.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}x(rd,"setupGitHook");function rf(){return /*#__PURE__*/i(function(){return T(this,function(e){switch(e.label){case 0:return[4,eM([{name:e9,type:em.DEPENDENCY}],{update:!0,postInstallActions:[rd]})];case 1:e.sent();return[2]}})})()}x(rf,"prepare");function rp(){return /*#__PURE__*/i(function(){return T(this,function(e){switch(e.label){case 0:eA(tk.NODE_MODULES,tk.PNPM_LOCK_YAML);return[4,eL()];case 1:e.sent();return[4,rd()];case 2:e.sent();return[2]}})})()}x(rp,"reset");function rm(){return /*#__PURE__*/i(function(){var e;return T(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,tq.nodeModulesInspect()];case 1:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}x(rm,"inspect");function rE(){return /*#__PURE__*/i(function(){var e;return T(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,tq.testUnit()];case 1:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}x(rE,"testUnit");function rg(){return /*#__PURE__*/i(function(){var e;return T(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,tq.testE2e()];case 1:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}x(rg,"testE2E");function rv(e){return /*#__PURE__*/i(function(){var t;return T(this,function(r){switch(r.label){case 0:t=["Creating MongoDB migration"];return[4,tq.mongoMigrateCreate(e)];case 1:return[4,e0.apply(void 0,t.concat([r.sent()]))];case 2:r.sent();return[2]}})})()}x(rv,"mongoMigrateCreate");function r_(){return /*#__PURE__*/i(function(){var e;return T(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,tq.mongoMigrateUp()];case 1:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}x(r_,"mongoMigrateUp");function rh(){return /*#__PURE__*/i(function(){var e;return T(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,tq.mongoMigrateDown()];case 1:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}x(rh,"mongoMigrateDown");(function(){return /*#__PURE__*/i(function(){var e;return T(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,re(t9(t7.argv)).scriptName(tf).usage("$0 <command> [options]").command("lint","Check code for linting issues",rc).command("lint:fix","Fix linting issues automatically",ru).command("lint:inspect","View active ESLint configuration",ra).command("lint-staged","Run lint checks on staged files",ro).command("commitlint","Validate commit message format",rl).command("prepare","Initialize project and dependencies",rf).command("reset","Reset the project and reinstall dependencies",rp).command("inspect","Analyze installed project dependencies",rm).command("test:unit","Run unit test suite",rE).command("test:e2e","Run end-to-end test suite",rg).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return /*#__PURE__*/i(function(){return T(this,function(t){switch(t.label){case 0:if(!e.name){ep.error("Migration name is required.");return[2]}return[4,rv(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",r_).command("mongo:migrate:down","Rollback last MongoDB migration",rh).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(rt.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();ep.error("Fatal: ".concat(e.message)),t7.exit(1);return[3,3];case 3:return[2]}})})()})();import{Router as ry}from"express";import{NestFactory as rS}from"@nestjs/core";import rO from"body-parser";import rR from"compression";import rC from"cookie-parser";import rN from"cors";import rI from"express";import rD from"express-session";import rb from"express-useragent";function rA(e){var t=e.isDev,r=e.whiteList,n=S(e,["isDev","whiteList"]);return _({origin:x(function(e,n){t||(r===null||r===void 0?void 0:r.includes(e!==null&&e!==void 0?e:""))?n(null,!0):n(new Error("Not allowed by CORS"),!1)},"origin"),credentials:!0},n)}x(rA,"createCorsOptions");function rT(e){return rN(rA(e))}x(rT,"createCors");function rP(e){return rD(e)}x(rP,"createSession");function rw(e){var t=rI();return t.set("trust proxy",1),t.use(rC()),t.use(rI.urlencoded({extended:!0})),t.use(rR()),t.use(rb.express()),(e===null||e===void 0?void 0:e.staticFolder)&&t.use(rI.static(e.staticFolder)),t}x(rw,"createExpress");function rx(e){return /*#__PURE__*/i(function(){var t,r,n;return T(this,function(s){switch(s.label){case 0:return[4,rS.create(e.module)];case 1:n=s.sent();return[2,(n.getHttpAdapter().getInstance().set("trust proxy",1),n.use(rI.urlencoded({extended:!0})),n.use(rC()),n.use(rR()),n.use(rb.express()),e.staticFolder&&n.use(rI.static(e.staticFolder)),e.filters&&(t=n).useGlobalFilters.apply(t,I(e.filters)),e.pipes&&(r=n).useGlobalPipes.apply(r,I(e.pipes)),n)]}})})()}x(rx,"createNest");var rG="MONGO_MIGRATE_OPTIONS";import{Collection as rL,Db as rM}from"mongodb";import{Document as rU,Model as rk}from"mongoose";var rj=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rM);x(rj,"C_Db");var rF=rj,rq=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rU);x(rq,"C_Document");var rV=rq,rY=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rk);x(rY,"C_Model");var rK=rY,rB=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rL);x(rB,"C_Collection");var rH=rB;import{format as rW}from"date-fns";import rQ from"migrate-mongo";import{Document as rJ}from"mongoose";import rz from"mongoose-aggregate-paginate-v2";import r$ from"mongoose-paginate-v2";import{v4 as rX}from"uuid";import rZ from"unorm";var r0={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},r1=Object.entries(r0).reduce(function(e,t){var r=N(t,2),n=r[0],s=r[1];return e[n.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function r2(e){e=rZ.nfkc(e);var t=_({},r0,r1);var r=true,n=false,s=undefined;try{for(var i=Object.entries(t)[Symbol.iterator](),o;!(r=(o=i.next()).done);r=true){var a=N(o.value,2),c=a[0],u=a[1];var l="[".concat(c).concat(u.join(""),"]"),d="(".concat([c].concat(I(u)).join("|"),")");e=e.replace(new RegExp(l,"g"),d)}}catch(e){n=true;s=e}finally{try{if(!r&&i.return!=null){i.return()}}finally{if(n){throw s}}}return e}x(r2,"regexSearchMapper");function r4(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}x(r4,"removeAccent");var r3={Date:{is:x(function(e){return p(e,Date)},"is"),serialize:x(function(e){return{__type:"Date",value:e.toISOString()}},"serialize"),deserialize:x(function(e){return new Date(e)},"deserialize")},Map:{is:x(function(e){return p(e,Map)},"is"),serialize:x(function(e){return{__type:"Map",value:Array.from(e.entries())}},"serialize"),deserialize:x(function(e){return new Map(e)},"deserialize")},Set:{is:x(function(e){return p(e,Set)},"is"),serialize:x(function(e){return{__type:"Set",value:Array.from(e)}},"serialize"),deserialize:x(function(e){return new Set(e)},"deserialize")},RegExp:{is:x(function(e){return p(e,RegExp)},"is"),serialize:x(function(e){return{__type:"RegExp",value:{source:e.source,flags:e.flags}}},"serialize"),deserialize:x(function(e){var t=e.source,r=e.flags;return new RegExp(t,r)},"deserialize")},BigInt:{is:x(function(e){return(typeof e==="undefined"?"undefined":D(e))=="bigint"},"is"),serialize:x(function(e){return{__type:"BigInt",value:e.toString()}},"serialize"),deserialize:x(function(e){return BigInt(e)},"deserialize")}},r5={serialize:function e(e){return JSON.stringify(e,function(e,t){var r=true,n=false,s=undefined;try{for(var i=Object.keys(r3)[Symbol.iterator](),o;!(r=(o=i.next()).done);r=true){var a=o.value;var c=r3[a];if(c.is(t))return c.serialize(t)}}catch(e){n=true;s=e}finally{try{if(!r&&i.return!=null){i.return()}}finally{if(n){throw s}}}return t})},deserialize:function e(e){return JSON.parse(e,function(e,t){if(t&&(typeof t==="undefined"?"undefined":D(t))=="object"&&"__type"in t&&typeof t.__type=="string"){var r=t.__type,n=r3[r];if(n)return n.deserialize(t.value)}return t})}};import r8 from"crypto-js";import r6 from"slugify";var r7=r6.default||r6;function r9(e,t){var r=x(function(e){var r,n;return r7(e!==null&&e!==void 0?e:"",_({lower:(r=t===null||t===void 0?void 0:t.lower)!==null&&r!==void 0?r:!0,locale:(n=t===null||t===void 0?void 0:t.locale)!==null&&n!==void 0?n:"vi"},t))},"slugifyWithOptions");if(tK(e)){var n={};var s=true,i=false,o=undefined;try{for(var a=Object.entries(e)[Symbol.iterator](),c;!(s=(c=a.next()).done);s=true){var u=N(c.value,2),l=u[0],d=u[1];n[l]=r(d)}}catch(e){i=true;o=e}finally{try{if(!s&&a.return!=null){a.return()}}finally{if(i){throw o}}}return n}return r(e)}x(r9,"generateSlug");function ne(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return r8.SHA256(e).toString(r8.enc.Hex).slice(0,t)}x(ne,"generateShortId");function nt(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:8;var t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+[]{}|;:,.<>?",r="";for(var n=0;n<e;n++){var s=Math.floor(Math.random()*t.length);r+=t.charAt(s)}return r}x(nt,"generateRandomPassword");function nr(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;var r=e.split(/[?#]/)[0]||"",n=r.substring(r.lastIndexOf("/")+1);if(t)return n;var s=n.lastIndexOf(".");return s>0?n.slice(0,s):n}x(nr,"getFileName");function nn(e,t,r){var n=e.indexOf(t);if(n===-1)return"";var s=n+t.length,i=e.indexOf(r,s);return i===-1?"":e.slice(s,i)}x(nn,"substringBetween");var ns={isEmpty:function e(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":D(e))=="object"?p(e,Date)?!1:p(e,Map)||p(e,Set)?e.size===0:p(e,WeakMap)||p(e,WeakSet)?!0:ArrayBuffer.isView(e)?e.byteLength===0:Object.keys(e).length===0:!1},isValidIP:function e(e){var t=e.split(".");return t.length===4&&t.every(function(e){return/^\d+$/.test(e)&&Number(e)>=0&&Number(e)<=255})?!0:/^(([a-f\d]{1,4}:){7}[a-f\d]{1,4}|((?:[a-f\d]{1,4}:){1,7}:)|((?:[a-f\d]{1,4}:){1,6}:[a-f\d]{1,4})|::)$/i.test(e)}};var ni={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return rW(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,r=t===void 0?"string":t;var n=r==="string"?ni.getDateTime():new Date;return{id:rX(),isDel:!1,createdAt:n,updatedAt:n}},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 r=t.method,n=t.pre,s=t.post;r&&n&&e.pre(r,n),r&&s&&e.post(r,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:rX,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,r=e.schema,n=e.virtuals,s=n===void 0?[]:n,i=e.standalone,o=i===void 0?!1:i;var a=new t.Schema(r,{strict:!0});return s.forEach(function(e){var t=e.name,r=e.options,n=e.get;var s=a.virtual(t,r);n&&s.get(n)}),o||a.add(ni.createGenericSchema(t)),a},createModel:function e(e){var t=e.mongoose,r=e.name,n=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(!r)throw new Error("Model name is required.");if(t.models[r])return t.models[r];var f=ni.createSchema({mongoose:t,schema:n,virtuals:u});return ni.applyPlugins(f,[i&&r$,a&&rz]),ni.applyMiddlewares(f,d),t.model(r,f)},validator:{isEmpty:function e(){return function(e){return /*#__PURE__*/i(function(){return T(this,function(t){return[2,!ns.isEmpty(e)]})})()}},isUnique:function e(e){return function(t){return /*#__PURE__*/i(function(){var r;return T(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");r={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.exists(r)];case 1:return[2,!n.sent()]}})}).call(this)}},matchesRegex:function e(e){return function(t){return /*#__PURE__*/i(function(){return T(this,function(r){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)})]})})()}}},migrate:y(_({},rQ),{setConfig:x(function(e){var t="// This file is automatically generated by the Cyberskill CLI.\nmodule.exports = ".concat(JSON.stringify(e,null,4));eI(tk.MIGRATE_MONGO_CONFIG,t);var r="\n".concat(tl,"\n");eb(tk.GIT_IGNORE)?eO(tk.GIT_IGNORE,"utf-8").split("\n").includes(tl)||eD(tk.GIT_IGNORE,r):eI(tk.GIT_IGNORE,r)},"setConfig")})},no=/*#__PURE__*/function(){"use strict";function e(t,r){a(this,e);G(this,"collection");this.collection=t.collection(r)}u(e,[{key:"createOne",value:function e(e){return /*#__PURE__*/i(function(){var t,r,n;return T(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=_({},ni.createGenericFields(),e);r={success:!0,message:"Document created successfully"};return[4,this.collection.insertOne(t)];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return /*#__PURE__*/i(function(){var t,r,n;return T(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=e.map(function(e){return _({},ni.createGenericFields(),e)});return[4,this.collection.insertMany(t)];case 1:r=s.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:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"findOne",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return T(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,this.collection.findOne(e)];case 1:t=n.sent();return[2,t?{success:!0,message:"Document found",result:t}:{success:!1,message:"Document not found"}];case 2:r=n.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"findAll",value:function e(){return /*#__PURE__*/i(function(){var e,t,r;var n=arguments;return T(this,function(s){switch(s.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Documents retrieved successfully"};return[4,this.collection.find(e).toArray()];case 2:return[2,(t.result=s.sent(),t)];case 3:r=s.sent();return[2,{success:!1,message:r.message}];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return /*#__PURE__*/i(function(){var e,t,r;var n=arguments;return T(this,function(s){switch(s.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Count retrieved successfully"};return[4,this.collection.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:r=s.sent();return[2,{success:!1,message:r.message}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(e,t){return /*#__PURE__*/i(function(){var r,n;return T(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateOne(e,{$set:t})];case 1:r=s.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"updateMany",value:function e(e,t){return /*#__PURE__*/i(function(){var r,n;return T(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateMany(e,{$set:t})];case 1:r=s.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"deleteOne",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return T(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,this.collection.deleteOne(e)];case 1:t=n.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:t}];case 2:r=n.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"deleteMany",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return T(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,this.collection.deleteMany(e)];case 1:t=n.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:t}];case 2:r=n.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}}]);return e}();x(no,"MongoController");var na=no,nc=/*#__PURE__*/function(){"use strict";function e(t){a(this,e);G(this,"model");this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(e){return /*#__PURE__*/i(function(){var e,t,r,n,s,i,o;var a=arguments;return T(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},r=a.length>2&&a[2]!==void 0?a[2]:{},n=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.findOne(e,t,r);n&&s.populate(n);return[4,s.exec()];case 2:i=c.sent();return[2,i?{success:!0,result:i}:{success:!1,message:"No ".concat(this.getModelName()," found."),code:eu.NOT_FOUND.CODE}];case 3:o=c.sent();return[2,{success:!1,message:o.message,code:eu.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findAll",value:function e(e){return /*#__PURE__*/i(function(){var e,t,r,n,s,i,o;var a=arguments;return T(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},r=a.length>2&&a[2]!==void 0?a[2]:{},n=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.find(e,t,r);n&&s.populate(n);i={success:!0};return[4,s.exec()];case 2:return[2,(i.result=c.sent(),i)];case 3:o=c.sent();return[2,{success:!1,message:o.message,code:eu.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPaging",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n;var s=arguments;return T(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);r={success:!0};return[4,this.model.paginate(e,t)];case 2:return[2,(r.result=i.sent(),r)];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:eu.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPagingAggregate",value:function e(e){return /*#__PURE__*/i(function(e){var t,r,n;var s=arguments;return T(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);r={success:!0};return[4,this.model.aggregatePaginate(this.model.aggregate(e),t)];case 2:return[2,(r.result=i.sent(),r)];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:eu.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return /*#__PURE__*/i(function(){var e,t,r;var n=arguments;return T(this,function(s){switch(s.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0};return[4,this.model.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:r=s.sent();return[2,{success:!1,message:r.message,code:eu.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"createOne",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return T(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);t={success:!0};return[4,this.model.create(e)];case 1:return[2,(t.result=n.sent(),t)];case 2:r=n.sent();return[2,{success:!1,message:r.message,code:eu.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return /*#__PURE__*/i(function(e){var t,r,n;var s=arguments;return T(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);r={success:!0};return[4,this.model.insertMany(e,t)];case 2:return[2,(r.result=i.sent().map(function(e){return p(e,rJ)?e.toObject():null}).filter(function(e){return e!==null}),r)];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:eu.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n,s;var i=arguments;return T(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},r=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);return[4,this.model.findOneAndUpdate(e,t,_({new:!0},r)).exec()];case 2:n=o.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"Failed to update ".concat(this.getModelName(),"."),code:eu.NOT_FOUND.CODE}];case 3:s=o.sent();return[2,{success:!1,message:s.message,code:eu.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateMany",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n,s;var i=arguments;return T(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},r=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);n={success:!0};return[4,this.model.updateMany(e,t,r).exec()];case 2:return[2,(n.result=o.sent(),n)];case 3:s=o.sent();return[2,{success:!1,message:s.message,code:eu.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteOne",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n;var s=arguments;return T(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.findOneAndDelete(e,t).exec()];case 2:r=i.sent();return[2,r?{success:!0,result:r}:{success:!1,message:"No ".concat(this.getModelName()," found to delete."),code:eu.NOT_FOUND.CODE}];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:eu.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteMany",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n;var s=arguments;return T(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.deleteMany(e,t).exec()];case 2:r=i.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents found to delete.",code:eu.NOT_FOUND.CODE}:{success:!0,result:r}];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:eu.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return /*#__PURE__*/i(function(){var r,n,s,i;return T(this,function(o){switch(o.label){case 0:r=new Set;n=0;o.label=1;case 1:if(!(n<10))return[3,5];s=ne(e,n+t);i=!r.has(s);if(!i)return[3,3];r.add(s);return[4,this.model.exists({shortId:s})];case 2:i=!o.sent();o.label=3;case 3:if(i)return[2,{success:!0,result:s}];o.label=4;case 4:n++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:eu.INTERNAL_SERVER_ERROR.CODE}]}})}).call(this)}},{key:"createSlug",value:function e(e,t,r){return /*#__PURE__*/i(function(){var n,s,o,a,c,u,d,f,p,m;return T(this,function(E){switch(E.label){case 0:n=this;E.label=1;case 1:E.trys.push([1,5,,6]);s=t[e],o=tK(s),a=x(function(t){var n=_({},r!==null&&r!==void 0?r:{});return o?y(_({},n),{$or:[l({},"slug.".concat(e),t),{slugHistory:{$elemMatch:l({},"slug.".concat(e),t)}}]}):y(_({},n),{$or:[{slug:t},{slugHistory:t}]})},"generateSlugQuery"),c=x(function(e){return /*#__PURE__*/i(function(){var t,r;return T(this,function(n){switch(n.label){case 0:t=e,r=1;n.label=1;case 1:return[4,this.model.exists(a(t))];case 2:if(!n.sent())return[3,4];t="".concat(e,"-").concat(r++);n.label=3;case 3:return[3,1];case 4:return[2,t]}})}).call(n)},"generateUniqueSlug");if(!o)return[3,3];u={success:!0};d=Object.fromEntries;return[4,Promise.all(Object.entries(s).map(function(e){var t=N(e,2),r=t[0],n=t[1];return /*#__PURE__*/i(function(){var e,t;return T(this,function(s){switch(s.label){case 0:e=r9(n);t=[r];return[4,c(e)];case 1:return[2,t.concat([s.sent()])]}})})()}))];case 2:return[2,(u.result=d.apply(Object,[E.sent()]),u)];case 3:f=r9(s);p={success:!0};return[4,c(f)];case 4:return[2,(p.result=E.sent(),p)];case 5:m=E.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(m.message),code:eu.INTERNAL_SERVER_ERROR.CODE}];case 6:return[2]}})}).call(this)}},{key:"aggregate",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return T(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);t={success:!0};return[4,this.model.aggregate(e)];case 1:return[2,(t.result=n.sent(),t)];case 2:r=n.sent();return[2,{success:!1,message:r.message,code:eu.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})}).call(this)}}]);return e}();x(nc,"MongooseController");var nu=nc;import{useServer as nl}from"graphql-ws/use/ws";import{WebSocketServer as nd}from"ws";function nf(e){return new nd({server:e.server,path:e.path})}x(nf,"createWSServer");function np(e){return nl({schema:e.schema},e.server)}x(np,"initGraphQLWS");import{ApolloClient as nm,ApolloError as nE,ApolloLink as ng,ApolloProvider as nv,from as n_,HttpLink as nh,InMemoryCache as ny,split as nS}from"@apollo/client";import{onError as nO}from"@apollo/client/link/error";import{removeTypenameFromVariables as nR}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as nC}from"@apollo/client/link/subscriptions";import{getMainDefinition as nN}from"@apollo/client/utilities";import{createClient as nI}from"graphql-ws";import nD,{useMemo as nb}from"react";import{FaInfo as nA}from"react-icons/fa6";import nT,{use as nP}from"react";import{FaRepeat as nw}from"react-icons/fa6";import{createContext as nx}from"react";var nG=nx(void 0);import nL from"./react/apollo-error/apollo-error.module.scss";function nM(){var e=nP(nG),t=e===null||e===void 0?void 0:e.error;if(!t)return null;var r=x(function(e,t){return(t===null||t===void 0?void 0:t.length)?nT.createElement("div",null,nT.createElement("strong",null,e,":"),nT.createElement("ul",null,t.map(function(e){return nT.createElement("li",{key:e.message},e.message)}))):null},"renderErrorList");return nT.createElement("div",{className:nL["modal-backdrop"]},nT.createElement("div",{className:nL["modal-content"]},nT.createElement("button",{type:"button",className:nL["btn-close"],onClick:e.hideError},"✕"),nT.createElement("div",{className:nL["error-title"]},nT.createElement("button",{type:"button",className:nL["btn-retry"],onClick:x(function(){return window.location.reload()},"onClick")},nT.createElement(nw,null))," ",t.message),nT.createElement("div",{className:nL["error-details"]},t.networkError&&nT.createElement("pre",{className:"network"},nT.createElement("strong",null,"Network Error:")," ",t.networkError.message),r("GraphQL Errors",I(t.graphQLErrors)),r("Protocol Errors",I(t.protocolErrors)),r("Client Errors",I(t.clientErrors)),t.extraInfo&&nT.createElement("pre",{className:"extra"},nT.createElement("strong",null,"Extra Info:")," ",JSON.stringify(t.extraInfo,null,4)))))}x(nM,"ApolloError");import{use as nU}from"react";function nk(){var e=nU(nG);if(!e)throw new Error("useApolloError must be used within ApolloErrorProvider");return e}x(nk,"useApolloError");import nj,{useEffect as nF,useMemo as nq,useState as nV}from"react";var nY=null;function nK(e){nY=e}x(nK,"setGlobalApolloErrorCallback");function nB(e){nY===null||nY===void 0?void 0:nY(e)}x(nB,"showGlobalApolloError");function nH(e){var t=e.children;var r=N(nV(null),2),n=r[0],s=r[1];nF(function(){nK(s)},[]);var i=nq(function(){return{error:n,showError:s,hideError:x(function(){return s(null)},"hideError")}},[n]);return nj.createElement(nG,{value:i},t)}x(nH,"ApolloErrorProvider");import{consola as nW}from"consola/browser";var nQ={silent:nW.silent,level:nW.level,fatal:nW.fatal,error:nW.error,warn:nW.warn,log:nW.log,info:nW.info,success:nW.success,ready:nW.ready,start:nW.start,box:nW.box,debug:nW.debug,trace:nW.trace,verbose:nW.verbose};import{toast as nJ,Toaster as nz}from"react-hot-toast";var n$="/graphql";var nX,nZ=(nX=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);var e;e=o(this,t,arguments);G(e,"count",0);return e}u(t,[{key:"request",value:function e(e,t){var r=this;var n=Date.now();return this.count+=1,t(e).map(function(t){var s=Date.now()-n,i=e.operationName||"Unnamed";return nQ.info("[Apollo] #".concat(r.count,": ").concat(i," (").concat(s,"ms)")),t})}}]);return t}(ng),x(nX,"DevLoggerLink"),nX);function n0(e){var t=e.uri,r=e.wsUrl,n=e.customLinks,s=new nZ,i=nO(function(e){var t=e.graphQLErrors,r=e.networkError,n=e.protocolErrors,s=e.operation;var i=(s===null||s===void 0?void 0:s.operationName)||"Unknown";if(t&&t.forEach(function(e){var t=e.message,r=e.locations,n=e.path;nQ.error("[GraphQL error] ".concat(i,": ").concat(t,", Location: ").concat(JSON.stringify(r,null,4),", Path: ").concat(n))}),n&&n.forEach(function(e){var t=e.message,r=e.extensions;nQ.error("[Protocol error]: ".concat(t,", Extensions: ").concat(JSON.stringify(r,null,4)))}),r&&nQ.error("[Network error]: ".concat(r)),t||n||r){var o,a;var c=(t===null||t===void 0?void 0:(o=t[0])===null||o===void 0?void 0:o.message)||(n===null||n===void 0?void 0:(a=n[0])===null||a===void 0?void 0:a.message)||(r===null||r===void 0?void 0:r.message)||"Unexpected error",u=new nE({graphQLErrors:t||[],protocolErrors:n||[],clientErrors:[],networkError:r||null,errorMessage:c,extraInfo:{operation:s}});nJ.error(function(e){return nD.createElement(nD.Fragment,null,c,"\xa0",nD.createElement(nA,{cursor:"pointer",onClick:x(function(){setTimeout(function(){nB(u)},0),nJ.dismiss(e.id)},"onClick")}))})}}),o=nR();t||nQ.warn('[Apollo] No GraphQL URI provided — using "'.concat(n$,'" as default'));var a=new nh({uri:t!==null&&t!==void 0?t:n$,credentials:"include"}),c=r?new nC(nI({url:r})):ng.empty(),u=p(c,ng)?nS(function(e){var t=e.query;var r=nN(t);return r.kind==="OperationDefinition"&&r.operation==="subscription"},c,a):a;return u===a&&r&&nQ.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[s,i,o].concat(I(n!==null&&n!==void 0?n:[]),[u])}x(n0,"createApolloLinks");function n1(e){var t=e.isNextJS,r=e.options,n=e.children,s=e.client,i=e.provider,o=e.cache;var a=r||{},c=a.uri,u=a.wsUrl,l=a.customLinks,d=S(a,["uri","wsUrl","customLinks"]),f=s!==null&&s!==void 0?s:nm;if(typeof f!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var m=i||nv,E=nb(function(){return n_(n0({uri:c!==null&&c!==void 0?c:n$,wsUrl:u!==null&&u!==void 0?u:"",customLinks:l!==null&&l!==void 0?l:[]}))},[c,u,l]),g=nb(function(){return p(o,ny)?o:new ny},[o]),v=nb(function(){return new f(_({link:E,cache:g},d))},[f,E,g,d]),h=t?nD.createElement(m,{makeClient:x(function(){return v},"makeClient")},n):nD.createElement(m,{client:v},n);return nD.createElement(nD.Fragment,null,nD.createElement(nH,null,h,nD.createElement(nM,null)),nD.createElement(nz,{position:"top-right"}))}x(n1,"ApolloProvider");import{useTranslation as n2}from"react-i18next";var n4=n2;import n3 from"i18next";import{initReactI18next as n5}from"react-i18next";function n8(e){return n3.use(n5).init(e)}x(n8,"initI18next");import n6 from"classnames";import n7 from"react";import n9 from"./react/loading/loading.module.scss";function se(e){var t=e.full,r=t===void 0?!1:t,n=e.block,s=n===void 0?!1:n,i=e.className,o=i===void 0?"":i,a=e.message,c=a===void 0?"Loading":a,u=S(e,["full","block","className","message"]);function l(){return n7.createElement("div",_({className:n9.container},u),n7.createElement("div",{className:n9.ring}),n7.createElement("div",{className:n9.ring}),n7.createElement("div",{className:n9.ring}),n7.createElement("div",{className:n9.ring}),c&&n7.createElement("div",{className:n9.message},c))}return x(l,"_renderLoading"),r?n7.createElement("div",{className:n6(n9.fullscreen,o)},l()):s?n7.createElement("div",{className:n6(n9.block,o)},l()):l()}x(se,"Loading");import{createContext as st}from"react";var sr=st(void 0);import{use as sn}from"react";function ss(){var e=sn(sr);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}x(ss,"useLoading");import si,{useCallback as so,useMemo as sa,useState as sc}from"react";function su(e){var t=e.children;var r=N(sc(!1),2),n=r[0],s=r[1],i=N(sc(!1),2),o=i[0],a=i[1],c=so(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;s(!0),a(e)},[]),u=so(function(){s(!1),a(!1)},[]),l=sa(function(){return{isLoading:n,isGlobalLoading:o,showLoading:c,hideLoading:u}},[n,o,c,u]);return si.createElement(sr,{value:l},n?si.createElement(se,{full:o}):t)}x(su,"LoadingProvider");import{enUS as sl}from"date-fns/locale";var sd={label:"English",value:"en",flag:"\uD83C\uDDFA\uD83C\uDDF8",adapterLocale:sl,icon:"flagpack:gb-nir",numberFormat:{code:"en-US",currency:"USD"},timezone:"America/New_York"};import{createContext as sf}from"react";var sp=sf(void 0);import{NextIntlClientProvider as sm}from"next-intl";import sE from"react";import{useTranslations as sg}from"next-intl";import{use as sv}from"react";function s_(){var e=sv(sp);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}x(s_,"useNextIntl");var sh=sg;function sy(e){var t=x(function(t){var r;var n;var s=s_(),i=s.currentLanguage,o=t.messages,a=t.languages,c="en",u=o[(i===null||i===void 0?void 0:i.value)||c],l=(n=(r=a.find(function(e){return e.value===(i===null||i===void 0?void 0:i.value)}))===null||r===void 0?void 0:r.timezone)!==null&&n!==void 0?n:sd.timezone;return o?sE.createElement(sm,{locale:(i===null||i===void 0?void 0:i.value)||c,messages:u||null,timeZone:l},sE.createElement(e,t)):(nQ.warn("Missing messages for language: ".concat((i===null||i===void 0?void 0:i.value)||c)),null)},"PageWithI18n");return t.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),t}x(sy,"withNextIntl");import sS,{useMemo as sO}from"react";import{useCallback as sR,useEffect as sC,useState as sN}from"react";import sI from"localforage";var sD={get:function e(e){return /*#__PURE__*/i(function(){var t;return T(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sI.getItem(e)];case 1:return[2,r.sent()];case 2:t=r.sent();return[2,(nQ.error('[Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 3:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/i(function(){var r;return T(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,sI.setItem(e,t)];case 1:n.sent();return[3,3];case 2:r=n.sent();nQ.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},remove:function e(e){return /*#__PURE__*/i(function(){var t;return T(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sI.removeItem(e)];case 1:r.sent();return[3,3];case 2:t=r.sent();nQ.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},keys:function e(){return /*#__PURE__*/i(function(){var e,t;return T(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sI.keys()];case 1:return[2,(e=r.sent())!==null&&e!==void 0?e:[]];case 2:t=r.sent();return[2,(nQ.error("[Storage:keys] Error getting keys:",t),[])];case 3:return[2]}})})()}};function sb(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r5;var n=N(sN(t),2),s=n[0],o=n[1],a=N(sN(!1),2),c=a[0],u=a[1];sC(function(){var n=!0;return x(function(){return /*#__PURE__*/i(function(){var s,i,a,c;return T(this,function(l){switch(l.label){case 0:l.trys.push([0,6,7,8]);return[4,sD.get(e)];case 1:s=l.sent();if(!n)return[3,5];if(!(s!==null))return[3,2];i=r.deserialize(s);o(i);return[3,5];case 2:if(!(t!==void 0))return[3,4];a=r.serialize(t);return[4,sD.set(e,a)];case 3:l.sent(),o(t);return[3,5];case 4:o(void 0);l.label=5;case 5:return[3,8];case 6:c=l.sent();nQ.error('Error loading value for key "'.concat(e,'":'),c),n&&o(t);return[3,8];case 7:n&&u(!0);return[7];case 8:return[2]}})})()},"loadValue")(),function(){n=!1,u(!1)}},[e,t,r]),sC(function(){if(!c)return;x(function(){return /*#__PURE__*/i(function(){var t,n;return T(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);if(!(s!==void 0))return[3,2];t=r.serialize(s);return[4,sD.set(e,t)];case 1:i.sent();i.label=2;case 2:return[3,4];case 3:n=i.sent();nQ.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},"saveValue")()},[s,e,r,c]);var l=sR(function(e){o(function(t){return typeof e=="function"?e(t):e})},[]),d=sR(function(){return /*#__PURE__*/i(function(){var t;return T(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sD.remove(e)];case 1:r.sent(),o(void 0);return[3,3];case 2:t=r.sent();nQ.error('Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},[e]);return{value:s,set:l,remove:d}}x(sb,"useStorage");function sA(e){var t=e.children;return sS.createElement(sS.Fragment,null,t)}x(sA,"LanguageWrapperBase");var sT=sy(sA);function sP(e){var t=e.children,r=e.languages,n=e.messages;var s=sb("lang",r[0]),i=s.value,o=s.set,a=sO(function(){return{languages:r,currentLanguage:i!==null&&i!==void 0?i:sd,setCurrentLanguage:o}},[r,o,i]);return sS.createElement(sp,{value:a},sS.createElement(sT,{languages:r,messages:n},t))}x(sP,"NextIntlProvider");export{nM as ApolloError,nG as ApolloErrorContext,nH as ApolloErrorProvider,n1 as ApolloProvider,tt as BUILD_DIRECTORY,tS as COMMIT_LINT_CLI,ty as COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME,th as COMMIT_LINT_PACKAGE_NAME,tf as CYBERSKILL_CLI,tp as CYBERSKILL_CLI_PATH,td as CYBERSKILL_DIRECTORY,e9 as CYBERSKILL_PACKAGE_NAME,K as CYBERSKILL_STORAGE_DIRECTORY,rH as C_Collection,rF as C_Db,rV as C_Document,rK as C_Model,tE as ESLINT_CLI,tx as ESLINT_INSPECT_CLI,tw as ESLINT_INSPECT_PACKAGE_NAME,tm as ESLINT_PACKAGE_NAME,et as E_CommandType,M as E_ConfigType,ei as E_IssueType,em as E_PackageType,tD as GIT_CLI,tu as GIT_COMMIT_EDITMSG,tc as GIT_HOOK,ti as GIT_IGNORE,n$ as GRAPHQL_URI_DEFAULT,t1 as IS_BROWSER,tR as LINT_STAGED_CLI,tO as LINT_STAGED_PACKAGE_NAME,se as Loading,sr as LoadingContext,su as LoadingProvider,tU as MIGRATE_MONGO_CLI,tl as MIGRATE_MONGO_CONFIG,tM as MIGRATE_MONGO_PACKAGE_NAME,rG as MONGO_MIGRATE_OPTIONS,na as MongoController,nu as MongooseController,sd as NEXT_INTL_DEFAULT_LANGUAGE,te as NODE_MODULES,tL as NODE_MODULES_INSPECT_CLI,tG as NODE_MODULES_INSPECT_PACKAGE_NAME,sp as NextIntlContext,sP as NextIntlProvider,tr as PACKAGE_JSON,tn as PACKAGE_LOCK_JSON,tk as PATH,tv as PLAYWRIGHT_PACKAGE_NAME,tb as PNPM_CLI,tA as PNPM_EXEC_CLI,ta as PNPM_LOCK_YAML,eu as RESPONSE_STATUS,ry as Router,tT as SIMPLE_GIT_HOOKS_PACKAGE_NAME,tP as SIMPLE_GIT_HOOK_CLI,to as SIMPLE_GIT_HOOK_JSON,ts as TSCONFIG_JSON,tN as TSC_CLI,tC as TSC_PACKAGE_NAME,tI as TSX_CLI,nz as Toaster,t_ as VITEST_CLI,tg as VITEST_PACKAGE_NAME,e7 as WORKING_DIRECTORY,rz as aggregatePaginate,eD as appendFileSync,rO as bodyParser,eH as clearAllErrorLists,tq as command,L as commitlintConfig,eT as copySync,t6 as createApolloServer,rT as createCors,rA as createCorsOptions,rw as createExpress,tj as createGitHooksConfig,tZ as createGraphqlCodegenConfig,rx as createNest,rP as createSession,nf as createWSServer,tB as deepMerge,tW as eslintConfig,rI as express,t4 as expressMiddleware,eX as formatCommand,e_ as fs,nt as generateRandomPassword,ne as generateShortId,r9 as generateSlug,ee as getEnv,nr as getFileName,ew as getLatestPackageVersion,ex as getPackage,eB as getStoredErrorLists,np as initGraphQLWS,n8 as initI18next,eL as installDependencies,tY as isJson,tK as isObject,e8 as join,t0 as lintStagedConfig,Z as loadEnvFile,nQ as log,ep as logNodeJS,eh as lstatSync,t$ as mergeConfigs,eS as mkdirSync,ni as mongo,r$ as mongoosePaginate,e4 as path,eb as pathExistsSync,ez as rawCommand,eO as readFileSync,eN as readJsonSync,ey as readdirSync,r2 as regexSearchMapper,r4 as removeAccent,eA as removeSync,e5 as resolve,eZ as resolveCommands,e3 as resolveWorkingPath,e0 as runCommand,r5 as serializer,nK as setGlobalApolloErrorCallback,eM as setupPackages,nB as showGlobalApolloError,eC as statSync,sD as storage,eF as storageNodeJS,nn as substringBetween,ed as throwError,nJ as toast,eR as unlinkSync,eG as updatePackage,nk as useApolloError,ss as useLoading,s_ as useNextIntl,sb as useStorage,n4 as useTranslateI18next,sh as useTranslateNextIntl,ns as validate,F as vitestE2E,tV as vitestUnit,sy as withNextIntl,eI as writeFileSync};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(r){if(Array.isArray(r))return e(r)}function t(e,r,t,n,o,a,l){try{var u=e[a](l);var i=u.value}catch(e){t(e);return}if(u.done){r(i)}else{Promise.resolve(i).then(n,o)}}function n(e){return function(){var r=this,n=arguments;return new Promise(function(o,a){var l=e.apply(r,n);function u(e){t(l,o,a,u,i,"next",e)}function i(e){t(l,o,a,u,i,"throw",e)}u(undefined)})}}function o(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function l(){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 u(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}n.forEach(function(r){o(e,r,t[r])})}return e}function i(e){return r(e)||a(e)||f(e)||l()}function c(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function f(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}function s(e,r){var t,n,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},l=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return l.next=u(0),l["throw"]=u(1),l["return"]=u(2),typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function u(e){return function(r){return i([e,r])}}function i(u){if(t)throw new TypeError("Generator is already executing.");while(l&&(l=0,u[0]&&(a=0)),a)try{if(t=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=r.call(e,a)}catch(e){u=[6,e];n=0}finally{t=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}var d=Object.create;var v=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var h=function(e,r){return v(e,"name",{value:r,configurable:!0})};var S=function(e,r){for(var t in r)v(e,t,{get:r[t],enumerable:!0})},m=function(e,r,t,n){var o=true,a=false,l=undefined;if(r&&(typeof r==="undefined"?"undefined":c(r))=="object"||typeof r=="function")try{var u=function(){var o=f.value;!g.call(e,o)&&o!==t&&v(e,o,{get:function(){return r[o]},enumerable:!(n=p(r,o))||n.enumerable})};for(var i=b(r)[Symbol.iterator](),f;!(o=(f=i.next()).done);o=true)u()}catch(e){a=true;l=e}finally{try{if(!o&&i.return!=null){i.return()}}finally{if(a){throw l}}}return e};var w=function(e,r,t){return t=e!=null?d(y(e)):{},m(r||!e||!e.__esModule?v(t,"default",{value:e,enumerable:!0}):t,e)},O=function(e){return m(v({},"__esModule",{value:!0}),e)};var E={};S(E,{createApolloServer:function(){return W},expressMiddleware:function(){return
|
|
1
|
+
"use strict";function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(r){if(Array.isArray(r))return e(r)}function t(e,r,t,n,o,a,l){try{var u=e[a](l);var i=u.value}catch(e){t(e);return}if(u.done){r(i)}else{Promise.resolve(i).then(n,o)}}function n(e){return function(){var r=this,n=arguments;return new Promise(function(o,a){var l=e.apply(r,n);function u(e){t(l,o,a,u,i,"next",e)}function i(e){t(l,o,a,u,i,"throw",e)}u(undefined)})}}function o(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function l(){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 u(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}n.forEach(function(r){o(e,r,t[r])})}return e}function i(e){return r(e)||a(e)||f(e)||l()}function c(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function f(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}function s(e,r){var t,n,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},l=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return l.next=u(0),l["throw"]=u(1),l["return"]=u(2),typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function u(e){return function(r){return i([e,r])}}function i(u){if(t)throw new TypeError("Generator is already executing.");while(l&&(l=0,u[0]&&(a=0)),a)try{if(t=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=r.call(e,a)}catch(e){u=[6,e];n=0}finally{t=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}var d=Object.create;var v=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var h=function(e,r){return v(e,"name",{value:r,configurable:!0})};var S=function(e,r){for(var t in r)v(e,t,{get:r[t],enumerable:!0})},m=function(e,r,t,n){var o=true,a=false,l=undefined;if(r&&(typeof r==="undefined"?"undefined":c(r))=="object"||typeof r=="function")try{var u=function(){var o=f.value;!g.call(e,o)&&o!==t&&v(e,o,{get:function(){return r[o]},enumerable:!(n=p(r,o))||n.enumerable})};for(var i=b(r)[Symbol.iterator](),f;!(o=(f=i.next()).done);o=true)u()}catch(e){a=true;l=e}finally{try{if(!o&&i.return!=null){i.return()}}finally{if(a){throw l}}}return e};var w=function(e,r,t){return t=e!=null?d(y(e)):{},m(r||!e||!e.__esModule?v(t,"default",{value:e,enumerable:!0}):t,e)},O=function(e){return m(v({},"__esModule",{value:!0}),e)};var E={};S(E,{createApolloServer:function(){return W},expressMiddleware:function(){return x.expressMiddleware}});module.exports=O(E);var P=require("@apollo/server"),x=require("@apollo/server/express4"),A=require("@apollo/server/plugin/drainHttpServer"),j=require("@apollo/server/plugin/landingPage/default");var _=w(require("chalk"),1),D=w(require("consola"),1),R=require("graphql");var q=".cyberskill-storage";var I=w(require("@dotenvx/dotenvx"),1),k=require("envalid"),C=w(require("os"),1),L=w(require("path"),1),B=w(require("process"),1);var G=!1;function M(){G||(I.default.config(),G=!0)}h(M,"loadEnvFile");function T(){M();var e=(0,k.cleanEnv)(B.default.env,{CWD:(0,k.str)({default:B.default.cwd()}),DEBUG:(0,k.bool)({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:(0,k.str)({default:L.default.join(C.default.homedir(),q)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}h(T,"getEnv");var U=T();U.DEBUG||(D.default.level=4);function Y(e){var r=_.default[e];return typeof r=="function"?r:_.default.green}h(Y,"chalkKeyword");var K={silent:D.default.silent,level:D.default.level,fatal:D.default.fatal,error:D.default.error,warn:D.default.warn,log:D.default.log,info:D.default.info,success:D.default.success,ready:D.default.ready,start:D.default.start,box:D.default.box,debug:D.default.debug,trace:D.default.trace,verbose:D.default.verbose,printBoxedLog:function e(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(r===null||r===void 0?void 0:r.length)){D.default.box(_.default.green(e));return}r.forEach(function(e){var r=e.file,n=e.position,o=e.rule,a=e.message;D.default.log("".concat(_.default.gray("File:")," ").concat(_.default.blue("".concat(r).concat(n?":".concat(n):"")))),o&&D.default.log(" ".concat(Y(t)("Rule:")," ").concat(o)),D.default.log(" ".concat(Y(t)("Message:")," ").concat(a))}),D.default.box(Y(t)("".concat(e," : ").concat(r.length))),D.default.log(_.default.gray("─".repeat(40)))}};function W(e){return new P.ApolloServer(u({schema:e.schema,plugins:[e.isDev?(0,j.ApolloServerPluginLandingPageLocalDefault)():(0,j.ApolloServerPluginLandingPageProductionDefault)(),(0,A.ApolloServerPluginDrainHttpServer)({httpServer:e.server})].concat(i(e.drainServer?[{serverWillStart:function r(){return /*#__PURE__*/n(function(){return s(this,function(r){return[2,{drainServer:function r(){return /*#__PURE__*/n(function(){var r;return s(this,function(t){(r=e.drainServer)===null||r===void 0?void 0:r.call(e),K.info("Apollo Server drainServer hook called");return[2]})})()}}]})})()}}]:[]))},e.isDev&&{introspection:!0,includeStacktraceInErrorResponses:!0}))}h(W,"createApolloServer");0&&(module.exports={createApolloServer:createApolloServer,expressMiddleware:expressMiddleware});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(e){if(Array.isArray(e))return r(e)}function t(r,e,t,n,o,a,i){try{var l=r[a](i);var c=l.value}catch(r){t(r);return}if(l.done){e(c)}else{Promise.resolve(c).then(n,o)}}function n(r){return function(){var e=this,n=arguments;return new Promise(function(o,a){var i=r.apply(e,n);function l(r){t(i,o,a,l,c,"next",r)}function c(r){t(i,o,a,l,c,"throw",r)}l(undefined)})}}function o(r,e,t){if(e in r){Object.defineProperty(r,e,{value:t,enumerable:true,configurable:true,writable:true})}else{r[e]=t}return r}function a(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function i(){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 l(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))}n.forEach(function(e){o(r,e,t[e])})}return r}function c(r){return e(r)||a(r)||u(r)||i()}function u(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}function f(r,e){var t,n,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=l(0),i["throw"]=l(1),i["return"]=l(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function l(r){return function(e){return c([r,e])}}function c(l){if(t)throw new TypeError("Generator is already executing.");while(i&&(i=0,l[0]&&(a=0)),a)try{if(t=1,n&&(o=l[0]&2?n["return"]:l[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;if(n=0,o)l=[l[0]&2,o.value];switch(l[0]){case 0:case 1:o=l;break;case 4:a.label++;return{value:l[1],done:false};case 5:a.label++;n=l[1];l=[0];continue;case 7:l=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){a=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(l[0]===6&&a.label<o[1]){a.label=o[1];o=l;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(l);break}if(o[2])a.ops.pop();a.trys.pop();continue}l=e.call(r,a)}catch(r){l=[6,r];n=0}finally{t=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}}var s=Object.defineProperty;var p=function(r,e){return s(r,"name",{value:e,configurable:!0})};import{ApolloServer as v}from"@apollo/server";import{expressMiddleware as d}from"@apollo/server/express4";import{ApolloServerPluginDrainHttpServer as b}from"@apollo/server/plugin/drainHttpServer";import{ApolloServerPluginLandingPageLocalDefault as g,ApolloServerPluginLandingPageProductionDefault as m}from"@apollo/server/plugin/landingPage/default";import y from"chalk";import h from"consola";import{GraphQLError as S}from"graphql";var
|
|
1
|
+
function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(e){if(Array.isArray(e))return r(e)}function t(r,e,t,n,o,a,i){try{var l=r[a](i);var c=l.value}catch(r){t(r);return}if(l.done){e(c)}else{Promise.resolve(c).then(n,o)}}function n(r){return function(){var e=this,n=arguments;return new Promise(function(o,a){var i=r.apply(e,n);function l(r){t(i,o,a,l,c,"next",r)}function c(r){t(i,o,a,l,c,"throw",r)}l(undefined)})}}function o(r,e,t){if(e in r){Object.defineProperty(r,e,{value:t,enumerable:true,configurable:true,writable:true})}else{r[e]=t}return r}function a(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function i(){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 l(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))}n.forEach(function(e){o(r,e,t[e])})}return r}function c(r){return e(r)||a(r)||u(r)||i()}function u(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}function f(r,e){var t,n,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=l(0),i["throw"]=l(1),i["return"]=l(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function l(r){return function(e){return c([r,e])}}function c(l){if(t)throw new TypeError("Generator is already executing.");while(i&&(i=0,l[0]&&(a=0)),a)try{if(t=1,n&&(o=l[0]&2?n["return"]:l[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;if(n=0,o)l=[l[0]&2,o.value];switch(l[0]){case 0:case 1:o=l;break;case 4:a.label++;return{value:l[1],done:false};case 5:a.label++;n=l[1];l=[0];continue;case 7:l=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){a=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(l[0]===6&&a.label<o[1]){a.label=o[1];o=l;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(l);break}if(o[2])a.ops.pop();a.trys.pop();continue}l=e.call(r,a)}catch(r){l=[6,r];n=0}finally{t=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}}var s=Object.defineProperty;var p=function(r,e){return s(r,"name",{value:e,configurable:!0})};import{ApolloServer as v}from"@apollo/server";import{expressMiddleware as d}from"@apollo/server/express4";import{ApolloServerPluginDrainHttpServer as b}from"@apollo/server/plugin/drainHttpServer";import{ApolloServerPluginLandingPageLocalDefault as g,ApolloServerPluginLandingPageProductionDefault as m}from"@apollo/server/plugin/landingPage/default";import y from"chalk";import h from"consola";import{GraphQLError as S}from"graphql";var E=".cyberskill-storage";import w from"@dotenvx/dotenvx";import{bool as O,cleanEnv as A,str as D}from"envalid";import P from"node:os";import R from"node:path";import x from"node:process";var _=!1;function j(){_||(w.config(),_=!0)}p(j,"loadEnvFile");function I(){j();var r=A(x.env,{CWD:D({default:x.cwd()}),DEBUG:O({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:D({default:R.join(P.homedir(),E)})});return{CWD:r.CWD,DEBUG:r.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:r.CYBERSKILL_STORAGE_DIRECTORY}}p(I,"getEnv");var L=I();L.DEBUG||(h.level=4);function k(r){var e=y[r];return typeof e=="function"?e:y.green}p(k,"chalkKeyword");var C={silent:h.silent,level:h.level,fatal:h.fatal,error:h.error,warn:h.warn,log:h.log,info:h.info,success:h.success,ready:h.ready,start:h.start,box:h.box,debug:h.debug,trace:h.trace,verbose:h.verbose,printBoxedLog:function r(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(e===null||e===void 0?void 0:e.length)){h.box(y.green(r));return}e.forEach(function(r){var e=r.file,n=r.position,o=r.rule,a=r.message;h.log("".concat(y.gray("File:")," ").concat(y.blue("".concat(e).concat(n?":".concat(n):"")))),o&&h.log(" ".concat(k(t)("Rule:")," ").concat(o)),h.log(" ".concat(k(t)("Message:")," ").concat(a))}),h.box(k(t)("".concat(r," : ").concat(e.length))),h.log(y.gray("─".repeat(40)))}};function G(r){return new v(l({schema:r.schema,plugins:[r.isDev?g():m(),b({httpServer:r.server})].concat(c(r.drainServer?[{serverWillStart:function e(){return /*#__PURE__*/n(function(){return f(this,function(e){return[2,{drainServer:function e(){return /*#__PURE__*/n(function(){var e;return f(this,function(t){(e=r.drainServer)===null||e===void 0?void 0:e.call(r),C.info("Apollo Server drainServer hook called");return[2]})})()}}]})})()}}]:[]))},r.isDev&&{introspection:!0,includeStacktraceInErrorResponses:!0}))}p(G,"createApolloServer");export{G as createApolloServer,d as expressMiddleware};
|