@cyberskill/shared 1.102.0 → 1.103.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +50 -51
  2. package/dist/_tsup-dts-rollup.d.ts +50 -51
  3. package/dist/configs/config.util.cjs +1 -1
  4. package/dist/configs/config.util.js +1 -1
  5. package/dist/configs/index.cjs +1 -1
  6. package/dist/configs/index.js +1 -1
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.d.cts +2 -2
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.js +1 -1
  11. package/dist/nodejs/cli/cli.util.cjs +1 -1
  12. package/dist/nodejs/cli/cli.util.js +1 -1
  13. package/dist/nodejs/cli/index.cjs +1 -1
  14. package/dist/nodejs/cli/index.js +1 -1
  15. package/dist/nodejs/command/command.util.cjs +1 -1
  16. package/dist/nodejs/command/command.util.js +1 -1
  17. package/dist/nodejs/command/index.cjs +1 -1
  18. package/dist/nodejs/command/index.js +1 -1
  19. package/dist/nodejs/index.cjs +1 -1
  20. package/dist/nodejs/index.d.cts +2 -2
  21. package/dist/nodejs/index.d.ts +2 -2
  22. package/dist/nodejs/index.js +1 -1
  23. package/dist/nodejs/mongo/index.cjs +1 -1
  24. package/dist/nodejs/mongo/index.d.cts +0 -1
  25. package/dist/nodejs/mongo/index.d.ts +0 -1
  26. package/dist/nodejs/mongo/index.js +1 -1
  27. package/dist/nodejs/mongo/mongo.type.d.cts +0 -1
  28. package/dist/nodejs/mongo/mongo.type.d.ts +0 -1
  29. package/dist/nodejs/mongo/mongo.util.cjs +1 -1
  30. package/dist/nodejs/mongo/mongo.util.js +1 -1
  31. package/dist/nodejs/package/index.cjs +1 -1
  32. package/dist/nodejs/package/index.js +1 -1
  33. package/dist/nodejs/package/package.util.cjs +1 -1
  34. package/dist/nodejs/package/package.util.js +1 -1
  35. package/dist/nodejs/path/index.cjs +1 -1
  36. package/dist/nodejs/path/index.d.cts +2 -1
  37. package/dist/nodejs/path/index.d.ts +2 -1
  38. package/dist/nodejs/path/index.js +1 -1
  39. package/dist/nodejs/path/path.constant.cjs +1 -1
  40. package/dist/nodejs/path/path.constant.d.cts +2 -1
  41. package/dist/nodejs/path/path.constant.d.ts +2 -1
  42. package/dist/nodejs/path/path.constant.js +1 -1
  43. package/dist/react/index.cjs +1 -1
  44. package/dist/react/index.js +1 -1
  45. package/dist/react/vitest/index.cjs +1 -1
  46. package/dist/react/vitest/index.js +1 -1
  47. package/dist/react/vitest/vitest.unit.cjs +1 -1
  48. package/dist/react/vitest/vitest.unit.js +1 -1
  49. package/package.json +7 -8
