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