@cyberskill/shared 1.89.0 → 1.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,i,s,o){try{var a=e[s](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,i)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(i,s){var o=e.apply(t,n);function a(e){r(o,i,s,a,c,"next",e)}function c(e){r(o,i,s,a,c,"throw",e)}a(undefined)})}}function s(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var i=true;var s=false;var o,a;try{for(n=n.call(e);!(i=(o=n.next()).done);i=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){s=true;a=e}finally{try{if(!i&&n["return"]!=null)n["return"]()}finally{if(s)throw a}}return r}function c(){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 u(){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(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){s(e,t,n[t])})}return e}function d(e,n){return t(e)||a(e,n)||g(e,n)||c()}function p(e){return n(e)||o(e)||g(e)||u()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function y(e,t){var n,r,i,s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(s=0)),s)try{if(n=1,r&&(i=a[0]&2?r["return"]:a[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;if(r=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:s.label++;return{value:a[1],done:false};case 5:s.label++;r=a[1];a=[0];continue;case 7:a=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){s=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(a[0]===6&&s.label<i[1]){s.label=i[1];i=a;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(a);break}if(i[2])s.ops.pop();s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e];r=0}finally{n=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var h=Object.create;var v=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var w=function(e,t){return v(e,"name",{value:t,configurable:!0})};var I=function(e,t,n,r){var i=true,s=false,o=undefined;if(t&&(typeof t==="undefined"?"undefined":f(t))=="object"||typeof t=="function")try{var a=function(){var i=u.value;!b.call(e,i)&&i!==n&&v(e,i,{get:function(){return t[i]},enumerable:!(r=m(t,i))||r.enumerable})};for(var c=j(t)[Symbol.iterator](),u;!(i=(u=c.next()).done);i=true)a()}catch(e){s=true;o=e}finally{try{if(!i&&c.return!=null){c.return()}}finally{if(s){throw o}}}return e};var S=function(e,t,n){return n=e!=null?h(x(e)):{},I(t||!e||!e.__esModule?v(n,"default",{value:e,enumerable:!0}):n,e)},E=function(e){return I(v({},"__esModule",{value:!0}),e)};var O={};module.exports=E(O);var k=S(require("process"),1),_=require("yargs/helpers"),C=S(require("yargs/yargs"),1);var T={name:"@cyberskill/shared",type:"module",version:"1.88.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/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.7","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.47.4","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.3.0","@swc/core":"1.11.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",consola:"3.4.2","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0","eslint-config-next":"15.3.0","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.0",jsdom:"26.1.0",localforage:"1.10.0","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.51.1","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.2.6",vitest:"3.1.1","vitest-browser-react":"0.1.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/crypto-js":"4.2.2","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.1","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var q=function(e){return e.CLI="CLI",e.RAW="RAW",e}({});var L=require("child_process"),P=S(require("process"),1),N=S(require("util"),1);var G=S(require("process"),1),A=G.default.env.DEBUG==="true";var R=function(e){return e.Error="error",e.Warning="warning",e}({});var D=S(require("chalk"),1),F=S(require("consola"),1),M=require("graphql");A||(F.default.level=4);function W(e){var t=D.default[e];return typeof t=="function"?t:D.default.green}w(W,"chalkKeyword");var U={silent:F.default.silent,level:F.default.level,fatal:F.default.fatal,error:F.default.error,warn:F.default.warn,log:F.default.log,info:F.default.info,success:F.default.success,ready:F.default.ready,start:F.default.start,box:F.default.box,debug:F.default.debug,trace:F.default.trace,verbose:F.default.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){F.default.box(D.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,i=e.rule,s=e.message;F.default.log("".concat(D.default.gray("File:")," ").concat(D.default.blue("".concat(t).concat(r?":".concat(r):"")))),i&&F.default.log(" ".concat(W(n)("Rule:")," ").concat(i)),F.default.log(" ".concat(W(n)("Message:")," ").concat(s))}),F.default.box(W(n)("".concat(e," : ").concat(t.length))),F.default.log(D.default.gray("─".repeat(40)))}};var J={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var K=S(require("node-fetch"),1);var B=S(require("fs"),1);function H(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return B.existsSync(e)})}w(H,"existsSync");function Y(e,t){var n=B.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":f(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}w(Y,"readFileSync");function $(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);B.writeFileSync(e,s,"utf-8")}w($,"writeFileSync");function V(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);B.appendFileSync(e,s,"utf-8")}w(V,"appendFileSync");function z(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){H(e)&&B.rmSync(e,{recursive:!0,force:!0})})}w(z,"rmSync");var Q=S(require("process"),1);var X=S(require("path"),1);function Z(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=X).resolve.apply(r,[et].concat(p(t)))}w(Z,"resolveWorkingPath");function ee(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=X).join.apply(r,p(t))}w(ee,"join");var et=Q.default.env.INIT_CWD||Q.default.cwd(),en="@cyberskill/shared",er=".cyberskill-storage",ei="node_modules",es="dist",eo="package.json",ea="package-lock.json",ec="tsconfig.json",eu=".gitignore",el=".simple-git-hooks.json",ed="pnpm-lock.yaml",ep=".git/hooks/",ef=".git/COMMIT_EDITMSG",eg=ee(et,ei,en,es),ey="cyberskill",eh="src/nodejs/cli/index.ts",ev="eslint",em="eslint",ej="vitest",ex="playwright",eb="vitest",ew="@commitlint/cli",eI="commitlint",eS="lint-staged",eE="lint-staged",eO="typescript",ek="tsc",e_="tsx",eC="git",eT="pnpm",eq="pnpm exec",eL="simple-git-hooks",eP="simple-git-hooks",eN="@eslint/config-inspector",eG="eslint-config-inspector",eA="node-modules-inspector",eR="node-modules-inspector",eD={CYBERSKILL_DIRECTORY:eg,WORKING_DIRECTORY:et,TS_CONFIG:Z(ec),GIT_IGNORE:Z(eu),GIT_HOOK:Z(ep),GIT_COMMIT_MSG:Z(ef),SIMPLE_GIT_HOOKS_JSON:Z(el),PACKAGE_JSON:Z(eo),PACKAGE_LOCK_JSON:Z(ea),PNPM_LOCK_YAML:Z(ed),NODE_MODULES:Z(ei),LINT_STAGED_CONFIG:Z("".concat(eg,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:Z("".concat(eg,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:Z("".concat(eg,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:Z("".concat(eg,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:Z("".concat(eg,"/react/vitest/vitest.e2e.js"))};function eF(e){var t=e.isCurrentProject;return l({"pre-commit":eE,"commit-msg":eI},t&&{"pre-push":tc("".concat(eC," pull"))})}w(eF,"HOOK");function eM(e){return eW.apply(this,arguments)}function eW(){eW=i(function(e){var t,n,r,i,s,o;var a=arguments;return y(this,function(c){switch(c.label){case 0:for(t=a.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=a[r]}i=d(n,2),s=i[0],o=i[1];if(!s)throw new Error("'first' argument is undefined");switch(e){case q.CLI:return[3,1];case q.RAW:return[3,3]}return[3,4];case 1:return[4,eQ(s.split(" "),{update:!0})];case 2:return[2,(c.sent(),tl(tc("".concat(eq," ").concat(o))))];case 3:return[2,tl(tc(s))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eW.apply(this,arguments)}w(eM,"buildCommand");function eU(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/i(function(){return y(this,function(t){return[2,eM.apply(void 0,[e].concat(p(n)))]})})}w(eU,"commandFactory");var eJ={simpleGitHooks:eU(q.CLI,eL,eP),eslintInspect:eU(q.CLI,eN,eG),nodeModulesInspect:eU(q.CLI,eA,eR),eslintCheck:eU(q.CLI,ev,"".concat(em," ").concat(eD.WORKING_DIRECTORY)),eslintFix:eU(q.CLI,ev,"".concat(em," ").concat(eD.WORKING_DIRECTORY," --fix")),typescriptCheck:eU(q.CLI,eO,"".concat(ek," -p ").concat(eD.TS_CONFIG," --noEmit")),configureGitHook:eU(q.RAW,"".concat(eC," config core.hooksPath ").concat(eD.GIT_HOOK)),testUnit:eU(q.CLI,ej,"".concat(eb," --config ").concat(eD.UNIT_TEST_CONFIG)),testE2e:eU(q.CLI,"".concat(ej," ").concat(ex),"".concat(eb," --config ").concat(eD.E2E_TEST_CONFIG)),commitLint:eU(q.CLI,ew,"".concat(eI," --edit ").concat(eD.GIT_COMMIT_MSG," --config ").concat(eD.COMMITLINT_CONFIG)),lintStaged:eU(q.CLI,eS,"".concat(eE," --config ").concat(eD.LINT_STAGED_CONFIG)),stageBuildDirectory:eU(q.RAW,"".concat(eC," add ").concat(es)),build:eU(q.RAW,"".concat(eT," run build")),pnpmInstallStandard:eU(q.RAW,"".concat(eT," install")),pnpmInstallLegacy:eU(q.RAW,"".concat(eT," install --legacy-peer-deps")),pnpmInstallForce:eU(q.RAW,"".concat(eT," install --force"))};function eK(e){var t=ee(et,eo);if(!H(t))return!1;try{var n=Y(t,{asJson:!0}),r=n.name,i=n.dependencies,s=i===void 0?{}:i,o=n.devDependencies,a=o===void 0?{}:o,c=r===e,u=e in s,l=e in a;return c||u||l?{path:t,file:n,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return U.warn("Failed to read package.json: ".concat(e.message)),!1}}w(eK,"getPackage");function eB(e){return eH.apply(this,arguments)}function eH(){eH=i(function(e){var t,n,r,i;return y(this,function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);return[4,(0,K.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=s.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=s.sent(),r=n.version;return[2,r];case 3:i=s.sent();throw U.error('Failed to fetch version for "'.concat(e,'": ').concat(i.message)),i;case 4:return[2]}})});return eH.apply(this,arguments)}w(eB,"getLatestPackageVersion");function eY(e,t){return e$.apply(this,arguments)}function e$(){e$=i(function(e,t){var n,r,i,s,o,a,c,u,d,p,f,g,h,v,m,j,x,b,w,I,S;return y(this,function(y){switch(y.label){case 0:y.trys.push([0,4,,5]);n=eK(e);if(!n)return[2,l({},J)];c=n.path,u=n.file,d=n.isCurrentProject,p=n.isDepend,f=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},h=(i=u.devDependencies)!==null&&i!==void 0?i:{},v=d?(s=u.version)!==null&&s!==void 0?s:"0.0.0":p?(o=g[e])!==null&&o!==void 0?o:"0.0.0":f?(a=h[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!d)return[3,1];x=v;return[3,3];case 1:return[4,eB(e)];case 2:x=y.sent();y.label=3;case 3:m=x,j=d||v===m;if(!j&&(t===null||t===void 0?void 0:t.update)){;w=p?"dependencies":f?"devDependencies":null;w&&((b=u[w])===null||b===void 0?void 0:b[e])!==m&&(u[w]=(I=u[w])!==null&&I!==void 0?I:{},u[w][e]=m,$(c,u,{isJson:!0}),U.info('Updated "'.concat(e,'" to version ').concat(m)))}return[2,{isCurrentProject:d,installedPath:c,file:u,isUpToDate:j}];case 4:S=y.sent();return[2,(U.error('Error checking package "'.concat(e,'": ').concat(S.message)),l({},J))];case 5:return[2]}})});return e$.apply(this,arguments)}w(eY,"checkPackage");function eV(){return ez.apply(this,arguments)}function ez(){ez=i(function(){var e,t,n,r,i,s,o,a,c,u,l,d;return y(this,function(p){switch(p.label){case 0:e=[{command:w(function(){return eJ.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:w(function(){return eJ.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:w(function(){return eJ.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);i=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(s=i.next()).done))return[3,8];o=s.value,a=o.command,c=o.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,a()];case 4:u=p.sent();return[4,tf("".concat(c," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();U.warn("Installation attempt failed: ".concat(c)),U.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&i.return!=null){i.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return ez.apply(this,arguments)}w(eV,"installDependencies");function eQ(e,t){return eX.apply(this,arguments)}function eX(){eX=i(function(e,t){var n,r,i,s,o,a,c,u,d,f,g;return y(this,function(y){switch(y.label){case 0:if(!H(eD.PACKAGE_JSON)){U.error("package.json not found. Aborting setup.");return[2]}y.label=1;case 1:y.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return eY(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=y.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,eV()];case 3:r=y.sent();y.label=4;case 4:r;s=true,o=false,a=undefined;y.label=5;case 5:y.trys.push([5,10,11,12]);c=((i=t===null||t===void 0?void 0:t.postInstallActions)!==null&&i!==void 0?i:[])[Symbol.iterator]();y.label=6;case 6:if(!!(s=(u=c.next()).done))return[3,9];d=u.value;return[4,d()];case 7:y.sent();y.label=8;case 8:s=true;return[3,6];case 9:return[3,12];case 10:f=y.sent();o=true;a=f;return[3,12];case 11:try{if(!s&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:g=y.sent();throw U.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})});return eX.apply(this,arguments)}w(eQ,"setupPackages");var eZ=S(require("node-persist"),1),e0=S(require("os"),1),e1=S(require("process"),1);function e2(){return e1.default.env.CYBERSKILL_STORAGE_DIR||ee(e0.default.homedir(),er)}w(e2,"getStorageDir");function e4(){return e3.apply(this,arguments)}function e3(){e3=i(function(){var e;return y(this,function(t){switch(t.label){case 0:e=eZ.default.defaultInstance;if(e)return[3,2];return[4,eZ.default.init({dir:e2(),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 e3.apply(this,arguments)}w(e4,"initNodePersist");var e5={get:function e(e){return i(function(){var t,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e4()];case 1:r.sent();return[4,eZ.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(U.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e4()];case 1:r.sent();return[4,eZ.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();U.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return y(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e4()];case 1:n.sent();return[4,eZ.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();U.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return y(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e4()];case 1:n.sent();return[4,eZ.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(U.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(U.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return y(this,function(t){try{return[2,"".concat(e2()," (key: ").concat(e,")")]}catch(e){return[2,(U.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var e6=N.promisify(L.exec);function e8(e){return"error_list:".concat(e)}w(e8,"getErrorListKey");function e9(e){return e7.apply(this,arguments)}function e7(){e7=i(function(e){var t,n,r;return y(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=e8(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,e5.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return y(this,function(t){switch(t.label){case 0:return[4,e5.getLogLink(n)];case 1:e=t.sent();e&&U.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=s.sent();U.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return e7.apply(this,arguments)}w(e9,"saveErrorListToStorage");function te(){return tt.apply(this,arguments)}function tt(){tt=i(function(){var e,t,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e5.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=i(function(e){var t;return y(this,function(n){switch(n.label){case 0:return[4,e5.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(U.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return tt.apply(this,arguments)}w(te,"getStoredErrorLists");function tn(){return tr.apply(this,arguments)}function tr(){tr=i(function(){var e,t,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e5.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return e5.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();U.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return tr.apply(this,arguments)}w(tn,"clearAllErrorLists");function ti(e){var t=[],n=[],r="",i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,s=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var a,c,u,l,d;var p=i.exec(e)||[],f=s.exec(e)||[],g=o.exec(e)||[];var y,h,v,m,j,x;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===R.Error?R.Error:R.Warning,message:(y=p===null||p===void 0?void 0:(a=p[4])===null||a===void 0?void 0:a.trim())!==null&&y!==void 0?y:"",rule:(h=p===null||p===void 0?void 0:(c=p[5])===null||c===void 0?void 0:c.trim())!==null&&h!==void 0?h:""}):f.length?t.push({file:(v=f===null||f===void 0?void 0:f[1])!==null&&v!==void 0?v:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===R.Error?R.Error:R.Warning,message:(m=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&m!==void 0?m:""}):g.length?t.push({file:"commitlint",type:R.Error,message:(j=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&j!==void 0?j:"",rule:(x=g===null||g===void 0?void 0:(d=g[2])===null||d===void 0?void 0:d.trim())!==null&&x!==void 0?x:""}):n.push(e.trim())}}),t.length&&e9(t),A&&n.length&&(U.warn("Unmatched lines:"),n.forEach(function(e){return U.info(" ".concat(e))}))}w(ti,"parseTextErrors");function ts(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,i=e.line,s=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?R.Error:R.Warning,file:t,position:"".concat(i,":").concat(s),rule:o,message:a})})}),n.length&&e9(n)}catch(t){ti(e)}}w(ts,"parseCommandOutput");function to(e){return ta.apply(this,arguments)}function ta(){ta=i(function(e){var t,n,r,i,s,o,a,c,u;var l=arguments;return y(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:ts;n=new AbortController;P.default.on("SIGINT",function(){U.warn("Process interrupted. Terminating..."),n.abort(),P.default.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,e6(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),i=r.stdout,s=r.stderr;[i,s].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&U.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return ta.apply(this,arguments)}w(to,"executeCommand");function tc(e){return{raw:!0,cmd:e}}w(tc,"rawCommand");function tu(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eq," ").concat(en," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eq," ").concat(e_," ").concat(eh," ").concat(e):"".concat(eq," ").concat(ey," ").concat(e)}w(tu,"formatCLI");function tl(e,t){return typeof e=="function"?tu(e(t),t):(typeof e==="undefined"?"undefined":f(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?tu(e,t):e}w(tl,"formatCommand");function td(e){return tp.apply(this,arguments)}function tp(){tp=i(function(e){var t,n,r,i,s,o,a;var c=arguments;return y(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];a=!1;return[3,3];case 1:return[4,eY(en)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:i=a,s={isRemote:r,isCurrentProject:i},o=typeof e=="function"?e(s):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,tl(r,s)]}))]}})});return tp.apply(this,arguments)}w(td,"resolveCommands");function tf(e,t){return tg.apply(this,arguments)}function tg(){tg=i(function(e,t){var n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);U.start("".concat(e)),A&&U.info("→ ".concat(t));return[4,to(t)];case 1:r.sent(),U.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw U.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return tg.apply(this,arguments)}w(tf,"runCommand");function ty(){return th.apply(this,arguments)}function th(){th=i(function(){var e,t;return y(this,function(n){switch(n.label){case 0:if(!H(eD.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eJ.typescriptCheck()];case 1:return[4,tf.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=U.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return th.apply(this,arguments)}w(ty,"checkTypescript");function tv(){return tm.apply(this,arguments)}function tm(){tm=i(function(){var e,t,n,r;var i=arguments;return y(this,function(s){switch(s.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eJ.eslintFix()];case 1:return[4,tf.apply(void 0,n.concat([s.sent()]))];case 2:t=s.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eJ.eslintCheck()];case 4:return[4,tf.apply(void 0,r.concat([s.sent()]))];case 5:t=s.sent();s.label=6;case 6:t;return[2]}})});return tm.apply(this,arguments)}w(tv,"checkEslint");function tj(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";U.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}w(tj,"printIssues");function tx(){return tb.apply(this,arguments)}function tb(){tb=i(function(){var e,t,n;return y(this,function(r){switch(r.label){case 0:return[4,te()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===R.Error}),n=e.filter(function(e){return e.type===R.Warning});!t.length&&!n.length?U.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tj("Warnings",n),tj("Errors",t));return[2]}})});return tb.apply(this,arguments)}w(tx,"showCheckResult");function tw(){return tI.apply(this,arguments)}function tI(){tI=i(function(){var e,t,n,r,i,s;return y(this,function(o){switch(o.label){case 0:return[4,tn()];case 1:o.sent();return[4,eY(en)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(en)];return[4,eJ.build()];case 4:return[4,tf.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eJ.stageBuildDirectory()];case 6:return[4,tf.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:i=o.sent();throw U.error("Error building and staging ".concat(en,": ").concat(i.message)),i;case 9:s=["Executing lint-staged"];return[4,eJ.lintStaged()];case 10:return[4,tf.apply(void 0,s.concat([o.sent()]))];case 11:o.sent(),tx();return[2]}})});return tI.apply(this,arguments)}w(tw,"lintStaged");function tS(){return tE.apply(this,arguments)}function tE(){tE=i(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eJ.eslintInspect()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tE.apply(this,arguments)}w(tS,"inspectLint");function tO(){return tk.apply(this,arguments)}function tk(){tk=i(function(){return y(this,function(e){switch(e.label){case 0:return[4,tn()];case 1:e.sent();return[4,Promise.all([ty(),tv()])];case 2:e.sent(),tx();return[2]}})});return tk.apply(this,arguments)}w(tO,"lintCheck");function t_(){return tC.apply(this,arguments)}function tC(){tC=i(function(){return y(this,function(e){switch(e.label){case 0:return[4,tn()];case 1:e.sent();return[4,Promise.all([ty(),tv(!0)])];case 2:e.sent(),tx();return[2]}})});return tC.apply(this,arguments)}w(t_,"lintFix");function tT(){return tq.apply(this,arguments)}function tq(){tq=i(function(){var e;return y(this,function(t){switch(t.label){case 0:return[4,tn()];case 1:t.sent();e=["Validating commit message"];return[4,eJ.commitLint()];case 2:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tx();return[2]}})});return tq.apply(this,arguments)}w(tT,"commitLint");function tL(){return tP.apply(this,arguments)}function tP(){tP=i(function(){var e,t,n,r;return y(this,function(i){switch(i.label){case 0:e=["Configuring Git hooks"];return[4,eJ.configureGitHook()];case 1:return[4,tf.apply(void 0,e.concat([i.sent()]))];case 2:i.sent(),z(eD.GIT_HOOK);return[4,td(eF)];case 3:t=i.sent();$(eD.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(el,"\n");H(eD.GIT_IGNORE)?Y(eD.GIT_IGNORE).split("\n").includes(el)||V(eD.GIT_IGNORE,n):$(eD.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eJ.simpleGitHooks()];case 4:return[4,tf.apply(void 0,r.concat([i.sent()]))];case 5:i.sent();return[2]}})});return tP.apply(this,arguments)}w(tL,"setupGitHook");function tN(){return tG.apply(this,arguments)}function tG(){tG=i(function(){return y(this,function(e){switch(e.label){case 0:return[4,eQ([en],{update:!0,postInstallActions:[tL]})];case 1:e.sent();return[2]}})});return tG.apply(this,arguments)}w(tN,"setup");function tA(){return tR.apply(this,arguments)}function tR(){tR=i(function(){return y(this,function(e){switch(e.label){case 0:z(eD.NODE_MODULES,eD.PNPM_LOCK_YAML);return[4,eV()];case 1:e.sent();return[4,tL()];case 2:e.sent();return[2]}})});return tR.apply(this,arguments)}w(tA,"reset");function tD(){return tF.apply(this,arguments)}function tF(){tF=i(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eJ.nodeModulesInspect()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tF.apply(this,arguments)}w(tD,"inspect");function tM(){return tW.apply(this,arguments)}function tW(){tW=i(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eJ.testUnit()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tW.apply(this,arguments)}w(tM,"testUnit");function tU(){return tJ.apply(this,arguments)}function tJ(){tJ=i(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eJ.testE2e()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tJ.apply(this,arguments)}w(tU,"testE2E");i(function(){var e;return y(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,(0,C.default)((0,_.hideBin)(k.default.argv)).scriptName(ey).usage("$0 <command> [options]").command("lint","Check code for linting issues",tO).command("lint:fix","Fix linting issues automatically",t_).command("lint:inspect","View active ESLint configuration",tS).command("lint-staged","Run lint checks on staged files",tw).command("commitlint","Validate commit message format",tT).command("setup","Initialize project setup and dependencies",tN).command("reset","Reset the project and reinstall dependencies",tA).command("inspect","Analyze installed project dependencies",tD).command("test:unit","Run unit test suite",tM).command("test:e2e","Run end-to-end test suite",tU).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(T.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();U.error("Fatal: ".concat(e.message)),k.default.exit(1);return[3,3];case 3:return[2]}})})();
1
+ "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,i,s,o){try{var a=e[s](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,i)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(i,s){var o=e.apply(t,n);function a(e){r(o,i,s,a,c,"next",e)}function c(e){r(o,i,s,a,c,"throw",e)}a(undefined)})}}function s(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var i=true;var s=false;var o,a;try{for(n=n.call(e);!(i=(o=n.next()).done);i=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){s=true;a=e}finally{try{if(!i&&n["return"]!=null)n["return"]()}finally{if(s)throw a}}return r}function c(){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 u(){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(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){s(e,t,n[t])})}return e}function d(e,n){return t(e)||a(e,n)||g(e,n)||c()}function p(e){return n(e)||o(e)||g(e)||u()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function y(e,t){var n,r,i,s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(s=0)),s)try{if(n=1,r&&(i=a[0]&2?r["return"]:a[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;if(r=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:s.label++;return{value:a[1],done:false};case 5:s.label++;r=a[1];a=[0];continue;case 7:a=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){s=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(a[0]===6&&s.label<i[1]){s.label=i[1];i=a;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(a);break}if(i[2])s.ops.pop();s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e];r=0}finally{n=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var h=Object.create;var v=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var w=function(e,t){return v(e,"name",{value:t,configurable:!0})};var I=function(e,t,n,r){var i=true,s=false,o=undefined;if(t&&(typeof t==="undefined"?"undefined":f(t))=="object"||typeof t=="function")try{var a=function(){var i=u.value;!b.call(e,i)&&i!==n&&v(e,i,{get:function(){return t[i]},enumerable:!(r=m(t,i))||r.enumerable})};for(var c=j(t)[Symbol.iterator](),u;!(i=(u=c.next()).done);i=true)a()}catch(e){s=true;o=e}finally{try{if(!i&&c.return!=null){c.return()}}finally{if(s){throw o}}}return e};var S=function(e,t,n){return n=e!=null?h(x(e)):{},I(t||!e||!e.__esModule?v(n,"default",{value:e,enumerable:!0}):n,e)},E=function(e){return I(v({},"__esModule",{value:!0}),e)};var O={};module.exports=E(O);var k=S(require("process"),1),_=require("yargs/helpers"),C=S(require("yargs/yargs"),1);var T={name:"@cyberskill/shared",type:"module",version:"1.89.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/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.7","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.47.4","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.3.0","@swc/core":"1.11.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",consola:"3.4.2","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0","eslint-config-next":"15.3.0","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.0",jsdom:"26.1.0",localforage:"1.10.0","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.51.1","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.2.6",vitest:"3.1.1","vitest-browser-react":"0.1.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/crypto-js":"4.2.2","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.1","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var q=function(e){return e.CLI="CLI",e.RAW="RAW",e}({});var L=require("child_process"),P=S(require("process"),1),N=S(require("util"),1);var G=S(require("process"),1),A=G.default.env.DEBUG==="true";var R=function(e){return e.Error="error",e.Warning="warning",e}({});var D=S(require("chalk"),1),F=S(require("consola"),1),M=require("graphql");A||(F.default.level=4);function W(e){var t=D.default[e];return typeof t=="function"?t:D.default.green}w(W,"chalkKeyword");var U={silent:F.default.silent,level:F.default.level,fatal:F.default.fatal,error:F.default.error,warn:F.default.warn,log:F.default.log,info:F.default.info,success:F.default.success,ready:F.default.ready,start:F.default.start,box:F.default.box,debug:F.default.debug,trace:F.default.trace,verbose:F.default.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){F.default.box(D.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,i=e.rule,s=e.message;F.default.log("".concat(D.default.gray("File:")," ").concat(D.default.blue("".concat(t).concat(r?":".concat(r):"")))),i&&F.default.log(" ".concat(W(n)("Rule:")," ").concat(i)),F.default.log(" ".concat(W(n)("Message:")," ").concat(s))}),F.default.box(W(n)("".concat(e," : ").concat(t.length))),F.default.log(D.default.gray("─".repeat(40)))}};var J={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var K=S(require("node-fetch"),1);var B=S(require("fs"),1);function H(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return B.existsSync(e)})}w(H,"existsSync");function Y(e,t){var n=B.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":f(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}w(Y,"readFileSync");function $(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);B.writeFileSync(e,s,"utf-8")}w($,"writeFileSync");function V(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);B.appendFileSync(e,s,"utf-8")}w(V,"appendFileSync");function z(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){H(e)&&B.rmSync(e,{recursive:!0,force:!0})})}w(z,"rmSync");var Q=S(require("process"),1);var X=S(require("path"),1);function Z(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=X).resolve.apply(r,[et].concat(p(t)))}w(Z,"resolveWorkingPath");function ee(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=X).join.apply(r,p(t))}w(ee,"join");var et=Q.default.env.INIT_CWD||Q.default.cwd(),en="@cyberskill/shared",er=".cyberskill-storage",ei="node_modules",es="dist",eo="package.json",ea="package-lock.json",ec="tsconfig.json",eu=".gitignore",el=".simple-git-hooks.json",ed="pnpm-lock.yaml",ep=".git/hooks/",ef=".git/COMMIT_EDITMSG",eg=ee(et,ei,en,es),ey="cyberskill",eh="src/nodejs/cli/index.ts",ev="eslint",em="eslint",ej="vitest",ex="playwright",eb="vitest",ew="@commitlint/cli",eI="commitlint",eS="lint-staged",eE="lint-staged",eO="typescript",ek="tsc",e_="tsx",eC="git",eT="pnpm",eq="pnpm exec",eL="simple-git-hooks",eP="simple-git-hooks",eN="@eslint/config-inspector",eG="eslint-config-inspector",eA="node-modules-inspector",eR="node-modules-inspector",eD={CYBERSKILL_DIRECTORY:eg,WORKING_DIRECTORY:et,TS_CONFIG:Z(ec),GIT_IGNORE:Z(eu),GIT_HOOK:Z(ep),GIT_COMMIT_MSG:Z(ef),SIMPLE_GIT_HOOKS_JSON:Z(el),PACKAGE_JSON:Z(eo),PACKAGE_LOCK_JSON:Z(ea),PNPM_LOCK_YAML:Z(ed),NODE_MODULES:Z(ei),LINT_STAGED_CONFIG:Z("".concat(eg,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:Z("".concat(eg,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:Z("".concat(eg,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:Z("".concat(eg,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:Z("".concat(eg,"/react/vitest/vitest.e2e.js"))};function eF(e){var t=e.isCurrentProject;return l({"pre-commit":eE,"commit-msg":eI},t&&{"pre-push":tc("".concat(eC," pull"))})}w(eF,"HOOK");function eM(e){return eW.apply(this,arguments)}function eW(){eW=i(function(e){var t,n,r,i,s,o;var a=arguments;return y(this,function(c){switch(c.label){case 0:for(t=a.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=a[r]}i=d(n,2),s=i[0],o=i[1];if(!s)throw new Error("'first' argument is undefined");switch(e){case q.CLI:return[3,1];case q.RAW:return[3,3]}return[3,4];case 1:return[4,eQ(s.split(" "),{update:!0})];case 2:return[2,(c.sent(),tl(tc("".concat(eq," ").concat(o))))];case 3:return[2,tl(tc(s))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eW.apply(this,arguments)}w(eM,"buildCommand");function eU(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/i(function(){return y(this,function(t){return[2,eM.apply(void 0,[e].concat(p(n)))]})})}w(eU,"commandFactory");var eJ={simpleGitHooks:eU(q.CLI,eL,eP),eslintInspect:eU(q.CLI,eN,eG),nodeModulesInspect:eU(q.CLI,eA,eR),eslintCheck:eU(q.CLI,ev,"".concat(em," ").concat(eD.WORKING_DIRECTORY)),eslintFix:eU(q.CLI,ev,"".concat(em," ").concat(eD.WORKING_DIRECTORY," --fix")),typescriptCheck:eU(q.CLI,eO,"".concat(ek," -p ").concat(eD.TS_CONFIG," --noEmit")),configureGitHook:eU(q.RAW,"".concat(eC," config core.hooksPath ").concat(eD.GIT_HOOK)),testUnit:eU(q.CLI,ej,"".concat(eb," --config ").concat(eD.UNIT_TEST_CONFIG)),testE2e:eU(q.CLI,"".concat(ej," ").concat(ex),"".concat(eb," --config ").concat(eD.E2E_TEST_CONFIG)),commitLint:eU(q.CLI,ew,"".concat(eI," --edit ").concat(eD.GIT_COMMIT_MSG," --config ").concat(eD.COMMITLINT_CONFIG)),lintStaged:eU(q.CLI,eS,"".concat(eE," --config ").concat(eD.LINT_STAGED_CONFIG)),stageBuildDirectory:eU(q.RAW,"".concat(eC," add ").concat(es)),build:eU(q.RAW,"".concat(eT," run build")),pnpmInstallStandard:eU(q.RAW,"".concat(eT," install")),pnpmInstallLegacy:eU(q.RAW,"".concat(eT," install --legacy-peer-deps")),pnpmInstallForce:eU(q.RAW,"".concat(eT," install --force"))};function eK(e){var t=ee(et,eo);if(!H(t))return!1;try{var n=Y(t,{asJson:!0}),r=n.name,i=n.dependencies,s=i===void 0?{}:i,o=n.devDependencies,a=o===void 0?{}:o,c=r===e,u=e in s,l=e in a;return c||u||l?{path:t,file:n,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return U.warn("Failed to read package.json: ".concat(e.message)),!1}}w(eK,"getPackage");function eB(e){return eH.apply(this,arguments)}function eH(){eH=i(function(e){var t,n,r,i;return y(this,function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);return[4,(0,K.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=s.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=s.sent(),r=n.version;return[2,r];case 3:i=s.sent();throw U.error('Failed to fetch version for "'.concat(e,'": ').concat(i.message)),i;case 4:return[2]}})});return eH.apply(this,arguments)}w(eB,"getLatestPackageVersion");function eY(e,t){return e$.apply(this,arguments)}function e$(){e$=i(function(e,t){var n,r,i,s,o,a,c,u,d,p,f,g,h,v,m,j,x,b,w,I,S;return y(this,function(y){switch(y.label){case 0:y.trys.push([0,4,,5]);n=eK(e);if(!n)return[2,l({},J)];c=n.path,u=n.file,d=n.isCurrentProject,p=n.isDepend,f=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},h=(i=u.devDependencies)!==null&&i!==void 0?i:{},v=d?(s=u.version)!==null&&s!==void 0?s:"0.0.0":p?(o=g[e])!==null&&o!==void 0?o:"0.0.0":f?(a=h[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!d)return[3,1];x=v;return[3,3];case 1:return[4,eB(e)];case 2:x=y.sent();y.label=3;case 3:m=x,j=d||v===m;if(!j&&(t===null||t===void 0?void 0:t.update)){;w=p?"dependencies":f?"devDependencies":null;w&&((b=u[w])===null||b===void 0?void 0:b[e])!==m&&(u[w]=(I=u[w])!==null&&I!==void 0?I:{},u[w][e]=m,$(c,u,{isJson:!0}),U.info('Updated "'.concat(e,'" to version ').concat(m)))}return[2,{isCurrentProject:d,installedPath:c,file:u,isUpToDate:j}];case 4:S=y.sent();return[2,(U.error('Error checking package "'.concat(e,'": ').concat(S.message)),l({},J))];case 5:return[2]}})});return e$.apply(this,arguments)}w(eY,"checkPackage");function eV(){return ez.apply(this,arguments)}function ez(){ez=i(function(){var e,t,n,r,i,s,o,a,c,u,l,d;return y(this,function(p){switch(p.label){case 0:e=[{command:w(function(){return eJ.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:w(function(){return eJ.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:w(function(){return eJ.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);i=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(s=i.next()).done))return[3,8];o=s.value,a=o.command,c=o.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,a()];case 4:u=p.sent();return[4,tf("".concat(c," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();U.warn("Installation attempt failed: ".concat(c)),U.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&i.return!=null){i.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return ez.apply(this,arguments)}w(eV,"installDependencies");function eQ(e,t){return eX.apply(this,arguments)}function eX(){eX=i(function(e,t){var n,r,i,s,o,a,c,u,d,f,g;return y(this,function(y){switch(y.label){case 0:if(!H(eD.PACKAGE_JSON)){U.error("package.json not found. Aborting setup.");return[2]}y.label=1;case 1:y.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return eY(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=y.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,eV()];case 3:r=y.sent();y.label=4;case 4:r;s=true,o=false,a=undefined;y.label=5;case 5:y.trys.push([5,10,11,12]);c=((i=t===null||t===void 0?void 0:t.postInstallActions)!==null&&i!==void 0?i:[])[Symbol.iterator]();y.label=6;case 6:if(!!(s=(u=c.next()).done))return[3,9];d=u.value;return[4,d()];case 7:y.sent();y.label=8;case 8:s=true;return[3,6];case 9:return[3,12];case 10:f=y.sent();o=true;a=f;return[3,12];case 11:try{if(!s&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:g=y.sent();throw U.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})});return eX.apply(this,arguments)}w(eQ,"setupPackages");var eZ=S(require("node-persist"),1),e0=S(require("os"),1),e1=S(require("process"),1);function e2(){return e1.default.env.CYBERSKILL_STORAGE_DIR||ee(e0.default.homedir(),er)}w(e2,"getStorageDir");function e4(){return e3.apply(this,arguments)}function e3(){e3=i(function(){var e;return y(this,function(t){switch(t.label){case 0:e=eZ.default.defaultInstance;if(e)return[3,2];return[4,eZ.default.init({dir:e2(),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 e3.apply(this,arguments)}w(e4,"initNodePersist");var e5={get:function e(e){return i(function(){var t,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e4()];case 1:r.sent();return[4,eZ.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(U.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e4()];case 1:r.sent();return[4,eZ.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();U.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return y(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e4()];case 1:n.sent();return[4,eZ.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();U.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return y(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e4()];case 1:n.sent();return[4,eZ.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(U.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(U.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return y(this,function(t){try{return[2,"".concat(e2()," (key: ").concat(e,")")]}catch(e){return[2,(U.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var e6=N.promisify(L.exec);function e8(e){return"error_list:".concat(e)}w(e8,"getErrorListKey");function e9(e){return e7.apply(this,arguments)}function e7(){e7=i(function(e){var t,n,r;return y(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=e8(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,e5.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return y(this,function(t){switch(t.label){case 0:return[4,e5.getLogLink(n)];case 1:e=t.sent();e&&U.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=s.sent();U.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return e7.apply(this,arguments)}w(e9,"saveErrorListToStorage");function te(){return tt.apply(this,arguments)}function tt(){tt=i(function(){var e,t,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e5.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=i(function(e){var t;return y(this,function(n){switch(n.label){case 0:return[4,e5.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(U.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return tt.apply(this,arguments)}w(te,"getStoredErrorLists");function tn(){return tr.apply(this,arguments)}function tr(){tr=i(function(){var e,t,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e5.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return e5.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();U.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return tr.apply(this,arguments)}w(tn,"clearAllErrorLists");function ti(e){var t=[],n=[],r="",i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,s=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var a,c,u,l,d;var p=i.exec(e)||[],f=s.exec(e)||[],g=o.exec(e)||[];var y,h,v,m,j,x;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===R.Error?R.Error:R.Warning,message:(y=p===null||p===void 0?void 0:(a=p[4])===null||a===void 0?void 0:a.trim())!==null&&y!==void 0?y:"",rule:(h=p===null||p===void 0?void 0:(c=p[5])===null||c===void 0?void 0:c.trim())!==null&&h!==void 0?h:""}):f.length?t.push({file:(v=f===null||f===void 0?void 0:f[1])!==null&&v!==void 0?v:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===R.Error?R.Error:R.Warning,message:(m=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&m!==void 0?m:""}):g.length?t.push({file:"commitlint",type:R.Error,message:(j=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&j!==void 0?j:"",rule:(x=g===null||g===void 0?void 0:(d=g[2])===null||d===void 0?void 0:d.trim())!==null&&x!==void 0?x:""}):n.push(e.trim())}}),t.length&&e9(t),A&&n.length&&(U.warn("Unmatched lines:"),n.forEach(function(e){return U.info(" ".concat(e))}))}w(ti,"parseTextErrors");function ts(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,i=e.line,s=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?R.Error:R.Warning,file:t,position:"".concat(i,":").concat(s),rule:o,message:a})})}),n.length&&e9(n)}catch(t){ti(e)}}w(ts,"parseCommandOutput");function to(e){return ta.apply(this,arguments)}function ta(){ta=i(function(e){var t,n,r,i,s,o,a,c,u;var l=arguments;return y(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:ts;n=new AbortController;P.default.on("SIGINT",function(){U.warn("Process interrupted. Terminating..."),n.abort(),P.default.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,e6(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),i=r.stdout,s=r.stderr;[i,s].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&U.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return ta.apply(this,arguments)}w(to,"executeCommand");function tc(e){return{raw:!0,cmd:e}}w(tc,"rawCommand");function tu(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eq," ").concat(en," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eq," ").concat(e_," ").concat(eh," ").concat(e):"".concat(eq," ").concat(ey," ").concat(e)}w(tu,"formatCLI");function tl(e,t){return typeof e=="function"?tu(e(t),t):(typeof e==="undefined"?"undefined":f(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?tu(e,t):e}w(tl,"formatCommand");function td(e){return tp.apply(this,arguments)}function tp(){tp=i(function(e){var t,n,r,i,s,o,a;var c=arguments;return y(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];a=!1;return[3,3];case 1:return[4,eY(en)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:i=a,s={isRemote:r,isCurrentProject:i},o=typeof e=="function"?e(s):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,tl(r,s)]}))]}})});return tp.apply(this,arguments)}w(td,"resolveCommands");function tf(e,t){return tg.apply(this,arguments)}function tg(){tg=i(function(e,t){var n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);U.start("".concat(e)),A&&U.info("→ ".concat(t));return[4,to(t)];case 1:r.sent(),U.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw U.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return tg.apply(this,arguments)}w(tf,"runCommand");function ty(){return th.apply(this,arguments)}function th(){th=i(function(){var e,t;return y(this,function(n){switch(n.label){case 0:if(!H(eD.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eJ.typescriptCheck()];case 1:return[4,tf.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=U.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return th.apply(this,arguments)}w(ty,"checkTypescript");function tv(){return tm.apply(this,arguments)}function tm(){tm=i(function(){var e,t,n,r;var i=arguments;return y(this,function(s){switch(s.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eJ.eslintFix()];case 1:return[4,tf.apply(void 0,n.concat([s.sent()]))];case 2:t=s.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eJ.eslintCheck()];case 4:return[4,tf.apply(void 0,r.concat([s.sent()]))];case 5:t=s.sent();s.label=6;case 6:t;return[2]}})});return tm.apply(this,arguments)}w(tv,"checkEslint");function tj(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";U.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}w(tj,"printIssues");function tx(){return tb.apply(this,arguments)}function tb(){tb=i(function(){var e,t,n;return y(this,function(r){switch(r.label){case 0:return[4,te()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===R.Error}),n=e.filter(function(e){return e.type===R.Warning});!t.length&&!n.length?U.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tj("Warnings",n),tj("Errors",t));return[2]}})});return tb.apply(this,arguments)}w(tx,"showCheckResult");function tw(){return tI.apply(this,arguments)}function tI(){tI=i(function(){var e,t,n,r,i,s;return y(this,function(o){switch(o.label){case 0:return[4,tn()];case 1:o.sent();return[4,eY(en)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(en)];return[4,eJ.build()];case 4:return[4,tf.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eJ.stageBuildDirectory()];case 6:return[4,tf.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:i=o.sent();throw U.error("Error building and staging ".concat(en,": ").concat(i.message)),i;case 9:s=["Executing lint-staged"];return[4,eJ.lintStaged()];case 10:return[4,tf.apply(void 0,s.concat([o.sent()]))];case 11:o.sent(),tx();return[2]}})});return tI.apply(this,arguments)}w(tw,"lintStaged");function tS(){return tE.apply(this,arguments)}function tE(){tE=i(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eJ.eslintInspect()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tE.apply(this,arguments)}w(tS,"inspectLint");function tO(){return tk.apply(this,arguments)}function tk(){tk=i(function(){return y(this,function(e){switch(e.label){case 0:return[4,tn()];case 1:e.sent();return[4,Promise.all([ty(),tv()])];case 2:e.sent(),tx();return[2]}})});return tk.apply(this,arguments)}w(tO,"lintCheck");function t_(){return tC.apply(this,arguments)}function tC(){tC=i(function(){return y(this,function(e){switch(e.label){case 0:return[4,tn()];case 1:e.sent();return[4,Promise.all([ty(),tv(!0)])];case 2:e.sent(),tx();return[2]}})});return tC.apply(this,arguments)}w(t_,"lintFix");function tT(){return tq.apply(this,arguments)}function tq(){tq=i(function(){var e;return y(this,function(t){switch(t.label){case 0:return[4,tn()];case 1:t.sent();e=["Validating commit message"];return[4,eJ.commitLint()];case 2:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tx();return[2]}})});return tq.apply(this,arguments)}w(tT,"commitLint");function tL(){return tP.apply(this,arguments)}function tP(){tP=i(function(){var e,t,n,r;return y(this,function(i){switch(i.label){case 0:e=["Configuring Git hooks"];return[4,eJ.configureGitHook()];case 1:return[4,tf.apply(void 0,e.concat([i.sent()]))];case 2:i.sent(),z(eD.GIT_HOOK);return[4,td(eF)];case 3:t=i.sent();$(eD.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(el,"\n");H(eD.GIT_IGNORE)?Y(eD.GIT_IGNORE).split("\n").includes(el)||V(eD.GIT_IGNORE,n):$(eD.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eJ.simpleGitHooks()];case 4:return[4,tf.apply(void 0,r.concat([i.sent()]))];case 5:i.sent();return[2]}})});return tP.apply(this,arguments)}w(tL,"setupGitHook");function tN(){return tG.apply(this,arguments)}function tG(){tG=i(function(){return y(this,function(e){switch(e.label){case 0:return[4,eQ([en],{update:!0,postInstallActions:[tL]})];case 1:e.sent();return[2]}})});return tG.apply(this,arguments)}w(tN,"setup");function tA(){return tR.apply(this,arguments)}function tR(){tR=i(function(){return y(this,function(e){switch(e.label){case 0:z(eD.NODE_MODULES,eD.PNPM_LOCK_YAML);return[4,eV()];case 1:e.sent();return[4,tL()];case 2:e.sent();return[2]}})});return tR.apply(this,arguments)}w(tA,"reset");function tD(){return tF.apply(this,arguments)}function tF(){tF=i(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eJ.nodeModulesInspect()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tF.apply(this,arguments)}w(tD,"inspect");function tM(){return tW.apply(this,arguments)}function tW(){tW=i(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eJ.testUnit()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tW.apply(this,arguments)}w(tM,"testUnit");function tU(){return tJ.apply(this,arguments)}function tJ(){tJ=i(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eJ.testE2e()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tJ.apply(this,arguments)}w(tU,"testE2E");i(function(){var e;return y(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,(0,C.default)((0,_.hideBin)(k.default.argv)).scriptName(ey).usage("$0 <command> [options]").command("lint","Check code for linting issues",tO).command("lint:fix","Fix linting issues automatically",t_).command("lint:inspect","View active ESLint configuration",tS).command("lint-staged","Run lint checks on staged files",tw).command("commitlint","Validate commit message format",tT).command("setup","Initialize project setup and dependencies",tN).command("reset","Reset the project and reinstall dependencies",tA).command("inspect","Analyze installed project dependencies",tD).command("test:unit","Run unit test suite",tM).command("test:e2e","Run end-to-end test suite",tU).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(T.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();U.error("Fatal: ".concat(e.message)),k.default.exit(1);return[3,3];case 3:return[2]}})})();
@@ -1 +1 @@
1
- function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,i,s,o){try{var c=e[s](o);var a=c.value}catch(e){n(e);return}if(c.done){t(a)}else{Promise.resolve(a).then(r,i)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(i,s){var o=e.apply(t,n);function c(e){r(o,i,s,c,a,"next",e)}function a(e){r(o,i,s,c,a,"throw",e)}c(undefined)})}}function s(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var i=true;var s=false;var o,c;try{for(n=n.call(e);!(i=(o=n.next()).done);i=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){s=true;c=e}finally{try{if(!i&&n["return"]!=null)n["return"]()}finally{if(s)throw c}}return r}function a(){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 u(){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(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){s(e,t,n[t])})}return e}function d(e,n){return t(e)||c(e,n)||g(e,n)||a()}function p(e){return n(e)||o(e)||g(e)||u()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function m(e,t){var n,r,i,s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=c(0),o["throw"]=c(1),o["return"]=c(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(e){return function(t){return a([e,t])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,c[0]&&(s=0)),s)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:s.label++;return{value:c[1],done:false};case 5:s.label++;r=c[1];c=[0];continue;case 7:c=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){s=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){s.label=c[1];break}if(c[0]===6&&s.label<i[1]){s.label=i[1];i=c;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(c);break}if(i[2])s.ops.pop();s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var h=Object.defineProperty;var y=function(e,t){return h(e,"name",{value:t,configurable:!0})};import v from"node:process";import{hideBin as x}from"yargs/helpers";import j from"yargs/yargs";var b={name:"@cyberskill/shared",type:"module",version:"1.88.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/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.7","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.47.4","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.3.0","@swc/core":"1.11.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",consola:"3.4.2","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0","eslint-config-next":"15.3.0","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.0",jsdom:"26.1.0",localforage:"1.10.0","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.51.1","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.2.6",vitest:"3.1.1","vitest-browser-react":"0.1.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/crypto-js":"4.2.2","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.1","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var w=function(e){return e.CLI="CLI",e.RAW="RAW",e}({});import{exec as I}from"node:child_process";import S from"node:process";import*as E from"node:util";import k from"node:process";var O=k.env.DEBUG==="true";var C=function(e){return e.Error="error",e.Warning="warning",e}({});import _ from"chalk";import T from"consola";import{GraphQLError as L}from"graphql";O||(T.level=4);function G(e){var t=_[e];return typeof t=="function"?t:_.green}y(G,"chalkKeyword");var N={silent:T.silent,level:T.level,fatal:T.fatal,error:T.error,warn:T.warn,log:T.log,info:T.info,success:T.success,ready:T.ready,start:T.start,box:T.box,debug:T.debug,trace:T.trace,verbose:T.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){T.box(_.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,i=e.rule,s=e.message;T.log("".concat(_.gray("File:")," ").concat(_.blue("".concat(t).concat(r?":".concat(r):"")))),i&&T.log(" ".concat(G(n)("Rule:")," ").concat(i)),T.log(" ".concat(G(n)("Message:")," ").concat(s))}),T.box(G(n)("".concat(e," : ").concat(t.length))),T.log(_.gray("─".repeat(40)))}};var P={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import A from"node-fetch";import*as R from"node:fs";function q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return R.existsSync(e)})}y(q,"existsSync");function F(e,t){var n=R.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":f(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}y(F,"readFileSync");function D(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);R.writeFileSync(e,s,"utf-8")}y(D,"writeFileSync");function M(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);R.appendFileSync(e,s,"utf-8")}y(M,"appendFileSync");function W(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){q(e)&&R.rmSync(e,{recursive:!0,force:!0})})}y(W,"rmSync");import U from"node:process";import*as J from"node:path";function K(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=J).resolve.apply(r,[H].concat(p(t)))}y(K,"resolveWorkingPath");function B(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=J).join.apply(r,p(t))}y(B,"join");var H=U.env.INIT_CWD||U.cwd(),Y="@cyberskill/shared",$=".cyberskill-storage",V="node_modules",z="dist",Q="package.json",X="package-lock.json",Z="tsconfig.json",ee=".gitignore",et=".simple-git-hooks.json",en="pnpm-lock.yaml",er=".git/hooks/",ei=".git/COMMIT_EDITMSG",es=B(H,V,Y,z),eo="cyberskill",ec="src/nodejs/cli/index.ts",ea="eslint",eu="eslint",el="vitest",ed="playwright",ep="vitest",ef="@commitlint/cli",eg="commitlint",em="lint-staged",eh="lint-staged",ey="typescript",ev="tsc",ex="tsx",ej="git",eb="pnpm",ew="pnpm exec",eI="simple-git-hooks",eS="simple-git-hooks",eE="@eslint/config-inspector",ek="eslint-config-inspector",eO="node-modules-inspector",eC="node-modules-inspector",e_={CYBERSKILL_DIRECTORY:es,WORKING_DIRECTORY:H,TS_CONFIG:K(Z),GIT_IGNORE:K(ee),GIT_HOOK:K(er),GIT_COMMIT_MSG:K(ei),SIMPLE_GIT_HOOKS_JSON:K(et),PACKAGE_JSON:K(Q),PACKAGE_LOCK_JSON:K(X),PNPM_LOCK_YAML:K(en),NODE_MODULES:K(V),LINT_STAGED_CONFIG:K("".concat(es,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:K("".concat(es,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:K("".concat(es,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:K("".concat(es,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:K("".concat(es,"/react/vitest/vitest.e2e.js"))};function eT(e){var t=e.isCurrentProject;return l({"pre-commit":eh,"commit-msg":eg},t&&{"pre-push":e7("".concat(ej," pull"))})}y(eT,"HOOK");function eL(e){return eG.apply(this,arguments)}function eG(){eG=i(function(e){var t,n,r,i,s,o;var c=arguments;return m(this,function(a){switch(a.label){case 0:for(t=c.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=c[r]}i=d(n,2),s=i[0],o=i[1];if(!s)throw new Error("'first' argument is undefined");switch(e){case w.CLI:return[3,1];case w.RAW:return[3,3]}return[3,4];case 1:return[4,eU(s.split(" "),{update:!0})];case 2:return[2,(a.sent(),tt(e7("".concat(ew," ").concat(o))))];case 3:return[2,tt(e7(s))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eG.apply(this,arguments)}y(eL,"buildCommand");function eN(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/i(function(){return m(this,function(t){return[2,eL.apply(void 0,[e].concat(p(n)))]})})}y(eN,"commandFactory");var eP={simpleGitHooks:eN(w.CLI,eI,eS),eslintInspect:eN(w.CLI,eE,ek),nodeModulesInspect:eN(w.CLI,eO,eC),eslintCheck:eN(w.CLI,ea,"".concat(eu," ").concat(e_.WORKING_DIRECTORY)),eslintFix:eN(w.CLI,ea,"".concat(eu," ").concat(e_.WORKING_DIRECTORY," --fix")),typescriptCheck:eN(w.CLI,ey,"".concat(ev," -p ").concat(e_.TS_CONFIG," --noEmit")),configureGitHook:eN(w.RAW,"".concat(ej," config core.hooksPath ").concat(e_.GIT_HOOK)),testUnit:eN(w.CLI,el,"".concat(ep," --config ").concat(e_.UNIT_TEST_CONFIG)),testE2e:eN(w.CLI,"".concat(el," ").concat(ed),"".concat(ep," --config ").concat(e_.E2E_TEST_CONFIG)),commitLint:eN(w.CLI,ef,"".concat(eg," --edit ").concat(e_.GIT_COMMIT_MSG," --config ").concat(e_.COMMITLINT_CONFIG)),lintStaged:eN(w.CLI,em,"".concat(eh," --config ").concat(e_.LINT_STAGED_CONFIG)),stageBuildDirectory:eN(w.RAW,"".concat(ej," add ").concat(z)),build:eN(w.RAW,"".concat(eb," run build")),pnpmInstallStandard:eN(w.RAW,"".concat(eb," install")),pnpmInstallLegacy:eN(w.RAW,"".concat(eb," install --legacy-peer-deps")),pnpmInstallForce:eN(w.RAW,"".concat(eb," install --force"))};function eA(e){var t=B(H,Q);if(!q(t))return!1;try{var n=F(t,{asJson:!0}),r=n.name,i=n.dependencies,s=i===void 0?{}:i,o=n.devDependencies,c=o===void 0?{}:o,a=r===e,u=e in s,l=e in c;return a||u||l?{path:t,file:n,isCurrentProject:a,isDepend:u,isDevDepend:l}:!1}catch(e){return N.warn("Failed to read package.json: ".concat(e.message)),!1}}y(eA,"getPackage");function eR(e){return eq.apply(this,arguments)}function eq(){eq=i(function(e){var t,n,r,i;return m(this,function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);return[4,A("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=s.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=s.sent(),r=n.version;return[2,r];case 3:i=s.sent();throw N.error('Failed to fetch version for "'.concat(e,'": ').concat(i.message)),i;case 4:return[2]}})});return eq.apply(this,arguments)}y(eR,"getLatestPackageVersion");function eF(e,t){return eD.apply(this,arguments)}function eD(){eD=i(function(e,t){var n,r,i,s,o,c,a,u,d,p,f,g,h,y,v,x,j,b,w,I,S;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=eA(e);if(!n)return[2,l({},P)];a=n.path,u=n.file,d=n.isCurrentProject,p=n.isDepend,f=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},h=(i=u.devDependencies)!==null&&i!==void 0?i:{},y=d?(s=u.version)!==null&&s!==void 0?s:"0.0.0":p?(o=g[e])!==null&&o!==void 0?o:"0.0.0":f?(c=h[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!d)return[3,1];j=y;return[3,3];case 1:return[4,eR(e)];case 2:j=m.sent();m.label=3;case 3:v=j,x=d||y===v;if(!x&&(t===null||t===void 0?void 0:t.update)){;w=p?"dependencies":f?"devDependencies":null;w&&((b=u[w])===null||b===void 0?void 0:b[e])!==v&&(u[w]=(I=u[w])!==null&&I!==void 0?I:{},u[w][e]=v,D(a,u,{isJson:!0}),N.info('Updated "'.concat(e,'" to version ').concat(v)))}return[2,{isCurrentProject:d,installedPath:a,file:u,isUpToDate:x}];case 4:S=m.sent();return[2,(N.error('Error checking package "'.concat(e,'": ').concat(S.message)),l({},P))];case 5:return[2]}})});return eD.apply(this,arguments)}y(eF,"checkPackage");function eM(){return eW.apply(this,arguments)}function eW(){eW=i(function(){var e,t,n,r,i,s,o,c,a,u,l,d;return m(this,function(p){switch(p.label){case 0:e=[{command:y(function(){return eP.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:y(function(){return eP.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:y(function(){return eP.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);i=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(s=i.next()).done))return[3,8];o=s.value,c=o.command,a=o.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,c()];case 4:u=p.sent();return[4,ti("".concat(a," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();N.warn("Installation attempt failed: ".concat(a)),N.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&i.return!=null){i.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eW.apply(this,arguments)}y(eM,"installDependencies");function eU(e,t){return eJ.apply(this,arguments)}function eJ(){eJ=i(function(e,t){var n,r,i,s,o,c,a,u,d,f,g;return m(this,function(m){switch(m.label){case 0:if(!q(e_.PACKAGE_JSON)){N.error("package.json not found. Aborting setup.");return[2]}m.label=1;case 1:m.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return eF(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=m.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,eM()];case 3:r=m.sent();m.label=4;case 4:r;s=true,o=false,c=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);a=((i=t===null||t===void 0?void 0:t.postInstallActions)!==null&&i!==void 0?i:[])[Symbol.iterator]();m.label=6;case 6:if(!!(s=(u=a.next()).done))return[3,9];d=u.value;return[4,d()];case 7:m.sent();m.label=8;case 8:s=true;return[3,6];case 9:return[3,12];case 10:f=m.sent();o=true;c=f;return[3,12];case 11:try{if(!s&&a.return!=null){a.return()}}finally{if(o){throw c}}return[7];case 12:return[3,14];case 13:g=m.sent();throw N.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})});return eJ.apply(this,arguments)}y(eU,"setupPackages");import eK from"node-persist";import eB from"node:os";import eH from"node:process";function eY(){return eH.env.CYBERSKILL_STORAGE_DIR||B(eB.homedir(),$)}y(eY,"getStorageDir");function e$(){return eV.apply(this,arguments)}function eV(){eV=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=eK.defaultInstance;if(e)return[3,2];return[4,eK.init({dir:eY(),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 eV.apply(this,arguments)}y(e$,"initNodePersist");var ez={get:function e(e){return i(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e$()];case 1:r.sent();return[4,eK.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(N.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e$()];case 1:r.sent();return[4,eK.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();N.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e$()];case 1:n.sent();return[4,eK.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();N.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e$()];case 1:n.sent();return[4,eK.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(N.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(N.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return m(this,function(t){try{return[2,"".concat(eY()," (key: ").concat(e,")")]}catch(e){return[2,(N.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eQ=E.promisify(I);function eX(e){return"error_list:".concat(e)}y(eX,"getErrorListKey");function eZ(e){return e0.apply(this,arguments)}function e0(){e0=i(function(e){var t,n,r;return m(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=eX(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,ez.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,ez.getLogLink(n)];case 1:e=t.sent();e&&N.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=s.sent();N.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return e0.apply(this,arguments)}y(eZ,"saveErrorListToStorage");function e1(){return e2.apply(this,arguments)}function e2(){e2=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ez.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=i(function(e){var t;return m(this,function(n){switch(n.label){case 0:return[4,ez.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(N.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return e2.apply(this,arguments)}y(e1,"getStoredErrorLists");function e4(){return e3.apply(this,arguments)}function e3(){e3=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ez.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return ez.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();N.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return e3.apply(this,arguments)}y(e4,"clearAllErrorLists");function e5(e){var t=[],n=[],r="",i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,s=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c,a,u,l,d;var p=i.exec(e)||[],f=s.exec(e)||[],g=o.exec(e)||[];var m,h,y,v,x,j;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===C.Error?C.Error:C.Warning,message:(m=p===null||p===void 0?void 0:(c=p[4])===null||c===void 0?void 0:c.trim())!==null&&m!==void 0?m:"",rule:(h=p===null||p===void 0?void 0:(a=p[5])===null||a===void 0?void 0:a.trim())!==null&&h!==void 0?h:""}):f.length?t.push({file:(y=f===null||f===void 0?void 0:f[1])!==null&&y!==void 0?y:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===C.Error?C.Error:C.Warning,message:(v=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&v!==void 0?v:""}):g.length?t.push({file:"commitlint",type:C.Error,message:(x=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&x!==void 0?x:"",rule:(j=g===null||g===void 0?void 0:(d=g[2])===null||d===void 0?void 0:d.trim())!==null&&j!==void 0?j:""}):n.push(e.trim())}}),t.length&&eZ(t),O&&n.length&&(N.warn("Unmatched lines:"),n.forEach(function(e){return N.info(" ".concat(e))}))}y(e5,"parseTextErrors");function e6(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,i=e.line,s=e.column,o=e.ruleId,c=e.message;n.push({type:r===2?C.Error:C.Warning,file:t,position:"".concat(i,":").concat(s),rule:o,message:c})})}),n.length&&eZ(n)}catch(t){e5(e)}}y(e6,"parseCommandOutput");function e8(e){return e9.apply(this,arguments)}function e9(){e9=i(function(e){var t,n,r,i,s,o,c,a,u;var l=arguments;return m(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:e6;n=new AbortController;S.on("SIGINT",function(){N.warn("Process interrupted. Terminating..."),n.abort(),S.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,eQ(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),i=r.stdout,s=r.stderr;[i,s].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();c=o.stdout,a=o.stderr,u=o.message;[c,a].forEach(function(e){return e&&t(e)}),!a&&!c&&N.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return e9.apply(this,arguments)}y(e8,"executeCommand");function e7(e){return{raw:!0,cmd:e}}y(e7,"rawCommand");function te(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ew," ").concat(Y," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ew," ").concat(ex," ").concat(ec," ").concat(e):"".concat(ew," ").concat(eo," ").concat(e)}y(te,"formatCLI");function tt(e,t){return typeof e=="function"?te(e(t),t):(typeof e==="undefined"?"undefined":f(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?te(e,t):e}y(tt,"formatCommand");function tn(e){return tr.apply(this,arguments)}function tr(){tr=i(function(e){var t,n,r,i,s,o,c;var a=arguments;return m(this,function(u){switch(u.label){case 0:t=a.length>1&&a[1]!==void 0?a[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];c=!1;return[3,3];case 1:return[4,eF(Y)];case 2:c=u.sent().isCurrentProject;u.label=3;case 3:i=c,s={isRemote:r,isCurrentProject:i},o=typeof e=="function"?e(s):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,tt(r,s)]}))]}})});return tr.apply(this,arguments)}y(tn,"resolveCommands");function ti(e,t){return ts.apply(this,arguments)}function ts(){ts=i(function(e,t){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);N.start("".concat(e)),O&&N.info("→ ".concat(t));return[4,e8(t)];case 1:r.sent(),N.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw N.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return ts.apply(this,arguments)}y(ti,"runCommand");function to(){return tc.apply(this,arguments)}function tc(){tc=i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!q(e_.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eP.typescriptCheck()];case 1:return[4,ti.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=N.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return tc.apply(this,arguments)}y(to,"checkTypescript");function ta(){return tu.apply(this,arguments)}function tu(){tu=i(function(){var e,t,n,r;var i=arguments;return m(this,function(s){switch(s.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eP.eslintFix()];case 1:return[4,ti.apply(void 0,n.concat([s.sent()]))];case 2:t=s.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eP.eslintCheck()];case 4:return[4,ti.apply(void 0,r.concat([s.sent()]))];case 5:t=s.sent();s.label=6;case 6:t;return[2]}})});return tu.apply(this,arguments)}y(ta,"checkEslint");function tl(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";N.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}y(tl,"printIssues");function td(){return tp.apply(this,arguments)}function tp(){tp=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,e1()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===C.Error}),n=e.filter(function(e){return e.type===C.Warning});!t.length&&!n.length?N.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tl("Warnings",n),tl("Errors",t));return[2]}})});return tp.apply(this,arguments)}y(td,"showCheckResult");function tf(){return tg.apply(this,arguments)}function tg(){tg=i(function(){var e,t,n,r,i,s;return m(this,function(o){switch(o.label){case 0:return[4,e4()];case 1:o.sent();return[4,eF(Y)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(Y)];return[4,eP.build()];case 4:return[4,ti.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eP.stageBuildDirectory()];case 6:return[4,ti.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:i=o.sent();throw N.error("Error building and staging ".concat(Y,": ").concat(i.message)),i;case 9:s=["Executing lint-staged"];return[4,eP.lintStaged()];case 10:return[4,ti.apply(void 0,s.concat([o.sent()]))];case 11:o.sent(),td();return[2]}})});return tg.apply(this,arguments)}y(tf,"lintStaged");function tm(){return th.apply(this,arguments)}function th(){th=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eP.eslintInspect()];case 1:return[4,ti.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return th.apply(this,arguments)}y(tm,"inspectLint");function ty(){return tv.apply(this,arguments)}function tv(){tv=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,e4()];case 1:e.sent();return[4,Promise.all([to(),ta()])];case 2:e.sent(),td();return[2]}})});return tv.apply(this,arguments)}y(ty,"lintCheck");function tx(){return tj.apply(this,arguments)}function tj(){tj=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,e4()];case 1:e.sent();return[4,Promise.all([to(),ta(!0)])];case 2:e.sent(),td();return[2]}})});return tj.apply(this,arguments)}y(tx,"lintFix");function tb(){return tw.apply(this,arguments)}function tw(){tw=i(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,e4()];case 1:t.sent();e=["Validating commit message"];return[4,eP.commitLint()];case 2:return[4,ti.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),td();return[2]}})});return tw.apply(this,arguments)}y(tb,"commitLint");function tI(){return tS.apply(this,arguments)}function tS(){tS=i(function(){var e,t,n,r;return m(this,function(i){switch(i.label){case 0:e=["Configuring Git hooks"];return[4,eP.configureGitHook()];case 1:return[4,ti.apply(void 0,e.concat([i.sent()]))];case 2:i.sent(),W(e_.GIT_HOOK);return[4,tn(eT)];case 3:t=i.sent();D(e_.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(et,"\n");q(e_.GIT_IGNORE)?F(e_.GIT_IGNORE).split("\n").includes(et)||M(e_.GIT_IGNORE,n):D(e_.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eP.simpleGitHooks()];case 4:return[4,ti.apply(void 0,r.concat([i.sent()]))];case 5:i.sent();return[2]}})});return tS.apply(this,arguments)}y(tI,"setupGitHook");function tE(){return tk.apply(this,arguments)}function tk(){tk=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,eU([Y],{update:!0,postInstallActions:[tI]})];case 1:e.sent();return[2]}})});return tk.apply(this,arguments)}y(tE,"setup");function tO(){return tC.apply(this,arguments)}function tC(){tC=i(function(){return m(this,function(e){switch(e.label){case 0:W(e_.NODE_MODULES,e_.PNPM_LOCK_YAML);return[4,eM()];case 1:e.sent();return[4,tI()];case 2:e.sent();return[2]}})});return tC.apply(this,arguments)}y(tO,"reset");function t_(){return tT.apply(this,arguments)}function tT(){tT=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eP.nodeModulesInspect()];case 1:return[4,ti.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tT.apply(this,arguments)}y(t_,"inspect");function tL(){return tG.apply(this,arguments)}function tG(){tG=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eP.testUnit()];case 1:return[4,ti.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tG.apply(this,arguments)}y(tL,"testUnit");function tN(){return tP.apply(this,arguments)}function tP(){tP=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eP.testE2e()];case 1:return[4,ti.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tP.apply(this,arguments)}y(tN,"testE2E");i(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j(x(v.argv)).scriptName(eo).usage("$0 <command> [options]").command("lint","Check code for linting issues",ty).command("lint:fix","Fix linting issues automatically",tx).command("lint:inspect","View active ESLint configuration",tm).command("lint-staged","Run lint checks on staged files",tf).command("commitlint","Validate commit message format",tb).command("setup","Initialize project setup and dependencies",tE).command("reset","Reset the project and reinstall dependencies",tO).command("inspect","Analyze installed project dependencies",t_).command("test:unit","Run unit test suite",tL).command("test:e2e","Run end-to-end test suite",tN).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(b.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();N.error("Fatal: ".concat(e.message)),v.exit(1);return[3,3];case 3:return[2]}})})();
1
+ function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,i,s,o){try{var c=e[s](o);var a=c.value}catch(e){n(e);return}if(c.done){t(a)}else{Promise.resolve(a).then(r,i)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(i,s){var o=e.apply(t,n);function c(e){r(o,i,s,c,a,"next",e)}function a(e){r(o,i,s,c,a,"throw",e)}c(undefined)})}}function s(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var i=true;var s=false;var o,c;try{for(n=n.call(e);!(i=(o=n.next()).done);i=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){s=true;c=e}finally{try{if(!i&&n["return"]!=null)n["return"]()}finally{if(s)throw c}}return r}function a(){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 u(){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(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){s(e,t,n[t])})}return e}function d(e,n){return t(e)||c(e,n)||g(e,n)||a()}function p(e){return n(e)||o(e)||g(e)||u()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function m(e,t){var n,r,i,s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=c(0),o["throw"]=c(1),o["return"]=c(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(e){return function(t){return a([e,t])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,c[0]&&(s=0)),s)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:s.label++;return{value:c[1],done:false};case 5:s.label++;r=c[1];c=[0];continue;case 7:c=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){s=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){s.label=c[1];break}if(c[0]===6&&s.label<i[1]){s.label=i[1];i=c;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(c);break}if(i[2])s.ops.pop();s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var h=Object.defineProperty;var y=function(e,t){return h(e,"name",{value:t,configurable:!0})};import v from"node:process";import{hideBin as x}from"yargs/helpers";import j from"yargs/yargs";var b={name:"@cyberskill/shared",type:"module",version:"1.89.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/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.7","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.47.4","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.3.0","@swc/core":"1.11.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",consola:"3.4.2","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0","eslint-config-next":"15.3.0","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.0",jsdom:"26.1.0",localforage:"1.10.0","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.51.1","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.2.6",vitest:"3.1.1","vitest-browser-react":"0.1.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/crypto-js":"4.2.2","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.1","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var w=function(e){return e.CLI="CLI",e.RAW="RAW",e}({});import{exec as I}from"node:child_process";import S from"node:process";import*as E from"node:util";import k from"node:process";var O=k.env.DEBUG==="true";var C=function(e){return e.Error="error",e.Warning="warning",e}({});import _ from"chalk";import T from"consola";import{GraphQLError as L}from"graphql";O||(T.level=4);function G(e){var t=_[e];return typeof t=="function"?t:_.green}y(G,"chalkKeyword");var N={silent:T.silent,level:T.level,fatal:T.fatal,error:T.error,warn:T.warn,log:T.log,info:T.info,success:T.success,ready:T.ready,start:T.start,box:T.box,debug:T.debug,trace:T.trace,verbose:T.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){T.box(_.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,i=e.rule,s=e.message;T.log("".concat(_.gray("File:")," ").concat(_.blue("".concat(t).concat(r?":".concat(r):"")))),i&&T.log(" ".concat(G(n)("Rule:")," ").concat(i)),T.log(" ".concat(G(n)("Message:")," ").concat(s))}),T.box(G(n)("".concat(e," : ").concat(t.length))),T.log(_.gray("─".repeat(40)))}};var P={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import A from"node-fetch";import*as R from"node:fs";function q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return R.existsSync(e)})}y(q,"existsSync");function F(e,t){var n=R.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":f(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}y(F,"readFileSync");function D(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);R.writeFileSync(e,s,"utf-8")}y(D,"writeFileSync");function M(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);R.appendFileSync(e,s,"utf-8")}y(M,"appendFileSync");function W(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){q(e)&&R.rmSync(e,{recursive:!0,force:!0})})}y(W,"rmSync");import U from"node:process";import*as J from"node:path";function K(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=J).resolve.apply(r,[H].concat(p(t)))}y(K,"resolveWorkingPath");function B(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=J).join.apply(r,p(t))}y(B,"join");var H=U.env.INIT_CWD||U.cwd(),Y="@cyberskill/shared",$=".cyberskill-storage",V="node_modules",z="dist",Q="package.json",X="package-lock.json",Z="tsconfig.json",ee=".gitignore",et=".simple-git-hooks.json",en="pnpm-lock.yaml",er=".git/hooks/",ei=".git/COMMIT_EDITMSG",es=B(H,V,Y,z),eo="cyberskill",ec="src/nodejs/cli/index.ts",ea="eslint",eu="eslint",el="vitest",ed="playwright",ep="vitest",ef="@commitlint/cli",eg="commitlint",em="lint-staged",eh="lint-staged",ey="typescript",ev="tsc",ex="tsx",ej="git",eb="pnpm",ew="pnpm exec",eI="simple-git-hooks",eS="simple-git-hooks",eE="@eslint/config-inspector",ek="eslint-config-inspector",eO="node-modules-inspector",eC="node-modules-inspector",e_={CYBERSKILL_DIRECTORY:es,WORKING_DIRECTORY:H,TS_CONFIG:K(Z),GIT_IGNORE:K(ee),GIT_HOOK:K(er),GIT_COMMIT_MSG:K(ei),SIMPLE_GIT_HOOKS_JSON:K(et),PACKAGE_JSON:K(Q),PACKAGE_LOCK_JSON:K(X),PNPM_LOCK_YAML:K(en),NODE_MODULES:K(V),LINT_STAGED_CONFIG:K("".concat(es,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:K("".concat(es,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:K("".concat(es,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:K("".concat(es,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:K("".concat(es,"/react/vitest/vitest.e2e.js"))};function eT(e){var t=e.isCurrentProject;return l({"pre-commit":eh,"commit-msg":eg},t&&{"pre-push":e7("".concat(ej," pull"))})}y(eT,"HOOK");function eL(e){return eG.apply(this,arguments)}function eG(){eG=i(function(e){var t,n,r,i,s,o;var c=arguments;return m(this,function(a){switch(a.label){case 0:for(t=c.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=c[r]}i=d(n,2),s=i[0],o=i[1];if(!s)throw new Error("'first' argument is undefined");switch(e){case w.CLI:return[3,1];case w.RAW:return[3,3]}return[3,4];case 1:return[4,eU(s.split(" "),{update:!0})];case 2:return[2,(a.sent(),tt(e7("".concat(ew," ").concat(o))))];case 3:return[2,tt(e7(s))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eG.apply(this,arguments)}y(eL,"buildCommand");function eN(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/i(function(){return m(this,function(t){return[2,eL.apply(void 0,[e].concat(p(n)))]})})}y(eN,"commandFactory");var eP={simpleGitHooks:eN(w.CLI,eI,eS),eslintInspect:eN(w.CLI,eE,ek),nodeModulesInspect:eN(w.CLI,eO,eC),eslintCheck:eN(w.CLI,ea,"".concat(eu," ").concat(e_.WORKING_DIRECTORY)),eslintFix:eN(w.CLI,ea,"".concat(eu," ").concat(e_.WORKING_DIRECTORY," --fix")),typescriptCheck:eN(w.CLI,ey,"".concat(ev," -p ").concat(e_.TS_CONFIG," --noEmit")),configureGitHook:eN(w.RAW,"".concat(ej," config core.hooksPath ").concat(e_.GIT_HOOK)),testUnit:eN(w.CLI,el,"".concat(ep," --config ").concat(e_.UNIT_TEST_CONFIG)),testE2e:eN(w.CLI,"".concat(el," ").concat(ed),"".concat(ep," --config ").concat(e_.E2E_TEST_CONFIG)),commitLint:eN(w.CLI,ef,"".concat(eg," --edit ").concat(e_.GIT_COMMIT_MSG," --config ").concat(e_.COMMITLINT_CONFIG)),lintStaged:eN(w.CLI,em,"".concat(eh," --config ").concat(e_.LINT_STAGED_CONFIG)),stageBuildDirectory:eN(w.RAW,"".concat(ej," add ").concat(z)),build:eN(w.RAW,"".concat(eb," run build")),pnpmInstallStandard:eN(w.RAW,"".concat(eb," install")),pnpmInstallLegacy:eN(w.RAW,"".concat(eb," install --legacy-peer-deps")),pnpmInstallForce:eN(w.RAW,"".concat(eb," install --force"))};function eA(e){var t=B(H,Q);if(!q(t))return!1;try{var n=F(t,{asJson:!0}),r=n.name,i=n.dependencies,s=i===void 0?{}:i,o=n.devDependencies,c=o===void 0?{}:o,a=r===e,u=e in s,l=e in c;return a||u||l?{path:t,file:n,isCurrentProject:a,isDepend:u,isDevDepend:l}:!1}catch(e){return N.warn("Failed to read package.json: ".concat(e.message)),!1}}y(eA,"getPackage");function eR(e){return eq.apply(this,arguments)}function eq(){eq=i(function(e){var t,n,r,i;return m(this,function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);return[4,A("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=s.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=s.sent(),r=n.version;return[2,r];case 3:i=s.sent();throw N.error('Failed to fetch version for "'.concat(e,'": ').concat(i.message)),i;case 4:return[2]}})});return eq.apply(this,arguments)}y(eR,"getLatestPackageVersion");function eF(e,t){return eD.apply(this,arguments)}function eD(){eD=i(function(e,t){var n,r,i,s,o,c,a,u,d,p,f,g,h,y,v,x,j,b,w,I,S;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=eA(e);if(!n)return[2,l({},P)];a=n.path,u=n.file,d=n.isCurrentProject,p=n.isDepend,f=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},h=(i=u.devDependencies)!==null&&i!==void 0?i:{},y=d?(s=u.version)!==null&&s!==void 0?s:"0.0.0":p?(o=g[e])!==null&&o!==void 0?o:"0.0.0":f?(c=h[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!d)return[3,1];j=y;return[3,3];case 1:return[4,eR(e)];case 2:j=m.sent();m.label=3;case 3:v=j,x=d||y===v;if(!x&&(t===null||t===void 0?void 0:t.update)){;w=p?"dependencies":f?"devDependencies":null;w&&((b=u[w])===null||b===void 0?void 0:b[e])!==v&&(u[w]=(I=u[w])!==null&&I!==void 0?I:{},u[w][e]=v,D(a,u,{isJson:!0}),N.info('Updated "'.concat(e,'" to version ').concat(v)))}return[2,{isCurrentProject:d,installedPath:a,file:u,isUpToDate:x}];case 4:S=m.sent();return[2,(N.error('Error checking package "'.concat(e,'": ').concat(S.message)),l({},P))];case 5:return[2]}})});return eD.apply(this,arguments)}y(eF,"checkPackage");function eM(){return eW.apply(this,arguments)}function eW(){eW=i(function(){var e,t,n,r,i,s,o,c,a,u,l,d;return m(this,function(p){switch(p.label){case 0:e=[{command:y(function(){return eP.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:y(function(){return eP.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:y(function(){return eP.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);i=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(s=i.next()).done))return[3,8];o=s.value,c=o.command,a=o.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,c()];case 4:u=p.sent();return[4,ti("".concat(a," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();N.warn("Installation attempt failed: ".concat(a)),N.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&i.return!=null){i.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eW.apply(this,arguments)}y(eM,"installDependencies");function eU(e,t){return eJ.apply(this,arguments)}function eJ(){eJ=i(function(e,t){var n,r,i,s,o,c,a,u,d,f,g;return m(this,function(m){switch(m.label){case 0:if(!q(e_.PACKAGE_JSON)){N.error("package.json not found. Aborting setup.");return[2]}m.label=1;case 1:m.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return eF(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=m.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,eM()];case 3:r=m.sent();m.label=4;case 4:r;s=true,o=false,c=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);a=((i=t===null||t===void 0?void 0:t.postInstallActions)!==null&&i!==void 0?i:[])[Symbol.iterator]();m.label=6;case 6:if(!!(s=(u=a.next()).done))return[3,9];d=u.value;return[4,d()];case 7:m.sent();m.label=8;case 8:s=true;return[3,6];case 9:return[3,12];case 10:f=m.sent();o=true;c=f;return[3,12];case 11:try{if(!s&&a.return!=null){a.return()}}finally{if(o){throw c}}return[7];case 12:return[3,14];case 13:g=m.sent();throw N.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})});return eJ.apply(this,arguments)}y(eU,"setupPackages");import eK from"node-persist";import eB from"node:os";import eH from"node:process";function eY(){return eH.env.CYBERSKILL_STORAGE_DIR||B(eB.homedir(),$)}y(eY,"getStorageDir");function e$(){return eV.apply(this,arguments)}function eV(){eV=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=eK.defaultInstance;if(e)return[3,2];return[4,eK.init({dir:eY(),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 eV.apply(this,arguments)}y(e$,"initNodePersist");var ez={get:function e(e){return i(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e$()];case 1:r.sent();return[4,eK.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(N.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e$()];case 1:r.sent();return[4,eK.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();N.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e$()];case 1:n.sent();return[4,eK.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();N.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e$()];case 1:n.sent();return[4,eK.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(N.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(N.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return m(this,function(t){try{return[2,"".concat(eY()," (key: ").concat(e,")")]}catch(e){return[2,(N.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eQ=E.promisify(I);function eX(e){return"error_list:".concat(e)}y(eX,"getErrorListKey");function eZ(e){return e0.apply(this,arguments)}function e0(){e0=i(function(e){var t,n,r;return m(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=eX(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,ez.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,ez.getLogLink(n)];case 1:e=t.sent();e&&N.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=s.sent();N.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return e0.apply(this,arguments)}y(eZ,"saveErrorListToStorage");function e1(){return e2.apply(this,arguments)}function e2(){e2=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ez.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=i(function(e){var t;return m(this,function(n){switch(n.label){case 0:return[4,ez.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(N.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return e2.apply(this,arguments)}y(e1,"getStoredErrorLists");function e4(){return e3.apply(this,arguments)}function e3(){e3=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ez.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return ez.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();N.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return e3.apply(this,arguments)}y(e4,"clearAllErrorLists");function e5(e){var t=[],n=[],r="",i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,s=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c,a,u,l,d;var p=i.exec(e)||[],f=s.exec(e)||[],g=o.exec(e)||[];var m,h,y,v,x,j;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===C.Error?C.Error:C.Warning,message:(m=p===null||p===void 0?void 0:(c=p[4])===null||c===void 0?void 0:c.trim())!==null&&m!==void 0?m:"",rule:(h=p===null||p===void 0?void 0:(a=p[5])===null||a===void 0?void 0:a.trim())!==null&&h!==void 0?h:""}):f.length?t.push({file:(y=f===null||f===void 0?void 0:f[1])!==null&&y!==void 0?y:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===C.Error?C.Error:C.Warning,message:(v=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&v!==void 0?v:""}):g.length?t.push({file:"commitlint",type:C.Error,message:(x=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&x!==void 0?x:"",rule:(j=g===null||g===void 0?void 0:(d=g[2])===null||d===void 0?void 0:d.trim())!==null&&j!==void 0?j:""}):n.push(e.trim())}}),t.length&&eZ(t),O&&n.length&&(N.warn("Unmatched lines:"),n.forEach(function(e){return N.info(" ".concat(e))}))}y(e5,"parseTextErrors");function e6(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,i=e.line,s=e.column,o=e.ruleId,c=e.message;n.push({type:r===2?C.Error:C.Warning,file:t,position:"".concat(i,":").concat(s),rule:o,message:c})})}),n.length&&eZ(n)}catch(t){e5(e)}}y(e6,"parseCommandOutput");function e8(e){return e9.apply(this,arguments)}function e9(){e9=i(function(e){var t,n,r,i,s,o,c,a,u;var l=arguments;return m(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:e6;n=new AbortController;S.on("SIGINT",function(){N.warn("Process interrupted. Terminating..."),n.abort(),S.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,eQ(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),i=r.stdout,s=r.stderr;[i,s].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();c=o.stdout,a=o.stderr,u=o.message;[c,a].forEach(function(e){return e&&t(e)}),!a&&!c&&N.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return e9.apply(this,arguments)}y(e8,"executeCommand");function e7(e){return{raw:!0,cmd:e}}y(e7,"rawCommand");function te(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ew," ").concat(Y," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ew," ").concat(ex," ").concat(ec," ").concat(e):"".concat(ew," ").concat(eo," ").concat(e)}y(te,"formatCLI");function tt(e,t){return typeof e=="function"?te(e(t),t):(typeof e==="undefined"?"undefined":f(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?te(e,t):e}y(tt,"formatCommand");function tn(e){return tr.apply(this,arguments)}function tr(){tr=i(function(e){var t,n,r,i,s,o,c;var a=arguments;return m(this,function(u){switch(u.label){case 0:t=a.length>1&&a[1]!==void 0?a[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];c=!1;return[3,3];case 1:return[4,eF(Y)];case 2:c=u.sent().isCurrentProject;u.label=3;case 3:i=c,s={isRemote:r,isCurrentProject:i},o=typeof e=="function"?e(s):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,tt(r,s)]}))]}})});return tr.apply(this,arguments)}y(tn,"resolveCommands");function ti(e,t){return ts.apply(this,arguments)}function ts(){ts=i(function(e,t){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);N.start("".concat(e)),O&&N.info("→ ".concat(t));return[4,e8(t)];case 1:r.sent(),N.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw N.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return ts.apply(this,arguments)}y(ti,"runCommand");function to(){return tc.apply(this,arguments)}function tc(){tc=i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!q(e_.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eP.typescriptCheck()];case 1:return[4,ti.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=N.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return tc.apply(this,arguments)}y(to,"checkTypescript");function ta(){return tu.apply(this,arguments)}function tu(){tu=i(function(){var e,t,n,r;var i=arguments;return m(this,function(s){switch(s.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eP.eslintFix()];case 1:return[4,ti.apply(void 0,n.concat([s.sent()]))];case 2:t=s.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eP.eslintCheck()];case 4:return[4,ti.apply(void 0,r.concat([s.sent()]))];case 5:t=s.sent();s.label=6;case 6:t;return[2]}})});return tu.apply(this,arguments)}y(ta,"checkEslint");function tl(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";N.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}y(tl,"printIssues");function td(){return tp.apply(this,arguments)}function tp(){tp=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,e1()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===C.Error}),n=e.filter(function(e){return e.type===C.Warning});!t.length&&!n.length?N.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tl("Warnings",n),tl("Errors",t));return[2]}})});return tp.apply(this,arguments)}y(td,"showCheckResult");function tf(){return tg.apply(this,arguments)}function tg(){tg=i(function(){var e,t,n,r,i,s;return m(this,function(o){switch(o.label){case 0:return[4,e4()];case 1:o.sent();return[4,eF(Y)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(Y)];return[4,eP.build()];case 4:return[4,ti.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eP.stageBuildDirectory()];case 6:return[4,ti.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:i=o.sent();throw N.error("Error building and staging ".concat(Y,": ").concat(i.message)),i;case 9:s=["Executing lint-staged"];return[4,eP.lintStaged()];case 10:return[4,ti.apply(void 0,s.concat([o.sent()]))];case 11:o.sent(),td();return[2]}})});return tg.apply(this,arguments)}y(tf,"lintStaged");function tm(){return th.apply(this,arguments)}function th(){th=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eP.eslintInspect()];case 1:return[4,ti.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return th.apply(this,arguments)}y(tm,"inspectLint");function ty(){return tv.apply(this,arguments)}function tv(){tv=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,e4()];case 1:e.sent();return[4,Promise.all([to(),ta()])];case 2:e.sent(),td();return[2]}})});return tv.apply(this,arguments)}y(ty,"lintCheck");function tx(){return tj.apply(this,arguments)}function tj(){tj=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,e4()];case 1:e.sent();return[4,Promise.all([to(),ta(!0)])];case 2:e.sent(),td();return[2]}})});return tj.apply(this,arguments)}y(tx,"lintFix");function tb(){return tw.apply(this,arguments)}function tw(){tw=i(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,e4()];case 1:t.sent();e=["Validating commit message"];return[4,eP.commitLint()];case 2:return[4,ti.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),td();return[2]}})});return tw.apply(this,arguments)}y(tb,"commitLint");function tI(){return tS.apply(this,arguments)}function tS(){tS=i(function(){var e,t,n,r;return m(this,function(i){switch(i.label){case 0:e=["Configuring Git hooks"];return[4,eP.configureGitHook()];case 1:return[4,ti.apply(void 0,e.concat([i.sent()]))];case 2:i.sent(),W(e_.GIT_HOOK);return[4,tn(eT)];case 3:t=i.sent();D(e_.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(et,"\n");q(e_.GIT_IGNORE)?F(e_.GIT_IGNORE).split("\n").includes(et)||M(e_.GIT_IGNORE,n):D(e_.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eP.simpleGitHooks()];case 4:return[4,ti.apply(void 0,r.concat([i.sent()]))];case 5:i.sent();return[2]}})});return tS.apply(this,arguments)}y(tI,"setupGitHook");function tE(){return tk.apply(this,arguments)}function tk(){tk=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,eU([Y],{update:!0,postInstallActions:[tI]})];case 1:e.sent();return[2]}})});return tk.apply(this,arguments)}y(tE,"setup");function tO(){return tC.apply(this,arguments)}function tC(){tC=i(function(){return m(this,function(e){switch(e.label){case 0:W(e_.NODE_MODULES,e_.PNPM_LOCK_YAML);return[4,eM()];case 1:e.sent();return[4,tI()];case 2:e.sent();return[2]}})});return tC.apply(this,arguments)}y(tO,"reset");function t_(){return tT.apply(this,arguments)}function tT(){tT=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eP.nodeModulesInspect()];case 1:return[4,ti.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tT.apply(this,arguments)}y(t_,"inspect");function tL(){return tG.apply(this,arguments)}function tG(){tG=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eP.testUnit()];case 1:return[4,ti.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tG.apply(this,arguments)}y(tL,"testUnit");function tN(){return tP.apply(this,arguments)}function tP(){tP=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eP.testE2e()];case 1:return[4,ti.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tP.apply(this,arguments)}y(tN,"testE2E");i(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j(x(v.argv)).scriptName(eo).usage("$0 <command> [options]").command("lint","Check code for linting issues",ty).command("lint:fix","Fix linting issues automatically",tx).command("lint:inspect","View active ESLint configuration",tm).command("lint-staged","Run lint checks on staged files",tf).command("commitlint","Validate commit message format",tb).command("setup","Initialize project setup and dependencies",tE).command("reset","Reset the project and reinstall dependencies",tO).command("inspect","Analyze installed project dependencies",t_).command("test:unit","Run unit test suite",tL).command("test:e2e","Run end-to-end test suite",tN).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(b.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();N.error("Fatal: ".concat(e.message)),v.exit(1);return[3,3];case 3:return[2]}})})();