@cyberskill/shared 1.67.0 → 1.69.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 (38) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +12 -8
  2. package/dist/_tsup-dts-rollup.d.ts +12 -8
  3. package/dist/configs/config.util.cjs +1 -1
  4. package/dist/configs/config.util.js +1 -1
  5. package/dist/configs/eslint/index.cjs +1 -1
  6. package/dist/configs/eslint/index.js +1 -1
  7. package/dist/configs/index.cjs +1 -1
  8. package/dist/configs/index.js +1 -1
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.d.cts +2 -1
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.js +1 -1
  13. package/dist/nodejs/cli/cli.util.cjs +1 -1
  14. package/dist/nodejs/cli/cli.util.js +1 -1
  15. package/dist/nodejs/cli/index.cjs +1 -1
  16. package/dist/nodejs/cli/index.js +1 -1
  17. package/dist/nodejs/index.cjs +1 -1
  18. package/dist/nodejs/index.js +1 -1
  19. package/dist/react/i18next/i18next.hook.cjs +1 -0
  20. package/dist/react/i18next/i18next.hook.d.cts +1 -0
  21. package/dist/react/i18next/i18next.hook.d.ts +1 -0
  22. package/dist/react/i18next/i18next.hook.js +1 -0
  23. package/dist/react/i18next/{i18next.cjs → i18next.util.cjs} +1 -1
  24. package/dist/react/i18next/i18next.util.d.cts +1 -0
  25. package/dist/react/i18next/i18next.util.d.ts +1 -0
  26. package/dist/react/i18next/i18next.util.js +1 -0
  27. package/dist/react/i18next/index.cjs +1 -1
  28. package/dist/react/i18next/index.d.cts +2 -1
  29. package/dist/react/i18next/index.d.ts +2 -1
  30. package/dist/react/i18next/index.js +1 -1
  31. package/dist/react/index.cjs +1 -1
  32. package/dist/react/index.d.cts +2 -1
  33. package/dist/react/index.d.ts +2 -1
  34. package/dist/react/index.js +1 -1
  35. package/package.json +1 -1
  36. package/dist/react/i18next/i18next.d.cts +0 -1
  37. package/dist/react/i18next/i18next.d.ts +0 -1
  38. package/dist/react/i18next/i18next.js +0 -1
