@cyberskill/shared 1.55.0 → 1.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_tsup-dts-rollup.d.cts +74 -4665
- package/dist/_tsup-dts-rollup.d.ts +74 -4665
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/configs/commitlint/base.d.cts +1 -1
- package/dist/configs/commitlint/base.d.ts +1 -1
- package/dist/configs/eslint/base.cjs +1 -1
- package/dist/configs/eslint/base.d.cts +1 -1
- package/dist/configs/eslint/base.d.ts +1 -1
- package/dist/configs/eslint/base.js +1 -1
- package/dist/configs/graphql/graphql-codegen.cjs +1 -1
- package/dist/configs/graphql/graphql-codegen.js +1 -1
- package/dist/configs/graphql/index.cjs +1 -1
- package/dist/configs/graphql/index.js +1 -1
- package/dist/configs/lint-staged/base.cjs +1 -1
- package/dist/configs/lint-staged/base.d.cts +1 -1
- package/dist/configs/lint-staged/base.d.ts +1 -1
- package/dist/configs/lint-staged/base.js +1 -1
- package/dist/configs/vitest/react/e2e.d.cts +1 -1
- package/dist/configs/vitest/react/e2e.d.ts +1 -1
- package/dist/configs/vitest/react/unit.cjs +1 -1
- package/dist/configs/vitest/react/unit.d.cts +1 -1
- package/dist/configs/vitest/react/unit.d.ts +1 -1
- package/dist/configs/vitest/react/unit.js +1 -1
- package/dist/constants/common.cjs +1 -0
- package/dist/constants/common.d.cts +1 -0
- package/dist/constants/common.d.ts +1 -0
- package/dist/constants/common.js +1 -0
- package/dist/constants/index.cjs +1 -1
- package/dist/constants/index.d.cts +2 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +1 -1
- package/dist/constants/path.cjs +1 -1
- package/dist/constants/path.d.cts +1 -0
- package/dist/constants/path.d.ts +1 -0
- package/dist/constants/path.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +1 -1
- package/dist/typescript/command.cjs +1 -1
- package/dist/typescript/command.js +1 -1
- package/dist/typescript/common.d.cts +1 -0
- package/dist/typescript/common.d.ts +1 -0
- package/dist/typescript/config.cjs +1 -1
- package/dist/typescript/config.d.cts +3 -1
- package/dist/typescript/config.d.ts +3 -1
- package/dist/typescript/config.js +1 -0
- package/dist/typescript/index.cjs +1 -1
- package/dist/typescript/index.d.cts +4 -2
- package/dist/typescript/index.d.ts +4 -2
- package/dist/typescript/index.js +1 -1
- package/dist/utils/command.cjs +1 -1
- package/dist/utils/command.js +1 -1
- package/dist/utils/common.cjs +1 -1
- package/dist/utils/common.d.cts +2 -0
- package/dist/utils/common.d.ts +2 -0
- package/dist/utils/common.js +1 -1
- package/dist/utils/config.cjs +1 -1
- package/dist/utils/config.d.cts +1 -1
- package/dist/utils/config.d.ts +1 -1
- package/dist/utils/config.js +1 -1
- package/dist/utils/index-nodejs.cjs +1 -1
- package/dist/utils/index-nodejs.js +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +3 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/package.cjs +1 -1
- package/dist/utils/package.js +1 -1
- package/dist/utils/path.cjs +1 -1
- package/dist/utils/path.js +1 -1
- package/dist/utils/storage-server.cjs +1 -1
- package/dist/utils/storage-server.js +1 -1
- package/package.json +9 -34
- package/dist/configs/eslint/nestjs.cjs +0 -1
- package/dist/configs/eslint/nestjs.d.cts +0 -1
- package/dist/configs/eslint/nestjs.d.ts +0 -1
- package/dist/configs/eslint/nestjs.js +0 -1
- package/dist/configs/eslint/nextjs.cjs +0 -1
- package/dist/configs/eslint/nextjs.d.cts +0 -1
- package/dist/configs/eslint/nextjs.d.ts +0 -1
- package/dist/configs/eslint/nextjs.js +0 -1
- package/dist/configs/eslint/nodejs.cjs +0 -1
- package/dist/configs/eslint/nodejs.d.cts +0 -1
- package/dist/configs/eslint/nodejs.d.ts +0 -1
- package/dist/configs/eslint/nodejs.js +0 -1
- package/dist/configs/eslint/vite-react.cjs +0 -1
- package/dist/configs/eslint/vite-react.d.cts +0 -1
- package/dist/configs/eslint/vite-react.d.ts +0 -1
- package/dist/configs/eslint/vite-react.js +0 -1
- package/dist/configs/index.cjs +0 -1
- package/dist/configs/index.d.cts +0 -1
- package/dist/configs/index.d.ts +0 -1
- package/dist/configs/index.js +0 -1
- package/dist/typescript/fs.d.cts +0 -1
- package/dist/typescript/fs.d.ts +0 -1
- /package/dist/typescript/{fs.cjs → common.cjs} +0 -0
- /package/dist/typescript/{fs.js → common.js} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -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(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function o(e,t,r,n,o,a,s){try{var u=e[a](s);var i=u.value}catch(e){r(e);return}if(u.done){t(i)}else{Promise.resolve(i).then(n,o)}}function a(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var s=e.apply(t,r);function u(e){o(s,n,a,u,i,"next",e)}function i(e){o(s,n,a,u,i,"throw",e)}u(undefined)})}}function s(e,t,r){t=f(t);return y(e,R()?Reflect.construct(t,r||[],f(e).constructor):t.apply(e,r))}function u(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function c(e,t,r){if(t)i(e.prototype,t);if(r)i(e,r);return e}function l(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function f(e){f=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return f(e)}function E(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)A(e,t)}function d(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function v(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function g(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var o=true;var a=false;var s,u;try{for(r=r.call(e);!(o=(s=r.next()).done);o=true){n.push(s.value);if(t&&n.length===t)break}}catch(e){a=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}return n}function _(){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 S(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){l(e,t,r[t])})}return e}function O(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 p(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{O(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function m(e,t){if(e==null)return{};var r=C(e,t);var n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++){n=a[o];if(t.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;r[n]=e[n]}}return r}function C(e,t){if(e==null)return{};var r={};var n=Object.keys(e);var o,a;for(a=0;a<n.length;a++){o=n[a];if(t.indexOf(o)>=0)continue;r[o]=e[o]}return r}function y(e,t){if(t&&(T(t)==="object"||typeof t==="function")){return t}return n(e)}function A(e,t){A=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return A(e,t)}function I(e,r){return t(e)||g(e,r)||D(e,r)||_()}function N(e){return r(e)||v(e)||D(e)||h()}function T(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function D(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 R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(R=function(){return!!e})()}function P(e,t){var r,n,o,a,s={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(t){return i([e,t])}}function i(a){if(r)throw new TypeError("Generator is already executing.");while(s)try{if(r=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:s.label++;return{value:a[1],done:false};case 5:s.label++;n=a[1];a=[0];continue;case 7:a=s.ops.pop();s.trys.pop();continue;default:if(!(o=s.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){s=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(a[0]===6&&s.label<o[1]){s.label=o[1];o=a;break}if(o&&s.label<o[2]){s.label=o[2];s.ops.push(a);break}if(o[2])s.ops.pop();s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e];n=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var L=Object.create;var M=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var U=function(e,t){for(var r in t)M(e,r,{get:t[r],enumerable:!0})},j=function(e,t,r,n){var o=true,a=false,s=undefined;if(t&&(typeof t==="undefined"?"undefined":T(t))=="object"||typeof t=="function")try{var u=function(){var o=c.value;!k.call(e,o)&&o!==r&&M(e,o,{get:function(){return t[o]},enumerable:!(n=b(t,o))||n.enumerable})};for(var i=G(t)[Symbol.iterator](),c;!(o=(c=i.next()).done);o=true)u()}catch(e){a=true;s=e}finally{try{if(!o&&i.return!=null){i.return()}}finally{if(a){throw s}}}return e};var x=function(e,t,r){return r=e!=null?L(w(e)):{},j(t||!e||!e.__esModule?M(r,"default",{value:e,enumerable:!0}):r,e)},K=function(e){return j(M({},"__esModule",{value:!0}),e)};var F={};U(F,{ApolloProvider:function(){return tV},BUILD_DIRECTORY:function(){return e$},COMMAND:function(){return tm},COMMIT_LINT_CLI:function(){return tn},COMMIT_LINT_PACKAGE_NAME:function(){return tr},CYBERSKILL_CLI:function(){return e7},CYBERSKILL_DIRECTORY:function(){return e6},CYBERSKILL_PACKAGE_NAME:function(){return eW},CYBERSKILL_STORAGE:function(){return eX},C_Collection:function(){return rc},C_Db:function(){return rs},C_Document:function(){return ru},C_Model:function(){return ri},ESLINT_CLI:function(){return e9},ESLINT_INSPECT_CLI:function(){return tg},ESLINT_INSPECT_PACKAGE_NAME:function(){return tv},E_CommandType:function(){return B},E_ErrorType:function(){return H},GIT_CLI:function(){return tc},GIT_COMMIT_EDITMSG:function(){return e8},GIT_HOOK:function(){return e5},GIT_IGNORE:function(){return e1},HOOK:function(){return tO},LINT_STAGED_CLI:function(){return ta},LINT_STAGED_PACKAGE_NAME:function(){return to},Loading:function(){return tz},LoadingContext:function(){return tW},LoadingProvider:function(){return t$},MongoController:function(){return tw},MongooseController:function(){return tk},NODE_MODULES:function(){return ez},NODE_MODULES_INSPECT_CLI:function(){return th},NODE_MODULES_INSPECT_PACKAGE_NAME:function(){return t_},NextIntlContext:function(){return t6},NextIntlProvider:function(){return rn},PACKAGE_JSON:function(){return eZ},PACKAGE_LOCK_JSON:function(){return e0},PATH:function(){return tS},PNPM_CLI:function(){return tl},PNPM_EXEC_CLI:function(){return tf},PNPM_LOCK_YAML:function(){return e4},RESPONSE_STATUS:function(){return tC},SIMPLE_GIT_HOOKS_PACKAGE_NAME:function(){return tE},SIMPLE_GIT_HOOK_CLI:function(){return td},SIMPLE_GIT_HOOK_JSON:function(){return e3},TSCONFIG_JSON:function(){return e2},TSC_CLI:function(){return tu},TSC_PACKAGE_NAME:function(){return ts},TSX_CLI:function(){return ti},VITEST_CLI:function(){return tt},VITEST_PACKAGE_NAME:function(){return te},WORKING_DIRECTORY:function(){return eQ},aggregatePaginate:function(){return tI.default},appendFileSync:function(){return en},checkPackage:function(){return ep},clearAllErrorLists:function(){return eU},commandLog:function(){return eL},deepMerge:function(){return Y},executeCommand:function(){return eF},existsSync:function(){return ee},formatCommand:function(){return eH},generateShortId:function(){return tM},generateSlug:function(){return tL},getLatestPackageVersion:function(){return eS},getPackageJson:function(){return eh},getStorageDir:function(){return eE},getStoredErrorLists:function(){return ew},initNodePersist:function(){return ed},isJson:function(){return rd},join:function(){return ei},mongo:function(){return tG},mongoosePaginate:function(){return tN.default},rawCommand:function(){return eY},readFileSync:function(){return et},regexSearchMapper:function(){return r_},removeAccent:function(){return rh},resolve:function(){return eu},resolveCommands:function(){return eB},resolveWorkingPath:function(){return es},rmSync:function(){return eo},serializer:function(){return t1},storageClient:function(){return t4},storageServer:function(){return eg},throwResponse:function(){return rf},useLoading:function(){return tX},useNextIntl:function(){return t7},useStorage:function(){return t5},useTranslateNextIntl:function(){return t9},validate:function(){return tb},withNextIntl:function(){return re},writeFileSync:function(){return er}});module.exports=K(F);var q=x(require("@antfu/eslint-config"),1);function Y(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=function(e,t){var r=S({},e);return Object.keys(t).forEach(function(e){if(!Object.hasOwnProperty.call(t,e))return;var o=t[e],a=r[e];Array.isArray(o)?r[e]=N(new Set(N(Array.isArray(a)?a:[]).concat(N(o)))):(typeof o==="undefined"?"undefined":T(o))=="object"&&o!==null&&!Array.isArray(o)?r[e]=n((typeof a==="undefined"?"undefined":T(a))=="object"&&a!==null&&!Array.isArray(a)?a:{},o):r[e]=o}),r};return t.flatMap(function(e){return Array.isArray(e)?e:[e]}).reduce(function(e,t){return n(e,t)},{})}var V=x(require("process"),1);var H=function(e){return e.Error="error",e.Warning="warning",e}(H||{}),B=function(e){return e.PNPM_ADD_AND_EXEC="PNPM_ADD_AND_EXEC",e.PNPM_ADD_DEV_AND_EXEC="PNPM_ADD_DEV_AND_EXEC",e.PNPM_EXEC="PNPM_EXEC",e.RAW="RAW",e}(B||{});var J=x(require("boxen"),1),Q=x(require("chalk"),1),W=require("child_process"),X=x(require("process"),1),z=x(require("util"),1);var $=x(require("node-fetch"),1);var Z=x(require("fs"),1),ee=function(e){return Z.existsSync(e)};function et(e,t){var r=Z.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var n=JSON.parse(r);if((typeof n==="undefined"?"undefined":T(n))=="object"&&n!==null)return n;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return r}function er(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=r.isJson,o=n===void 0?!1:n,a=o&&(typeof t==="undefined"?"undefined":T(t))=="object"?JSON.stringify(t,null,4):String(t);Z.writeFileSync(e,a,"utf-8")}function en(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=r.isJson,o=n===void 0?!1:n,a=o&&(typeof t==="undefined"?"undefined":T(t))=="object"?JSON.stringify(t,null,4):String(t);Z.appendFileSync(e,a,"utf-8")}function eo(e){e.forEach(function(e){ee(e)&&Z.rmSync(e,{recursive:!0,force:!0})})}var ea=x(require("path"),1);function es(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=ea).resolve.apply(n,[eQ].concat(N(t)))}function eu(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=ea).resolve.apply(n,N(t))}function ei(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=ea).join.apply(n,N(t))}var ec=x(require("node-persist"),1),el=x(require("os"),1),ef=x(require("process"),1);function eE(){return ef.default.env.CYBERSKILL_STORAGE_DIR||ei(el.default.homedir(),eX)}function ed(){return ev.apply(this,arguments)}function ev(){ev=a(function(){var e;return P(this,function(t){switch(t.label){case 0:e=ec.default.defaultInstance;if(e)return[3,2];return[4,ec.default.init({dir:eE(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return ev.apply(this,arguments)}var eg={get:function e(e){return a(function(){var t,r;return P(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ed()];case 1:n.sent();return[4,ec.default.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 4:return[2]}})})()},set:function e(e,t){return a(function(){var r;return P(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ed()];case 1:n.sent();return[4,ec.default.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return a(function(){var t;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ed()];case 1:r.sent();return[4,ec.default.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return a(function(){var e,t;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ed()];case 1:r.sent();return[4,ec.default.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return a(function(){return P(this,function(t){try{return[2,"".concat(eE()," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var e_=24*60*60*1e3;function eh(e){var t=ei(eQ,eZ);if(ee(t))try{var r=et(t,{asJson:!0});if(r.name===e)return{path:t,file:r,isCurrentProject:!0}}catch(e){eL.warning("Failed to read local package.json: ".concat(e.message))}var n=ei(eQ,ez,e,eZ);if(ee(n))try{var o=et(n,{asJson:!0});if(o.name===e)return{path:n,file:o,isCurrentProject:!1}}catch(t){eL.warning("Failed to read node_modules package.json for ".concat(e,": ").concat(t.message))}return!1}function eS(e){return eO.apply(this,arguments)}function eO(){eO=a(function(e){var t,r,n,o,a,s,u,i,c,l;var f=arguments;return P(this,function(E){switch(E.label){case 0:t=f.length>1&&f[1]!==void 0?f[1]:!1;r="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,eg.get(r)];case 1:o=E.sent();return[4,eg.get(n)];case 2:a=E.sent(),s=o&&Date.now()-o.timestamp<e_;if(!t&&s)return[2,o.version];u={};(a===null||a===void 0?void 0:a.etag)&&(u["If-None-Match"]=a.etag),(a===null||a===void 0?void 0:a.lastModified)&&(u["If-Modified-Since"]=a.lastModified);E.label=3;case 3:E.trys.push([3,8,,9]);return[4,(0,$.default)("https://registry.npmjs.org/".concat(e,"/latest"),{headers:u})];case 4:i=E.sent();if(i.status===304&&o)return[2,o.version];if(!i.ok)throw new Error("Failed to fetch latest version: ".concat(i.statusText));return[4,i.json()];case 5:c=E.sent().version;return[4,eg.set(r,{version:c,timestamp:Date.now()})];case 6:E.sent();return[4,eg.set(n,{etag:i.headers.get("ETag")||void 0,lastModified:i.headers.get("Last-Modified")||void 0})];case 7:return[2,(E.sent(),c)];case 8:l=E.sent();if(eL.error("Error fetching latest version for ".concat(e,": ").concat(l.message)),o)return[2,(eL.warning("Falling back to cached version for ".concat(e,": ").concat(o.version)),o.version)];throw l;case 9:return[2]}})});return eO.apply(this,arguments)}function ep(e){return em.apply(this,arguments)}function em(){em=a(function(e){var t,r,n,o,a;return P(this,function(s){switch(s.label){case 0:t={isInstalled:!1,isCurrentProject:!1,installedPath:"",installedVersion:"",latestVersion:"",file:{}};s.label=1;case 1:s.trys.push([1,6,,7]);r=eh(e);n=r;if(!n)return[3,5];t.file=r.file,t.isInstalled=!0,t.installedPath=r.path,t.installedVersion=r.file.version,t.isCurrentProject=r.isCurrentProject;if(!r.isCurrentProject)return[3,2];o=r.file.version;return[3,4];case 2:return[4,eS(e,!0)];case 3:o=s.sent();s.label=4;case 4:n=t.latestVersion=o;s.label=5;case 5:return[2,(n,t)];case 6:a=s.sent();return[2,(eL.error('Error checking package "'.concat(e,'": ').concat(a.message)),t)];case 7:return[2]}})});return em.apply(this,arguments)}var eC=X.default.env.DEBUG==="true",ey=z.promisify(W.exec),eA=Q.default,eI=eA.gray,eN=eA.blue;function eT(){return eI("[".concat(new Date().toLocaleTimeString(),"]"))}function eD(e){var t=Q.default[e];return typeof t=="function"?t:Q.default.green}function eR(e,t,r,n){var o=eD(t);console.log("".concat(eT()," ").concat(o("".concat(r," ").concat(e))," ").concat(n))}function eP(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=r.color,o=n===void 0?"green":n,a=r.padding,s=a===void 0?1:a,u=r.margin,i=u===void 0?1:u,c=r.borderStyle,l=c===void 0?"round":c,f=r.titleColor,E=f===void 0?"bold":f;var d=eD(o),v=eD(E);if(typeof t=="string"){console.log((0,J.default)(v(d("".concat(e,"\n").concat(t))),{padding:s,margin:i,borderStyle:l,borderColor:o}));return}Array.isArray(t)&&t.length&&(t.forEach(function(e){var t=e.file,r=e.position,n=e.rule,o=e.message;console.log("".concat(eT()," ").concat(d("File:")," ").concat(eN("".concat(t).concat(r?":".concat(r):"")))),n&&console.log(" ".concat(d("Rule:")," ").concat(d(n))),console.log(" ".concat(d("Message:")," ").concat(d(o)))}),console.log((0,J.default)(v(d("".concat(e,": ").concat(t.length))),{padding:s,margin:i,borderStyle:l,borderColor:o})),console.log(eI("─".repeat(40))))}var eL={success:function(e){return eR("SUCCESS","green","✔",e)},error:function(e){return eR("ERROR","red","✖",e)},warning:function(e){return eR("WARNING","yellow","⚠",e)},info:function(e){return eR("INFO","blue","ℹ",e)},printBoxedLog:eP};function eM(e){return"error_list:".concat(e)}function eb(e){return eG.apply(this,arguments)}function eG(){eG=a(function(e){var t,r,n;return P(this,function(o){switch(o.label){case 0:if(e.length===0)return[2];t=Date.now(),r=eM(t);o.label=1;case 1:o.trys.push([1,3,,4]);return[4,eg.set(r,{errors:e,timestamp:t})];case 2:o.sent(),setTimeout(/*#__PURE__*/a(function(){var e;return P(this,function(t){switch(t.label){case 0:return[4,eg.getLogLink(r)];case 1:e=t.sent();e&&eL.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:n=o.sent();eL.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return eG.apply(this,arguments)}function ew(){return ek.apply(this,arguments)}function ek(){ek=a(function(){var e,t,r;return P(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eg.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=a(function(e){var t;return P(this,function(r){switch(r.label){case 0:return[4,eg.get(e)];case 1:return[2,((t=r.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,n.sent().flat()];case 3:r=n.sent();return[2,(eL.error("Failed to retrieve stored errors: ".concat(r.message)),[])];case 4:return[2]}})});return ek.apply(this,arguments)}function eU(){return ej.apply(this,arguments)}function ej(){ej=a(function(){var e,t,r;return P(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eg.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return eg.remove(e)}))];case 2:n.sent();return[3,4];case 3:r=n.sent();eL.error("Failed to clear error lists: ".concat(r.message));return[3,4];case 4:return[2]}})});return ej.apply(this,arguments)}function ex(e){var t=[],r=[],n="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,s=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var u=o.exec(e)||[],i=a.exec(e)||[],c=s.exec(e)||[];u.length&&n?t.push({file:n,position:"".concat(u[1],":").concat(u[2]),type:u[3]==="error"?"error":"warning",message:u[4].trim(),rule:u[5].trim()}):i.length?t.push({file:i[1],position:"".concat(i[2],":").concat(i[3]),type:i[4]==="error"?"error":"warning",message:i[5].trim()}):c.length?t.push({file:"commitlint",type:"error",message:c[1].trim(),rule:c[2].trim()}):r.push(e.trim())}}),t.length&&eb(t),r.length&&eC&&(eL.warning("Unmatched lines:"),r.forEach(function(e){return console.log(" ".concat(e))}))}function eK(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,o=e.line,a=e.column,s=e.ruleId,u=e.message;r.push({type:n===2?"error":"warning",file:t,position:"".concat(o,":").concat(a),rule:s,message:u})})}),r.length&&eb(r)}catch(t){ex(e)}}function eF(e){return eq.apply(this,arguments)}function eq(){eq=a(function(e){var t,r,n,o,a,s,u,i,c;var l=arguments;return P(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eK;r=new AbortController;X.default.on("SIGINT",function(){eL.warning("Process interrupted. Terminating..."),r.abort(),X.default.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,ey(e,{maxBuffer:0x6400000,signal:r.signal})];case 2:n=f.sent(),o=n.stdout,a=n.stderr;[o,a].forEach(function(e){return e&&t(e)});return[3,4];case 3:s=f.sent();u=s.stdout,i=s.stderr,c=s.message;[u,i].forEach(function(e){return e&&t(e)}),!i&&!u&&eL.error("Command failed: ".concat(c));return[3,4];case 4:return[2]}})});return eq.apply(this,arguments)}function eY(e){return{raw:!0,cmd:e}}function eV(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(tf," ").concat(eW," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(tf," ").concat(ti," src/cli.ts ").concat(e):"".concat(tf," ").concat(e7," ").concat(e)}function eH(e,t){return typeof e=="function"?eV(e(t),t):(typeof e==="undefined"?"undefined":T(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eV(e,t):e}function eB(e){return eJ.apply(this,arguments)}function eJ(){eJ=a(function(e){var t,r,n,o,a,s,u;var i=arguments;return P(this,function(c){switch(c.label){case 0:t=i.length>1&&i[1]!==void 0?i[1]:{};n=(r=t===null||t===void 0?void 0:t.isRemote)!==null&&r!==void 0?r:!1;if(!n)return[3,1];u=!1;return[3,3];case 1:return[4,ep(eW)];case 2:u=c.sent().isCurrentProject;c.label=3;case 3:o=u,a={isRemote:n,isCurrentProject:o},s=typeof e=="function"?e(a):e;return[2,Object.fromEntries(Object.entries(s).map(function(e){var t=I(e,2),r=t[0],n=t[1];return[r,eH(n,a)]}))]}})});return eJ.apply(this,arguments)}var eQ=V.default.env.INIT_CWD||V.default.cwd(),eW="@cyberskill/shared",eX=".cyberskill-storage",ez="node_modules",e$="dist",eZ="package.json",e0="package-lock.json",e2="tsconfig.json",e1=".gitignore",e3=".simple-git-hooks.json",e4="pnpm-lock.yaml",e5=".git/hooks/",e8=".git/COMMIT_EDITMSG",e6=ei(eQ,ez,eW,e$),e7="cyberskill",e9="eslint",te="vitest",tt="vitest",tr="@commitlint/cli",tn="commitlint",to="lint-staged",ta="lint-staged",ts="typescript",tu="tsc",ti="tsx",tc="git",tl="pnpm",tf="pnpm exec",tE="simple-git-hooks",td="simple-git-hooks",tv="@eslint/config-inspector",tg="eslint-config-inspector",t_="node-modules-inspector",th="node-modules-inspector",tS={CYBERSKILL_DIRECTORY:e6,WORKING_DIRECTORY:eQ,TS_CONFIG:es(e2),GIT_IGNORE:es(e1),GIT_HOOK:es(e5),GIT_COMMIT_MSG:es(e8),SIMPLE_GIT_HOOKS_JSON:es(e3),PACKAGE_JSON:es(eZ),PACKAGE_LOCK_JSON:es(e0),PNPM_LOCK_YAML:es(e4),NODE_MODULES:es(ez),CYBERSKILL:{LINT_STAGED_CONFIG:es("".concat(e6,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:es("".concat(e6,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:es("".concat(e6,"/configs/vitest/react/unit.js")),UNIT_TEST_SETUP_CONFIG:es("".concat(e6,"/configs/vitest/react/unit.setup.js")),E2E_TEST_CONFIG:es("".concat(e6,"/configs/vitest/react/e2e.js"))}};function tO(e){var t=e.isCurrentProject;return S({"pre-commit":ta,"commit-msg":tn},t&&{"pre-push":eY("".concat(tc," pull"))})}function tp(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}var o=I(r,2),a=o[0],s=o[1];switch(e){case"PNPM_ADD_AND_EXEC":return eH(eY("".concat(tl," add ").concat(a," && ").concat(tf," ").concat(s)));case"PNPM_ADD_DEV_AND_EXEC":return eH(eY("".concat(tl," add -D ").concat(a," && ").concat(tf," ").concat(s)));case"PNPM_EXEC":return eH(eY("".concat(tf," ").concat(a," ").concat(s||"").trim()));case"RAW":return eH(eY(a))}}var tm={SIMPLE_GIT_HOOKS:tp("PNPM_ADD_DEV_AND_EXEC",tE,td),ESLINT_INSPECT:tp("PNPM_ADD_DEV_AND_EXEC",tv,tg),NODE_MODULES_INSPECT:tp("PNPM_ADD_DEV_AND_EXEC",t_,th),ESLINT_CHECK:tp("PNPM_ADD_DEV_AND_EXEC",e9,tS.WORKING_DIRECTORY),ESLINT_FIX:tp("PNPM_ADD_DEV_AND_EXEC",e9,"".concat(tS.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:tp("PNPM_ADD_AND_EXEC",ts,"".concat(tu," -p ").concat(tS.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:tp("RAW","".concat(tc," config core.hooksPath ").concat(tS.GIT_HOOK)),BUILD:tp("RAW","".concat(tl," run build")),STAGE_BUILD_DIRECTORY:tp("RAW","".concat(tc," add ").concat(e$)),PNPM_INSTALL_STANDARD:tp("RAW","".concat(tl," install")),PNPM_INSTALL_LEGACY:tp("RAW","".concat(tl," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:tp("RAW","".concat(tl," install --force")),CYBERSKILL:{TEST_UNIT:tp("PNPM_ADD_DEV_AND_EXEC",te,"".concat(tt," --config ").concat(tS.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:tp("PNPM_ADD_DEV_AND_EXEC",te,"".concat(tt," --config ").concat(tS.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:tp("PNPM_ADD_DEV_AND_EXEC",tr,"".concat(tn," --edit ").concat(tS.GIT_COMMIT_MSG," --config ").concat(tS.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:tp("PNPM_ADD_DEV_AND_EXEC",to,"".concat(ta," --config ").concat(tS.CYBERSKILL.LINT_STAGED_CONFIG))}};var tC={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var ty=require("date-fns"),tA=require("mongoose"),tI=x(require("mongoose-aggregate-paginate-v2"),1),tN=x(require("mongoose-paginate-v2"),1),tT=require("uuid");var tD=x(require("crypto-js"),1),tR=x(require("slugify"),1),tP=tR.default.default||tR.default;function tL(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;var r=t||{},n=r.lower,o=n===void 0?!0:n,a=r.locale,s=a===void 0?"vi":a,u=m(r,["lower","locale"]);return tP(e,S({lower:o,locale:s},u))}function tM(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return tD.default.SHA256(e).toString(tD.default.enc.Hex).slice(0,t)}var tb={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":T(e))=="object"?d(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var tG={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return(0,ty.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"?tG.getDateTime():new Date;return{id:(0,tT.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,o=t.post;r&&n&&e.pre(r,n),r&&o&&e.post(r,o)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:tT.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,o=n===void 0?[]:n,a=e.standalone,s=a===void 0?!1:a;var u=new t.Schema(r,{strict:!0});return o.forEach(function(e){var t=e.name,r=e.options,n=e.get;var o=u.virtual(t,r);n&&o.get(n)}),s||u.add(tG.createGenericSchema(t)),u},createModel:function e(e){var t=e.mongoose,r=e.name,n=e.schema,o=e.pagination,a=o===void 0?!1:o,s=e.aggregate,u=s===void 0?!1:s,i=e.virtuals,c=i===void 0?[]:i,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 E=tG.createSchema({mongoose:t,schema:n,virtuals:c});return tG.applyPlugins(E,[a&&tN.default,u&&tI.default]),tG.applyMiddlewares(E,f),t.model(r,E)},createSlugQuery:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return p(S({},t,r&&{id:{$ne:r}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=a(function(e){return P(this,function(t){return[2,!tb.isEmpty(e)]})});return function(t){return e.apply(this,arguments)}}()},isUnique:function e(e){return /*#__PURE__*/function(){var t=a(function(t){var r;return P(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");r={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.findOne(r)];case 1:return[2,!n.sent()]}})});return function(e){return t.apply(this,arguments)}}()},matchesRegex:function e(e){return /*#__PURE__*/function(){var t=a(function(t){return P(this,function(r){if(!Array.isArray(e)||e.some(function(e){return!d(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)}}()}}},tw=/*#__PURE__*/function(){function e(t,r){u(this,e);this.collection=t.collection(r)}c(e,[{key:"createOne",value:function e(e){var t=this;return a(function(){var r,n,o;return P(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);r=S({},tG.createGenericFields(),e);n={success:!0,message:"Document created successfully"};return[4,t.collection.insertOne(r)];case 1:return[2,(n.result=a.sent(),n)];case 2:o=a.sent();return[2,{success:!1,message:o.message}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=this;return a(function(){var r,n,o;return P(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);r=e.map(function(e){return S({},tG.createGenericFields(),e)});return[4,t.collection.insertMany(r)];case 1:n=a.sent();return[2,n.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(n.insertedCount," documents created successfully"),result:n}];case 2:o=a.sent();return[2,{success:!1,message:o.message}];case 3:return[2]}})})()}},{key:"findOne",value:function e(e){var t=this;return a(function(){var r,n;return P(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t.collection.findOne(e)];case 1:r=o.sent();return[2,r?{success:!0,message:"Document found",result:r}:{success:!1,message:"Document not found"}];case 2:n=o.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return a(function(){var r,n;return P(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);r={success:!0,message:"Documents retrieved successfully"};return[4,t.collection.find(e).toArray()];case 1:return[2,(r.result=o.sent(),r)];case 2:n=o.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return a(function(){var r,n;return P(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);r={success:!0,message:"Count retrieved successfully"};return[4,t.collection.countDocuments(e)];case 1:return[2,(r.result=o.sent(),r)];case 2:n=o.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(e,t){var r=this;return a(function(){var n,o;return P(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);return[4,r.collection.updateOne(e,{$set:t})];case 1:n=a.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:n}];case 2:o=a.sent();return[2,{success:!1,message:o.message}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(e,t){var r=this;return a(function(){var n,o;return P(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);return[4,r.collection.updateMany(e,{$set:t})];case 1:n=a.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:n}];case 2:o=a.sent();return[2,{success:!1,message:o.message}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(e){var t=this;return a(function(){var r,n;return P(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t.collection.deleteOne(e)];case 1:r=o.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:r}];case 2:n=o.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(e){var t=this;return a(function(){var r,n;return P(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t.collection.deleteMany(e)];case 1:r=o.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:r}];case 2:n=o.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}}]);return e}(),tk=/*#__PURE__*/function(){function e(t){u(this,e);this.model=t}c(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;var o=this;return a(function(){var a,s,u;return P(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);a=o.model.findOne(e,t,r);n&&a.populate(n);return[4,a.exec()];case 1:s=i.sent();return[2,s?{success:!0,result:s}:{success:!1,message:"No ".concat(o.getModelName()," found."),code:tC.NOT_FOUND.CODE}];case 2:u=i.sent();return[2,{success:!1,message:u.message,code:tC.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;var o=this;return a(function(){var a,s,u;return P(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);a=o.model.find(e,t,r);n&&a.populate(n);s={success:!0};return[4,a.exec()];case 1:return[2,(s.result=i.sent(),s)];case 2:u=i.sent();return[2,{success:!1,message:u.message,code:tC.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPaging",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return a(function(){var n,o;return P(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);n={success:!0};return[4,r.model.paginate(e,t)];case 1:return[2,(n.result=a.sent(),n)];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:tC.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPagingAggregate",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return a(function(){var n,o;return P(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);n={success:!0};return[4,r.model.aggregatePaginate(r.model.aggregate(e),t)];case 1:return[2,(n.result=a.sent(),n)];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:tC.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return a(function(){var r,n;return P(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);r={success:!0};return[4,t.model.countDocuments(e)];case 1:return[2,(r.result=o.sent(),r)];case 2:n=o.sent();return[2,{success:!1,message:n.message,code:tC.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createOne",value:function e(e){var t=this;return a(function(){var r,n;return P(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);r={success:!0};return[4,t.model.create(e)];case 1:return[2,(r.result=o.sent(),r)];case 2:n=o.sent();return[2,{success:!1,message:n.message,code:tC.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return a(function(){var n,o;return P(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);n={success:!0};return[4,r.model.insertMany(e,t)];case 1:return[2,(n.result=a.sent().map(function(e){return d(e,tA.Document)?e.toObject():null}).filter(function(e){return e!==null}),n)];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:tC.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return a(function(){var o,a;return P(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,n.model.findOneAndUpdate(e,t,S({new:!0},r)).exec()];case 1:o=s.sent();return[2,o?{success:!0,result:o}:{success:!1,message:"Failed to update ".concat(n.getModelName(),"."),code:tC.NOT_FOUND.CODE}];case 2:a=s.sent();return[2,{success:!1,message:a.message,code:tC.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return a(function(){var o,a;return P(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);o={success:!0};return[4,n.model.updateMany(e,t,r).exec()];case 1:return[2,(o.result=s.sent(),o)];case 2:a=s.sent();return[2,{success:!1,message:a.message,code:tC.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return a(function(){var n,o;return P(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);return[4,r.model.findOneAndDelete(e,t).exec()];case 1:n=a.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"No ".concat(r.getModelName()," found to delete."),code:tC.NOT_FOUND.CODE}];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:tC.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return a(function(){var n,o;return P(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);return[4,r.model.deleteMany(e,t).exec()];case 1:n=a.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents found to delete.",code:tC.NOT_FOUND.CODE}:{success:!0,result:n}];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:tC.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;var r=this;return a(function(){var n,o,a,s;return P(this,function(u){switch(u.label){case 0:n=new Set;o=0;u.label=1;case 1:if(!(o<10))return[3,5];a=tM(e,o+t);s=!n.has(a);if(!s)return[3,3];n.add(a);return[4,r.model.exists({shortId:a})];case 2:s=!u.sent();u.label=3;case 3:if(s)return[2,{success:!0,result:a}];u.label=4;case 4:o++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:tC.INTERNAL_SERVER_ERROR.CODE}]}})})()}},{key:"createSlug",value:function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return a(function(){var o,s,u,i,c,l,f,E,d,v,g;return P(this,function(_){switch(_.label){case 0:_.trys.push([0,8,,9]);o=t[e],s=/*#__PURE__*/function(){var e=a(function(e){var o,a,s;return P(this,function(u){switch(u.label){case 0:return[4,n.model.findOne(tG.createSlugQuery(e,r,t.id))];case 1:o=u.sent();if(!o)return[2,e];a=1;u.label=2;case 2:s="".concat(e,"-").concat(a);return[4,n.model.findOne(tG.createSlugQuery(s,r,t.id))];case 3:o=u.sent(),a++;u.label=4;case 4:if(o)return[3,2];u.label=5;case 5:return[2,s]}})});return function t(t){return e.apply(this,arguments)}}();if(!((typeof o==="undefined"?"undefined":T(o))=="object"))return[3,5];u={};i=[];for(c in o)i.push(c);l=0;_.label=1;case 1:if(!(l<i.length))return[3,4];f=i[l];E=tL(o[f]);return[4,s(E)];case 2:u[f]=_.sent();_.label=3;case 3:l++;return[3,1];case 4:return[2,{success:!0,result:u}];case 5:d=tL(o);v={success:!0};return[4,s(d)];case 6:return[2,(v.result=_.sent(),v)];case 7:return[3,9];case 8:g=_.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(g.message),code:tC.INTERNAL_SERVER_ERROR.CODE}];case 9:return[2]}})})()}},{key:"aggregate",value:function e(e){var t=this;return a(function(){var r,n;return P(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);r={success:!0};return[4,t.model.aggregate(e)];case 1:return[2,(r.result=o.sent(),r)];case 2:n=o.sent();return[2,{success:!1,message:n.message,code:tC.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}}]);return e}();var tU=require("@apollo/client"),tj=require("@apollo/client/link/error"),tx=require("@apollo/client/link/subscriptions"),tK=require("@apollo/client/utilities"),tF=require("graphql-ws"),tq=require("react/jsx-runtime");function tY(e){var t=(0,tj.onError)(function(e){var t=e.graphQLErrors,r=e.networkError;t===null||t===void 0?void 0:t.forEach(function(e){var t=e.message,r=e.locations,n=e.path;return console.error("[GraphQL error]: Message: ".concat(t,", Location: ").concat(r,", Path: ").concat(n))}),r&&console.error("[Network error]: ".concat(r))}),r=new tU.HttpLink({uri:e===null||e===void 0?void 0:e.uri,credentials:"include"}),n=(e===null||e===void 0?void 0:e.wsUrl)?new tx.GraphQLWsLink((0,tF.createClient)({url:e.wsUrl})):null,o=n?(0,tU.split)(function(e){var t=e.query;var r=(0,tK.getMainDefinition)(t);if(r.kind==="OperationDefinition"){var n=r.operation;return n==="subscription"}return!1},n,r):r,a=new tU.ApolloLink(function(e,t){return e.variables&&(e.variables=JSON.parse(JSON.stringify(e.variables),function(e,t){return e==="__typename"?void 0:t})),t(e)});return{errorLink:t,httpLink:r,wsLink:n,splitLink:o,cleanTypeName:a}}function tV(e){var t=e.isNextJS,r=e.options,n=e.children,o=e.client,a=e.provider,s=e.cache;var u=o!==null&&o!==void 0?o:tU.ApolloClient;if(typeof u!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var i=a||tU.ApolloProvider,c=s||tU.InMemoryCache,l=tY(r),f=l.cleanTypeName,E=l.errorLink,v=l.splitLink,g=new u(S({cache:d(c,tU.InMemoryCache)?c:new tU.InMemoryCache,link:tU.ApolloLink.from([f,E,v].filter(Boolean))},r));return t?(0,tq.jsx)(i,{makeClient:function(){return g},children:n}):(0,tq.jsx)(i,{client:g,children:n})}var tH=x(require("classnames"),1),tB=require("react"),tJ=x(require("./react/loading.module.scss"),1),tQ=require("react/jsx-runtime"),tW=(0,tB.createContext)(void 0);function tX(){var e=(0,tB.use)(tW);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}function tz(e){var t=e.full,r=t===void 0?!1:t,n=e.block,o=n===void 0?!1:n,a=e.className,s=a===void 0?"":a,u=e.message,i=u===void 0?"Loading":u,c=m(e,["full","block","className","message"]);function l(){return(0,tQ.jsxs)("div",p(S({className:tJ.default.container},c),{children:[(0,tQ.jsx)("div",{className:tJ.default.ring}),(0,tQ.jsx)("div",{className:tJ.default.ring}),(0,tQ.jsx)("div",{className:tJ.default.ring}),(0,tQ.jsx)("div",{className:tJ.default.ring}),i&&(0,tQ.jsx)("div",{className:tJ.default.message,children:i})]}))}return r?(0,tQ.jsx)("div",{className:(0,tH.default)(tJ.default.fullscreen,s),children:l()}):o?(0,tQ.jsx)("div",{className:(0,tH.default)(tJ.default.block,s),children:l()}):l()}function t$(e){var t=e.children;var r=I((0,tB.useState)(!1),2),n=r[0],o=r[1],a=I((0,tB.useState)(!1),2),s=a[0],u=a[1],i=(0,tB.useCallback)(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),u(e)},[]),c=(0,tB.useCallback)(function(){o(!1),u(!1)},[]),l=(0,tB.useMemo)(function(){return{isLoading:n,isGlobalLoading:s,showLoading:i,hideLoading:c}},[n,s,i,c]);return(0,tQ.jsx)(tW,{value:l,children:n?(0,tQ.jsx)(tz,{full:s}):t})}var tZ=require("next-intl"),t0=require("react");var t2=require("react");var t1={serialize:function(e){return JSON.stringify(e,function(e,t){return d(t,Date)?{__type:"Date",value:t.toISOString()}:t})},deserialize:function(e){return JSON.parse(e,function(e,t){return(t===null||t===void 0?void 0:t.__type)==="Date"?new Date(t.value):t})}};var t3=x(require("localforage"),1),t4={get:function e(e){return a(function(){var t;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,t3.default.getItem(e)];case 1:return[2,r.sent()];case 2:t=r.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 3:return[2]}})})()},set:function e(e,t){return a(function(){var r;return P(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,t3.default.setItem(e,t)];case 1:n.sent();return[3,3];case 2:r=n.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},remove:function e(e){return a(function(){var t;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,t3.default.removeItem(e)];case 1:r.sent();return[3,3];case 2:t=r.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},keys:function e(){return a(function(){var e,t;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,t3.default.keys()];case 1:return[2,(e=r.sent())!==null&&e!==void 0?e:[]];case 2:t=r.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",t),[])];case 3:return[2]}})})()}};function t5(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t1;var n=I((0,t2.useState)(t),2),o=n[0],s=n[1],u=I((0,t2.useState)(!1),2),i=u[0],c=u[1];(0,t2.useEffect)(function(){var n=!0;return a(function(){var o,a,u,i;return P(this,function(l){switch(l.label){case 0:l.trys.push([0,6,7,8]);return[4,t4.get(e)];case 1:o=l.sent();if(!n)return[3,5];if(!(o!==null))return[3,2];a=r.deserialize(o);s(a);return[3,5];case 2:if(!(t!==void 0))return[3,4];u=r.serialize(t);return[4,t4.set(e,u)];case 3:l.sent(),s(t);return[3,5];case 4:s(void 0);l.label=5;case 5:return[3,8];case 6:i=l.sent();console.error('Error loading value for key "'.concat(e,'":'),i),n&&s(t);return[3,8];case 7:n&&c(!0);return[7];case 8:return[2]}})})(),function(){n=!1,c(!1)}},[e,t,r]),(0,t2.useEffect)(function(){if(!i)return;a(function(){var t,n;return P(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);if(!(o!==void 0))return[3,2];t=r.serialize(o);return[4,t4.set(e,t)];case 1:a.sent();a.label=2;case 2:return[3,4];case 3:n=a.sent();console.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},[o,e,r,i]);var l=(0,t2.useCallback)(function(e){s(function(t){return typeof e=="function"?e(t):e})},[]),f=(0,t2.useCallback)(/*#__PURE__*/a(function(){var t;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,t4.remove(e)];case 1:r.sent(),s(void 0);return[3,3];case 2:t=r.sent();console.error('Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})}),[e]);return{value:o,set:l,remove:f}}var t8=require("react/jsx-runtime"),t6=(0,t0.createContext)(void 0);function t7(){var e=(0,t0.use)(t6);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}var t9=tZ.useTranslations;function re(e){var t=function(t){var r;var n=t7(),o=n.currentLanguage,a=t.messages,s=t.languages,u="en",i=a[(o===null||o===void 0?void 0:o.value)||u],c=(r=s.find(function(e){return e.value===(o===null||o===void 0?void 0:o.value)}))===null||r===void 0?void 0:r.timezone;return a?(0,t8.jsx)(tZ.NextIntlClientProvider,{locale:(o===null||o===void 0?void 0:o.value)||u,messages:i,timeZone:c,children:(0,t8.jsx)(e,S({},t))}):(console.warn("Missing messages for language: ".concat((o===null||o===void 0?void 0:o.value)||u)),null)};return t.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),t}function rt(e){var t=e.children;return(0,t8.jsx)(t8.Fragment,{children:t})}var rr=re(rt);function rn(e){var t=e.children,r=e.languages,n=e.messages;var o;var a=t5("lang",(o=r===null||r===void 0?void 0:r[0])!==null&&o!==void 0?o:{}),s=a.value,u=a.set,i=(0,t0.useMemo)(function(){return{languages:r,currentLanguage:s,setCurrentLanguage:u}},[r,u,s]);return(0,t8.jsx)(t6,{value:i,children:(0,t8.jsx)(rr,{languages:r,messages:n,children:t})})}var ro=require("mongodb"),ra=require("mongoose"),rs=/*#__PURE__*/function(e){E(t,e);function t(){u(this,t);return s(this,t,arguments)}return t}(ro.Db),ru=/*#__PURE__*/function(e){E(t,e);function t(){u(this,t);return s(this,t,arguments)}return t}(ra.Document),ri=/*#__PURE__*/function(e){E(t,e);function t(){u(this,t);return s(this,t,arguments)}return t}(ra.Model),rc=/*#__PURE__*/function(e){E(t,e);function t(){u(this,t);return s(this,t,arguments)}return t}(ro.Collection);var rl=require("graphql");function rf(e){var t=e.message,r=e.status,n=r===void 0?tC.INTERNAL_SERVER_ERROR:r,o=e.type,a=o===void 0?"graphql":o;var s;var u=(s=t!==null&&t!==void 0?t:n.MESSAGE)!==null&&s!==void 0?s:"Internal server error";throw a==="graphql"?new rl.GraphQLError(u,{extensions:{code:n.CODE}}):new Error(u)}var rE=x(require("unorm"),1);function rd(e){try{return JSON.parse(e),!0}catch(e){return!1}}var rv={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},rg=Object.entries(rv).reduce(function(e,t){var r=I(t,2),n=r[0],o=r[1];return e[n.toUpperCase()]=o.map(function(e){return e.toUpperCase()}),e},{});function r_(e){e=rE.default.nfkc(e);var t=S({},rv,rg);var r=true,n=false,o=undefined;try{for(var a=Object.entries(t)[Symbol.iterator](),s;!(r=(s=a.next()).done);r=true){var u=I(s.value,2),i=u[0],c=u[1];var l="[".concat(i).concat(c.join(""),"]"),f="(".concat([i].concat(N(c)).join("|"),")");e=e.replace(new RegExp(l,"g"),f)}}catch(e){n=true;o=e}finally{try{if(!r&&a.return!=null){a.return()}}finally{if(n){throw o}}}return e}function rh(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}0&&(module.exports={ApolloProvider:ApolloProvider,BUILD_DIRECTORY:BUILD_DIRECTORY,COMMAND:COMMAND,COMMIT_LINT_CLI:COMMIT_LINT_CLI,COMMIT_LINT_PACKAGE_NAME:COMMIT_LINT_PACKAGE_NAME,CYBERSKILL_CLI:CYBERSKILL_CLI,CYBERSKILL_DIRECTORY:CYBERSKILL_DIRECTORY,CYBERSKILL_PACKAGE_NAME:CYBERSKILL_PACKAGE_NAME,CYBERSKILL_STORAGE:CYBERSKILL_STORAGE,C_Collection:C_Collection,C_Db:C_Db,C_Document:C_Document,C_Model:C_Model,ESLINT_CLI:ESLINT_CLI,ESLINT_INSPECT_CLI:ESLINT_INSPECT_CLI,ESLINT_INSPECT_PACKAGE_NAME:ESLINT_INSPECT_PACKAGE_NAME,E_CommandType:E_CommandType,E_ErrorType:E_ErrorType,GIT_CLI:GIT_CLI,GIT_COMMIT_EDITMSG:GIT_COMMIT_EDITMSG,GIT_HOOK:GIT_HOOK,GIT_IGNORE:GIT_IGNORE,HOOK:HOOK,LINT_STAGED_CLI:LINT_STAGED_CLI,LINT_STAGED_PACKAGE_NAME:LINT_STAGED_PACKAGE_NAME,Loading:Loading,LoadingContext:LoadingContext,LoadingProvider:LoadingProvider,MongoController:MongoController,MongooseController:MongooseController,NODE_MODULES:NODE_MODULES,NODE_MODULES_INSPECT_CLI:NODE_MODULES_INSPECT_CLI,NODE_MODULES_INSPECT_PACKAGE_NAME:NODE_MODULES_INSPECT_PACKAGE_NAME,NextIntlContext:NextIntlContext,NextIntlProvider:NextIntlProvider,PACKAGE_JSON:PACKAGE_JSON,PACKAGE_LOCK_JSON:PACKAGE_LOCK_JSON,PATH:PATH,PNPM_CLI:PNPM_CLI,PNPM_EXEC_CLI:PNPM_EXEC_CLI,PNPM_LOCK_YAML:PNPM_LOCK_YAML,RESPONSE_STATUS:RESPONSE_STATUS,SIMPLE_GIT_HOOKS_PACKAGE_NAME:SIMPLE_GIT_HOOKS_PACKAGE_NAME,SIMPLE_GIT_HOOK_CLI:SIMPLE_GIT_HOOK_CLI,SIMPLE_GIT_HOOK_JSON:SIMPLE_GIT_HOOK_JSON,TSCONFIG_JSON:TSCONFIG_JSON,TSC_CLI:TSC_CLI,TSC_PACKAGE_NAME:TSC_PACKAGE_NAME,TSX_CLI:TSX_CLI,VITEST_CLI:VITEST_CLI,VITEST_PACKAGE_NAME:VITEST_PACKAGE_NAME,WORKING_DIRECTORY:WORKING_DIRECTORY,aggregatePaginate:aggregatePaginate,appendFileSync:appendFileSync,checkPackage:checkPackage,clearAllErrorLists:clearAllErrorLists,commandLog:commandLog,deepMerge:deepMerge,executeCommand:executeCommand,existsSync:existsSync,formatCommand:formatCommand,generateShortId:generateShortId,generateSlug:generateSlug,getLatestPackageVersion:getLatestPackageVersion,getPackageJson:getPackageJson,getStorageDir:getStorageDir,getStoredErrorLists:getStoredErrorLists,initNodePersist:initNodePersist,isJson:isJson,join:join,mongo:mongo,mongoosePaginate:mongoosePaginate,rawCommand:rawCommand,readFileSync:readFileSync,regexSearchMapper:regexSearchMapper,removeAccent:removeAccent,resolve:resolve,resolveCommands:resolveCommands,resolveWorkingPath:resolveWorkingPath,rmSync:rmSync,serializer:serializer,storageClient:storageClient,storageServer:storageServer,throwResponse:throwResponse,useLoading:useLoading,useNextIntl:useNextIntl,useStorage:useStorage,useTranslateNextIntl:useTranslateNextIntl,validate:validate,withNextIntl:withNextIntl,writeFileSync:writeFileSync});
|
|
1
|
+
"use strict";function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(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,s){try{var u=e[a](s);var i=u.value}catch(e){t(e);return}if(u.done){r(i)}else{Promise.resolve(i).then(n,o)}}function a(e){return function(){var r=this,t=arguments;return new Promise(function(n,a){var s=e.apply(r,t);function u(e){o(s,n,a,u,i,"next",e)}function i(e){o(s,n,a,u,i,"throw",e)}u(undefined)})}}function s(e,r,t){r=f(r);return C(e,R()?Reflect.construct(r,t||[],f(e).constructor):r.apply(e,t))}function u(e,r){if(!(e instanceof r)){throw new TypeError("Cannot call a class as a function")}}function i(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 c(e,r,t){if(r)i(e.prototype,r);if(t)i(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 E(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)A(e,r)}function d(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function g(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 s,u;try{for(t=t.call(e);!(o=(s=t.next()).done);o=true){n.push(s.value);if(r&&n.length===r)break}}catch(e){a=true;u=e}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(a)throw u}}return n}function _(){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 S(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 p(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 m(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{p(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function O(e,r){if(e==null)return{};var t=y(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 y(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 C(e,r){if(r&&(T(r)==="object"||typeof r==="function")){return r}return n(e)}function A(e,r){A=Object.setPrototypeOf||function e(e,r){e.__proto__=r;return e};return A(e,r)}function I(e,t){return r(e)||v(e,t)||D(e,t)||_()}function N(e){return t(e)||g(e)||D(e)||h()}function T(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function D(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 R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(R=function(){return!!e})()}function L(e,r){var t,n,o,a,s={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(r){return i([e,r])}}function i(a){if(t)throw new TypeError("Generator is already executing.");while(s)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:s.label++;return{value:a[1],done:false};case 5:s.label++;n=a[1];a=[0];continue;case 7:a=s.ops.pop();s.trys.pop();continue;default:if(!(o=s.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){s=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(a[0]===6&&s.label<o[1]){s.label=o[1];o=a;break}if(o&&s.label<o[2]){s.label=o[2];s.ops.push(a);break}if(o[2])s.ops.pop();s.trys.pop();continue}a=r.call(e,s)}catch(e){a=[6,e];n=0}finally{t=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var P=void 0;var M=Object.create;var b=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var j=function(e,r){for(var t in r)b(e,t,{get:r[t],enumerable:!0})},x=function(e,r,t,n){var o=true,a=false,s=undefined;if(r&&(typeof r==="undefined"?"undefined":T(r))=="object"||typeof r=="function")try{var u=function(){var o=c.value;!U.call(e,o)&&o!==t&&b(e,o,{get:function(){return r[o]},enumerable:!(n=G(r,o))||n.enumerable})};for(var i=w(r)[Symbol.iterator](),c;!(o=(c=i.next()).done);o=true)u()}catch(e){a=true;s=e}finally{try{if(!o&&i.return!=null){i.return()}}finally{if(a){throw s}}}return e};var K=function(e,r,t){return t=e!=null?M(k(e)):{},x(r||!e||!e.__esModule?b(t,"default",{value:e,enumerable:!0}):t,e)},F=function(e){return x(b({},"__esModule",{value:!0}),e)};var q={};j(q,{ApolloProvider:function(){return rV},BUILD_DIRECTORY:function(){return ez},COMMAND:function(){return rO},COMMIT_LINT_CLI:function(){return rn},COMMIT_LINT_PACKAGE_NAME:function(){return rt},CYBERSKILL_CLI:function(){return e6},CYBERSKILL_DIRECTORY:function(){return e8},CYBERSKILL_PACKAGE_NAME:function(){return eQ},CYBERSKILL_STORAGE:function(){return eW},C_Collection:function(){return tl},C_Db:function(){return tu},C_Document:function(){return ti},C_Model:function(){return tc},DEBUG:function(){return Y},ESLINT_CLI:function(){return e9},ESLINT_INSPECT_CLI:function(){return rv},ESLINT_INSPECT_PACKAGE_NAME:function(){return rg},ESLINT_PACKAGE_NAME:function(){return e7},E_CommandType:function(){return B},E_ConfigType:function(){return to},E_ErrorType:function(){return H},GIT_CLI:function(){return rc},GIT_COMMIT_EDITMSG:function(){return e5},GIT_HOOK:function(){return e4},GIT_IGNORE:function(){return e2},HOOK:function(){return rp},LINT_STAGED_CLI:function(){return ra},LINT_STAGED_PACKAGE_NAME:function(){return ro},Loading:function(){return rz},LoadingContext:function(){return rW},LoadingProvider:function(){return r$},MongoController:function(){return rw},MongooseController:function(){return rk},NODE_MODULES:function(){return eX},NODE_MODULES_INSPECT_CLI:function(){return rh},NODE_MODULES_INSPECT_PACKAGE_NAME:function(){return r_},NextIntlContext:function(){return r6},NextIntlProvider:function(){return tn},PACKAGE_JSON:function(){return e$},PACKAGE_LOCK_JSON:function(){return eZ},PATH:function(){return rS},PNPM_CLI:function(){return rl},PNPM_EXEC_CLI:function(){return rf},PNPM_LOCK_YAML:function(){return e3},RESPONSE_STATUS:function(){return ry},SIMPLE_GIT_HOOKS_PACKAGE_NAME:function(){return rE},SIMPLE_GIT_HOOK_CLI:function(){return rd},SIMPLE_GIT_HOOK_JSON:function(){return e1},TSCONFIG_JSON:function(){return e0},TSC_CLI:function(){return ru},TSC_PACKAGE_NAME:function(){return rs},TSX_CLI:function(){return ri},VITEST_CLI:function(){return rr},VITEST_PACKAGE_NAME:function(){return re},WORKING_DIRECTORY:function(){return eJ},aggregatePaginate:function(){return rI.default},appendFileSync:function(){return en},checkPackage:function(){return em},clearAllErrorLists:function(){return ek},commandLog:function(){return eL},deepMerge:function(){return t_},executeCommand:function(){return eK},existsSync:function(){return ee},formatCommand:function(){return eV},generateShortId:function(){return rM},generateSlug:function(){return rP},getLatestPackageVersion:function(){return eS},getPackageJson:function(){return eh},getStorageDir:function(){return eE},getStoredErrorLists:function(){return eG},initNodePersist:function(){return ed},isJson:function(){return tg},isPlainObject:function(){return tv},join:function(){return ei},mergeConfigs:function(){return tT},mongo:function(){return rG},mongoosePaginate:function(){return rN.default},rawCommand:function(){return eq},readFileSync:function(){return er},regexSearchMapper:function(){return tp},removeAccent:function(){return tm},resolve:function(){return eu},resolveCommands:function(){return eH},resolveWorkingPath:function(){return es},rmSync:function(){return eo},serializer:function(){return r1},storageClient:function(){return r4},storageServer:function(){return ev},throwResponse:function(){return tE},useLoading:function(){return rX},useNextIntl:function(){return r7},useStorage:function(){return r5},useTranslateNextIntl:function(){return r9},validate:function(){return rb},withNextIntl:function(){return te},writeFileSync:function(){return et}});module.exports=F(q);var Y=process.env.DEBUG==="true";var V=K(require("process"),1);var H=function(e){return e.Error="error",e.Warning="warning",e}(H||{}),B=function(e){return e.PNPM_ADD_AND_EXEC="PNPM_ADD_AND_EXEC",e.PNPM_ADD_DEV_AND_EXEC="PNPM_ADD_DEV_AND_EXEC",e.RAW="RAW",e}(B||{});var J=K(require("boxen"),1),Q=K(require("chalk"),1),W=require("child_process"),X=K(require("process"),1),z=K(require("util"),1);var $=K(require("node-fetch"),1);var Z=K(require("fs"),1),ee=function(e){return Z.existsSync(e)};function er(e,r){var t=Z.readFileSync(e,"utf-8");if(r===null||r===void 0?void 0:r.asJson)try{var n=JSON.parse(t);if((typeof n==="undefined"?"undefined":T(n))=="object"&&n!==null)return n;throw new Error("Parsed JSON is not an object or array")}catch(r){throw new Error("Failed to parse JSON from file: ".concat(e))}return t}function et(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=t.isJson,o=n===void 0?!1:n,a=o&&(typeof r==="undefined"?"undefined":T(r))=="object"?JSON.stringify(r,null,4):String(r);Z.writeFileSync(e,a,"utf-8")}function en(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=t.isJson,o=n===void 0?!1:n,a=o&&(typeof r==="undefined"?"undefined":T(r))=="object"?JSON.stringify(r,null,4):String(r);Z.appendFileSync(e,a,"utf-8")}function eo(e){e.forEach(function(e){ee(e)&&Z.rmSync(e,{recursive:!0,force:!0})})}var ea=K(require("path"),1);function es(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n;return(n=ea).resolve.apply(n,[eJ].concat(N(r)))}function eu(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n;return(n=ea).resolve.apply(n,N(r))}function ei(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n;return(n=ea).join.apply(n,N(r))}var ec=K(require("node-persist"),1),el=K(require("os"),1),ef=K(require("process"),1);function eE(){return ef.default.env.CYBERSKILL_STORAGE_DIR||ei(el.default.homedir(),eW)}function ed(){return eg.apply(this,arguments)}function eg(){eg=a(function(){var e;return L(this,function(r){switch(r.label){case 0:e=ec.default.defaultInstance;if(e)return[3,2];return[4,ec.default.init({dir:eE(),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 eg.apply(this,arguments)}var ev={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,ed()];case 1:n.sent();return[4,ec.default.getItem(e)];case 2:return[2,(r=n.sent())!==null&&r!==void 0?r:null];case 3:t=n.sent();return[2,(console.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,ed()];case 1:n.sent();return[4,ec.default.setItem(e,r)];case 2:n.sent();return[3,4];case 3:t=n.sent();console.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,ed()];case 1:t.sent();return[4,ec.default.removeItem(e)];case 2:t.sent();return[3,4];case 3:r=t.sent();console.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,ed()];case 1:t.sent();return[4,ec.default.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:r=t.sent();return[2,(console.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(eE()," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var e_=24*60*60*1e3;function eh(e){var r=ei(eJ,e$);if(ee(r))try{var t=er(r,{asJson:!0});if(t.name===e)return{path:r,file:t,isCurrentProject:!0}}catch(e){eL.warning("Failed to read local package.json: ".concat(e.message))}var n=ei(eJ,eX,e,e$);if(ee(n))try{var o=er(n,{asJson:!0});if(o.name===e)return{path:n,file:o,isCurrentProject:!1}}catch(r){eL.warning("Failed to read node_modules package.json for ".concat(e,": ").concat(r.message))}return!1}function eS(e){return ep.apply(this,arguments)}function ep(){ep=a(function(e){var r,t,n,o,a,s,u,i,c,l;var f=arguments;return L(this,function(E){switch(E.label){case 0:r=f.length>1&&f[1]!==void 0?f[1]:!1;t="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,ev.get(t)];case 1:o=E.sent();return[4,ev.get(n)];case 2:a=E.sent(),s=o&&Date.now()-o.timestamp<e_;if(!r&&s)return[2,o.version];u={};(a===null||a===void 0?void 0:a.etag)&&(u["If-None-Match"]=a.etag),(a===null||a===void 0?void 0:a.lastModified)&&(u["If-Modified-Since"]=a.lastModified);E.label=3;case 3:E.trys.push([3,8,,9]);return[4,(0,$.default)("https://registry.npmjs.org/".concat(e,"/latest"),{headers:u})];case 4:i=E.sent();if(i.status===304&&o)return[2,o.version];if(!i.ok)throw new Error("Failed to fetch latest version: ".concat(i.statusText));return[4,i.json()];case 5:c=E.sent().version;return[4,ev.set(t,{version:c,timestamp:Date.now()})];case 6:E.sent();return[4,ev.set(n,{etag:i.headers.get("ETag")||void 0,lastModified:i.headers.get("Last-Modified")||void 0})];case 7:return[2,(E.sent(),c)];case 8:l=E.sent();if(eL.error("Error fetching latest version for ".concat(e,": ").concat(l.message)),o)return[2,(eL.warning("Falling back to cached version for ".concat(e,": ").concat(o.version)),o.version)];throw l;case 9:return[2]}})});return ep.apply(this,arguments)}function em(e){return eO.apply(this,arguments)}function eO(){eO=a(function(e){var r,t,n,o,a;return L(this,function(s){switch(s.label){case 0:r={isInstalled:!1,isCurrentProject:!1,installedPath:"",installedVersion:"",latestVersion:"",file:{}};s.label=1;case 1:s.trys.push([1,6,,7]);t=eh(e);n=t;if(!n)return[3,5];r.file=t.file,r.isInstalled=!0,r.installedPath=t.path,r.installedVersion=t.file.version,r.isCurrentProject=t.isCurrentProject;if(!t.isCurrentProject)return[3,2];o=t.file.version;return[3,4];case 2:return[4,eS(e,!0)];case 3:o=s.sent();s.label=4;case 4:n=r.latestVersion=o;s.label=5;case 5:return[2,(n,r)];case 6:a=s.sent();return[2,(eL.error('Error checking package "'.concat(e,'": ').concat(a.message)),r)];case 7:return[2]}})});return eO.apply(this,arguments)}var ey=z.promisify(W.exec),eC=Q.default,eA=eC.gray,eI=eC.blue;function eN(){return eA("[".concat(new Date().toLocaleTimeString(),"]"))}function eT(e){var r=Q.default[e];return typeof r=="function"?r:Q.default.green}function eD(e,r,t,n){var o=eT(r);console.log("".concat(eN()," ").concat(o("".concat(t," ").concat(e))," ").concat(n))}function eR(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=t.color,o=n===void 0?"green":n,a=t.padding,s=a===void 0?1:a,u=t.margin,i=u===void 0?1:u,c=t.borderStyle,l=c===void 0?"round":c,f=t.titleColor,E=f===void 0?"bold":f;var d=eT(o),g=eT(E);if(typeof r=="string"){console.log((0,J.default)(g(d("".concat(e,"\n").concat(r))),{padding:s,margin:i,borderStyle:l,borderColor:o}));return}Array.isArray(r)&&r.length&&(r.forEach(function(e){var r=e.file,t=e.position,n=e.rule,o=e.message;console.log("".concat(eN()," ").concat(d("File:")," ").concat(eI("".concat(r).concat(t?":".concat(t):"")))),n&&console.log(" ".concat(d("Rule:")," ").concat(d(n))),console.log(" ".concat(d("Message:")," ").concat(d(o)))}),console.log((0,J.default)(g(d("".concat(e,": ").concat(r.length))),{padding:s,margin:i,borderStyle:l,borderColor:o})),console.log(eA("─".repeat(40))))}var eL={success:function(e){return eD("SUCCESS","green","✔",e)},error:function(e){return eD("ERROR","red","✖",e)},warning:function(e){return eD("WARNING","yellow","⚠",e)},info:function(e){return eD("INFO","blue","ℹ",e)},printBoxedLog:eR};function eP(e){return"error_list:".concat(e)}function eM(e){return eb.apply(this,arguments)}function eb(){eb=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=eP(r);o.label=1;case 1:o.trys.push([1,3,,4]);return[4,ev.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,ev.getLogLink(t)];case 1:e=r.sent();e&&eL.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:n=o.sent();eL.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return eb.apply(this,arguments)}function eG(){return ew.apply(this,arguments)}function ew(){ew=a(function(){var e,r,t;return L(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev.keys()];case 1:e=n.sent(),r=Array.isArray(e)?e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}):[];return[4,Promise.all(r.map(/*#__PURE__*/function(){var e=a(function(e){var r;return L(this,function(t){switch(t.label){case 0:return[4,ev.get(e)];case 1:return[2,((r=t.sent())===null||r===void 0?void 0:r.errors)||[]]}})});return function(r){return e.apply(this,arguments)}}()))];case 2:return[2,n.sent().flat()];case 3:t=n.sent();return[2,(eL.error("Failed to retrieve stored errors: ".concat(t.message)),[])];case 4:return[2]}})});return ew.apply(this,arguments)}function ek(){return eU.apply(this,arguments)}function eU(){eU=a(function(){var e,r,t;return L(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev.keys()];case 1:e=n.sent(),r=Array.isArray(e)?e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}):[];return[4,Promise.all(r.map(function(e){return ev.remove(e)}))];case 2:n.sent();return[3,4];case 3:t=n.sent();eL.error("Failed to clear error lists: ".concat(t.message));return[3,4];case 4:return[2]}})});return eU.apply(this,arguments)}function ej(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.+)$/,s=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var u=o.exec(e)||[],i=a.exec(e)||[],c=s.exec(e)||[];u.length&&n?r.push({file:n,position:"".concat(u[1],":").concat(u[2]),type:u[3]==="error"?"error":"warning",message:u[4].trim(),rule:u[5].trim()}):i.length?r.push({file:i[1],position:"".concat(i[2],":").concat(i[3]),type:i[4]==="error"?"error":"warning",message:i[5].trim()}):c.length?r.push({file:"commitlint",type:"error",message:c[1].trim(),rule:c[2].trim()}):t.push(e.trim())}}),r.length&&eM(r),t.length&&Y&&(eL.warning("Unmatched lines:"),t.forEach(function(e){return console.log(" ".concat(e))}))}function ex(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,s=e.ruleId,u=e.message;t.push({type:n===2?"error":"warning",file:r,position:"".concat(o,":").concat(a),rule:s,message:u})})}),t.length&&eM(t)}catch(r){ej(e)}}function eK(e){return eF.apply(this,arguments)}function eF(){eF=a(function(e){var r,t,n,o,a,s,u,i,c;var l=arguments;return L(this,function(f){switch(f.label){case 0:r=l.length>1&&l[1]!==void 0?l[1]:ex;t=new AbortController;X.default.on("SIGINT",function(){eL.warning("Process interrupted. Terminating..."),t.abort(),X.default.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,ey(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)});return[3,4];case 3:s=f.sent();u=s.stdout,i=s.stderr,c=s.message;[u,i].forEach(function(e){return e&&r(e)}),!i&&!u&&eL.error("Command failed: ".concat(c));return[3,4];case 4:return[2]}})});return eF.apply(this,arguments)}function eq(e){return{raw:!0,cmd:e}}function eY(e,r){return(r===null||r===void 0?void 0:r.isRemote)?"".concat(rf," ").concat(eQ," ").concat(e):(r===null||r===void 0?void 0:r.isCurrentProject)?"".concat(rf," ").concat(ri," src/cli.ts ").concat(e):"".concat(rf," ").concat(e6," ").concat(e)}function eV(e,r){return typeof e=="function"?eY(e(r),r):(typeof e==="undefined"?"undefined":T(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eY(e,r):e}function eH(e){return eB.apply(this,arguments)}function eB(){eB=a(function(e){var r,t,n,o,a,s,u;var i=arguments;return L(this,function(c){switch(c.label){case 0:r=i.length>1&&i[1]!==void 0?i[1]:{};n=(t=r===null||r===void 0?void 0:r.isRemote)!==null&&t!==void 0?t:!1;if(!n)return[3,1];u=!1;return[3,3];case 1:return[4,em(eQ)];case 2:u=c.sent().isCurrentProject;c.label=3;case 3:o=u,a={isRemote:n,isCurrentProject:o},s=typeof e=="function"?e(a):e;return[2,Object.fromEntries(Object.entries(s).map(function(e){var r=I(e,2),t=r[0],n=r[1];return[t,eV(n,a)]}))]}})});return eB.apply(this,arguments)}var eJ=V.default.env.INIT_CWD||V.default.cwd(),eQ="@cyberskill/shared",eW=".cyberskill-storage",eX="node_modules",ez="dist",e$="package.json",eZ="package-lock.json",e0="tsconfig.json",e2=".gitignore",e1=".simple-git-hooks.json",e3="pnpm-lock.yaml",e4=".git/hooks/",e5=".git/COMMIT_EDITMSG",e8=ei(eJ,eX,eQ,ez),e6="cyberskill",e7="eslint",e9="eslint",re="vitest",rr="vitest",rt="@commitlint/cli",rn="commitlint",ro="lint-staged",ra="lint-staged",rs="typescript",ru="tsc",ri="tsx",rc="git",rl="pnpm",rf="pnpm exec",rE="simple-git-hooks",rd="simple-git-hooks",rg="@eslint/config-inspector",rv="eslint-config-inspector",r_="node-modules-inspector",rh="node-modules-inspector",rS={CYBERSKILL_DIRECTORY:e8,WORKING_DIRECTORY:eJ,TS_CONFIG:es(e0),GIT_IGNORE:es(e2),GIT_HOOK:es(e4),GIT_COMMIT_MSG:es(e5),SIMPLE_GIT_HOOKS_JSON:es(e1),PACKAGE_JSON:es(e$),PACKAGE_LOCK_JSON:es(eZ),PNPM_LOCK_YAML:es(e3),NODE_MODULES:es(eX),CYBERSKILL:{LINT_STAGED_CONFIG:es("".concat(e8,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:es("".concat(e8,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:es("".concat(e8,"/configs/vitest/react/unit.js")),UNIT_TEST_SETUP_CONFIG:es("".concat(e8,"/configs/vitest/react/unit.setup.js")),E2E_TEST_CONFIG:es("".concat(e8,"/configs/vitest/react/e2e.js"))}};function rp(e){var r=e.isCurrentProject;return S({"pre-commit":ra,"commit-msg":rn},r&&{"pre-push":eq("".concat(rc," pull"))})}function rm(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++){t[n-1]=arguments[n]}var o=I(t,2),a=o[0],s=o[1];switch(e){case"PNPM_ADD_AND_EXEC":return eV(eq("".concat(rl," add ").concat(a," && ").concat(rf," ").concat(s)));case"PNPM_ADD_DEV_AND_EXEC":return eV(eq("".concat(rl," add -D ").concat(a," && ").concat(rf," ").concat(s)));case"RAW":return eV(eq(a))}}var rO={SIMPLE_GIT_HOOKS:rm("PNPM_ADD_DEV_AND_EXEC",rE,rd),ESLINT_INSPECT:rm("PNPM_ADD_DEV_AND_EXEC",rg,rv),NODE_MODULES_INSPECT:rm("PNPM_ADD_DEV_AND_EXEC",r_,rh),ESLINT_CHECK:rm("PNPM_ADD_DEV_AND_EXEC",e7,"".concat(e9," ").concat(rS.WORKING_DIRECTORY)),ESLINT_FIX:rm("PNPM_ADD_DEV_AND_EXEC",e7,"".concat(e9," ").concat(rS.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:rm("PNPM_ADD_AND_EXEC",rs,"".concat(ru," -p ").concat(rS.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:rm("RAW","".concat(rc," config core.hooksPath ").concat(rS.GIT_HOOK)),BUILD:rm("RAW","".concat(rl," run build")),STAGE_BUILD_DIRECTORY:rm("RAW","".concat(rc," add ").concat(ez)),PNPM_INSTALL_STANDARD:rm("RAW","".concat(rl," install")),PNPM_INSTALL_LEGACY:rm("RAW","".concat(rl," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:rm("RAW","".concat(rl," install --force")),CYBERSKILL:{TEST_UNIT:rm("PNPM_ADD_DEV_AND_EXEC",re,"".concat(rr," --config ").concat(rS.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:rm("PNPM_ADD_DEV_AND_EXEC",re,"".concat(rr," --config ").concat(rS.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:rm("PNPM_ADD_DEV_AND_EXEC",rt,"".concat(rn," --edit ").concat(rS.GIT_COMMIT_MSG," --config ").concat(rS.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:rm("PNPM_ADD_DEV_AND_EXEC",ro,"".concat(ra," --config ").concat(rS.CYBERSKILL.LINT_STAGED_CONFIG))}};var ry={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var rC=require("date-fns"),rA=require("mongoose"),rI=K(require("mongoose-aggregate-paginate-v2"),1),rN=K(require("mongoose-paginate-v2"),1),rT=require("uuid");var rD=K(require("crypto-js"),1),rR=K(require("slugify"),1),rL=rR.default.default||rR.default;function rP(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;var t=r||{},n=t.lower,o=n===void 0?!0:n,a=t.locale,s=a===void 0?"vi":a,u=O(t,["lower","locale"]);return rL(e,S({lower:o,locale:s},u))}function rM(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return rD.default.SHA256(e).toString(rD.default.enc.Hex).slice(0,r)}var rb={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":T(e))=="object"?d(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var rG={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return(0,rC.format)(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"?rG.getDateTime():new Date;return{id:(0,rT.v4)(),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:rT.v4,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,s=a===void 0?!1:a;var u=new r.Schema(t,{strict:!0});return o.forEach(function(e){var r=e.name,t=e.options,n=e.get;var o=u.virtual(r,t);n&&o.get(n)}),s||u.add(rG.createGenericSchema(r)),u},createModel:function e(e){var r=e.mongoose,t=e.name,n=e.schema,o=e.pagination,a=o===void 0?!1:o,s=e.aggregate,u=s===void 0?!1:s,i=e.virtuals,c=i===void 0?[]:i,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 E=rG.createSchema({mongoose:r,schema:n,virtuals:c});return rG.applyPlugins(E,[a&&rN.default,u&&rI.default]),rG.applyMiddlewares(E,f),r.model(t,E)},createSlugQuery:function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;return m(S({},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,!rb.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!d(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)}}()}}},rw=/*#__PURE__*/function(){function e(r,t){u(this,e);this.collection=r.collection(t)}c(e,[{key:"createOne",value:function e(e){var r=this;return a(function(){var t,n,o;return L(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);t=S({},rG.createGenericFields(),e);n={success:!0,message:"Document created successfully"};return[4,r.collection.insertOne(t)];case 1:return[2,(n.result=a.sent(),n)];case 2:o=a.sent();return[2,{success:!1,message:o.message}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var r=this;return a(function(){var t,n,o;return L(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);t=e.map(function(e){return S({},rG.createGenericFields(),e)});return[4,r.collection.insertMany(t)];case 1:n=a.sent();return[2,n.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(n.insertedCount," documents created successfully"),result:n}];case 2:o=a.sent();return[2,{success:!1,message:o.message}];case 3:return[2]}})})()}},{key:"findOne",value:function e(e){var r=this;return a(function(){var t,n;return L(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,r.collection.findOne(e)];case 1:t=o.sent();return[2,t?{success:!0,message:"Document found",result:t}:{success:!1,message:"Document not found"}];case 2:n=o.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var r=this;return a(function(){var t,n;return L(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);t={success:!0,message:"Documents retrieved successfully"};return[4,r.collection.find(e).toArray()];case 1:return[2,(t.result=o.sent(),t)];case 2:n=o.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var r=this;return a(function(){var t,n;return L(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);t={success:!0,message:"Count retrieved successfully"};return[4,r.collection.countDocuments(e)];case 1:return[2,(t.result=o.sent(),t)];case 2:n=o.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(e,r){var t=this;return a(function(){var n,o;return L(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);return[4,t.collection.updateOne(e,{$set:r})];case 1:n=a.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:n}];case 2:o=a.sent();return[2,{success:!1,message:o.message}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(e,r){var t=this;return a(function(){var n,o;return L(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);return[4,t.collection.updateMany(e,{$set:r})];case 1:n=a.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:n}];case 2:o=a.sent();return[2,{success:!1,message:o.message}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(e){var r=this;return a(function(){var t,n;return L(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,r.collection.deleteOne(e)];case 1:t=o.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:t}];case 2:n=o.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(e){var r=this;return a(function(){var t,n;return L(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,r.collection.deleteMany(e)];case 1:t=o.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:t}];case 2:n=o.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}}]);return e}(),rk=/*#__PURE__*/function(){function e(r){u(this,e);this.model=r}c(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;var o=this;return a(function(){var a,s,u;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);a=o.model.findOne(e,r,t);n&&a.populate(n);return[4,a.exec()];case 1:s=i.sent();return[2,s?{success:!0,result:s}:{success:!1,message:"No ".concat(o.getModelName()," found."),code:ry.NOT_FOUND.CODE}];case 2:u=i.sent();return[2,{success:!1,message:u.message,code:ry.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;var o=this;return a(function(){var a,s,u;return L(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);a=o.model.find(e,r,t);n&&a.populate(n);s={success:!0};return[4,a.exec()];case 1:return[2,(s.result=i.sent(),s)];case 2:u=i.sent();return[2,{success:!1,message:u.message,code:ry.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPaging",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return a(function(){var n,o;return L(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);n={success:!0};return[4,t.model.paginate(e,r)];case 1:return[2,(n.result=a.sent(),n)];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:ry.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPagingAggregate",value:function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return a(function(){var n,o;return L(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);n={success:!0};return[4,t.model.aggregatePaginate(t.model.aggregate(e),r)];case 1:return[2,(n.result=a.sent(),n)];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:ry.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var r=this;return a(function(){var t,n;return L(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);t={success:!0};return[4,r.model.countDocuments(e)];case 1:return[2,(t.result=o.sent(),t)];case 2:n=o.sent();return[2,{success:!1,message:n.message,code:ry.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createOne",value:function e(e){var r=this;return a(function(){var t,n;return L(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);t={success:!0};return[4,r.model.create(e)];case 1:return[2,(t.result=o.sent(),t)];case 2:n=o.sent();return[2,{success:!1,message:n.message,code:ry.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return a(function(){var n,o;return L(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);n={success:!0};return[4,t.model.insertMany(e,r)];case 1:return[2,(n.result=a.sent().map(function(e){return d(e,rA.Document)?e.toObject():null}).filter(function(e){return e!==null}),n)];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:ry.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return a(function(){var o,a;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,n.model.findOneAndUpdate(e,r,S({new:!0},t)).exec()];case 1:o=s.sent();return[2,o?{success:!0,result:o}:{success:!1,message:"Failed to update ".concat(n.getModelName(),"."),code:ry.NOT_FOUND.CODE}];case 2:a=s.sent();return[2,{success:!1,message:a.message,code:ry.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return a(function(){var o,a;return L(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);o={success:!0};return[4,n.model.updateMany(e,r,t).exec()];case 1:return[2,(o.result=s.sent(),o)];case 2:a=s.sent();return[2,{success:!1,message:a.message,code:ry.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return a(function(){var n,o;return L(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);return[4,t.model.findOneAndDelete(e,r).exec()];case 1:n=a.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"No ".concat(t.getModelName()," found to delete."),code:ry.NOT_FOUND.CODE}];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:ry.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return a(function(){var n,o;return L(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);return[4,t.model.deleteMany(e,r).exec()];case 1:n=a.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents found to delete.",code:ry.NOT_FOUND.CODE}:{success:!0,result:n}];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:ry.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createShortId",value:function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;var t=this;return a(function(){var n,o,a,s;return L(this,function(u){switch(u.label){case 0:n=new Set;o=0;u.label=1;case 1:if(!(o<10))return[3,5];a=rM(e,o+r);s=!n.has(a);if(!s)return[3,3];n.add(a);return[4,t.model.exists({shortId:a})];case 2:s=!u.sent();u.label=3;case 3:if(s)return[2,{success:!0,result:a}];u.label=4;case 4:o++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:ry.INTERNAL_SERVER_ERROR.CODE}]}})})()}},{key:"createSlug",value:function e(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return a(function(){var o,s,u,i,c,l,f,E,d,g,v;return L(this,function(_){switch(_.label){case 0:_.trys.push([0,8,,9]);o=r[e],s=/*#__PURE__*/function(){var e=a(function(e){var o,a,s;return L(this,function(u){switch(u.label){case 0:return[4,n.model.findOne(rG.createSlugQuery(e,t,r.id))];case 1:o=u.sent();if(!o)return[2,e];a=1;u.label=2;case 2:s="".concat(e,"-").concat(a);return[4,n.model.findOne(rG.createSlugQuery(s,t,r.id))];case 3:o=u.sent(),a++;u.label=4;case 4:if(o)return[3,2];u.label=5;case 5:return[2,s]}})});return function r(r){return e.apply(this,arguments)}}();if(!((typeof o==="undefined"?"undefined":T(o))=="object"))return[3,5];u={};i=[];for(c in o)i.push(c);l=0;_.label=1;case 1:if(!(l<i.length))return[3,4];f=i[l];E=rP(o[f]);return[4,s(E)];case 2:u[f]=_.sent();_.label=3;case 3:l++;return[3,1];case 4:return[2,{success:!0,result:u}];case 5:d=rP(o);g={success:!0};return[4,s(d)];case 6:return[2,(g.result=_.sent(),g)];case 7:return[3,9];case 8:v=_.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(v.message),code:ry.INTERNAL_SERVER_ERROR.CODE}];case 9:return[2]}})})()}},{key:"aggregate",value:function e(e){var r=this;return a(function(){var t,n;return L(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);t={success:!0};return[4,r.model.aggregate(e)];case 1:return[2,(t.result=o.sent(),t)];case 2:n=o.sent();return[2,{success:!1,message:n.message,code:ry.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}}]);return e}();var rU=require("@apollo/client"),rj=require("@apollo/client/link/error"),rx=require("@apollo/client/link/subscriptions"),rK=require("@apollo/client/utilities"),rF=require("graphql-ws"),rq=require("react/jsx-runtime");function rY(e){var r=(0,rj.onError)(function(e){var r=e.graphQLErrors,t=e.networkError;r===null||r===void 0?void 0:r.forEach(function(e){var r=e.message,t=e.locations,n=e.path;return console.error("[GraphQL error]: Message: ".concat(r,", Location: ").concat(t,", Path: ").concat(n))}),t&&console.error("[Network error]: ".concat(t))}),t=new rU.HttpLink({uri:e===null||e===void 0?void 0:e.uri,credentials:"include"}),n=(e===null||e===void 0?void 0:e.wsUrl)?new rx.GraphQLWsLink((0,rF.createClient)({url:e.wsUrl})):null,o=n?(0,rU.split)(function(e){var r=e.query;var t=(0,rK.getMainDefinition)(r);if(t.kind==="OperationDefinition"){var n=t.operation;return n==="subscription"}return!1},n,t):t,a=new rU.ApolloLink(function(e,r){return e.variables&&(e.variables=JSON.parse(JSON.stringify(e.variables),function(e,r){return e==="__typename"?void 0:r})),r(e)});return{errorLink:r,httpLink:t,wsLink:n,splitLink:o,cleanTypeName:a}}function rV(e){var r=e.isNextJS,t=e.options,n=e.children,o=e.client,a=e.provider,s=e.cache;var u=o!==null&&o!==void 0?o:rU.ApolloClient;if(typeof u!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var i=a||rU.ApolloProvider,c=s||rU.InMemoryCache,l=rY(t),f=l.cleanTypeName,E=l.errorLink,g=l.splitLink,v=new u(S({cache:d(c,rU.InMemoryCache)?c:new rU.InMemoryCache,link:rU.ApolloLink.from([f,E,g].filter(Boolean))},t));return r?(0,rq.jsx)(i,{makeClient:function(){return v},children:n}):(0,rq.jsx)(i,{client:v,children:n})}var rH=K(require("classnames"),1),rB=require("react"),rJ=K(require("./react/loading.module.scss"),1),rQ=require("react/jsx-runtime"),rW=(0,rB.createContext)(void 0);function rX(){var e=(0,rB.use)(rW);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}function rz(e){var r=e.full,t=r===void 0?!1:r,n=e.block,o=n===void 0?!1:n,a=e.className,s=a===void 0?"":a,u=e.message,i=u===void 0?"Loading":u,c=O(e,["full","block","className","message"]);function l(){return(0,rQ.jsxs)("div",m(S({className:rJ.default.container},c),{children:[(0,rQ.jsx)("div",{className:rJ.default.ring}),(0,rQ.jsx)("div",{className:rJ.default.ring}),(0,rQ.jsx)("div",{className:rJ.default.ring}),(0,rQ.jsx)("div",{className:rJ.default.ring}),i&&(0,rQ.jsx)("div",{className:rJ.default.message,children:i})]}))}return t?(0,rQ.jsx)("div",{className:(0,rH.default)(rJ.default.fullscreen,s),children:l()}):o?(0,rQ.jsx)("div",{className:(0,rH.default)(rJ.default.block,s),children:l()}):l()}function r$(e){var r=e.children;var t=I((0,rB.useState)(!1),2),n=t[0],o=t[1],a=I((0,rB.useState)(!1),2),s=a[0],u=a[1],i=(0,rB.useCallback)(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),u(e)},[]),c=(0,rB.useCallback)(function(){o(!1),u(!1)},[]),l=(0,rB.useMemo)(function(){return{isLoading:n,isGlobalLoading:s,showLoading:i,hideLoading:c}},[n,s,i,c]);return(0,rQ.jsx)(rW,{value:l,children:n?(0,rQ.jsx)(rz,{full:s}):r})}var rZ=require("next-intl"),r0=require("react");var r2=require("react");var r1={serialize:function(e){return JSON.stringify(e,function(e,r){return d(r,Date)?{__type:"Date",value:r.toISOString()}:r})},deserialize: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})}};var r3=K(require("localforage"),1),r4={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,r3.default.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.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,r3.default.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.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,r3.default.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.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,r3.default.keys()];case 1:return[2,(e=t.sent())!==null&&e!==void 0?e:[]];case 2:r=t.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",r),[])];case 3:return[2]}})})()}};function r5(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r1;var n=I((0,r2.useState)(r),2),o=n[0],s=n[1],u=I((0,r2.useState)(!1),2),i=u[0],c=u[1];(0,r2.useEffect)(function(){var n=!0;return a(function(){var o,a,u,i;return L(this,function(l){switch(l.label){case 0:l.trys.push([0,6,7,8]);return[4,r4.get(e)];case 1:o=l.sent();if(!n)return[3,5];if(!(o!==null))return[3,2];a=t.deserialize(o);s(a);return[3,5];case 2:if(!(r!==void 0))return[3,4];u=t.serialize(r);return[4,r4.set(e,u)];case 3:l.sent(),s(r);return[3,5];case 4:s(void 0);l.label=5;case 5:return[3,8];case 6:i=l.sent();console.error('Error loading value for key "'.concat(e,'":'),i),n&&s(r);return[3,8];case 7:n&&c(!0);return[7];case 8:return[2]}})})(),function(){n=!1,c(!1)}},[e,r,t]),(0,r2.useEffect)(function(){if(!i)return;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,r4.set(e,r)];case 1:a.sent();a.label=2;case 2:return[3,4];case 3:n=a.sent();console.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},[o,e,t,i]);var l=(0,r2.useCallback)(function(e){s(function(r){return typeof e=="function"?e(r):e})},[]),f=(0,r2.useCallback)(/*#__PURE__*/a(function(){var r;return L(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,r4.remove(e)];case 1:t.sent(),s(void 0);return[3,3];case 2:r=t.sent();console.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})}),[e]);return{value:o,set:l,remove:f}}var r8=require("react/jsx-runtime"),r6=(0,r0.createContext)(void 0);function r7(){var e=(0,r0.use)(r6);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}var r9=rZ.useTranslations;function te(e){var r=function(r){var t;var n=r7(),o=n.currentLanguage,a=r.messages,s=r.languages,u="en",i=a[(o===null||o===void 0?void 0:o.value)||u],c=(t=s.find(function(e){return e.value===(o===null||o===void 0?void 0:o.value)}))===null||t===void 0?void 0:t.timezone;return a?(0,r8.jsx)(rZ.NextIntlClientProvider,{locale:(o===null||o===void 0?void 0:o.value)||u,messages:i,timeZone:c,children:(0,r8.jsx)(e,S({},r))}):(console.warn("Missing messages for language: ".concat((o===null||o===void 0?void 0:o.value)||u)),null)};return r.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),r}function tr(e){var r=e.children;return(0,r8.jsx)(r8.Fragment,{children:r})}var tt=te(tr);function tn(e){var r=e.children,t=e.languages,n=e.messages;var o;var a=r5("lang",(o=t===null||t===void 0?void 0:t[0])!==null&&o!==void 0?o:{}),s=a.value,u=a.set,i=(0,r0.useMemo)(function(){return{languages:t,currentLanguage:s,setCurrentLanguage:u}},[t,u,s]);return(0,r8.jsx)(r6,{value:i,children:(0,r8.jsx)(tt,{languages:t,messages:n,children:r})})}var to=function(e){return e.ESLINT="eslint",e.COMMITLINT="commitlint",e.LINT_STAGED="lint-staged",e.VITEST="vitest",e}(to||{});var ta=require("mongodb"),ts=require("mongoose"),tu=/*#__PURE__*/function(e){E(r,e);function r(){u(this,r);return s(this,r,arguments)}return r}(ta.Db),ti=/*#__PURE__*/function(e){E(r,e);function r(){u(this,r);return s(this,r,arguments)}return r}(ts.Document),tc=/*#__PURE__*/function(e){E(r,e);function r(){u(this,r);return s(this,r,arguments)}return r}(ts.Model),tl=/*#__PURE__*/function(e){E(r,e);function r(){u(this,r);return s(this,r,arguments)}return r}(ta.Collection);var tf=require("graphql");function tE(e){var r=e.message,t=e.status,n=t===void 0?ry.INTERNAL_SERVER_ERROR:t,o=e.type,a=o===void 0?"graphql":o;var s;var u=(s=r!==null&&r!==void 0?r:n.MESSAGE)!==null&&s!==void 0?s:"Internal server error";throw a==="graphql"?new tf.GraphQLError(u,{extensions:{code:n.CODE}}):new Error(u)}var td=K(require("unorm"),1);function tg(e){try{return JSON.parse(e),!0}catch(e){return!1}}function tv(e){return!!e&&(typeof e==="undefined"?"undefined":T(e))=="object"&&!Array.isArray(e)}function t_(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return r.flat().reduce(function(e,r){var t=true,n=false,o=undefined;try{for(var a=Object.entries(r)[Symbol.iterator](),s;!(t=(s=a.next()).done);t=true){var u=I(s.value,2),i=u[0],c=u[1];var l=e[i];Array.isArray(c)?e[i]=Array.from(new Set(N(Array.isArray(l)?l:[]).concat(N(c)))):tv(c)?e[i]=t_(tv(l)?l:{},c):e[i]=c}}catch(e){n=true;o=e}finally{try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw o}}}return e},{})}var th={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},tS=Object.entries(th).reduce(function(e,r){var t=I(r,2),n=t[0],o=t[1];return e[n.toUpperCase()]=o.map(function(e){return e.toUpperCase()}),e},{});function tp(e){e=td.default.nfkc(e);var r=S({},th,tS);var t=true,n=false,o=undefined;try{for(var a=Object.entries(r)[Symbol.iterator](),s;!(t=(s=a.next()).done);t=true){var u=I(s.value,2),i=u[0],c=u[1];var l="[".concat(i).concat(c.join(""),"]"),f="(".concat([i].concat(N(c)).join("|"),")");e=e.replace(new RegExp(l,"g"),f)}}catch(e){n=true;o=e}finally{try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw o}}}return e}function tm(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}var tO=K(require("@antfu/eslint-config"),1);var ty=K(require("globals"),1),tC=[{languageOptions:{globals:S({},ty.node,ty.browser)},rules:{"no-console":"warn","no-debugger":"warn","no-alert":"warn","perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}]},ignores:["build","dist"]}];var tA=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n=t_.apply(void 0,[tC].concat(N(r))),o=n.ignores,a=O(n,["ignores"]),s=Array.isArray(o)&&o.every(function(e){return typeof e=="string"})?{ignores:o}:void 0,u=[a].concat(N(s?[s]:[]));return(0,tO.default).apply(P,[{stylistic:{semi:!0,indent:4,quotes:"single"},formatters:{css:!0,html:!0,markdown:"prettier"},yaml:!1,react:!0}].concat(N(u)))},tI=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return t_.apply(void 0,N(r))},tN={eslint:tA,commitlint:tI,"lint-staged":tI,vitest:tI};function tT(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++){t[n-1]=arguments[n]}var o=tN[e];if(!o)throw new Error("Unknown config type: ".concat(e));return o.apply(void 0,N(t))}0&&(module.exports={ApolloProvider:ApolloProvider,BUILD_DIRECTORY:BUILD_DIRECTORY,COMMAND:COMMAND,COMMIT_LINT_CLI:COMMIT_LINT_CLI,COMMIT_LINT_PACKAGE_NAME:COMMIT_LINT_PACKAGE_NAME,CYBERSKILL_CLI:CYBERSKILL_CLI,CYBERSKILL_DIRECTORY:CYBERSKILL_DIRECTORY,CYBERSKILL_PACKAGE_NAME:CYBERSKILL_PACKAGE_NAME,CYBERSKILL_STORAGE:CYBERSKILL_STORAGE,C_Collection:C_Collection,C_Db:C_Db,C_Document:C_Document,C_Model:C_Model,DEBUG:DEBUG,ESLINT_CLI:ESLINT_CLI,ESLINT_INSPECT_CLI:ESLINT_INSPECT_CLI,ESLINT_INSPECT_PACKAGE_NAME:ESLINT_INSPECT_PACKAGE_NAME,ESLINT_PACKAGE_NAME:ESLINT_PACKAGE_NAME,E_CommandType:E_CommandType,E_ConfigType:E_ConfigType,E_ErrorType:E_ErrorType,GIT_CLI:GIT_CLI,GIT_COMMIT_EDITMSG:GIT_COMMIT_EDITMSG,GIT_HOOK:GIT_HOOK,GIT_IGNORE:GIT_IGNORE,HOOK:HOOK,LINT_STAGED_CLI:LINT_STAGED_CLI,LINT_STAGED_PACKAGE_NAME:LINT_STAGED_PACKAGE_NAME,Loading:Loading,LoadingContext:LoadingContext,LoadingProvider:LoadingProvider,MongoController:MongoController,MongooseController:MongooseController,NODE_MODULES:NODE_MODULES,NODE_MODULES_INSPECT_CLI:NODE_MODULES_INSPECT_CLI,NODE_MODULES_INSPECT_PACKAGE_NAME:NODE_MODULES_INSPECT_PACKAGE_NAME,NextIntlContext:NextIntlContext,NextIntlProvider:NextIntlProvider,PACKAGE_JSON:PACKAGE_JSON,PACKAGE_LOCK_JSON:PACKAGE_LOCK_JSON,PATH:PATH,PNPM_CLI:PNPM_CLI,PNPM_EXEC_CLI:PNPM_EXEC_CLI,PNPM_LOCK_YAML:PNPM_LOCK_YAML,RESPONSE_STATUS:RESPONSE_STATUS,SIMPLE_GIT_HOOKS_PACKAGE_NAME:SIMPLE_GIT_HOOKS_PACKAGE_NAME,SIMPLE_GIT_HOOK_CLI:SIMPLE_GIT_HOOK_CLI,SIMPLE_GIT_HOOK_JSON:SIMPLE_GIT_HOOK_JSON,TSCONFIG_JSON:TSCONFIG_JSON,TSC_CLI:TSC_CLI,TSC_PACKAGE_NAME:TSC_PACKAGE_NAME,TSX_CLI:TSX_CLI,VITEST_CLI:VITEST_CLI,VITEST_PACKAGE_NAME:VITEST_PACKAGE_NAME,WORKING_DIRECTORY:WORKING_DIRECTORY,aggregatePaginate:aggregatePaginate,appendFileSync:appendFileSync,checkPackage:checkPackage,clearAllErrorLists:clearAllErrorLists,commandLog:commandLog,deepMerge:deepMerge,executeCommand:executeCommand,existsSync:existsSync,formatCommand:formatCommand,generateShortId:generateShortId,generateSlug:generateSlug,getLatestPackageVersion:getLatestPackageVersion,getPackageJson:getPackageJson,getStorageDir:getStorageDir,getStoredErrorLists:getStoredErrorLists,initNodePersist:initNodePersist,isJson:isJson,isPlainObject:isPlainObject,join:join,mergeConfigs:mergeConfigs,mongo:mongo,mongoosePaginate:mongoosePaginate,rawCommand:rawCommand,readFileSync:readFileSync,regexSearchMapper:regexSearchMapper,removeAccent:removeAccent,resolve:resolve,resolveCommands:resolveCommands,resolveWorkingPath:resolveWorkingPath,rmSync:rmSync,serializer:serializer,storageClient:storageClient,storageServer:storageServer,throwResponse:throwResponse,useLoading:useLoading,useNextIntl:useNextIntl,useStorage:useStorage,useTranslateNextIntl:useTranslateNextIntl,validate:validate,withNextIntl:withNextIntl,writeFileSync:writeFileSync});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { DEBUG } from './_tsup-dts-rollup.cjs';
|
|
1
2
|
export { HOOK } from './_tsup-dts-rollup.cjs';
|
|
2
3
|
export { WORKING_DIRECTORY } from './_tsup-dts-rollup.cjs';
|
|
3
4
|
export { CYBERSKILL_PACKAGE_NAME } from './_tsup-dts-rollup.cjs';
|
|
@@ -14,6 +15,7 @@ export { GIT_HOOK } from './_tsup-dts-rollup.cjs';
|
|
|
14
15
|
export { GIT_COMMIT_EDITMSG } from './_tsup-dts-rollup.cjs';
|
|
15
16
|
export { CYBERSKILL_DIRECTORY } from './_tsup-dts-rollup.cjs';
|
|
16
17
|
export { CYBERSKILL_CLI } from './_tsup-dts-rollup.cjs';
|
|
18
|
+
export { ESLINT_PACKAGE_NAME } from './_tsup-dts-rollup.cjs';
|
|
17
19
|
export { ESLINT_CLI } from './_tsup-dts-rollup.cjs';
|
|
18
20
|
export { VITEST_PACKAGE_NAME } from './_tsup-dts-rollup.cjs';
|
|
19
21
|
export { VITEST_CLI } from './_tsup-dts-rollup.cjs';
|
|
@@ -71,8 +73,10 @@ export { T_Command } from './_tsup-dts-rollup.cjs';
|
|
|
71
73
|
export { T_CommandMap } from './_tsup-dts-rollup.cjs';
|
|
72
74
|
export { T_CommandMapInput } from './_tsup-dts-rollup.cjs';
|
|
73
75
|
export { E_CommandType } from './_tsup-dts-rollup.cjs';
|
|
74
|
-
export {
|
|
75
|
-
export {
|
|
76
|
+
export { T_Object } from './_tsup-dts-rollup.cjs';
|
|
77
|
+
export { E_ConfigType } from './_tsup-dts-rollup.cjs';
|
|
78
|
+
export { T_ConfigType } from './_tsup-dts-rollup.cjs';
|
|
79
|
+
export { T_ConfigHandler } from './_tsup-dts-rollup.cjs';
|
|
76
80
|
export { I_GraphqlCodegenConfig } from './_tsup-dts-rollup.cjs';
|
|
77
81
|
export { I_LoadingProps } from './_tsup-dts-rollup.cjs';
|
|
78
82
|
export { T_ThrowResponseArgs } from './_tsup-dts-rollup.cjs';
|
|
@@ -162,9 +166,11 @@ export { getStorageDir } from './_tsup-dts-rollup.cjs';
|
|
|
162
166
|
export { initNodePersist } from './_tsup-dts-rollup.cjs';
|
|
163
167
|
export { storageServer } from './_tsup-dts-rollup.cjs';
|
|
164
168
|
export { isJson } from './_tsup-dts-rollup.cjs';
|
|
169
|
+
export { isPlainObject } from './_tsup-dts-rollup.cjs';
|
|
170
|
+
export { deepMerge } from './_tsup-dts-rollup.cjs';
|
|
165
171
|
export { regexSearchMapper } from './_tsup-dts-rollup.cjs';
|
|
166
172
|
export { removeAccent } from './_tsup-dts-rollup.cjs';
|
|
167
|
-
export {
|
|
173
|
+
export { mergeConfigs } from './_tsup-dts-rollup.cjs';
|
|
168
174
|
export { serializer } from './_tsup-dts-rollup.cjs';
|
|
169
175
|
export { storageClient } from './_tsup-dts-rollup.cjs';
|
|
170
176
|
export { generateSlug } from './_tsup-dts-rollup.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { DEBUG } from './_tsup-dts-rollup.js';
|
|
1
2
|
export { HOOK } from './_tsup-dts-rollup.js';
|
|
2
3
|
export { WORKING_DIRECTORY } from './_tsup-dts-rollup.js';
|
|
3
4
|
export { CYBERSKILL_PACKAGE_NAME } from './_tsup-dts-rollup.js';
|
|
@@ -14,6 +15,7 @@ export { GIT_HOOK } from './_tsup-dts-rollup.js';
|
|
|
14
15
|
export { GIT_COMMIT_EDITMSG } from './_tsup-dts-rollup.js';
|
|
15
16
|
export { CYBERSKILL_DIRECTORY } from './_tsup-dts-rollup.js';
|
|
16
17
|
export { CYBERSKILL_CLI } from './_tsup-dts-rollup.js';
|
|
18
|
+
export { ESLINT_PACKAGE_NAME } from './_tsup-dts-rollup.js';
|
|
17
19
|
export { ESLINT_CLI } from './_tsup-dts-rollup.js';
|
|
18
20
|
export { VITEST_PACKAGE_NAME } from './_tsup-dts-rollup.js';
|
|
19
21
|
export { VITEST_CLI } from './_tsup-dts-rollup.js';
|
|
@@ -71,8 +73,10 @@ export { T_Command } from './_tsup-dts-rollup.js';
|
|
|
71
73
|
export { T_CommandMap } from './_tsup-dts-rollup.js';
|
|
72
74
|
export { T_CommandMapInput } from './_tsup-dts-rollup.js';
|
|
73
75
|
export { E_CommandType } from './_tsup-dts-rollup.js';
|
|
74
|
-
export {
|
|
75
|
-
export {
|
|
76
|
+
export { T_Object } from './_tsup-dts-rollup.js';
|
|
77
|
+
export { E_ConfigType } from './_tsup-dts-rollup.js';
|
|
78
|
+
export { T_ConfigType } from './_tsup-dts-rollup.js';
|
|
79
|
+
export { T_ConfigHandler } from './_tsup-dts-rollup.js';
|
|
76
80
|
export { I_GraphqlCodegenConfig } from './_tsup-dts-rollup.js';
|
|
77
81
|
export { I_LoadingProps } from './_tsup-dts-rollup.js';
|
|
78
82
|
export { T_ThrowResponseArgs } from './_tsup-dts-rollup.js';
|
|
@@ -162,9 +166,11 @@ export { getStorageDir } from './_tsup-dts-rollup.js';
|
|
|
162
166
|
export { initNodePersist } from './_tsup-dts-rollup.js';
|
|
163
167
|
export { storageServer } from './_tsup-dts-rollup.js';
|
|
164
168
|
export { isJson } from './_tsup-dts-rollup.js';
|
|
169
|
+
export { isPlainObject } from './_tsup-dts-rollup.js';
|
|
170
|
+
export { deepMerge } from './_tsup-dts-rollup.js';
|
|
165
171
|
export { regexSearchMapper } from './_tsup-dts-rollup.js';
|
|
166
172
|
export { removeAccent } from './_tsup-dts-rollup.js';
|
|
167
|
-
export {
|
|
173
|
+
export { mergeConfigs } from './_tsup-dts-rollup.js';
|
|
168
174
|
export { serializer } from './_tsup-dts-rollup.js';
|
|
169
175
|
export { storageClient } from './_tsup-dts-rollup.js';
|
|
170
176
|
export { generateSlug } from './_tsup-dts-rollup.js';
|