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