@@ -1 +1 @@
1
- function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(r){if(Array.isArray(r))return r}function t(e){if(Array.isArray(e))return r(e)}function n(r){if(r===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return r}function o(r,e,t,n,o,a,i){try{var c=r[a](i);var s=c.value}catch(r){t(r);return}if(c.done){e(s)}else{Promise.resolve(s).then(n,o)}}function a(r){return function(){var e=this,t=arguments;return new Promise(function(n,a){var i=r.apply(e,t);function c(r){o(i,n,a,c,s,"next",r)}function s(r){o(i,n,a,c,s,"throw",r)}c(undefined)})}}function i(r,e,t){e=f(e);return w(r,P()?Reflect.construct(e,t||[],f(r).constructor):e.apply(r,t))}function c(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function s(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(r,n.key,n)}}function l(r,e,t){if(e)s(r.prototype,e);if(t)s(r,t);return r}function u(r,e,t){if(e in r){Object.defineProperty(r,e,{value:t,enumerable:true,configurable:true,writable:true})}else{r[e]=t}return r}function f(r){f=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return f(r)}function p(r,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:true,configurable:true}});if(e)I(r,e)}function m(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function v(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function d(r,e){var t=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(t==null)return;var n=[];var o=true;var a=false;var i,c;try{for(t=t.call(r);!(o=(i=t.next()).done);o=true){n.push(i.value);if(e&&n.length===e)break}}catch(r){a=true;c=r}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(a)throw c}}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(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))}n.forEach(function(e){u(r,e,t[e])})}return r}function E(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);if(e){n=n.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})}t.push.apply(t,n)}return t}function b(r,e){e=e!=null?e:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(r,Object.getOwnPropertyDescriptors(e))}else{E(Object(e)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))})}return r}function _(r,e){if(r==null)return{};var t=N(r,e);var n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(o=0;o<a.length;o++){n=a[o];if(e.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,n))continue;t[n]=r[n]}}return t}function N(r,e){if(r==null)return{};var t={};var n=Object.keys(r);var o,a;for(a=0;a<n.length;a++){o=n[a];if(e.indexOf(o)>=0)continue;t[o]=r[o]}return t}function w(r,e){if(e&&(C(e)==="object"||typeof e==="function")){return e}return n(r)}function I(r,e){I=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return I(r,e)}function O(r,t){return e(r)||d(r,t)||T(r,t)||g()}function S(r){return t(r)||v(r)||T(r)||h()}function C(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function T(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}function P(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(P=function(){return!!r})()}function D(r,e){var t,n,o,a,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(r){return function(e){return s([r,e])}}function s(a){if(t)throw new TypeError("Generator is already executing.");while(i)try{if(t=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=e.call(r,i)}catch(r){a=[6,r];n=0}finally{t=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}import{ApolloClient as A,ApolloError as L,ApolloLink as x,ApolloProvider as k,from as j,HttpLink as M,InMemoryCache as R,split as G}from"@apollo/client";import{onError as U}from"@apollo/client/link/error";import{removeTypenameFromVariables as F}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as K}from"@apollo/client/link/subscriptions";import{getMainDefinition as Y}from"@apollo/client/utilities";import{createClient as W}from"graphql-ws";import{useMemo as B}from"react";import{FaInfo as X}from"react-icons/fa6";import{use as H}from"react";import{FaRepeat as J}from"react-icons/fa6";import{createContext as Q}from"react";var V=Q(void 0);import z from"./apollo-error/apollo-error.module.scss";import{jsx as q,jsxs as Z}from"react/jsx-runtime";function $(){var r=H(V),e=r===null||r===void 0?void 0:r.error;if(!e)return null;var t=function(r,e){return(e===null||e===void 0?void 0:e.length)?Z("div",{children:[Z("strong",{children:[r,":"]}),q("ul",{children:e.map(function(r){return q("li",{children:r.message},r.message)})})]}):null};return q("div",{className:z["modal-backdrop"],children:Z("div",{className:z["modal-content"],children:[q("button",{type:"button",className:z["btn-close"],onClick:r.hideError,children:"✕"}),Z("div",{className:z["error-title"],children:[q("button",{type:"button",className:z["btn-retry"],onClick:function(){return window.location.reload()},children:q(J,{})})," ",e.message]}),Z("div",{className:z["error-details"],children:[e.networkError&&Z("pre",{className:"network",children:[q("strong",{children:"Network Error:"})," ",e.networkError.message]}),t("GraphQL Errors",S(e.graphQLErrors)),t("Protocol Errors",S(e.protocolErrors)),t("Client Errors",S(e.clientErrors)),e.extraInfo&&Z("pre",{className:"extra",children:[q("strong",{children:"Extra Info:"})," ",JSON.stringify(e.extraInfo,null,4)]})]})]})})}import{use as rr}from"react";function re(){var r=rr(V);if(!r)throw new Error("useApolloError must be used within ApolloErrorProvider");return r}import{useEffect as rt,useMemo as rn,useState as ro}from"react";import{jsx as ra}from"react/jsx-runtime";var ri=null;function rc(r){ri===null||ri===void 0?void 0:ri(r)}function rs(r){var e=r.children;var t=O(ro(null),2),n=t[0],o=t[1];rt(function(){ri=o},[]);var a=rn(function(){return{error:n,showError:o,hideError:function(){return o(null)}}},[n]);return ra(V,{value:a,children:e})}import{consola as rl}from"consola/browser";var ru={silent:rl.silent,level:rl.level,fatal:rl.fatal,error:rl.error,warn:rl.warn,log:rl.log,info:rl.info,success:rl.success,ready:rl.ready,start:rl.start,box:rl.box,debug:rl.debug,trace:rl.trace,verbose:rl.verbose};import{toast as rf,Toaster as rp}from"react-hot-toast";var rm="/graphql";import{Fragment as rv,jsx as rd,jsxs as rg}from"react/jsx-runtime";var rh=/*#__PURE__*/function(r){"use strict";p(e,r);function e(){c(this,e);var r;r=i(this,e,arguments);r.count=0;return r}l(e,[{key:"request",value:function r(r,e){var t=this;var n=Date.now();return this.count+=1,e(r).map(function(e){var o=Date.now()-n,a=r.operationName||"Unnamed";return ru.info("[Apollo] #".concat(t.count,": ").concat(a," (").concat(o,"ms)")),e})}}]);return e}(x);function ry(r){var e=r||{},t=e.uri,n=e.wsUrl,o=e.customLinks,a=new rh,i=U(function(r){var e=r.graphQLErrors,t=r.networkError,n=r.protocolErrors,o=r.operation;var a=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,t=r.locations,n=r.path;ru.error("[GraphQL error] ".concat(a,": ").concat(e,", Location: ").concat(JSON.stringify(t),", Path: ").concat(n))}),n&&n.forEach(function(r){var e=r.message,t=r.extensions;ru.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(t)))}),t&&ru.error("[Network error]: ".concat(t)),e||n||t){var i,c;var s=(e===null||e===void 0?void 0:(i=e[0])===null||i===void 0?void 0:i.message)||(n===null||n===void 0?void 0:(c=n[0])===null||c===void 0?void 0:c.message)||(t===null||t===void 0?void 0:t.message)||"Unexpected error",l=new L({graphQLErrors:e||[],protocolErrors:n||[],clientErrors:[],networkError:t||null,errorMessage:s,extraInfo:{operation:o}});rf.error(function(r){return rg(rv,{children:[s,"\xa0",rd(X,{cursor:"pointer",onClick:function(){setTimeout(function(){rc(l)},0),rf.dismiss(r.id)}})]})})}}),c=F();t||ru.warn('[Apollo] No GraphQL URI provided — using "'.concat(rm,'" as default'));var s=new M({uri:t!==null&&t!==void 0?t:rm,credentials:"include"}),l=n?new K(W({url:n})):x.empty(),u=m(l,x)?G(function(r){var e=r.query;var t=Y(e);return t.kind==="OperationDefinition"&&t.operation==="subscription"},l,s):s;return u===s&&n&&ru.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[a,i,c].concat(S(o!==null&&o!==void 0?o:[]),[u])}function rE(r){var e=r.isNextJS,t=r.options,n=r.children,o=r.client,a=r.provider,i=r.cache;var c=t||{},s=c.uri,l=c.wsUrl,u=c.customLinks,f=_(c,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:A)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var p=a||k,v=B(function(){return j(ry({uri:s,wsUrl:l,customLinks:u}))},[s,l,u]),d=B(function(){return new A(y({link:v,cache:m(i,R)?i:new R},f))},[v,i,f]),g=e?rd(p,{makeClient:function(){return d},children:n}):rd(p,{client:d,children:n});return e?rd(p,{makeClient:function(){return d},children:n}):rg(rv,{children:[rg(rs,{children:[g,rd($,{})]}),rd(rp,{position:"top-right"})]})}import rb from"i18next";import{initReactI18next as r_}from"react-i18next";function rN(r){return rb.use(r_).init(r)}import rw from"classnames";import rI from"./loading/loading.module.scss";import{jsx as rO,jsxs as rS}from"react/jsx-runtime";function rC(r){var e=r.full,t=e===void 0?!1:e,n=r.block,o=n===void 0?!1:n,a=r.className,i=a===void 0?"":a,c=r.message,s=c===void 0?"Loading":c,l=_(r,["full","block","className","message"]);function u(){return rS("div",b(y({className:rI.container},l),{children:[rO("div",{className:rI.ring}),rO("div",{className:rI.ring}),rO("div",{className:rI.ring}),rO("div",{className:rI.ring}),s&&rO("div",{className:rI.message,children:s})]}))}return t?rO("div",{className:rw(rI.fullscreen,i),children:u()}):o?rO("div",{className:rw(rI.block,i),children:u()}):u()}import{createContext as rT}from"react";var rP=rT(void 0);import{use as rD}from"react";function rA(){var r=rD(rP);if(!r)throw new Error("useLoading must be used within a LoadingProvider");return r}import{useCallback as rL,useMemo as rx,useState as rk}from"react";import{jsx as rj}from"react/jsx-runtime";function rM(r){var e=r.children;var t=O(rk(!1),2),n=t[0],o=t[1],a=O(rk(!1),2),i=a[0],c=a[1],s=rL(function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),c(r)},[]),l=rL(function(){o(!1),c(!1)},[]),u=rx(function(){return{isLoading:n,isGlobalLoading:i,showLoading:s,hideLoading:l}},[n,i,s,l]);return rj(rP,{value:u,children:n?rj(rC,{full:i}):e})}import{createContext as rR}from"react";var rG=rR(void 0);import{NextIntlClientProvider as rU}from"next-intl";import{useTranslations as rF}from"next-intl";import{use as rK}from"react";function rY(){var r=rK(rG);if(!r)throw new Error("useNextIntl must be used within a NextIntlProvider");return r}var rW=rF;import{jsx as rB}from"react/jsx-runtime";function rX(r){var e=function(e){var t;var n=rY(),o=n.currentLanguage,a=e.messages,i=e.languages,c="en",s=a[(o===null||o===void 0?void 0:o.value)||c],l=(t=i.find(function(r){return r.value===(o===null||o===void 0?void 0:o.value)}))===null||t===void 0?void 0:t.timezone;return a?rB(rU,{locale:(o===null||o===void 0?void 0:o.value)||c,messages:s,timeZone:l,children:rB(r,y({},e))}):(ru.warn("Missing messages for language: ".concat((o===null||o===void 0?void 0:o.value)||c)),null)};return e.displayName="withNextIntl(".concat(r.displayName||r.name||"Component",")"),e}import{useMemo as rH}from"react";import{useCallback as rJ,useEffect as rQ,useState as rV}from"react";var rz={serialize:function(r){return JSON.stringify(r,function(r,e){return m(e,Date)?{__type:"Date",value:e.toISOString()}:e})},deserialize:function(r){return JSON.parse(r,function(r,e){return(e===null||e===void 0?void 0:e.__type)==="Date"?new Date(e.value):e})}};import rq from"localforage";var rZ={get:function r(r){return a(function(){var e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,rq.getItem(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(ru.error('[Storage:get] Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return a(function(){var t;return D(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rq.setItem(r,e)];case 1:n.sent();return[3,3];case 2:t=n.sent();ru.error('[Storage:set] Error setting key "'.concat(r,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function r(r){return a(function(){var e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,rq.removeItem(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();ru.error('[Storage:remove] Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},keys:function r(){return a(function(){var r,e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,rq.keys()];case 1:return[2,(r=t.sent())!==null&&r!==void 0?r:[]];case 2:e=t.sent();return[2,(ru.error("[Storage:keys] Error getting keys:",e),[])];case 3:return[2]}})})()}};function r$(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rz;var n=O(rV(e),2),o=n[0],i=n[1],c=O(rV(!1),2),s=c[0],l=c[1];rQ(function(){var n=!0;return a(function(){var o,a,c,s;return D(this,function(u){switch(u.label){case 0:u.trys.push([0,6,7,8]);return[4,rZ.get(r)];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(!(e!==void 0))return[3,4];c=t.serialize(e);return[4,rZ.set(r,c)];case 3:u.sent(),i(e);return[3,5];case 4:i(void 0);u.label=5;case 5:return[3,8];case 6:s=u.sent();ru.error('Error loading value for key "'.concat(r,'":'),s),n&&i(e);return[3,8];case 7:n&&l(!0);return[7];case 8:return[2]}})})(),function(){n=!1,l(!1)}},[r,e,t]),rQ(function(){if(!s)return;a(function(){var e,n;return D(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);if(!(o!==void 0))return[3,2];e=t.serialize(o);return[4,rZ.set(r,e)];case 1:a.sent();a.label=2;case 2:return[3,4];case 3:n=a.sent();ru.error('Error saving value for key "'.concat(r,'":'),n);return[3,4];case 4:return[2]}})})()},[o,r,t,s]);var u=rJ(function(r){i(function(e){return typeof r=="function"?r(e):r})},[]),f=rJ(/*#__PURE__*/a(function(){var e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,rZ.remove(r)];case 1:t.sent(),i(void 0);return[3,3];case 2:e=t.sent();ru.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})}),[r]);return{value:o,set:u,remove:f}}import{Fragment as r0,jsx as r1}from"react/jsx-runtime";function r2(r){var e=r.children;return r1(r0,{children:e})}var r3=rX(r2);function r4(r){var e=r.children,t=r.languages,n=r.messages;var o;var a=r$("lang",(o=t===null||t===void 0?void 0:t[0])!==null&&o!==void 0?o:{}),i=a.value,c=a.set,s=rH(function(){return{languages:t,currentLanguage:i,setCurrentLanguage:c}},[t,c,i]);return r1(rG,{value:s,children:r1(r3,{languages:t,messages:n,children:e})})}import r8 from"@vitejs/plugin-react-swc";import{defineConfig as r6}from"vitest/config";function r5(r){return r6(y({plugins:[r8()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},r))}import r7 from"@vitejs/plugin-react-swc";import{defineConfig as r9}from"vitest/config";import er from"node:process";import{exec as ee}from"node:child_process";import*as et from"node:util";import en from"node:process";var eo=en.env.DEBUG==="true";import ea from"chalk";import ei from"consola";import{GraphQLError as ec}from"graphql";eo||(ei.level=4);function es(r){var e=ea[r];return typeof e=="function"?e:ea.green}var el={silent:ei.silent,level:ei.level,fatal:ei.fatal,error:ei.error,warn:ei.warn,log:ei.log,info:ei.info,success:ei.success,ready:ei.ready,start:ei.start,box:ei.box,debug:ei.debug,trace:ei.trace,verbose:ei.verbose,printBoxedLog:function r(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(e===null||e===void 0?void 0:e.length)){ei.box(ea.green(r));return}e.forEach(function(r){var e=r.file,n=r.position,o=r.rule,a=r.message;ei.log("".concat(ea.gray("File:")," ").concat(ea.blue("".concat(e).concat(n?":".concat(n):"")))),o&&ei.log(" ".concat(es(t)("Rule:")," ").concat(o)),ei.log(" ".concat(es(t)("Message:")," ").concat(a))}),ei.box(es(t)("".concat(r," : ").concat(e.length))),ei.log(ea.gray("─".repeat(40)))}};import eu from"node-fetch";import*as ef from"node:fs";function ep(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}return e.every(function(r){return ef.existsSync(r)})}import em from"node-persist";var ev=et.promisify(ee);function ed(r){return{raw:!0,cmd:r}}function eg(r,e){return(e===null||e===void 0?void 0:e.isRemote)?"".concat(ez," ").concat(eN," ").concat(r):(e===null||e===void 0?void 0:e.isCurrentProject)?"".concat(ez," ").concat(eJ," ").concat(ej," ").concat(r):"".concat(ez," ").concat(ek," ").concat(r)}function eh(r,e){return typeof r=="function"?eg(r(e),e):(typeof r==="undefined"?"undefined":C(r))=="object"&&(r===null||r===void 0?void 0:r.raw)===!0?r.cmd:typeof r=="string"?eg(r,e):r}import*as ey from"node:path";function eE(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}var n;return(n=ey).resolve.apply(n,[e_].concat(S(e)))}function eb(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}var n;return(n=ey).join.apply(n,S(e))}var e_=er.env.INIT_CWD||er.cwd(),eN="@cyberskill/shared";var ew="node_modules",eI="dist",eO="package.json",eS="package-lock.json",eC="tsconfig.json",eT=".gitignore",eP=".simple-git-hooks.json",eD="pnpm-lock.yaml",eA=".git/hooks/",eL=".git/COMMIT_EDITMSG",ex=eb(e_,ew,eN,eI),ek="cyberskill",ej="src/nodejs/cli/index.ts",eM="eslint",eR="eslint",eG="vitest",eU="playwright",eF="vitest",eK="@commitlint/cli",eY="commitlint",eW="lint-staged",eB="lint-staged",eX="typescript",eH="tsc",eJ="tsx",eQ="git",eV="pnpm",ez="pnpm exec",eq="simple-git-hooks",eZ="simple-git-hooks",e$="@eslint/config-inspector",e0="eslint-config-inspector",e1="node-modules-inspector",e2="node-modules-inspector",e3={CYBERSKILL_DIRECTORY:ex,WORKING_DIRECTORY:e_,TS_CONFIG:eE(eC),GIT_IGNORE:eE(eT),GIT_HOOK:eE(eA),GIT_COMMIT_MSG:eE(eL),SIMPLE_GIT_HOOKS_JSON:eE(eP),PACKAGE_JSON:eE(eO),PACKAGE_LOCK_JSON:eE(eS),PNPM_LOCK_YAML:eE(eD),NODE_MODULES:eE(ew),CYBERSKILL:{LINT_STAGED_CONFIG:eE("".concat(ex,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:eE("".concat(ex,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:eE("".concat(ex,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eE("".concat(ex,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eE("".concat(ex,"/react/vitest/vitest.e2e.js"))}};function e4(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++){t[n-1]=arguments[n]}var o=O(t,2),a=o[0],i=o[1],c=r==="RAW"?!0:ep.apply(void 0,S(a.split(" ").map(function(r){return eb(e3.NODE_MODULES,r)})));switch(r){case"PNPM_ADD_AND_EXEC":return eh(ed("".concat(c?"":"".concat(eV," add ").concat(a," && ")).concat(ez," ").concat(i)));case"PNPM_ADD_DEV_AND_EXEC":return eh(ed("".concat(c?"":"".concat(eV," add -D ").concat(a," && ")).concat(ez," ").concat(i)));case"RAW":return eh(ed(a))}}var e8={SIMPLE_GIT_HOOKS:e4("PNPM_ADD_DEV_AND_EXEC",eq,eZ),ESLINT_INSPECT:e4("PNPM_ADD_DEV_AND_EXEC",e$,e0),NODE_MODULES_INSPECT:e4("PNPM_ADD_DEV_AND_EXEC",e1,e2),ESLINT_CHECK:e4("PNPM_ADD_DEV_AND_EXEC",eM,"".concat(eR," ").concat(e3.WORKING_DIRECTORY)),ESLINT_FIX:e4("PNPM_ADD_DEV_AND_EXEC",eM,"".concat(eR," ").concat(e3.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:e4("PNPM_ADD_AND_EXEC",eX,"".concat(eH," -p ").concat(e3.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:e4("RAW","".concat(eQ," config core.hooksPath ").concat(e3.GIT_HOOK)),BUILD:e4("RAW","".concat(eV," run build")),STAGE_BUILD_DIRECTORY:e4("RAW","".concat(eQ," add ").concat(eI)),PNPM_INSTALL_STANDARD:e4("RAW","".concat(eV," install")),PNPM_INSTALL_LEGACY:e4("RAW","".concat(eV," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:e4("RAW","".concat(eV," install --force")),CYBERSKILL:{TEST_UNIT:e4("PNPM_ADD_AND_EXEC",eG,"".concat(eF," --config ").concat(e3.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:e4("PNPM_ADD_AND_EXEC","".concat(eG," ").concat(eU),"".concat(eF," --config ").concat(e3.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:e4("PNPM_ADD_DEV_AND_EXEC",eK,"".concat(eY," --edit ").concat(e3.GIT_COMMIT_MSG," --config ").concat(e3.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:e4("PNPM_ADD_DEV_AND_EXEC",eW,"".concat(eB," --config ").concat(e3.CYBERSKILL.LINT_STAGED_CONFIG))}};function e6(r){return r9(y({plugins:[r7()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[e3.CYBERSKILL.UNIT_TEST_SETUP_CONFIG]}},r))}export{$ as ApolloError,V as ApolloErrorContext,rs as ApolloErrorProvider,rE as ApolloProvider,rm as GRAPHQL_URI_DEFAULT,rC as Loading,rP as LoadingContext,rM as LoadingProvider,rG as NextIntlContext,r4 as NextIntlProvider,rp as Toaster,rN as initI18Next,ru as log,rc as showGlobalApolloError,rZ as storage,rf as toast,re as useApolloError,rA as useLoading,rY as useNextIntl,r$ as useStorage,rW as useTranslateNextIntl,r5 as vitestE2E,e6 as vitestUnit,rX as withNextIntl};
1
+ function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(r){if(Array.isArray(r))return r}function t(e){if(Array.isArray(e))return r(e)}function n(r){if(r===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return r}function o(r,e,t,n,o,a,i){try{var c=r[a](i);var s=c.value}catch(r){t(r);return}if(c.done){e(s)}else{Promise.resolve(s).then(n,o)}}function a(r){return function(){var e=this,t=arguments;return new Promise(function(n,a){var i=r.apply(e,t);function c(r){o(i,n,a,c,s,"next",r)}function s(r){o(i,n,a,c,s,"throw",r)}c(undefined)})}}function i(r,e,t){e=f(e);return w(r,P()?Reflect.construct(e,t||[],f(r).constructor):e.apply(r,t))}function c(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function s(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(r,n.key,n)}}function l(r,e,t){if(e)s(r.prototype,e);if(t)s(r,t);return r}function u(r,e,t){if(e in r){Object.defineProperty(r,e,{value:t,enumerable:true,configurable:true,writable:true})}else{r[e]=t}return r}function f(r){f=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return f(r)}function p(r,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:true,configurable:true}});if(e)I(r,e)}function m(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function v(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function d(r,e){var t=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(t==null)return;var n=[];var o=true;var a=false;var i,c;try{for(t=t.call(r);!(o=(i=t.next()).done);o=true){n.push(i.value);if(e&&n.length===e)break}}catch(r){a=true;c=r}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(a)throw c}}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(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))}n.forEach(function(e){u(r,e,t[e])})}return r}function E(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);if(e){n=n.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})}t.push.apply(t,n)}return t}function b(r,e){e=e!=null?e:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(r,Object.getOwnPropertyDescriptors(e))}else{E(Object(e)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))})}return r}function _(r,e){if(r==null)return{};var t=N(r,e);var n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(o=0;o<a.length;o++){n=a[o];if(e.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,n))continue;t[n]=r[n]}}return t}function N(r,e){if(r==null)return{};var t={};var n=Object.keys(r);var o,a;for(a=0;a<n.length;a++){o=n[a];if(e.indexOf(o)>=0)continue;t[o]=r[o]}return t}function w(r,e){if(e&&(C(e)==="object"||typeof e==="function")){return e}return n(r)}function I(r,e){I=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return I(r,e)}function O(r,t){return e(r)||d(r,t)||T(r,t)||g()}function S(r){return t(r)||v(r)||T(r)||h()}function C(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function T(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}function P(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(P=function(){return!!r})()}function D(r,e){var t,n,o,a,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(r){return function(e){return s([r,e])}}function s(a){if(t)throw new TypeError("Generator is already executing.");while(i)try{if(t=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=e.call(r,i)}catch(r){a=[6,r];n=0}finally{t=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}import{ApolloClient as A,ApolloError as L,ApolloLink as x,ApolloProvider as k,from as j,HttpLink as M,InMemoryCache as R,split as G}from"@apollo/client";import{onError as U}from"@apollo/client/link/error";import{removeTypenameFromVariables as F}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as K}from"@apollo/client/link/subscriptions";import{getMainDefinition as Y}from"@apollo/client/utilities";import{createClient as B}from"graphql-ws";import{useMemo as W}from"react";import{FaInfo as X}from"react-icons/fa6";import{use as H}from"react";import{FaRepeat as Q}from"react-icons/fa6";import{createContext as J}from"react";var V=J(void 0);import z from"./apollo-error/apollo-error.module.scss";import{jsx as q,jsxs as Z}from"react/jsx-runtime";function $(){var r=H(V),e=r===null||r===void 0?void 0:r.error;if(!e)return null;var t=function(r,e){return(e===null||e===void 0?void 0:e.length)?Z("div",{children:[Z("strong",{children:[r,":"]}),q("ul",{children:e.map(function(r){return q("li",{children:r.message},r.message)})})]}):null};return q("div",{className:z["modal-backdrop"],children:Z("div",{className:z["modal-content"],children:[q("button",{type:"button",className:z["btn-close"],onClick:r.hideError,children:"✕"}),Z("div",{className:z["error-title"],children:[q("button",{type:"button",className:z["btn-retry"],onClick:function(){return window.location.reload()},children:q(Q,{})})," ",e.message]}),Z("div",{className:z["error-details"],children:[e.networkError&&Z("pre",{className:"network",children:[q("strong",{children:"Network Error:"})," ",e.networkError.message]}),t("GraphQL Errors",S(e.graphQLErrors)),t("Protocol Errors",S(e.protocolErrors)),t("Client Errors",S(e.clientErrors)),e.extraInfo&&Z("pre",{className:"extra",children:[q("strong",{children:"Extra Info:"})," ",JSON.stringify(e.extraInfo,null,4)]})]})]})})}import{use as rr}from"react";function re(){var r=rr(V);if(!r)throw new Error("useApolloError must be used within ApolloErrorProvider");return r}import{useEffect as rt,useMemo as rn,useState as ro}from"react";import{jsx as ra}from"react/jsx-runtime";var ri=null;function rc(r){ri===null||ri===void 0?void 0:ri(r)}function rs(r){var e=r.children;var t=O(ro(null),2),n=t[0],o=t[1];rt(function(){ri=o},[]);var a=rn(function(){return{error:n,showError:o,hideError:function(){return o(null)}}},[n]);return ra(V,{value:a,children:e})}import{consola as rl}from"consola/browser";var ru={silent:rl.silent,level:rl.level,fatal:rl.fatal,error:rl.error,warn:rl.warn,log:rl.log,info:rl.info,success:rl.success,ready:rl.ready,start:rl.start,box:rl.box,debug:rl.debug,trace:rl.trace,verbose:rl.verbose};import{toast as rf,Toaster as rp}from"react-hot-toast";var rm="/graphql";import{Fragment as rv,jsx as rd,jsxs as rg}from"react/jsx-runtime";var rh=/*#__PURE__*/function(r){"use strict";p(e,r);function e(){c(this,e);var r;r=i(this,e,arguments);r.count=0;return r}l(e,[{key:"request",value:function r(r,e){var t=this;var n=Date.now();return this.count+=1,e(r).map(function(e){var o=Date.now()-n,a=r.operationName||"Unnamed";return ru.info("[Apollo] #".concat(t.count,": ").concat(a," (").concat(o,"ms)")),e})}}]);return e}(x);function ry(r){var e=r||{},t=e.uri,n=e.wsUrl,o=e.customLinks,a=new rh,i=U(function(r){var e=r.graphQLErrors,t=r.networkError,n=r.protocolErrors,o=r.operation;var a=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,t=r.locations,n=r.path;ru.error("[GraphQL error] ".concat(a,": ").concat(e,", Location: ").concat(JSON.stringify(t),", Path: ").concat(n))}),n&&n.forEach(function(r){var e=r.message,t=r.extensions;ru.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(t)))}),t&&ru.error("[Network error]: ".concat(t)),e||n||t){var i,c;var s=(e===null||e===void 0?void 0:(i=e[0])===null||i===void 0?void 0:i.message)||(n===null||n===void 0?void 0:(c=n[0])===null||c===void 0?void 0:c.message)||(t===null||t===void 0?void 0:t.message)||"Unexpected error",l=new L({graphQLErrors:e||[],protocolErrors:n||[],clientErrors:[],networkError:t||null,errorMessage:s,extraInfo:{operation:o}});rf.error(function(r){return rg(rv,{children:[s,"\xa0",rd(X,{cursor:"pointer",onClick:function(){setTimeout(function(){rc(l)},0),rf.dismiss(r.id)}})]})})}}),c=F();t||ru.warn('[Apollo] No GraphQL URI provided — using "'.concat(rm,'" as default'));var s=new M({uri:t!==null&&t!==void 0?t:rm,credentials:"include"}),l=n?new K(B({url:n})):x.empty(),u=m(l,x)?G(function(r){var e=r.query;var t=Y(e);return t.kind==="OperationDefinition"&&t.operation==="subscription"},l,s):s;return u===s&&n&&ru.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[a,i,c].concat(S(o!==null&&o!==void 0?o:[]),[u])}function rE(r){var e=r.isNextJS,t=r.options,n=r.children,o=r.client,a=r.provider,i=r.cache;var c=t||{},s=c.uri,l=c.wsUrl,u=c.customLinks,f=_(c,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:A)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var p=a||k,v=W(function(){return j(ry({uri:s,wsUrl:l,customLinks:u}))},[s,l,u]),d=W(function(){return new A(y({link:v,cache:m(i,R)?i:new R},f))},[v,i,f]),g=e?rd(p,{makeClient:function(){return d},children:n}):rd(p,{client:d,children:n});return e?rd(p,{makeClient:function(){return d},children:n}):rg(rv,{children:[rg(rs,{children:[g,rd($,{})]}),rd(rp,{position:"top-right"})]})}import{useTranslation as rb}from"react-i18next";var r_=rb;import rN from"i18next";import{initReactI18next as rw}from"react-i18next";function rI(r){return rN.use(rw).init(r)}import rO from"classnames";import rS from"./loading/loading.module.scss";import{jsx as rC,jsxs as rT}from"react/jsx-runtime";function rP(r){var e=r.full,t=e===void 0?!1:e,n=r.block,o=n===void 0?!1:n,a=r.className,i=a===void 0?"":a,c=r.message,s=c===void 0?"Loading":c,l=_(r,["full","block","className","message"]);function u(){return rT("div",b(y({className:rS.container},l),{children:[rC("div",{className:rS.ring}),rC("div",{className:rS.ring}),rC("div",{className:rS.ring}),rC("div",{className:rS.ring}),s&&rC("div",{className:rS.message,children:s})]}))}return t?rC("div",{className:rO(rS.fullscreen,i),children:u()}):o?rC("div",{className:rO(rS.block,i),children:u()}):u()}import{createContext as rD}from"react";var rA=rD(void 0);import{use as rL}from"react";function rx(){var r=rL(rA);if(!r)throw new Error("useLoading must be used within a LoadingProvider");return r}import{useCallback as rk,useMemo as rj,useState as rM}from"react";import{jsx as rR}from"react/jsx-runtime";function rG(r){var e=r.children;var t=O(rM(!1),2),n=t[0],o=t[1],a=O(rM(!1),2),i=a[0],c=a[1],s=rk(function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),c(r)},[]),l=rk(function(){o(!1),c(!1)},[]),u=rj(function(){return{isLoading:n,isGlobalLoading:i,showLoading:s,hideLoading:l}},[n,i,s,l]);return rR(rA,{value:u,children:n?rR(rP,{full:i}):e})}import{createContext as rU}from"react";var rF=rU(void 0);import{NextIntlClientProvider as rK}from"next-intl";import{useTranslations as rY}from"next-intl";import{use as rB}from"react";function rW(){var r=rB(rF);if(!r)throw new Error("useNextIntl must be used within a NextIntlProvider");return r}var rX=rY;import{jsx as rH}from"react/jsx-runtime";function rQ(r){var e=function(e){var t;var n=rW(),o=n.currentLanguage,a=e.messages,i=e.languages,c="en",s=a[(o===null||o===void 0?void 0:o.value)||c],l=(t=i.find(function(r){return r.value===(o===null||o===void 0?void 0:o.value)}))===null||t===void 0?void 0:t.timezone;return a?rH(rK,{locale:(o===null||o===void 0?void 0:o.value)||c,messages:s,timeZone:l,children:rH(r,y({},e))}):(ru.warn("Missing messages for language: ".concat((o===null||o===void 0?void 0:o.value)||c)),null)};return e.displayName="withNextIntl(".concat(r.displayName||r.name||"Component",")"),e}import{useMemo as rJ}from"react";import{useCallback as rV,useEffect as rz,useState as rq}from"react";var rZ={serialize:function(r){return JSON.stringify(r,function(r,e){return m(e,Date)?{__type:"Date",value:e.toISOString()}:e})},deserialize:function(r){return JSON.parse(r,function(r,e){return(e===null||e===void 0?void 0:e.__type)==="Date"?new Date(e.value):e})}};import r$ from"localforage";var r0={get:function r(r){return a(function(){var e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,r$.getItem(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(ru.error('[Storage:get] Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return a(function(){var t;return D(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,r$.setItem(r,e)];case 1:n.sent();return[3,3];case 2:t=n.sent();ru.error('[Storage:set] Error setting key "'.concat(r,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function r(r){return a(function(){var e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,r$.removeItem(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();ru.error('[Storage:remove] Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},keys:function r(){return a(function(){var r,e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,r$.keys()];case 1:return[2,(r=t.sent())!==null&&r!==void 0?r:[]];case 2:e=t.sent();return[2,(ru.error("[Storage:keys] Error getting keys:",e),[])];case 3:return[2]}})})()}};function r1(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rZ;var n=O(rq(e),2),o=n[0],i=n[1],c=O(rq(!1),2),s=c[0],l=c[1];rz(function(){var n=!0;return a(function(){var o,a,c,s;return D(this,function(u){switch(u.label){case 0:u.trys.push([0,6,7,8]);return[4,r0.get(r)];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(!(e!==void 0))return[3,4];c=t.serialize(e);return[4,r0.set(r,c)];case 3:u.sent(),i(e);return[3,5];case 4:i(void 0);u.label=5;case 5:return[3,8];case 6:s=u.sent();ru.error('Error loading value for key "'.concat(r,'":'),s),n&&i(e);return[3,8];case 7:n&&l(!0);return[7];case 8:return[2]}})})(),function(){n=!1,l(!1)}},[r,e,t]),rz(function(){if(!s)return;a(function(){var e,n;return D(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);if(!(o!==void 0))return[3,2];e=t.serialize(o);return[4,r0.set(r,e)];case 1:a.sent();a.label=2;case 2:return[3,4];case 3:n=a.sent();ru.error('Error saving value for key "'.concat(r,'":'),n);return[3,4];case 4:return[2]}})})()},[o,r,t,s]);var u=rV(function(r){i(function(e){return typeof r=="function"?r(e):r})},[]),f=rV(/*#__PURE__*/a(function(){var e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,r0.remove(r)];case 1:t.sent(),i(void 0);return[3,3];case 2:e=t.sent();ru.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})}),[r]);return{value:o,set:u,remove:f}}import{Fragment as r2,jsx as r3}from"react/jsx-runtime";function r4(r){var e=r.children;return r3(r2,{children:e})}var r8=rQ(r4);function r6(r){var e=r.children,t=r.languages,n=r.messages;var o;var a=r1("lang",(o=t===null||t===void 0?void 0:t[0])!==null&&o!==void 0?o:{}),i=a.value,c=a.set,s=rJ(function(){return{languages:t,currentLanguage:i,setCurrentLanguage:c}},[t,c,i]);return r3(rF,{value:s,children:r3(r8,{languages:t,messages:n,children:e})})}import r5 from"@vitejs/plugin-react-swc";import{defineConfig as r7}from"vitest/config";function r9(r){return r7(y({plugins:[r5()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},r))}import er from"@vitejs/plugin-react-swc";import{defineConfig as ee}from"vitest/config";import et from"node:process";import{exec as en}from"node:child_process";import*as eo from"node:util";import ea from"node:process";var ei=ea.env.DEBUG==="true";import ec from"chalk";import es from"consola";import{GraphQLError as el}from"graphql";ei||(es.level=4);function eu(r){var e=ec[r];return typeof e=="function"?e:ec.green}var ef={silent:es.silent,level:es.level,fatal:es.fatal,error:es.error,warn:es.warn,log:es.log,info:es.info,success:es.success,ready:es.ready,start:es.start,box:es.box,debug:es.debug,trace:es.trace,verbose:es.verbose,printBoxedLog:function r(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(e===null||e===void 0?void 0:e.length)){es.box(ec.green(r));return}e.forEach(function(r){var e=r.file,n=r.position,o=r.rule,a=r.message;es.log("".concat(ec.gray("File:")," ").concat(ec.blue("".concat(e).concat(n?":".concat(n):"")))),o&&es.log(" ".concat(eu(t)("Rule:")," ").concat(o)),es.log(" ".concat(eu(t)("Message:")," ").concat(a))}),es.box(eu(t)("".concat(r," : ").concat(e.length))),es.log(ec.gray("─".repeat(40)))}};import ep from"node-fetch";import*as em from"node:fs";function ev(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}return e.every(function(r){return em.existsSync(r)})}import ed from"node-persist";var eg=eo.promisify(en);function eh(r){return{raw:!0,cmd:r}}function ey(r,e){return(e===null||e===void 0?void 0:e.isRemote)?"".concat(eZ," ").concat(eI," ").concat(r):(e===null||e===void 0?void 0:e.isCurrentProject)?"".concat(eZ," ").concat(eV," ").concat(eR," ").concat(r):"".concat(eZ," ").concat(eM," ").concat(r)}function eE(r,e){return typeof r=="function"?ey(r(e),e):(typeof r==="undefined"?"undefined":C(r))=="object"&&(r===null||r===void 0?void 0:r.raw)===!0?r.cmd:typeof r=="string"?ey(r,e):r}import*as eb from"node:path";function e_(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}var n;return(n=eb).resolve.apply(n,[ew].concat(S(e)))}function eN(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}var n;return(n=eb).join.apply(n,S(e))}var ew=et.env.INIT_CWD||et.cwd(),eI="@cyberskill/shared";var eO="node_modules",eS="dist",eC="package.json",eT="package-lock.json",eP="tsconfig.json",eD=".gitignore",eA=".simple-git-hooks.json",eL="pnpm-lock.yaml",ex=".git/hooks/",ek=".git/COMMIT_EDITMSG",ej=eN(ew,eO,eI,eS),eM="cyberskill",eR="src/nodejs/cli/index.ts",eG="eslint",eU="eslint",eF="vitest",eK="playwright",eY="vitest",eB="@commitlint/cli",eW="commitlint",eX="lint-staged",eH="lint-staged",eQ="typescript",eJ="tsc",eV="tsx",ez="git",eq="pnpm",eZ="pnpm exec",e$="simple-git-hooks",e0="simple-git-hooks",e1="@eslint/config-inspector",e2="eslint-config-inspector",e3="node-modules-inspector",e4="node-modules-inspector",e8={CYBERSKILL_DIRECTORY:ej,WORKING_DIRECTORY:ew,TS_CONFIG:e_(eP),GIT_IGNORE:e_(eD),GIT_HOOK:e_(ex),GIT_COMMIT_MSG:e_(ek),SIMPLE_GIT_HOOKS_JSON:e_(eA),PACKAGE_JSON:e_(eC),PACKAGE_LOCK_JSON:e_(eT),PNPM_LOCK_YAML:e_(eL),NODE_MODULES:e_(eO),CYBERSKILL:{LINT_STAGED_CONFIG:e_("".concat(ej,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:e_("".concat(ej,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:e_("".concat(ej,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:e_("".concat(ej,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:e_("".concat(ej,"/react/vitest/vitest.e2e.js"))}};function e6(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++){t[n-1]=arguments[n]}var o=O(t,2),a=o[0],i=o[1],c=r==="RAW"?!0:ev.apply(void 0,S(a.split(" ").map(function(r){return eN(e8.NODE_MODULES,r)})));switch(r){case"PNPM_ADD_AND_EXEC":return eE(eh("".concat(c?"":"".concat(eq," add ").concat(a," && ")).concat(eZ," ").concat(i)));case"PNPM_ADD_DEV_AND_EXEC":return eE(eh("".concat(c?"":"".concat(eq," add -D ").concat(a," && ")).concat(eZ," ").concat(i)));case"RAW":return eE(eh(a))}}var e5={SIMPLE_GIT_HOOKS:e6("PNPM_ADD_DEV_AND_EXEC",e$,e0),ESLINT_INSPECT:e6("PNPM_ADD_DEV_AND_EXEC",e1,e2),NODE_MODULES_INSPECT:e6("PNPM_ADD_DEV_AND_EXEC",e3,e4),ESLINT_CHECK:e6("PNPM_ADD_DEV_AND_EXEC",eG,"".concat(eU," ").concat(e8.WORKING_DIRECTORY)),ESLINT_FIX:e6("PNPM_ADD_DEV_AND_EXEC",eG,"".concat(eU," ").concat(e8.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:e6("PNPM_ADD_AND_EXEC",eQ,"".concat(eJ," -p ").concat(e8.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:e6("RAW","".concat(ez," config core.hooksPath ").concat(e8.GIT_HOOK)),BUILD:e6("RAW","".concat(eq," run build")),STAGE_BUILD_DIRECTORY:e6("RAW","".concat(ez," add ").concat(eS)),PNPM_INSTALL_STANDARD:e6("RAW","".concat(eq," install")),PNPM_INSTALL_LEGACY:e6("RAW","".concat(eq," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:e6("RAW","".concat(eq," install --force")),CYBERSKILL:{TEST_UNIT:e6("PNPM_ADD_AND_EXEC",eF,"".concat(eY," --config ").concat(e8.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:e6("PNPM_ADD_AND_EXEC","".concat(eF," ").concat(eK),"".concat(eY," --config ").concat(e8.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:e6("PNPM_ADD_DEV_AND_EXEC",eB,"".concat(eW," --edit ").concat(e8.GIT_COMMIT_MSG," --config ").concat(e8.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:e6("PNPM_ADD_DEV_AND_EXEC",eX,"".concat(eH," --config ").concat(e8.CYBERSKILL.LINT_STAGED_CONFIG))}};function e7(r){return ee(y({plugins:[er()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[e8.CYBERSKILL.UNIT_TEST_SETUP_CONFIG]}},r))}export{$ as ApolloError,V as ApolloErrorContext,rs as ApolloErrorProvider,rE as ApolloProvider,rm as GRAPHQL_URI_DEFAULT,rP as Loading,rA as LoadingContext,rG as LoadingProvider,rF as NextIntlContext,r6 as NextIntlProvider,rp as Toaster,rI as initI18next,ru as log,rc as showGlobalApolloError,r0 as storage,rf as toast,re as useApolloError,rx as useLoading,rW as useNextIntl,r1 as useStorage,r_ as useTranslateI18next,rX as useTranslateNextIntl,r9 as vitestE2E,e7 as vitestUnit,rQ as withNextIntl};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cyberskill/shared",
3
3
  "type": "module",
4
- "version": "1.67.0",
4
+ "version": "1.69.0",
5
5
  "description": "CyberSkill Shared",
6
6
  "author": "Stephen Cheng",
7
7
  "license": "MIT",
@@ -1 +0,0 @@
1
- export { initI18Next_alias_2 as initI18Next } from '../../_tsup-dts-rollup.cjs';
@@ -1 +0,0 @@
1
- export { initI18Next_alias_2 as initI18Next } from '../../_tsup-dts-rollup.js';
@@ -1 +0,0 @@
1
- import t from"i18next";import{initReactI18next as i}from"react-i18next";function e(e){return t.use(i).init(e)}export{e as initI18Next};