@@ -1 +1 @@
1
- function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(r){if(Array.isArray(r))return e(r)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function o(e,r,t,n,o,a,i){try{var s=e[a](i);var c=s.value}catch(e){t(e);return}if(s.done){r(c)}else{Promise.resolve(c).then(n,o)}}function a(e){return function(){var r=this,t=arguments;return new Promise(function(n,a){var i=e.apply(r,t);function s(e){o(i,n,a,s,c,"next",e)}function c(e){o(i,n,a,s,c,"throw",e)}s(undefined)})}}function i(e,r,t){r=f(r);return I(e,T()?Reflect.construct(r,t||[],f(e).constructor):r.apply(e,t))}function s(e,r){if(!(e instanceof r)){throw new TypeError("Cannot call a class as a function")}}function c(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function u(e,r,t){if(r)c(e.prototype,r);if(t)c(e,t);return e}function l(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function f(e){f=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return f(e)}function p(e,r){if(typeof r!=="function"&&r!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:true,configurable:true}});if(r)S(e,r)}function m(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function d(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function v(e,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var o=true;var a=false;var i,s;try{for(t=t.call(e);!(o=(i=t.next()).done);o=true){n.push(i.value);if(r&&n.length===r)break}}catch(e){a=true;s=e}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(a)throw s}}return n}function g(){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 h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}n.forEach(function(r){l(e,r,t[r])})}return e}function E(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function b(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{E(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function w(e,r){if(e==null)return{};var t=_(e,r);var n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++){n=a[o];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function _(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var o,a;for(a=0;a<n.length;a++){o=n[a];if(r.indexOf(o)>=0)continue;t[o]=e[o]}return t}function I(e,r){if(r&&(k(r)==="object"||typeof r==="function")){return r}return n(e)}function S(e,r){S=Object.setPrototypeOf||function e(e,r){e.__proto__=r;return e};return S(e,r)}function O(e,t){return r(e)||v(e,t)||N(e,t)||g()}function C(e){return t(e)||d(e)||N(e)||h()}function k(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function N(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}function T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(T=function(){return!!e})()}function L(e,r){var t,n,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=s(0),i["throw"]=s(1),i["return"]=s(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(e){return function(r){return c([e,r])}}function c(s){if(t)throw new TypeError("Generator is already executing.");while(i&&(i=0,s[0]&&(a=0)),a)try{if(t=1,n&&(o=s[0]&2?n["return"]:s[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;if(n=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:a.label++;return{value:s[1],done:false};case 5:a.label++;n=s[1];s=[0];continue;case 7:s=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){a=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(s[0]===6&&a.label<o[1]){a.label=o[1];o=s;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(s);break}if(o[2])a.ops.pop();a.trys.pop();continue}s=r.call(e,a)}catch(e){s=[6,e];n=0}finally{t=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}}var P=Object.defineProperty;var x=function(e,r,t){return r in e?P(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t};var R=function(e,r){return P(e,"name",{value:r,configurable:!0})};var A=function(e,r,t){return x(e,(typeof r==="undefined"?"undefined":k(r))!="symbol"?r+"":r,t)};import{ApolloClient as G,ApolloError as D,ApolloLink as j,ApolloProvider as U,from as F,HttpLink as M,InMemoryCache as B,split as K}from"@apollo/client";import{onError as W}from"@apollo/client/link/error";import{removeTypenameFromVariables as Y}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as J}from"@apollo/client/link/subscriptions";import{getMainDefinition as Q}from"@apollo/client/utilities";import{createClient as H}from"graphql-ws";import q,{useMemo as z}from"react";import{FaInfo as $}from"react-icons/fa6";import V,{use as X}from"react";import{FaRepeat as Z}from"react-icons/fa6";import{createContext as ee}from"react";var er=ee(void 0);import et from"./apollo-error/apollo-error.module.scss";function en(){var e=X(er),r=e===null||e===void 0?void 0:e.error;if(!r)return null;var t=R(function(e,r){return(r===null||r===void 0?void 0:r.length)?V.createElement("div",null,V.createElement("strong",null,e,":"),V.createElement("ul",null,r.map(function(e){return V.createElement("li",{key:e.message},e.message)}))):null},"renderErrorList");return V.createElement("div",{className:et["modal-backdrop"]},V.createElement("div",{className:et["modal-content"]},V.createElement("button",{type:"button",className:et["btn-close"],onClick:e.hideError},"✕"),V.createElement("div",{className:et["error-title"]},V.createElement("button",{type:"button",className:et["btn-retry"],onClick:R(function(){return window.location.reload()},"onClick")},V.createElement(Z,null))," ",r.message),V.createElement("div",{className:et["error-details"]},r.networkError&&V.createElement("pre",{className:"network"},V.createElement("strong",null,"Network Error:")," ",r.networkError.message),t("GraphQL Errors",C(r.graphQLErrors)),t("Protocol Errors",C(r.protocolErrors)),t("Client Errors",C(r.clientErrors)),r.extraInfo&&V.createElement("pre",{className:"extra"},V.createElement("strong",null,"Extra Info:")," ",JSON.stringify(r.extraInfo,null,4)))))}R(en,"ApolloError");import{use as eo}from"react";function ea(){var e=eo(er);if(!e)throw new Error("useApolloError must be used within ApolloErrorProvider");return e}R(ea,"useApolloError");import ei,{useEffect as es,useMemo as ec,useState as eu}from"react";var el=null;function ef(e){el=e}R(ef,"setGlobalApolloErrorCallback");function ep(e){el===null||el===void 0?void 0:el(e)}R(ep,"showGlobalApolloError");function em(e){var r=e.children;var t=O(eu(null),2),n=t[0],o=t[1];es(function(){ef(o)},[]);var a=ec(function(){return{error:n,showError:o,hideError:R(function(){return o(null)},"hideError")}},[n]);return ei.createElement(er,{value:a},r)}R(em,"ApolloErrorProvider");import{consola as ed}from"consola/browser";var ev={silent:ed.silent,level:ed.level,fatal:ed.fatal,error:ed.error,warn:ed.warn,log:ed.log,info:ed.info,success:ed.success,ready:ed.ready,start:ed.start,box:ed.box,debug:ed.debug,trace:ed.trace,verbose:ed.verbose};import{toast as eg,Toaster as eh}from"react-hot-toast";var ey="/graphql";var eE,eb=(eE=/*#__PURE__*/function(e){"use strict";p(r,e);function r(){s(this,r);var e;e=i(this,r,arguments);A(e,"count",0);return e}u(r,[{key:"request",value:function e(e,r){var t=this;var n=Date.now();return this.count+=1,r(e).map(function(r){var o=Date.now()-n,a=e.operationName||"Unnamed";return ev.info("[Apollo] #".concat(t.count,": ").concat(a," (").concat(o,"ms)")),r})}}]);return r}(j),R(eE,"DevLoggerLink"),eE);function ew(e){var r=e.uri,t=e.wsUrl,n=e.customLinks,o=new eb,a=W(function(e){var r=e.graphQLErrors,t=e.networkError,n=e.protocolErrors,o=e.operation;var a=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(r&&r.forEach(function(e){var r=e.message,t=e.locations,n=e.path;ev.error("[GraphQL error] ".concat(a,": ").concat(r,", Location: ").concat(JSON.stringify(t),", Path: ").concat(n))}),n&&n.forEach(function(e){var r=e.message,t=e.extensions;ev.error("[Protocol error]: ".concat(r,", Extensions: ").concat(JSON.stringify(t)))}),t&&ev.error("[Network error]: ".concat(t)),r||n||t){var i,s;var c=(r===null||r===void 0?void 0:(i=r[0])===null||i===void 0?void 0:i.message)||(n===null||n===void 0?void 0:(s=n[0])===null||s===void 0?void 0:s.message)||(t===null||t===void 0?void 0:t.message)||"Unexpected error",u=new D({graphQLErrors:r||[],protocolErrors:n||[],clientErrors:[],networkError:t||null,errorMessage:c,extraInfo:{operation:o}});eg.error(function(e){return q.createElement(q.Fragment,null,c,"\xa0",q.createElement($,{cursor:"pointer",onClick:R(function(){setTimeout(function(){ep(u)},0),eg.dismiss(e.id)},"onClick")}))})}}),i=Y();r||ev.warn('[Apollo] No GraphQL URI provided — using "'.concat(ey,'" as default'));var s=new M({uri:r!==null&&r!==void 0?r:ey,credentials:"include"}),c=t?new J(H({url:t})):j.empty(),u=m(c,j)?K(function(e){var r=e.query;var t=Q(r);return t.kind==="OperationDefinition"&&t.operation==="subscription"},c,s):s;return u===s&&t&&ev.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[o,a,i].concat(C(n!==null&&n!==void 0?n:[]),[u])}R(ew,"createApolloLinks");function e_(e){var r=e.isNextJS,t=e.options,n=e.children,o=e.client,a=e.provider,i=e.cache;var s=t||{},c=s.uri,u=s.wsUrl,l=s.customLinks,f=w(s,["uri","wsUrl","customLinks"]),p=o!==null&&o!==void 0?o:G;if(typeof p!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var d=a||U,v=z(function(){return F(ew({uri:c!==null&&c!==void 0?c:ey,wsUrl:u!==null&&u!==void 0?u:"",customLinks:l!==null&&l!==void 0?l:[]}))},[c,u,l]),g=z(function(){return m(i,B)?i:new B},[i]),h=z(function(){return new p(y({link:v,cache:g},f))},[p,v,g,f]),E=r?q.createElement(d,{makeClient:R(function(){return h},"makeClient")},n):q.createElement(d,{client:h},n);return q.createElement(q.Fragment,null,q.createElement(em,null,E,q.createElement(en,null)),q.createElement(eh,{position:"top-right"}))}R(e_,"ApolloProvider");import{useTranslation as eI}from"react-i18next";var eS=eI;import eO from"i18next";import{initReactI18next as eC}from"react-i18next";function ek(e){return eO.use(eC).init(e)}R(ek,"initI18next");import eN from"classnames";import eT from"react";import eL from"./loading/loading.module.scss";function eP(e){var r=e.full,t=r===void 0?!1:r,n=e.block,o=n===void 0?!1:n,a=e.className,i=a===void 0?"":a,s=e.message,c=s===void 0?"Loading":s,u=w(e,["full","block","className","message"]);function l(){return eT.createElement("div",y({className:eL.container},u),eT.createElement("div",{className:eL.ring}),eT.createElement("div",{className:eL.ring}),eT.createElement("div",{className:eL.ring}),eT.createElement("div",{className:eL.ring}),c&&eT.createElement("div",{className:eL.message},c))}return R(l,"_renderLoading"),t?eT.createElement("div",{className:eN(eL.fullscreen,i)},l()):o?eT.createElement("div",{className:eN(eL.block,i)},l()):l()}R(eP,"Loading");import{createContext as ex}from"react";var eR=ex(void 0);import{use as eA}from"react";function eG(){var e=eA(eR);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}R(eG,"useLoading");import eD,{useCallback as ej,useMemo as eU,useState as eF}from"react";function eM(e){var r=e.children;var t=O(eF(!1),2),n=t[0],o=t[1],a=O(eF(!1),2),i=a[0],s=a[1],c=ej(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),s(e)},[]),u=ej(function(){o(!1),s(!1)},[]),l=eU(function(){return{isLoading:n,isGlobalLoading:i,showLoading:c,hideLoading:u}},[n,i,c,u]);return eD.createElement(eR,{value:l},n?eD.createElement(eP,{full:i}):r)}R(eM,"LoadingProvider");import{enUS as eB}from"date-fns/locale";var eK={label:"English",value:"en",flag:"\uD83C\uDDFA\uD83C\uDDF8",adapterLocale:eB,icon:"flagpack:gb-nir",numberFormat:{code:"en-US",currency:"USD"},timezone:"America/New_York"};import{createContext as eW}from"react";var eY=eW(void 0);import{NextIntlClientProvider as eJ}from"next-intl";import eQ from"react";import{useTranslations as eH}from"next-intl";import{use as eq}from"react";function ez(){var e=eq(eY);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}R(ez,"useNextIntl");var e$=eH;function eV(e){var r=R(function(r){var t;var n;var o=ez(),a=o.currentLanguage,i=r.messages,s=r.languages,c="en",u=i[(a===null||a===void 0?void 0:a.value)||c],l=(n=(t=s.find(function(e){return e.value===(a===null||a===void 0?void 0:a.value)}))===null||t===void 0?void 0:t.timezone)!==null&&n!==void 0?n:eK.timezone;return i?eQ.createElement(eJ,{locale:(a===null||a===void 0?void 0:a.value)||c,messages:u||null,timeZone:l},eQ.createElement(e,r)):(ev.warn("Missing messages for language: ".concat((a===null||a===void 0?void 0:a.value)||c)),null)},"PageWithI18n");return r.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),r}R(eV,"withNextIntl");import eX,{useMemo as eZ}from"react";import{useCallback as e0,useEffect as e1,useState as e2}from"react";var e3={serialize:R(function(e){return JSON.stringify(e,function(e,r){return m(r,Date)?{__type:"Date",value:r.toISOString()}:r})},"serialize"),deserialize:R(function(e){return JSON.parse(e,function(e,r){return(r===null||r===void 0?void 0:r.__type)==="Date"?new Date(r.value):r})},"deserialize")};import e4 from"localforage";var e5={get:function e(e){return a(function(){var r;return L(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,e4.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(ev.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return a(function(){var t;return L(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,e4.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();ev.error('[Storage:set] Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return a(function(){var r;return L(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,e4.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();ev.error('[Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},keys:function e(){return a(function(){var e,r;return L(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,e4.keys()];case 1:return[2,(e=t.sent())!==null&&e!==void 0?e:[]];case 2:r=t.sent();return[2,(ev.error("[Storage:keys] Error getting keys:",r),[])];case 3:return[2]}})})()}};function e8(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e3;var n=O(e2(r),2),o=n[0],i=n[1],s=O(e2(!1),2),c=s[0],u=s[1];e1(function(){var n=!0;return R(/*#__PURE__*/a(function(){var o,a,s,c;return L(this,function(l){switch(l.label){case 0:l.trys.push([0,6,7,8]);return[4,e5.get(e)];case 1:o=l.sent();if(!n)return[3,5];if(!(o!==null))return[3,2];a=t.deserialize(o);i(a);return[3,5];case 2:if(!(r!==void 0))return[3,4];s=t.serialize(r);return[4,e5.set(e,s)];case 3:l.sent(),i(r);return[3,5];case 4:i(void 0);l.label=5;case 5:return[3,8];case 6:c=l.sent();ev.error('Error loading value for key "'.concat(e,'":'),c),n&&i(r);return[3,8];case 7:n&&u(!0);return[7];case 8:return[2]}})}),"loadValue")(),function(){n=!1,u(!1)}},[e,r,t]),e1(function(){if(!c)return;R(/*#__PURE__*/a(function(){var r,n;return L(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);if(!(o!==void 0))return[3,2];r=t.serialize(o);return[4,e5.set(e,r)];case 1:a.sent();a.label=2;case 2:return[3,4];case 3:n=a.sent();ev.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})}),"saveValue")()},[o,e,t,c]);var l=e0(function(e){i(function(r){return typeof e=="function"?e(r):e})},[]),f=e0(/*#__PURE__*/a(function(){var r;return L(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,e5.remove(e)];case 1:t.sent(),i(void 0);return[3,3];case 2:r=t.sent();ev.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})}),[e]);return{value:o,set:l,remove:f}}R(e8,"useStorage");function e6(e){var r=e.children;return eX.createElement(eX.Fragment,null,r)}R(e6,"LanguageWrapperBase");var e7=eV(e6);function e9(e){var r=e.children,t=e.languages,n=e.messages;var o=e8("lang",t[0]),a=o.value,i=o.set,s=eZ(function(){return{languages:t,currentLanguage:a!==null&&a!==void 0?a:eK,setCurrentLanguage:i}},[t,i,a]);return eX.createElement(eY,{value:s},eX.createElement(e7,{languages:t,messages:n},r))}R(e9,"NextIntlProvider");import re from"@vitejs/plugin-react-swc";import{defineConfig as rr}from"vitest/config";function rt(e){return rr(y({plugins:[re()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}R(rt,"vitestE2E");import rn from"@vitejs/plugin-react-swc";import{defineConfig as ro}from"vitest/config";var ra=".cyberskill-storage";import ri from"dotenv";import{bool as rs,cleanEnv as rc,str as ru}from"envalid";import rl from"node:os";import rf from"node:path";import rp from"node:process";ri.config();function rm(){var e={DEBUG:rp.env.DEBUG||!1,CWD:rp.env.CWD||rp.cwd(),CYBERSKILL_STORAGE_DIRECTORY:rp.env.CYBERSKILL_STORAGE_DIRECTORY||rf.join(rl.homedir(),ra)};return rc(e,{DEBUG:rs(),CWD:ru(),CYBERSKILL_STORAGE_DIRECTORY:ru()})}R(rm,"getEnv");var rd="MONGO_MIGRATE_OPTIONS";import{Collection as rv,Db as rg}from"mongodb";import{Document as rh,Model as ry}from"mongoose";import{format as rE}from"date-fns";import rb from"migrate-mongo";import{Document as rw}from"mongoose";import r_ from"mongoose-aggregate-paginate-v2";import rI from"mongoose-paginate-v2";import{v4 as rS}from"uuid";import rO from"node-persist";var rC=function(e){return e.Error="error",e.Warning="warning",e}({});import rk from"chalk";import rN from"consola";import{GraphQLError as rT}from"graphql";var rL=rm();rL.DEBUG||(rN.level=4);function rP(e){var r=rk[e];return typeof r=="function"?r:rk.green}R(rP,"chalkKeyword");var rx={silent:rN.silent,level:rN.level,fatal:rN.fatal,error:rN.error,warn:rN.warn,log:rN.log,info:rN.info,success:rN.success,ready:rN.ready,start:rN.start,box:rN.box,debug:rN.debug,trace:rN.trace,verbose:rN.verbose,printBoxedLog:function e(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(r===null||r===void 0?void 0:r.length)){rN.box(rk.green(e));return}r.forEach(function(e){var r=e.file,n=e.position,o=e.rule,a=e.message;rN.log("".concat(rk.gray("File:")," ").concat(rk.blue("".concat(r).concat(n?":".concat(n):"")))),o&&rN.log(" ".concat(rP(t)("Rule:")," ").concat(o)),rN.log(" ".concat(rP(t)("Message:")," ").concat(a))}),rN.box(rP(t)("".concat(e," : ").concat(r.length))),rN.log(rk.gray("─".repeat(40)))}};var rR=rm();function rA(){return rG.apply(this,arguments)}function rG(){rG=a(function(){var e;return L(this,function(r){switch(r.label){case 0:e=rO.defaultInstance;if(e)return[3,2];return[4,rO.init({dir:rR.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return rG.apply(this,arguments)}R(rA,"initNodePersist");var rD={get:function e(e){return a(function(){var r,t;return L(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,rA()];case 1:n.sent();return[4,rO.getItem(e)];case 2:return[2,(r=n.sent())!==null&&r!==void 0?r:null];case 3:t=n.sent();return[2,(rx.error('[Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 4:return[2]}})})()},set:function e(e,r){return a(function(){var t;return L(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,rA()];case 1:n.sent();return[4,rO.setItem(e,r)];case 2:n.sent();return[3,4];case 3:t=n.sent();rx.error('[Storage:set] Error setting key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},remove:function e(e){return a(function(){var r;return L(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,rA()];case 1:t.sent();return[4,rO.removeItem(e)];case 2:t.sent();return[3,4];case 3:r=t.sent();rx.error('[Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},keys:function e(){return a(function(){var e,r;return L(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,rA()];case 1:t.sent();return[4,rO.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(rx.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:r=t.sent();return[2,(rx.error("[Storage:keys] Error getting keys:",r),[])];case 4:return[2]}})})()},getLogLink:function e(e){return a(function(){return L(this,function(r){try{return[2,"".concat(rR.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(rx.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};import rj from"crypto-js";import rU from"slugify";var rF=rU.default||rU;var rM={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":k(e))=="object"?m(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var rB={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return rE(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.returnDateAs,t=r===void 0?"string":r;var n=t==="string"?rB.getDateTime():new Date;return{id:rS(),isDel:!1,createdAt:n,updatedAt:n}},applyPlugins:function e(e,r){r.filter(function(e){return typeof e=="function"}).forEach(function(r){return e.plugin(r)})},applyMiddlewares:function e(e,r){r.forEach(function(r){var t=r.method,n=r.pre,o=r.post;t&&n&&e.pre(t,n),t&&o&&e.post(t,o)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:rS,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var r=e.mongoose,t=e.schema,n=e.virtuals,o=n===void 0?[]:n,a=e.standalone,i=a===void 0?!1:a;var s=new r.Schema(t,{strict:!0});return o.forEach(function(e){var r=e.name,t=e.options,n=e.get;var o=s.virtual(r,t);n&&o.get(n)}),i||s.add(rB.createGenericSchema(r)),s},createModel:function e(e){var r=e.mongoose,t=e.name,n=e.schema,o=e.pagination,a=o===void 0?!1:o,i=e.aggregate,s=i===void 0?!1:i,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,f=l===void 0?[]:l;if(!t)throw new Error("Model name is required.");if(r.models[t])return r.models[t];var p=rB.createSchema({mongoose:r,schema:n,virtuals:u});return rB.applyPlugins(p,[a&&rI,s&&r_]),rB.applyMiddlewares(p,f),r.model(t,p)},createSlugQuery:function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;return b(y({},r,t&&{id:{$ne:t}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=a(function(e){return L(this,function(r){return[2,!rM.isEmpty(e)]})});return function(r){return e.apply(this,arguments)}}()},isUnique:function e(e){return /*#__PURE__*/function(){var r=a(function(r){var t;return L(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");t={$or:e.map(function(e){return l({},e,r)})};return[4,this.constructor.findOne(t)];case 1:return[2,!n.sent()]}})});return function(e){return r.apply(this,arguments)}}()},matchesRegex:function e(e){return /*#__PURE__*/function(){var r=a(function(r){return L(this,function(t){if(!Array.isArray(e)||e.some(function(e){return!m(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(r)})]})});return function(e){return r.apply(this,arguments)}}()}},migrate:{withConfig:R(/*#__PURE__*/function(){var e=a(function(e,r){var t,n,o,a;return L(this,function(i){switch(i.label){case 0:return[4,rD.get(rd)];case 1:t=i.sent();if(!t)throw new Error("Missing migrate config");if(rb.config.set(t),!r)return[2,e(void 0)];return[4,rb.database.connect()];case 2:n=i.sent(),o=n.db,a=n.client;i.label=3;case 3:i.trys.push([3,,5,7]);return[4,e({db:o,client:a})];case 4:return[2,i.sent()];case 5:return[4,a.close()];case 6:i.sent();return[7];case 7:return[2]}})});return function(r,t){return e.apply(this,arguments)}}(),"withConfig"),init:R(/*#__PURE__*/a(function(){return L(this,function(e){switch(e.label){case 0:return[4,rb.init()];case 1:e.sent();return[2]}})}),"init"),create:R(/*#__PURE__*/function(){var e=a(function(e){return L(this,function(r){switch(r.label){case 0:return[4,rB.migrate.withConfig(function(){return rb.create(e)})];case 1:r.sent();return[2]}})});return function(r){return e.apply(this,arguments)}}(),"create"),up:R(/*#__PURE__*/a(function(){return L(this,function(e){switch(e.label){case 0:return[4,import("ts-node").then(function(e){return e.register({transpileOnly:!0})})];case 1:e.sent();return[4,rB.migrate.withConfig(/*#__PURE__*/function(){var e=a(function(e){var r,t;return L(this,function(n){switch(n.label){case 0:r=e.db,t=e.client;return[4,rb.up(r,t)];case 1:n.sent();return[2]}})});return function(r){return e.apply(this,arguments)}}(),!0)];case 2:e.sent();return[2]}})}),"up"),down:R(/*#__PURE__*/a(function(){return L(this,function(e){switch(e.label){case 0:return[4,import("ts-node").then(function(e){return e.register({transpileOnly:!0})})];case 1:e.sent();return[4,rB.migrate.withConfig(/*#__PURE__*/function(){var e=a(function(e){var r,t;return L(this,function(n){switch(n.label){case 0:r=e.db,t=e.client;return[4,rb.down(r,t)];case 1:n.sent();return[2]}})});return function(r){return e.apply(this,arguments)}}(),!0)];case 2:e.sent();return[2]}})}),"down"),status:R(/*#__PURE__*/a(function(){return L(this,function(e){switch(e.label){case 0:return[4,rB.migrate.withConfig(/*#__PURE__*/function(){var e=a(function(e){var r;return L(this,function(t){switch(t.label){case 0:r=e.db;return[4,rb.status(r)];case 1:t.sent();return[2]}})});return function(r){return e.apply(this,arguments)}}(),!0)];case 1:e.sent();return[2]}})}),"status"),config:R(function(e){rD.set(rd,e)},"config")}};var rK=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as rW}from"node:child_process";import rY from"node:process";import*as rJ from"node:util";var rQ={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import rH from"node-fetch";import rq from"fs-extra";var rz=rq.readFileSync,r$=rq.writeFileSync,rV=rq.pathExistsSync,rX=rq.appendFileSync,rZ=rq.copySync,r0=rq.removeSync,r1=rq.statSync,r2=rq.readJsonSync,r3=rq.writeJsonSync;function r4(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return r.every(function(e){return rV(e)})}R(r4,"existsSync");var r5=rm();function r8(e){var r=tI(r5.CWD,tT);if(!r4(r))return!1;try{var t=r2(r),n=t.name,o=t.dependencies,a=o===void 0?{}:o,i=t.devDependencies,s=i===void 0?{}:i,c=n===e,u=e in a,l=e in s;return c||u||l?{path:r,file:t,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return rx.warn("Failed to read package.json: ".concat(e.message)),!1}}R(r8,"getPackage");function r6(e){return r7.apply(this,arguments)}function r7(){r7=a(function(e){var r,t,n,o;return L(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,rH("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:r=a.sent();if(!r.ok)throw new Error("Failed to fetch latest version: ".concat(r.status," ").concat(r.statusText));return[4,r.json()];case 2:t=a.sent(),n=t.version;return[2,n];case 3:o=a.sent();throw rx.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})});return r7.apply(this,arguments)}R(r6,"getLatestPackageVersion");function r9(e,r){return te.apply(this,arguments)}function te(){te=a(function(e,r){var t,n,o,a,i,s,c,u,l,f,p,m,d,v,g,h,E,b,w,_,I;return L(this,function(S){switch(S.label){case 0:S.trys.push([0,4,,5]);t=r8(e);if(!t)return[2,y({},rQ)];c=t.path,u=t.file,l=t.isCurrentProject,f=t.isDepend,p=t.isDevDepend,m=(n=u.dependencies)!==null&&n!==void 0?n:{},d=(o=u.devDependencies)!==null&&o!==void 0?o:{},v=l?(a=u.version)!==null&&a!==void 0?a:"0.0.0":f?(i=m[e])!==null&&i!==void 0?i:"0.0.0":p?(s=d[e])!==null&&s!==void 0?s:"0.0.0":"0.0.0";if(!l)return[3,1];E=v;return[3,3];case 1:return[4,r6(e)];case 2:E=S.sent();S.label=3;case 3:g=E,h=l||v===g;if(!h&&(r===null||r===void 0?void 0:r.update)){;w=f?"dependencies":p?"devDependencies":null;w&&((b=u[w])===null||b===void 0?void 0:b[e])!==g&&(u[w]=(_=u[w])!==null&&_!==void 0?_:{},u[w][e]=g,r3(c,u),rx.info('Updated "'.concat(e,'" to version ').concat(g)))}return[2,{isCurrentProject:l,installedPath:c,file:u,isUpToDate:h}];case 4:I=S.sent();return[2,(rx.error('Error checking package "'.concat(e,'": ').concat(I.message)),y({},rQ))];case 5:return[2]}})});return te.apply(this,arguments)}R(r9,"checkPackage");function tr(){return tt.apply(this,arguments)}function tt(){tt=a(function(){var e,r,t,n,o,a,i,s,c,u,l,f;return L(this,function(p){switch(p.label){case 0:e=[{command:R(function(){return nt.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:R(function(){return nt.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:R(function(){return nt.pnpmInstallForce()},"command"),message:"Retrying with force install"}];r=true,t=false,n=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);o=e[Symbol.iterator]();p.label=2;case 2:if(!!(r=(a=o.next()).done))return[3,8];i=a.value,s=i.command,c=i.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,s()];case 4:u=p.sent();return[4,th("".concat(c," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();rx.warn("Installation attempt failed: ".concat(c)),rx.error("Details: ".concat(l.message));return[3,7];case 7:r=true;return[3,2];case 8:return[3,11];case 9:f=p.sent();t=true;n=f;return[3,11];case 10:try{if(!r&&o.return!=null){o.return()}}finally{if(t){throw n}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return tt.apply(this,arguments)}R(tr,"installDependencies");function tn(e,r){return to.apply(this,arguments)}function to(){to=a(function(e,r){var t,n,o,a,i,s,c,u,l,f,p;return L(this,function(m){switch(m.label){case 0:if(!r4(t7.PACKAGE_JSON)){rx.error("package.json not found. Aborting setup.");return[2]}m.label=1;case 1:m.trys.push([1,13,,14]);t=C(new Set(e)).sort();return[4,Promise.all(t.map(function(e){return r9(e,y({},(r===null||r===void 0?void 0:r.update)&&{update:r.update}))}))];case 2:n=m.sent().every(function(e){return e.isUpToDate});if(n)return[3,4];return[4,tr()];case 3:n=m.sent();m.label=4;case 4:n;a=true,i=false,s=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);c=((o=r===null||r===void 0?void 0:r.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();m.label=6;case 6:if(!!(a=(u=c.next()).done))return[3,9];l=u.value;return[4,l()];case 7:m.sent();m.label=8;case 8:a=true;return[3,6];case 9:return[3,12];case 10:f=m.sent();i=true;s=f;return[3,12];case 11:try{if(!a&&c.return!=null){c.return()}}finally{if(i){throw s}}return[7];case 12:return[3,14];case 13:p=m.sent();throw rx.error('Failed to setup "'.concat(e.join(", "),'": ').concat(p.message)),p;case 14:return[2]}})});return to.apply(this,arguments)}R(tn,"setupPackages");var ta=rm(),ti=rJ.promisify(rW);function ts(e){return"error_list:".concat(e)}R(ts,"getErrorListKey");function tc(e){return tu.apply(this,arguments)}function tu(){tu=a(function(e){var r,t,n;return L(this,function(o){switch(o.label){case 0:if(e.length===0)return[2];r=Date.now(),t=ts(r);o.label=1;case 1:o.trys.push([1,3,,4]);return[4,rD.set(t,{errors:e,timestamp:r})];case 2:o.sent(),setTimeout(/*#__PURE__*/a(function(){var e;return L(this,function(r){switch(r.label){case 0:return[4,rD.getLogLink(t)];case 1:e=r.sent();e&&rx.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:n=o.sent();rx.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return tu.apply(this,arguments)}R(tc,"saveErrorListToStorage");function tl(e){var r=[],t=[],n="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,i=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var s,c,u,l,f;var p=o.exec(e)||[],m=a.exec(e)||[],d=i.exec(e)||[];var v,g,h,y,E,b;p.length&&n?r.push({file:n,position:"".concat(p[1],":").concat(p[2]),type:p[3]===rC.Error?rC.Error:rC.Warning,message:(v=p===null||p===void 0?void 0:(s=p[4])===null||s===void 0?void 0:s.trim())!==null&&v!==void 0?v:"",rule:(g=p===null||p===void 0?void 0:(c=p[5])===null||c===void 0?void 0:c.trim())!==null&&g!==void 0?g:""}):m.length?r.push({file:(h=m===null||m===void 0?void 0:m[1])!==null&&h!==void 0?h:"",position:"".concat(m[2],":").concat(m[3]),type:m[4]===rC.Error?rC.Error:rC.Warning,message:(y=m===null||m===void 0?void 0:(u=m[5])===null||u===void 0?void 0:u.trim())!==null&&y!==void 0?y:""}):d.length?r.push({file:"commitlint",type:rC.Error,message:(E=d===null||d===void 0?void 0:(l=d[1])===null||l===void 0?void 0:l.trim())!==null&&E!==void 0?E:"",rule:(b=d===null||d===void 0?void 0:(f=d[2])===null||f===void 0?void 0:f.trim())!==null&&b!==void 0?b:""}):t.push(e.trim())}}),r.length&&tc(r),ta.DEBUG&&t.length&&(rx.warn("Unmatched lines:"),t.forEach(function(e){return rx.info(" ".concat(e))}))}R(tl,"parseTextErrors");function tf(e){try{var r=JSON.parse(e),t=[];r.forEach(function(e){var r=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,o=e.line,a=e.column,i=e.ruleId,s=e.message;t.push({type:n===2?rC.Error:rC.Warning,file:r,position:"".concat(o,":").concat(a),rule:i,message:s})})}),t.length&&tc(t)}catch(r){tl(e)}}R(tf,"parseCommandOutput");function tp(e){return tm.apply(this,arguments)}function tm(){tm=a(function(e){var r,t,n,o,a,i,s,c,u;var l=arguments;return L(this,function(f){switch(f.label){case 0:r=l.length>1&&l[1]!==void 0?l[1]:tf;t=new AbortController;rY.on("SIGINT",function(){rx.warn("Process interrupted. Terminating..."),t.abort(),rY.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,ti(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:n=f.sent(),o=n.stdout,a=n.stderr;[o,a].forEach(function(e){return e&&r(e)});f.label=3;case 3:return[3,5];case 4:i=f.sent();s=i.stdout,c=i.stderr,u=i.message;[s,c].forEach(function(e){return e&&r(e)}),!c&&!s&&rx.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})});return tm.apply(this,arguments)}R(tp,"executeCommand");function td(e){return{raw:!0,cmd:e}}R(td,"rawCommand");function tv(e,r){return(r===null||r===void 0?void 0:r.isRemote)?"".concat(t0," ").concat(tC," ").concat(e):(r===null||r===void 0?void 0:r.isCurrentProject)?"".concat(t0," ").concat(tV," ").concat(tF," ").concat(e):"".concat(t0," ").concat(tU," ").concat(e)}R(tv,"formatCLI");function tg(e,r){return typeof e=="function"?tv(e(r),r):(typeof e==="undefined"?"undefined":k(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?tv(e,r):e}R(tg,"formatCommand");function th(e,r){return ty.apply(this,arguments)}function ty(){ty=a(function(e,r){var t;return L(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);rx.start("".concat(e)),ta.DEBUG&&rx.info("→ ".concat(r));return[4,tp(r)];case 1:n.sent(),rx.success("".concat(e," done."));return[3,3];case 2:t=n.sent();throw rx.error("".concat(e," failed: ").concat(t.message)),t;case 3:return[2]}})});return ty.apply(this,arguments)}R(th,"runCommand");import{join as tE,resolve as tb}from"node:path";var tw=rm();function t_(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return tb.apply(void 0,[tw.CWD].concat(C(r)))}R(t_,"resolveWorkingPath");function tI(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return tE.apply(void 0,C(r))}R(tI,"join");var tS=rm(),tO=tS.CWD,tC="@cyberskill/shared",tk="node_modules",tN="dist",tT="package.json",tL="package-lock.json",tP="tsconfig.json",tx=".gitignore",tR=".simple-git-hooks.json",tA="pnpm-lock.yaml",tG=".git/hooks/",tD=".git/COMMIT_EDITMSG",tj=tI(tO,tk,tC,tN),tU="cyberskill",tF="src/nodejs/cli/index.ts",tM="eslint",tB="eslint",tK="vitest",tW="playwright",tY="vitest",tJ="@commitlint/cli",tQ="commitlint",tH="lint-staged",tq="lint-staged",tz="typescript",t$="tsc",tV="tsx",tX="git",tZ="pnpm",t0="pnpm exec",t1="simple-git-hooks",t2="simple-git-hooks",t3="@eslint/config-inspector",t4="eslint-config-inspector",t5="node-modules-inspector",t8="node-modules-inspector",t6="migrate-mongo";var t7={CYBERSKILL_DIRECTORY:tj,WORKING_DIRECTORY:tO,TS_CONFIG:t_(tP),GIT_IGNORE:t_(tx),GIT_HOOK:t_(tG),GIT_COMMIT_MSG:t_(tD),SIMPLE_GIT_HOOKS_JSON:t_(tR),PACKAGE_JSON:t_(tT),PACKAGE_LOCK_JSON:t_(tL),PNPM_LOCK_YAML:t_(tA),NODE_MODULES:t_(tk),LINT_STAGED_CONFIG:t_("".concat(tj,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:t_("".concat(tj,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:t_("".concat(tj,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:t_("".concat(tj,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:t_("".concat(tj,"/react/vitest/vitest.e2e.js"))};function t9(e,r,t){return ne.apply(this,arguments)}function ne(){ne=a(function(e,r,t){return L(this,function(n){switch(n.label){case 0:if(!r)throw new Error("'first' argument is undefined");switch(e){case rK.CLI:return[3,1];case rK.STRING:return[3,3];case rK.FUNCTION:return[3,4]}return[3,6];case 1:return[4,tn(r.split(" "),{update:!0})];case 2:return[2,(n.sent(),tg(td("".concat(t0," ").concat(t))))];case 3:return[2,tg(td(r))];case 4:return[4,tn(r.split(" "),{update:!0})];case 5:if(n.sent(),typeof t=="function")return[2,t()];throw new Error("'second' argument is not a callable function");case 6:throw new Error("Unsupported command type");case 7:return[2]}})});return ne.apply(this,arguments)}R(t9,"buildCommand");function nr(e,r,t){return /*#__PURE__*/a(function(){return L(this,function(n){return[2,t9(e,r,t)]})})}R(nr,"commandFactory");var nt={simpleGitHooks:nr(rK.CLI,t1,t2),eslintInspect:nr(rK.CLI,t3,t4),nodeModulesInspect:nr(rK.CLI,t5,t8),eslintCheck:nr(rK.CLI,tM,"".concat(tB," ").concat(t7.WORKING_DIRECTORY)),eslintFix:nr(rK.CLI,tM,"".concat(tB," ").concat(t7.WORKING_DIRECTORY," --fix")),typescriptCheck:nr(rK.CLI,tz,"".concat(t$," -p ").concat(t7.TS_CONFIG," --noEmit")),configureGitHook:nr(rK.STRING,"".concat(tX," config core.hooksPath ").concat(t7.GIT_HOOK)),testUnit:nr(rK.CLI,tK,"".concat(tY," --config ").concat(t7.UNIT_TEST_CONFIG)),testE2e:nr(rK.CLI,"".concat(tK," ").concat(tW),"".concat(tY," --config ").concat(t7.E2E_TEST_CONFIG)),mongoMigrateCreate:R(function(e){return nr(rK.FUNCTION,"".concat(t6),function(){return rB.migrate.create(e)})()},"mongoMigrateCreate"),mongoMigrateUp:nr(rK.FUNCTION,"".concat(t6),rB.migrate.up),mongoMigrateDown:nr(rK.FUNCTION,"".concat(t6),rB.migrate.down),commitLint:nr(rK.CLI,tJ,"".concat(tQ," --edit ").concat(t7.GIT_COMMIT_MSG," --config ").concat(t7.COMMITLINT_CONFIG)),lintStaged:nr(rK.CLI,tH,"".concat(tq," --config ").concat(t7.LINT_STAGED_CONFIG)),stageBuildDirectory:nr(rK.STRING,"".concat(tX," add ").concat(tN)),build:nr(rK.STRING,"".concat(tZ," run build")),pnpmInstallStandard:nr(rK.STRING,"".concat(tZ," install")),pnpmInstallLegacy:nr(rK.STRING,"".concat(tZ," install --legacy-peer-deps")),pnpmInstallForce:nr(rK.STRING,"".concat(tZ," install --force"))};function nn(e){return ro(y({plugins:[rn()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[t7.UNIT_TEST_SETUP_CONFIG]}},e))}R(nn,"vitestUnit");export{en as ApolloError,er as ApolloErrorContext,em as ApolloErrorProvider,e_ as ApolloProvider,ey as GRAPHQL_URI_DEFAULT,eP as Loading,eR as LoadingContext,eM as LoadingProvider,eK as NEXT_INTL_DEFAULT_LANGUAGE,eY as NextIntlContext,e9 as NextIntlProvider,eh as Toaster,ek as initI18next,ev as log,ef as setGlobalApolloErrorCallback,ep as showGlobalApolloError,e5 as storage,eg as toast,ea as useApolloError,eG as useLoading,ez as useNextIntl,e8 as useStorage,eS as useTranslateI18next,e$ as useTranslateNextIntl,rt as vitestE2E,nn as vitestUnit,eV as withNextIntl};
1
+ function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(r){if(Array.isArray(r))return e(r)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function o(e,r,t,n,o,a,i){try{var s=e[a](i);var c=s.value}catch(e){t(e);return}if(s.done){r(c)}else{Promise.resolve(c).then(n,o)}}function a(e){return function(){var r=this,t=arguments;return new Promise(function(n,a){var i=e.apply(r,t);function s(e){o(i,n,a,s,c,"next",e)}function c(e){o(i,n,a,s,c,"throw",e)}s(undefined)})}}function i(e,r,t){r=f(r);return w(e,k()?Reflect.construct(r,t||[],f(e).constructor):r.apply(e,t))}function s(e,r){if(!(e instanceof r)){throw new TypeError("Cannot call a class as a function")}}function c(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function l(e,r,t){if(r)c(e.prototype,r);if(t)c(e,t);return e}function u(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function f(e){f=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return f(e)}function m(e,r){if(typeof r!=="function"&&r!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:true,configurable:true}});if(r)I(e,r)}function p(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function d(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function v(e,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var o=true;var a=false;var i,s;try{for(t=t.call(e);!(o=(i=t.next()).done);o=true){n.push(i.value);if(r&&n.length===r)break}}catch(e){a=true;s=e}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(a)throw s}}return n}function g(){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 h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}n.forEach(function(r){u(e,r,t[r])})}return e}function E(e,r){if(e==null)return{};var t=b(e,r);var n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++){n=a[o];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function b(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var o,a;for(a=0;a<n.length;a++){o=n[a];if(r.indexOf(o)>=0)continue;t[o]=e[o]}return t}function w(e,r){if(r&&(_(r)==="object"||typeof r==="function")){return r}return n(e)}function I(e,r){I=Object.setPrototypeOf||function e(e,r){e.__proto__=r;return e};return I(e,r)}function C(e,t){return r(e)||v(e,t)||O(e,t)||g()}function S(e){return t(e)||d(e)||O(e)||h()}function _(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function O(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}function k(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(k=function(){return!!e})()}function N(e,r){var t,n,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=s(0),i["throw"]=s(1),i["return"]=s(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(e){return function(r){return c([e,r])}}function c(s){if(t)throw new TypeError("Generator is already executing.");while(i&&(i=0,s[0]&&(a=0)),a)try{if(t=1,n&&(o=s[0]&2?n["return"]:s[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;if(n=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:a.label++;return{value:s[1],done:false};case 5:a.label++;n=s[1];s=[0];continue;case 7:s=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){a=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(s[0]===6&&a.label<o[1]){a.label=o[1];o=s;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(s);break}if(o[2])a.ops.pop();a.trys.pop();continue}s=r.call(e,a)}catch(e){s=[6,e];n=0}finally{t=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}}var L=Object.defineProperty;var T=function(e,r,t){return r in e?L(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t};var G=function(e,r){return L(e,"name",{value:r,configurable:!0})};var x=function(e,r,t){return T(e,(typeof r==="undefined"?"undefined":_(r))!="symbol"?r+"":r,t)};import{ApolloClient as A,ApolloError as P,ApolloLink as R,ApolloProvider as D,from as j,HttpLink as U,InMemoryCache as M,split as F}from"@apollo/client";import{onError as B}from"@apollo/client/link/error";import{removeTypenameFromVariables as K}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as W}from"@apollo/client/link/subscriptions";import{getMainDefinition as Y}from"@apollo/client/utilities";import{createClient as J}from"graphql-ws";import z,{useMemo as Q}from"react";import{FaInfo as H}from"react-icons/fa6";import q,{use as V}from"react";import{FaRepeat as $}from"react-icons/fa6";import{createContext as X}from"react";var Z=X(void 0);import ee from"./apollo-error/apollo-error.module.scss";function er(){var e=V(Z),r=e===null||e===void 0?void 0:e.error;if(!r)return null;var t=G(function(e,r){return(r===null||r===void 0?void 0:r.length)?q.createElement("div",null,q.createElement("strong",null,e,":"),q.createElement("ul",null,r.map(function(e){return q.createElement("li",{key:e.message},e.message)}))):null},"renderErrorList");return q.createElement("div",{className:ee["modal-backdrop"]},q.createElement("div",{className:ee["modal-content"]},q.createElement("button",{type:"button",className:ee["btn-close"],onClick:e.hideError},"✕"),q.createElement("div",{className:ee["error-title"]},q.createElement("button",{type:"button",className:ee["btn-retry"],onClick:G(function(){return window.location.reload()},"onClick")},q.createElement($,null))," ",r.message),q.createElement("div",{className:ee["error-details"]},r.networkError&&q.createElement("pre",{className:"network"},q.createElement("strong",null,"Network Error:")," ",r.networkError.message),t("GraphQL Errors",S(r.graphQLErrors)),t("Protocol Errors",S(r.protocolErrors)),t("Client Errors",S(r.clientErrors)),r.extraInfo&&q.createElement("pre",{className:"extra"},q.createElement("strong",null,"Extra Info:")," ",JSON.stringify(r.extraInfo,null,4)))))}G(er,"ApolloError");import{use as et}from"react";function en(){var e=et(Z);if(!e)throw new Error("useApolloError must be used within ApolloErrorProvider");return e}G(en,"useApolloError");import eo,{useEffect as ea,useMemo as ei,useState as es}from"react";var ec=null;function el(e){ec=e}G(el,"setGlobalApolloErrorCallback");function eu(e){ec===null||ec===void 0?void 0:ec(e)}G(eu,"showGlobalApolloError");function ef(e){var r=e.children;var t=C(es(null),2),n=t[0],o=t[1];ea(function(){el(o)},[]);var a=ei(function(){return{error:n,showError:o,hideError:G(function(){return o(null)},"hideError")}},[n]);return eo.createElement(Z,{value:a},r)}G(ef,"ApolloErrorProvider");import{consola as em}from"consola/browser";var ep={silent:em.silent,level:em.level,fatal:em.fatal,error:em.error,warn:em.warn,log:em.log,info:em.info,success:em.success,ready:em.ready,start:em.start,box:em.box,debug:em.debug,trace:em.trace,verbose:em.verbose};import{toast as ed,Toaster as ev}from"react-hot-toast";var eg="/graphql";var eh,ey=(eh=/*#__PURE__*/function(e){"use strict";m(r,e);function r(){s(this,r);var e;e=i(this,r,arguments);x(e,"count",0);return e}l(r,[{key:"request",value:function e(e,r){var t=this;var n=Date.now();return this.count+=1,r(e).map(function(r){var o=Date.now()-n,a=e.operationName||"Unnamed";return ep.info("[Apollo] #".concat(t.count,": ").concat(a," (").concat(o,"ms)")),r})}}]);return r}(R),G(eh,"DevLoggerLink"),eh);function eE(e){var r=e.uri,t=e.wsUrl,n=e.customLinks,o=new ey,a=B(function(e){var r=e.graphQLErrors,t=e.networkError,n=e.protocolErrors,o=e.operation;var a=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(r&&r.forEach(function(e){var r=e.message,t=e.locations,n=e.path;ep.error("[GraphQL error] ".concat(a,": ").concat(r,", Location: ").concat(JSON.stringify(t),", Path: ").concat(n))}),n&&n.forEach(function(e){var r=e.message,t=e.extensions;ep.error("[Protocol error]: ".concat(r,", Extensions: ").concat(JSON.stringify(t)))}),t&&ep.error("[Network error]: ".concat(t)),r||n||t){var i,s;var c=(r===null||r===void 0?void 0:(i=r[0])===null||i===void 0?void 0:i.message)||(n===null||n===void 0?void 0:(s=n[0])===null||s===void 0?void 0:s.message)||(t===null||t===void 0?void 0:t.message)||"Unexpected error",l=new P({graphQLErrors:r||[],protocolErrors:n||[],clientErrors:[],networkError:t||null,errorMessage:c,extraInfo:{operation:o}});ed.error(function(e){return z.createElement(z.Fragment,null,c,"\xa0",z.createElement(H,{cursor:"pointer",onClick:G(function(){setTimeout(function(){eu(l)},0),ed.dismiss(e.id)},"onClick")}))})}}),i=K();r||ep.warn('[Apollo] No GraphQL URI provided — using "'.concat(eg,'" as default'));var s=new U({uri:r!==null&&r!==void 0?r:eg,credentials:"include"}),c=t?new W(J({url:t})):R.empty(),l=p(c,R)?F(function(e){var r=e.query;var t=Y(r);return t.kind==="OperationDefinition"&&t.operation==="subscription"},c,s):s;return l===s&&t&&ep.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[o,a,i].concat(S(n!==null&&n!==void 0?n:[]),[l])}G(eE,"createApolloLinks");function eb(e){var r=e.isNextJS,t=e.options,n=e.children,o=e.client,a=e.provider,i=e.cache;var s=t||{},c=s.uri,l=s.wsUrl,u=s.customLinks,f=E(s,["uri","wsUrl","customLinks"]),m=o!==null&&o!==void 0?o:A;if(typeof m!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var d=a||D,v=Q(function(){return j(eE({uri:c!==null&&c!==void 0?c:eg,wsUrl:l!==null&&l!==void 0?l:"",customLinks:u!==null&&u!==void 0?u:[]}))},[c,l,u]),g=Q(function(){return p(i,M)?i:new M},[i]),h=Q(function(){return new m(y({link:v,cache:g},f))},[m,v,g,f]),b=r?z.createElement(d,{makeClient:G(function(){return h},"makeClient")},n):z.createElement(d,{client:h},n);return z.createElement(z.Fragment,null,z.createElement(ef,null,b,z.createElement(er,null)),z.createElement(ev,{position:"top-right"}))}G(eb,"ApolloProvider");import{useTranslation as ew}from"react-i18next";var eI=ew;import eC from"i18next";import{initReactI18next as eS}from"react-i18next";function e_(e){return eC.use(eS).init(e)}G(e_,"initI18next");import eO from"classnames";import ek from"react";import eN from"./loading/loading.module.scss";function eL(e){var r=e.full,t=r===void 0?!1:r,n=e.block,o=n===void 0?!1:n,a=e.className,i=a===void 0?"":a,s=e.message,c=s===void 0?"Loading":s,l=E(e,["full","block","className","message"]);function u(){return ek.createElement("div",y({className:eN.container},l),ek.createElement("div",{className:eN.ring}),ek.createElement("div",{className:eN.ring}),ek.createElement("div",{className:eN.ring}),ek.createElement("div",{className:eN.ring}),c&&ek.createElement("div",{className:eN.message},c))}return G(u,"_renderLoading"),t?ek.createElement("div",{className:eO(eN.fullscreen,i)},u()):o?ek.createElement("div",{className:eO(eN.block,i)},u()):u()}G(eL,"Loading");import{createContext as eT}from"react";var eG=eT(void 0);import{use as ex}from"react";function eA(){var e=ex(eG);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}G(eA,"useLoading");import eP,{useCallback as eR,useMemo as eD,useState as ej}from"react";function eU(e){var r=e.children;var t=C(ej(!1),2),n=t[0],o=t[1],a=C(ej(!1),2),i=a[0],s=a[1],c=eR(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),s(e)},[]),l=eR(function(){o(!1),s(!1)},[]),u=eD(function(){return{isLoading:n,isGlobalLoading:i,showLoading:c,hideLoading:l}},[n,i,c,l]);return eP.createElement(eG,{value:u},n?eP.createElement(eL,{full:i}):r)}G(eU,"LoadingProvider");import{enUS as eM}from"date-fns/locale";var eF={label:"English",value:"en",flag:"\uD83C\uDDFA\uD83C\uDDF8",adapterLocale:eM,icon:"flagpack:gb-nir",numberFormat:{code:"en-US",currency:"USD"},timezone:"America/New_York"};import{createContext as eB}from"react";var eK=eB(void 0);import{NextIntlClientProvider as eW}from"next-intl";import eY from"react";import{useTranslations as eJ}from"next-intl";import{use as ez}from"react";function eQ(){var e=ez(eK);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}G(eQ,"useNextIntl");var eH=eJ;function eq(e){var r=G(function(r){var t;var n;var o=eQ(),a=o.currentLanguage,i=r.messages,s=r.languages,c="en",l=i[(a===null||a===void 0?void 0:a.value)||c],u=(n=(t=s.find(function(e){return e.value===(a===null||a===void 0?void 0:a.value)}))===null||t===void 0?void 0:t.timezone)!==null&&n!==void 0?n:eF.timezone;return i?eY.createElement(eW,{locale:(a===null||a===void 0?void 0:a.value)||c,messages:l||null,timeZone:u},eY.createElement(e,r)):(ep.warn("Missing messages for language: ".concat((a===null||a===void 0?void 0:a.value)||c)),null)},"PageWithI18n");return r.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),r}G(eq,"withNextIntl");import eV,{useMemo as e$}from"react";import{useCallback as eX,useEffect as eZ,useState as e0}from"react";var e1={serialize:G(function(e){return JSON.stringify(e,function(e,r){return p(r,Date)?{__type:"Date",value:r.toISOString()}:r})},"serialize"),deserialize:G(function(e){return JSON.parse(e,function(e,r){return(r===null||r===void 0?void 0:r.__type)==="Date"?new Date(r.value):r})},"deserialize")};import e2 from"localforage";var e3={get:function e(e){return a(function(){var r;return N(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,e2.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(ep.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return a(function(){var t;return N(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,e2.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();ep.error('[Storage:set] Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return a(function(){var r;return N(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,e2.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();ep.error('[Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},keys:function e(){return a(function(){var e,r;return N(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,e2.keys()];case 1:return[2,(e=t.sent())!==null&&e!==void 0?e:[]];case 2:r=t.sent();return[2,(ep.error("[Storage:keys] Error getting keys:",r),[])];case 3:return[2]}})})()}};function e4(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e1;var n=C(e0(r),2),o=n[0],i=n[1],s=C(e0(!1),2),c=s[0],l=s[1];eZ(function(){var n=!0;return G(/*#__PURE__*/a(function(){var o,a,s,c;return N(this,function(u){switch(u.label){case 0:u.trys.push([0,6,7,8]);return[4,e3.get(e)];case 1:o=u.sent();if(!n)return[3,5];if(!(o!==null))return[3,2];a=t.deserialize(o);i(a);return[3,5];case 2:if(!(r!==void 0))return[3,4];s=t.serialize(r);return[4,e3.set(e,s)];case 3:u.sent(),i(r);return[3,5];case 4:i(void 0);u.label=5;case 5:return[3,8];case 6:c=u.sent();ep.error('Error loading value for key "'.concat(e,'":'),c),n&&i(r);return[3,8];case 7:n&&l(!0);return[7];case 8:return[2]}})}),"loadValue")(),function(){n=!1,l(!1)}},[e,r,t]),eZ(function(){if(!c)return;G(/*#__PURE__*/a(function(){var r,n;return N(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);if(!(o!==void 0))return[3,2];r=t.serialize(o);return[4,e3.set(e,r)];case 1:a.sent();a.label=2;case 2:return[3,4];case 3:n=a.sent();ep.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})}),"saveValue")()},[o,e,t,c]);var u=eX(function(e){i(function(r){return typeof e=="function"?e(r):e})},[]),f=eX(/*#__PURE__*/a(function(){var r;return N(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,e3.remove(e)];case 1:t.sent(),i(void 0);return[3,3];case 2:r=t.sent();ep.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})}),[e]);return{value:o,set:u,remove:f}}G(e4,"useStorage");function e5(e){var r=e.children;return eV.createElement(eV.Fragment,null,r)}G(e5,"LanguageWrapperBase");var e8=eq(e5);function e6(e){var r=e.children,t=e.languages,n=e.messages;var o=e4("lang",t[0]),a=o.value,i=o.set,s=e$(function(){return{languages:t,currentLanguage:a!==null&&a!==void 0?a:eF,setCurrentLanguage:i}},[t,i,a]);return eV.createElement(eK,{value:s},eV.createElement(e8,{languages:t,messages:n},r))}G(e6,"NextIntlProvider");import e7 from"@vitejs/plugin-react-swc";import{defineConfig as e9}from"vitest/config";function re(e){return e9(y({plugins:[e7()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}G(re,"vitestE2E");import rr from"@vitejs/plugin-react-swc";import{defineConfig as rt}from"vitest/config";var rn=".cyberskill-storage";import ro from"dotenv";import{bool as ra,cleanEnv as ri,str as rs}from"envalid";import rc from"node:os";import rl from"node:path";import ru from"node:process";ro.config();function rf(){var e={DEBUG:ru.env.DEBUG||!1,CWD:ru.env.CWD||ru.cwd(),CYBERSKILL_STORAGE_DIRECTORY:ru.env.CYBERSKILL_STORAGE_DIRECTORY||rl.join(rc.homedir(),rn)};return ri(e,{DEBUG:ra(),CWD:rs(),CYBERSKILL_STORAGE_DIRECTORY:rs()})}G(rf,"getEnv");var rm=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as rp}from"node:child_process";import rd from"node:process";import*as rv from"node:util";var rg=function(e){return e.Error="error",e.Warning="warning",e}({});import rh from"chalk";import ry from"consola";import{GraphQLError as rE}from"graphql";var rb=rf();rb.DEBUG||(ry.level=4);function rw(e){var r=rh[e];return typeof r=="function"?r:rh.green}G(rw,"chalkKeyword");var rI={silent:ry.silent,level:ry.level,fatal:ry.fatal,error:ry.error,warn:ry.warn,log:ry.log,info:ry.info,success:ry.success,ready:ry.ready,start:ry.start,box:ry.box,debug:ry.debug,trace:ry.trace,verbose:ry.verbose,printBoxedLog:function e(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(r===null||r===void 0?void 0:r.length)){ry.box(rh.green(e));return}r.forEach(function(e){var r=e.file,n=e.position,o=e.rule,a=e.message;ry.log("".concat(rh.gray("File:")," ").concat(rh.blue("".concat(r).concat(n?":".concat(n):"")))),o&&ry.log(" ".concat(rw(t)("Rule:")," ").concat(o)),ry.log(" ".concat(rw(t)("Message:")," ").concat(a))}),ry.box(rw(t)("".concat(e," : ").concat(r.length))),ry.log(rh.gray("─".repeat(40)))}};var rC={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import rS from"node-fetch";import r_ from"fs-extra";var rO=r_.readFileSync,rk=r_.writeFileSync,rN=r_.pathExistsSync,rL=r_.appendFileSync,rT=r_.copySync,rG=r_.removeSync,rx=r_.statSync,rA=r_.readJsonSync,rP=r_.writeJsonSync;function rR(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return r.every(function(e){return rN(e)})}G(rR,"existsSync");var rD=rf();function rj(e){var r=ta(rD.CWD,tf);if(!rR(r))return!1;try{var t=rA(r),n=t.name,o=t.dependencies,a=o===void 0?{}:o,i=t.devDependencies,s=i===void 0?{}:i,c=n===e,l=e in a,u=e in s;return c||l||u?{path:r,file:t,isCurrentProject:c,isDepend:l,isDevDepend:u}:!1}catch(e){return rI.warn("Failed to read package.json: ".concat(e.message)),!1}}G(rj,"getPackage");function rU(e){return rM.apply(this,arguments)}function rM(){rM=a(function(e){var r,t,n,o;return N(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,rS("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:r=a.sent();if(!r.ok)throw new Error("Failed to fetch latest version: ".concat(r.status," ").concat(r.statusText));return[4,r.json()];case 2:t=a.sent(),n=t.version;return[2,n];case 3:o=a.sent();throw rI.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})});return rM.apply(this,arguments)}G(rU,"getLatestPackageVersion");function rF(e,r){return rB.apply(this,arguments)}function rB(){rB=a(function(e,r){var t,n,o,a,i,s,c,l,u,f,m,p,d,v,g,h,E,b,w,I,C;return N(this,function(S){switch(S.label){case 0:S.trys.push([0,4,,5]);t=rj(e);if(!t)return[2,y({},rC)];c=t.path,l=t.file,u=t.isCurrentProject,f=t.isDepend,m=t.isDevDepend,p=(n=l.dependencies)!==null&&n!==void 0?n:{},d=(o=l.devDependencies)!==null&&o!==void 0?o:{},v=u?(a=l.version)!==null&&a!==void 0?a:"0.0.0":f?(i=p[e])!==null&&i!==void 0?i:"0.0.0":m?(s=d[e])!==null&&s!==void 0?s:"0.0.0":"0.0.0";if(!u)return[3,1];E=v;return[3,3];case 1:return[4,rU(e)];case 2:E=S.sent();S.label=3;case 3:g=E,h=u||v===g;if(!h&&(r===null||r===void 0?void 0:r.update)){;w=f?"dependencies":m?"devDependencies":null;w&&((b=l[w])===null||b===void 0?void 0:b[e])!==g&&(l[w]=(I=l[w])!==null&&I!==void 0?I:{},l[w][e]=g,rP(c,l),rI.info('Updated "'.concat(e,'" to version ').concat(g)))}return[2,{isCurrentProject:u,installedPath:c,file:l,isUpToDate:h}];case 4:C=S.sent();return[2,(rI.error('Error checking package "'.concat(e,'": ').concat(C.message)),y({},rC))];case 5:return[2]}})});return rB.apply(this,arguments)}G(rF,"checkPackage");function rK(){return rW.apply(this,arguments)}function rW(){rW=a(function(){var e,r,t,n,o,a,i,s,c,l,u,f;return N(this,function(m){switch(m.label){case 0:e=[{command:G(function(){return tV.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:G(function(){return tV.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:G(function(){return tV.pnpmInstallForce()},"command"),message:"Retrying with force install"}];r=true,t=false,n=undefined;m.label=1;case 1:m.trys.push([1,9,10,11]);o=e[Symbol.iterator]();m.label=2;case 2:if(!!(r=(a=o.next()).done))return[3,8];i=a.value,s=i.command,c=i.message;m.label=3;case 3:m.trys.push([3,6,,7]);return[4,s()];case 4:l=m.sent();return[4,r9("".concat(c," using: ").concat(l),l)];case 5:m.sent();return[2];case 6:u=m.sent();rI.warn("Installation attempt failed: ".concat(c)),rI.error("Details: ".concat(u.message));return[3,7];case 7:r=true;return[3,2];case 8:return[3,11];case 9:f=m.sent();t=true;n=f;return[3,11];case 10:try{if(!r&&o.return!=null){o.return()}}finally{if(t){throw n}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return rW.apply(this,arguments)}G(rK,"installDependencies");function rY(e,r){return rJ.apply(this,arguments)}function rJ(){rJ=a(function(e,r){var t,n,o,a,i,s,c,l,u,f,m;return N(this,function(p){switch(p.label){case 0:if(!rR(tz.PACKAGE_JSON)){rI.error("package.json not found. Aborting setup.");return[2]}p.label=1;case 1:p.trys.push([1,13,,14]);t=S(new Set(e)).sort();return[4,Promise.all(t.map(function(e){return rF(e,y({},(r===null||r===void 0?void 0:r.update)&&{update:r.update}))}))];case 2:n=p.sent().every(function(e){return e.isUpToDate});if(n)return[3,4];return[4,rK()];case 3:n=p.sent();p.label=4;case 4:n;a=true,i=false,s=undefined;p.label=5;case 5:p.trys.push([5,10,11,12]);c=((o=r===null||r===void 0?void 0:r.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();p.label=6;case 6:if(!!(a=(l=c.next()).done))return[3,9];u=l.value;return[4,u()];case 7:p.sent();p.label=8;case 8:a=true;return[3,6];case 9:return[3,12];case 10:f=p.sent();i=true;s=f;return[3,12];case 11:try{if(!a&&c.return!=null){c.return()}}finally{if(i){throw s}}return[7];case 12:return[3,14];case 13:m=p.sent();throw rI.error('Failed to setup "'.concat(e.join(", "),'": ').concat(m.message)),m;case 14:return[2]}})});return rJ.apply(this,arguments)}G(rY,"setupPackages");import rz from"node-persist";var rQ=rf();function rH(){return rq.apply(this,arguments)}function rq(){rq=a(function(){var e;return N(this,function(r){switch(r.label){case 0:e=rz.defaultInstance;if(e)return[3,2];return[4,rz.init({dir:rQ.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return rq.apply(this,arguments)}G(rH,"initNodePersist");var rV={get:function e(e){return a(function(){var r,t;return N(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,rH()];case 1:n.sent();return[4,rz.getItem(e)];case 2:return[2,(r=n.sent())!==null&&r!==void 0?r:null];case 3:t=n.sent();return[2,(rI.error('[Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 4:return[2]}})})()},set:function e(e,r){return a(function(){var t;return N(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,rH()];case 1:n.sent();return[4,rz.setItem(e,r)];case 2:n.sent();return[3,4];case 3:t=n.sent();rI.error('[Storage:set] Error setting key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},remove:function e(e){return a(function(){var r;return N(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,rH()];case 1:t.sent();return[4,rz.removeItem(e)];case 2:t.sent();return[3,4];case 3:r=t.sent();rI.error('[Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},keys:function e(){return a(function(){var e,r;return N(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,rH()];case 1:t.sent();return[4,rz.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(rI.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:r=t.sent();return[2,(rI.error("[Storage:keys] Error getting keys:",r),[])];case 4:return[2]}})})()},getLogLink:function e(e){return a(function(){return N(this,function(r){try{return[2,"".concat(rQ.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(rI.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var r$=rf(),rX=rv.promisify(rp);function rZ(e){return"error_list:".concat(e)}G(rZ,"getErrorListKey");function r0(e){return r1.apply(this,arguments)}function r1(){r1=a(function(e){var r,t,n;return N(this,function(o){switch(o.label){case 0:if(e.length===0)return[2];r=Date.now(),t=rZ(r);o.label=1;case 1:o.trys.push([1,3,,4]);return[4,rV.set(t,{errors:e,timestamp:r})];case 2:o.sent(),setTimeout(/*#__PURE__*/a(function(){var e;return N(this,function(r){switch(r.label){case 0:return[4,rV.getLogLink(t)];case 1:e=r.sent();e&&rI.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:n=o.sent();rI.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return r1.apply(this,arguments)}G(r0,"saveErrorListToStorage");function r2(e){var r=[],t=[],n="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,i=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var s,c,l,u,f;var m=o.exec(e)||[],p=a.exec(e)||[],d=i.exec(e)||[];var v,g,h,y,E,b;m.length&&n?r.push({file:n,position:"".concat(m[1],":").concat(m[2]),type:m[3]===rg.Error?rg.Error:rg.Warning,message:(v=m===null||m===void 0?void 0:(s=m[4])===null||s===void 0?void 0:s.trim())!==null&&v!==void 0?v:"",rule:(g=m===null||m===void 0?void 0:(c=m[5])===null||c===void 0?void 0:c.trim())!==null&&g!==void 0?g:""}):p.length?r.push({file:(h=p===null||p===void 0?void 0:p[1])!==null&&h!==void 0?h:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===rg.Error?rg.Error:rg.Warning,message:(y=p===null||p===void 0?void 0:(l=p[5])===null||l===void 0?void 0:l.trim())!==null&&y!==void 0?y:""}):d.length?r.push({file:"commitlint",type:rg.Error,message:(E=d===null||d===void 0?void 0:(u=d[1])===null||u===void 0?void 0:u.trim())!==null&&E!==void 0?E:"",rule:(b=d===null||d===void 0?void 0:(f=d[2])===null||f===void 0?void 0:f.trim())!==null&&b!==void 0?b:""}):t.push(e.trim())}}),r.length&&r0(r),r$.DEBUG&&t.length&&(rI.warn("Unmatched lines:"),t.forEach(function(e){return rI.info(" ".concat(e))}))}G(r2,"parseTextErrors");function r3(e){try{var r=JSON.parse(e),t=[];r.forEach(function(e){var r=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,o=e.line,a=e.column,i=e.ruleId,s=e.message;t.push({type:n===2?rg.Error:rg.Warning,file:r,position:"".concat(o,":").concat(a),rule:i,message:s})})}),t.length&&r0(t)}catch(r){r2(e)}}G(r3,"parseCommandOutput");function r4(e){return r5.apply(this,arguments)}function r5(){r5=a(function(e){var r,t,n,o,a,i,s,c,l;var u=arguments;return N(this,function(f){switch(f.label){case 0:r=u.length>1&&u[1]!==void 0?u[1]:r3;t=new AbortController;rd.on("SIGINT",function(){rI.warn("Process interrupted. Terminating..."),t.abort(),rd.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,rX(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:n=f.sent(),o=n.stdout,a=n.stderr;[o,a].forEach(function(e){return e&&r(e)});f.label=3;case 3:return[3,5];case 4:i=f.sent();s=i.stdout,c=i.stderr,l=i.message;[s,c].forEach(function(e){return e&&r(e)}),!c&&!s&&rI.error("Command failed: ".concat(l));return[3,5];case 5:return[2]}})});return r5.apply(this,arguments)}G(r4,"executeCommand");function r8(e){return{raw:!0,cmd:e}}G(r8,"rawCommand");function r6(e,r){return(r===null||r===void 0?void 0:r.isRemote)?"".concat(tj," ").concat(tc," ").concat(e):(r===null||r===void 0?void 0:r.isCurrentProject)?"".concat(tj," ").concat(tP," ").concat(tI," ").concat(e):"".concat(tj," ").concat(tw," ").concat(e)}G(r6,"formatCLI");function r7(e,r){return typeof e=="function"?r6(e(r),r):(typeof e==="undefined"?"undefined":_(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?r6(e,r):e}G(r7,"formatCommand");function r9(e,r){return te.apply(this,arguments)}function te(){te=a(function(e,r){var t;return N(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);rI.start("".concat(e)),r$.DEBUG&&rI.info("→ ".concat(r));return[4,r4(r)];case 1:n.sent(),rI.success("".concat(e," done."));return[3,3];case 2:t=n.sent();throw rI.error("".concat(e," failed: ").concat(t.message)),t;case 3:return[2]}})});return te.apply(this,arguments)}G(r9,"runCommand");import{join as tr,resolve as tt}from"node:path";var tn=rf();function to(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return tt.apply(void 0,[tn.CWD].concat(S(r)))}G(to,"resolveWorkingPath");function ta(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return tr.apply(void 0,S(r))}G(ta,"join");var ti=rf(),ts=ti.CWD,tc="@cyberskill/shared",tl="node_modules",tu="dist",tf="package.json",tm="package-lock.json",tp="tsconfig.json",td=".gitignore",tv=".simple-git-hooks.json",tg="pnpm-lock.yaml",th=".git/hooks/",ty=".git/COMMIT_EDITMSG",tE=".migrate-mongo.config.js",tb=ta(ts,tl,tc,tu),tw="cyberskill",tI="src/nodejs/cli/index.ts",tC="eslint",tS="eslint",t_="vitest",tO="playwright",tk="vitest",tN="@commitlint/cli",tL="commitlint",tT="lint-staged",tG="lint-staged",tx="typescript",tA="tsc",tP="tsx",tR="git",tD="pnpm",tj="pnpm exec",tU="simple-git-hooks",tM="simple-git-hooks",tF="@eslint/config-inspector",tB="eslint-config-inspector",tK="node-modules-inspector",tW="node-modules-inspector",tY="migrate-mongo",tJ="./node_modules/migrate-mongo/bin/migrate-mongo",tz={CYBERSKILL_DIRECTORY:tb,WORKING_DIRECTORY:ts,TS_CONFIG:to(tp),GIT_IGNORE:to(td),GIT_HOOK:to(th),GIT_COMMIT_MSG:to(ty),SIMPLE_GIT_HOOKS_JSON:to(tv),PACKAGE_JSON:to(tf),PACKAGE_LOCK_JSON:to(tm),PNPM_LOCK_YAML:to(tg),NODE_MODULES:to(tl),MIGRATE_MONGO_CONFIG:to(tE),LINT_STAGED_CONFIG:to("".concat(tb,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:to("".concat(tb,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:to("".concat(tb,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:to("".concat(tb,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:to("".concat(tb,"/react/vitest/vitest.e2e.js"))};function tQ(e,r,t){return tH.apply(this,arguments)}function tH(){tH=a(function(e,r,t){return N(this,function(n){switch(n.label){case 0:if(!r)throw new Error("'first' argument is undefined");switch(e){case rm.CLI:return[3,1];case rm.STRING:return[3,3]}return[3,4];case 1:return[4,rY(r.split(" "),{update:!0})];case 2:return[2,(n.sent(),r7(r8("".concat(tj," ").concat(t))))];case 3:return[2,r7(r8(r))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return tH.apply(this,arguments)}G(tQ,"buildCommand");function tq(e,r,t){return /*#__PURE__*/a(function(){return N(this,function(n){return[2,tQ(e,r,t)]})})}G(tq,"commandFactory");var tV={simpleGitHooks:tq(rm.CLI,tU,tM),eslintInspect:tq(rm.CLI,tF,tB),nodeModulesInspect:tq(rm.CLI,tK,tW),eslintCheck:tq(rm.CLI,tC,"".concat(tS," ").concat(tz.WORKING_DIRECTORY)),eslintFix:tq(rm.CLI,tC,"".concat(tS," ").concat(tz.WORKING_DIRECTORY," --fix")),typescriptCheck:tq(rm.CLI,tx,"".concat(tA," -p ").concat(tz.TS_CONFIG," --noEmit")),configureGitHook:tq(rm.STRING,"".concat(tR," config core.hooksPath ").concat(tz.GIT_HOOK)),testUnit:tq(rm.CLI,t_,"".concat(tk," --config ").concat(tz.UNIT_TEST_CONFIG)),testE2e:tq(rm.CLI,"".concat(t_," ").concat(tO),"".concat(tk," --config ").concat(tz.E2E_TEST_CONFIG)),mongoMigrateCreate:G(function(e){return tq(rm.CLI,tY,"".concat(tP," ").concat(tJ," create ").concat(e," -f ").concat(tz.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:tq(rm.CLI,tY,"".concat(tP," ").concat(tJ," up -f ").concat(tz.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:tq(rm.CLI,tY,"".concat(tP," ").concat(tJ," down -f ").concat(tz.MIGRATE_MONGO_CONFIG)),mongoMigrateStatus:tq(rm.CLI,tY,"".concat(tP," ").concat(tJ," status -f ").concat(tz.MIGRATE_MONGO_CONFIG)),commitLint:tq(rm.CLI,tN,"".concat(tL," --edit ").concat(tz.GIT_COMMIT_MSG," --config ").concat(tz.COMMITLINT_CONFIG)),lintStaged:tq(rm.CLI,tT,"".concat(tG," --config ").concat(tz.LINT_STAGED_CONFIG)),stageBuildDirectory:tq(rm.STRING,"".concat(tR," add ").concat(tu)),build:tq(rm.STRING,"".concat(tD," run build")),pnpmInstallStandard:tq(rm.STRING,"".concat(tD," install")),pnpmInstallLegacy:tq(rm.STRING,"".concat(tD," install --legacy-peer-deps")),pnpmInstallForce:tq(rm.STRING,"".concat(tD," install --force"))};function t$(e){return rt(y({plugins:[rr()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tz.UNIT_TEST_SETUP_CONFIG]}},e))}G(t$,"vitestUnit");export{er as ApolloError,Z as ApolloErrorContext,ef as ApolloErrorProvider,eb as ApolloProvider,eg as GRAPHQL_URI_DEFAULT,eL as Loading,eG as LoadingContext,eU as LoadingProvider,eF as NEXT_INTL_DEFAULT_LANGUAGE,eK as NextIntlContext,e6 as NextIntlProvider,ev as Toaster,e_ as initI18next,ep as log,el as setGlobalApolloErrorCallback,eu as showGlobalApolloError,e3 as storage,ed as toast,en as useApolloError,eA as useLoading,eQ as useNextIntl,e4 as useStorage,eI as useTranslateI18next,eH as useTranslateNextIntl,re as vitestE2E,t$ as vitestUnit,eq as withNextIntl};
@@ -1 +1 @@
1
- "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(t){if(Array.isArray(t))return e(t)}function r(e,t,r,n,a,i,o){try{var c=e[i](o);var u=c.value}catch(e){r(e);return}if(c.done){t(u)}else{Promise.resolve(u).then(n,a)}}function n(e){return function(){var t=this,n=arguments;return new Promise(function(a,i){var o=e.apply(t,n);function c(e){r(o,a,i,c,u,"next",e)}function u(e){r(o,a,i,c,u,"throw",e)}c(undefined)})}}function a(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function i(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function o(e){if(typeof WeakMap!=="function")return null;var t=new WeakMap;var r=new WeakMap;return(o=function(e){return e?r:t})(e)}function c(e,t){if(!t&&e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var r=o(t);if(r&&r.has(e)){return r.get(e)}var n={__proto__:null};var a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e){if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var c=a?Object.getOwnPropertyDescriptor(e,i):null;if(c&&(c.get||c.set)){Object.defineProperty(n,i,c)}else{n[i]=e[i]}}}n.default=e;if(r){r.set(e,n)}return n}function u(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function s(){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 r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){a(e,t,r[t])})}return e}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function d(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{f(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function p(e){return t(e)||u(e)||g(e)||s()}function v(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function h(e,t){var r,n,a,i={label:0,sent:function(){if(a[0]&1)throw a[1];return a[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 u([e,t])}}function u(c){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,c[0]&&(i=0)),i)try{if(r=1,n&&(a=c[0]&2?n["return"]:c[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;if(n=0,a)c=[c[0]&2,a.value];switch(c[0]){case 0:case 1:a=c;break;case 4:i.label++;return{value:c[1],done:false};case 5:i.label++;n=c[1];c=[0];continue;case 7:c=i.ops.pop();i.trys.pop();continue;default:if(!(a=i.trys,a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){i=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){i.label=c[1];break}if(c[0]===6&&i.label<a[1]){i.label=a[1];a=c;break}if(a&&i.label<a[2]){i.label=a[2];i.ops.push(c);break}if(a[2])i.ops.pop();i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e];n=0}finally{r=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var y=Object.create;var m=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var O=function(e,t){return m(e,"name",{value:t,configurable:!0})};var I=function(e,t){for(var r in t)m(e,r,{get:t[r],enumerable:!0})},S=function(e,t,r,n){var a=true,i=false,o=undefined;if(t&&(typeof t==="undefined"?"undefined":v(t))=="object"||typeof t=="function")try{var c=function(){var a=s.value;!E.call(e,a)&&a!==r&&m(e,a,{get:function(){return t[a]},enumerable:!(n=b(t,a))||n.enumerable})};for(var u=w(t)[Symbol.iterator](),s;!(a=(s=u.next()).done);a=true)c()}catch(e){i=true;o=e}finally{try{if(!a&&u.return!=null){u.return()}}finally{if(i){throw o}}}return e};var C=function(e,t,r){return r=e!=null?y(_(e)):{},S(t||!e||!e.__esModule?m(r,"default",{value:e,enumerable:!0}):r,e)},T=function(e){return S(m({},"__esModule",{value:!0}),e)};var P={};I(P,{vitestE2E:function(){return D},vitestUnit:function(){return tM}});module.exports=T(P);var j=C(require("@vitejs/plugin-react-swc"),1),R=require("vitest/config");function D(e){return(0,R.defineConfig)(l({plugins:[(0,j.default)()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}O(D,"vitestE2E");var G=C(require("@vitejs/plugin-react-swc"),1),N=require("vitest/config");var k=".cyberskill-storage";var U=C(require("dotenv"),1),L=require("envalid"),A=C(require("os"),1),x=C(require("path"),1),M=C(require("process"),1);U.default.config();function q(){var e={DEBUG:M.default.env.DEBUG||!1,CWD:M.default.env.CWD||M.default.cwd(),CYBERSKILL_STORAGE_DIRECTORY:M.default.env.CYBERSKILL_STORAGE_DIRECTORY||x.default.join(A.default.homedir(),k)};return(0,L.cleanEnv)(e,{DEBUG:(0,L.bool)(),CWD:(0,L.str)(),CYBERSKILL_STORAGE_DIRECTORY:(0,L.str)()})}O(q,"getEnv");var F="MONGO_MIGRATE_OPTIONS";var K=require("mongodb"),W=require("mongoose");var B=require("date-fns"),Y=C(require("migrate-mongo"),1),J=require("mongoose"),H=C(require("mongoose-aggregate-paginate-v2"),1),$=C(require("mongoose-paginate-v2"),1),Q=require("uuid");var V=C(require("node-persist"),1);var z=function(e){return e.Error="error",e.Warning="warning",e}({});var X=C(require("chalk"),1),Z=C(require("consola"),1),ee=require("graphql");var et=q();et.DEBUG||(Z.default.level=4);function er(e){var t=X.default[e];return typeof t=="function"?t:X.default.green}O(er,"chalkKeyword");var en={silent:Z.default.silent,level:Z.default.level,fatal:Z.default.fatal,error:Z.default.error,warn:Z.default.warn,log:Z.default.log,info:Z.default.info,success:Z.default.success,ready:Z.default.ready,start:Z.default.start,box:Z.default.box,debug:Z.default.debug,trace:Z.default.trace,verbose:Z.default.verbose,printBoxedLog:function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){Z.default.box(X.default.green(e));return}t.forEach(function(e){var t=e.file,n=e.position,a=e.rule,i=e.message;Z.default.log("".concat(X.default.gray("File:")," ").concat(X.default.blue("".concat(t).concat(n?":".concat(n):"")))),a&&Z.default.log(" ".concat(er(r)("Rule:")," ").concat(a)),Z.default.log(" ".concat(er(r)("Message:")," ").concat(i))}),Z.default.box(er(r)("".concat(e," : ").concat(t.length))),Z.default.log(X.default.gray("─".repeat(40)))}};var ea=q();function ei(){return eo.apply(this,arguments)}function eo(){eo=n(function(){var e;return h(this,function(t){switch(t.label){case 0:e=V.default.defaultInstance;if(e)return[3,2];return[4,V.default.init({dir:ea.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return eo.apply(this,arguments)}O(ei,"initNodePersist");var ec={get:function e(e){return n(function(){var t,r;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ei()];case 1:n.sent();return[4,V.default.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,(en.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 4:return[2]}})})()},set:function e(e,t){return n(function(){var r;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ei()];case 1:n.sent();return[4,V.default.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();en.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return n(function(){var t;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ei()];case 1:r.sent();return[4,V.default.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();en.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return n(function(){var e,t;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ei()];case 1:r.sent();return[4,V.default.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:(en.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,(en.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return n(function(){return h(this,function(t){try{return[2,"".concat(ea.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(en.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eu=C(require("crypto-js"),1),es=C(require("slugify"),1);var el=es.default.default||es.default;var ef={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":v(e))=="object"?i(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var ed={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return(0,B.format)(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.returnDateAs,r=t===void 0?"string":t;var n=r==="string"?ed.getDateTime():new Date;return{id:(0,Q.v4)(),isDel:!1,createdAt:n,updatedAt:n}},applyPlugins:function e(e,t){t.filter(function(e){return typeof e=="function"}).forEach(function(t){return e.plugin(t)})},applyMiddlewares:function e(e,t){t.forEach(function(t){var r=t.method,n=t.pre,a=t.post;r&&n&&e.pre(r,n),r&&a&&e.post(r,a)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:Q.v4,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,r=e.schema,n=e.virtuals,a=n===void 0?[]:n,i=e.standalone,o=i===void 0?!1:i;var c=new t.Schema(r,{strict:!0});return a.forEach(function(e){var t=e.name,r=e.options,n=e.get;var a=c.virtual(t,r);n&&a.get(n)}),o||c.add(ed.createGenericSchema(t)),c},createModel:function e(e){var t=e.mongoose,r=e.name,n=e.schema,a=e.pagination,i=a===void 0?!1:a,o=e.aggregate,c=o===void 0?!1:o,u=e.virtuals,s=u===void 0?[]:u,l=e.middlewares,f=l===void 0?[]:l;if(!r)throw new Error("Model name is required.");if(t.models[r])return t.models[r];var d=ed.createSchema({mongoose:t,schema:n,virtuals:s});return ed.applyPlugins(d,[i&&$.default,c&&H.default]),ed.applyMiddlewares(d,f),t.model(r,d)},createSlugQuery:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return d(l({},t,r&&{id:{$ne:r}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=n(function(e){return h(this,function(t){return[2,!ef.isEmpty(e)]})});return function(t){return e.apply(this,arguments)}}()},isUnique:function e(e){return /*#__PURE__*/function(){var t=n(function(t){var r;return h(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");r={$or:e.map(function(e){return a({},e,t)})};return[4,this.constructor.findOne(r)];case 1:return[2,!n.sent()]}})});return function(e){return t.apply(this,arguments)}}()},matchesRegex:function e(e){return /*#__PURE__*/function(){var t=n(function(t){return h(this,function(r){if(!Array.isArray(e)||e.some(function(e){return!i(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(t)})]})});return function(e){return t.apply(this,arguments)}}()}},migrate:{withConfig:O(/*#__PURE__*/function(){var e=n(function(e,t){var r,n,a,i;return h(this,function(o){switch(o.label){case 0:return[4,ec.get(F)];case 1:r=o.sent();if(!r)throw new Error("Missing migrate config");if(Y.default.config.set(r),!t)return[2,e(void 0)];return[4,Y.default.database.connect()];case 2:n=o.sent(),a=n.db,i=n.client;o.label=3;case 3:o.trys.push([3,,5,7]);return[4,e({db:a,client:i})];case 4:return[2,o.sent()];case 5:return[4,i.close()];case 6:o.sent();return[7];case 7:return[2]}})});return function(t,r){return e.apply(this,arguments)}}(),"withConfig"),init:O(/*#__PURE__*/n(function(){return h(this,function(e){switch(e.label){case 0:return[4,Y.default.init()];case 1:e.sent();return[2]}})}),"init"),create:O(/*#__PURE__*/function(){var e=n(function(e){return h(this,function(t){switch(t.label){case 0:return[4,ed.migrate.withConfig(function(){return Y.default.create(e)})];case 1:t.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}(),"create"),up:O(/*#__PURE__*/n(function(){return h(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return /*#__PURE__*/c(require("ts-node"))}).then(function(e){return e.register({transpileOnly:!0})})];case 1:e.sent();return[4,ed.migrate.withConfig(/*#__PURE__*/function(){var e=n(function(e){var t,r;return h(this,function(n){switch(n.label){case 0:t=e.db,r=e.client;return[4,Y.default.up(t,r)];case 1:n.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}(),!0)];case 2:e.sent();return[2]}})}),"up"),down:O(/*#__PURE__*/n(function(){return h(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return /*#__PURE__*/c(require("ts-node"))}).then(function(e){return e.register({transpileOnly:!0})})];case 1:e.sent();return[4,ed.migrate.withConfig(/*#__PURE__*/function(){var e=n(function(e){var t,r;return h(this,function(n){switch(n.label){case 0:t=e.db,r=e.client;return[4,Y.default.down(t,r)];case 1:n.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}(),!0)];case 2:e.sent();return[2]}})}),"down"),status:O(/*#__PURE__*/n(function(){return h(this,function(e){switch(e.label){case 0:return[4,ed.migrate.withConfig(/*#__PURE__*/function(){var e=n(function(e){var t;return h(this,function(r){switch(r.label){case 0:t=e.db;return[4,Y.default.status(t)];case 1:r.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}(),!0)];case 1:e.sent();return[2]}})}),"status"),config:O(function(e){ec.set(F,e)},"config")}};var ep=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var ev=require("child_process"),eg=C(require("process"),1),eh=C(require("util"),1);var ey={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var em=C(require("node-fetch"),1);var eb=C(require("fs-extra"),1),ew=require("path");var e_=eb.default,eE=e_.readFileSync,eO=e_.writeFileSync,eI=e_.pathExistsSync,eS=e_.appendFileSync,eC=e_.copySync,eT=e_.removeSync,eP=e_.statSync,ej=eb.default.readJsonSync,eR=eb.default.writeJsonSync;function eD(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return t.every(function(e){return eI(e)})}O(eD,"existsSync");var eG=q();function eN(e){var t=e5(eG.CWD,tt);if(!eD(t))return!1;try{var r=ej(t),n=r.name,a=r.dependencies,i=a===void 0?{}:a,o=r.devDependencies,c=o===void 0?{}:o,u=n===e,s=e in i,l=e in c;return u||s||l?{path:t,file:r,isCurrentProject:u,isDepend:s,isDevDepend:l}:!1}catch(e){return en.warn("Failed to read package.json: ".concat(e.message)),!1}}O(eN,"getPackage");function ek(e){return eU.apply(this,arguments)}function eU(){eU=n(function(e){var t,r,n,a;return h(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,(0,em.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:r=i.sent(),n=r.version;return[2,n];case 3:a=i.sent();throw en.error('Failed to fetch version for "'.concat(e,'": ').concat(a.message)),a;case 4:return[2]}})});return eU.apply(this,arguments)}O(ek,"getLatestPackageVersion");function eL(e,t){return eA.apply(this,arguments)}function eA(){eA=n(function(e,t){var r,n,a,i,o,c,u,s,f,d,p,v,g,y,m,b,w,_,E,O,I;return h(this,function(h){switch(h.label){case 0:h.trys.push([0,4,,5]);r=eN(e);if(!r)return[2,l({},ey)];u=r.path,s=r.file,f=r.isCurrentProject,d=r.isDepend,p=r.isDevDepend,v=(n=s.dependencies)!==null&&n!==void 0?n:{},g=(a=s.devDependencies)!==null&&a!==void 0?a:{},y=f?(i=s.version)!==null&&i!==void 0?i:"0.0.0":d?(o=v[e])!==null&&o!==void 0?o:"0.0.0":p?(c=g[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!f)return[3,1];w=y;return[3,3];case 1:return[4,ek(e)];case 2:w=h.sent();h.label=3;case 3:m=w,b=f||y===m;if(!b&&(t===null||t===void 0?void 0:t.update)){;E=d?"dependencies":p?"devDependencies":null;E&&((_=s[E])===null||_===void 0?void 0:_[e])!==m&&(s[E]=(O=s[E])!==null&&O!==void 0?O:{},s[E][e]=m,eR(u,s),en.info('Updated "'.concat(e,'" to version ').concat(m)))}return[2,{isCurrentProject:f,installedPath:u,file:s,isUpToDate:b}];case 4:I=h.sent();return[2,(en.error('Error checking package "'.concat(e,'": ').concat(I.message)),l({},ey))];case 5:return[2]}})});return eA.apply(this,arguments)}O(eL,"checkPackage");function ex(){return eM.apply(this,arguments)}function eM(){eM=n(function(){var e,t,r,n,a,i,o,c,u,s,l,f;return h(this,function(d){switch(d.label){case 0:e=[{command:O(function(){return tx.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:O(function(){return tx.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:O(function(){return tx.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,r=false,n=undefined;d.label=1;case 1:d.trys.push([1,9,10,11]);a=e[Symbol.iterator]();d.label=2;case 2:if(!!(t=(i=a.next()).done))return[3,8];o=i.value,c=o.command,u=o.message;d.label=3;case 3:d.trys.push([3,6,,7]);return[4,c()];case 4:s=d.sent();return[4,e0("".concat(u," using: ").concat(s),s)];case 5:d.sent();return[2];case 6:l=d.sent();en.warn("Installation attempt failed: ".concat(u)),en.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:f=d.sent();r=true;n=f;return[3,11];case 10:try{if(!t&&a.return!=null){a.return()}}finally{if(r){throw n}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eM.apply(this,arguments)}O(ex,"installDependencies");function eq(e,t){return eF.apply(this,arguments)}function eF(){eF=n(function(e,t){var r,n,a,i,o,c,u,s,f,d,v;return h(this,function(g){switch(g.label){case 0:if(!eD(tk.PACKAGE_JSON)){en.error("package.json not found. Aborting setup.");return[2]}g.label=1;case 1:g.trys.push([1,13,,14]);r=p(new Set(e)).sort();return[4,Promise.all(r.map(function(e){return eL(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:n=g.sent().every(function(e){return e.isUpToDate});if(n)return[3,4];return[4,ex()];case 3:n=g.sent();g.label=4;case 4:n;i=true,o=false,c=undefined;g.label=5;case 5:g.trys.push([5,10,11,12]);u=((a=t===null||t===void 0?void 0:t.postInstallActions)!==null&&a!==void 0?a:[])[Symbol.iterator]();g.label=6;case 6:if(!!(i=(s=u.next()).done))return[3,9];f=s.value;return[4,f()];case 7:g.sent();g.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=g.sent();o=true;c=d;return[3,12];case 11:try{if(!i&&u.return!=null){u.return()}}finally{if(o){throw c}}return[7];case 12:return[3,14];case 13:v=g.sent();throw en.error('Failed to setup "'.concat(e.join(", "),'": ').concat(v.message)),v;case 14:return[2]}})});return eF.apply(this,arguments)}O(eq,"setupPackages");var eK=q(),eW=eh.promisify(ev.exec);function eB(e){return"error_list:".concat(e)}O(eB,"getErrorListKey");function eY(e){return eJ.apply(this,arguments)}function eJ(){eJ=n(function(e){var t,r,a;return h(this,function(i){switch(i.label){case 0:if(e.length===0)return[2];t=Date.now(),r=eB(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,ec.set(r,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(/*#__PURE__*/n(function(){var e;return h(this,function(t){switch(t.label){case 0:return[4,ec.getLogLink(r)];case 1:e=t.sent();e&&en.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:a=i.sent();en.error("Failed to save errors: ".concat(a.message));return[3,4];case 4:return[2]}})});return eJ.apply(this,arguments)}O(eY,"saveErrorListToStorage");function eH(e){var t=[],r=[],n="",a=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var c,u,s,l,f;var d=a.exec(e)||[],p=i.exec(e)||[],v=o.exec(e)||[];var g,h,y,m,b,w;d.length&&n?t.push({file:n,position:"".concat(d[1],":").concat(d[2]),type:d[3]===z.Error?z.Error:z.Warning,message:(g=d===null||d===void 0?void 0:(c=d[4])===null||c===void 0?void 0:c.trim())!==null&&g!==void 0?g:"",rule:(h=d===null||d===void 0?void 0:(u=d[5])===null||u===void 0?void 0:u.trim())!==null&&h!==void 0?h:""}):p.length?t.push({file:(y=p===null||p===void 0?void 0:p[1])!==null&&y!==void 0?y:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===z.Error?z.Error:z.Warning,message:(m=p===null||p===void 0?void 0:(s=p[5])===null||s===void 0?void 0:s.trim())!==null&&m!==void 0?m:""}):v.length?t.push({file:"commitlint",type:z.Error,message:(b=v===null||v===void 0?void 0:(l=v[1])===null||l===void 0?void 0:l.trim())!==null&&b!==void 0?b:"",rule:(w=v===null||v===void 0?void 0:(f=v[2])===null||f===void 0?void 0:f.trim())!==null&&w!==void 0?w:""}):r.push(e.trim())}}),t.length&&eY(t),eK.DEBUG&&r.length&&(en.warn("Unmatched lines:"),r.forEach(function(e){return en.info(" ".concat(e))}))}O(eH,"parseTextErrors");function e$(e){try{var t=JSON.parse(e),r=[];t.forEach(function(e){var t=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,a=e.line,i=e.column,o=e.ruleId,c=e.message;r.push({type:n===2?z.Error:z.Warning,file:t,position:"".concat(a,":").concat(i),rule:o,message:c})})}),r.length&&eY(r)}catch(t){eH(e)}}O(e$,"parseCommandOutput");function eQ(e){return eV.apply(this,arguments)}function eV(){eV=n(function(e){var t,r,n,a,i,o,c,u,s;var l=arguments;return h(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:e$;r=new AbortController;eg.default.on("SIGINT",function(){en.warn("Process interrupted. Terminating..."),r.abort(),eg.default.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,eW(e,{maxBuffer:0x6400000,signal:r.signal})];case 2:n=f.sent(),a=n.stdout,i=n.stderr;[a,i].forEach(function(e){return e&&t(e)});f.label=3;case 3:return[3,5];case 4:o=f.sent();c=o.stdout,u=o.stderr,s=o.message;[c,u].forEach(function(e){return e&&t(e)}),!u&&!c&&en.error("Command failed: ".concat(s));return[3,5];case 5:return[2]}})});return eV.apply(this,arguments)}O(eQ,"executeCommand");function ez(e){return{raw:!0,cmd:e}}O(ez,"rawCommand");function eX(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(tC," ").concat(e8," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(tC," ").concat(tO," ").concat(tf," ").concat(e):"".concat(tC," ").concat(tl," ").concat(e)}O(eX,"formatCLI");function eZ(e,t){return typeof e=="function"?eX(e(t),t):(typeof e==="undefined"?"undefined":v(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eX(e,t):e}O(eZ,"formatCommand");function e0(e,t){return e1.apply(this,arguments)}function e1(){e1=n(function(e,t){var r;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);en.start("".concat(e)),eK.DEBUG&&en.info("→ ".concat(t));return[4,eQ(t)];case 1:n.sent(),en.success("".concat(e," done."));return[3,3];case 2:r=n.sent();throw en.error("".concat(e," failed: ").concat(r.message)),r;case 3:return[2]}})});return e1.apply(this,arguments)}O(e0,"runCommand");var e2=require("path");var e4=q();function e3(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return(0,e2.resolve).apply(this,[e4.CWD].concat(p(t)))}O(e3,"resolveWorkingPath");function e5(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return(0,e2.join).apply(this,p(t))}O(e5,"join");var e6=q(),e7=e6.CWD,e8="@cyberskill/shared",e9="node_modules",te="dist",tt="package.json",tr="package-lock.json",tn="tsconfig.json",ta=".gitignore",ti=".simple-git-hooks.json",to="pnpm-lock.yaml",tc=".git/hooks/",tu=".git/COMMIT_EDITMSG",ts=e5(e7,e9,e8,te),tl="cyberskill",tf="src/nodejs/cli/index.ts",td="eslint",tp="eslint",tv="vitest",tg="playwright",th="vitest",ty="@commitlint/cli",tm="commitlint",tb="lint-staged",tw="lint-staged",t_="typescript",tE="tsc",tO="tsx",tI="git",tS="pnpm",tC="pnpm exec",tT="simple-git-hooks",tP="simple-git-hooks",tj="@eslint/config-inspector",tR="eslint-config-inspector",tD="node-modules-inspector",tG="node-modules-inspector",tN="migrate-mongo";var tk={CYBERSKILL_DIRECTORY:ts,WORKING_DIRECTORY:e7,TS_CONFIG:e3(tn),GIT_IGNORE:e3(ta),GIT_HOOK:e3(tc),GIT_COMMIT_MSG:e3(tu),SIMPLE_GIT_HOOKS_JSON:e3(ti),PACKAGE_JSON:e3(tt),PACKAGE_LOCK_JSON:e3(tr),PNPM_LOCK_YAML:e3(to),NODE_MODULES:e3(e9),LINT_STAGED_CONFIG:e3("".concat(ts,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:e3("".concat(ts,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:e3("".concat(ts,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:e3("".concat(ts,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:e3("".concat(ts,"/react/vitest/vitest.e2e.js"))};function tU(e,t,r){return tL.apply(this,arguments)}function tL(){tL=n(function(e,t,r){return h(this,function(n){switch(n.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case ep.CLI:return[3,1];case ep.STRING:return[3,3];case ep.FUNCTION:return[3,4]}return[3,6];case 1:return[4,eq(t.split(" "),{update:!0})];case 2:return[2,(n.sent(),eZ(ez("".concat(tC," ").concat(r))))];case 3:return[2,eZ(ez(t))];case 4:return[4,eq(t.split(" "),{update:!0})];case 5:if(n.sent(),typeof r=="function")return[2,r()];throw new Error("'second' argument is not a callable function");case 6:throw new Error("Unsupported command type");case 7:return[2]}})});return tL.apply(this,arguments)}O(tU,"buildCommand");function tA(e,t,r){return /*#__PURE__*/n(function(){return h(this,function(n){return[2,tU(e,t,r)]})})}O(tA,"commandFactory");var tx={simpleGitHooks:tA(ep.CLI,tT,tP),eslintInspect:tA(ep.CLI,tj,tR),nodeModulesInspect:tA(ep.CLI,tD,tG),eslintCheck:tA(ep.CLI,td,"".concat(tp," ").concat(tk.WORKING_DIRECTORY)),eslintFix:tA(ep.CLI,td,"".concat(tp," ").concat(tk.WORKING_DIRECTORY," --fix")),typescriptCheck:tA(ep.CLI,t_,"".concat(tE," -p ").concat(tk.TS_CONFIG," --noEmit")),configureGitHook:tA(ep.STRING,"".concat(tI," config core.hooksPath ").concat(tk.GIT_HOOK)),testUnit:tA(ep.CLI,tv,"".concat(th," --config ").concat(tk.UNIT_TEST_CONFIG)),testE2e:tA(ep.CLI,"".concat(tv," ").concat(tg),"".concat(th," --config ").concat(tk.E2E_TEST_CONFIG)),mongoMigrateCreate:O(function(e){return tA(ep.FUNCTION,"".concat(tN),function(){return ed.migrate.create(e)})()},"mongoMigrateCreate"),mongoMigrateUp:tA(ep.FUNCTION,"".concat(tN),ed.migrate.up),mongoMigrateDown:tA(ep.FUNCTION,"".concat(tN),ed.migrate.down),commitLint:tA(ep.CLI,ty,"".concat(tm," --edit ").concat(tk.GIT_COMMIT_MSG," --config ").concat(tk.COMMITLINT_CONFIG)),lintStaged:tA(ep.CLI,tb,"".concat(tw," --config ").concat(tk.LINT_STAGED_CONFIG)),stageBuildDirectory:tA(ep.STRING,"".concat(tI," add ").concat(te)),build:tA(ep.STRING,"".concat(tS," run build")),pnpmInstallStandard:tA(ep.STRING,"".concat(tS," install")),pnpmInstallLegacy:tA(ep.STRING,"".concat(tS," install --legacy-peer-deps")),pnpmInstallForce:tA(ep.STRING,"".concat(tS," install --force"))};function tM(e){return(0,N.defineConfig)(l({plugins:[(0,G.default)()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tk.UNIT_TEST_SETUP_CONFIG]}},e))}O(tM,"vitestUnit");0&&(module.exports={vitestE2E:vitestE2E,vitestUnit:vitestUnit});
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(t){if(Array.isArray(t))return e(t)}function n(e,t,n,r,o,a,c){try{var i=e[a](c);var s=i.value}catch(e){n(e);return}if(i.done){t(s)}else{Promise.resolve(s).then(r,o)}}function r(e){return function(){var t=this,r=arguments;return new Promise(function(o,a){var c=e.apply(t,r);function i(e){n(c,o,a,i,s,"next",e)}function s(e){n(c,o,a,i,s,"throw",e)}i(undefined)})}}function o(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 a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(){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 i(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){o(e,t,n[t])})}return e}function s(e){return t(e)||a(e)||l(e)||c()}function u(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(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 f(e,t){var n,r,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},c=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return c.next=i(0),c["throw"]=i(1),c["return"]=i(2),typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function i(e){return function(t){return s([e,t])}}function s(i){if(n)throw new TypeError("Generator is already executing.");while(c&&(c=0,i[0]&&(a=0)),a)try{if(n=1,r&&(o=i[0]&2?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;if(r=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:a.label++;return{value:i[1],done:false};case 5:a.label++;r=i[1];i=[0];continue;case 7:i=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){a=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(i[0]===6&&a.label<o[1]){a.label=o[1];o=i;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(i);break}if(o[2])a.ops.pop();a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e];r=0}finally{n=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var d=Object.create;var p=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var y=function(e,t){return p(e,"name",{value:t,configurable:!0})};var I=function(e,t){for(var n in t)p(e,n,{get:t[n],enumerable:!0})},b=function(e,t,n,r){var o=true,a=false,c=undefined;if(t&&(typeof t==="undefined"?"undefined":u(t))=="object"||typeof t=="function")try{var i=function(){var o=l.value;!h.call(e,o)&&o!==n&&p(e,o,{get:function(){return t[o]},enumerable:!(r=v(t,o))||r.enumerable})};for(var s=g(t)[Symbol.iterator](),l;!(o=(l=s.next()).done);o=true)i()}catch(e){a=true;c=e}finally{try{if(!o&&s.return!=null){s.return()}}finally{if(a){throw c}}}return e};var E=function(e,t,n){return n=e!=null?d(m(e)):{},b(t||!e||!e.__esModule?p(n,"default",{value:e,enumerable:!0}):n,e)},O=function(e){return b(p({},"__esModule",{value:!0}),e)};var C={};I(C,{vitestE2E:function(){return T},vitestUnit:function(){return tO}});module.exports=O(C);var w=E(require("@vitejs/plugin-react-swc"),1),S=require("vitest/config");function T(e){return(0,S.defineConfig)(i({plugins:[(0,w.default)()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}y(T,"vitestE2E");var _=E(require("@vitejs/plugin-react-swc"),1),G=require("vitest/config");var N=".cyberskill-storage";var R=E(require("dotenv"),1),L=require("envalid"),k=E(require("os"),1),j=E(require("path"),1),D=E(require("process"),1);R.default.config();function P(){var e={DEBUG:D.default.env.DEBUG||!1,CWD:D.default.env.CWD||D.default.cwd(),CYBERSKILL_STORAGE_DIRECTORY:D.default.env.CYBERSKILL_STORAGE_DIRECTORY||j.default.join(k.default.homedir(),N)};return(0,L.cleanEnv)(e,{DEBUG:(0,L.bool)(),CWD:(0,L.str)(),CYBERSKILL_STORAGE_DIRECTORY:(0,L.str)()})}y(P,"getEnv");var M=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var x=require("child_process"),A=E(require("process"),1),F=E(require("util"),1);var U=function(e){return e.Error="error",e.Warning="warning",e}({});var q=E(require("chalk"),1),K=E(require("consola"),1),Y=require("graphql");var B=P();B.DEBUG||(K.default.level=4);function W(e){var t=q.default[e];return typeof t=="function"?t:q.default.green}y(W,"chalkKeyword");var J={silent:K.default.silent,level:K.default.level,fatal:K.default.fatal,error:K.default.error,warn:K.default.warn,log:K.default.log,info:K.default.info,success:K.default.success,ready:K.default.ready,start:K.default.start,box:K.default.box,debug:K.default.debug,trace:K.default.trace,verbose:K.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)){K.default.box(q.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,a=e.message;K.default.log("".concat(q.default.gray("File:")," ").concat(q.default.blue("".concat(t).concat(r?":".concat(r):"")))),o&&K.default.log(" ".concat(W(n)("Rule:")," ").concat(o)),K.default.log(" ".concat(W(n)("Message:")," ").concat(a))}),K.default.box(W(n)("".concat(e," : ").concat(t.length))),K.default.log(q.default.gray("─".repeat(40)))}};var H={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var $=E(require("node-fetch"),1);var V=E(require("fs-extra"),1),z=require("path");var Q=V.default,X=Q.readFileSync,Z=Q.writeFileSync,ee=Q.pathExistsSync,et=Q.appendFileSync,en=Q.copySync,er=Q.removeSync,eo=Q.statSync,ea=V.default.readJsonSync,ec=V.default.writeJsonSync;function ei(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return ee(e)})}y(ei,"existsSync");var es=P();function eu(e){var t=eU(es.CWD,eJ);if(!ei(t))return!1;try{var n=ea(t),r=n.name,o=n.dependencies,a=o===void 0?{}:o,c=n.devDependencies,i=c===void 0?{}:c,s=r===e,u=e in a,l=e in i;return s||u||l?{path:t,file:n,isCurrentProject:s,isDepend:u,isDevDepend:l}:!1}catch(e){return J.warn("Failed to read package.json: ".concat(e.message)),!1}}y(eu,"getPackage");function el(e){return ef.apply(this,arguments)}function ef(){ef=r(function(e){var t,n,r,o;return f(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,(0,$.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=a.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=a.sent(),r=n.version;return[2,r];case 3:o=a.sent();throw J.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})});return ef.apply(this,arguments)}y(el,"getLatestPackageVersion");function ed(e,t){return ep.apply(this,arguments)}function ep(){ep=r(function(e,t){var n,r,o,a,c,s,u,l,d,p,v,g,m,h,y,I,b,E,O,C,w;return f(this,function(f){switch(f.label){case 0:f.trys.push([0,4,,5]);n=eu(e);if(!n)return[2,i({},H)];u=n.path,l=n.file,d=n.isCurrentProject,p=n.isDepend,v=n.isDevDepend,g=(r=l.dependencies)!==null&&r!==void 0?r:{},m=(o=l.devDependencies)!==null&&o!==void 0?o:{},h=d?(a=l.version)!==null&&a!==void 0?a:"0.0.0":p?(c=g[e])!==null&&c!==void 0?c:"0.0.0":v?(s=m[e])!==null&&s!==void 0?s:"0.0.0":"0.0.0";if(!d)return[3,1];b=h;return[3,3];case 1:return[4,el(e)];case 2:b=f.sent();f.label=3;case 3:y=b,I=d||h===y;if(!I&&(t===null||t===void 0?void 0:t.update)){;O=p?"dependencies":v?"devDependencies":null;O&&((E=l[O])===null||E===void 0?void 0:E[e])!==y&&(l[O]=(C=l[O])!==null&&C!==void 0?C:{},l[O][e]=y,ec(u,l),J.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:d,installedPath:u,file:l,isUpToDate:I}];case 4:w=f.sent();return[2,(J.error('Error checking package "'.concat(e,'": ').concat(w.message)),i({},H))];case 5:return[2]}})});return ep.apply(this,arguments)}y(ed,"checkPackage");function ev(){return eg.apply(this,arguments)}function eg(){eg=r(function(){var e,t,n,r,o,a,c,i,s,u,l,d;return f(this,function(f){switch(f.label){case 0:e=[{command:y(function(){return tE.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:y(function(){return tE.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:y(function(){return tE.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);o=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(a=o.next()).done))return[3,8];c=a.value,i=c.command,s=c.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,i()];case 4:u=f.sent();return[4,eP("".concat(s," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();J.warn("Installation attempt failed: ".concat(s)),J.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eg.apply(this,arguments)}y(ev,"installDependencies");function em(e,t){return eh.apply(this,arguments)}function eh(){eh=r(function(e,t){var n,r,o,a,c,u,l,d,p,v,g;return f(this,function(f){switch(f.label){case 0:if(!ei(th.PACKAGE_JSON)){J.error("package.json not found. Aborting setup.");return[2]}f.label=1;case 1:f.trys.push([1,13,,14]);n=s(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return ed(e,i({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=f.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,ev()];case 3:r=f.sent();f.label=4;case 4:r;a=true,c=false,u=undefined;f.label=5;case 5:f.trys.push([5,10,11,12]);l=((o=t===null||t===void 0?void 0:t.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();f.label=6;case 6:if(!!(a=(d=l.next()).done))return[3,9];p=d.value;return[4,p()];case 7:f.sent();f.label=8;case 8:a=true;return[3,6];case 9:return[3,12];case 10:v=f.sent();c=true;u=v;return[3,12];case 11:try{if(!a&&l.return!=null){l.return()}}finally{if(c){throw u}}return[7];case 12:return[3,14];case 13:g=f.sent();throw J.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})});return eh.apply(this,arguments)}y(em,"setupPackages");var ey=E(require("node-persist"),1);var eI=P();function eb(){return eE.apply(this,arguments)}function eE(){eE=r(function(){var e;return f(this,function(t){switch(t.label){case 0:e=ey.default.defaultInstance;if(e)return[3,2];return[4,ey.default.init({dir:eI.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return eE.apply(this,arguments)}y(eb,"initNodePersist");var eO={get:function e(e){return r(function(){var t,n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eb()];case 1:r.sent();return[4,ey.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(J.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eb()];case 1:r.sent();return[4,ey.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();J.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var t;return f(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eb()];case 1:n.sent();return[4,ey.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();J.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,t;return f(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eb()];case 1:n.sent();return[4,ey.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(J.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(J.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return f(this,function(t){try{return[2,"".concat(eI.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(J.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eC=P(),ew=F.promisify(x.exec);function eS(e){return"error_list:".concat(e)}y(eS,"getErrorListKey");function eT(e){return e_.apply(this,arguments)}function e_(){e_=r(function(e){var t,n,o;return f(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];t=Date.now(),n=eS(t);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,eO.set(n,{errors:e,timestamp:t})];case 2:a.sent(),setTimeout(/*#__PURE__*/r(function(){var e;return f(this,function(t){switch(t.label){case 0:return[4,eO.getLogLink(n)];case 1:e=t.sent();e&&J.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:o=a.sent();J.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return e_.apply(this,arguments)}y(eT,"saveErrorListToStorage");function eG(e){var t=[],n=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,s,u,l,f;var d=o.exec(e)||[],p=a.exec(e)||[],v=c.exec(e)||[];var g,m,h,y,I,b;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===U.Error?U.Error:U.Warning,message:(g=d===null||d===void 0?void 0:(i=d[4])===null||i===void 0?void 0:i.trim())!==null&&g!==void 0?g:"",rule:(m=d===null||d===void 0?void 0:(s=d[5])===null||s===void 0?void 0:s.trim())!==null&&m!==void 0?m:""}):p.length?t.push({file:(h=p===null||p===void 0?void 0:p[1])!==null&&h!==void 0?h:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===U.Error?U.Error:U.Warning,message:(y=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&y!==void 0?y:""}):v.length?t.push({file:"commitlint",type:U.Error,message:(I=v===null||v===void 0?void 0:(l=v[1])===null||l===void 0?void 0:l.trim())!==null&&I!==void 0?I:"",rule:(b=v===null||v===void 0?void 0:(f=v[2])===null||f===void 0?void 0:f.trim())!==null&&b!==void 0?b:""}):n.push(e.trim())}}),t.length&&eT(t),eC.DEBUG&&n.length&&(J.warn("Unmatched lines:"),n.forEach(function(e){return J.info(" ".concat(e))}))}y(eG,"parseTextErrors");function eN(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,o=e.line,a=e.column,c=e.ruleId,i=e.message;n.push({type:r===2?U.Error:U.Warning,file:t,position:"".concat(o,":").concat(a),rule:c,message:i})})}),n.length&&eT(n)}catch(t){eG(e)}}y(eN,"parseCommandOutput");function eR(e){return eL.apply(this,arguments)}function eL(){eL=r(function(e){var t,n,r,o,a,c,i,s,u;var l=arguments;return f(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eN;n=new AbortController;A.default.on("SIGINT",function(){J.warn("Process interrupted. Terminating..."),n.abort(),A.default.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,ew(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),o=r.stdout,a=r.stderr;[o,a].forEach(function(e){return e&&t(e)});f.label=3;case 3:return[3,5];case 4:c=f.sent();i=c.stdout,s=c.stderr,u=c.message;[i,s].forEach(function(e){return e&&t(e)}),!s&&!i&&J.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})});return eL.apply(this,arguments)}y(eR,"executeCommand");function ek(e){return{raw:!0,cmd:e}}y(ek,"rawCommand");function ej(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ts," ").concat(eY," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ts," ").concat(ta," ").concat(e3," ").concat(e):"".concat(ts," ").concat(e2," ").concat(e)}y(ej,"formatCLI");function eD(e,t){return typeof e=="function"?ej(e(t),t):(typeof e==="undefined"?"undefined":u(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?ej(e,t):e}y(eD,"formatCommand");function eP(e,t){return eM.apply(this,arguments)}function eM(){eM=r(function(e,t){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);J.start("".concat(e)),eC.DEBUG&&J.info("→ ".concat(t));return[4,eR(t)];case 1:r.sent(),J.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw J.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return eM.apply(this,arguments)}y(eP,"runCommand");var ex=require("path");var eA=P();function eF(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return(0,ex.resolve).apply(this,[eA.CWD].concat(s(t)))}y(eF,"resolveWorkingPath");function eU(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return(0,ex.join).apply(this,s(t))}y(eU,"join");var eq=P(),eK=eq.CWD,eY="@cyberskill/shared",eB="node_modules",eW="dist",eJ="package.json",eH="package-lock.json",e$="tsconfig.json",eV=".gitignore",ez=".simple-git-hooks.json",eQ="pnpm-lock.yaml",eX=".git/hooks/",eZ=".git/COMMIT_EDITMSG",e0=".migrate-mongo.config.js",e1=eU(eK,eB,eY,eW),e2="cyberskill",e3="src/nodejs/cli/index.ts",e4="eslint",e5="eslint",e6="vitest",e7="playwright",e8="vitest",e9="@commitlint/cli",te="commitlint",tt="lint-staged",tn="lint-staged",tr="typescript",to="tsc",ta="tsx",tc="git",ti="pnpm",ts="pnpm exec",tu="simple-git-hooks",tl="simple-git-hooks",tf="@eslint/config-inspector",td="eslint-config-inspector",tp="node-modules-inspector",tv="node-modules-inspector",tg="migrate-mongo",tm="./node_modules/migrate-mongo/bin/migrate-mongo",th={CYBERSKILL_DIRECTORY:e1,WORKING_DIRECTORY:eK,TS_CONFIG:eF(e$),GIT_IGNORE:eF(eV),GIT_HOOK:eF(eX),GIT_COMMIT_MSG:eF(eZ),SIMPLE_GIT_HOOKS_JSON:eF(ez),PACKAGE_JSON:eF(eJ),PACKAGE_LOCK_JSON:eF(eH),PNPM_LOCK_YAML:eF(eQ),NODE_MODULES:eF(eB),MIGRATE_MONGO_CONFIG:eF(e0),LINT_STAGED_CONFIG:eF("".concat(e1,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:eF("".concat(e1,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:eF("".concat(e1,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eF("".concat(e1,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eF("".concat(e1,"/react/vitest/vitest.e2e.js"))};function ty(e,t,n){return tI.apply(this,arguments)}function tI(){tI=r(function(e,t,n){return f(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case M.CLI:return[3,1];case M.STRING:return[3,3]}return[3,4];case 1:return[4,em(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),eD(ek("".concat(ts," ").concat(n))))];case 3:return[2,eD(ek(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return tI.apply(this,arguments)}y(ty,"buildCommand");function tb(e,t,n){return /*#__PURE__*/r(function(){return f(this,function(r){return[2,ty(e,t,n)]})})}y(tb,"commandFactory");var tE={simpleGitHooks:tb(M.CLI,tu,tl),eslintInspect:tb(M.CLI,tf,td),nodeModulesInspect:tb(M.CLI,tp,tv),eslintCheck:tb(M.CLI,e4,"".concat(e5," ").concat(th.WORKING_DIRECTORY)),eslintFix:tb(M.CLI,e4,"".concat(e5," ").concat(th.WORKING_DIRECTORY," --fix")),typescriptCheck:tb(M.CLI,tr,"".concat(to," -p ").concat(th.TS_CONFIG," --noEmit")),configureGitHook:tb(M.STRING,"".concat(tc," config core.hooksPath ").concat(th.GIT_HOOK)),testUnit:tb(M.CLI,e6,"".concat(e8," --config ").concat(th.UNIT_TEST_CONFIG)),testE2e:tb(M.CLI,"".concat(e6," ").concat(e7),"".concat(e8," --config ").concat(th.E2E_TEST_CONFIG)),mongoMigrateCreate:y(function(e){return tb(M.CLI,tg,"".concat(ta," ").concat(tm," create ").concat(e," -f ").concat(th.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:tb(M.CLI,tg,"".concat(ta," ").concat(tm," up -f ").concat(th.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:tb(M.CLI,tg,"".concat(ta," ").concat(tm," down -f ").concat(th.MIGRATE_MONGO_CONFIG)),mongoMigrateStatus:tb(M.CLI,tg,"".concat(ta," ").concat(tm," status -f ").concat(th.MIGRATE_MONGO_CONFIG)),commitLint:tb(M.CLI,e9,"".concat(te," --edit ").concat(th.GIT_COMMIT_MSG," --config ").concat(th.COMMITLINT_CONFIG)),lintStaged:tb(M.CLI,tt,"".concat(tn," --config ").concat(th.LINT_STAGED_CONFIG)),stageBuildDirectory:tb(M.STRING,"".concat(tc," add ").concat(eW)),build:tb(M.STRING,"".concat(ti," run build")),pnpmInstallStandard:tb(M.STRING,"".concat(ti," install")),pnpmInstallLegacy:tb(M.STRING,"".concat(ti," install --legacy-peer-deps")),pnpmInstallForce:tb(M.STRING,"".concat(ti," install --force"))};function tO(e){return(0,G.defineConfig)(i({plugins:[(0,_.default)()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[th.UNIT_TEST_SETUP_CONFIG]}},e))}y(tO,"vitestUnit");0&&(module.exports={vitestE2E:vitestE2E,vitestUnit:vitestUnit});
@@ -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(t){if(Array.isArray(t))return e(t)}function n(e,t,n,r,o,i,a){try{var c=e[i](a);var s=c.value}catch(e){n(e);return}if(c.done){t(s)}else{Promise.resolve(s).then(r,o)}}function r(e){return function(){var t=this,r=arguments;return new Promise(function(o,i){var a=e.apply(t,r);function c(e){n(a,o,i,c,s,"next",e)}function s(e){n(a,o,i,c,s,"throw",e)}c(undefined)})}}function o(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 i(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(){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 s(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){o(e,t,n[t])})}return e}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(t){r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}n.push.apply(n,r)}return n}function l(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{u(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function f(e){return t(e)||a(e)||d(e)||c()}function p(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function d(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,o,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=c(0),a["throw"]=c(1),a["return"]=c(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(e){return function(t){return s([e,t])}}function s(c){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,c[0]&&(i=0)),i)try{if(n=1,r&&(o=c[0]&2?r["return"]:c[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;if(r=0,o)c=[c[0]&2,o.value];switch(c[0]){case 0:case 1:o=c;break;case 4:i.label++;return{value:c[1],done:false};case 5:i.label++;r=c[1];c=[0];continue;case 7:c=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){i=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(c[0]===6&&i.label<o[1]){i.label=o[1];o=c;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(c);break}if(o[2])i.ops.pop();i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e];r=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var g=Object.defineProperty;var h=function(e,t){return g(e,"name",{value:t,configurable:!0})};import v from"@vitejs/plugin-react-swc";import{defineConfig as y}from"vitest/config";function b(e){return y(s({plugins:[v()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}h(b,"vitestE2E");import w from"@vitejs/plugin-react-swc";import{defineConfig as E}from"vitest/config";var _=".cyberskill-storage";import I from"dotenv";import{bool as S,cleanEnv as O,str as C}from"envalid";import T from"node:os";import R from"node:path";import G from"node:process";I.config();function D(){var e={DEBUG:G.env.DEBUG||!1,CWD:G.env.CWD||G.cwd(),CYBERSKILL_STORAGE_DIRECTORY:G.env.CYBERSKILL_STORAGE_DIRECTORY||R.join(T.homedir(),_)};return O(e,{DEBUG:S(),CWD:C(),CYBERSKILL_STORAGE_DIRECTORY:C()})}h(D,"getEnv");var N="MONGO_MIGRATE_OPTIONS";import{Collection as P,Db as j}from"mongodb";import{Document as k,Model as L}from"mongoose";import{format as U}from"date-fns";import A from"migrate-mongo";import{Document as x}from"mongoose";import F from"mongoose-aggregate-paginate-v2";import M from"mongoose-paginate-v2";import{v4 as K}from"uuid";import B from"node-persist";var Y=function(e){return e.Error="error",e.Warning="warning",e}({});import W from"chalk";import J from"consola";import{GraphQLError as H}from"graphql";var $=D();$.DEBUG||(J.level=4);function q(e){var t=W[e];return typeof t=="function"?t:W.green}h(q,"chalkKeyword");var Q={silent:J.silent,level:J.level,fatal:J.fatal,error:J.error,warn:J.warn,log:J.log,info:J.info,success:J.success,ready:J.ready,start:J.start,box:J.box,debug:J.debug,trace:J.trace,verbose:J.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)){J.box(W.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,i=e.message;J.log("".concat(W.gray("File:")," ").concat(W.blue("".concat(t).concat(r?":".concat(r):"")))),o&&J.log(" ".concat(q(n)("Rule:")," ").concat(o)),J.log(" ".concat(q(n)("Message:")," ").concat(i))}),J.box(q(n)("".concat(e," : ").concat(t.length))),J.log(W.gray("─".repeat(40)))}};var V=D();function z(){return X.apply(this,arguments)}function X(){X=r(function(){var e;return m(this,function(t){switch(t.label){case 0:e=B.defaultInstance;if(e)return[3,2];return[4,B.init({dir:V.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return X.apply(this,arguments)}h(z,"initNodePersist");var Z={get:function e(e){return r(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,z()];case 1:r.sent();return[4,B.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(Q.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,z()];case 1:r.sent();return[4,B.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();Q.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,z()];case 1:n.sent();return[4,B.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();Q.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,z()];case 1:n.sent();return[4,B.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(Q.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(Q.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return m(this,function(t){try{return[2,"".concat(V.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(Q.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};import ee from"crypto-js";import et from"slugify";var en=et.default||et;var er={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":p(e))=="object"?i(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var eo={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return U(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.returnDateAs,n=t===void 0?"string":t;var r=n==="string"?eo.getDateTime():new Date;return{id:K(),isDel:!1,createdAt:r,updatedAt:r}},applyPlugins:function e(e,t){t.filter(function(e){return typeof e=="function"}).forEach(function(t){return e.plugin(t)})},applyMiddlewares:function e(e,t){t.forEach(function(t){var n=t.method,r=t.pre,o=t.post;n&&r&&e.pre(n,r),n&&o&&e.post(n,o)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:K,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,n=e.schema,r=e.virtuals,o=r===void 0?[]:r,i=e.standalone,a=i===void 0?!1:i;var c=new t.Schema(n,{strict:!0});return o.forEach(function(e){var t=e.name,n=e.options,r=e.get;var o=c.virtual(t,n);r&&o.get(r)}),a||c.add(eo.createGenericSchema(t)),c},createModel:function e(e){var t=e.mongoose,n=e.name,r=e.schema,o=e.pagination,i=o===void 0?!1:o,a=e.aggregate,c=a===void 0?!1:a,s=e.virtuals,u=s===void 0?[]:s,l=e.middlewares,f=l===void 0?[]:l;if(!n)throw new Error("Model name is required.");if(t.models[n])return t.models[n];var p=eo.createSchema({mongoose:t,schema:r,virtuals:u});return eo.applyPlugins(p,[i&&M,c&&F]),eo.applyMiddlewares(p,f),t.model(n,p)},createSlugQuery:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return l(s({},t,n&&{id:{$ne:n}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=r(function(e){return m(this,function(t){return[2,!er.isEmpty(e)]})});return function(t){return e.apply(this,arguments)}}()},isUnique:function e(e){return /*#__PURE__*/function(){var t=r(function(t){var n;return m(this,function(r){switch(r.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");n={$or:e.map(function(e){return o({},e,t)})};return[4,this.constructor.findOne(n)];case 1:return[2,!r.sent()]}})});return function(e){return t.apply(this,arguments)}}()},matchesRegex:function e(e){return /*#__PURE__*/function(){var t=r(function(t){return m(this,function(n){if(!Array.isArray(e)||e.some(function(e){return!i(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(t)})]})});return function(e){return t.apply(this,arguments)}}()}},migrate:{withConfig:h(/*#__PURE__*/function(){var e=r(function(e,t){var n,r,o,i;return m(this,function(a){switch(a.label){case 0:return[4,Z.get(N)];case 1:n=a.sent();if(!n)throw new Error("Missing migrate config");if(A.config.set(n),!t)return[2,e(void 0)];return[4,A.database.connect()];case 2:r=a.sent(),o=r.db,i=r.client;a.label=3;case 3:a.trys.push([3,,5,7]);return[4,e({db:o,client:i})];case 4:return[2,a.sent()];case 5:return[4,i.close()];case 6:a.sent();return[7];case 7:return[2]}})});return function(t,n){return e.apply(this,arguments)}}(),"withConfig"),init:h(/*#__PURE__*/r(function(){return m(this,function(e){switch(e.label){case 0:return[4,A.init()];case 1:e.sent();return[2]}})}),"init"),create:h(/*#__PURE__*/function(){var e=r(function(e){return m(this,function(t){switch(t.label){case 0:return[4,eo.migrate.withConfig(function(){return A.create(e)})];case 1:t.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}(),"create"),up:h(/*#__PURE__*/r(function(){return m(this,function(e){switch(e.label){case 0:return[4,import("ts-node").then(function(e){return e.register({transpileOnly:!0})})];case 1:e.sent();return[4,eo.migrate.withConfig(/*#__PURE__*/function(){var e=r(function(e){var t,n;return m(this,function(r){switch(r.label){case 0:t=e.db,n=e.client;return[4,A.up(t,n)];case 1:r.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}(),!0)];case 2:e.sent();return[2]}})}),"up"),down:h(/*#__PURE__*/r(function(){return m(this,function(e){switch(e.label){case 0:return[4,import("ts-node").then(function(e){return e.register({transpileOnly:!0})})];case 1:e.sent();return[4,eo.migrate.withConfig(/*#__PURE__*/function(){var e=r(function(e){var t,n;return m(this,function(r){switch(r.label){case 0:t=e.db,n=e.client;return[4,A.down(t,n)];case 1:r.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}(),!0)];case 2:e.sent();return[2]}})}),"down"),status:h(/*#__PURE__*/r(function(){return m(this,function(e){switch(e.label){case 0:return[4,eo.migrate.withConfig(/*#__PURE__*/function(){var e=r(function(e){var t;return m(this,function(n){switch(n.label){case 0:t=e.db;return[4,A.status(t)];case 1:n.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}(),!0)];case 1:e.sent();return[2]}})}),"status"),config:h(function(e){Z.set(N,e)},"config")}};var ei=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as ea}from"node:child_process";import ec from"node:process";import*as es from"node:util";var eu={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import el from"node-fetch";import ef from"fs-extra";var ep=ef.readFileSync,ed=ef.writeFileSync,em=ef.pathExistsSync,eg=ef.appendFileSync,eh=ef.copySync,ev=ef.removeSync,ey=ef.statSync,eb=ef.readJsonSync,ew=ef.writeJsonSync;function eE(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return em(e)})}h(eE,"existsSync");var e_=D();function eI(e){var t=eV(e_.CWD,e2);if(!eE(t))return!1;try{var n=eb(t),r=n.name,o=n.dependencies,i=o===void 0?{}:o,a=n.devDependencies,c=a===void 0?{}:a,s=r===e,u=e in i,l=e in c;return s||u||l?{path:t,file:n,isCurrentProject:s,isDepend:u,isDevDepend:l}:!1}catch(e){return Q.warn("Failed to read package.json: ".concat(e.message)),!1}}h(eI,"getPackage");function eS(e){return eO.apply(this,arguments)}function eO(){eO=r(function(e){var t,n,r,o;return m(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,el("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:o=i.sent();throw Q.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})});return eO.apply(this,arguments)}h(eS,"getLatestPackageVersion");function eC(e,t){return eT.apply(this,arguments)}function eT(){eT=r(function(e,t){var n,r,o,i,a,c,u,l,f,p,d,g,h,v,y,b,w,E,_,I,S;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=eI(e);if(!n)return[2,s({},eu)];u=n.path,l=n.file,f=n.isCurrentProject,p=n.isDepend,d=n.isDevDepend,g=(r=l.dependencies)!==null&&r!==void 0?r:{},h=(o=l.devDependencies)!==null&&o!==void 0?o:{},v=f?(i=l.version)!==null&&i!==void 0?i:"0.0.0":p?(a=g[e])!==null&&a!==void 0?a:"0.0.0":d?(c=h[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!f)return[3,1];w=v;return[3,3];case 1:return[4,eS(e)];case 2:w=m.sent();m.label=3;case 3:y=w,b=f||v===y;if(!b&&(t===null||t===void 0?void 0:t.update)){;_=p?"dependencies":d?"devDependencies":null;_&&((E=l[_])===null||E===void 0?void 0:E[e])!==y&&(l[_]=(I=l[_])!==null&&I!==void 0?I:{},l[_][e]=y,ew(u,l),Q.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:f,installedPath:u,file:l,isUpToDate:b}];case 4:S=m.sent();return[2,(Q.error('Error checking package "'.concat(e,'": ').concat(S.message)),s({},eu))];case 5:return[2]}})});return eT.apply(this,arguments)}h(eC,"checkPackage");function eR(){return eG.apply(this,arguments)}function eG(){eG=r(function(){var e,t,n,r,o,i,a,c,s,u,l,f;return m(this,function(p){switch(p.label){case 0:e=[{command:h(function(){return tG.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:h(function(){return tG.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:h(function(){return tG.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]);o=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(i=o.next()).done))return[3,8];a=i.value,c=a.command,s=a.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,c()];case 4:u=p.sent();return[4,eW("".concat(s," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();Q.warn("Installation attempt failed: ".concat(s)),Q.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:f=p.sent();n=true;r=f;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eG.apply(this,arguments)}h(eR,"installDependencies");function eD(e,t){return eN.apply(this,arguments)}function eN(){eN=r(function(e,t){var n,r,o,i,a,c,u,l,p,d,g;return m(this,function(m){switch(m.label){case 0:if(!eE(tO.PACKAGE_JSON)){Q.error("package.json not found. Aborting setup.");return[2]}m.label=1;case 1:m.trys.push([1,13,,14]);n=f(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return eC(e,s({},(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,eR()];case 3:r=m.sent();m.label=4;case 4:r;i=true,a=false,c=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);u=((o=t===null||t===void 0?void 0:t.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();m.label=6;case 6:if(!!(i=(l=u.next()).done))return[3,9];p=l.value;return[4,p()];case 7:m.sent();m.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=m.sent();a=true;c=d;return[3,12];case 11:try{if(!i&&u.return!=null){u.return()}}finally{if(a){throw c}}return[7];case 12:return[3,14];case 13:g=m.sent();throw Q.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})});return eN.apply(this,arguments)}h(eD,"setupPackages");var eP=D(),ej=es.promisify(ea);function ek(e){return"error_list:".concat(e)}h(ek,"getErrorListKey");function eL(e){return eU.apply(this,arguments)}function eU(){eU=r(function(e){var t,n,o;return m(this,function(i){switch(i.label){case 0:if(e.length===0)return[2];t=Date.now(),n=ek(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,Z.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(/*#__PURE__*/r(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,Z.getLogLink(n)];case 1:e=t.sent();e&&Q.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:o=i.sent();Q.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return eU.apply(this,arguments)}h(eL,"saveErrorListToStorage");function eA(e){var t=[],n=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,a=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c,s,u,l,f;var p=o.exec(e)||[],d=i.exec(e)||[],m=a.exec(e)||[];var g,h,v,y,b,w;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===Y.Error?Y.Error:Y.Warning,message:(g=p===null||p===void 0?void 0:(c=p[4])===null||c===void 0?void 0:c.trim())!==null&&g!==void 0?g:"",rule:(h=p===null||p===void 0?void 0:(s=p[5])===null||s===void 0?void 0:s.trim())!==null&&h!==void 0?h:""}):d.length?t.push({file:(v=d===null||d===void 0?void 0:d[1])!==null&&v!==void 0?v:"",position:"".concat(d[2],":").concat(d[3]),type:d[4]===Y.Error?Y.Error:Y.Warning,message:(y=d===null||d===void 0?void 0:(u=d[5])===null||u===void 0?void 0:u.trim())!==null&&y!==void 0?y:""}):m.length?t.push({file:"commitlint",type:Y.Error,message:(b=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&b!==void 0?b:"",rule:(w=m===null||m===void 0?void 0:(f=m[2])===null||f===void 0?void 0:f.trim())!==null&&w!==void 0?w:""}):n.push(e.trim())}}),t.length&&eL(t),eP.DEBUG&&n.length&&(Q.warn("Unmatched lines:"),n.forEach(function(e){return Q.info(" ".concat(e))}))}h(eA,"parseTextErrors");function ex(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,o=e.line,i=e.column,a=e.ruleId,c=e.message;n.push({type:r===2?Y.Error:Y.Warning,file:t,position:"".concat(o,":").concat(i),rule:a,message:c})})}),n.length&&eL(n)}catch(t){eA(e)}}h(ex,"parseCommandOutput");function eF(e){return eM.apply(this,arguments)}function eM(){eM=r(function(e){var t,n,r,o,i,a,c,s,u;var l=arguments;return m(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:ex;n=new AbortController;ec.on("SIGINT",function(){Q.warn("Process interrupted. Terminating..."),n.abort(),ec.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,ej(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),o=r.stdout,i=r.stderr;[o,i].forEach(function(e){return e&&t(e)});f.label=3;case 3:return[3,5];case 4:a=f.sent();c=a.stdout,s=a.stderr,u=a.message;[c,s].forEach(function(e){return e&&t(e)}),!s&&!c&&Q.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})});return eM.apply(this,arguments)}h(eF,"executeCommand");function eK(e){return{raw:!0,cmd:e}}h(eK,"rawCommand");function eB(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(tv," ").concat(eZ," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(tv," ").concat(tm," ").concat(tn," ").concat(e):"".concat(tv," ").concat(tt," ").concat(e)}h(eB,"formatCLI");function eY(e,t){return typeof e=="function"?eB(e(t),t):(typeof e==="undefined"?"undefined":p(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eB(e,t):e}h(eY,"formatCommand");function eW(e,t){return eJ.apply(this,arguments)}function eJ(){eJ=r(function(e,t){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);Q.start("".concat(e)),eP.DEBUG&&Q.info("→ ".concat(t));return[4,eF(t)];case 1:r.sent(),Q.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw Q.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return eJ.apply(this,arguments)}h(eW,"runCommand");import{join as eH,resolve as e$}from"node:path";var eq=D();function eQ(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return e$.apply(void 0,[eq.CWD].concat(f(t)))}h(eQ,"resolveWorkingPath");function eV(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return eH.apply(void 0,f(t))}h(eV,"join");var ez=D(),eX=ez.CWD,eZ="@cyberskill/shared",e0="node_modules",e1="dist",e2="package.json",e4="package-lock.json",e3="tsconfig.json",e5=".gitignore",e6=".simple-git-hooks.json",e7="pnpm-lock.yaml",e8=".git/hooks/",e9=".git/COMMIT_EDITMSG",te=eV(eX,e0,eZ,e1),tt="cyberskill",tn="src/nodejs/cli/index.ts",tr="eslint",to="eslint",ti="vitest",ta="playwright",tc="vitest",ts="@commitlint/cli",tu="commitlint",tl="lint-staged",tf="lint-staged",tp="typescript",td="tsc",tm="tsx",tg="git",th="pnpm",tv="pnpm exec",ty="simple-git-hooks",tb="simple-git-hooks",tw="@eslint/config-inspector",tE="eslint-config-inspector",t_="node-modules-inspector",tI="node-modules-inspector",tS="migrate-mongo";var tO={CYBERSKILL_DIRECTORY:te,WORKING_DIRECTORY:eX,TS_CONFIG:eQ(e3),GIT_IGNORE:eQ(e5),GIT_HOOK:eQ(e8),GIT_COMMIT_MSG:eQ(e9),SIMPLE_GIT_HOOKS_JSON:eQ(e6),PACKAGE_JSON:eQ(e2),PACKAGE_LOCK_JSON:eQ(e4),PNPM_LOCK_YAML:eQ(e7),NODE_MODULES:eQ(e0),LINT_STAGED_CONFIG:eQ("".concat(te,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:eQ("".concat(te,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:eQ("".concat(te,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eQ("".concat(te,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eQ("".concat(te,"/react/vitest/vitest.e2e.js"))};function tC(e,t,n){return tT.apply(this,arguments)}function tT(){tT=r(function(e,t,n){return m(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case ei.CLI:return[3,1];case ei.STRING:return[3,3];case ei.FUNCTION:return[3,4]}return[3,6];case 1:return[4,eD(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),eY(eK("".concat(tv," ").concat(n))))];case 3:return[2,eY(eK(t))];case 4:return[4,eD(t.split(" "),{update:!0})];case 5:if(r.sent(),typeof n=="function")return[2,n()];throw new Error("'second' argument is not a callable function");case 6:throw new Error("Unsupported command type");case 7:return[2]}})});return tT.apply(this,arguments)}h(tC,"buildCommand");function tR(e,t,n){return /*#__PURE__*/r(function(){return m(this,function(r){return[2,tC(e,t,n)]})})}h(tR,"commandFactory");var tG={simpleGitHooks:tR(ei.CLI,ty,tb),eslintInspect:tR(ei.CLI,tw,tE),nodeModulesInspect:tR(ei.CLI,t_,tI),eslintCheck:tR(ei.CLI,tr,"".concat(to," ").concat(tO.WORKING_DIRECTORY)),eslintFix:tR(ei.CLI,tr,"".concat(to," ").concat(tO.WORKING_DIRECTORY," --fix")),typescriptCheck:tR(ei.CLI,tp,"".concat(td," -p ").concat(tO.TS_CONFIG," --noEmit")),configureGitHook:tR(ei.STRING,"".concat(tg," config core.hooksPath ").concat(tO.GIT_HOOK)),testUnit:tR(ei.CLI,ti,"".concat(tc," --config ").concat(tO.UNIT_TEST_CONFIG)),testE2e:tR(ei.CLI,"".concat(ti," ").concat(ta),"".concat(tc," --config ").concat(tO.E2E_TEST_CONFIG)),mongoMigrateCreate:h(function(e){return tR(ei.FUNCTION,"".concat(tS),function(){return eo.migrate.create(e)})()},"mongoMigrateCreate"),mongoMigrateUp:tR(ei.FUNCTION,"".concat(tS),eo.migrate.up),mongoMigrateDown:tR(ei.FUNCTION,"".concat(tS),eo.migrate.down),commitLint:tR(ei.CLI,ts,"".concat(tu," --edit ").concat(tO.GIT_COMMIT_MSG," --config ").concat(tO.COMMITLINT_CONFIG)),lintStaged:tR(ei.CLI,tl,"".concat(tf," --config ").concat(tO.LINT_STAGED_CONFIG)),stageBuildDirectory:tR(ei.STRING,"".concat(tg," add ").concat(e1)),build:tR(ei.STRING,"".concat(th," run build")),pnpmInstallStandard:tR(ei.STRING,"".concat(th," install")),pnpmInstallLegacy:tR(ei.STRING,"".concat(th," install --legacy-peer-deps")),pnpmInstallForce:tR(ei.STRING,"".concat(th," install --force"))};function tD(e){return E(s({plugins:[w()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tO.UNIT_TEST_SETUP_CONFIG]}},e))}h(tD,"vitestUnit");export{b as vitestE2E,tD as vitestUnit};
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(t){if(Array.isArray(t))return e(t)}function n(e,t,n,r,o,a,c){try{var i=e[a](c);var s=i.value}catch(e){n(e);return}if(i.done){t(s)}else{Promise.resolve(s).then(r,o)}}function r(e){return function(){var t=this,r=arguments;return new Promise(function(o,a){var c=e.apply(t,r);function i(e){n(c,o,a,i,s,"next",e)}function s(e){n(c,o,a,i,s,"throw",e)}i(undefined)})}}function o(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 a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(){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 i(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){o(e,t,n[t])})}return e}function s(e){return t(e)||a(e)||l(e)||c()}function u(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(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 f(e,t){var n,r,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},c=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return c.next=i(0),c["throw"]=i(1),c["return"]=i(2),typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function i(e){return function(t){return s([e,t])}}function s(i){if(n)throw new TypeError("Generator is already executing.");while(c&&(c=0,i[0]&&(a=0)),a)try{if(n=1,r&&(o=i[0]&2?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;if(r=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:a.label++;return{value:i[1],done:false};case 5:a.label++;r=i[1];i=[0];continue;case 7:i=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){a=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(i[0]===6&&a.label<o[1]){a.label=o[1];o=i;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(i);break}if(o[2])a.ops.pop();a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e];r=0}finally{n=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var p=Object.defineProperty;var d=function(e,t){return p(e,"name",{value:t,configurable:!0})};import m from"@vitejs/plugin-react-swc";import{defineConfig as g}from"vitest/config";function v(e){return g(i({plugins:[m()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}d(v,"vitestE2E");import h from"@vitejs/plugin-react-swc";import{defineConfig as y}from"vitest/config";var I=".cyberskill-storage";import b from"dotenv";import{bool as E,cleanEnv as C,str as O}from"envalid";import S from"node:os";import w from"node:path";import T from"node:process";b.config();function _(){var e={DEBUG:T.env.DEBUG||!1,CWD:T.env.CWD||T.cwd(),CYBERSKILL_STORAGE_DIRECTORY:T.env.CYBERSKILL_STORAGE_DIRECTORY||w.join(S.homedir(),I)};return C(e,{DEBUG:E(),CWD:O(),CYBERSKILL_STORAGE_DIRECTORY:O()})}d(_,"getEnv");var G=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as N}from"node:child_process";import L from"node:process";import*as R from"node:util";var k=function(e){return e.Error="error",e.Warning="warning",e}({});import D from"chalk";import j from"consola";import{GraphQLError as A}from"graphql";var M=_();M.DEBUG||(j.level=4);function P(e){var t=D[e];return typeof t=="function"?t:D.green}d(P,"chalkKeyword");var x={silent:j.silent,level:j.level,fatal:j.fatal,error:j.error,warn:j.warn,log:j.log,info:j.info,success:j.success,ready:j.ready,start:j.start,box:j.box,debug:j.debug,trace:j.trace,verbose:j.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)){j.box(D.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,a=e.message;j.log("".concat(D.gray("File:")," ").concat(D.blue("".concat(t).concat(r?":".concat(r):"")))),o&&j.log(" ".concat(P(n)("Rule:")," ").concat(o)),j.log(" ".concat(P(n)("Message:")," ").concat(a))}),j.box(P(n)("".concat(e," : ").concat(t.length))),j.log(D.gray("─".repeat(40)))}};var F={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import U from"node-fetch";import K from"fs-extra";var Y=K.readFileSync,B=K.writeFileSync,W=K.pathExistsSync,J=K.appendFileSync,H=K.copySync,$=K.removeSync,q=K.statSync,Q=K.readJsonSync,V=K.writeJsonSync;function z(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return W(e)})}d(z,"existsSync");var X=_();function Z(e){var t=eR(X.CWD,eP);if(!z(t))return!1;try{var n=Q(t),r=n.name,o=n.dependencies,a=o===void 0?{}:o,c=n.devDependencies,i=c===void 0?{}:c,s=r===e,u=e in a,l=e in i;return s||u||l?{path:t,file:n,isCurrentProject:s,isDepend:u,isDevDepend:l}:!1}catch(e){return x.warn("Failed to read package.json: ".concat(e.message)),!1}}d(Z,"getPackage");function ee(e){return et.apply(this,arguments)}function et(){et=r(function(e){var t,n,r,o;return f(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,U("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=a.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=a.sent(),r=n.version;return[2,r];case 3:o=a.sent();throw x.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})});return et.apply(this,arguments)}d(ee,"getLatestPackageVersion");function en(e,t){return er.apply(this,arguments)}function er(){er=r(function(e,t){var n,r,o,a,c,s,u,l,p,d,m,g,v,h,y,I,b,E,C,O,S;return f(this,function(f){switch(f.label){case 0:f.trys.push([0,4,,5]);n=Z(e);if(!n)return[2,i({},F)];u=n.path,l=n.file,p=n.isCurrentProject,d=n.isDepend,m=n.isDevDepend,g=(r=l.dependencies)!==null&&r!==void 0?r:{},v=(o=l.devDependencies)!==null&&o!==void 0?o:{},h=p?(a=l.version)!==null&&a!==void 0?a:"0.0.0":d?(c=g[e])!==null&&c!==void 0?c:"0.0.0":m?(s=v[e])!==null&&s!==void 0?s:"0.0.0":"0.0.0";if(!p)return[3,1];b=h;return[3,3];case 1:return[4,ee(e)];case 2:b=f.sent();f.label=3;case 3:y=b,I=p||h===y;if(!I&&(t===null||t===void 0?void 0:t.update)){;C=d?"dependencies":m?"devDependencies":null;C&&((E=l[C])===null||E===void 0?void 0:E[e])!==y&&(l[C]=(O=l[C])!==null&&O!==void 0?O:{},l[C][e]=y,V(u,l),x.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:p,installedPath:u,file:l,isUpToDate:I}];case 4:S=f.sent();return[2,(x.error('Error checking package "'.concat(e,'": ').concat(S.message)),i({},F))];case 5:return[2]}})});return er.apply(this,arguments)}d(en,"checkPackage");function eo(){return ea.apply(this,arguments)}function ea(){ea=r(function(){var e,t,n,r,o,a,c,i,s,u,l,p;return f(this,function(f){switch(f.label){case 0:e=[{command:d(function(){return tp.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:d(function(){return tp.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:d(function(){return tp.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);o=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(a=o.next()).done))return[3,8];c=a.value,i=c.command,s=c.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,i()];case 4:u=f.sent();return[4,ew("".concat(s," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();x.warn("Installation attempt failed: ".concat(s)),x.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:p=f.sent();n=true;r=p;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return ea.apply(this,arguments)}d(eo,"installDependencies");function ec(e,t){return ei.apply(this,arguments)}function ei(){ei=r(function(e,t){var n,r,o,a,c,u,l,p,d,m,g;return f(this,function(f){switch(f.label){case 0:if(!z(ts.PACKAGE_JSON)){x.error("package.json not found. Aborting setup.");return[2]}f.label=1;case 1:f.trys.push([1,13,,14]);n=s(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return en(e,i({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=f.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,eo()];case 3:r=f.sent();f.label=4;case 4:r;a=true,c=false,u=undefined;f.label=5;case 5:f.trys.push([5,10,11,12]);l=((o=t===null||t===void 0?void 0:t.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();f.label=6;case 6:if(!!(a=(p=l.next()).done))return[3,9];d=p.value;return[4,d()];case 7:f.sent();f.label=8;case 8:a=true;return[3,6];case 9:return[3,12];case 10:m=f.sent();c=true;u=m;return[3,12];case 11:try{if(!a&&l.return!=null){l.return()}}finally{if(c){throw u}}return[7];case 12:return[3,14];case 13:g=f.sent();throw x.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})});return ei.apply(this,arguments)}d(ec,"setupPackages");import es from"node-persist";var eu=_();function el(){return ef.apply(this,arguments)}function ef(){ef=r(function(){var e;return f(this,function(t){switch(t.label){case 0:e=es.defaultInstance;if(e)return[3,2];return[4,es.init({dir:eu.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return ef.apply(this,arguments)}d(el,"initNodePersist");var ep={get:function e(e){return r(function(){var t,n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,el()];case 1:r.sent();return[4,es.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(x.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,el()];case 1:r.sent();return[4,es.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();x.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var t;return f(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,el()];case 1:n.sent();return[4,es.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();x.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,t;return f(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,el()];case 1:n.sent();return[4,es.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(x.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(x.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return f(this,function(t){try{return[2,"".concat(eu.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(x.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var ed=_(),em=R.promisify(N);function eg(e){return"error_list:".concat(e)}d(eg,"getErrorListKey");function ev(e){return eh.apply(this,arguments)}function eh(){eh=r(function(e){var t,n,o;return f(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];t=Date.now(),n=eg(t);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,ep.set(n,{errors:e,timestamp:t})];case 2:a.sent(),setTimeout(/*#__PURE__*/r(function(){var e;return f(this,function(t){switch(t.label){case 0:return[4,ep.getLogLink(n)];case 1:e=t.sent();e&&x.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:o=a.sent();x.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return eh.apply(this,arguments)}d(ev,"saveErrorListToStorage");function ey(e){var t=[],n=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,s,u,l,f;var p=o.exec(e)||[],d=a.exec(e)||[],m=c.exec(e)||[];var g,v,h,y,I,b;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===k.Error?k.Error:k.Warning,message:(g=p===null||p===void 0?void 0:(i=p[4])===null||i===void 0?void 0:i.trim())!==null&&g!==void 0?g:"",rule:(v=p===null||p===void 0?void 0:(s=p[5])===null||s===void 0?void 0:s.trim())!==null&&v!==void 0?v:""}):d.length?t.push({file:(h=d===null||d===void 0?void 0:d[1])!==null&&h!==void 0?h:"",position:"".concat(d[2],":").concat(d[3]),type:d[4]===k.Error?k.Error:k.Warning,message:(y=d===null||d===void 0?void 0:(u=d[5])===null||u===void 0?void 0:u.trim())!==null&&y!==void 0?y:""}):m.length?t.push({file:"commitlint",type:k.Error,message:(I=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&I!==void 0?I:"",rule:(b=m===null||m===void 0?void 0:(f=m[2])===null||f===void 0?void 0:f.trim())!==null&&b!==void 0?b:""}):n.push(e.trim())}}),t.length&&ev(t),ed.DEBUG&&n.length&&(x.warn("Unmatched lines:"),n.forEach(function(e){return x.info(" ".concat(e))}))}d(ey,"parseTextErrors");function eI(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,o=e.line,a=e.column,c=e.ruleId,i=e.message;n.push({type:r===2?k.Error:k.Warning,file:t,position:"".concat(o,":").concat(a),rule:c,message:i})})}),n.length&&ev(n)}catch(t){ey(e)}}d(eI,"parseCommandOutput");function eb(e){return eE.apply(this,arguments)}function eE(){eE=r(function(e){var t,n,r,o,a,c,i,s,u;var l=arguments;return f(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eI;n=new AbortController;L.on("SIGINT",function(){x.warn("Process interrupted. Terminating..."),n.abort(),L.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,em(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),o=r.stdout,a=r.stderr;[o,a].forEach(function(e){return e&&t(e)});f.label=3;case 3:return[3,5];case 4:c=f.sent();i=c.stdout,s=c.stderr,u=c.message;[i,s].forEach(function(e){return e&&t(e)}),!s&&!i&&x.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})});return eE.apply(this,arguments)}d(eb,"executeCommand");function eC(e){return{raw:!0,cmd:e}}d(eC,"rawCommand");function eO(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(e9," ").concat(ej," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(e9," ").concat(e6," ").concat(eq," ").concat(e):"".concat(e9," ").concat(e$," ").concat(e)}d(eO,"formatCLI");function eS(e,t){return typeof e=="function"?eO(e(t),t):(typeof e==="undefined"?"undefined":u(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eO(e,t):e}d(eS,"formatCommand");function ew(e,t){return eT.apply(this,arguments)}function eT(){eT=r(function(e,t){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);x.start("".concat(e)),ed.DEBUG&&x.info("→ ".concat(t));return[4,eb(t)];case 1:r.sent(),x.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw x.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return eT.apply(this,arguments)}d(ew,"runCommand");import{join as e_,resolve as eG}from"node:path";var eN=_();function eL(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return eG.apply(void 0,[eN.CWD].concat(s(t)))}d(eL,"resolveWorkingPath");function eR(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return e_.apply(void 0,s(t))}d(eR,"join");var ek=_(),eD=ek.CWD,ej="@cyberskill/shared",eA="node_modules",eM="dist",eP="package.json",ex="package-lock.json",eF="tsconfig.json",eU=".gitignore",eK=".simple-git-hooks.json",eY="pnpm-lock.yaml",eB=".git/hooks/",eW=".git/COMMIT_EDITMSG",eJ=".migrate-mongo.config.js",eH=eR(eD,eA,ej,eM),e$="cyberskill",eq="src/nodejs/cli/index.ts",eQ="eslint",eV="eslint",ez="vitest",eX="playwright",eZ="vitest",e0="@commitlint/cli",e1="commitlint",e2="lint-staged",e3="lint-staged",e4="typescript",e5="tsc",e6="tsx",e7="git",e8="pnpm",e9="pnpm exec",te="simple-git-hooks",tt="simple-git-hooks",tn="@eslint/config-inspector",tr="eslint-config-inspector",to="node-modules-inspector",ta="node-modules-inspector",tc="migrate-mongo",ti="./node_modules/migrate-mongo/bin/migrate-mongo",ts={CYBERSKILL_DIRECTORY:eH,WORKING_DIRECTORY:eD,TS_CONFIG:eL(eF),GIT_IGNORE:eL(eU),GIT_HOOK:eL(eB),GIT_COMMIT_MSG:eL(eW),SIMPLE_GIT_HOOKS_JSON:eL(eK),PACKAGE_JSON:eL(eP),PACKAGE_LOCK_JSON:eL(ex),PNPM_LOCK_YAML:eL(eY),NODE_MODULES:eL(eA),MIGRATE_MONGO_CONFIG:eL(eJ),LINT_STAGED_CONFIG:eL("".concat(eH,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:eL("".concat(eH,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:eL("".concat(eH,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eL("".concat(eH,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eL("".concat(eH,"/react/vitest/vitest.e2e.js"))};function tu(e,t,n){return tl.apply(this,arguments)}function tl(){tl=r(function(e,t,n){return f(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case G.CLI:return[3,1];case G.STRING:return[3,3]}return[3,4];case 1:return[4,ec(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),eS(eC("".concat(e9," ").concat(n))))];case 3:return[2,eS(eC(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return tl.apply(this,arguments)}d(tu,"buildCommand");function tf(e,t,n){return /*#__PURE__*/r(function(){return f(this,function(r){return[2,tu(e,t,n)]})})}d(tf,"commandFactory");var tp={simpleGitHooks:tf(G.CLI,te,tt),eslintInspect:tf(G.CLI,tn,tr),nodeModulesInspect:tf(G.CLI,to,ta),eslintCheck:tf(G.CLI,eQ,"".concat(eV," ").concat(ts.WORKING_DIRECTORY)),eslintFix:tf(G.CLI,eQ,"".concat(eV," ").concat(ts.WORKING_DIRECTORY," --fix")),typescriptCheck:tf(G.CLI,e4,"".concat(e5," -p ").concat(ts.TS_CONFIG," --noEmit")),configureGitHook:tf(G.STRING,"".concat(e7," config core.hooksPath ").concat(ts.GIT_HOOK)),testUnit:tf(G.CLI,ez,"".concat(eZ," --config ").concat(ts.UNIT_TEST_CONFIG)),testE2e:tf(G.CLI,"".concat(ez," ").concat(eX),"".concat(eZ," --config ").concat(ts.E2E_TEST_CONFIG)),mongoMigrateCreate:d(function(e){return tf(G.CLI,tc,"".concat(e6," ").concat(ti," create ").concat(e," -f ").concat(ts.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:tf(G.CLI,tc,"".concat(e6," ").concat(ti," up -f ").concat(ts.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:tf(G.CLI,tc,"".concat(e6," ").concat(ti," down -f ").concat(ts.MIGRATE_MONGO_CONFIG)),mongoMigrateStatus:tf(G.CLI,tc,"".concat(e6," ").concat(ti," status -f ").concat(ts.MIGRATE_MONGO_CONFIG)),commitLint:tf(G.CLI,e0,"".concat(e1," --edit ").concat(ts.GIT_COMMIT_MSG," --config ").concat(ts.COMMITLINT_CONFIG)),lintStaged:tf(G.CLI,e2,"".concat(e3," --config ").concat(ts.LINT_STAGED_CONFIG)),stageBuildDirectory:tf(G.STRING,"".concat(e7," add ").concat(eM)),build:tf(G.STRING,"".concat(e8," run build")),pnpmInstallStandard:tf(G.STRING,"".concat(e8," install")),pnpmInstallLegacy:tf(G.STRING,"".concat(e8," install --legacy-peer-deps")),pnpmInstallForce:tf(G.STRING,"".concat(e8," install --force"))};function td(e){return y(i({plugins:[h()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[ts.UNIT_TEST_SETUP_CONFIG]}},e))}d(td,"vitestUnit");export{v as vitestE2E,td as vitestUnit};