@cyberskill/shared 1.119.0 → 1.121.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +3 -8
  2. package/dist/_tsup-dts-rollup.d.ts +3 -8
  3. package/dist/configs/config.util.cjs +1 -1
  4. package/dist/configs/config.util.js +1 -1
  5. package/dist/configs/eslint/index.cjs +1 -1
  6. package/dist/configs/eslint/index.js +1 -1
  7. package/dist/configs/index.cjs +1 -1
  8. package/dist/configs/index.js +1 -1
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.d.cts +2 -3
  11. package/dist/index.d.ts +2 -3
  12. package/dist/index.js +1 -1
  13. package/dist/nodejs/cli/cli.util.cjs +1 -1
  14. package/dist/nodejs/cli/cli.util.js +1 -1
  15. package/dist/nodejs/cli/index.cjs +1 -1
  16. package/dist/nodejs/cli/index.js +1 -1
  17. package/dist/nodejs/command/command.util.cjs +1 -1
  18. package/dist/nodejs/command/command.util.js +1 -1
  19. package/dist/nodejs/command/index.cjs +1 -1
  20. package/dist/nodejs/command/index.js +1 -1
  21. package/dist/nodejs/fs/fs.util.cjs +1 -1
  22. package/dist/nodejs/fs/fs.util.d.cts +2 -3
  23. package/dist/nodejs/fs/fs.util.d.ts +2 -3
  24. package/dist/nodejs/fs/fs.util.js +1 -1
  25. package/dist/nodejs/fs/index.cjs +1 -1
  26. package/dist/nodejs/fs/index.d.cts +2 -3
  27. package/dist/nodejs/fs/index.d.ts +2 -3
  28. package/dist/nodejs/fs/index.js +1 -1
  29. package/dist/nodejs/index.cjs +1 -1
  30. package/dist/nodejs/index.d.cts +2 -3
  31. package/dist/nodejs/index.d.ts +2 -3
  32. package/dist/nodejs/index.js +1 -1
  33. package/dist/nodejs/mongo/index.cjs +1 -1
  34. package/dist/nodejs/mongo/index.js +1 -1
  35. package/dist/nodejs/mongo/mongo.util.cjs +1 -1
  36. package/dist/nodejs/mongo/mongo.util.js +1 -1
  37. package/dist/nodejs/package/index.cjs +1 -1
  38. package/dist/nodejs/package/index.js +1 -1
  39. package/dist/nodejs/package/package.util.cjs +1 -1
  40. package/dist/nodejs/package/package.util.js +1 -1
  41. package/dist/nodejs/path/index.cjs +1 -1
  42. package/dist/nodejs/path/index.js +1 -1
  43. package/dist/nodejs/path/path.constant.cjs +1 -1
  44. package/dist/nodejs/path/path.constant.js +1 -1
  45. package/dist/react/apollo-client/apollo-client.component.cjs +1 -1
  46. package/dist/react/apollo-client/apollo-client.component.js +1 -1
  47. package/dist/react/apollo-client/index.cjs +1 -1
  48. package/dist/react/apollo-client/index.js +1 -1
  49. package/dist/react/index.cjs +1 -1
  50. package/dist/react/index.js +1 -1
  51. package/dist/react/vitest/index.cjs +1 -1
  52. package/dist/react/vitest/index.js +1 -1
  53. package/dist/react/vitest/vitest.unit.cjs +1 -1
  54. package/dist/react/vitest/vitest.unit.js +1 -1
  55. package/package.json +1 -2
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,r,n,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){r(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(n,s)}}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){s(o,n,i,a,c,"next",e)}function c(e){s(o,n,i,a,c,"throw",e)}a(undefined)})}}function o(e,t,r){t=d(t);return R(e,N()?Reflect.construct(t,r||[],d(e).constructor):t.apply(e,r))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function u(e,t,r){if(t)c(e.prototype,t);if(r)c(e,r);return e}function l(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function d(e){d=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return d(e)}function f(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)I(e,t)}function p(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function m(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function g(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var s=true;var i=false;var o,a;try{for(r=r.call(e);!(s=(o=r.next()).done);s=true){n.push(o.value);if(t&&n.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&r["return"]!=null)r["return"]()}finally{if(i)throw a}}return n}function E(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){l(e,t,r[t])})}return e}function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function y(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{h(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function S(e,t){if(e==null)return{};var r=O(e,t);var n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){n=i[s];if(t.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;r[n]=e[n]}}return r}function O(e,t){if(e==null)return{};var r={};var n=Object.keys(e);var s,i;for(i=0;i<n.length;i++){s=n[i];if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function R(e,t){if(t&&(A(t)==="object"||typeof t==="function")){return t}return n(e)}function I(e,t){I=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return I(e,t)}function C(e,r){return t(e)||g(e,r)||T(e,r)||E()}function b(e){return r(e)||m(e)||T(e)||v()}function A(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function T(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}function w(e,t){var r,n,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(r=1,n&&(s=a[0]&2?n["return"]:a[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;if(n=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];n=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var x=Object.defineProperty;var P=function(e,t,r){return t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var D=function(e,t){return x(e,"name",{value:t,configurable:!0})};var L=function(e,t,r){return P(e,(typeof t==="undefined"?"undefined":A(t))!="symbol"?t+"":t,r)};var G={extends:["@commitlint/config-conventional"]};var M=function(e){return e.ESLINT="eslint",e.COMMITLINT="commitlint",e.LINT_STAGED="lint-staged",e.VITEST_REACT_E2E="vitest-react-e2e",e.VITEST_REACT_UNIT="vitest-react-unit",e}({});import j from"@antfu/eslint-config";import U from"@vitejs/plugin-react-swc";import{defineConfig as k}from"vitest/config";function F(e){return k(_({plugins:[U()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}D(F,"vitestE2E");import q from"@vitejs/plugin-react-swc";import{defineConfig as B}from"vitest/config";var K=".cyberskill-storage";import H from"@dotenvx/dotenvx";import{bool as Y,cleanEnv as V,str as W}from"envalid";import z from"node:os";import Q from"node:path";import J from"node:process";var $=!1;function X(){$||(H.config(),$=!0)}D(X,"loadEnvFile");function Z(){X();var e=V(J.env,{CWD:W({default:J.cwd()}),DEBUG:Y({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:W({default:Q.join(z.homedir(),K)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}D(Z,"getEnv");var ee=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as et}from"node:child_process";import er from"node:process";import*as en from"node:util";var es=function(e){return e.Error="error",e.Warning="warning",e}({});import ei from"chalk";import eo from"consola";import{GraphQLError as ea}from"graphql";var ec={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var eu=Z();function el(e){var t=e.message,r=e.status,n=r===void 0?ec.INTERNAL_SERVER_ERROR:r,s=e.type,i=s===void 0?"graphql":s;var o;var a=(o=t!==null&&t!==void 0?t:n.MESSAGE)!==null&&o!==void 0?o:"Internal server error";throw i==="graphql"?new ea(a,{extensions:{code:n.CODE}}):new Error(a)}D(el,"throwError");eu.DEBUG||(eo.level=4);function ed(e){var t=ei[e];return typeof t=="function"?t:ei.green}D(ed,"chalkKeyword");var ef={silent:eo.silent,level:eo.level,fatal:eo.fatal,error:eo.error,warn:eo.warn,log:eo.log,info:eo.info,success:eo.success,ready:eo.ready,start:eo.start,box:eo.box,debug:eo.debug,trace:eo.trace,verbose:eo.verbose,printBoxedLog:function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){eo.box(ei.green(e));return}t.forEach(function(e){var t=e.file,n=e.position,s=e.rule,i=e.message;eo.log("".concat(ei.gray("File:")," ").concat(ei.blue("".concat(t).concat(n?":".concat(n):"")))),s&&eo.log(" ".concat(ed(r)("Rule:")," ").concat(s)),eo.log(" ".concat(ed(r)("Message:")," ").concat(i))}),eo.box(ed(r)("".concat(e," : ").concat(t.length))),eo.log(ei.gray("─".repeat(40)))}};var ep={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import em from"node-fetch";import eg from"fs-extra";import{extname as eE}from"node:path";var ev=eg,e_=eg.lstatSync,eh=eg.readdirSync,ey=eg.mkdirSync,eS=eg.readFileSync,eO=eg.writeFileSync,eR=eg.appendFileSync,eI=eg.unlinkSync,eC=eg.statSync,eb=eg.readJsonSync,eA=eg.writeJsonSync;function eT(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return t.every(function(e){return eg.pathExistsSync(e)})}D(eT,"pathExistsSync");function eN(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}t.forEach(function(e){eT(e)&&eg.removeSync(e)})}D(eN,"removeSync");function ew(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=r.extensions,s=S(r,["extensions"]);eg.copySync(e,t,_({filter:D(function(e){return eC(e).isDirectory()||!n||n.length===0?!0:n.includes(eE(e))},"filter")},s))}D(ew,"copySync");var ex=Z();function eP(e){var t=e7(ex.CWD,ts);if(!eT(t))return!1;try{var r=eb(t),n=r.name,s=r.dependencies,i=s===void 0?{}:s,o=r.devDependencies,a=o===void 0?{}:o,c=n===e,u=e in i,l=e in a;return c||u||l?{path:t,file:r,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return ef.warn("Failed to read package.json: ".concat(e.message)),!1}}D(eP,"getPackage");function eD(e){return /*#__PURE__*/i(function(){var t,r,n,s;return w(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,em("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:r=i.sent(),n=r.version;return[2,n];case 3:s=i.sent();throw ef.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}D(eD,"getLatestPackageVersion");function eL(e,t){return /*#__PURE__*/i(function(){var r,n,s,i,o,a,c,u,l,d,f,p,m,g,E,v,h,y,S,O,R;return w(this,function(I){switch(I.label){case 0:I.trys.push([0,4,,5]);r=eP(e);if(!r)return[2,_({},ep)];c=r.path,u=r.file,l=r.isCurrentProject,d=r.isDepend,f=r.isDevDepend,p=(n=u.dependencies)!==null&&n!==void 0?n:{},m=(s=u.devDependencies)!==null&&s!==void 0?s:{},g=l?(i=u.version)!==null&&i!==void 0?i:"0.0.0":d?(o=p[e])!==null&&o!==void 0?o:"0.0.0":f?(a=m[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!l)return[3,1];h=g;return[3,3];case 1:return[4,eD(e)];case 2:h=I.sent();I.label=3;case 3:E=h,v=l||g===E;if(!v&&(t===null||t===void 0?void 0:t.update)){;S=d?"dependencies":f?"devDependencies":null;S&&((y=u[S])===null||y===void 0?void 0:y[e])!==E&&(u[S]=(O=u[S])!==null&&O!==void 0?O:{},u[S][e]=E,eA(c,u),ef.info('Updated "'.concat(e,'" to version ').concat(E)))}return[2,{isCurrentProject:l,installedPath:c,file:u,isUpToDate:v}];case 4:R=I.sent();return[2,(ef.error('Error checking package "'.concat(e,'": ').concat(R.message)),_({},ep))];case 5:return[2]}})})()}D(eL,"checkPackage");function eG(){return /*#__PURE__*/i(function(){var e,t,r,n,s,i,o,a,c,u,l,d;return w(this,function(f){switch(f.label){case 0:e=[{command:D(function(){return tK.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:D(function(){return tK.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:D(function(){return tK.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,r=false,n=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);s=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,a()];case 4:u=f.sent();return[4,e0("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();ef.warn("Installation attempt failed: ".concat(c)),ef.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();r=true;n=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(r){throw n}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}D(eG,"installDependencies");function eM(e,t){return /*#__PURE__*/i(function(){var r,n,s,i,o,a,c,u,l,d,f;return w(this,function(p){switch(p.label){case 0:if(!eT(tk.PACKAGE_JSON)){ef.error("package.json not found. Aborting setup.");return[2]}p.label=1;case 1:p.trys.push([1,13,,14]);r=b(new Set(e)).sort();return[4,Promise.all(r.map(function(e){return eL(e,_({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:n=p.sent().every(function(e){return e.isUpToDate});if(n)return[3,4];return[4,eG()];case 3:n=p.sent();p.label=4;case 4:n;i=true,o=false,a=undefined;p.label=5;case 5:p.trys.push([5,10,11,12]);c=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();p.label=6;case 6:if(!!(i=(u=c.next()).done))return[3,9];l=u.value;return[4,l()];case 7:p.sent();p.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=p.sent();o=true;a=d;return[3,12];case 11:try{if(!i&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:f=p.sent();throw ef.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})})()}D(eM,"setupPackages");import ej from"node-persist";var eU=Z();function ek(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=ej.defaultInstance;if(e)return[3,2];return[4,ej.init({dir:eU.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}D(ek,"initNodePersist");var eF={get:function e(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ek()];case 1:n.sent();return[4,ej.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,(ef.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 4:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/i(function(){var r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ek()];case 1:n.sent();return[4,ej.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();ef.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ek()];case 1:r.sent();return[4,ej.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();ef.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/i(function(){var e,t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ek()];case 1:r.sent();return[4,ej.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:(ef.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,(ef.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/i(function(){return w(this,function(t){try{return[2,"".concat(eU.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(ef.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eq=Z(),eB=en.promisify(et);function eK(e){return"error_list:".concat(e)}D(eK,"getErrorListKey");function eH(e){return /*#__PURE__*/i(function(){var t,r,n;return w(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),r=eK(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,eF.set(r,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(function(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:return[4,eF.getLogLink(r)];case 1:e=t.sent();e&&ef.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:n=s.sent();ef.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})})()}D(eH,"saveErrorListToStorage");function eY(){return /*#__PURE__*/i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eF.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return /*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:return[4,eF.get(e)];case 1:return[2,((t=r.sent())===null||t===void 0?void 0:t.errors)||[]]}})})()}))];case 2:return[2,n.sent().flat()];case 3:r=n.sent();return[2,(ef.error("Failed to retrieve stored errors: ".concat(r.message)),[])];case 4:return[2]}})})()}D(eY,"getStoredErrorLists");function eV(){return /*#__PURE__*/i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eF.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return eF.remove(e)}))];case 2:n.sent();return[3,4];case 3:r=n.sent();ef.error("Failed to clear error lists: ".concat(r.message));return[3,4];case 4:return[2]}})})()}D(eV,"clearAllErrorLists");function eW(e){var t=[],r=[],n="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var a,c,u,l,d;var f=s.exec(e)||[],p=i.exec(e)||[],m=o.exec(e)||[];var g,E,v,_,h,y;f.length&&n?t.push({file:n,position:"".concat(f[1],":").concat(f[2]),type:f[3]===es.Error?es.Error:es.Warning,message:(g=f===null||f===void 0?void 0:(a=f[4])===null||a===void 0?void 0:a.trim())!==null&&g!==void 0?g:"",rule:(E=f===null||f===void 0?void 0:(c=f[5])===null||c===void 0?void 0:c.trim())!==null&&E!==void 0?E:""}):p.length?t.push({file:(v=p===null||p===void 0?void 0:p[1])!==null&&v!==void 0?v:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===es.Error?es.Error:es.Warning,message:(_=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&_!==void 0?_:""}):m.length?t.push({file:"commitlint",type:es.Error,message:(h=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&h!==void 0?h:"",rule:(y=m===null||m===void 0?void 0:(d=m[2])===null||d===void 0?void 0:d.trim())!==null&&y!==void 0?y:""}):r.push(e.trim())}}),t.length&&eH(t),eq.DEBUG&&r.length&&(ef.warn("Unmatched lines:"),r.forEach(function(e){return ef.info(" ".concat(e))}))}D(eW,"parseTextErrors");function ez(e){try{var t=JSON.parse(e),r=[];t.forEach(function(e){var t=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;r.push({type:n===2?es.Error:es.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),r.length&&eH(r)}catch(t){eW(e)}}D(ez,"parseCommandOutput");function eQ(e){return /*#__PURE__*/i(function(e){var t,r,n,s,i,o,a,c,u;var l=arguments;return w(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:ez;r=new AbortController;er.on("SIGINT",function(){ef.warn("Process interrupted. Terminating..."),r.abort(),er.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,eB(e,{maxBuffer:0x6400000,signal:r.signal})];case 2:n=d.sent(),s=n.stdout,i=n.stderr;[s,i].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&ef.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}D(eQ,"executeCommand");function eJ(e){return{raw:!0,cmd:e}}D(eJ,"rawCommand");function e$(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(tw," ").concat(tt," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(tw," ").concat(tA," ").concat(tg," ").concat(e):"".concat(tw," ").concat(tm," ").concat(e)}D(e$,"formatCLI");function eX(e,t){return typeof e=="function"?e$(e(t),t):(typeof e==="undefined"?"undefined":A(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?e$(e,t):e}D(eX,"formatCommand");function eZ(e){return /*#__PURE__*/i(function(e){var t,r,n,s,i,o,a;var c=arguments;return w(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};n=(r=t===null||t===void 0?void 0:t.isRemote)!==null&&r!==void 0?r:!1;if(!n)return[3,1];a=!1;return[3,3];case 1:return[4,eL(tt)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:s=a,i={isRemote:n,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=C(e,2),r=t[0],n=t[1];return[r,eX(n,i)]}))]}})}).apply(this,arguments)}D(eZ,"resolveCommands");function e0(e,t){return /*#__PURE__*/i(function(){var r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);ef.start("".concat(e)),eq.DEBUG&&ef.info("→ ".concat(t));return[4,eQ(t)];case 1:n.sent(),ef.success("".concat(e," done."));return[3,3];case 2:r=n.sent();throw ef.error("".concat(e," failed: ").concat(r.message)),r;case 3:return[2]}})})()}D(e0,"runCommand");import e1,{join as e2,resolve as e4}from"node:path";var e3=Z(),e5=e1;function e8(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return e4.apply(void 0,[e3.CWD].concat(b(t)))}D(e8,"resolveWorkingPath");function e6(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return e4.apply(void 0,b(t))}D(e6,"resolve");function e7(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return e2.apply(void 0,b(t))}D(e7,"join");var e9=Z(),te=e9.CWD,tt="@cyberskill/shared",tr="node_modules",tn="dist",ts="package.json",ti="package-lock.json",to="tsconfig.json",ta=".gitignore",tc=".simple-git-hooks.json",tu="pnpm-lock.yaml",tl=".git/hooks/",td=".git/COMMIT_EDITMSG",tf=".migrate-mongo.config.js",tp=e7(te,tr,tt,tn),tm="cyberskill",tg="src/nodejs/cli/index.ts",tE="eslint",tv="eslint",t_="vitest",th="playwright",ty="vitest",tS="@commitlint/cli",tO="commitlint",tR="lint-staged",tI="lint-staged",tC="typescript",tb="tsc",tA="tsx",tT="git",tN="pnpm",tw="pnpm exec",tx="simple-git-hooks",tP="simple-git-hooks",tD="@eslint/config-inspector",tL="eslint-config-inspector",tG="node-modules-inspector",tM="node-modules-inspector",tj="migrate-mongo",tU="./node_modules/migrate-mongo/bin/migrate-mongo",tk={CYBERSKILL_DIRECTORY:tp,WORKING_DIRECTORY:te,TS_CONFIG:e8(to),GIT_IGNORE:e8(ta),GIT_HOOK:e8(tl),GIT_COMMIT_MSG:e8(td),SIMPLE_GIT_HOOKS_JSON:e8(tc),PACKAGE_JSON:e8(ts),PACKAGE_LOCK_JSON:e8(ti),PNPM_LOCK_YAML:e8(tu),NODE_MODULES:e8(tr),MIGRATE_MONGO_CONFIG:e8(tf),LINT_STAGED_CONFIG:e8("".concat(tp,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:e8("".concat(tp,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:e8("".concat(tp,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:e8("".concat(tp,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:e8("".concat(tp,"/react/vitest/vitest.e2e.js"))};function tF(e){var t=e.isCurrentProject;return _({"pre-commit":tI,"commit-msg":tO},t&&{"pre-push":eJ("".concat(tT," pull"))})}D(tF,"createGitHooksConfig");function tq(e,t,r){return /*#__PURE__*/i(function(){return w(this,function(n){switch(n.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case ee.CLI:return[3,1];case ee.STRING:return[3,3]}return[3,4];case 1:return[4,eM(t.split(" "),{update:!0})];case 2:return[2,(n.sent(),eX(eJ("".concat(tw," ").concat(r))))];case 3:return[2,eX(eJ(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}D(tq,"buildCommand");function tB(e,t,r){return function(){return /*#__PURE__*/i(function(){return w(this,function(n){return[2,tq(e,t,r)]})})()}}D(tB,"commandFactory");var tK={simpleGitHooks:tB(ee.CLI,tx,tP),eslintInspect:tB(ee.CLI,tD,tL),nodeModulesInspect:tB(ee.CLI,tG,tM),eslintCheck:tB(ee.CLI,tE,"".concat(tv," ").concat(tk.WORKING_DIRECTORY)),eslintFix:tB(ee.CLI,tE,"".concat(tv," ").concat(tk.WORKING_DIRECTORY," --fix")),typescriptCheck:tB(ee.CLI,tC,"".concat(tb," -p ").concat(tk.TS_CONFIG," --noEmit")),configureGitHook:tB(ee.STRING,"".concat(tT," config core.hooksPath ").concat(tk.GIT_HOOK)),testUnit:tB(ee.CLI,t_,"".concat(ty," --config ").concat(tk.UNIT_TEST_CONFIG)),testE2e:tB(ee.CLI,"".concat(t_," ").concat(th),"".concat(ty," --config ").concat(tk.E2E_TEST_CONFIG)),mongoMigrateCreate:D(function(e){return tB(ee.CLI,tj,"".concat(tA," ").concat(tU," create ").concat(e," -f ").concat(tk.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:tB(ee.CLI,tj,"".concat(tA," ").concat(tU," up -f ").concat(tk.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:tB(ee.CLI,tj,"".concat(tA," ").concat(tU," down -f ").concat(tk.MIGRATE_MONGO_CONFIG)),commitLint:tB(ee.CLI,tS,"".concat(tO," --edit ").concat(tk.GIT_COMMIT_MSG," --config ").concat(tk.COMMITLINT_CONFIG)),lintStaged:tB(ee.CLI,tR,"".concat(tI," --config ").concat(tk.LINT_STAGED_CONFIG)),stageBuildDirectory:tB(ee.STRING,"".concat(tT," add ").concat(tn)),build:tB(ee.STRING,"".concat(tN," run build")),pnpmInstallStandard:tB(ee.STRING,"".concat(tN," install")),pnpmInstallLegacy:tB(ee.STRING,"".concat(tN," install --legacy-peer-deps")),pnpmInstallForce:tB(ee.STRING,"".concat(tN," install --force"))};function tH(e){return B(_({plugins:[q()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tk.UNIT_TEST_SETUP_CONFIG]}},e))}D(tH,"vitestUnit");function tY(e){try{return JSON.parse(e),!0}catch(e){return!1}}D(tY,"isJson");function tV(e){return(typeof e==="undefined"?"undefined":A(e))=="object"&&e!==null&&!Array.isArray(e)}D(tV,"isObject");function tW(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n={};var s=true,i=false,o=undefined,a=true,c=false,u=undefined;try{for(var l=t.flat()[Symbol.iterator](),d;!(a=(d=l.next()).done);a=true){var f=d.value;try{for(var p=Object.entries(f)[Symbol.iterator](),m;!(s=(m=p.next()).done);s=true){var g=C(m.value,2),E=g[0],v=g[1];var _=n[E];if(Array.isArray(v)){var h=Array.isArray(_)?_:[];n[E]=b(new Set(b(h).concat(b(v))));continue}if(tV(v)){n[E]=tW(tV(_)?_:{},v);continue}n[E]=v}}catch(e){i=true;o=e}finally{try{if(!s&&p.return!=null){p.return()}}finally{if(i){throw o}}}}}catch(e){c=true;u=e}finally{try{if(!a&&l.return!=null){l.return()}}finally{if(c){throw u}}}return n}D(tW,"deepMerge");import*as tz from"globals";var tQ=[{languageOptions:{globals:_({},tz.node,tz.browser)},rules:{"perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}]},ignores:["build","dist"]}];var tJ;var t$=D(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=tW.apply(void 0,[tQ].concat(b(t.map(function(e){return e})))),s=n.ignores,i=S(n,["ignores"]),o=Array.isArray(s)&&s.every(function(e){return typeof e=="string"})?{ignores:s}:void 0,a=[i].concat(b(o?[o]:[]));return j.apply(void 0,[{stylistic:{semi:!0,indent:4,quotes:"single"},formatters:{css:!0,html:!0,markdown:"prettier"},yaml:!1,react:!0}].concat(b(a)))},"handleESLint"),tX=(tJ={},l(tJ,M.ESLINT,function(e){return t$(e)}),l(tJ,M.COMMITLINT,function(e){return tW(e)}),l(tJ,M.LINT_STAGED,function(e){return tW(e)}),l(tJ,M.VITEST_REACT_UNIT,function(e){return tH(e)}),l(tJ,M.VITEST_REACT_E2E,function(e){return F(e)}),tJ);function tZ(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}var s=tX[e];if(!s)throw new Error("Unknown config type: ".concat(e));return s.apply(void 0,b(r))}D(tZ,"mergeConfigs");import{defineConfig as t0}from"@eddeee888/gcg-typescript-resolver-files";X();function t1(e){var t=e.uri,r=e.from,n=e.to,s=e.target,i=s===void 0?"client":s;var o=i==="client",a=i==="server";return y(_({schema:t,ignoreNoDocuments:!0,overwrite:!0},o&&{documents:[r]}),{generates:_({},o&&l({},n,{preset:"client",presetConfig:{fragmentMasking:!1,persistedDocuments:!0},config:{useTypeImports:!0}}),a&&l({},n,t0()))})}D(t1,"createGraphqlCodegenConfig");var t2={"*":["eslint --fix"]};var t4=(typeof window==="undefined"?"undefined":A(window))<"u";import{ApolloServer as t3}from"@apollo/server";import{expressMiddleware as t5}from"@apollo/server/express4";import{ApolloServerPluginDrainHttpServer as t8}from"@apollo/server/plugin/drainHttpServer";import{ApolloServerPluginLandingPageLocalDefault as t6,ApolloServerPluginLandingPageProductionDefault as t7}from"@apollo/server/plugin/landingPage/default";function t9(e){return new t3(_({schema:e.schema,plugins:[e.isDev?t6():t7(),t8({httpServer:e.server})].concat(b(e.drainServer?[{serverWillStart:function t(){return /*#__PURE__*/i(function(){return w(this,function(t){return[2,{drainServer:function t(){return /*#__PURE__*/i(function(){var t;return w(this,function(r){(t=e.drainServer)===null||t===void 0?void 0:t.call(e),ef.info("Apollo Server drainServer hook called");return[2]})})()}}]})})()}}]:[]))},e.isDev&&{introspection:!0,includeStacktraceInErrorResponses:!0}))}D(t9,"createApolloServer");import re from"node:process";import{hideBin as rt}from"yargs/helpers";import rr from"yargs/yargs";var rn={name:"@cyberskill/shared",type:"module",version:"1.118.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/env":{types:"./dist/configs/env/index.d.ts",import:"./dist/configs/env/index.js",require:"./dist/configs/env/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"tsup --watch",lint:"tsx src/nodejs/cli/index.ts lint","lint:fix":"tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"tsx src/nodejs/cli/index.ts lint:inspect",reset:"tsx src/nodejs/cli/index.ts reset",setup:"tsx src/nodejs/cli/index.ts setup",inspect:"tsx src/nodejs/cli/index.ts inspect","test:unit":"tsx src/nodejs/cli/index.ts test:unit","test:e2e":"tsx src/nodejs/cli/index.ts test:e2e",commitlint:"tsx src/nodejs/cli/index.ts commitlint","lint-staged":"tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.8","@apollo/server":"4.12.0","@dotenvx/dotenvx":"1.41.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@nestjs/common":"11.1.0","@nestjs/core":"11.1.0","@next/eslint-plugin-next":"15.3.1","@swc/core":"1.11.22","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.2","body-parser":"2.2.0",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.11.0","graphql-ws":"6.0.4",i18next:"25.0.1",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.16.0",mongoose:"8.14.0","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.1.0","node-fetch":"3.3.2","node-persist":"4.0.4",playwright:"1.52.0","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.3",vitest:"3.1.2","vitest-browser-react":"0.1.1",ws:"8.18.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/compression":"1.7.5","@types/cookie-parser":"1.4.8","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};function rs(){return /*#__PURE__*/i(function(){var e,t;return w(this,function(r){switch(r.label){case 0:if(!eT(tk.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,tK.typescriptCheck()];case 1:return[4,e0.apply(void 0,t.concat([r.sent()]))];case 2:e=r.sent();return[3,4];case 3:e=ef.warn("No TypeScript configuration found. Skipping type check.");r.label=4;case 4:e;return[2]}})})()}D(rs,"checkTypescript");function ri(){return /*#__PURE__*/i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];r=["Running ESLint with auto-fix"];return[4,tK.eslintFix()];case 1:return[4,e0.apply(void 0,r.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:n=["Running ESLint check"];return[4,tK.eslintCheck()];case 4:return[4,e0.apply(void 0,n.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}D(ri,"checkEslint");function ro(e,t){if(!t.length)return;var r=e==="Errors"?"red":"yellow";ef.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,r)}D(ro,"printIssues");function ra(){return /*#__PURE__*/i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:return[4,eY()];case 1:e=n.sent(),t=e.filter(function(e){return e.type===es.Error}),r=e.filter(function(e){return e.type===es.Warning});!t.length&&!r.length?ef.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(ro("Warnings",r),ro("Errors",t),(t.length>0||r.length>0)&&re.exit(1));return[2]}})})()}D(ra,"showCheckResult");function rc(){return /*#__PURE__*/i(function(){var e,t,r,n,s,i;return w(this,function(o){switch(o.label){case 0:return[4,eV()];case 1:o.sent();return[4,eL(tt)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);r=["Building package: ".concat(tt)];return[4,tK.build()];case 4:return[4,e0.apply(void 0,r.concat([o.sent()]))];case 5:o.sent();n=["Staging build artifacts"];return[4,tK.stageBuildDirectory()];case 6:return[4,e0.apply(void 0,n.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw ef.error("Error building and staging ".concat(tt,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,tK.lintStaged()];case 10:return[4,e0.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),ra();return[2]}})})()}D(rc,"lintStaged");function ru(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,tK.eslintInspect()];case 1:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}D(ru,"inspectLint");function rl(){return /*#__PURE__*/i(function(){return w(this,function(e){switch(e.label){case 0:return[4,eV()];case 1:e.sent();return[4,Promise.all([rs(),ri()])];case 2:e.sent(),ra();return[2]}})})()}D(rl,"lintCheck");function rd(){return /*#__PURE__*/i(function(){return w(this,function(e){switch(e.label){case 0:return[4,eV()];case 1:e.sent();return[4,Promise.all([rs(),ri(!0)])];case 2:e.sent(),ra();return[2]}})})()}D(rd,"lintFix");function rf(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:return[4,eV()];case 1:t.sent();e=["Validating commit message"];return[4,tK.commitLint()];case 2:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),ra();return[2]}})})()}D(rf,"commitLint");function rp(){return /*#__PURE__*/i(function(){var e,t,r,n;return w(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,tK.configureGitHook()];case 1:return[4,e0.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eN(tk.GIT_HOOK);return[4,eZ(tF)];case 3:t=s.sent();eA(tk.SIMPLE_GIT_HOOKS_JSON,t);r="\n".concat(tc,"\n");eT(tk.GIT_IGNORE)?eS(tk.GIT_IGNORE,"utf-8").split("\n").includes(tc)||eR(tk.GIT_IGNORE,r,"utf-8"):eO(tk.GIT_IGNORE,r,"utf-8");n=["Setting up simple-git-hooks"];return[4,tK.simpleGitHooks()];case 4:return[4,e0.apply(void 0,n.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}D(rp,"setupGitHook");function rm(){return /*#__PURE__*/i(function(){return w(this,function(e){switch(e.label){case 0:return[4,eM([tt],{update:!0,postInstallActions:[rp]})];case 1:e.sent();return[2]}})})()}D(rm,"setup");function rg(){return /*#__PURE__*/i(function(){return w(this,function(e){switch(e.label){case 0:eN(tk.NODE_MODULES,tk.PNPM_LOCK_YAML);return[4,eG()];case 1:e.sent();return[4,rp()];case 2:e.sent();return[2]}})})()}D(rg,"reset");function rE(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,tK.nodeModulesInspect()];case 1:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}D(rE,"inspect");function rv(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,tK.testUnit()];case 1:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}D(rv,"testUnit");function r_(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,tK.testE2e()];case 1:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}D(r_,"testE2E");function rh(e){return /*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:t=["Creating MongoDB migration"];return[4,tK.mongoMigrateCreate(e)];case 1:return[4,e0.apply(void 0,t.concat([r.sent()]))];case 2:r.sent();return[2]}})})()}D(rh,"mongoMigrateCreate");function ry(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,tK.mongoMigrateUp()];case 1:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}D(ry,"mongoMigrateUp");function rS(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,tK.mongoMigrateDown()];case 1:return[4,e0.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}D(rS,"mongoMigrateDown");(function(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,rr(rt(re.argv)).scriptName(tm).usage("$0 <command> [options]").command("lint","Check code for linting issues",rl).command("lint:fix","Fix linting issues automatically",rd).command("lint:inspect","View active ESLint configuration",ru).command("lint-staged","Run lint checks on staged files",rc).command("commitlint","Validate commit message format",rf).command("setup","Initialize project setup and dependencies",rm).command("reset","Reset the project and reinstall dependencies",rg).command("inspect","Analyze installed project dependencies",rE).command("test:unit","Run unit test suite",rv).command("test:e2e","Run end-to-end test suite",r_).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return /*#__PURE__*/i(function(){return w(this,function(t){switch(t.label){case 0:if(!e.name){ef.error("Migration name is required.");return[2]}return[4,rh(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",ry).command("mongo:migrate:down","Rollback last MongoDB migration",rS).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(rn.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();ef.error("Fatal: ".concat(e.message)),re.exit(1);return[3,3];case 3:return[2]}})})()})();import{Router as rO}from"express";import{NestFactory as rR}from"@nestjs/core";import rI from"body-parser";import rC from"compression";import rb from"cookie-parser";import rA from"cors";import rT from"express";import rN from"express-device";import rw from"express-session";function rx(e){var t=e.isDev,r=e.whiteList,n=S(e,["isDev","whiteList"]);return _({origin:D(function(e,n){t||(r===null||r===void 0?void 0:r.includes(e!==null&&e!==void 0?e:""))?n(null,!0):n(new Error("Not allowed by CORS"),!1)},"origin"),credentials:!0},n)}D(rx,"createCorsOptions");function rP(e){return rA(rx(e))}D(rP,"createCors");function rD(e){return rw(e)}D(rD,"createSession");function rL(e){var t=rT();return t.set("trust proxy",1),t.use(rb()),t.use(rT.urlencoded({extended:!0})),t.use(rC()),t.use(rN.capture()),(e===null||e===void 0?void 0:e.staticFolder)&&t.use(rT.static(e.staticFolder)),t}D(rL,"createExpress");function rG(e){return /*#__PURE__*/i(function(){var t,r,n;return w(this,function(s){switch(s.label){case 0:return[4,rR.create(e.module)];case 1:n=s.sent();return[2,(n.getHttpAdapter().getInstance().set("trust proxy",1),n.use(rT.urlencoded({extended:!0})),n.use(rb()),n.use(rC()),n.use(rN.capture()),e.staticFolder&&n.use(rT.static(e.staticFolder)),e.filters&&(t=n).useGlobalFilters.apply(t,b(e.filters)),e.pipes&&(r=n).useGlobalPipes.apply(r,b(e.pipes)),n)]}})})()}D(rG,"createNest");var rM="MONGO_MIGRATE_OPTIONS";import{Collection as rj,Db as rU}from"mongodb";import{Document as rk,Model as rF}from"mongoose";var rq=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rU);D(rq,"C_Db");var rB=rq,rK=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rk);D(rK,"C_Document");var rH=rK,rY=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rF);D(rY,"C_Model");var rV=rY,rW=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rj);D(rW,"C_Collection");var rz=rW;import{format as rQ}from"date-fns";import rJ from"migrate-mongo";import{Document as r$}from"mongoose";import rX from"mongoose-aggregate-paginate-v2";import rZ from"mongoose-paginate-v2";import{v4 as r0}from"uuid";import r1 from"unorm";var r2={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},r4=Object.entries(r2).reduce(function(e,t){var r=C(t,2),n=r[0],s=r[1];return e[n.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function r3(e){e=r1.nfkc(e);var t=_({},r2,r4);var r=true,n=false,s=undefined;try{for(var i=Object.entries(t)[Symbol.iterator](),o;!(r=(o=i.next()).done);r=true){var a=C(o.value,2),c=a[0],u=a[1];var l="[".concat(c).concat(u.join(""),"]"),d="(".concat([c].concat(b(u)).join("|"),")");e=e.replace(new RegExp(l,"g"),d)}}catch(e){n=true;s=e}finally{try{if(!r&&i.return!=null){i.return()}}finally{if(n){throw s}}}return e}D(r3,"regexSearchMapper");function r5(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}D(r5,"removeAccent");var r8={Date:{is:D(function(e){return p(e,Date)},"is"),serialize:D(function(e){return{__type:"Date",value:e.toISOString()}},"serialize"),deserialize:D(function(e){return new Date(e)},"deserialize")},Map:{is:D(function(e){return p(e,Map)},"is"),serialize:D(function(e){return{__type:"Map",value:Array.from(e.entries())}},"serialize"),deserialize:D(function(e){return new Map(e)},"deserialize")},Set:{is:D(function(e){return p(e,Set)},"is"),serialize:D(function(e){return{__type:"Set",value:Array.from(e)}},"serialize"),deserialize:D(function(e){return new Set(e)},"deserialize")},RegExp:{is:D(function(e){return p(e,RegExp)},"is"),serialize:D(function(e){return{__type:"RegExp",value:{source:e.source,flags:e.flags}}},"serialize"),deserialize:D(function(e){var t=e.source,r=e.flags;return new RegExp(t,r)},"deserialize")},BigInt:{is:D(function(e){return(typeof e==="undefined"?"undefined":A(e))=="bigint"},"is"),serialize:D(function(e){return{__type:"BigInt",value:e.toString()}},"serialize"),deserialize:D(function(e){return BigInt(e)},"deserialize")}},r6={serialize:function e(e){return JSON.stringify(e,function(e,t){var r=true,n=false,s=undefined;try{for(var i=Object.keys(r8)[Symbol.iterator](),o;!(r=(o=i.next()).done);r=true){var a=o.value;var c=r8[a];if(c.is(t))return c.serialize(t)}}catch(e){n=true;s=e}finally{try{if(!r&&i.return!=null){i.return()}}finally{if(n){throw s}}}return t})},deserialize:function e(e){return JSON.parse(e,function(e,t){if(t&&(typeof t==="undefined"?"undefined":A(t))=="object"&&"__type"in t&&typeof t.__type=="string"){var r=t.__type,n=r8[r];if(n)return n.deserialize(t.value)}return t})}};import r7 from"crypto-js";import r9 from"slugify";var ne=r9.default||r9;function nt(e,t){var r=D(function(e){var r,n;return ne(e!==null&&e!==void 0?e:"",_({lower:(r=t===null||t===void 0?void 0:t.lower)!==null&&r!==void 0?r:!0,locale:(n=t===null||t===void 0?void 0:t.locale)!==null&&n!==void 0?n:"vi"},t))},"slugifyWithOptions");if(tV(e)){var n={};var s=true,i=false,o=undefined;try{for(var a=Object.entries(e)[Symbol.iterator](),c;!(s=(c=a.next()).done);s=true){var u=C(c.value,2),l=u[0],d=u[1];n[l]=r(d)}}catch(e){i=true;o=e}finally{try{if(!s&&a.return!=null){a.return()}}finally{if(i){throw o}}}return n}return r(e)}D(nt,"generateSlug");function nr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return r7.SHA256(e).toString(r7.enc.Hex).slice(0,t)}D(nr,"generateShortId");function nn(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:8;var t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+[]{}|;:,.<>?",r="";for(var n=0;n<e;n++){var s=Math.floor(Math.random()*t.length);r+=t.charAt(s)}return r}D(nn,"generateRandomPassword");function ns(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;var r=e.split(/[?#]/)[0]||"",n=r.substring(r.lastIndexOf("/")+1);if(t)return n;var s=n.lastIndexOf(".");return s>0?n.slice(0,s):n}D(ns,"getFileName");function ni(e,t,r){var n=e.indexOf(t);if(n===-1)return"";var s=n+t.length,i=e.indexOf(r,s);return i===-1?"":e.slice(s,i)}D(ni,"substringBetween");var no={isEmpty:function e(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":A(e))=="object"?p(e,Date)?!1:p(e,Map)||p(e,Set)?e.size===0:p(e,WeakMap)||p(e,WeakSet)?!0:ArrayBuffer.isView(e)?e.byteLength===0:Object.keys(e).length===0:!1},isValidIP:function e(e){var t=e.split(".");return t.length===4&&t.every(function(e){return/^\d+$/.test(e)&&Number(e)>=0&&Number(e)<=255})?!0:/^(([a-f\d]{1,4}:){7}[a-f\d]{1,4}|((?:[a-f\d]{1,4}:){1,7}:)|((?:[a-f\d]{1,4}:){1,6}:[a-f\d]{1,4})|::)$/i.test(e)}};var na={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return rQ(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.returnDateAs,r=t===void 0?"string":t;var n=r==="string"?na.getDateTime():new Date;return{id:r0(),isDel:!1,createdAt:n,updatedAt:n}},applyPlugins:function e(e,t){t.filter(function(e){return typeof e=="function"}).forEach(function(t){return e.plugin(t)})},applyMiddlewares:function e(e,t){t.forEach(function(t){var r=t.method,n=t.pre,s=t.post;r&&n&&e.pre(r,n),r&&s&&e.post(r,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:r0,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,r=e.schema,n=e.virtuals,s=n===void 0?[]:n,i=e.standalone,o=i===void 0?!1:i;var a=new t.Schema(r,{strict:!0});return s.forEach(function(e){var t=e.name,r=e.options,n=e.get;var s=a.virtual(t,r);n&&s.get(n)}),o||a.add(na.createGenericSchema(t)),a},createModel:function e(e){var t=e.mongoose,r=e.name,n=e.schema,s=e.pagination,i=s===void 0?!1:s,o=e.aggregate,a=o===void 0?!1:o,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,d=l===void 0?[]:l;if(!r)throw new Error("Model name is required.");if(t.models[r])return t.models[r];var f=na.createSchema({mongoose:t,schema:n,virtuals:u});return na.applyPlugins(f,[i&&rZ,a&&rX]),na.applyMiddlewares(f,d),t.model(r,f)},validator:{isEmpty:function e(){return function(e){return /*#__PURE__*/i(function(){return w(this,function(t){return[2,!no.isEmpty(e)]})})()}},isUnique:function e(e){return function(t){return /*#__PURE__*/i(function(){var r;return w(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");r={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.exists(r)];case 1:return[2,!n.sent()]}})}).call(this)}},matchesRegex:function e(e){return function(t){return /*#__PURE__*/i(function(){return w(this,function(r){if(!Array.isArray(e)||e.some(function(e){return!p(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(t)})]})})()}}},migrate:y(_({},rJ),{setConfig:D(function(e){var t="// This file is automatically generated by the Cyberskill CLI.\nmodule.exports = ".concat(JSON.stringify(e,null,4));eO(tk.MIGRATE_MONGO_CONFIG,t);var r="\n".concat(tf,"\n");eT(tk.GIT_IGNORE)?eS(tk.GIT_IGNORE,"utf-8").split("\n").includes(tf)||eR(tk.GIT_IGNORE,r,"utf-8"):eO(tk.GIT_IGNORE,r,"utf-8")},"setConfig")})},nc=/*#__PURE__*/function(){"use strict";function e(t,r){a(this,e);L(this,"collection");this.collection=t.collection(r)}u(e,[{key:"createOne",value:function e(e){return /*#__PURE__*/i(function(){var t,r,n;return w(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=_({},na.createGenericFields(),e);r={success:!0,message:"Document created successfully"};return[4,this.collection.insertOne(t)];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return /*#__PURE__*/i(function(){var t,r,n;return w(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=e.map(function(e){return _({},na.createGenericFields(),e)});return[4,this.collection.insertMany(t)];case 1:r=s.sent();return[2,r.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(r.insertedCount," documents created successfully"),result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"findOne",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,this.collection.findOne(e)];case 1:t=n.sent();return[2,t?{success:!0,message:"Document found",result:t}:{success:!1,message:"Document not found"}];case 2:r=n.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"findAll",value:function e(){return /*#__PURE__*/i(function(){var e,t,r;var n=arguments;return w(this,function(s){switch(s.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Documents retrieved successfully"};return[4,this.collection.find(e).toArray()];case 2:return[2,(t.result=s.sent(),t)];case 3:r=s.sent();return[2,{success:!1,message:r.message}];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return /*#__PURE__*/i(function(){var e,t,r;var n=arguments;return w(this,function(s){switch(s.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Count retrieved successfully"};return[4,this.collection.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:r=s.sent();return[2,{success:!1,message:r.message}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(e,t){return /*#__PURE__*/i(function(){var r,n;return w(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateOne(e,{$set:t})];case 1:r=s.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"updateMany",value:function e(e,t){return /*#__PURE__*/i(function(){var r,n;return w(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateMany(e,{$set:t})];case 1:r=s.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"deleteOne",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,this.collection.deleteOne(e)];case 1:t=n.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:t}];case 2:r=n.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"deleteMany",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,this.collection.deleteMany(e)];case 1:t=n.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:t}];case 2:r=n.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}}]);return e}();D(nc,"MongoController");var nu=nc,nl=/*#__PURE__*/function(){"use strict";function e(t){a(this,e);L(this,"model");this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(e){return /*#__PURE__*/i(function(){var e,t,r,n,s,i,o;var a=arguments;return w(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},r=a.length>2&&a[2]!==void 0?a[2]:{},n=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.findOne(e,t,r);n&&s.populate(n);return[4,s.exec()];case 2:i=c.sent();return[2,i?{success:!0,result:i}:{success:!1,message:"No ".concat(this.getModelName()," found."),code:ec.NOT_FOUND.CODE}];case 3:o=c.sent();return[2,{success:!1,message:o.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findAll",value:function e(e){return /*#__PURE__*/i(function(){var e,t,r,n,s,i,o;var a=arguments;return w(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},r=a.length>2&&a[2]!==void 0?a[2]:{},n=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.find(e,t,r);n&&s.populate(n);i={success:!0};return[4,s.exec()];case 2:return[2,(i.result=c.sent(),i)];case 3:o=c.sent();return[2,{success:!1,message:o.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPaging",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);r={success:!0};return[4,this.model.paginate(e,t)];case 2:return[2,(r.result=i.sent(),r)];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPagingAggregate",value:function e(e){return /*#__PURE__*/i(function(e){var t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);r={success:!0};return[4,this.model.aggregatePaginate(this.model.aggregate(e),t)];case 2:return[2,(r.result=i.sent(),r)];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return /*#__PURE__*/i(function(){var e,t,r;var n=arguments;return w(this,function(s){switch(s.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0};return[4,this.model.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:r=s.sent();return[2,{success:!1,message:r.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"createOne",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);t={success:!0};return[4,this.model.create(e)];case 1:return[2,(t.result=n.sent(),t)];case 2:r=n.sent();return[2,{success:!1,message:r.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return /*#__PURE__*/i(function(e){var t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);r={success:!0};return[4,this.model.insertMany(e,t)];case 2:return[2,(r.result=i.sent().map(function(e){return p(e,r$)?e.toObject():null}).filter(function(e){return e!==null}),r)];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n,s;var i=arguments;return w(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},r=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);return[4,this.model.findOneAndUpdate(e,t,_({new:!0},r)).exec()];case 2:n=o.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"Failed to update ".concat(this.getModelName(),"."),code:ec.NOT_FOUND.CODE}];case 3:s=o.sent();return[2,{success:!1,message:s.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateMany",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n,s;var i=arguments;return w(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},r=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);n={success:!0};return[4,this.model.updateMany(e,t,r).exec()];case 2:return[2,(n.result=o.sent(),n)];case 3:s=o.sent();return[2,{success:!1,message:s.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteOne",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.findOneAndDelete(e,t).exec()];case 2:r=i.sent();return[2,r?{success:!0,result:r}:{success:!1,message:"No ".concat(this.getModelName()," found to delete."),code:ec.NOT_FOUND.CODE}];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteMany",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.deleteMany(e,t).exec()];case 2:r=i.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents found to delete.",code:ec.NOT_FOUND.CODE}:{success:!0,result:r}];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return /*#__PURE__*/i(function(){var r,n,s,i;return w(this,function(o){switch(o.label){case 0:r=new Set;n=0;o.label=1;case 1:if(!(n<10))return[3,5];s=nr(e,n+t);i=!r.has(s);if(!i)return[3,3];r.add(s);return[4,this.model.exists({shortId:s})];case 2:i=!o.sent();o.label=3;case 3:if(i)return[2,{success:!0,result:s}];o.label=4;case 4:n++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:ec.INTERNAL_SERVER_ERROR.CODE}]}})}).call(this)}},{key:"createSlug",value:function e(e,t,r){return /*#__PURE__*/i(function(){var n,s,o,a,c,u,d,f,p,m;return w(this,function(g){switch(g.label){case 0:n=this;g.label=1;case 1:g.trys.push([1,5,,6]);s=t[e],o=tV(s),a=D(function(t){var n=_({},r!==null&&r!==void 0?r:{});return o?y(_({},n),{$or:[l({},"slug.".concat(e),t),{slugHistory:{$elemMatch:l({},"slug.".concat(e),t)}}]}):y(_({},n),{$or:[{slug:t},{slugHistory:t}]})},"generateSlugQuery"),c=D(function(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:t=e,r=1;n.label=1;case 1:return[4,this.model.exists(a(t))];case 2:if(!n.sent())return[3,4];t="".concat(e,"-").concat(r++);n.label=3;case 3:return[3,1];case 4:return[2,t]}})}).call(n)},"generateUniqueSlug");if(!o)return[3,3];u={success:!0};d=Object.fromEntries;return[4,Promise.all(Object.entries(s).map(function(e){var t=C(e,2),r=t[0],n=t[1];return /*#__PURE__*/i(function(){var e,t;return w(this,function(s){switch(s.label){case 0:e=nt(n);t=[r];return[4,c(e)];case 1:return[2,t.concat([s.sent()])]}})})()}))];case 2:return[2,(u.result=d.apply(Object,[g.sent()]),u)];case 3:f=nt(s);p={success:!0};return[4,c(f)];case 4:return[2,(p.result=g.sent(),p)];case 5:m=g.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(m.message),code:ec.INTERNAL_SERVER_ERROR.CODE}];case 6:return[2]}})}).call(this)}},{key:"aggregate",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);t={success:!0};return[4,this.model.aggregate(e)];case 1:return[2,(t.result=n.sent(),t)];case 2:r=n.sent();return[2,{success:!1,message:r.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})}).call(this)}}]);return e}();D(nl,"MongooseController");var nd=nl;import{useServer as nf}from"graphql-ws/use/ws";import{WebSocketServer as np}from"ws";function nm(e){return new np({server:e.server,path:e.path})}D(nm,"createWSServer");function ng(e){return nf({schema:e.schema},e.server)}D(ng,"initGraphQLWS");import{ApolloClient as nE,ApolloError as nv,ApolloLink as n_,ApolloProvider as nh,from as ny,HttpLink as nS,InMemoryCache as nO,split as nR}from"@apollo/client";import{onError as nI}from"@apollo/client/link/error";import{removeTypenameFromVariables as nC}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as nb}from"@apollo/client/link/subscriptions";import{getMainDefinition as nA}from"@apollo/client/utilities";import{createClient as nT}from"graphql-ws";import nN,{useMemo as nw}from"react";import{FaInfo as nx}from"react-icons/fa6";import nP,{use as nD}from"react";import{FaRepeat as nL}from"react-icons/fa6";import{createContext as nG}from"react";var nM=nG(void 0);import nj from"./react/apollo-error/apollo-error.module.scss";function nU(){var e=nD(nM),t=e===null||e===void 0?void 0:e.error;if(!t)return null;var r=D(function(e,t){return(t===null||t===void 0?void 0:t.length)?nP.createElement("div",null,nP.createElement("strong",null,e,":"),nP.createElement("ul",null,t.map(function(e){return nP.createElement("li",{key:e.message},e.message)}))):null},"renderErrorList");return nP.createElement("div",{className:nj["modal-backdrop"]},nP.createElement("div",{className:nj["modal-content"]},nP.createElement("button",{type:"button",className:nj["btn-close"],onClick:e.hideError},"✕"),nP.createElement("div",{className:nj["error-title"]},nP.createElement("button",{type:"button",className:nj["btn-retry"],onClick:D(function(){return window.location.reload()},"onClick")},nP.createElement(nL,null))," ",t.message),nP.createElement("div",{className:nj["error-details"]},t.networkError&&nP.createElement("pre",{className:"network"},nP.createElement("strong",null,"Network Error:")," ",t.networkError.message),r("GraphQL Errors",b(t.graphQLErrors)),r("Protocol Errors",b(t.protocolErrors)),r("Client Errors",b(t.clientErrors)),t.extraInfo&&nP.createElement("pre",{className:"extra"},nP.createElement("strong",null,"Extra Info:")," ",JSON.stringify(t.extraInfo,null,4)))))}D(nU,"ApolloError");import{use as nk}from"react";function nF(){var e=nk(nM);if(!e)throw new Error("useApolloError must be used within ApolloErrorProvider");return e}D(nF,"useApolloError");import nq,{useEffect as nB,useMemo as nK,useState as nH}from"react";var nY=null;function nV(e){nY=e}D(nV,"setGlobalApolloErrorCallback");function nW(e){nY===null||nY===void 0?void 0:nY(e)}D(nW,"showGlobalApolloError");function nz(e){var t=e.children;var r=C(nH(null),2),n=r[0],s=r[1];nB(function(){nV(s)},[]);var i=nK(function(){return{error:n,showError:s,hideError:D(function(){return s(null)},"hideError")}},[n]);return nq.createElement(nM,{value:i},t)}D(nz,"ApolloErrorProvider");import{consola as nQ}from"consola/browser";var nJ={silent:nQ.silent,level:nQ.level,fatal:nQ.fatal,error:nQ.error,warn:nQ.warn,log:nQ.log,info:nQ.info,success:nQ.success,ready:nQ.ready,start:nQ.start,box:nQ.box,debug:nQ.debug,trace:nQ.trace,verbose:nQ.verbose};import{toast as n$,Toaster as nX}from"react-hot-toast";var nZ="/graphql";var n0,n1=(n0=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);var e;e=o(this,t,arguments);L(e,"count",0);return e}u(t,[{key:"request",value:function e(e,t){var r=this;var n=Date.now();return this.count+=1,t(e).map(function(t){var s=Date.now()-n,i=e.operationName||"Unnamed";return nJ.info("[Apollo] #".concat(r.count,": ").concat(i," (").concat(s,"ms)")),t})}}]);return t}(n_),D(n0,"DevLoggerLink"),n0);function n2(e){var t=e.uri,r=e.wsUrl,n=e.customLinks,s=new n1,i=nI(function(e){var t=e.graphQLErrors,r=e.networkError,n=e.protocolErrors,s=e.operation;var i=(s===null||s===void 0?void 0:s.operationName)||"Unknown";if(t&&t.forEach(function(e){var t=e.message,r=e.locations,n=e.path;nJ.error("[GraphQL error] ".concat(i,": ").concat(t,", Location: ").concat(JSON.stringify(r),", Path: ").concat(n))}),n&&n.forEach(function(e){var t=e.message,r=e.extensions;nJ.error("[Protocol error]: ".concat(t,", Extensions: ").concat(JSON.stringify(r)))}),r&&nJ.error("[Network error]: ".concat(r)),t||n||r){var o,a;var c=(t===null||t===void 0?void 0:(o=t[0])===null||o===void 0?void 0:o.message)||(n===null||n===void 0?void 0:(a=n[0])===null||a===void 0?void 0:a.message)||(r===null||r===void 0?void 0:r.message)||"Unexpected error",u=new nv({graphQLErrors:t||[],protocolErrors:n||[],clientErrors:[],networkError:r||null,errorMessage:c,extraInfo:{operation:s}});n$.error(function(e){return nN.createElement(nN.Fragment,null,c,"\xa0",nN.createElement(nx,{cursor:"pointer",onClick:D(function(){setTimeout(function(){nW(u)},0),n$.dismiss(e.id)},"onClick")}))})}}),o=nC();t||nJ.warn('[Apollo] No GraphQL URI provided — using "'.concat(nZ,'" as default'));var a=new nS({uri:t!==null&&t!==void 0?t:nZ,credentials:"include"}),c=r?new nb(nT({url:r})):n_.empty(),u=p(c,n_)?nR(function(e){var t=e.query;var r=nA(t);return r.kind==="OperationDefinition"&&r.operation==="subscription"},c,a):a;return u===a&&r&&nJ.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[s,i,o].concat(b(n!==null&&n!==void 0?n:[]),[u])}D(n2,"createApolloLinks");function n4(e){var t=e.isNextJS,r=e.options,n=e.children,s=e.client,i=e.provider,o=e.cache;var a=r||{},c=a.uri,u=a.wsUrl,l=a.customLinks,d=S(a,["uri","wsUrl","customLinks"]),f=s!==null&&s!==void 0?s:nE;if(typeof f!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var m=i||nh,g=nw(function(){return ny(n2({uri:c!==null&&c!==void 0?c:nZ,wsUrl:u!==null&&u!==void 0?u:"",customLinks:l!==null&&l!==void 0?l:[]}))},[c,u,l]),E=nw(function(){return p(o,nO)?o:new nO},[o]),v=nw(function(){return new f(_({link:g,cache:E},d))},[f,g,E,d]),h=t?nN.createElement(m,{makeClient:D(function(){return v},"makeClient")},n):nN.createElement(m,{client:v},n);return nN.createElement(nN.Fragment,null,nN.createElement(nz,null,h,nN.createElement(nU,null)),nN.createElement(nX,{position:"top-right"}))}D(n4,"ApolloProvider");import{useTranslation as n3}from"react-i18next";var n5=n3;import n8 from"i18next";import{initReactI18next as n6}from"react-i18next";function n7(e){return n8.use(n6).init(e)}D(n7,"initI18next");import n9 from"classnames";import se from"react";import st from"./react/loading/loading.module.scss";function sr(e){var t=e.full,r=t===void 0?!1:t,n=e.block,s=n===void 0?!1:n,i=e.className,o=i===void 0?"":i,a=e.message,c=a===void 0?"Loading":a,u=S(e,["full","block","className","message"]);function l(){return se.createElement("div",_({className:st.container},u),se.createElement("div",{className:st.ring}),se.createElement("div",{className:st.ring}),se.createElement("div",{className:st.ring}),se.createElement("div",{className:st.ring}),c&&se.createElement("div",{className:st.message},c))}return D(l,"_renderLoading"),r?se.createElement("div",{className:n9(st.fullscreen,o)},l()):s?se.createElement("div",{className:n9(st.block,o)},l()):l()}D(sr,"Loading");import{createContext as sn}from"react";var ss=sn(void 0);import{use as si}from"react";function so(){var e=si(ss);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}D(so,"useLoading");import sa,{useCallback as sc,useMemo as su,useState as sl}from"react";function sd(e){var t=e.children;var r=C(sl(!1),2),n=r[0],s=r[1],i=C(sl(!1),2),o=i[0],a=i[1],c=sc(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;s(!0),a(e)},[]),u=sc(function(){s(!1),a(!1)},[]),l=su(function(){return{isLoading:n,isGlobalLoading:o,showLoading:c,hideLoading:u}},[n,o,c,u]);return sa.createElement(ss,{value:l},n?sa.createElement(sr,{full:o}):t)}D(sd,"LoadingProvider");import{enUS as sf}from"date-fns/locale";var sp={label:"English",value:"en",flag:"\uD83C\uDDFA\uD83C\uDDF8",adapterLocale:sf,icon:"flagpack:gb-nir",numberFormat:{code:"en-US",currency:"USD"},timezone:"America/New_York"};import{createContext as sm}from"react";var sg=sm(void 0);import{NextIntlClientProvider as sE}from"next-intl";import sv from"react";import{useTranslations as s_}from"next-intl";import{use as sh}from"react";function sy(){var e=sh(sg);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}D(sy,"useNextIntl");var sS=s_;function sO(e){var t=D(function(t){var r;var n;var s=sy(),i=s.currentLanguage,o=t.messages,a=t.languages,c="en",u=o[(i===null||i===void 0?void 0:i.value)||c],l=(n=(r=a.find(function(e){return e.value===(i===null||i===void 0?void 0:i.value)}))===null||r===void 0?void 0:r.timezone)!==null&&n!==void 0?n:sp.timezone;return o?sv.createElement(sE,{locale:(i===null||i===void 0?void 0:i.value)||c,messages:u||null,timeZone:l},sv.createElement(e,t)):(nJ.warn("Missing messages for language: ".concat((i===null||i===void 0?void 0:i.value)||c)),null)},"PageWithI18n");return t.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),t}D(sO,"withNextIntl");import sR,{useMemo as sI}from"react";import{useCallback as sC,useEffect as sb,useState as sA}from"react";import sT from"localforage";var sN={get:function e(e){return /*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sT.getItem(e)];case 1:return[2,r.sent()];case 2:t=r.sent();return[2,(nJ.error('[Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 3:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/i(function(){var r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,sT.setItem(e,t)];case 1:n.sent();return[3,3];case 2:r=n.sent();nJ.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},remove:function e(e){return /*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sT.removeItem(e)];case 1:r.sent();return[3,3];case 2:t=r.sent();nJ.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},keys:function e(){return /*#__PURE__*/i(function(){var e,t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sT.keys()];case 1:return[2,(e=r.sent())!==null&&e!==void 0?e:[]];case 2:t=r.sent();return[2,(nJ.error("[Storage:keys] Error getting keys:",t),[])];case 3:return[2]}})})()}};function sw(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r6;var n=C(sA(t),2),s=n[0],o=n[1],a=C(sA(!1),2),c=a[0],u=a[1];sb(function(){var n=!0;return D(function(){return /*#__PURE__*/i(function(){var s,i,a,c;return w(this,function(l){switch(l.label){case 0:l.trys.push([0,6,7,8]);return[4,sN.get(e)];case 1:s=l.sent();if(!n)return[3,5];if(!(s!==null))return[3,2];i=r.deserialize(s);o(i);return[3,5];case 2:if(!(t!==void 0))return[3,4];a=r.serialize(t);return[4,sN.set(e,a)];case 3:l.sent(),o(t);return[3,5];case 4:o(void 0);l.label=5;case 5:return[3,8];case 6:c=l.sent();nJ.error('Error loading value for key "'.concat(e,'":'),c),n&&o(t);return[3,8];case 7:n&&u(!0);return[7];case 8:return[2]}})})()},"loadValue")(),function(){n=!1,u(!1)}},[e,t,r]),sb(function(){if(!c)return;D(function(){return /*#__PURE__*/i(function(){var t,n;return w(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);if(!(s!==void 0))return[3,2];t=r.serialize(s);return[4,sN.set(e,t)];case 1:i.sent();i.label=2;case 2:return[3,4];case 3:n=i.sent();nJ.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},"saveValue")()},[s,e,r,c]);var l=sC(function(e){o(function(t){return typeof e=="function"?e(t):e})},[]),d=sC(function(){return /*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sN.remove(e)];case 1:r.sent(),o(void 0);return[3,3];case 2:t=r.sent();nJ.error('Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},[e]);return{value:s,set:l,remove:d}}D(sw,"useStorage");function sx(e){var t=e.children;return sR.createElement(sR.Fragment,null,t)}D(sx,"LanguageWrapperBase");var sP=sO(sx);function sD(e){var t=e.children,r=e.languages,n=e.messages;var s=sw("lang",r[0]),i=s.value,o=s.set,a=sI(function(){return{languages:r,currentLanguage:i!==null&&i!==void 0?i:sp,setCurrentLanguage:o}},[r,o,i]);return sR.createElement(sg,{value:a},sR.createElement(sP,{languages:r,messages:n},t))}D(sD,"NextIntlProvider");export{nU as ApolloError,nM as ApolloErrorContext,nz as ApolloErrorProvider,n4 as ApolloProvider,tn as BUILD_DIRECTORY,ep as CHECK_PACKAGE_EMPTY_RESULT,tO as COMMIT_LINT_CLI,tS as COMMIT_LINT_PACKAGE_NAME,tm as CYBERSKILL_CLI,tg as CYBERSKILL_CLI_PATH,tp as CYBERSKILL_DIRECTORY,tt as CYBERSKILL_PACKAGE_NAME,K as CYBERSKILL_STORAGE_DIRECTORY,rz as C_Collection,rB as C_Db,rH as C_Document,rV as C_Model,tv as ESLINT_CLI,tL as ESLINT_INSPECT_CLI,tD as ESLINT_INSPECT_PACKAGE_NAME,tE as ESLINT_PACKAGE_NAME,ee as E_CommandType,M as E_ConfigType,es as E_IssueType,tT as GIT_CLI,td as GIT_COMMIT_EDITMSG,tl as GIT_HOOK,ta as GIT_IGNORE,nZ as GRAPHQL_URI_DEFAULT,t4 as IS_BROWSER,tI as LINT_STAGED_CLI,tR as LINT_STAGED_PACKAGE_NAME,sr as Loading,ss as LoadingContext,sd as LoadingProvider,tU as MIGRATE_MONGO_CLI,tf as MIGRATE_MONGO_CONFIG,tj as MIGRATE_MONGO_PACKAGE_NAME,rM as MONGO_MIGRATE_OPTIONS,nu as MongoController,nd as MongooseController,sp as NEXT_INTL_DEFAULT_LANGUAGE,tr as NODE_MODULES,tM as NODE_MODULES_INSPECT_CLI,tG as NODE_MODULES_INSPECT_PACKAGE_NAME,sg as NextIntlContext,sD as NextIntlProvider,ts as PACKAGE_JSON,ti as PACKAGE_LOCK_JSON,tk as PATH,th as PLAYWRIGHT_PACKAGE_NAME,tN as PNPM_CLI,tw as PNPM_EXEC_CLI,tu as PNPM_LOCK_YAML,ec as RESPONSE_STATUS,rO as Router,tx as SIMPLE_GIT_HOOKS_PACKAGE_NAME,tP as SIMPLE_GIT_HOOK_CLI,tc as SIMPLE_GIT_HOOK_JSON,to as TSCONFIG_JSON,tb as TSC_CLI,tC as TSC_PACKAGE_NAME,tA as TSX_CLI,nX as Toaster,ty as VITEST_CLI,t_ as VITEST_PACKAGE_NAME,te as WORKING_DIRECTORY,rX as aggregatePaginate,eR as appendFileSync,rI as bodyParser,eL as checkPackage,eV as clearAllErrorLists,tK as command,G as commitlintConfig,ew as copySync,t9 as createApolloServer,rP as createCors,rx as createCorsOptions,rL as createExpress,tF as createGitHooksConfig,t1 as createGraphqlCodegenConfig,rG as createNest,rD as createSession,nm as createWSServer,tW as deepMerge,tQ as eslintConfig,rT as express,t5 as expressMiddleware,eX as formatCommand,ev as fs,nn as generateRandomPassword,nr as generateShortId,nt as generateSlug,Z as getEnv,ns as getFileName,eD as getLatestPackageVersion,eP as getPackage,eY as getStoredErrorLists,ng as initGraphQLWS,n7 as initI18next,eG as installDependencies,tY as isJson,tV as isObject,e7 as join,t2 as lintStagedConfig,X as loadEnvFile,nJ as log,ef as logNodeJS,e_ as lstatSync,tZ as mergeConfigs,ey as mkdirSync,na as mongo,rZ as mongoosePaginate,e5 as path,eT as pathExistsSync,eJ as rawCommand,eS as readFileSync,eb as readJsonSync,eh as readdirSync,r3 as regexSearchMapper,r5 as removeAccent,eN as removeSync,e6 as resolve,eZ as resolveCommands,e8 as resolveWorkingPath,e0 as runCommand,r6 as serializer,nV as setGlobalApolloErrorCallback,eM as setupPackages,nW as showGlobalApolloError,eC as statSync,sN as storage,eF as storageNodeJS,ni as substringBetween,el as throwError,n$ as toast,eI as unlinkSync,nF as useApolloError,so as useLoading,sy as useNextIntl,sw as useStorage,n5 as useTranslateI18next,sS as useTranslateNextIntl,no as validate,F as vitestE2E,tH as vitestUnit,sO as withNextIntl,eO as writeFileSync,eA as writeJsonSync};
1
+ function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,r,n,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){r(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(n,s)}}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){s(o,n,i,a,c,"next",e)}function c(e){s(o,n,i,a,c,"throw",e)}a(undefined)})}}function o(e,t,r){t=d(t);return R(e,N()?Reflect.construct(t,r||[],d(e).constructor):t.apply(e,r))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function u(e,t,r){if(t)c(e.prototype,t);if(r)c(e,r);return e}function l(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function d(e){d=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return d(e)}function f(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)I(e,t)}function p(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function m(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function g(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var s=true;var i=false;var o,a;try{for(r=r.call(e);!(s=(o=r.next()).done);s=true){n.push(o.value);if(t&&n.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&r["return"]!=null)r["return"]()}finally{if(i)throw a}}return n}function E(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){l(e,t,r[t])})}return e}function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function y(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{h(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function S(e,t){if(e==null)return{};var r=O(e,t);var n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){n=i[s];if(t.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;r[n]=e[n]}}return r}function O(e,t){if(e==null)return{};var r={};var n=Object.keys(e);var s,i;for(i=0;i<n.length;i++){s=n[i];if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function R(e,t){if(t&&(A(t)==="object"||typeof t==="function")){return t}return n(e)}function I(e,t){I=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return I(e,t)}function C(e,r){return t(e)||g(e,r)||T(e,r)||E()}function b(e){return r(e)||m(e)||T(e)||v()}function A(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function T(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}function w(e,t){var r,n,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(r=1,n&&(s=a[0]&2?n["return"]:a[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;if(n=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];n=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var x=Object.defineProperty;var P=function(e,t,r){return t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var D=function(e,t){return x(e,"name",{value:t,configurable:!0})};var L=function(e,t,r){return P(e,(typeof t==="undefined"?"undefined":A(t))!="symbol"?t+"":t,r)};var G={extends:["@commitlint/config-conventional"]};var M=function(e){return e.ESLINT="eslint",e.COMMITLINT="commitlint",e.LINT_STAGED="lint-staged",e.VITEST_REACT_E2E="vitest-react-e2e",e.VITEST_REACT_UNIT="vitest-react-unit",e}({});import j from"@antfu/eslint-config";import U from"@vitejs/plugin-react-swc";import{defineConfig as k}from"vitest/config";function F(e){return k(_({plugins:[U()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}D(F,"vitestE2E");import q from"@vitejs/plugin-react-swc";import{defineConfig as B}from"vitest/config";var H=".cyberskill-storage";import K from"@dotenvx/dotenvx";import{bool as Y,cleanEnv as V,str as W}from"envalid";import Q from"node:os";import z from"node:path";import J from"node:process";var $=!1;function X(){$||(K.config(),$=!0)}D(X,"loadEnvFile");function Z(){X();var e=V(J.env,{CWD:W({default:J.cwd()}),DEBUG:Y({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:W({default:z.join(Q.homedir(),H)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}D(Z,"getEnv");var ee=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as et}from"node:child_process";import er from"node:process";import*as en from"node:util";var es=function(e){return e.Error="error",e.Warning="warning",e}({});import ei from"chalk";import eo from"consola";import{GraphQLError as ea}from"graphql";var ec={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var eu=Z();function el(e){var t=e.message,r=e.status,n=r===void 0?ec.INTERNAL_SERVER_ERROR:r,s=e.type,i=s===void 0?"graphql":s;var o;var a=(o=t!==null&&t!==void 0?t:n.MESSAGE)!==null&&o!==void 0?o:"Internal server error";throw i==="graphql"?new ea(a,{extensions:{code:n.CODE}}):new Error(a)}D(el,"throwError");eu.DEBUG||(eo.level=4);function ed(e){var t=ei[e];return typeof t=="function"?t:ei.green}D(ed,"chalkKeyword");var ef={silent:eo.silent,level:eo.level,fatal:eo.fatal,error:eo.error,warn:eo.warn,log:eo.log,info:eo.info,success:eo.success,ready:eo.ready,start:eo.start,box:eo.box,debug:eo.debug,trace:eo.trace,verbose:eo.verbose,printBoxedLog:function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){eo.box(ei.green(e));return}t.forEach(function(e){var t=e.file,n=e.position,s=e.rule,i=e.message;eo.log("".concat(ei.gray("File:")," ").concat(ei.blue("".concat(t).concat(n?":".concat(n):"")))),s&&eo.log(" ".concat(ed(r)("Rule:")," ").concat(s)),eo.log(" ".concat(ed(r)("Message:")," ").concat(i))}),eo.box(ed(r)("".concat(e," : ").concat(t.length))),eo.log(ei.gray("─".repeat(40)))}};var ep={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import em from"node-fetch";import eg from"fs-extra";import{extname as eE}from"node:path";var ev=eg,e_=eg.lstatSync,eh=eg.readdirSync,ey=eg.mkdirSync,eS=eg.readFileSync,eO=eg.unlinkSync,eR=eg.statSync,eI=eg.readJsonSync;function eC(e,t,r){eg.writeFileSync(e,t,r!==null&&r!==void 0?r:"utf-8")}D(eC,"writeFileSync");function eb(e,t,r){eg.appendFileSync(e,t,r!==null&&r!==void 0?r:"utf-8")}D(eb,"appendFileSync");function eA(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return t.every(function(e){return eg.pathExistsSync(e)})}D(eA,"pathExistsSync");function eT(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}t.forEach(function(e){eA(e)&&eg.removeSync(e)})}D(eT,"removeSync");function eN(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=r.extensions,s=S(r,["extensions"]);eg.copySync(e,t,_({filter:D(function(e){return eR(e).isDirectory()||!n||n.length===0?!0:n.includes(eE(e))},"filter")},s))}D(eN,"copySync");var ew=Z();function ex(e){var t=e6(ew.CWD,tn);if(!eA(t))return!1;try{var r=eI(t),n=r.name,s=r.dependencies,i=s===void 0?{}:s,o=r.devDependencies,a=o===void 0?{}:o,c=n===e,u=e in i,l=e in a;return c||u||l?{path:t,file:r,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return ef.warn("Failed to read package.json: ".concat(e.message)),!1}}D(ex,"getPackage");function eP(e){return /*#__PURE__*/i(function(){var t,r,n,s;return w(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,em("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:r=i.sent(),n=r.version;return[2,n];case 3:s=i.sent();throw ef.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}D(eP,"getLatestPackageVersion");function eD(e,t){return /*#__PURE__*/i(function(){var r,n,s,i,o,a,c,u,l,d,f,p,m,g,E,v,h,y,S,O,R;return w(this,function(I){switch(I.label){case 0:I.trys.push([0,4,,5]);r=ex(e);if(!r)return[2,_({},ep)];c=r.path,u=r.file,l=r.isCurrentProject,d=r.isDepend,f=r.isDevDepend,p=(n=u.dependencies)!==null&&n!==void 0?n:{},m=(s=u.devDependencies)!==null&&s!==void 0?s:{},g=l?(i=u.version)!==null&&i!==void 0?i:"0.0.0":d?(o=p[e])!==null&&o!==void 0?o:"0.0.0":f?(a=m[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!l)return[3,1];h=g;return[3,3];case 1:return[4,eP(e)];case 2:h=I.sent();I.label=3;case 3:E=h,v=l||g===E;if(!v&&(t===null||t===void 0?void 0:t.update)){;S=d?"dependencies":f?"devDependencies":null;S&&((y=u[S])===null||y===void 0?void 0:y[e])!==E&&(u[S]=(O=u[S])!==null&&O!==void 0?O:{},u[S][e]=E,eC(c,JSON.stringify(u,null,4)),ef.info('Updated "'.concat(e,'" to version ').concat(E)))}return[2,{isCurrentProject:l,installedPath:c,file:u,isUpToDate:v}];case 4:R=I.sent();return[2,(ef.error('Error checking package "'.concat(e,'": ').concat(R.message)),_({},ep))];case 5:return[2]}})})()}D(eD,"checkPackage");function eL(){return /*#__PURE__*/i(function(){var e,t,r,n,s,i,o,a,c,u,l,d;return w(this,function(f){switch(f.label){case 0:e=[{command:D(function(){return tB.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:D(function(){return tB.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:D(function(){return tB.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,r=false,n=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);s=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,a()];case 4:u=f.sent();return[4,eZ("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();ef.warn("Installation attempt failed: ".concat(c)),ef.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();r=true;n=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(r){throw n}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}D(eL,"installDependencies");function eG(e,t){return /*#__PURE__*/i(function(){var r,n,s,i,o,a,c,u,l,d,f;return w(this,function(p){switch(p.label){case 0:if(!eA(tU.PACKAGE_JSON)){ef.error("package.json not found. Aborting setup.");return[2]}p.label=1;case 1:p.trys.push([1,13,,14]);r=b(new Set(e)).sort();return[4,Promise.all(r.map(function(e){return eD(e,_({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:n=p.sent().every(function(e){return e.isUpToDate});if(n)return[3,4];return[4,eL()];case 3:n=p.sent();p.label=4;case 4:n;i=true,o=false,a=undefined;p.label=5;case 5:p.trys.push([5,10,11,12]);c=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();p.label=6;case 6:if(!!(i=(u=c.next()).done))return[3,9];l=u.value;return[4,l()];case 7:p.sent();p.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=p.sent();o=true;a=d;return[3,12];case 11:try{if(!i&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:f=p.sent();throw ef.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})})()}D(eG,"setupPackages");import eM from"node-persist";var ej=Z();function eU(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=eM.defaultInstance;if(e)return[3,2];return[4,eM.init({dir:ej.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}D(eU,"initNodePersist");var ek={get:function e(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eU()];case 1:n.sent();return[4,eM.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,(ef.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 4:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/i(function(){var r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eU()];case 1:n.sent();return[4,eM.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();ef.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eU()];case 1:r.sent();return[4,eM.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();ef.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/i(function(){var e,t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eU()];case 1:r.sent();return[4,eM.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:(ef.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,(ef.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/i(function(){return w(this,function(t){try{return[2,"".concat(ej.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(ef.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eF=Z(),eq=en.promisify(et);function eB(e){return"error_list:".concat(e)}D(eB,"getErrorListKey");function eH(e){return /*#__PURE__*/i(function(){var t,r,n;return w(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),r=eB(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,ek.set(r,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(function(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:return[4,ek.getLogLink(r)];case 1:e=t.sent();e&&ef.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:n=s.sent();ef.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})})()}D(eH,"saveErrorListToStorage");function eK(){return /*#__PURE__*/i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ek.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return /*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:return[4,ek.get(e)];case 1:return[2,((t=r.sent())===null||t===void 0?void 0:t.errors)||[]]}})})()}))];case 2:return[2,n.sent().flat()];case 3:r=n.sent();return[2,(ef.error("Failed to retrieve stored errors: ".concat(r.message)),[])];case 4:return[2]}})})()}D(eK,"getStoredErrorLists");function eY(){return /*#__PURE__*/i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ek.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return ek.remove(e)}))];case 2:n.sent();return[3,4];case 3:r=n.sent();ef.error("Failed to clear error lists: ".concat(r.message));return[3,4];case 4:return[2]}})})()}D(eY,"clearAllErrorLists");function eV(e){var t=[],r=[],n="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var a,c,u,l,d;var f=s.exec(e)||[],p=i.exec(e)||[],m=o.exec(e)||[];var g,E,v,_,h,y;f.length&&n?t.push({file:n,position:"".concat(f[1],":").concat(f[2]),type:f[3]===es.Error?es.Error:es.Warning,message:(g=f===null||f===void 0?void 0:(a=f[4])===null||a===void 0?void 0:a.trim())!==null&&g!==void 0?g:"",rule:(E=f===null||f===void 0?void 0:(c=f[5])===null||c===void 0?void 0:c.trim())!==null&&E!==void 0?E:""}):p.length?t.push({file:(v=p===null||p===void 0?void 0:p[1])!==null&&v!==void 0?v:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===es.Error?es.Error:es.Warning,message:(_=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&_!==void 0?_:""}):m.length?t.push({file:"commitlint",type:es.Error,message:(h=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&h!==void 0?h:"",rule:(y=m===null||m===void 0?void 0:(d=m[2])===null||d===void 0?void 0:d.trim())!==null&&y!==void 0?y:""}):r.push(e.trim())}}),t.length&&eH(t),eF.DEBUG&&r.length&&(ef.warn("Unmatched lines:"),r.forEach(function(e){return ef.info(" ".concat(e))}))}D(eV,"parseTextErrors");function eW(e){try{var t=JSON.parse(e),r=[];t.forEach(function(e){var t=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;r.push({type:n===2?es.Error:es.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),r.length&&eH(r)}catch(t){eV(e)}}D(eW,"parseCommandOutput");function eQ(e){return /*#__PURE__*/i(function(e){var t,r,n,s,i,o,a,c,u;var l=arguments;return w(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eW;r=new AbortController;er.on("SIGINT",function(){ef.warn("Process interrupted. Terminating..."),r.abort(),er.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,eq(e,{maxBuffer:0x6400000,signal:r.signal})];case 2:n=d.sent(),s=n.stdout,i=n.stderr;[s,i].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&ef.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}D(eQ,"executeCommand");function ez(e){return{raw:!0,cmd:e}}D(ez,"rawCommand");function eJ(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(tN," ").concat(te," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(tN," ").concat(tb," ").concat(tm," ").concat(e):"".concat(tN," ").concat(tp," ").concat(e)}D(eJ,"formatCLI");function e$(e,t){return typeof e=="function"?eJ(e(t),t):(typeof e==="undefined"?"undefined":A(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eJ(e,t):e}D(e$,"formatCommand");function eX(e){return /*#__PURE__*/i(function(e){var t,r,n,s,i,o,a;var c=arguments;return w(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};n=(r=t===null||t===void 0?void 0:t.isRemote)!==null&&r!==void 0?r:!1;if(!n)return[3,1];a=!1;return[3,3];case 1:return[4,eD(te)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:s=a,i={isRemote:n,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=C(e,2),r=t[0],n=t[1];return[r,e$(n,i)]}))]}})}).apply(this,arguments)}D(eX,"resolveCommands");function eZ(e,t){return /*#__PURE__*/i(function(){var r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);ef.start("".concat(e)),eF.DEBUG&&ef.info("→ ".concat(t));return[4,eQ(t)];case 1:n.sent(),ef.success("".concat(e," done."));return[3,3];case 2:r=n.sent();throw ef.error("".concat(e," failed: ").concat(r.message)),r;case 3:return[2]}})})()}D(eZ,"runCommand");import e0,{join as e1,resolve as e2}from"node:path";var e4=Z(),e3=e0;function e5(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return e2.apply(void 0,[e4.CWD].concat(b(t)))}D(e5,"resolveWorkingPath");function e8(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return e2.apply(void 0,b(t))}D(e8,"resolve");function e6(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return e1.apply(void 0,b(t))}D(e6,"join");var e7=Z(),e9=e7.CWD,te="@cyberskill/shared",tt="node_modules",tr="dist",tn="package.json",ts="package-lock.json",ti="tsconfig.json",to=".gitignore",ta=".simple-git-hooks.json",tc="pnpm-lock.yaml",tu=".git/hooks/",tl=".git/COMMIT_EDITMSG",td=".migrate-mongo.config.js",tf=e6(e9,tt,te,tr),tp="cyberskill",tm="src/nodejs/cli/index.ts",tg="eslint",tE="eslint",tv="vitest",t_="playwright",th="vitest",ty="@commitlint/cli",tS="commitlint",tO="lint-staged",tR="lint-staged",tI="typescript",tC="tsc",tb="tsx",tA="git",tT="pnpm",tN="pnpm exec",tw="simple-git-hooks",tx="simple-git-hooks",tP="@eslint/config-inspector",tD="eslint-config-inspector",tL="node-modules-inspector",tG="node-modules-inspector",tM="migrate-mongo",tj="./node_modules/migrate-mongo/bin/migrate-mongo",tU={CYBERSKILL_DIRECTORY:tf,WORKING_DIRECTORY:e9,TS_CONFIG:e5(ti),GIT_IGNORE:e5(to),GIT_HOOK:e5(tu),GIT_COMMIT_MSG:e5(tl),SIMPLE_GIT_HOOKS_JSON:e5(ta),PACKAGE_JSON:e5(tn),PACKAGE_LOCK_JSON:e5(ts),PNPM_LOCK_YAML:e5(tc),NODE_MODULES:e5(tt),MIGRATE_MONGO_CONFIG:e5(td),LINT_STAGED_CONFIG:e5("".concat(tf,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:e5("".concat(tf,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:e5("".concat(tf,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:e5("".concat(tf,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:e5("".concat(tf,"/react/vitest/vitest.e2e.js"))};function tk(e){var t=e.isCurrentProject;return _({"pre-commit":tR,"commit-msg":tS},t&&{"pre-push":ez("".concat(tA," pull"))})}D(tk,"createGitHooksConfig");function tF(e,t,r){return /*#__PURE__*/i(function(){return w(this,function(n){switch(n.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case ee.CLI:return[3,1];case ee.STRING:return[3,3]}return[3,4];case 1:return[4,eG(t.split(" "),{update:!0})];case 2:return[2,(n.sent(),e$(ez("".concat(tN," ").concat(r))))];case 3:return[2,e$(ez(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}D(tF,"buildCommand");function tq(e,t,r){return function(){return /*#__PURE__*/i(function(){return w(this,function(n){return[2,tF(e,t,r)]})})()}}D(tq,"commandFactory");var tB={simpleGitHooks:tq(ee.CLI,tw,tx),eslintInspect:tq(ee.CLI,tP,tD),nodeModulesInspect:tq(ee.CLI,tL,tG),eslintCheck:tq(ee.CLI,tg,"".concat(tE," ").concat(tU.WORKING_DIRECTORY," --no-cache")),eslintFix:tq(ee.CLI,tg,"".concat(tE," ").concat(tU.WORKING_DIRECTORY," --fix --no-cache")),typescriptCheck:tq(ee.CLI,tI,"".concat(tC," -p ").concat(tU.TS_CONFIG," --noEmit")),configureGitHook:tq(ee.STRING,"".concat(tA," config core.hooksPath ").concat(tU.GIT_HOOK)),testUnit:tq(ee.CLI,tv,"".concat(th," --config ").concat(tU.UNIT_TEST_CONFIG)),testE2e:tq(ee.CLI,"".concat(tv," ").concat(t_),"".concat(th," --config ").concat(tU.E2E_TEST_CONFIG)),mongoMigrateCreate:D(function(e){return tq(ee.CLI,tM,"".concat(tb," ").concat(tj," create ").concat(e," -f ").concat(tU.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:tq(ee.CLI,tM,"".concat(tb," ").concat(tj," up -f ").concat(tU.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:tq(ee.CLI,tM,"".concat(tb," ").concat(tj," down -f ").concat(tU.MIGRATE_MONGO_CONFIG)),commitLint:tq(ee.CLI,ty,"".concat(tS," --edit ").concat(tU.GIT_COMMIT_MSG," --config ").concat(tU.COMMITLINT_CONFIG)),lintStaged:tq(ee.CLI,tO,"".concat(tR," --config ").concat(tU.LINT_STAGED_CONFIG)),stageBuildDirectory:tq(ee.STRING,"".concat(tA," add ").concat(tr)),build:tq(ee.STRING,"".concat(tT," run build")),pnpmInstallStandard:tq(ee.STRING,"".concat(tT," install")),pnpmInstallLegacy:tq(ee.STRING,"".concat(tT," install --legacy-peer-deps")),pnpmInstallForce:tq(ee.STRING,"".concat(tT," install --force"))};function tH(e){return B(_({plugins:[q()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tU.UNIT_TEST_SETUP_CONFIG]}},e))}D(tH,"vitestUnit");function tK(e){try{return JSON.parse(e),!0}catch(e){return!1}}D(tK,"isJson");function tY(e){return(typeof e==="undefined"?"undefined":A(e))=="object"&&e!==null&&!Array.isArray(e)}D(tY,"isObject");function tV(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n={};var s=true,i=false,o=undefined,a=true,c=false,u=undefined;try{for(var l=t.flat()[Symbol.iterator](),d;!(a=(d=l.next()).done);a=true){var f=d.value;try{for(var p=Object.entries(f)[Symbol.iterator](),m;!(s=(m=p.next()).done);s=true){var g=C(m.value,2),E=g[0],v=g[1];var _=n[E];if(Array.isArray(v)){var h=Array.isArray(_)?_:[];n[E]=b(new Set(b(h).concat(b(v))));continue}if(tY(v)){n[E]=tV(tY(_)?_:{},v);continue}n[E]=v}}catch(e){i=true;o=e}finally{try{if(!s&&p.return!=null){p.return()}}finally{if(i){throw o}}}}}catch(e){c=true;u=e}finally{try{if(!a&&l.return!=null){l.return()}}finally{if(c){throw u}}}return n}D(tV,"deepMerge");import*as tW from"globals";var tQ=[{languageOptions:{globals:_({},tW.node,tW.browser)},rules:{"perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}],"dot-notation":"off"},ignores:["build","dist"]}];var tz;var tJ=D(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=tV.apply(void 0,[tQ].concat(b(t.map(function(e){return e})))),s=n.ignores,i=S(n,["ignores"]),o=Array.isArray(s)&&s.every(function(e){return typeof e=="string"})?{ignores:s}:void 0,a=[i].concat(b(o?[o]:[]));return j.apply(void 0,[{stylistic:{semi:!0,indent:4,quotes:"single"},formatters:{css:!0,html:!0,markdown:"prettier"},yaml:!1,react:!0}].concat(b(a)))},"handleESLint"),t$=(tz={},l(tz,M.ESLINT,function(e){return tJ(e)}),l(tz,M.COMMITLINT,function(e){return tV(e)}),l(tz,M.LINT_STAGED,function(e){return tV(e)}),l(tz,M.VITEST_REACT_UNIT,function(e){return tH(e)}),l(tz,M.VITEST_REACT_E2E,function(e){return F(e)}),tz);function tX(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}var s=t$[e];if(!s)throw new Error("Unknown config type: ".concat(e));return s.apply(void 0,b(r))}D(tX,"mergeConfigs");import{defineConfig as tZ}from"@eddeee888/gcg-typescript-resolver-files";X();function t0(e){var t=e.uri,r=e.from,n=e.to,s=e.target,i=s===void 0?"client":s;var o=i==="client",a=i==="server";return y(_({schema:t,ignoreNoDocuments:!0,overwrite:!0},o&&{documents:[r]}),{generates:_({},o&&l({},n,{preset:"client",presetConfig:{fragmentMasking:!1,persistedDocuments:!0},config:{useTypeImports:!0}}),a&&l({},n,tZ()))})}D(t0,"createGraphqlCodegenConfig");var t1={"*":["eslint --fix"]};var t2=(typeof window==="undefined"?"undefined":A(window))<"u";import{ApolloServer as t4}from"@apollo/server";import{expressMiddleware as t3}from"@apollo/server/express4";import{ApolloServerPluginDrainHttpServer as t5}from"@apollo/server/plugin/drainHttpServer";import{ApolloServerPluginLandingPageLocalDefault as t8,ApolloServerPluginLandingPageProductionDefault as t6}from"@apollo/server/plugin/landingPage/default";function t7(e){return new t4(_({schema:e.schema,plugins:[e.isDev?t8():t6(),t5({httpServer:e.server})].concat(b(e.drainServer?[{serverWillStart:function t(){return /*#__PURE__*/i(function(){return w(this,function(t){return[2,{drainServer:function t(){return /*#__PURE__*/i(function(){var t;return w(this,function(r){(t=e.drainServer)===null||t===void 0?void 0:t.call(e),ef.info("Apollo Server drainServer hook called");return[2]})})()}}]})})()}}]:[]))},e.isDev&&{introspection:!0,includeStacktraceInErrorResponses:!0}))}D(t7,"createApolloServer");import t9 from"node:process";import{hideBin as re}from"yargs/helpers";import rt from"yargs/yargs";var rr={name:"@cyberskill/shared",type:"module",version:"1.120.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/env":{types:"./dist/configs/env/index.d.ts",import:"./dist/configs/env/index.js",require:"./dist/configs/env/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"tsup --watch",lint:"tsx src/nodejs/cli/index.ts lint","lint:fix":"tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"tsx src/nodejs/cli/index.ts lint:inspect",reset:"tsx src/nodejs/cli/index.ts reset",setup:"tsx src/nodejs/cli/index.ts setup",inspect:"tsx src/nodejs/cli/index.ts inspect","test:unit":"tsx src/nodejs/cli/index.ts test:unit","test:e2e":"tsx src/nodejs/cli/index.ts test:e2e",commitlint:"tsx src/nodejs/cli/index.ts commitlint","lint-staged":"tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.8","@apollo/server":"4.12.0","@dotenvx/dotenvx":"1.41.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@nestjs/common":"11.1.0","@nestjs/core":"11.1.0","@next/eslint-plugin-next":"15.3.1","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.2","body-parser":"2.2.0",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.11.0","graphql-ws":"6.0.4",i18next:"25.0.1",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.16.0",mongoose:"8.14.0","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.1.0","node-fetch":"3.3.2","node-persist":"4.0.4",playwright:"1.52.0","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.3",vitest:"3.1.2","vitest-browser-react":"0.1.1",ws:"8.18.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/compression":"1.7.5","@types/cookie-parser":"1.4.8","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};function rn(){return /*#__PURE__*/i(function(){var e,t;return w(this,function(r){switch(r.label){case 0:if(!eA(tU.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,tB.typescriptCheck()];case 1:return[4,eZ.apply(void 0,t.concat([r.sent()]))];case 2:e=r.sent();return[3,4];case 3:e=ef.warn("No TypeScript configuration found. Skipping type check.");r.label=4;case 4:e;return[2]}})})()}D(rn,"checkTypescript");function rs(){return /*#__PURE__*/i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];r=["Running ESLint with auto-fix"];return[4,tB.eslintFix()];case 1:return[4,eZ.apply(void 0,r.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:n=["Running ESLint check"];return[4,tB.eslintCheck()];case 4:return[4,eZ.apply(void 0,n.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}D(rs,"checkEslint");function ri(e,t){if(!t.length)return;var r=e==="Errors"?"red":"yellow";ef.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,r)}D(ri,"printIssues");function ro(){return /*#__PURE__*/i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:return[4,eK()];case 1:e=n.sent(),t=e.filter(function(e){return e.type===es.Error}),r=e.filter(function(e){return e.type===es.Warning});!t.length&&!r.length?ef.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(ri("Warnings",r),ri("Errors",t),(t.length>0||r.length>0)&&t9.exit(1));return[2]}})})()}D(ro,"showCheckResult");function ra(){return /*#__PURE__*/i(function(){var e,t,r,n,s,i;return w(this,function(o){switch(o.label){case 0:return[4,eY()];case 1:o.sent();return[4,eD(te)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);r=["Building package: ".concat(te)];return[4,tB.build()];case 4:return[4,eZ.apply(void 0,r.concat([o.sent()]))];case 5:o.sent();n=["Staging build artifacts"];return[4,tB.stageBuildDirectory()];case 6:return[4,eZ.apply(void 0,n.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw ef.error("Error building and staging ".concat(te,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,tB.lintStaged()];case 10:return[4,eZ.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),ro();return[2]}})})()}D(ra,"lintStaged");function rc(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,tB.eslintInspect()];case 1:return[4,eZ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}D(rc,"inspectLint");function ru(){return /*#__PURE__*/i(function(){return w(this,function(e){switch(e.label){case 0:return[4,eY()];case 1:e.sent();return[4,Promise.all([rn(),rs()])];case 2:e.sent(),ro();return[2]}})})()}D(ru,"lintCheck");function rl(){return /*#__PURE__*/i(function(){return w(this,function(e){switch(e.label){case 0:return[4,eY()];case 1:e.sent();return[4,Promise.all([rn(),rs(!0)])];case 2:e.sent(),ro();return[2]}})})()}D(rl,"lintFix");function rd(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:return[4,eY()];case 1:t.sent();e=["Validating commit message"];return[4,tB.commitLint()];case 2:return[4,eZ.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),ro();return[2]}})})()}D(rd,"commitLint");function rf(){return /*#__PURE__*/i(function(){var e,t,r,n;return w(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,tB.configureGitHook()];case 1:return[4,eZ.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eT(tU.GIT_HOOK);return[4,eX(tk)];case 3:t=s.sent();eC(tU.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(t,null,4));r="\n".concat(ta,"\n");eA(tU.GIT_IGNORE)?eS(tU.GIT_IGNORE,"utf-8").split("\n").includes(ta)||eb(tU.GIT_IGNORE,r):eC(tU.GIT_IGNORE,r);n=["Setting up simple-git-hooks"];return[4,tB.simpleGitHooks()];case 4:return[4,eZ.apply(void 0,n.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}D(rf,"setupGitHook");function rp(){return /*#__PURE__*/i(function(){return w(this,function(e){switch(e.label){case 0:return[4,eG([te],{update:!0,postInstallActions:[rf]})];case 1:e.sent();return[2]}})})()}D(rp,"setup");function rm(){return /*#__PURE__*/i(function(){return w(this,function(e){switch(e.label){case 0:eT(tU.NODE_MODULES,tU.PNPM_LOCK_YAML);return[4,eL()];case 1:e.sent();return[4,rf()];case 2:e.sent();return[2]}})})()}D(rm,"reset");function rg(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,tB.nodeModulesInspect()];case 1:return[4,eZ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}D(rg,"inspect");function rE(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,tB.testUnit()];case 1:return[4,eZ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}D(rE,"testUnit");function rv(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,tB.testE2e()];case 1:return[4,eZ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}D(rv,"testE2E");function r_(e){return /*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:t=["Creating MongoDB migration"];return[4,tB.mongoMigrateCreate(e)];case 1:return[4,eZ.apply(void 0,t.concat([r.sent()]))];case 2:r.sent();return[2]}})})()}D(r_,"mongoMigrateCreate");function rh(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,tB.mongoMigrateUp()];case 1:return[4,eZ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}D(rh,"mongoMigrateUp");function ry(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,tB.mongoMigrateDown()];case 1:return[4,eZ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}D(ry,"mongoMigrateDown");(function(){return /*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,rt(re(t9.argv)).scriptName(tp).usage("$0 <command> [options]").command("lint","Check code for linting issues",ru).command("lint:fix","Fix linting issues automatically",rl).command("lint:inspect","View active ESLint configuration",rc).command("lint-staged","Run lint checks on staged files",ra).command("commitlint","Validate commit message format",rd).command("setup","Initialize project setup and dependencies",rp).command("reset","Reset the project and reinstall dependencies",rm).command("inspect","Analyze installed project dependencies",rg).command("test:unit","Run unit test suite",rE).command("test:e2e","Run end-to-end test suite",rv).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return /*#__PURE__*/i(function(){return w(this,function(t){switch(t.label){case 0:if(!e.name){ef.error("Migration name is required.");return[2]}return[4,r_(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",rh).command("mongo:migrate:down","Rollback last MongoDB migration",ry).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(rr.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();ef.error("Fatal: ".concat(e.message)),t9.exit(1);return[3,3];case 3:return[2]}})})()})();import{Router as rS}from"express";import{NestFactory as rO}from"@nestjs/core";import rR from"body-parser";import rI from"compression";import rC from"cookie-parser";import rb from"cors";import rA from"express";import rT from"express-device";import rN from"express-session";function rw(e){var t=e.isDev,r=e.whiteList,n=S(e,["isDev","whiteList"]);return _({origin:D(function(e,n){t||(r===null||r===void 0?void 0:r.includes(e!==null&&e!==void 0?e:""))?n(null,!0):n(new Error("Not allowed by CORS"),!1)},"origin"),credentials:!0},n)}D(rw,"createCorsOptions");function rx(e){return rb(rw(e))}D(rx,"createCors");function rP(e){return rN(e)}D(rP,"createSession");function rD(e){var t=rA();return t.set("trust proxy",1),t.use(rC()),t.use(rA.urlencoded({extended:!0})),t.use(rI()),t.use(rT.capture()),(e===null||e===void 0?void 0:e.staticFolder)&&t.use(rA.static(e.staticFolder)),t}D(rD,"createExpress");function rL(e){return /*#__PURE__*/i(function(){var t,r,n;return w(this,function(s){switch(s.label){case 0:return[4,rO.create(e.module)];case 1:n=s.sent();return[2,(n.getHttpAdapter().getInstance().set("trust proxy",1),n.use(rA.urlencoded({extended:!0})),n.use(rC()),n.use(rI()),n.use(rT.capture()),e.staticFolder&&n.use(rA.static(e.staticFolder)),e.filters&&(t=n).useGlobalFilters.apply(t,b(e.filters)),e.pipes&&(r=n).useGlobalPipes.apply(r,b(e.pipes)),n)]}})})()}D(rL,"createNest");var rG="MONGO_MIGRATE_OPTIONS";import{Collection as rM,Db as rj}from"mongodb";import{Document as rU,Model as rk}from"mongoose";var rF=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rj);D(rF,"C_Db");var rq=rF,rB=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rU);D(rB,"C_Document");var rH=rB,rK=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rk);D(rK,"C_Model");var rY=rK,rV=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rM);D(rV,"C_Collection");var rW=rV;import{format as rQ}from"date-fns";import rz from"migrate-mongo";import{Document as rJ}from"mongoose";import r$ from"mongoose-aggregate-paginate-v2";import rX from"mongoose-paginate-v2";import{v4 as rZ}from"uuid";import r0 from"unorm";var r1={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},r2=Object.entries(r1).reduce(function(e,t){var r=C(t,2),n=r[0],s=r[1];return e[n.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function r4(e){e=r0.nfkc(e);var t=_({},r1,r2);var r=true,n=false,s=undefined;try{for(var i=Object.entries(t)[Symbol.iterator](),o;!(r=(o=i.next()).done);r=true){var a=C(o.value,2),c=a[0],u=a[1];var l="[".concat(c).concat(u.join(""),"]"),d="(".concat([c].concat(b(u)).join("|"),")");e=e.replace(new RegExp(l,"g"),d)}}catch(e){n=true;s=e}finally{try{if(!r&&i.return!=null){i.return()}}finally{if(n){throw s}}}return e}D(r4,"regexSearchMapper");function r3(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}D(r3,"removeAccent");var r5={Date:{is:D(function(e){return p(e,Date)},"is"),serialize:D(function(e){return{__type:"Date",value:e.toISOString()}},"serialize"),deserialize:D(function(e){return new Date(e)},"deserialize")},Map:{is:D(function(e){return p(e,Map)},"is"),serialize:D(function(e){return{__type:"Map",value:Array.from(e.entries())}},"serialize"),deserialize:D(function(e){return new Map(e)},"deserialize")},Set:{is:D(function(e){return p(e,Set)},"is"),serialize:D(function(e){return{__type:"Set",value:Array.from(e)}},"serialize"),deserialize:D(function(e){return new Set(e)},"deserialize")},RegExp:{is:D(function(e){return p(e,RegExp)},"is"),serialize:D(function(e){return{__type:"RegExp",value:{source:e.source,flags:e.flags}}},"serialize"),deserialize:D(function(e){var t=e.source,r=e.flags;return new RegExp(t,r)},"deserialize")},BigInt:{is:D(function(e){return(typeof e==="undefined"?"undefined":A(e))=="bigint"},"is"),serialize:D(function(e){return{__type:"BigInt",value:e.toString()}},"serialize"),deserialize:D(function(e){return BigInt(e)},"deserialize")}},r8={serialize:function e(e){return JSON.stringify(e,function(e,t){var r=true,n=false,s=undefined;try{for(var i=Object.keys(r5)[Symbol.iterator](),o;!(r=(o=i.next()).done);r=true){var a=o.value;var c=r5[a];if(c.is(t))return c.serialize(t)}}catch(e){n=true;s=e}finally{try{if(!r&&i.return!=null){i.return()}}finally{if(n){throw s}}}return t})},deserialize:function e(e){return JSON.parse(e,function(e,t){if(t&&(typeof t==="undefined"?"undefined":A(t))=="object"&&"__type"in t&&typeof t.__type=="string"){var r=t.__type,n=r5[r];if(n)return n.deserialize(t.value)}return t})}};import r6 from"crypto-js";import r7 from"slugify";var r9=r7.default||r7;function ne(e,t){var r=D(function(e){var r,n;return r9(e!==null&&e!==void 0?e:"",_({lower:(r=t===null||t===void 0?void 0:t.lower)!==null&&r!==void 0?r:!0,locale:(n=t===null||t===void 0?void 0:t.locale)!==null&&n!==void 0?n:"vi"},t))},"slugifyWithOptions");if(tY(e)){var n={};var s=true,i=false,o=undefined;try{for(var a=Object.entries(e)[Symbol.iterator](),c;!(s=(c=a.next()).done);s=true){var u=C(c.value,2),l=u[0],d=u[1];n[l]=r(d)}}catch(e){i=true;o=e}finally{try{if(!s&&a.return!=null){a.return()}}finally{if(i){throw o}}}return n}return r(e)}D(ne,"generateSlug");function nt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return r6.SHA256(e).toString(r6.enc.Hex).slice(0,t)}D(nt,"generateShortId");function nr(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:8;var t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+[]{}|;:,.<>?",r="";for(var n=0;n<e;n++){var s=Math.floor(Math.random()*t.length);r+=t.charAt(s)}return r}D(nr,"generateRandomPassword");function nn(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;var r=e.split(/[?#]/)[0]||"",n=r.substring(r.lastIndexOf("/")+1);if(t)return n;var s=n.lastIndexOf(".");return s>0?n.slice(0,s):n}D(nn,"getFileName");function ns(e,t,r){var n=e.indexOf(t);if(n===-1)return"";var s=n+t.length,i=e.indexOf(r,s);return i===-1?"":e.slice(s,i)}D(ns,"substringBetween");var ni={isEmpty:function e(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":A(e))=="object"?p(e,Date)?!1:p(e,Map)||p(e,Set)?e.size===0:p(e,WeakMap)||p(e,WeakSet)?!0:ArrayBuffer.isView(e)?e.byteLength===0:Object.keys(e).length===0:!1},isValidIP:function e(e){var t=e.split(".");return t.length===4&&t.every(function(e){return/^\d+$/.test(e)&&Number(e)>=0&&Number(e)<=255})?!0:/^(([a-f\d]{1,4}:){7}[a-f\d]{1,4}|((?:[a-f\d]{1,4}:){1,7}:)|((?:[a-f\d]{1,4}:){1,6}:[a-f\d]{1,4})|::)$/i.test(e)}};var no={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return rQ(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.returnDateAs,r=t===void 0?"string":t;var n=r==="string"?no.getDateTime():new Date;return{id:rZ(),isDel:!1,createdAt:n,updatedAt:n}},applyPlugins:function e(e,t){t.filter(function(e){return typeof e=="function"}).forEach(function(t){return e.plugin(t)})},applyMiddlewares:function e(e,t){t.forEach(function(t){var r=t.method,n=t.pre,s=t.post;r&&n&&e.pre(r,n),r&&s&&e.post(r,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:rZ,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,r=e.schema,n=e.virtuals,s=n===void 0?[]:n,i=e.standalone,o=i===void 0?!1:i;var a=new t.Schema(r,{strict:!0});return s.forEach(function(e){var t=e.name,r=e.options,n=e.get;var s=a.virtual(t,r);n&&s.get(n)}),o||a.add(no.createGenericSchema(t)),a},createModel:function e(e){var t=e.mongoose,r=e.name,n=e.schema,s=e.pagination,i=s===void 0?!1:s,o=e.aggregate,a=o===void 0?!1:o,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,d=l===void 0?[]:l;if(!r)throw new Error("Model name is required.");if(t.models[r])return t.models[r];var f=no.createSchema({mongoose:t,schema:n,virtuals:u});return no.applyPlugins(f,[i&&rX,a&&r$]),no.applyMiddlewares(f,d),t.model(r,f)},validator:{isEmpty:function e(){return function(e){return /*#__PURE__*/i(function(){return w(this,function(t){return[2,!ni.isEmpty(e)]})})()}},isUnique:function e(e){return function(t){return /*#__PURE__*/i(function(){var r;return w(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");r={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.exists(r)];case 1:return[2,!n.sent()]}})}).call(this)}},matchesRegex:function e(e){return function(t){return /*#__PURE__*/i(function(){return w(this,function(r){if(!Array.isArray(e)||e.some(function(e){return!p(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(t)})]})})()}}},migrate:y(_({},rz),{setConfig:D(function(e){var t="// This file is automatically generated by the Cyberskill CLI.\nmodule.exports = ".concat(JSON.stringify(e,null,4));eC(tU.MIGRATE_MONGO_CONFIG,t);var r="\n".concat(td,"\n");eA(tU.GIT_IGNORE)?eS(tU.GIT_IGNORE,"utf-8").split("\n").includes(td)||eb(tU.GIT_IGNORE,r):eC(tU.GIT_IGNORE,r)},"setConfig")})},na=/*#__PURE__*/function(){"use strict";function e(t,r){a(this,e);L(this,"collection");this.collection=t.collection(r)}u(e,[{key:"createOne",value:function e(e){return /*#__PURE__*/i(function(){var t,r,n;return w(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=_({},no.createGenericFields(),e);r={success:!0,message:"Document created successfully"};return[4,this.collection.insertOne(t)];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return /*#__PURE__*/i(function(){var t,r,n;return w(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=e.map(function(e){return _({},no.createGenericFields(),e)});return[4,this.collection.insertMany(t)];case 1:r=s.sent();return[2,r.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(r.insertedCount," documents created successfully"),result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"findOne",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,this.collection.findOne(e)];case 1:t=n.sent();return[2,t?{success:!0,message:"Document found",result:t}:{success:!1,message:"Document not found"}];case 2:r=n.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"findAll",value:function e(){return /*#__PURE__*/i(function(){var e,t,r;var n=arguments;return w(this,function(s){switch(s.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Documents retrieved successfully"};return[4,this.collection.find(e).toArray()];case 2:return[2,(t.result=s.sent(),t)];case 3:r=s.sent();return[2,{success:!1,message:r.message}];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return /*#__PURE__*/i(function(){var e,t,r;var n=arguments;return w(this,function(s){switch(s.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Count retrieved successfully"};return[4,this.collection.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:r=s.sent();return[2,{success:!1,message:r.message}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(e,t){return /*#__PURE__*/i(function(){var r,n;return w(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateOne(e,{$set:t})];case 1:r=s.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"updateMany",value:function e(e,t){return /*#__PURE__*/i(function(){var r,n;return w(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateMany(e,{$set:t})];case 1:r=s.sent();return[2,r.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"deleteOne",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,this.collection.deleteOne(e)];case 1:t=n.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:t}];case 2:r=n.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"deleteMany",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,this.collection.deleteMany(e)];case 1:t=n.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:t}];case 2:r=n.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}}]);return e}();D(na,"MongoController");var nc=na,nu=/*#__PURE__*/function(){"use strict";function e(t){a(this,e);L(this,"model");this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(e){return /*#__PURE__*/i(function(){var e,t,r,n,s,i,o;var a=arguments;return w(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},r=a.length>2&&a[2]!==void 0?a[2]:{},n=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.findOne(e,t,r);n&&s.populate(n);return[4,s.exec()];case 2:i=c.sent();return[2,i?{success:!0,result:i}:{success:!1,message:"No ".concat(this.getModelName()," found."),code:ec.NOT_FOUND.CODE}];case 3:o=c.sent();return[2,{success:!1,message:o.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findAll",value:function e(e){return /*#__PURE__*/i(function(){var e,t,r,n,s,i,o;var a=arguments;return w(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},r=a.length>2&&a[2]!==void 0?a[2]:{},n=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.find(e,t,r);n&&s.populate(n);i={success:!0};return[4,s.exec()];case 2:return[2,(i.result=c.sent(),i)];case 3:o=c.sent();return[2,{success:!1,message:o.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPaging",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);r={success:!0};return[4,this.model.paginate(e,t)];case 2:return[2,(r.result=i.sent(),r)];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPagingAggregate",value:function e(e){return /*#__PURE__*/i(function(e){var t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);r={success:!0};return[4,this.model.aggregatePaginate(this.model.aggregate(e),t)];case 2:return[2,(r.result=i.sent(),r)];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return /*#__PURE__*/i(function(){var e,t,r;var n=arguments;return w(this,function(s){switch(s.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0};return[4,this.model.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:r=s.sent();return[2,{success:!1,message:r.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"createOne",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);t={success:!0};return[4,this.model.create(e)];case 1:return[2,(t.result=n.sent(),t)];case 2:r=n.sent();return[2,{success:!1,message:r.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return /*#__PURE__*/i(function(e){var t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);r={success:!0};return[4,this.model.insertMany(e,t)];case 2:return[2,(r.result=i.sent().map(function(e){return p(e,rJ)?e.toObject():null}).filter(function(e){return e!==null}),r)];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n,s;var i=arguments;return w(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},r=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);return[4,this.model.findOneAndUpdate(e,t,_({new:!0},r)).exec()];case 2:n=o.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"Failed to update ".concat(this.getModelName(),"."),code:ec.NOT_FOUND.CODE}];case 3:s=o.sent();return[2,{success:!1,message:s.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateMany",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n,s;var i=arguments;return w(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},r=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);n={success:!0};return[4,this.model.updateMany(e,t,r).exec()];case 2:return[2,(n.result=o.sent(),n)];case 3:s=o.sent();return[2,{success:!1,message:s.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteOne",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.findOneAndDelete(e,t).exec()];case 2:r=i.sent();return[2,r?{success:!0,result:r}:{success:!1,message:"No ".concat(this.getModelName()," found to delete."),code:ec.NOT_FOUND.CODE}];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteMany",value:function e(){return /*#__PURE__*/i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.deleteMany(e,t).exec()];case 2:r=i.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents found to delete.",code:ec.NOT_FOUND.CODE}:{success:!0,result:r}];case 3:n=i.sent();return[2,{success:!1,message:n.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return /*#__PURE__*/i(function(){var r,n,s,i;return w(this,function(o){switch(o.label){case 0:r=new Set;n=0;o.label=1;case 1:if(!(n<10))return[3,5];s=nt(e,n+t);i=!r.has(s);if(!i)return[3,3];r.add(s);return[4,this.model.exists({shortId:s})];case 2:i=!o.sent();o.label=3;case 3:if(i)return[2,{success:!0,result:s}];o.label=4;case 4:n++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:ec.INTERNAL_SERVER_ERROR.CODE}]}})}).call(this)}},{key:"createSlug",value:function e(e,t,r){return /*#__PURE__*/i(function(){var n,s,o,a,c,u,d,f,p,m;return w(this,function(g){switch(g.label){case 0:n=this;g.label=1;case 1:g.trys.push([1,5,,6]);s=t[e],o=tY(s),a=D(function(t){var n=_({},r!==null&&r!==void 0?r:{});return o?y(_({},n),{$or:[l({},"slug.".concat(e),t),{slugHistory:{$elemMatch:l({},"slug.".concat(e),t)}}]}):y(_({},n),{$or:[{slug:t},{slugHistory:t}]})},"generateSlugQuery"),c=D(function(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:t=e,r=1;n.label=1;case 1:return[4,this.model.exists(a(t))];case 2:if(!n.sent())return[3,4];t="".concat(e,"-").concat(r++);n.label=3;case 3:return[3,1];case 4:return[2,t]}})}).call(n)},"generateUniqueSlug");if(!o)return[3,3];u={success:!0};d=Object.fromEntries;return[4,Promise.all(Object.entries(s).map(function(e){var t=C(e,2),r=t[0],n=t[1];return /*#__PURE__*/i(function(){var e,t;return w(this,function(s){switch(s.label){case 0:e=ne(n);t=[r];return[4,c(e)];case 1:return[2,t.concat([s.sent()])]}})})()}))];case 2:return[2,(u.result=d.apply(Object,[g.sent()]),u)];case 3:f=ne(s);p={success:!0};return[4,c(f)];case 4:return[2,(p.result=g.sent(),p)];case 5:m=g.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(m.message),code:ec.INTERNAL_SERVER_ERROR.CODE}];case 6:return[2]}})}).call(this)}},{key:"aggregate",value:function e(e){return /*#__PURE__*/i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);t={success:!0};return[4,this.model.aggregate(e)];case 1:return[2,(t.result=n.sent(),t)];case 2:r=n.sent();return[2,{success:!1,message:r.message,code:ec.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})}).call(this)}}]);return e}();D(nu,"MongooseController");var nl=nu;import{useServer as nd}from"graphql-ws/use/ws";import{WebSocketServer as nf}from"ws";function np(e){return new nf({server:e.server,path:e.path})}D(np,"createWSServer");function nm(e){return nd({schema:e.schema},e.server)}D(nm,"initGraphQLWS");import{ApolloClient as ng,ApolloError as nE,ApolloLink as nv,ApolloProvider as n_,from as nh,HttpLink as ny,InMemoryCache as nS,split as nO}from"@apollo/client";import{onError as nR}from"@apollo/client/link/error";import{removeTypenameFromVariables as nI}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as nC}from"@apollo/client/link/subscriptions";import{getMainDefinition as nb}from"@apollo/client/utilities";import{createClient as nA}from"graphql-ws";import nT,{useMemo as nN}from"react";import{FaInfo as nw}from"react-icons/fa6";import nx,{use as nP}from"react";import{FaRepeat as nD}from"react-icons/fa6";import{createContext as nL}from"react";var nG=nL(void 0);import nM from"./react/apollo-error/apollo-error.module.scss";function nj(){var e=nP(nG),t=e===null||e===void 0?void 0:e.error;if(!t)return null;var r=D(function(e,t){return(t===null||t===void 0?void 0:t.length)?nx.createElement("div",null,nx.createElement("strong",null,e,":"),nx.createElement("ul",null,t.map(function(e){return nx.createElement("li",{key:e.message},e.message)}))):null},"renderErrorList");return nx.createElement("div",{className:nM["modal-backdrop"]},nx.createElement("div",{className:nM["modal-content"]},nx.createElement("button",{type:"button",className:nM["btn-close"],onClick:e.hideError},"✕"),nx.createElement("div",{className:nM["error-title"]},nx.createElement("button",{type:"button",className:nM["btn-retry"],onClick:D(function(){return window.location.reload()},"onClick")},nx.createElement(nD,null))," ",t.message),nx.createElement("div",{className:nM["error-details"]},t.networkError&&nx.createElement("pre",{className:"network"},nx.createElement("strong",null,"Network Error:")," ",t.networkError.message),r("GraphQL Errors",b(t.graphQLErrors)),r("Protocol Errors",b(t.protocolErrors)),r("Client Errors",b(t.clientErrors)),t.extraInfo&&nx.createElement("pre",{className:"extra"},nx.createElement("strong",null,"Extra Info:")," ",JSON.stringify(t.extraInfo,null,4)))))}D(nj,"ApolloError");import{use as nU}from"react";function nk(){var e=nU(nG);if(!e)throw new Error("useApolloError must be used within ApolloErrorProvider");return e}D(nk,"useApolloError");import nF,{useEffect as nq,useMemo as nB,useState as nH}from"react";var nK=null;function nY(e){nK=e}D(nY,"setGlobalApolloErrorCallback");function nV(e){nK===null||nK===void 0?void 0:nK(e)}D(nV,"showGlobalApolloError");function nW(e){var t=e.children;var r=C(nH(null),2),n=r[0],s=r[1];nq(function(){nY(s)},[]);var i=nB(function(){return{error:n,showError:s,hideError:D(function(){return s(null)},"hideError")}},[n]);return nF.createElement(nG,{value:i},t)}D(nW,"ApolloErrorProvider");import{consola as nQ}from"consola/browser";var nz={silent:nQ.silent,level:nQ.level,fatal:nQ.fatal,error:nQ.error,warn:nQ.warn,log:nQ.log,info:nQ.info,success:nQ.success,ready:nQ.ready,start:nQ.start,box:nQ.box,debug:nQ.debug,trace:nQ.trace,verbose:nQ.verbose};import{toast as nJ,Toaster as n$}from"react-hot-toast";var nX="/graphql";var nZ,n0=(nZ=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);var e;e=o(this,t,arguments);L(e,"count",0);return e}u(t,[{key:"request",value:function e(e,t){var r=this;var n=Date.now();return this.count+=1,t(e).map(function(t){var s=Date.now()-n,i=e.operationName||"Unnamed";return nz.info("[Apollo] #".concat(r.count,": ").concat(i," (").concat(s,"ms)")),t})}}]);return t}(nv),D(nZ,"DevLoggerLink"),nZ);function n1(e){var t=e.uri,r=e.wsUrl,n=e.customLinks,s=new n0,i=nR(function(e){var t=e.graphQLErrors,r=e.networkError,n=e.protocolErrors,s=e.operation;var i=(s===null||s===void 0?void 0:s.operationName)||"Unknown";if(t&&t.forEach(function(e){var t=e.message,r=e.locations,n=e.path;nz.error("[GraphQL error] ".concat(i,": ").concat(t,", Location: ").concat(JSON.stringify(r,null,4),", Path: ").concat(n))}),n&&n.forEach(function(e){var t=e.message,r=e.extensions;nz.error("[Protocol error]: ".concat(t,", Extensions: ").concat(JSON.stringify(r,null,4)))}),r&&nz.error("[Network error]: ".concat(r)),t||n||r){var o,a;var c=(t===null||t===void 0?void 0:(o=t[0])===null||o===void 0?void 0:o.message)||(n===null||n===void 0?void 0:(a=n[0])===null||a===void 0?void 0:a.message)||(r===null||r===void 0?void 0:r.message)||"Unexpected error",u=new nE({graphQLErrors:t||[],protocolErrors:n||[],clientErrors:[],networkError:r||null,errorMessage:c,extraInfo:{operation:s}});nJ.error(function(e){return nT.createElement(nT.Fragment,null,c,"\xa0",nT.createElement(nw,{cursor:"pointer",onClick:D(function(){setTimeout(function(){nV(u)},0),nJ.dismiss(e.id)},"onClick")}))})}}),o=nI();t||nz.warn('[Apollo] No GraphQL URI provided — using "'.concat(nX,'" as default'));var a=new ny({uri:t!==null&&t!==void 0?t:nX,credentials:"include"}),c=r?new nC(nA({url:r})):nv.empty(),u=p(c,nv)?nO(function(e){var t=e.query;var r=nb(t);return r.kind==="OperationDefinition"&&r.operation==="subscription"},c,a):a;return u===a&&r&&nz.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[s,i,o].concat(b(n!==null&&n!==void 0?n:[]),[u])}D(n1,"createApolloLinks");function n2(e){var t=e.isNextJS,r=e.options,n=e.children,s=e.client,i=e.provider,o=e.cache;var a=r||{},c=a.uri,u=a.wsUrl,l=a.customLinks,d=S(a,["uri","wsUrl","customLinks"]),f=s!==null&&s!==void 0?s:ng;if(typeof f!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var m=i||n_,g=nN(function(){return nh(n1({uri:c!==null&&c!==void 0?c:nX,wsUrl:u!==null&&u!==void 0?u:"",customLinks:l!==null&&l!==void 0?l:[]}))},[c,u,l]),E=nN(function(){return p(o,nS)?o:new nS},[o]),v=nN(function(){return new f(_({link:g,cache:E},d))},[f,g,E,d]),h=t?nT.createElement(m,{makeClient:D(function(){return v},"makeClient")},n):nT.createElement(m,{client:v},n);return nT.createElement(nT.Fragment,null,nT.createElement(nW,null,h,nT.createElement(nj,null)),nT.createElement(n$,{position:"top-right"}))}D(n2,"ApolloProvider");import{useTranslation as n4}from"react-i18next";var n3=n4;import n5 from"i18next";import{initReactI18next as n8}from"react-i18next";function n6(e){return n5.use(n8).init(e)}D(n6,"initI18next");import n7 from"classnames";import n9 from"react";import se from"./react/loading/loading.module.scss";function st(e){var t=e.full,r=t===void 0?!1:t,n=e.block,s=n===void 0?!1:n,i=e.className,o=i===void 0?"":i,a=e.message,c=a===void 0?"Loading":a,u=S(e,["full","block","className","message"]);function l(){return n9.createElement("div",_({className:se.container},u),n9.createElement("div",{className:se.ring}),n9.createElement("div",{className:se.ring}),n9.createElement("div",{className:se.ring}),n9.createElement("div",{className:se.ring}),c&&n9.createElement("div",{className:se.message},c))}return D(l,"_renderLoading"),r?n9.createElement("div",{className:n7(se.fullscreen,o)},l()):s?n9.createElement("div",{className:n7(se.block,o)},l()):l()}D(st,"Loading");import{createContext as sr}from"react";var sn=sr(void 0);import{use as ss}from"react";function si(){var e=ss(sn);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}D(si,"useLoading");import so,{useCallback as sa,useMemo as sc,useState as su}from"react";function sl(e){var t=e.children;var r=C(su(!1),2),n=r[0],s=r[1],i=C(su(!1),2),o=i[0],a=i[1],c=sa(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;s(!0),a(e)},[]),u=sa(function(){s(!1),a(!1)},[]),l=sc(function(){return{isLoading:n,isGlobalLoading:o,showLoading:c,hideLoading:u}},[n,o,c,u]);return so.createElement(sn,{value:l},n?so.createElement(st,{full:o}):t)}D(sl,"LoadingProvider");import{enUS as sd}from"date-fns/locale";var sf={label:"English",value:"en",flag:"\uD83C\uDDFA\uD83C\uDDF8",adapterLocale:sd,icon:"flagpack:gb-nir",numberFormat:{code:"en-US",currency:"USD"},timezone:"America/New_York"};import{createContext as sp}from"react";var sm=sp(void 0);import{NextIntlClientProvider as sg}from"next-intl";import sE from"react";import{useTranslations as sv}from"next-intl";import{use as s_}from"react";function sh(){var e=s_(sm);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}D(sh,"useNextIntl");var sy=sv;function sS(e){var t=D(function(t){var r;var n;var s=sh(),i=s.currentLanguage,o=t.messages,a=t.languages,c="en",u=o[(i===null||i===void 0?void 0:i.value)||c],l=(n=(r=a.find(function(e){return e.value===(i===null||i===void 0?void 0:i.value)}))===null||r===void 0?void 0:r.timezone)!==null&&n!==void 0?n:sf.timezone;return o?sE.createElement(sg,{locale:(i===null||i===void 0?void 0:i.value)||c,messages:u||null,timeZone:l},sE.createElement(e,t)):(nz.warn("Missing messages for language: ".concat((i===null||i===void 0?void 0:i.value)||c)),null)},"PageWithI18n");return t.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),t}D(sS,"withNextIntl");import sO,{useMemo as sR}from"react";import{useCallback as sI,useEffect as sC,useState as sb}from"react";import sA from"localforage";var sT={get:function e(e){return /*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sA.getItem(e)];case 1:return[2,r.sent()];case 2:t=r.sent();return[2,(nz.error('[Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 3:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/i(function(){var r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,sA.setItem(e,t)];case 1:n.sent();return[3,3];case 2:r=n.sent();nz.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},remove:function e(e){return /*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sA.removeItem(e)];case 1:r.sent();return[3,3];case 2:t=r.sent();nz.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},keys:function e(){return /*#__PURE__*/i(function(){var e,t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sA.keys()];case 1:return[2,(e=r.sent())!==null&&e!==void 0?e:[]];case 2:t=r.sent();return[2,(nz.error("[Storage:keys] Error getting keys:",t),[])];case 3:return[2]}})})()}};function sN(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r8;var n=C(sb(t),2),s=n[0],o=n[1],a=C(sb(!1),2),c=a[0],u=a[1];sC(function(){var n=!0;return D(function(){return /*#__PURE__*/i(function(){var s,i,a,c;return w(this,function(l){switch(l.label){case 0:l.trys.push([0,6,7,8]);return[4,sT.get(e)];case 1:s=l.sent();if(!n)return[3,5];if(!(s!==null))return[3,2];i=r.deserialize(s);o(i);return[3,5];case 2:if(!(t!==void 0))return[3,4];a=r.serialize(t);return[4,sT.set(e,a)];case 3:l.sent(),o(t);return[3,5];case 4:o(void 0);l.label=5;case 5:return[3,8];case 6:c=l.sent();nz.error('Error loading value for key "'.concat(e,'":'),c),n&&o(t);return[3,8];case 7:n&&u(!0);return[7];case 8:return[2]}})})()},"loadValue")(),function(){n=!1,u(!1)}},[e,t,r]),sC(function(){if(!c)return;D(function(){return /*#__PURE__*/i(function(){var t,n;return w(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);if(!(s!==void 0))return[3,2];t=r.serialize(s);return[4,sT.set(e,t)];case 1:i.sent();i.label=2;case 2:return[3,4];case 3:n=i.sent();nz.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},"saveValue")()},[s,e,r,c]);var l=sI(function(e){o(function(t){return typeof e=="function"?e(t):e})},[]),d=sI(function(){return /*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,sT.remove(e)];case 1:r.sent(),o(void 0);return[3,3];case 2:t=r.sent();nz.error('Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},[e]);return{value:s,set:l,remove:d}}D(sN,"useStorage");function sw(e){var t=e.children;return sO.createElement(sO.Fragment,null,t)}D(sw,"LanguageWrapperBase");var sx=sS(sw);function sP(e){var t=e.children,r=e.languages,n=e.messages;var s=sN("lang",r[0]),i=s.value,o=s.set,a=sR(function(){return{languages:r,currentLanguage:i!==null&&i!==void 0?i:sf,setCurrentLanguage:o}},[r,o,i]);return sO.createElement(sm,{value:a},sO.createElement(sx,{languages:r,messages:n},t))}D(sP,"NextIntlProvider");export{nj as ApolloError,nG as ApolloErrorContext,nW as ApolloErrorProvider,n2 as ApolloProvider,tr as BUILD_DIRECTORY,ep as CHECK_PACKAGE_EMPTY_RESULT,tS as COMMIT_LINT_CLI,ty as COMMIT_LINT_PACKAGE_NAME,tp as CYBERSKILL_CLI,tm as CYBERSKILL_CLI_PATH,tf as CYBERSKILL_DIRECTORY,te as CYBERSKILL_PACKAGE_NAME,H as CYBERSKILL_STORAGE_DIRECTORY,rW as C_Collection,rq as C_Db,rH as C_Document,rY as C_Model,tE as ESLINT_CLI,tD as ESLINT_INSPECT_CLI,tP as ESLINT_INSPECT_PACKAGE_NAME,tg as ESLINT_PACKAGE_NAME,ee as E_CommandType,M as E_ConfigType,es as E_IssueType,tA as GIT_CLI,tl as GIT_COMMIT_EDITMSG,tu as GIT_HOOK,to as GIT_IGNORE,nX as GRAPHQL_URI_DEFAULT,t2 as IS_BROWSER,tR as LINT_STAGED_CLI,tO as LINT_STAGED_PACKAGE_NAME,st as Loading,sn as LoadingContext,sl as LoadingProvider,tj as MIGRATE_MONGO_CLI,td as MIGRATE_MONGO_CONFIG,tM as MIGRATE_MONGO_PACKAGE_NAME,rG as MONGO_MIGRATE_OPTIONS,nc as MongoController,nl as MongooseController,sf as NEXT_INTL_DEFAULT_LANGUAGE,tt as NODE_MODULES,tG as NODE_MODULES_INSPECT_CLI,tL as NODE_MODULES_INSPECT_PACKAGE_NAME,sm as NextIntlContext,sP as NextIntlProvider,tn as PACKAGE_JSON,ts as PACKAGE_LOCK_JSON,tU as PATH,t_ as PLAYWRIGHT_PACKAGE_NAME,tT as PNPM_CLI,tN as PNPM_EXEC_CLI,tc as PNPM_LOCK_YAML,ec as RESPONSE_STATUS,rS as Router,tw as SIMPLE_GIT_HOOKS_PACKAGE_NAME,tx as SIMPLE_GIT_HOOK_CLI,ta as SIMPLE_GIT_HOOK_JSON,ti as TSCONFIG_JSON,tC as TSC_CLI,tI as TSC_PACKAGE_NAME,tb as TSX_CLI,n$ as Toaster,th as VITEST_CLI,tv as VITEST_PACKAGE_NAME,e9 as WORKING_DIRECTORY,r$ as aggregatePaginate,eb as appendFileSync,rR as bodyParser,eD as checkPackage,eY as clearAllErrorLists,tB as command,G as commitlintConfig,eN as copySync,t7 as createApolloServer,rx as createCors,rw as createCorsOptions,rD as createExpress,tk as createGitHooksConfig,t0 as createGraphqlCodegenConfig,rL as createNest,rP as createSession,np as createWSServer,tV as deepMerge,tQ as eslintConfig,rA as express,t3 as expressMiddleware,e$ as formatCommand,ev as fs,nr as generateRandomPassword,nt as generateShortId,ne as generateSlug,Z as getEnv,nn as getFileName,eP as getLatestPackageVersion,ex as getPackage,eK as getStoredErrorLists,nm as initGraphQLWS,n6 as initI18next,eL as installDependencies,tK as isJson,tY as isObject,e6 as join,t1 as lintStagedConfig,X as loadEnvFile,nz as log,ef as logNodeJS,e_ as lstatSync,tX as mergeConfigs,ey as mkdirSync,no as mongo,rX as mongoosePaginate,e3 as path,eA as pathExistsSync,ez as rawCommand,eS as readFileSync,eI as readJsonSync,eh as readdirSync,r4 as regexSearchMapper,r3 as removeAccent,eT as removeSync,e8 as resolve,eX as resolveCommands,e5 as resolveWorkingPath,eZ as runCommand,r8 as serializer,nY as setGlobalApolloErrorCallback,eG as setupPackages,nV as showGlobalApolloError,eR as statSync,sT as storage,ek as storageNodeJS,ns as substringBetween,el as throwError,nJ as toast,eO as unlinkSync,nk as useApolloError,si as useLoading,sh as useNextIntl,sN as useStorage,n3 as useTranslateI18next,sy as useTranslateNextIntl,ni as validate,F as vitestE2E,tH as vitestUnit,sS as withNextIntl,eC as writeFileSync};