@cyberskill/shared 1.77.0 → 1.78.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.
@@ -1 +1 @@
1
- function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,n,r,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,s)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,c,"next",e)}function c(e){s(o,r,i,a,c,"throw",e)}a(undefined)})}}function o(e,t,n){t=d(t);return R(e,N()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function u(e,t,n){if(t)c(e.prototype,t);if(n)c(e,n);return e}function l(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function d(e){d=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return d(e)}function f(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)A(e,t)}function p(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function E(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function g(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,a;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw a}}return r}function h(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(){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 y(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){l(e,t,n[t])})}return e}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(t){r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}n.push.apply(n,r)}return n}function S(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{v(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function O(e,t){if(e==null)return{};var n=_(e,t);var r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){r=i[s];if(t.indexOf(r)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;n[r]=e[r]}}return n}function _(e,t){if(e==null)return{};var n={};var r=Object.keys(e);var s,i;for(i=0;i<r.length;i++){s=r[i];if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function R(e,t){if(t&&(T(t)==="object"||typeof t==="function")){return t}return r(e)}function A(e,t){A=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return A(e,t)}function I(e,n){return t(e)||g(e,n)||b(e,n)||h()}function C(e){return n(e)||E(e)||b(e)||m()}function T(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function b(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}function D(e,t){var n,r,s,i,o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),"throw":a(1),"return":a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return c([e,t])}}function c(i){if(n)throw new TypeError("Generator is already executing.");while(o)try{if(n=1,r&&(s=i[0]&2?r["return"]:i[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;if(r=0,s)i=[i[0]&2,s.value];switch(i[0]){case 0:case 1:s=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;r=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(i[0]===6&&o.label<s[1]){o.label=s[1];s=i;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(i);break}if(s[2])o.ops.pop();o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e];r=0}finally{n=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}import w from"node:process";import{hideBin as j}from"yargs/helpers";import x from"yargs/yargs";var M={name:"@cyberskill/shared",type:"module",version:"1.76.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./configs/vitest/react/e2e":{types:"./dist/configs/vitest/react/e2e.d.ts",import:"./dist/configs/vitest/react/e2e.js",require:"./dist/configs/vitest/react/e2e.cjs"},"./configs/vitest/react/unit":{types:"./dist/configs/vitest/react/unit.d.ts",import:"./dist/configs/vitest/react/unit.js",require:"./dist/configs/vitest/react/unit.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/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/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"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.7","@eslint-react/eslint-plugin":"1.43.0","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@graphql-codegen/typescript-react-apollo":"4.3.2","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.3.0","@swc/core":"1.11.18","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.8.1","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",consola:"3.4.2","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0","eslint-config-next":"15.3.0","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"24.2.3",jsdom:"26.0.0",localforage:"1.10.0","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.51.1","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.2.6",vitest:"3.1.1","vitest-browser-react":"0.1.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/crypto-js":"4.2.2","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.0","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.0","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var G=function(e){return e.CLI="CLI",e.RAW="RAW",e}(G||{});import{exec as P}from"node:child_process";import L from"node:process";import*as k from"node:util";import U from"node:process";var F=U.env.DEBUG==="true";var q=function(e){return e.Error="error",e.Warning="warning",e}(q||{});import K from"chalk";import H from"consola";import{GraphQLError as Y}from"graphql";var B={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"}};function V(e){var t=e.message,n=e.status,r=n===void 0?B.INTERNAL_SERVER_ERROR:n,s=e.type,i=s===void 0?"graphql":s;var o;var a=(o=t!==null&&t!==void 0?t:r.MESSAGE)!==null&&o!==void 0?o:"Internal server error";throw i==="graphql"?new Y(a,{extensions:{code:r.CODE}}):new Error(a)}F||(H.level=4);function Q(e){var t=K[e];return typeof t=="function"?t:K.green}var W={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 e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){H.box(K.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;H.log("".concat(K.gray("File:")," ").concat(K.blue("".concat(t).concat(r?":".concat(r):"")))),s&&H.log(" ".concat(Q(n)("Rule:")," ").concat(s)),H.log(" ".concat(Q(n)("Message:")," ").concat(i))}),H.box(Q(n)("".concat(e," : ").concat(t.length))),H.log(K.gray("─".repeat(40)))}};var J={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import $ from"node-fetch";import*as X from"node:fs";function z(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return X.existsSync(e)})}function Z(e,t){var n=X.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":T(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}function ee(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":T(t))=="object"?JSON.stringify(t,null,4):String(t);X.writeFileSync(e,i,"utf-8")}function et(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":T(t))=="object"?JSON.stringify(t,null,4):String(t);X.appendFileSync(e,i,"utf-8")}function en(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){z(e)&&X.rmSync(e,{recursive:!0,force:!0})})}import er from"node:process";import*as es from"node:path";function ei(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=es).resolve.apply(r,[ec].concat(C(t)))}function eo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=es).resolve.apply(r,C(t))}function ea(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=es).join.apply(r,C(t))}var ec=er.env.INIT_CWD||er.cwd(),eu="@cyberskill/shared",el=".cyberskill-storage",ed="node_modules",ef="dist",ep="package.json",eE="package-lock.json",eg="tsconfig.json",eh=".gitignore",em=".simple-git-hooks.json",ey="pnpm-lock.yaml",ev=".git/hooks/",eS=".git/COMMIT_EDITMSG",eO=ea(ec,ed,eu,ef),e_="cyberskill",eR="src/nodejs/cli/index.ts",eA="eslint",eI="eslint",eC="vitest",eT="playwright",eb="vitest",eN="@commitlint/cli",eD="commitlint",ew="lint-staged",ej="lint-staged",ex="typescript",eM="tsc",eG="tsx",eP="git",eL="pnpm",ek="pnpm exec",eU="simple-git-hooks",eF="simple-git-hooks",eq="@eslint/config-inspector",eK="eslint-config-inspector",eH="node-modules-inspector",eY="node-modules-inspector",eB={CYBERSKILL_DIRECTORY:eO,WORKING_DIRECTORY:ec,TS_CONFIG:ei(eg),GIT_IGNORE:ei(eh),GIT_HOOK:ei(ev),GIT_COMMIT_MSG:ei(eS),SIMPLE_GIT_HOOKS_JSON:ei(em),PACKAGE_JSON:ei(ep),PACKAGE_LOCK_JSON:ei(eE),PNPM_LOCK_YAML:ei(ey),NODE_MODULES:ei(ed),LINT_STAGED_CONFIG:ei("".concat(eO,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:ei("".concat(eO,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:ei("".concat(eO,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ei("".concat(eO,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ei("".concat(eO,"/react/vitest/vitest.e2e.js"))};function eV(e){var t=e.isCurrentProject;return y({"pre-commit":ej,"commit-msg":eD},t&&{"pre-push":tg("".concat(eP," pull"))})}function eQ(e){return eW.apply(this,arguments)}function eW(){eW=i(function(e){var t,n,r,s,i,o;var a=arguments;return D(this,function(c){switch(c.label){case 0:for(t=a.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=a[r]}s=I(n,2),i=s[0],o=s[1];switch(e){case"CLI":return[3,1];case"RAW":return[3,3]}return[3,4];case 1:return[4,e3(i.split(" "),{update:!0})];case 2:return[2,(c.sent(),tm(tg("".concat(ek," ").concat(o))))];case 3:return[2,tm(tg(i))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eW.apply(this,arguments)}function eJ(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/i(function(){return D(this,function(t){return[2,eQ.apply(void 0,[e].concat(C(n)))]})})}var e$={simpleGitHooks:eJ("CLI",eU,eF),eslintInspect:eJ("CLI",eq,eK),nodeModulesInspect:eJ("CLI",eH,eY),eslintCheck:eJ("CLI",eA,"".concat(eI," ").concat(eB.WORKING_DIRECTORY)),eslintFix:eJ("CLI",eA,"".concat(eI," ").concat(eB.WORKING_DIRECTORY," --fix")),typescriptCheck:eJ("CLI",ex,"".concat(eM," -p ").concat(eB.TS_CONFIG," --noEmit")),configureGitHook:eJ("RAW","".concat(eP," config core.hooksPath ").concat(eB.GIT_HOOK)),testUnit:eJ("CLI",eC,"".concat(eb," --config ").concat(eB.UNIT_TEST_CONFIG)),testE2e:eJ("CLI","".concat(eC," ").concat(eT),"".concat(eb," --config ").concat(eB.E2E_TEST_CONFIG)),commitLint:eJ("CLI",eN,"".concat(eD," --edit ").concat(eB.GIT_COMMIT_MSG," --config ").concat(eB.COMMITLINT_CONFIG)),lintStaged:eJ("CLI",ew,"".concat(ej," --config ").concat(eB.LINT_STAGED_CONFIG)),stageBuildDirectory:eJ("RAW","".concat(eP," add ").concat(ef)),build:eJ("RAW","".concat(eL," run build")),pnpmInstallStandard:eJ("RAW","".concat(eL," install")),pnpmInstallLegacy:eJ("RAW","".concat(eL," install --legacy-peer-deps")),pnpmInstallForce:eJ("RAW","".concat(eL," install --force"))};function eX(e){var t=ea(ec,ep);if(!z(t))return!1;try{var n=Z(t,{asJson:!0}),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,a=o===void 0?{}:o,c=r===e,u=e in i,l=e in a;return c||u||l?{path:t,file:n,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return W.warn("Failed to read package.json: ".concat(e.message)),!1}}function ez(e){return eZ.apply(this,arguments)}function eZ(){eZ=i(function(e){var t,n,r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,$("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw W.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})});return eZ.apply(this,arguments)}function e0(e,t){return e1.apply(this,arguments)}function e1(){e1=i(function(e,t){var n,r,s,i,o,a,c,u,l,d,f,p,E,g,h,m,v,S,O,_,R;return D(this,function(A){switch(A.label){case 0:A.trys.push([0,4,,5]);n=eX(e);if(!n)return[2,y({},J)];c=n.path,u=n.file,l=n.isCurrentProject,d=n.isDepend,f=n.isDevDepend,p=(r=u.dependencies)!==null&&r!==void 0?r:{},E=(s=u.devDependencies)!==null&&s!==void 0?s:{},g=l?(i=u.version)!==null&&i!==void 0?i:"0.0.0":d?(o=p[e])!==null&&o!==void 0?o:"0.0.0":f?(a=E[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!l)return[3,1];v=g;return[3,3];case 1:return[4,ez(e)];case 2:v=A.sent();A.label=3;case 3:h=v,m=l||g===h;if(!m&&(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])!==h&&(u[O]=(_=u[O])!==null&&_!==void 0?_:{},u[O][e]=h,ee(c,u,{isJson:!0}),W.info('Updated "'.concat(e,'" to version ').concat(h)))}return[2,{isCurrentProject:l,installedPath:c,file:u,isUpToDate:m}];case 4:R=A.sent();return[2,(W.error('Error checking package "'.concat(e,'": ').concat(R.message)),y({},J))];case 5:return[2]}})});return e1.apply(this,arguments)}function e2(){return e4.apply(this,arguments)}function e4(){e4=i(function(){var e,t,n,r,s,i,o,a,c,u,l,d;return D(this,function(f){switch(f.label){case 0:e=[{command:function(){return e$.pnpmInstallStandard()},message:"Installing dependencies (standard)"},{command:function(){return e$.pnpmInstallLegacy()},message:"Retrying with legacy peer dependencies"},{command:function(){return e$.pnpmInstallForce()},message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);s=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,a()];case 4:u=f.sent();return[4,tS("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();W.warn("Installation attempt failed: ".concat(c)),W.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return e4.apply(this,arguments)}function e3(e,t){return e5.apply(this,arguments)}function e5(){e5=i(function(e,t){var n,r,s,i,o,a,c,u,l,d,f;return D(this,function(p){switch(p.label){case 0:if(!z(eB.PACKAGE_JSON)){W.error("package.json not found. Aborting setup.");return[2]}p.label=1;case 1:p.trys.push([1,13,,14]);n=C(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return e0(e,{update:t===null||t===void 0?void 0:t.update})}))];case 2:r=p.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,e2()];case 3:r=p.sent();p.label=4;case 4:r;i=true,o=false,a=undefined;p.label=5;case 5:p.trys.push([5,10,11,12]);c=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();p.label=6;case 6:if(!!(i=(u=c.next()).done))return[3,9];l=u.value;return[4,l()];case 7:p.sent();p.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=p.sent();o=true;a=d;return[3,12];case 11:try{if(!i&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:f=p.sent();throw W.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})});return e5.apply(this,arguments)}import e6 from"node-persist";import e8 from"node:os";import e9 from"node:process";function e7(){return e9.env.CYBERSKILL_STORAGE_DIR||ea(e8.homedir(),el)}function te(){return tt.apply(this,arguments)}function tt(){tt=i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=e6.defaultInstance;if(e)return[3,2];return[4,e6.init({dir:e7(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return tt.apply(this,arguments)}var tn={get:function e(e){return i(function(){var t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,te()];case 1:r.sent();return[4,e6.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(W.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,te()];case 1:r.sent();return[4,e6.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();W.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return D(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,te()];case 1:n.sent();return[4,e6.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();W.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 D(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,te()];case 1:n.sent();return[4,e6.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(W.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(W.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return D(this,function(t){try{return[2,"".concat(e7()," (key: ").concat(e,")")]}catch(e){return[2,(W.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var tr=k.promisify(P);function ts(e){return"error_list:".concat(e)}function ti(e){return to.apply(this,arguments)}function to(){to=i(function(e){var t,n,r;return D(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=ts(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,tn.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return D(this,function(t){switch(t.label){case 0:return[4,tn.getLogLink(n)];case 1:e=t.sent();e&&W.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=s.sent();W.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return to.apply(this,arguments)}function ta(){return tc.apply(this,arguments)}function tc(){tc=i(function(){var e,t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tn.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=i(function(e){var t;return D(this,function(n){switch(n.label){case 0:return[4,tn.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(W.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return tc.apply(this,arguments)}function tu(){return tl.apply(this,arguments)}function tl(){tl=i(function(){var e,t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tn.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return tn.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();W.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return tl.apply(this,arguments)}function td(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var a=s.exec(e)||[],c=i.exec(e)||[],u=o.exec(e)||[];a.length&&r?t.push({file:r,position:"".concat(a[1],":").concat(a[2]),type:a[3]==="error"?"error":"warning",message:a[4].trim(),rule:a[5].trim()}):c.length?t.push({file:c[1],position:"".concat(c[2],":").concat(c[3]),type:c[4]==="error"?"error":"warning",message:c[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):n.push(e.trim())}}),t.length&&ti(t),F&&n.length&&(W.warn("Unmatched lines:"),n.forEach(function(e){return W.info(" ".concat(e))}))}function tf(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?"error":"warning",file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),n.length&&ti(n)}catch(t){td(e)}}function tp(e){return tE.apply(this,arguments)}function tE(){tE=i(function(e){var t,n,r,s,i,o,a,c,u;var l=arguments;return D(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:tf;n=new AbortController;L.on("SIGINT",function(){W.warn("Process interrupted. Terminating..."),n.abort(),L.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,tr(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&W.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return tE.apply(this,arguments)}function tg(e){return{raw:!0,cmd:e}}function th(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ek," ").concat(eu," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ek," ").concat(eG," ").concat(eR," ").concat(e):"".concat(ek," ").concat(e_," ").concat(e)}function tm(e,t){return typeof e=="function"?th(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"?th(e,t):e}function ty(e){return tv.apply(this,arguments)}function tv(){tv=i(function(e){var t,n,r,s,i,o,a;var c=arguments;return D(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];a=!1;return[3,3];case 1:return[4,e0(eu)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:s=a,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=I(e,2),n=t[0],r=t[1];return[n,tm(r,i)]}))]}})});return tv.apply(this,arguments)}function tS(e,t){return tO.apply(this,arguments)}function tO(){tO=i(function(e,t){var n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);W.start("".concat(e)),F&&W.info("→ ".concat(t));return[4,tp(t)];case 1:r.sent(),W.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw W.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return tO.apply(this,arguments)}function t_(){return tR.apply(this,arguments)}function tR(){tR=i(function(){var e,t;return D(this,function(n){switch(n.label){case 0:if(!z(eB.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,e$.typescriptCheck()];case 1:return[4,tS.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=W.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return tR.apply(this,arguments)}function tA(){return tI.apply(this,arguments)}function tI(){tI=i(function(){var e,t,n,r;var s=arguments;return D(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,e$.eslintFix()];case 1:return[4,tS.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,e$.eslintCheck()];case 4:return[4,tS.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})});return tI.apply(this,arguments)}function tC(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";W.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}function tT(){return tb.apply(this,arguments)}function tb(){tb=i(function(){var e,t,n;return D(this,function(r){switch(r.label){case 0:return[4,ta()];case 1:e=r.sent(),t=e.filter(function(e){return e.type==="error"}),n=e.filter(function(e){return e.type==="warning"});!t.length&&!n.length?W.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tC("Warnings",n),tC("Errors",t));return[2]}})});return tb.apply(this,arguments)}function tN(){return tD.apply(this,arguments)}function tD(){tD=i(function(){var e,t,n,r,s,i;return D(this,function(o){switch(o.label){case 0:return[4,tu()];case 1:o.sent();return[4,e0(eu)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(eu)];return[4,e$.build()];case 4:return[4,tS.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,e$.stageBuildDirectory()];case 6:return[4,tS.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw W.error("Error building and staging ".concat(eu,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,e$.lintStaged()];case 10:return[4,tS.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tT();return[2]}})});return tD.apply(this,arguments)}function tw(){return tj.apply(this,arguments)}function tj(){tj=i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,e$.eslintInspect()];case 1:return[4,tS.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tj.apply(this,arguments)}function tx(){return tM.apply(this,arguments)}function tM(){tM=i(function(){return D(this,function(e){switch(e.label){case 0:return[4,tu()];case 1:e.sent();return[4,Promise.all([t_(),tA()])];case 2:e.sent(),tT();return[2]}})});return tM.apply(this,arguments)}function tG(){return tP.apply(this,arguments)}function tP(){tP=i(function(){return D(this,function(e){switch(e.label){case 0:return[4,tu()];case 1:e.sent();return[4,Promise.all([t_(),tA(!0)])];case 2:e.sent(),tT();return[2]}})});return tP.apply(this,arguments)}function tL(){return tk.apply(this,arguments)}function tk(){tk=i(function(){var e;return D(this,function(t){switch(t.label){case 0:return[4,tu()];case 1:t.sent();e=["Validating commit message"];return[4,e$.commitLint()];case 2:return[4,tS.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tT();return[2]}})});return tk.apply(this,arguments)}function tU(){return tF.apply(this,arguments)}function tF(){tF=i(function(){var e,t,n,r;return D(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,e$.configureGitHook()];case 1:return[4,tS.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),en(eB.GIT_HOOK);return[4,ty(eV)];case 3:t=s.sent();ee(eB.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(em,"\n");z(eB.GIT_IGNORE)?Z(eB.GIT_IGNORE).split("\n").includes(em)||et(eB.GIT_IGNORE,n):ee(eB.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,e$.simpleGitHooks()];case 4:return[4,tS.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})});return tF.apply(this,arguments)}function tq(){return tK.apply(this,arguments)}function tK(){tK=i(function(){return D(this,function(e){switch(e.label){case 0:return[4,e3([eu],{update:!0,postInstallActions:[tU]})];case 1:e.sent();return[2]}})});return tK.apply(this,arguments)}function tH(){return tY.apply(this,arguments)}function tY(){tY=i(function(){return D(this,function(e){switch(e.label){case 0:en(eB.NODE_MODULES,eB.PNPM_LOCK_YAML);return[4,e2()];case 1:e.sent();return[4,tU()];case 2:e.sent();return[2]}})});return tY.apply(this,arguments)}function tB(){return tV.apply(this,arguments)}function tV(){tV=i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,e$.nodeModulesInspect()];case 1:return[4,tS.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tV.apply(this,arguments)}function tQ(){return tW.apply(this,arguments)}function tW(){tW=i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,e$.testUnit()];case 1:return[4,tS.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tW.apply(this,arguments)}function tJ(){return t$.apply(this,arguments)}function t$(){t$=i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,e$.testE2e()];case 1:return[4,tS.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return t$.apply(this,arguments)}i(function(){var e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,x(j(w.argv)).scriptName(e_).usage("$0 <command> [options]").command("lint","Check code for linting issues",tx).command("lint:fix","Fix linting issues automatically",tG).command("lint:inspect","View active ESLint configuration",tw).command("lint-staged","Run lint checks on staged files",tN).command("commitlint","Validate commit message format",tL).command("setup","Initialize project setup and dependencies",tq).command("reset","Reset the project and reinstall dependencies",tH).command("inspect","Analyze installed project dependencies",tB).command("test:unit","Run unit test suite",tQ).command("test:e2e","Run end-to-end test suite",tJ).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(M.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();W.error("Fatal: ".concat(e.message)),w.exit(1);return[3,3];case 3:return[2]}})})();import{format as tX}from"date-fns";import{Document as tz}from"mongoose";import tZ from"mongoose-aggregate-paginate-v2";import t0 from"mongoose-paginate-v2";import{v4 as t1}from"uuid";import t2 from"crypto-js";import t4 from"slugify";var t3=t4.default||t4;function t5(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;var n=t||{},r=n.lower,s=r===void 0?!0:r,i=n.locale,o=i===void 0?"vi":i,a=O(n,["lower","locale"]);return t3(e,y({lower:s,locale:o},a))}function t6(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return t2.SHA256(e).toString(t2.enc.Hex).slice(0,t)}var t8={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":T(e))=="object"?p(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var t9={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return tX(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.returnDateAs,n=t===void 0?"string":t;var r=n==="string"?t9.getDateTime():new Date;return{id:t1(),isDel:!1,createdAt:r,updatedAt:r}},applyPlugins:function e(e,t){t.filter(function(e){return typeof e=="function"}).forEach(function(t){return e.plugin(t)})},applyMiddlewares:function e(e,t){t.forEach(function(t){var n=t.method,r=t.pre,s=t.post;n&&r&&e.pre(n,r),n&&s&&e.post(n,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:t1,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,n=e.schema,r=e.virtuals,s=r===void 0?[]:r,i=e.standalone,o=i===void 0?!1:i;var a=new t.Schema(n,{strict:!0});return s.forEach(function(e){var t=e.name,n=e.options,r=e.get;var s=a.virtual(t,n);r&&s.get(r)}),o||a.add(t9.createGenericSchema(t)),a},createModel:function e(e){var t=e.mongoose,n=e.name,r=e.schema,s=e.pagination,i=s===void 0?!1:s,o=e.aggregate,a=o===void 0?!1:o,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,d=l===void 0?[]:l;if(!n)throw new Error("Model name is required.");if(t.models[n])return t.models[n];var f=t9.createSchema({mongoose:t,schema:r,virtuals:u});return t9.applyPlugins(f,[i&&t0,a&&tZ]),t9.applyMiddlewares(f,d),t.model(n,f)},createSlugQuery:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return S(y({},t,n&&{id:{$ne:n}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=i(function(e){return D(this,function(t){return[2,!t8.isEmpty(e)]})});return function(t){return e.apply(this,arguments)}}()},isUnique:function e(e){return /*#__PURE__*/function(){var t=i(function(t){var n;return D(this,function(r){switch(r.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");n={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.findOne(n)];case 1:return[2,!r.sent()]}})});return function(e){return t.apply(this,arguments)}}()},matchesRegex:function e(e){return /*#__PURE__*/function(){var t=i(function(t){return D(this,function(n){if(!Array.isArray(e)||e.some(function(e){return!p(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(t)})]})});return function(e){return t.apply(this,arguments)}}()}}},t7=/*#__PURE__*/function(){"use strict";function e(t,n){a(this,e);this.collection=t.collection(n)}u(e,[{key:"createOne",value:function e(e){var t=this;return i(function(){var n,r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n=y({},t9.createGenericFields(),e);r={success:!0,message:"Document created successfully"};return[4,t.collection.insertOne(n)];case 1:return[2,(r.result=i.sent(),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=this;return i(function(){var n,r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n=e.map(function(e){return y({},t9.createGenericFields(),e)});return[4,t.collection.insertMany(n)];case 1:r=i.sent();return[2,r.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(r.insertedCount," documents created successfully"),result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"findOne",value:function e(e){var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.findOne(e)];case 1:n=s.sent();return[2,n?{success:!0,message:"Document found",result:n}:{success:!1,message:"Document not found"}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0,message:"Documents retrieved successfully"};return[4,t.collection.find(e).toArray()];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0,message:"Count retrieved successfully"};return[4,t.collection.countDocuments(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(e,t){var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.collection.updateOne(e,{$set:t})];case 1:r=i.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(e,t){var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.collection.updateMany(e,{$set:t})];case 1:r=i.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(e){var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.deleteOne(e)];case 1:n=s.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(e){var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.deleteMany(e)];case 1:n=s.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}}]);return e}(),ne=/*#__PURE__*/function(){"use strict";function e(t){a(this,e);this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;var s=this;return i(function(){var i,o,a;return D(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);i=s.model.findOne(e,t,n);r&&i.populate(r);return[4,i.exec()];case 1:o=c.sent();return[2,o?{success:!0,result:o}:{success:!1,message:"No ".concat(s.getModelName()," found."),code:B.NOT_FOUND.CODE}];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;var s=this;return i(function(){var i,o,a;return D(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);i=s.model.find(e,t,n);r&&i.populate(r);o={success:!0};return[4,i.exec()];case 1:return[2,(o.result=c.sent(),o)];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPaging",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r={success:!0};return[4,n.model.paginate(e,t)];case 1:return[2,(r.result=i.sent(),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPagingAggregate",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r={success:!0};return[4,n.model.aggregatePaginate(n.model.aggregate(e),t)];case 1:return[2,(r.result=i.sent(),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0};return[4,t.model.countDocuments(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createOne",value:function e(e){var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0};return[4,t.model.create(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r={success:!0};return[4,n.model.insertMany(e,t)];case 1:return[2,(r.result=i.sent().map(function(e){return p(e,tz)?e.toObject():null}).filter(function(e){return e!==null}),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=this;return i(function(){var s,i;return D(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,r.model.findOneAndUpdate(e,t,y({new:!0},n)).exec()];case 1:s=o.sent();return[2,s?{success:!0,result:s}:{success:!1,message:"Failed to update ".concat(r.getModelName(),"."),code:B.NOT_FOUND.CODE}];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=this;return i(function(){var s,i;return D(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);s={success:!0};return[4,r.model.updateMany(e,t,n).exec()];case 1:return[2,(s.result=o.sent(),s)];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.model.findOneAndDelete(e,t).exec()];case 1:r=i.sent();return[2,r?{success:!0,result:r}:{success:!1,message:"No ".concat(n.getModelName()," found to delete."),code:B.NOT_FOUND.CODE}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.model.deleteMany(e,t).exec()];case 1:r=i.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents found to delete.",code:B.NOT_FOUND.CODE}:{success:!0,result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;var n=this;return i(function(){var r,s,i,o;return D(this,function(a){switch(a.label){case 0:r=new Set;s=0;a.label=1;case 1:if(!(s<10))return[3,5];i=t6(e,s+t);o=!r.has(i);if(!o)return[3,3];r.add(i);return[4,n.model.exists({shortId:i})];case 2:o=!a.sent();a.label=3;case 3:if(o)return[2,{success:!0,result:i}];a.label=4;case 4:s++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:B.INTERNAL_SERVER_ERROR.CODE}]}})})()}},{key:"createSlug",value:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=this;return i(function(){var s,o,a,c,u,l,d,f,p,E,g;return D(this,function(h){switch(h.label){case 0:h.trys.push([0,8,,9]);s=t[e],o=/*#__PURE__*/function(){var e=i(function(e){var s,i,o;return D(this,function(a){switch(a.label){case 0:return[4,r.model.findOne(t9.createSlugQuery(e,n,t.id))];case 1:s=a.sent();if(!s)return[2,e];i=1;a.label=2;case 2:o="".concat(e,"-").concat(i);return[4,r.model.findOne(t9.createSlugQuery(o,n,t.id))];case 3:s=a.sent(),i++;a.label=4;case 4:if(s)return[3,2];a.label=5;case 5:return[2,o]}})});return function t(t){return e.apply(this,arguments)}}();if(!((typeof s==="undefined"?"undefined":T(s))=="object"))return[3,5];a={};c=[];for(u in s)c.push(u);l=0;h.label=1;case 1:if(!(l<c.length))return[3,4];d=c[l];f=t5(s[d]);return[4,o(f)];case 2:a[d]=h.sent();h.label=3;case 3:l++;return[3,1];case 4:return[2,{success:!0,result:a}];case 5:p=t5(s);E={success:!0};return[4,o(p)];case 6:return[2,(E.result=h.sent(),E)];case 7:return[3,9];case 8:g=h.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(g.message),code:B.INTERNAL_SERVER_ERROR.CODE}];case 9:return[2]}})})()}},{key:"aggregate",value:function e(e){var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0};return[4,t.model.aggregate(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}}]);return e}();import{Collection as nt,Db as nn}from"mongodb";import{Document as nr,Model as ns}from"mongoose";var ni=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nn),no=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nr),na=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(ns),nc=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nt);export{ef as BUILD_DIRECTORY,J as CHECK_PACKAGE_EMPTY_RESULT,eD as COMMIT_LINT_CLI,eN as COMMIT_LINT_PACKAGE_NAME,e_ as CYBERSKILL_CLI,eR as CYBERSKILL_CLI_PATH,eO as CYBERSKILL_DIRECTORY,eu as CYBERSKILL_PACKAGE_NAME,el as CYBERSKILL_STORAGE,nc as C_Collection,ni as C_Db,no as C_Document,na as C_Model,eI as ESLINT_CLI,eK as ESLINT_INSPECT_CLI,eq as ESLINT_INSPECT_PACKAGE_NAME,eA as ESLINT_PACKAGE_NAME,G as E_CommandType,q as E_IssueType,eP as GIT_CLI,eS as GIT_COMMIT_EDITMSG,ev as GIT_HOOK,eh as GIT_IGNORE,eV as HOOK,ej as LINT_STAGED_CLI,ew as LINT_STAGED_PACKAGE_NAME,t7 as MongoController,ne as MongooseController,ed as NODE_MODULES,eY as NODE_MODULES_INSPECT_CLI,eH as NODE_MODULES_INSPECT_PACKAGE_NAME,ep as PACKAGE_JSON,eE as PACKAGE_LOCK_JSON,eB as PATH,eT as PLAYWRIGHT_PACKAGE_NAME,eL as PNPM_CLI,ek as PNPM_EXEC_CLI,ey as PNPM_LOCK_YAML,eU as SIMPLE_GIT_HOOKS_PACKAGE_NAME,eF as SIMPLE_GIT_HOOK_CLI,em as SIMPLE_GIT_HOOK_JSON,eg as TSCONFIG_JSON,eM as TSC_CLI,ex as TSC_PACKAGE_NAME,eG as TSX_CLI,eb as VITEST_CLI,eC as VITEST_PACKAGE_NAME,ec as WORKING_DIRECTORY,tZ as aggregatePaginate,et as appendFileSync,e0 as checkPackage,tu as clearAllErrorLists,e$ as command,z as existsSync,tm as formatCommand,ez as getLatestPackageVersion,eX as getPackage,ta as getStoredErrorLists,e2 as installDependencies,ea as join,W as logNodeJS,t9 as mongo,t0 as mongoosePaginate,tg as rawCommand,Z as readFileSync,eo as resolve,ty as resolveCommands,ei as resolveWorkingPath,en as rmSync,tS as runCommand,e3 as setupPackages,tn as storageNodeJS,V as throwError,ee as writeFileSync};
1
+ function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,n,r,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,s)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,c,"next",e)}function c(e){s(o,r,i,a,c,"throw",e)}a(undefined)})}}function o(e,t,n){t=d(t);return R(e,N()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function u(e,t,n){if(t)c(e.prototype,t);if(n)c(e,n);return e}function l(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function d(e){d=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return d(e)}function f(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)A(e,t)}function p(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function E(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function g(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,a;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw a}}return r}function h(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(){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 y(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){l(e,t,n[t])})}return e}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(t){r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}n.push.apply(n,r)}return n}function S(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{v(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function O(e,t){if(e==null)return{};var n=_(e,t);var r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){r=i[s];if(t.indexOf(r)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;n[r]=e[r]}}return n}function _(e,t){if(e==null)return{};var n={};var r=Object.keys(e);var s,i;for(i=0;i<r.length;i++){s=r[i];if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function R(e,t){if(t&&(T(t)==="object"||typeof t==="function")){return t}return r(e)}function A(e,t){A=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return A(e,t)}function I(e,n){return t(e)||g(e,n)||b(e,n)||h()}function C(e){return n(e)||E(e)||b(e)||m()}function T(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function b(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}function D(e,t){var n,r,s,i,o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),"throw":a(1),"return":a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return c([e,t])}}function c(i){if(n)throw new TypeError("Generator is already executing.");while(o)try{if(n=1,r&&(s=i[0]&2?r["return"]:i[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;if(r=0,s)i=[i[0]&2,s.value];switch(i[0]){case 0:case 1:s=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;r=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(i[0]===6&&o.label<s[1]){o.label=s[1];s=i;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(i);break}if(s[2])o.ops.pop();o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e];r=0}finally{n=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}import w from"node:process";import{hideBin as j}from"yargs/helpers";import x from"yargs/yargs";var M={name:"@cyberskill/shared",type:"module",version:"1.77.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./configs/vitest/react/e2e":{types:"./dist/configs/vitest/react/e2e.d.ts",import:"./dist/configs/vitest/react/e2e.js",require:"./dist/configs/vitest/react/e2e.cjs"},"./configs/vitest/react/unit":{types:"./dist/configs/vitest/react/unit.d.ts",import:"./dist/configs/vitest/react/unit.js",require:"./dist/configs/vitest/react/unit.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/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/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"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.7","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.45.0","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.3.0","@swc/core":"1.11.20","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.8.1","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",consola:"3.4.2","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0","eslint-config-next":"15.3.0","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"24.2.3",jsdom:"26.0.0",localforage:"1.10.0","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.51.1","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.2.6",vitest:"3.1.1","vitest-browser-react":"0.1.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/crypto-js":"4.2.2","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.0","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.0","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var G=function(e){return e.CLI="CLI",e.RAW="RAW",e}(G||{});import{exec as P}from"node:child_process";import L from"node:process";import*as k from"node:util";import U from"node:process";var F=U.env.DEBUG==="true";var q=function(e){return e.Error="error",e.Warning="warning",e}(q||{});import K from"chalk";import H from"consola";import{GraphQLError as Y}from"graphql";var B={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"}};function V(e){var t=e.message,n=e.status,r=n===void 0?B.INTERNAL_SERVER_ERROR:n,s=e.type,i=s===void 0?"graphql":s;var o;var a=(o=t!==null&&t!==void 0?t:r.MESSAGE)!==null&&o!==void 0?o:"Internal server error";throw i==="graphql"?new Y(a,{extensions:{code:r.CODE}}):new Error(a)}F||(H.level=4);function Q(e){var t=K[e];return typeof t=="function"?t:K.green}var W={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 e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){H.box(K.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;H.log("".concat(K.gray("File:")," ").concat(K.blue("".concat(t).concat(r?":".concat(r):"")))),s&&H.log(" ".concat(Q(n)("Rule:")," ").concat(s)),H.log(" ".concat(Q(n)("Message:")," ").concat(i))}),H.box(Q(n)("".concat(e," : ").concat(t.length))),H.log(K.gray("─".repeat(40)))}};var J={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import $ from"node-fetch";import*as X from"node:fs";function z(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return X.existsSync(e)})}function Z(e,t){var n=X.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":T(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}function ee(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":T(t))=="object"?JSON.stringify(t,null,4):String(t);X.writeFileSync(e,i,"utf-8")}function et(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":T(t))=="object"?JSON.stringify(t,null,4):String(t);X.appendFileSync(e,i,"utf-8")}function en(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){z(e)&&X.rmSync(e,{recursive:!0,force:!0})})}import er from"node:process";import*as es from"node:path";function ei(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=es).resolve.apply(r,[ec].concat(C(t)))}function eo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=es).resolve.apply(r,C(t))}function ea(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=es).join.apply(r,C(t))}var ec=er.env.INIT_CWD||er.cwd(),eu="@cyberskill/shared",el=".cyberskill-storage",ed="node_modules",ef="dist",ep="package.json",eE="package-lock.json",eg="tsconfig.json",eh=".gitignore",em=".simple-git-hooks.json",ey="pnpm-lock.yaml",ev=".git/hooks/",eS=".git/COMMIT_EDITMSG",eO=ea(ec,ed,eu,ef),e_="cyberskill",eR="src/nodejs/cli/index.ts",eA="eslint",eI="eslint",eC="vitest",eT="playwright",eb="vitest",eN="@commitlint/cli",eD="commitlint",ew="lint-staged",ej="lint-staged",ex="typescript",eM="tsc",eG="tsx",eP="git",eL="pnpm",ek="pnpm exec",eU="simple-git-hooks",eF="simple-git-hooks",eq="@eslint/config-inspector",eK="eslint-config-inspector",eH="node-modules-inspector",eY="node-modules-inspector",eB={CYBERSKILL_DIRECTORY:eO,WORKING_DIRECTORY:ec,TS_CONFIG:ei(eg),GIT_IGNORE:ei(eh),GIT_HOOK:ei(ev),GIT_COMMIT_MSG:ei(eS),SIMPLE_GIT_HOOKS_JSON:ei(em),PACKAGE_JSON:ei(ep),PACKAGE_LOCK_JSON:ei(eE),PNPM_LOCK_YAML:ei(ey),NODE_MODULES:ei(ed),LINT_STAGED_CONFIG:ei("".concat(eO,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:ei("".concat(eO,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:ei("".concat(eO,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ei("".concat(eO,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ei("".concat(eO,"/react/vitest/vitest.e2e.js"))};function eV(e){var t=e.isCurrentProject;return y({"pre-commit":ej,"commit-msg":eD},t&&{"pre-push":tg("".concat(eP," pull"))})}function eQ(e){return eW.apply(this,arguments)}function eW(){eW=i(function(e){var t,n,r,s,i,o;var a=arguments;return D(this,function(c){switch(c.label){case 0:for(t=a.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=a[r]}s=I(n,2),i=s[0],o=s[1];switch(e){case"CLI":return[3,1];case"RAW":return[3,3]}return[3,4];case 1:return[4,e3(i.split(" "),{update:!0})];case 2:return[2,(c.sent(),tm(tg("".concat(ek," ").concat(o))))];case 3:return[2,tm(tg(i))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eW.apply(this,arguments)}function eJ(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/i(function(){return D(this,function(t){return[2,eQ.apply(void 0,[e].concat(C(n)))]})})}var e$={simpleGitHooks:eJ("CLI",eU,eF),eslintInspect:eJ("CLI",eq,eK),nodeModulesInspect:eJ("CLI",eH,eY),eslintCheck:eJ("CLI",eA,"".concat(eI," ").concat(eB.WORKING_DIRECTORY)),eslintFix:eJ("CLI",eA,"".concat(eI," ").concat(eB.WORKING_DIRECTORY," --fix")),typescriptCheck:eJ("CLI",ex,"".concat(eM," -p ").concat(eB.TS_CONFIG," --noEmit")),configureGitHook:eJ("RAW","".concat(eP," config core.hooksPath ").concat(eB.GIT_HOOK)),testUnit:eJ("CLI",eC,"".concat(eb," --config ").concat(eB.UNIT_TEST_CONFIG)),testE2e:eJ("CLI","".concat(eC," ").concat(eT),"".concat(eb," --config ").concat(eB.E2E_TEST_CONFIG)),commitLint:eJ("CLI",eN,"".concat(eD," --edit ").concat(eB.GIT_COMMIT_MSG," --config ").concat(eB.COMMITLINT_CONFIG)),lintStaged:eJ("CLI",ew,"".concat(ej," --config ").concat(eB.LINT_STAGED_CONFIG)),stageBuildDirectory:eJ("RAW","".concat(eP," add ").concat(ef)),build:eJ("RAW","".concat(eL," run build")),pnpmInstallStandard:eJ("RAW","".concat(eL," install")),pnpmInstallLegacy:eJ("RAW","".concat(eL," install --legacy-peer-deps")),pnpmInstallForce:eJ("RAW","".concat(eL," install --force"))};function eX(e){var t=ea(ec,ep);if(!z(t))return!1;try{var n=Z(t,{asJson:!0}),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,a=o===void 0?{}:o,c=r===e,u=e in i,l=e in a;return c||u||l?{path:t,file:n,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return W.warn("Failed to read package.json: ".concat(e.message)),!1}}function ez(e){return eZ.apply(this,arguments)}function eZ(){eZ=i(function(e){var t,n,r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,$("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw W.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})});return eZ.apply(this,arguments)}function e0(e,t){return e1.apply(this,arguments)}function e1(){e1=i(function(e,t){var n,r,s,i,o,a,c,u,l,d,f,p,E,g,h,m,v,S,O,_,R;return D(this,function(A){switch(A.label){case 0:A.trys.push([0,4,,5]);n=eX(e);if(!n)return[2,y({},J)];c=n.path,u=n.file,l=n.isCurrentProject,d=n.isDepend,f=n.isDevDepend,p=(r=u.dependencies)!==null&&r!==void 0?r:{},E=(s=u.devDependencies)!==null&&s!==void 0?s:{},g=l?(i=u.version)!==null&&i!==void 0?i:"0.0.0":d?(o=p[e])!==null&&o!==void 0?o:"0.0.0":f?(a=E[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!l)return[3,1];v=g;return[3,3];case 1:return[4,ez(e)];case 2:v=A.sent();A.label=3;case 3:h=v,m=l||g===h;if(!m&&(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])!==h&&(u[O]=(_=u[O])!==null&&_!==void 0?_:{},u[O][e]=h,ee(c,u,{isJson:!0}),W.info('Updated "'.concat(e,'" to version ').concat(h)))}return[2,{isCurrentProject:l,installedPath:c,file:u,isUpToDate:m}];case 4:R=A.sent();return[2,(W.error('Error checking package "'.concat(e,'": ').concat(R.message)),y({},J))];case 5:return[2]}})});return e1.apply(this,arguments)}function e2(){return e4.apply(this,arguments)}function e4(){e4=i(function(){var e,t,n,r,s,i,o,a,c,u,l,d;return D(this,function(f){switch(f.label){case 0:e=[{command:function(){return e$.pnpmInstallStandard()},message:"Installing dependencies (standard)"},{command:function(){return e$.pnpmInstallLegacy()},message:"Retrying with legacy peer dependencies"},{command:function(){return e$.pnpmInstallForce()},message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);s=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,a()];case 4:u=f.sent();return[4,tS("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();W.warn("Installation attempt failed: ".concat(c)),W.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return e4.apply(this,arguments)}function e3(e,t){return e5.apply(this,arguments)}function e5(){e5=i(function(e,t){var n,r,s,i,o,a,c,u,l,d,f;return D(this,function(p){switch(p.label){case 0:if(!z(eB.PACKAGE_JSON)){W.error("package.json not found. Aborting setup.");return[2]}p.label=1;case 1:p.trys.push([1,13,,14]);n=C(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return e0(e,{update:t===null||t===void 0?void 0:t.update})}))];case 2:r=p.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,e2()];case 3:r=p.sent();p.label=4;case 4:r;i=true,o=false,a=undefined;p.label=5;case 5:p.trys.push([5,10,11,12]);c=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();p.label=6;case 6:if(!!(i=(u=c.next()).done))return[3,9];l=u.value;return[4,l()];case 7:p.sent();p.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=p.sent();o=true;a=d;return[3,12];case 11:try{if(!i&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:f=p.sent();throw W.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})});return e5.apply(this,arguments)}import e6 from"node-persist";import e8 from"node:os";import e9 from"node:process";function e7(){return e9.env.CYBERSKILL_STORAGE_DIR||ea(e8.homedir(),el)}function te(){return tt.apply(this,arguments)}function tt(){tt=i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=e6.defaultInstance;if(e)return[3,2];return[4,e6.init({dir:e7(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return tt.apply(this,arguments)}var tn={get:function e(e){return i(function(){var t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,te()];case 1:r.sent();return[4,e6.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(W.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,te()];case 1:r.sent();return[4,e6.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();W.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return D(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,te()];case 1:n.sent();return[4,e6.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();W.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 D(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,te()];case 1:n.sent();return[4,e6.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(W.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(W.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return D(this,function(t){try{return[2,"".concat(e7()," (key: ").concat(e,")")]}catch(e){return[2,(W.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var tr=k.promisify(P);function ts(e){return"error_list:".concat(e)}function ti(e){return to.apply(this,arguments)}function to(){to=i(function(e){var t,n,r;return D(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=ts(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,tn.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return D(this,function(t){switch(t.label){case 0:return[4,tn.getLogLink(n)];case 1:e=t.sent();e&&W.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=s.sent();W.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return to.apply(this,arguments)}function ta(){return tc.apply(this,arguments)}function tc(){tc=i(function(){var e,t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tn.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=i(function(e){var t;return D(this,function(n){switch(n.label){case 0:return[4,tn.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(W.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return tc.apply(this,arguments)}function tu(){return tl.apply(this,arguments)}function tl(){tl=i(function(){var e,t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tn.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return tn.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();W.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return tl.apply(this,arguments)}function td(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var a=s.exec(e)||[],c=i.exec(e)||[],u=o.exec(e)||[];a.length&&r?t.push({file:r,position:"".concat(a[1],":").concat(a[2]),type:a[3]==="error"?"error":"warning",message:a[4].trim(),rule:a[5].trim()}):c.length?t.push({file:c[1],position:"".concat(c[2],":").concat(c[3]),type:c[4]==="error"?"error":"warning",message:c[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):n.push(e.trim())}}),t.length&&ti(t),F&&n.length&&(W.warn("Unmatched lines:"),n.forEach(function(e){return W.info(" ".concat(e))}))}function tf(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?"error":"warning",file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),n.length&&ti(n)}catch(t){td(e)}}function tp(e){return tE.apply(this,arguments)}function tE(){tE=i(function(e){var t,n,r,s,i,o,a,c,u;var l=arguments;return D(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:tf;n=new AbortController;L.on("SIGINT",function(){W.warn("Process interrupted. Terminating..."),n.abort(),L.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,tr(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&W.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return tE.apply(this,arguments)}function tg(e){return{raw:!0,cmd:e}}function th(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ek," ").concat(eu," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ek," ").concat(eG," ").concat(eR," ").concat(e):"".concat(ek," ").concat(e_," ").concat(e)}function tm(e,t){return typeof e=="function"?th(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"?th(e,t):e}function ty(e){return tv.apply(this,arguments)}function tv(){tv=i(function(e){var t,n,r,s,i,o,a;var c=arguments;return D(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];a=!1;return[3,3];case 1:return[4,e0(eu)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:s=a,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=I(e,2),n=t[0],r=t[1];return[n,tm(r,i)]}))]}})});return tv.apply(this,arguments)}function tS(e,t){return tO.apply(this,arguments)}function tO(){tO=i(function(e,t){var n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);W.start("".concat(e)),F&&W.info("→ ".concat(t));return[4,tp(t)];case 1:r.sent(),W.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw W.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return tO.apply(this,arguments)}function t_(){return tR.apply(this,arguments)}function tR(){tR=i(function(){var e,t;return D(this,function(n){switch(n.label){case 0:if(!z(eB.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,e$.typescriptCheck()];case 1:return[4,tS.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=W.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return tR.apply(this,arguments)}function tA(){return tI.apply(this,arguments)}function tI(){tI=i(function(){var e,t,n,r;var s=arguments;return D(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,e$.eslintFix()];case 1:return[4,tS.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,e$.eslintCheck()];case 4:return[4,tS.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})});return tI.apply(this,arguments)}function tC(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";W.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}function tT(){return tb.apply(this,arguments)}function tb(){tb=i(function(){var e,t,n;return D(this,function(r){switch(r.label){case 0:return[4,ta()];case 1:e=r.sent(),t=e.filter(function(e){return e.type==="error"}),n=e.filter(function(e){return e.type==="warning"});!t.length&&!n.length?W.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tC("Warnings",n),tC("Errors",t));return[2]}})});return tb.apply(this,arguments)}function tN(){return tD.apply(this,arguments)}function tD(){tD=i(function(){var e,t,n,r,s,i;return D(this,function(o){switch(o.label){case 0:return[4,tu()];case 1:o.sent();return[4,e0(eu)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(eu)];return[4,e$.build()];case 4:return[4,tS.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,e$.stageBuildDirectory()];case 6:return[4,tS.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw W.error("Error building and staging ".concat(eu,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,e$.lintStaged()];case 10:return[4,tS.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tT();return[2]}})});return tD.apply(this,arguments)}function tw(){return tj.apply(this,arguments)}function tj(){tj=i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,e$.eslintInspect()];case 1:return[4,tS.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tj.apply(this,arguments)}function tx(){return tM.apply(this,arguments)}function tM(){tM=i(function(){return D(this,function(e){switch(e.label){case 0:return[4,tu()];case 1:e.sent();return[4,Promise.all([t_(),tA()])];case 2:e.sent(),tT();return[2]}})});return tM.apply(this,arguments)}function tG(){return tP.apply(this,arguments)}function tP(){tP=i(function(){return D(this,function(e){switch(e.label){case 0:return[4,tu()];case 1:e.sent();return[4,Promise.all([t_(),tA(!0)])];case 2:e.sent(),tT();return[2]}})});return tP.apply(this,arguments)}function tL(){return tk.apply(this,arguments)}function tk(){tk=i(function(){var e;return D(this,function(t){switch(t.label){case 0:return[4,tu()];case 1:t.sent();e=["Validating commit message"];return[4,e$.commitLint()];case 2:return[4,tS.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tT();return[2]}})});return tk.apply(this,arguments)}function tU(){return tF.apply(this,arguments)}function tF(){tF=i(function(){var e,t,n,r;return D(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,e$.configureGitHook()];case 1:return[4,tS.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),en(eB.GIT_HOOK);return[4,ty(eV)];case 3:t=s.sent();ee(eB.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(em,"\n");z(eB.GIT_IGNORE)?Z(eB.GIT_IGNORE).split("\n").includes(em)||et(eB.GIT_IGNORE,n):ee(eB.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,e$.simpleGitHooks()];case 4:return[4,tS.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})});return tF.apply(this,arguments)}function tq(){return tK.apply(this,arguments)}function tK(){tK=i(function(){return D(this,function(e){switch(e.label){case 0:return[4,e3([eu],{update:!0,postInstallActions:[tU]})];case 1:e.sent();return[2]}})});return tK.apply(this,arguments)}function tH(){return tY.apply(this,arguments)}function tY(){tY=i(function(){return D(this,function(e){switch(e.label){case 0:en(eB.NODE_MODULES,eB.PNPM_LOCK_YAML);return[4,e2()];case 1:e.sent();return[4,tU()];case 2:e.sent();return[2]}})});return tY.apply(this,arguments)}function tB(){return tV.apply(this,arguments)}function tV(){tV=i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,e$.nodeModulesInspect()];case 1:return[4,tS.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tV.apply(this,arguments)}function tQ(){return tW.apply(this,arguments)}function tW(){tW=i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,e$.testUnit()];case 1:return[4,tS.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tW.apply(this,arguments)}function tJ(){return t$.apply(this,arguments)}function t$(){t$=i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,e$.testE2e()];case 1:return[4,tS.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return t$.apply(this,arguments)}i(function(){var e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,x(j(w.argv)).scriptName(e_).usage("$0 <command> [options]").command("lint","Check code for linting issues",tx).command("lint:fix","Fix linting issues automatically",tG).command("lint:inspect","View active ESLint configuration",tw).command("lint-staged","Run lint checks on staged files",tN).command("commitlint","Validate commit message format",tL).command("setup","Initialize project setup and dependencies",tq).command("reset","Reset the project and reinstall dependencies",tH).command("inspect","Analyze installed project dependencies",tB).command("test:unit","Run unit test suite",tQ).command("test:e2e","Run end-to-end test suite",tJ).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(M.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();W.error("Fatal: ".concat(e.message)),w.exit(1);return[3,3];case 3:return[2]}})})();import{format as tX}from"date-fns";import{Document as tz}from"mongoose";import tZ from"mongoose-aggregate-paginate-v2";import t0 from"mongoose-paginate-v2";import{v4 as t1}from"uuid";import t2 from"crypto-js";import t4 from"slugify";var t3=t4.default||t4;function t5(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;var n=t||{},r=n.lower,s=r===void 0?!0:r,i=n.locale,o=i===void 0?"vi":i,a=O(n,["lower","locale"]);return t3(e,y({lower:s,locale:o},a))}function t6(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return t2.SHA256(e).toString(t2.enc.Hex).slice(0,t)}var t8={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":T(e))=="object"?p(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var t9={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return tX(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.returnDateAs,n=t===void 0?"string":t;var r=n==="string"?t9.getDateTime():new Date;return{id:t1(),isDel:!1,createdAt:r,updatedAt:r}},applyPlugins:function e(e,t){t.filter(function(e){return typeof e=="function"}).forEach(function(t){return e.plugin(t)})},applyMiddlewares:function e(e,t){t.forEach(function(t){var n=t.method,r=t.pre,s=t.post;n&&r&&e.pre(n,r),n&&s&&e.post(n,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:t1,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,n=e.schema,r=e.virtuals,s=r===void 0?[]:r,i=e.standalone,o=i===void 0?!1:i;var a=new t.Schema(n,{strict:!0});return s.forEach(function(e){var t=e.name,n=e.options,r=e.get;var s=a.virtual(t,n);r&&s.get(r)}),o||a.add(t9.createGenericSchema(t)),a},createModel:function e(e){var t=e.mongoose,n=e.name,r=e.schema,s=e.pagination,i=s===void 0?!1:s,o=e.aggregate,a=o===void 0?!1:o,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,d=l===void 0?[]:l;if(!n)throw new Error("Model name is required.");if(t.models[n])return t.models[n];var f=t9.createSchema({mongoose:t,schema:r,virtuals:u});return t9.applyPlugins(f,[i&&t0,a&&tZ]),t9.applyMiddlewares(f,d),t.model(n,f)},createSlugQuery:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return S(y({},t,n&&{id:{$ne:n}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=i(function(e){return D(this,function(t){return[2,!t8.isEmpty(e)]})});return function(t){return e.apply(this,arguments)}}()},isUnique:function e(e){return /*#__PURE__*/function(){var t=i(function(t){var n;return D(this,function(r){switch(r.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");n={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.findOne(n)];case 1:return[2,!r.sent()]}})});return function(e){return t.apply(this,arguments)}}()},matchesRegex:function e(e){return /*#__PURE__*/function(){var t=i(function(t){return D(this,function(n){if(!Array.isArray(e)||e.some(function(e){return!p(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(t)})]})});return function(e){return t.apply(this,arguments)}}()}}},t7=/*#__PURE__*/function(){"use strict";function e(t,n){a(this,e);this.collection=t.collection(n)}u(e,[{key:"createOne",value:function e(e){var t=this;return i(function(){var n,r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n=y({},t9.createGenericFields(),e);r={success:!0,message:"Document created successfully"};return[4,t.collection.insertOne(n)];case 1:return[2,(r.result=i.sent(),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=this;return i(function(){var n,r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n=e.map(function(e){return y({},t9.createGenericFields(),e)});return[4,t.collection.insertMany(n)];case 1:r=i.sent();return[2,r.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(r.insertedCount," documents created successfully"),result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"findOne",value:function e(e){var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.findOne(e)];case 1:n=s.sent();return[2,n?{success:!0,message:"Document found",result:n}:{success:!1,message:"Document not found"}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0,message:"Documents retrieved successfully"};return[4,t.collection.find(e).toArray()];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0,message:"Count retrieved successfully"};return[4,t.collection.countDocuments(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(e,t){var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.collection.updateOne(e,{$set:t})];case 1:r=i.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(e,t){var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.collection.updateMany(e,{$set:t})];case 1:r=i.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(e){var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.deleteOne(e)];case 1:n=s.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(e){var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.deleteMany(e)];case 1:n=s.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}}]);return e}(),ne=/*#__PURE__*/function(){"use strict";function e(t){a(this,e);this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;var s=this;return i(function(){var i,o,a;return D(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);i=s.model.findOne(e,t,n);r&&i.populate(r);return[4,i.exec()];case 1:o=c.sent();return[2,o?{success:!0,result:o}:{success:!1,message:"No ".concat(s.getModelName()," found."),code:B.NOT_FOUND.CODE}];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;var s=this;return i(function(){var i,o,a;return D(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);i=s.model.find(e,t,n);r&&i.populate(r);o={success:!0};return[4,i.exec()];case 1:return[2,(o.result=c.sent(),o)];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPaging",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r={success:!0};return[4,n.model.paginate(e,t)];case 1:return[2,(r.result=i.sent(),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPagingAggregate",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r={success:!0};return[4,n.model.aggregatePaginate(n.model.aggregate(e),t)];case 1:return[2,(r.result=i.sent(),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0};return[4,t.model.countDocuments(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createOne",value:function e(e){var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0};return[4,t.model.create(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r={success:!0};return[4,n.model.insertMany(e,t)];case 1:return[2,(r.result=i.sent().map(function(e){return p(e,tz)?e.toObject():null}).filter(function(e){return e!==null}),r)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=this;return i(function(){var s,i;return D(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,r.model.findOneAndUpdate(e,t,y({new:!0},n)).exec()];case 1:s=o.sent();return[2,s?{success:!0,result:s}:{success:!1,message:"Failed to update ".concat(r.getModelName(),"."),code:B.NOT_FOUND.CODE}];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=this;return i(function(){var s,i;return D(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);s={success:!0};return[4,r.model.updateMany(e,t,n).exec()];case 1:return[2,(s.result=o.sent(),s)];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.model.findOneAndDelete(e,t).exec()];case 1:r=i.sent();return[2,r?{success:!0,result:r}:{success:!1,message:"No ".concat(n.getModelName()," found to delete."),code:B.NOT_FOUND.CODE}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=this;return i(function(){var r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,n.model.deleteMany(e,t).exec()];case 1:r=i.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents found to delete.",code:B.NOT_FOUND.CODE}:{success:!0,result:r}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;var n=this;return i(function(){var r,s,i,o;return D(this,function(a){switch(a.label){case 0:r=new Set;s=0;a.label=1;case 1:if(!(s<10))return[3,5];i=t6(e,s+t);o=!r.has(i);if(!o)return[3,3];r.add(i);return[4,n.model.exists({shortId:i})];case 2:o=!a.sent();a.label=3;case 3:if(o)return[2,{success:!0,result:i}];a.label=4;case 4:s++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:B.INTERNAL_SERVER_ERROR.CODE}]}})})()}},{key:"createSlug",value:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=this;return i(function(){var s,o,a,c,u,l,d,f,p,E,g;return D(this,function(h){switch(h.label){case 0:h.trys.push([0,8,,9]);s=t[e],o=/*#__PURE__*/function(){var e=i(function(e){var s,i,o;return D(this,function(a){switch(a.label){case 0:return[4,r.model.findOne(t9.createSlugQuery(e,n,t.id))];case 1:s=a.sent();if(!s)return[2,e];i=1;a.label=2;case 2:o="".concat(e,"-").concat(i);return[4,r.model.findOne(t9.createSlugQuery(o,n,t.id))];case 3:s=a.sent(),i++;a.label=4;case 4:if(s)return[3,2];a.label=5;case 5:return[2,o]}})});return function t(t){return e.apply(this,arguments)}}();if(!((typeof s==="undefined"?"undefined":T(s))=="object"))return[3,5];a={};c=[];for(u in s)c.push(u);l=0;h.label=1;case 1:if(!(l<c.length))return[3,4];d=c[l];f=t5(s[d]);return[4,o(f)];case 2:a[d]=h.sent();h.label=3;case 3:l++;return[3,1];case 4:return[2,{success:!0,result:a}];case 5:p=t5(s);E={success:!0};return[4,o(p)];case 6:return[2,(E.result=h.sent(),E)];case 7:return[3,9];case 8:g=h.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(g.message),code:B.INTERNAL_SERVER_ERROR.CODE}];case 9:return[2]}})})()}},{key:"aggregate",value:function e(e){var t=this;return i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n={success:!0};return[4,t.model.aggregate(e)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}}]);return e}();import{Collection as nt,Db as nn}from"mongodb";import{Document as nr,Model as ns}from"mongoose";var ni=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nn),no=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nr),na=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(ns),nc=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nt);export{ef as BUILD_DIRECTORY,J as CHECK_PACKAGE_EMPTY_RESULT,eD as COMMIT_LINT_CLI,eN as COMMIT_LINT_PACKAGE_NAME,e_ as CYBERSKILL_CLI,eR as CYBERSKILL_CLI_PATH,eO as CYBERSKILL_DIRECTORY,eu as CYBERSKILL_PACKAGE_NAME,el as CYBERSKILL_STORAGE,nc as C_Collection,ni as C_Db,no as C_Document,na as C_Model,eI as ESLINT_CLI,eK as ESLINT_INSPECT_CLI,eq as ESLINT_INSPECT_PACKAGE_NAME,eA as ESLINT_PACKAGE_NAME,G as E_CommandType,q as E_IssueType,eP as GIT_CLI,eS as GIT_COMMIT_EDITMSG,ev as GIT_HOOK,eh as GIT_IGNORE,eV as HOOK,ej as LINT_STAGED_CLI,ew as LINT_STAGED_PACKAGE_NAME,t7 as MongoController,ne as MongooseController,ed as NODE_MODULES,eY as NODE_MODULES_INSPECT_CLI,eH as NODE_MODULES_INSPECT_PACKAGE_NAME,ep as PACKAGE_JSON,eE as PACKAGE_LOCK_JSON,eB as PATH,eT as PLAYWRIGHT_PACKAGE_NAME,eL as PNPM_CLI,ek as PNPM_EXEC_CLI,ey as PNPM_LOCK_YAML,eU as SIMPLE_GIT_HOOKS_PACKAGE_NAME,eF as SIMPLE_GIT_HOOK_CLI,em as SIMPLE_GIT_HOOK_JSON,eg as TSCONFIG_JSON,eM as TSC_CLI,ex as TSC_PACKAGE_NAME,eG as TSX_CLI,eb as VITEST_CLI,eC as VITEST_PACKAGE_NAME,ec as WORKING_DIRECTORY,tZ as aggregatePaginate,et as appendFileSync,e0 as checkPackage,tu as clearAllErrorLists,e$ as command,z as existsSync,tm as formatCommand,ez as getLatestPackageVersion,eX as getPackage,ta as getStoredErrorLists,e2 as installDependencies,ea as join,W as logNodeJS,t9 as mongo,t0 as mongoosePaginate,tg as rawCommand,Z as readFileSync,eo as resolve,ty as resolveCommands,ei as resolveWorkingPath,en as rmSync,tS as runCommand,e3 as setupPackages,tn as storageNodeJS,V as throwError,ee as writeFileSync};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cyberskill/shared",
3
3
  "type": "module",
4
- "version": "1.77.0",
4
+ "version": "1.78.0",
5
5
  "description": "CyberSkill Shared",
6
6
  "author": "Stephen Cheng",
7
7
  "license": "MIT",
@@ -196,13 +196,13 @@
196
196
  "dependencies": {
197
197
  "@antfu/eslint-config": "4.12.0",
198
198
  "@apollo/client": "3.13.7",
199
- "@eslint-react/eslint-plugin": "1.43.0",
199
+ "@eddeee888/gcg-typescript-resolver-files": "0.12.0",
200
+ "@eslint-react/eslint-plugin": "1.45.0",
200
201
  "@graphql-codegen/cli": "5.0.5",
201
202
  "@graphql-codegen/client-preset": "4.8.0",
202
- "@graphql-codegen/typescript-react-apollo": "4.3.2",
203
203
  "@microsoft/api-extractor": "7.52.3",
204
204
  "@next/eslint-plugin-next": "15.3.0",
205
- "@swc/core": "1.11.18",
205
+ "@swc/core": "1.11.20",
206
206
  "@testing-library/jest-dom": "6.6.3",
207
207
  "@testing-library/react": "16.3.0",
208
208
  "@vitejs/plugin-react-swc": "3.8.1",