@cyberskill/shared 1.78.0 → 1.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/configs/config.util.cjs +1 -1
  2. package/dist/configs/config.util.js +1 -1
  3. package/dist/configs/graphql-codegen/graphql-codegen.util.cjs +1 -1
  4. package/dist/configs/graphql-codegen/graphql-codegen.util.js +1 -1
  5. package/dist/configs/graphql-codegen/index.cjs +1 -1
  6. package/dist/configs/graphql-codegen/index.js +1 -1
  7. package/dist/configs/index.cjs +1 -1
  8. package/dist/configs/index.js +1 -1
  9. package/dist/configs/tsconfig/tsconfig.base.d.cts +1 -0
  10. package/dist/configs/tsconfig/tsconfig.base.d.ts +1 -0
  11. package/dist/configs/tsconfig/tsconfig.base.json +46 -0
  12. package/dist/configs/tsconfig/tsconfig.nextjs.d.cts +1 -0
  13. package/dist/configs/tsconfig/tsconfig.nextjs.d.ts +1 -0
  14. package/dist/configs/tsconfig/tsconfig.nodejs.d.cts +1 -0
  15. package/dist/configs/tsconfig/tsconfig.nodejs.d.ts +1 -0
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/nodejs/cli/cli.util.cjs +1 -1
  19. package/dist/nodejs/cli/cli.util.js +1 -1
  20. package/dist/nodejs/cli/index.cjs +1 -1
  21. package/dist/nodejs/cli/index.js +1 -1
  22. package/dist/nodejs/command/command.util.cjs +1 -1
  23. package/dist/nodejs/command/command.util.js +1 -1
  24. package/dist/nodejs/command/index.cjs +1 -1
  25. package/dist/nodejs/command/index.js +1 -1
  26. package/dist/nodejs/index.cjs +1 -1
  27. package/dist/nodejs/index.js +1 -1
  28. package/dist/nodejs/mongo/index.cjs +1 -1
  29. package/dist/nodejs/mongo/index.js +1 -1
  30. package/dist/nodejs/mongo/mongo.cjs +1 -1
  31. package/dist/nodejs/mongo/mongo.js +1 -1
  32. package/dist/nodejs/package/index.cjs +1 -1
  33. package/dist/nodejs/package/index.js +1 -1
  34. package/dist/nodejs/package/package.util.cjs +1 -1
  35. package/dist/nodejs/package/package.util.js +1 -1
  36. package/dist/nodejs/path/index.cjs +1 -1
  37. package/dist/nodejs/path/index.js +1 -1
  38. package/dist/nodejs/path/path.constant.cjs +1 -1
  39. package/dist/nodejs/path/path.constant.js +1 -1
  40. package/dist/nodejs/path/path.util.cjs +1 -1
  41. package/dist/nodejs/path/path.util.js +1 -1
  42. package/dist/nodejs/storage/index.cjs +1 -1
  43. package/dist/nodejs/storage/index.js +1 -1
  44. package/dist/nodejs/storage/storage.util.cjs +1 -1
  45. package/dist/nodejs/storage/storage.util.js +1 -1
  46. package/dist/package-MZ24VJKI.json +266 -0
  47. package/dist/react/apollo-client/apollo-client.component.cjs +1 -1
  48. package/dist/react/apollo-client/apollo-client.component.js +1 -1
  49. package/dist/react/apollo-client/index.cjs +1 -1
  50. package/dist/react/apollo-client/index.js +1 -1
  51. package/dist/react/index.cjs +1 -1
  52. package/dist/react/index.js +1 -1
  53. package/dist/react/loading/loading.module.scss.d.cjs +1 -0
  54. package/dist/react/loading/loading.module.scss.d.js +1 -0
  55. package/dist/react/next-intl/index.cjs +1 -1
  56. package/dist/react/next-intl/index.js +1 -1
  57. package/dist/react/next-intl/next-intl.constant.cjs +1 -0
  58. package/dist/react/next-intl/next-intl.constant.js +1 -0
  59. package/dist/react/next-intl/next-intl.hoc.cjs +1 -1
  60. package/dist/react/next-intl/next-intl.hoc.js +1 -1
  61. package/dist/react/next-intl/next-intl.provider.cjs +1 -1
  62. package/dist/react/next-intl/next-intl.provider.js +1 -1
  63. package/dist/react/storage/index.cjs +1 -1
  64. package/dist/react/storage/index.js +1 -1
  65. package/dist/react/storage/storage.hook.cjs +1 -1
  66. package/dist/react/storage/storage.hook.js +1 -1
  67. package/dist/react/storage/storage.util.cjs +1 -1
  68. package/dist/react/storage/storage.util.js +1 -1
  69. package/dist/react/vitest/index.cjs +1 -1
  70. package/dist/react/vitest/index.js +1 -1
  71. package/dist/react/vitest/vitest.unit.cjs +1 -1
  72. package/dist/react/vitest/vitest.unit.js +1 -1
  73. package/dist/utils/index.cjs +1 -1
  74. package/dist/utils/index.js +1 -1
  75. package/dist/utils/string/index.cjs +1 -1
  76. package/dist/utils/string/index.js +1 -1
  77. package/dist/utils/string/string.util.cjs +1 -1
  78. package/dist/utils/string/string.util.js +1 -1
  79. package/package.json +9 -18
  80. package/public/wiki/convention.md +11 -11
@@ -1 +1 @@
1
- function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,o,a,c){try{var i=e[a](c);var s=i.value}catch(e){n(e);return}if(i.done){t(s)}else{Promise.resolve(s).then(r,o)}}function o(e){return function(){var t=this,n=arguments;return new Promise(function(o,a){var c=e.apply(t,n);function i(e){r(c,o,a,i,s,"next",e)}function s(e){r(c,o,a,i,s,"throw",e)}i(undefined)})}}function a(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function c(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var o=true;var a=false;var c,i;try{for(n=n.call(e);!(o=(c=n.next()).done);o=true){r.push(c.value);if(t&&r.length===t)break}}catch(e){a=true;i=e}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(a)throw i}}return r}function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){a(e,t,n[t])})}return e}function f(e,n){return t(e)||i(e,n)||h(e,n)||s()}function p(e){return n(e)||c(e)||h(e)||u()}function d(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function h(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function y(e,t){var n,r,o,a,c={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(e){return function(t){return s([e,t])}}function s(a){if(n)throw new TypeError("Generator is already executing.");while(c)try{if(n=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:c.label++;return{value:a[1],done:false};case 5:c.label++;r=a[1];a=[0];continue;case 7:a=c.ops.pop();c.trys.pop();continue;default:if(!(o=c.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){c=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){c.label=a[1];break}if(a[0]===6&&c.label<o[1]){c.label=o[1];o=a;break}if(o&&c.label<o[2]){c.label=o[2];c.ops.push(a);break}if(o[2])c.ops.pop();c.trys.pop();continue}a=t.call(e,c)}catch(e){a=[6,e];r=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}import g from"node-persist";import m from"node:os";import v from"node:process";import b from"chalk";import I from"consola";import{GraphQLError as w}from"graphql";import S from"node:process";var O=S.env.DEBUG==="true";O||(I.level=4);function E(e){var t=b[e];return typeof t=="function"?t:b.green}var _={silent:I.silent,level:I.level,fatal:I.fatal,error:I.error,warn:I.warn,log:I.log,info:I.info,success:I.success,ready:I.ready,start:I.start,box:I.box,debug:I.debug,trace:I.trace,verbose:I.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){I.box(b.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,a=e.message;I.log("".concat(b.gray("File:")," ").concat(b.blue("".concat(t).concat(r?":".concat(r):"")))),o&&I.log(" ".concat(E(n)("Rule:")," ").concat(o)),I.log(" ".concat(E(n)("Message:")," ").concat(a))}),I.box(E(n)("".concat(e," : ").concat(t.length))),I.log(b.gray("─".repeat(40)))}};import T from"node:process";import{exec as C}from"node:child_process";import k from"node:process";import*as N from"node:util";var A={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import G from"node-fetch";import*as L from"node:fs";function j(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return L.existsSync(e)})}function R(e,t){var n=L.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":d(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}function D(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,o=r===void 0?!1:r,a=o&&(typeof t==="undefined"?"undefined":d(t))=="object"?JSON.stringify(t,null,4):String(t);L.writeFileSync(e,a,"utf-8")}function P(e){var t=ec(ei,ep);if(!j(t))return!1;try{var n=R(t,{asJson:!0}),r=n.name,o=n.dependencies,a=o===void 0?{}:o,c=n.devDependencies,i=c===void 0?{}:c,s=r===e,u=e in a,l=e in i;return s||u||l?{path:t,file:n,isCurrentProject:s,isDepend:u,isDevDepend:l}:!1}catch(e){return _.warn("Failed to read package.json: ".concat(e.message)),!1}}function x(e){return F.apply(this,arguments)}function F(){F=o(function(e){var t,n,r,o;return y(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,G("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=a.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=a.sent(),r=n.version;return[2,r];case 3:o=a.sent();throw _.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})});return F.apply(this,arguments)}function M(e,t){return U.apply(this,arguments)}function U(){U=o(function(e,t){var n,r,o,a,c,i,s,u,f,p,d,h,g,m,v,b,I,w,S,O,E;return y(this,function(y){switch(y.label){case 0:y.trys.push([0,4,,5]);n=P(e);if(!n)return[2,l({},A)];s=n.path,u=n.file,f=n.isCurrentProject,p=n.isDepend,d=n.isDevDepend,h=(r=u.dependencies)!==null&&r!==void 0?r:{},g=(o=u.devDependencies)!==null&&o!==void 0?o:{},m=f?(a=u.version)!==null&&a!==void 0?a:"0.0.0":p?(c=h[e])!==null&&c!==void 0?c:"0.0.0":d?(i=g[e])!==null&&i!==void 0?i:"0.0.0":"0.0.0";if(!f)return[3,1];I=m;return[3,3];case 1:return[4,x(e)];case 2:I=y.sent();y.label=3;case 3:v=I,b=f||m===v;if(!b&&(t===null||t===void 0?void 0:t.update)){;S=p?"dependencies":d?"devDependencies":null;S&&((w=u[S])===null||w===void 0?void 0:w[e])!==v&&(u[S]=(O=u[S])!==null&&O!==void 0?O:{},u[S][e]=v,D(s,u,{isJson:!0}),_.info('Updated "'.concat(e,'" to version ').concat(v)))}return[2,{isCurrentProject:f,installedPath:s,file:u,isUpToDate:b}];case 4:E=y.sent();return[2,(_.error('Error checking package "'.concat(e,'": ').concat(E.message)),l({},A))];case 5:return[2]}})});return U.apply(this,arguments)}function J(){return K.apply(this,arguments)}function K(){K=o(function(){var e,t,n,r,o,a,c,i,s,u,l,f;return y(this,function(p){switch(p.label){case 0:e=[{command:function(){return eq.pnpmInstallStandard()},message:"Installing dependencies (standard)"},{command:function(){return eq.pnpmInstallLegacy()},message:"Retrying with legacy peer dependencies"},{command:function(){return eq.pnpmInstallForce()},message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);o=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(a=o.next()).done))return[3,8];c=a.value,i=c.command,s=c.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,i()];case 4:u=p.sent();return[4,en("".concat(s," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();_.warn("Installation attempt failed: ".concat(s)),_.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:f=p.sent();n=true;r=f;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return K.apply(this,arguments)}function W(e,t){return Y.apply(this,arguments)}function Y(){Y=o(function(e,t){var n,r,o,a,c,i,s,u,l,f,d;return y(this,function(h){switch(h.label){case 0:if(!j(eY.PACKAGE_JSON)){_.error("package.json not found. Aborting setup.");return[2]}h.label=1;case 1:h.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return M(e,{update:t===null||t===void 0?void 0:t.update})}))];case 2:r=h.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,J()];case 3:r=h.sent();h.label=4;case 4:r;a=true,c=false,i=undefined;h.label=5;case 5:h.trys.push([5,10,11,12]);s=((o=t===null||t===void 0?void 0:t.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();h.label=6;case 6:if(!!(a=(u=s.next()).done))return[3,9];l=u.value;return[4,l()];case 7:h.sent();h.label=8;case 8:a=true;return[3,6];case 9:return[3,12];case 10:f=h.sent();c=true;i=f;return[3,12];case 11:try{if(!a&&s.return!=null){s.return()}}finally{if(c){throw i}}return[7];case 12:return[3,14];case 13:d=h.sent();throw _.error('Failed to setup "'.concat(e.join(", "),'": ').concat(d.message)),d;case 14:return[2]}})});return Y.apply(this,arguments)}var B=N.promisify(C);function H(e){return"error_list:".concat(e)}function $(e){return q.apply(this,arguments)}function q(){q=o(function(e){var t,n,r;return y(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];t=Date.now(),n=H(t);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,eX.set(n,{errors:e,timestamp:t})];case 2:a.sent(),setTimeout(/*#__PURE__*/o(function(){var e;return y(this,function(t){switch(t.label){case 0:return[4,eX.getLogLink(n)];case 1:e=t.sent();e&&_.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=a.sent();_.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return q.apply(this,arguments)}function Q(e){var t=[],n=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i=o.exec(e)||[],s=a.exec(e)||[],u=c.exec(e)||[];i.length&&r?t.push({file:r,position:"".concat(i[1],":").concat(i[2]),type:i[3]==="error"?"error":"warning",message:i[4].trim(),rule:i[5].trim()}):s.length?t.push({file:s[1],position:"".concat(s[2],":").concat(s[3]),type:s[4]==="error"?"error":"warning",message:s[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):n.push(e.trim())}}),t.length&&$(t),O&&n.length&&(_.warn("Unmatched lines:"),n.forEach(function(e){return _.info(" ".concat(e))}))}function z(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,o=e.line,a=e.column,c=e.ruleId,i=e.message;n.push({type:r===2?"error":"warning",file:t,position:"".concat(o,":").concat(a),rule:c,message:i})})}),n.length&&$(n)}catch(t){Q(e)}}function V(e){return X.apply(this,arguments)}function X(){X=o(function(e){var t,n,r,o,a,c,i,s,u;var l=arguments;return y(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:z;n=new AbortController;k.on("SIGINT",function(){_.warn("Process interrupted. Terminating..."),n.abort(),k.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,B(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),o=r.stdout,a=r.stderr;[o,a].forEach(function(e){return e&&t(e)});return[3,4];case 3:c=f.sent();i=c.stdout,s=c.stderr,u=c.message;[i,s].forEach(function(e){return e&&t(e)}),!s&&!i&&_.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return X.apply(this,arguments)}function Z(e){return{raw:!0,cmd:e}}function ee(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ex," ").concat(es," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ex," ").concat(eR," ").concat(eS," ").concat(e):"".concat(ex," ").concat(ew," ").concat(e)}function et(e,t){return typeof e=="function"?ee(e(t),t):(typeof e==="undefined"?"undefined":d(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?ee(e,t):e}function en(e,t){return er.apply(this,arguments)}function er(){er=o(function(e,t){var n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);_.start("".concat(e)),O&&_.info("→ ".concat(t));return[4,V(t)];case 1:r.sent(),_.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw _.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return er.apply(this,arguments)}import*as eo from"node:path";function ea(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eo).resolve.apply(r,[ei].concat(p(t)))}function ec(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eo).join.apply(r,p(t))}var ei=T.env.INIT_CWD||T.cwd(),es="@cyberskill/shared",eu=".cyberskill-storage",el="node_modules",ef="dist",ep="package.json",ed="package-lock.json",eh="tsconfig.json",ey=".gitignore",eg=".simple-git-hooks.json",em="pnpm-lock.yaml",ev=".git/hooks/",eb=".git/COMMIT_EDITMSG",eI=ec(ei,el,es,ef),ew="cyberskill",eS="src/nodejs/cli/index.ts",eO="eslint",eE="eslint",e_="vitest",eT="playwright",eC="vitest",ek="@commitlint/cli",eN="commitlint",eA="lint-staged",eG="lint-staged",eL="typescript",ej="tsc",eR="tsx",eD="git",eP="pnpm",ex="pnpm exec",eF="simple-git-hooks",eM="simple-git-hooks",eU="@eslint/config-inspector",eJ="eslint-config-inspector",eK="node-modules-inspector",eW="node-modules-inspector",eY={CYBERSKILL_DIRECTORY:eI,WORKING_DIRECTORY:ei,TS_CONFIG:ea(eh),GIT_IGNORE:ea(ey),GIT_HOOK:ea(ev),GIT_COMMIT_MSG:ea(eb),SIMPLE_GIT_HOOKS_JSON:ea(eg),PACKAGE_JSON:ea(ep),PACKAGE_LOCK_JSON:ea(ed),PNPM_LOCK_YAML:ea(em),NODE_MODULES:ea(el),LINT_STAGED_CONFIG:ea("".concat(eI,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:ea("".concat(eI,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:ea("".concat(eI,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ea("".concat(eI,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ea("".concat(eI,"/react/vitest/vitest.e2e.js"))};function eB(e){return eH.apply(this,arguments)}function eH(){eH=o(function(e){var t,n,r,o,a,c;var i=arguments;return y(this,function(s){switch(s.label){case 0:for(t=i.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=i[r]}o=f(n,2),a=o[0],c=o[1];switch(e){case"CLI":return[3,1];case"RAW":return[3,3]}return[3,4];case 1:return[4,W(a.split(" "),{update:!0})];case 2:return[2,(s.sent(),et(Z("".concat(ex," ").concat(c))))];case 3:return[2,et(Z(a))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eH.apply(this,arguments)}function e$(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/o(function(){return y(this,function(t){return[2,eB.apply(void 0,[e].concat(p(n)))]})})}var eq={simpleGitHooks:e$("CLI",eF,eM),eslintInspect:e$("CLI",eU,eJ),nodeModulesInspect:e$("CLI",eK,eW),eslintCheck:e$("CLI",eO,"".concat(eE," ").concat(eY.WORKING_DIRECTORY)),eslintFix:e$("CLI",eO,"".concat(eE," ").concat(eY.WORKING_DIRECTORY," --fix")),typescriptCheck:e$("CLI",eL,"".concat(ej," -p ").concat(eY.TS_CONFIG," --noEmit")),configureGitHook:e$("RAW","".concat(eD," config core.hooksPath ").concat(eY.GIT_HOOK)),testUnit:e$("CLI",e_,"".concat(eC," --config ").concat(eY.UNIT_TEST_CONFIG)),testE2e:e$("CLI","".concat(e_," ").concat(eT),"".concat(eC," --config ").concat(eY.E2E_TEST_CONFIG)),commitLint:e$("CLI",ek,"".concat(eN," --edit ").concat(eY.GIT_COMMIT_MSG," --config ").concat(eY.COMMITLINT_CONFIG)),lintStaged:e$("CLI",eA,"".concat(eG," --config ").concat(eY.LINT_STAGED_CONFIG)),stageBuildDirectory:e$("RAW","".concat(eD," add ").concat(ef)),build:e$("RAW","".concat(eP," run build")),pnpmInstallStandard:e$("RAW","".concat(eP," install")),pnpmInstallLegacy:e$("RAW","".concat(eP," install --legacy-peer-deps")),pnpmInstallForce:e$("RAW","".concat(eP," install --force"))};function eQ(){return v.env.CYBERSKILL_STORAGE_DIR||ec(m.homedir(),eu)}function ez(){return eV.apply(this,arguments)}function eV(){eV=o(function(){var e;return y(this,function(t){switch(t.label){case 0:e=g.defaultInstance;if(e)return[3,2];return[4,g.init({dir:eQ(),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 eX={get:function e(e){return o(function(){var t,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ez()];case 1:r.sent();return[4,g.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(_.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return o(function(){var n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ez()];case 1:r.sent();return[4,g.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();_.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return o(function(){var t;return y(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ez()];case 1:n.sent();return[4,g.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();_.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return o(function(){var e,t;return y(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ez()];case 1:n.sent();return[4,g.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(_.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(_.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return o(function(){return y(this,function(t){try{return[2,"".concat(eQ()," (key: ").concat(e,")")]}catch(e){return[2,(_.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};export{eX as storageNodeJS};
1
+ function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,o,a,i){try{var c=e[a](i);var s=c.value}catch(e){n(e);return}if(c.done){t(s)}else{Promise.resolve(s).then(r,o)}}function o(e){return function(){var t=this,n=arguments;return new Promise(function(o,a){var i=e.apply(t,n);function c(e){r(i,o,a,c,s,"next",e)}function s(e){r(i,o,a,c,s,"throw",e)}c(undefined)})}}function a(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function i(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var o=true;var a=false;var i,c;try{for(n=n.call(e);!(o=(i=n.next()).done);o=true){r.push(i.value);if(t&&r.length===t)break}}catch(e){a=true;c=e}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(a)throw c}}return r}function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){a(e,t,n[t])})}return e}function f(e,n){return t(e)||c(e,n)||v(e,n)||s()}function p(e){return n(e)||i(e)||v(e)||u()}function d(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function v(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function h(e,t){var n,r,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=c(0),i["throw"]=c(1),i["return"]=c(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(e){return function(t){return s([e,t])}}function s(c){if(n)throw new TypeError("Generator is already executing.");while(i&&(i=0,c[0]&&(a=0)),a)try{if(n=1,r&&(o=c[0]&2?r["return"]:c[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;if(r=0,o)c=[c[0]&2,o.value];switch(c[0]){case 0:case 1:o=c;break;case 4:a.label++;return{value:c[1],done:false};case 5:a.label++;r=c[1];c=[0];continue;case 7:c=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){a=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(c[0]===6&&a.label<o[1]){a.label=o[1];o=c;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(c);break}if(o[2])a.ops.pop();a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e];r=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}import y from"node-persist";import g from"node:os";import m from"node:process";import b from"chalk";import I from"consola";import{GraphQLError as w}from"graphql";import S from"node:process";var O=S.env.DEBUG==="true";O||(I.level=4);function E(e){var t=b[e];return typeof t=="function"?t:b.green}var _={silent:I.silent,level:I.level,fatal:I.fatal,error:I.error,warn:I.warn,log:I.log,info:I.info,success:I.success,ready:I.ready,start:I.start,box:I.box,debug:I.debug,trace:I.trace,verbose:I.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){I.box(b.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,a=e.message;I.log("".concat(b.gray("File:")," ").concat(b.blue("".concat(t).concat(r?":".concat(r):"")))),o&&I.log(" ".concat(E(n)("Rule:")," ").concat(o)),I.log(" ".concat(E(n)("Message:")," ").concat(a))}),I.box(E(n)("".concat(e," : ").concat(t.length))),I.log(b.gray("─".repeat(40)))}};import T from"node:process";import{exec as C}from"node:child_process";import k from"node:process";import*as N from"node:util";var A={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import j from"node-fetch";import*as G from"node:fs";function L(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return G.existsSync(e)})}function R(e,t){var n=G.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":d(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}function D(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,o=r===void 0?!1:r,a=o&&(typeof t==="undefined"?"undefined":d(t))=="object"?JSON.stringify(t,null,4):String(t);G.writeFileSync(e,a,"utf-8")}function P(e){var t=ei(ec,ep);if(!L(t))return!1;try{var n=R(t,{asJson:!0}),r=n.name,o=n.dependencies,a=o===void 0?{}:o,i=n.devDependencies,c=i===void 0?{}:i,s=r===e,u=e in a,l=e in c;return s||u||l?{path:t,file:n,isCurrentProject:s,isDepend:u,isDevDepend:l}:!1}catch(e){return _.warn("Failed to read package.json: ".concat(e.message)),!1}}function x(e){return F.apply(this,arguments)}function F(){F=o(function(e){var t,n,r,o;return h(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,j("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=a.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=a.sent(),r=n.version;return[2,r];case 3:o=a.sent();throw _.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})});return F.apply(this,arguments)}function M(e,t){return U.apply(this,arguments)}function U(){U=o(function(e,t){var n,r,o,a,i,c,s,u,f,p,d,v,y,g,m,b,I,w,S,O,E;return h(this,function(h){switch(h.label){case 0:h.trys.push([0,4,,5]);n=P(e);if(!n)return[2,l({},A)];s=n.path,u=n.file,f=n.isCurrentProject,p=n.isDepend,d=n.isDevDepend,v=(r=u.dependencies)!==null&&r!==void 0?r:{},y=(o=u.devDependencies)!==null&&o!==void 0?o:{},g=f?(a=u.version)!==null&&a!==void 0?a:"0.0.0":p?(i=v[e])!==null&&i!==void 0?i:"0.0.0":d?(c=y[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!f)return[3,1];I=g;return[3,3];case 1:return[4,x(e)];case 2:I=h.sent();h.label=3;case 3:m=I,b=f||g===m;if(!b&&(t===null||t===void 0?void 0:t.update)){;S=p?"dependencies":d?"devDependencies":null;S&&((w=u[S])===null||w===void 0?void 0:w[e])!==m&&(u[S]=(O=u[S])!==null&&O!==void 0?O:{},u[S][e]=m,D(s,u,{isJson:!0}),_.info('Updated "'.concat(e,'" to version ').concat(m)))}return[2,{isCurrentProject:f,installedPath:s,file:u,isUpToDate:b}];case 4:E=h.sent();return[2,(_.error('Error checking package "'.concat(e,'": ').concat(E.message)),l({},A))];case 5:return[2]}})});return U.apply(this,arguments)}function J(){return K.apply(this,arguments)}function K(){K=o(function(){var e,t,n,r,o,a,i,c,s,u,l,f;return h(this,function(p){switch(p.label){case 0:e=[{command:function(){return eq.pnpmInstallStandard()},message:"Installing dependencies (standard)"},{command:function(){return eq.pnpmInstallLegacy()},message:"Retrying with legacy peer dependencies"},{command:function(){return eq.pnpmInstallForce()},message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);o=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(a=o.next()).done))return[3,8];i=a.value,c=i.command,s=i.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,c()];case 4:u=p.sent();return[4,en("".concat(s," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();_.warn("Installation attempt failed: ".concat(s)),_.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:f=p.sent();n=true;r=f;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return K.apply(this,arguments)}function W(e,t){return Y.apply(this,arguments)}function Y(){Y=o(function(e,t){var n,r,o,a,i,c,s,u,f,d,v;return h(this,function(h){switch(h.label){case 0:if(!L(eY.PACKAGE_JSON)){_.error("package.json not found. Aborting setup.");return[2]}h.label=1;case 1:h.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return M(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=h.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,J()];case 3:r=h.sent();h.label=4;case 4:r;a=true,i=false,c=undefined;h.label=5;case 5:h.trys.push([5,10,11,12]);s=((o=t===null||t===void 0?void 0:t.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();h.label=6;case 6:if(!!(a=(u=s.next()).done))return[3,9];f=u.value;return[4,f()];case 7:h.sent();h.label=8;case 8:a=true;return[3,6];case 9:return[3,12];case 10:d=h.sent();i=true;c=d;return[3,12];case 11:try{if(!a&&s.return!=null){s.return()}}finally{if(i){throw c}}return[7];case 12:return[3,14];case 13:v=h.sent();throw _.error('Failed to setup "'.concat(e.join(", "),'": ').concat(v.message)),v;case 14:return[2]}})});return Y.apply(this,arguments)}var B=N.promisify(C);function H(e){return"error_list:".concat(e)}function $(e){return q.apply(this,arguments)}function q(){q=o(function(e){var t,n,r;return h(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];t=Date.now(),n=H(t);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,eX.set(n,{errors:e,timestamp:t})];case 2:a.sent(),setTimeout(/*#__PURE__*/o(function(){var e;return h(this,function(t){switch(t.label){case 0:return[4,eX.getLogLink(n)];case 1:e=t.sent();e&&_.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=a.sent();_.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return q.apply(this,arguments)}function Q(e){var t=[],n=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,i=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c,s,u,l,f;var p=o.exec(e)||[],d=a.exec(e)||[],v=i.exec(e)||[];var h,y,g,m,b,I;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]==="error"?"error":"warning",message:(h=p===null||p===void 0?void 0:(c=p[4])===null||c===void 0?void 0:c.trim())!==null&&h!==void 0?h:"",rule:(y=p===null||p===void 0?void 0:(s=p[5])===null||s===void 0?void 0:s.trim())!==null&&y!==void 0?y:""}):d.length?t.push({file:(g=d===null||d===void 0?void 0:d[1])!==null&&g!==void 0?g:"",position:"".concat(d[2],":").concat(d[3]),type:d[4]==="error"?"error":"warning",message:(m=d===null||d===void 0?void 0:(u=d[5])===null||u===void 0?void 0:u.trim())!==null&&m!==void 0?m:""}):v.length?t.push({file:"commitlint",type:"error",message:(b=v===null||v===void 0?void 0:(l=v[1])===null||l===void 0?void 0:l.trim())!==null&&b!==void 0?b:"",rule:(I=v===null||v===void 0?void 0:(f=v[2])===null||f===void 0?void 0:f.trim())!==null&&I!==void 0?I:""}):n.push(e.trim())}}),t.length&&$(t),O&&n.length&&(_.warn("Unmatched lines:"),n.forEach(function(e){return _.info(" ".concat(e))}))}function z(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,o=e.line,a=e.column,i=e.ruleId,c=e.message;n.push({type:r===2?"error":"warning",file:t,position:"".concat(o,":").concat(a),rule:i,message:c})})}),n.length&&$(n)}catch(t){Q(e)}}function V(e){return X.apply(this,arguments)}function X(){X=o(function(e){var t,n,r,o,a,i,c,s,u;var l=arguments;return h(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:z;n=new AbortController;k.on("SIGINT",function(){_.warn("Process interrupted. Terminating..."),n.abort(),k.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,B(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),o=r.stdout,a=r.stderr;[o,a].forEach(function(e){return e&&t(e)});return[3,4];case 3:i=f.sent();c=i.stdout,s=i.stderr,u=i.message;[c,s].forEach(function(e){return e&&t(e)}),!s&&!c&&_.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return X.apply(this,arguments)}function Z(e){return{raw:!0,cmd:e}}function ee(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ex," ").concat(es," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ex," ").concat(eR," ").concat(eS," ").concat(e):"".concat(ex," ").concat(ew," ").concat(e)}function et(e,t){return typeof e=="function"?ee(e(t),t):(typeof e==="undefined"?"undefined":d(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?ee(e,t):e}function en(e,t){return er.apply(this,arguments)}function er(){er=o(function(e,t){var n;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);_.start("".concat(e)),O&&_.info("→ ".concat(t));return[4,V(t)];case 1:r.sent(),_.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw _.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return er.apply(this,arguments)}import*as eo from"node:path";function ea(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eo).resolve.apply(r,[ec].concat(p(t)))}function ei(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eo).join.apply(r,p(t))}var ec=T.env.INIT_CWD||T.cwd(),es="@cyberskill/shared",eu=".cyberskill-storage",el="node_modules",ef="dist",ep="package.json",ed="package-lock.json",ev="tsconfig.json",eh=".gitignore",ey=".simple-git-hooks.json",eg="pnpm-lock.yaml",em=".git/hooks/",eb=".git/COMMIT_EDITMSG",eI=ei(ec,el,es,ef),ew="cyberskill",eS="src/nodejs/cli/index.ts",eO="eslint",eE="eslint",e_="vitest",eT="playwright",eC="vitest",ek="@commitlint/cli",eN="commitlint",eA="lint-staged",ej="lint-staged",eG="typescript",eL="tsc",eR="tsx",eD="git",eP="pnpm",ex="pnpm exec",eF="simple-git-hooks",eM="simple-git-hooks",eU="@eslint/config-inspector",eJ="eslint-config-inspector",eK="node-modules-inspector",eW="node-modules-inspector",eY={CYBERSKILL_DIRECTORY:eI,WORKING_DIRECTORY:ec,TS_CONFIG:ea(ev),GIT_IGNORE:ea(eh),GIT_HOOK:ea(em),GIT_COMMIT_MSG:ea(eb),SIMPLE_GIT_HOOKS_JSON:ea(ey),PACKAGE_JSON:ea(ep),PACKAGE_LOCK_JSON:ea(ed),PNPM_LOCK_YAML:ea(eg),NODE_MODULES:ea(el),LINT_STAGED_CONFIG:ea("".concat(eI,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:ea("".concat(eI,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:ea("".concat(eI,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ea("".concat(eI,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ea("".concat(eI,"/react/vitest/vitest.e2e.js"))};function eB(e){return eH.apply(this,arguments)}function eH(){eH=o(function(e){var t,n,r,o,a,i;var c=arguments;return h(this,function(s){switch(s.label){case 0:for(t=c.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=c[r]}o=f(n,2),a=o[0],i=o[1];if(!a)throw new Error("'first' argument is undefined");switch(e){case"CLI":return[3,1];case"RAW":return[3,3]}return[3,4];case 1:return[4,W(a.split(" "),{update:!0})];case 2:return[2,(s.sent(),et(Z("".concat(ex," ").concat(i))))];case 3:return[2,et(Z(a))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eH.apply(this,arguments)}function e$(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/o(function(){return h(this,function(t){return[2,eB.apply(void 0,[e].concat(p(n)))]})})}var eq={simpleGitHooks:e$("CLI",eF,eM),eslintInspect:e$("CLI",eU,eJ),nodeModulesInspect:e$("CLI",eK,eW),eslintCheck:e$("CLI",eO,"".concat(eE," ").concat(eY.WORKING_DIRECTORY)),eslintFix:e$("CLI",eO,"".concat(eE," ").concat(eY.WORKING_DIRECTORY," --fix")),typescriptCheck:e$("CLI",eG,"".concat(eL," -p ").concat(eY.TS_CONFIG," --noEmit")),configureGitHook:e$("RAW","".concat(eD," config core.hooksPath ").concat(eY.GIT_HOOK)),testUnit:e$("CLI",e_,"".concat(eC," --config ").concat(eY.UNIT_TEST_CONFIG)),testE2e:e$("CLI","".concat(e_," ").concat(eT),"".concat(eC," --config ").concat(eY.E2E_TEST_CONFIG)),commitLint:e$("CLI",ek,"".concat(eN," --edit ").concat(eY.GIT_COMMIT_MSG," --config ").concat(eY.COMMITLINT_CONFIG)),lintStaged:e$("CLI",eA,"".concat(ej," --config ").concat(eY.LINT_STAGED_CONFIG)),stageBuildDirectory:e$("RAW","".concat(eD," add ").concat(ef)),build:e$("RAW","".concat(eP," run build")),pnpmInstallStandard:e$("RAW","".concat(eP," install")),pnpmInstallLegacy:e$("RAW","".concat(eP," install --legacy-peer-deps")),pnpmInstallForce:e$("RAW","".concat(eP," install --force"))};function eQ(){return m.env.CYBERSKILL_STORAGE_DIR||ei(g.homedir(),eu)}function ez(){return eV.apply(this,arguments)}function eV(){eV=o(function(){var e;return h(this,function(t){switch(t.label){case 0:e=y.defaultInstance;if(e)return[3,2];return[4,y.init({dir:eQ(),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 eX={get:function e(e){return o(function(){var t,n;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ez()];case 1:r.sent();return[4,y.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(_.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return o(function(){var n;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ez()];case 1:r.sent();return[4,y.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();_.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return o(function(){var t;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ez()];case 1:n.sent();return[4,y.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();_.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return o(function(){var e,t;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ez()];case 1:n.sent();return[4,y.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(_.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(_.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return o(function(){return h(this,function(t){try{return[2,"".concat(eQ()," (key: ").concat(e,")")]}catch(e){return[2,(_.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};export{eX as storageNodeJS};
@@ -0,0 +1,266 @@
1
+ {
2
+ "name": "@cyberskill/shared",
3
+ "type": "module",
4
+ "version": "1.79.0",
5
+ "description": "CyberSkill Shared",
6
+ "author": "Stephen Cheng",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/cyberskill-world/shared#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/cyberskill-world/shared.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/cyberskill-world/shared/issues"
15
+ },
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js",
20
+ "require": "./dist/index.cjs"
21
+ },
22
+ "./configs": {
23
+ "types": "./dist/configs/index.d.ts",
24
+ "import": "./dist/configs/index.js",
25
+ "require": "./dist/configs/index.cjs"
26
+ },
27
+ "./configs/commitlint": {
28
+ "types": "./dist/configs/commitlint/index.d.ts",
29
+ "import": "./dist/configs/commitlint/index.js",
30
+ "require": "./dist/configs/commitlint/index.cjs"
31
+ },
32
+ "./configs/eslint": {
33
+ "types": "./dist/configs/eslint/index.d.ts",
34
+ "import": "./dist/configs/eslint/index.js",
35
+ "require": "./dist/configs/eslint/index.cjs"
36
+ },
37
+ "./configs/graphql-codegen": {
38
+ "types": "./dist/configs/graphql-codegen/index.d.ts",
39
+ "import": "./dist/configs/graphql-codegen/index.js",
40
+ "require": "./dist/configs/graphql-codegen/index.cjs"
41
+ },
42
+ "./configs/lint-staged": {
43
+ "types": "./dist/configs/lint-staged/index.d.ts",
44
+ "import": "./dist/configs/lint-staged/index.js",
45
+ "require": "./dist/configs/lint-staged/index.cjs"
46
+ },
47
+ "./configs/tsconfig": "./dist/configs/tsconfig/tsconfig.base.json",
48
+ "./constants": {
49
+ "types": "./dist/constants/index.d.ts",
50
+ "import": "./dist/constants/index.js",
51
+ "require": "./dist/constants/index.cjs"
52
+ },
53
+ "./nodejs": {
54
+ "types": "./dist/nodejs/index.d.ts",
55
+ "import": "./dist/nodejs/index.js",
56
+ "require": "./dist/nodejs/index.cjs"
57
+ },
58
+ "./nodejs/cli": {
59
+ "types": "./dist/nodejs/cli/index.d.ts",
60
+ "import": "./dist/nodejs/cli/index.js",
61
+ "require": "./dist/nodejs/cli/index.cjs"
62
+ },
63
+ "./nodejs/command": {
64
+ "types": "./dist/nodejs/command/index.d.ts",
65
+ "import": "./dist/nodejs/command/index.js",
66
+ "require": "./dist/nodejs/command/index.cjs"
67
+ },
68
+ "./nodejs/fs": {
69
+ "types": "./dist/nodejs/fs/index.d.ts",
70
+ "import": "./dist/nodejs/fs/index.js",
71
+ "require": "./dist/nodejs/fs/index.cjs"
72
+ },
73
+ "./nodejs/log": {
74
+ "types": "./dist/nodejs/log/index.d.ts",
75
+ "import": "./dist/nodejs/log/index.js",
76
+ "require": "./dist/nodejs/log/index.cjs"
77
+ },
78
+ "./nodejs/mongo": {
79
+ "types": "./dist/nodejs/mongo/index.d.ts",
80
+ "import": "./dist/nodejs/mongo/index.js",
81
+ "require": "./dist/nodejs/mongo/index.cjs"
82
+ },
83
+ "./nodejs/package": {
84
+ "types": "./dist/nodejs/package/index.d.ts",
85
+ "import": "./dist/nodejs/package/index.js",
86
+ "require": "./dist/nodejs/package/index.cjs"
87
+ },
88
+ "./nodejs/path": {
89
+ "types": "./dist/nodejs/path/index.d.ts",
90
+ "import": "./dist/nodejs/path/index.js",
91
+ "require": "./dist/nodejs/path/index.cjs"
92
+ },
93
+ "./nodejs/storage": {
94
+ "types": "./dist/nodejs/storage/index.d.ts",
95
+ "import": "./dist/nodejs/storage/index.js",
96
+ "require": "./dist/nodejs/storage/index.cjs"
97
+ },
98
+ "./react": {
99
+ "types": "./dist/react/index.d.ts",
100
+ "import": "./dist/react/index.js",
101
+ "require": "./dist/react/index.cjs"
102
+ },
103
+ "./react/apollo-client": {
104
+ "types": "./dist/react/apollo-client/index.d.ts",
105
+ "import": "./dist/react/apollo-client/index.js",
106
+ "require": "./dist/react/apollo-client/index.cjs"
107
+ },
108
+ "./react/apollo-error": {
109
+ "types": "./dist/react/apollo-error/index.d.ts",
110
+ "import": "./dist/react/apollo-error/index.js",
111
+ "require": "./dist/react/apollo-error/index.cjs"
112
+ },
113
+ "./react/i18next": {
114
+ "types": "./dist/react/i18next/index.d.ts",
115
+ "import": "./dist/react/i18next/index.js",
116
+ "require": "./dist/react/i18next/index.cjs"
117
+ },
118
+ "./react/loading": {
119
+ "types": "./dist/react/loading/index.d.ts",
120
+ "import": "./dist/react/loading/index.js",
121
+ "require": "./dist/react/loading/index.cjs"
122
+ },
123
+ "./react/log": {
124
+ "types": "./dist/react/log/index.d.ts",
125
+ "import": "./dist/react/log/index.js",
126
+ "require": "./dist/react/log/index.cjs"
127
+ },
128
+ "./react/next-intl": {
129
+ "types": "./dist/react/next-intl/index.d.ts",
130
+ "import": "./dist/react/next-intl/index.js",
131
+ "require": "./dist/react/next-intl/index.cjs"
132
+ },
133
+ "./react/storage": {
134
+ "types": "./dist/react/storage/index.d.ts",
135
+ "import": "./dist/react/storage/index.js",
136
+ "require": "./dist/react/storage/index.cjs"
137
+ },
138
+ "./react/toast": {
139
+ "types": "./dist/react/toast/index.d.ts",
140
+ "import": "./dist/react/toast/index.js",
141
+ "require": "./dist/react/toast/index.cjs"
142
+ },
143
+ "./react/vitest": {
144
+ "types": "./dist/react/vitest/index.d.ts",
145
+ "import": "./dist/react/vitest/index.js",
146
+ "require": "./dist/react/vitest/index.cjs"
147
+ },
148
+ "./styles/reset.css": {
149
+ "import": "./dist/styles/reset.css",
150
+ "require": "./dist/styles/reset.css"
151
+ },
152
+ "./typescript": {
153
+ "types": "./dist/typescript/index.d.ts",
154
+ "import": "./dist/typescript/index.js",
155
+ "require": "./dist/typescript/index.cjs"
156
+ },
157
+ "./utils": {
158
+ "types": "./dist/utils/index.d.ts",
159
+ "import": "./dist/utils/index.js",
160
+ "require": "./dist/utils/index.cjs"
161
+ }
162
+ },
163
+ "main": "./dist/index.cjs",
164
+ "module": "./dist/index.js",
165
+ "types": "./dist/index.d.ts",
166
+ "bin": {
167
+ "cyberskill": "./dist/nodejs/cli/index.js"
168
+ },
169
+ "files": [
170
+ "dist",
171
+ "public"
172
+ ],
173
+ "scripts": {
174
+ "build": "tsup",
175
+ "dev": "dotenv -e .env -- tsup --watch",
176
+ "lint": "dotenv -e .env -- tsx src/nodejs/cli/index.ts lint",
177
+ "lint:fix": "dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix",
178
+ "lint:inspect": "dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",
179
+ "reset": "dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",
180
+ "setup": "dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",
181
+ "inspect": "dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect",
182
+ "test:unit": "dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit",
183
+ "test:e2e": "dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",
184
+ "commitlint": "dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint",
185
+ "lint-staged": "dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"
186
+ },
187
+ "dependencies": {
188
+ "@antfu/eslint-config": "4.12.0",
189
+ "@apollo/client": "3.13.7",
190
+ "@eddeee888/gcg-typescript-resolver-files": "0.12.0",
191
+ "@eslint-react/eslint-plugin": "1.47.4",
192
+ "@graphql-codegen/cli": "5.0.5",
193
+ "@graphql-codegen/client-preset": "4.8.0",
194
+ "@microsoft/api-extractor": "7.52.3",
195
+ "@next/eslint-plugin-next": "15.3.0",
196
+ "@swc/core": "1.11.21",
197
+ "@testing-library/jest-dom": "6.6.3",
198
+ "@testing-library/react": "16.3.0",
199
+ "@vitejs/plugin-react-swc": "3.9.0",
200
+ "@vitest/browser": "3.1.1",
201
+ "chalk": "5.4.1",
202
+ "classnames": "2.5.1",
203
+ "consola": "3.4.2",
204
+ "crypto-js": "4.2.0",
205
+ "date-fns": "4.1.0",
206
+ "dotenv-cli": "8.0.0",
207
+ "eslint-config-next": "15.3.0",
208
+ "eslint-plugin-format": "1.0.1",
209
+ "eslint-plugin-react-hooks": "5.2.0",
210
+ "eslint-plugin-react-refresh": "0.4.19",
211
+ "globals": "16.0.0",
212
+ "graphql": "16.10.0",
213
+ "graphql-ws": "6.0.4",
214
+ "i18next": "25.0.0",
215
+ "jsdom": "26.1.0",
216
+ "localforage": "1.10.0",
217
+ "modern-normalize": "3.0.1",
218
+ "mongodb": "6.15.0",
219
+ "mongoose": "8.13.2",
220
+ "mongoose-aggregate-paginate-v2": "1.1.4",
221
+ "mongoose-paginate-v2": "1.9.0",
222
+ "next-intl": "4.0.2",
223
+ "node-fetch": "3.3.2",
224
+ "node-persist": "4.0.4",
225
+ "ora": "8.2.0",
226
+ "playwright": "1.51.1",
227
+ "postcss-modules": "6.0.1",
228
+ "qs": "6.14.0",
229
+ "react": "19.1.0",
230
+ "react-dom": "19.1.0",
231
+ "react-hot-toast": "2.5.2",
232
+ "react-i18next": "15.4.1",
233
+ "react-icons": "5.5.0",
234
+ "sass": "1.86.3",
235
+ "slugify": "1.6.6",
236
+ "tsup": "8.4.0",
237
+ "tsx": "4.19.3",
238
+ "typescript": "5.8.3",
239
+ "unorm": "1.6.0",
240
+ "uuid": "11.1.0",
241
+ "vite": "6.2.6",
242
+ "vitest": "3.1.1",
243
+ "vitest-browser-react": "0.1.1",
244
+ "yargs": "17.7.2"
245
+ },
246
+ "publishConfig": {
247
+ "access": "public",
248
+ "registry": "https://registry.npmjs.org/"
249
+ },
250
+ "devDependencies": {
251
+ "@commitlint/cli": "19.8.0",
252
+ "@eslint/config-inspector": "1.0.2",
253
+ "@types/crypto-js": "4.2.2",
254
+ "@types/mongoose-aggregate-paginate-v2": "1.0.12",
255
+ "@types/node-persist": "3.1.8",
256
+ "@types/react": "19.1.2",
257
+ "@types/react-dom": "19.1.2",
258
+ "@types/unorm": "1.3.31",
259
+ "@types/uuid": "10.0.0",
260
+ "@types/yargs": "17.0.33",
261
+ "eslint": "9.24.0",
262
+ "lint-staged": "15.5.1",
263
+ "node-modules-inspector": "0.6.6",
264
+ "simple-git-hooks": "2.12.1"
265
+ }
266
+ }
@@ -1 +1 @@
1
- "use strict";function r(r,e){if(e==null||e>r.length)e=r.length;for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}function e(r){if(Array.isArray(r))return r}function n(e){if(Array.isArray(e))return r(e)}function t(r){if(r===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return r}function o(r,e,n){e=c(e);return g(r,k()?Reflect.construct(e,n||[],c(r).constructor):e.apply(r,n))}function i(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function a(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||false;t.configurable=true;if("value"in t)t.writable=true;Object.defineProperty(r,t.key,t)}}function l(r,e,n){if(e)a(r.prototype,e);if(n)a(r,n);return r}function u(r,e,n){if(e in r){Object.defineProperty(r,e,{value:n,enumerable:true,configurable:true,writable:true})}else{r[e]=n}return r}function c(r){c=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return c(r)}function s(r,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:true,configurable:true}});if(e)w(r,e)}function f(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function p(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function d(r,e){var n=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(n==null)return;var t=[];var o=true;var i=false;var a,l;try{for(n=n.call(r);!(o=(a=n.next()).done);o=true){t.push(a.value);if(e&&t.length===e)break}}catch(r){i=true;l=r}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw l}}return t}function v(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(){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 m(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};var t=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){t=t.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))}t.forEach(function(e){u(r,e,n[e])})}return r}function b(r,e){if(r==null)return{};var n=h(r,e);var t,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(o=0;o<i.length;o++){t=i[o];if(e.indexOf(t)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,t))continue;n[t]=r[t]}}return n}function h(r,e){if(r==null)return{};var n={};var t=Object.keys(r);var o,i;for(i=0;i<t.length;i++){o=t[i];if(e.indexOf(o)>=0)continue;n[o]=r[o]}return n}function g(r,e){if(e&&(O(e)==="object"||typeof e==="function")){return e}return t(r)}function w(r,e){w=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return w(r,e)}function j(r,n){return e(r)||d(r,n)||E(r,n)||v()}function x(r){return n(r)||p(r)||E(r)||y()}function O(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function E(e,n){if(!e)return;if(typeof e==="string")return r(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return r(e,n)}function k(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(k=function(){return!!r})()}var P=Object.create;var S=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var I=function(r,e){for(var n in e)S(r,n,{get:e[n],enumerable:!0})},C=function(r,e,n,t){var o=true,i=false,a=undefined;if(e&&(typeof e==="undefined"?"undefined":O(e))=="object"||typeof e=="function")try{var l=function(){var o=c.value;!N.call(r,o)&&o!==n&&S(r,o,{get:function(){return e[o]},enumerable:!(t=q(e,o))||t.enumerable})};for(var u=A(e)[Symbol.iterator](),c;!(o=(c=u.next()).done);o=true)l()}catch(r){i=true;a=r}finally{try{if(!o&&u.return!=null){u.return()}}finally{if(i){throw a}}}return r};var _=function(r,e,n){return n=r!=null?P(L(r)):{},C(e||!r||!r.__esModule?S(n,"default",{value:r,enumerable:!0}):n,r)},M=function(r){return C(S({},"__esModule",{value:!0}),r)};var U={};I(U,{ApolloProvider:function(){return rf}});module.exports=M(U);var T=require("@apollo/client"),Q=require("@apollo/client/link/error"),R=require("@apollo/client/link/remove-typename"),D=require("@apollo/client/link/subscriptions"),F=require("@apollo/client/utilities"),G=require("graphql-ws"),J=require("react"),B=require("react-icons/fa6");var H=require("react"),W=require("react-icons/fa6");var V=require("react"),$=(0,V.createContext)(void 0);var z=_(require("../apollo-error/apollo-error.module.scss"),1),K=require("react/jsx-runtime");function X(){var r=(0,H.use)($),e=r===null||r===void 0?void 0:r.error;if(!e)return null;var n=function(r,e){return(e===null||e===void 0?void 0:e.length)?(0,K.jsxs)("div",{children:[(0,K.jsxs)("strong",{children:[r,":"]}),(0,K.jsx)("ul",{children:e.map(function(r){return(0,K.jsx)("li",{children:r.message},r.message)})})]}):null};return(0,K.jsx)("div",{className:z.default["modal-backdrop"],children:(0,K.jsxs)("div",{className:z.default["modal-content"],children:[(0,K.jsx)("button",{type:"button",className:z.default["btn-close"],onClick:r.hideError,children:"✕"}),(0,K.jsxs)("div",{className:z.default["error-title"],children:[(0,K.jsx)("button",{type:"button",className:z.default["btn-retry"],onClick:function(){return window.location.reload()},children:(0,K.jsx)(W.FaRepeat,{})})," ",e.message]}),(0,K.jsxs)("div",{className:z.default["error-details"],children:[e.networkError&&(0,K.jsxs)("pre",{className:"network",children:[(0,K.jsx)("strong",{children:"Network Error:"})," ",e.networkError.message]}),n("GraphQL Errors",x(e.graphQLErrors)),n("Protocol Errors",x(e.protocolErrors)),n("Client Errors",x(e.clientErrors)),e.extraInfo&&(0,K.jsxs)("pre",{className:"extra",children:[(0,K.jsx)("strong",{children:"Extra Info:"})," ",JSON.stringify(e.extraInfo,null,4)]})]})]})})}var Y=require("react");var Z=require("react");var rr=require("react/jsx-runtime"),re=null;function rn(r){re===null||re===void 0?void 0:re(r)}function rt(r){var e=r.children;var n=j((0,Z.useState)(null),2),t=n[0],o=n[1];(0,Z.useEffect)(function(){re=o},[]);var i=(0,Z.useMemo)(function(){return{error:t,showError:o,hideError:function(){return o(null)}}},[t]);return(0,rr.jsx)($,{value:i,children:e})}var ro=require("consola/browser"),ri={silent:ro.consola.silent,level:ro.consola.level,fatal:ro.consola.fatal,error:ro.consola.error,warn:ro.consola.warn,log:ro.consola.log,info:ro.consola.info,success:ro.consola.success,ready:ro.consola.ready,start:ro.consola.start,box:ro.consola.box,debug:ro.consola.debug,trace:ro.consola.trace,verbose:ro.consola.verbose};var ra=require("react-hot-toast");var rl="/graphql";var ru=require("react/jsx-runtime"),rc=/*#__PURE__*/function(r){s(e,r);function e(){i(this,e);var r;r=o(this,e,arguments);r.count=0;return r}l(e,[{key:"request",value:function r(r,e){var n=this;var t=Date.now();return this.count+=1,e(r).map(function(e){var o=Date.now()-t,i=r.operationName||"Unnamed";return ri.info("[Apollo] #".concat(n.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(T.ApolloLink);function rs(r){var e=r||{},n=e.uri,t=e.wsUrl,o=e.customLinks,i=new rc,a=(0,Q.onError)(function(r){var e=r.graphQLErrors,n=r.networkError,t=r.protocolErrors,o=r.operation;var i=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,n=r.locations,t=r.path;ri.error("[GraphQL error] ".concat(i,": ").concat(e,", Location: ").concat(JSON.stringify(n),", Path: ").concat(t))}),t&&t.forEach(function(r){var e=r.message,n=r.extensions;ri.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(n)))}),n&&ri.error("[Network error]: ".concat(n)),e||t||n){var a,l;var u=(e===null||e===void 0?void 0:(a=e[0])===null||a===void 0?void 0:a.message)||(t===null||t===void 0?void 0:(l=t[0])===null||l===void 0?void 0:l.message)||(n===null||n===void 0?void 0:n.message)||"Unexpected error",c=new T.ApolloError({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:u,extraInfo:{operation:o}});ra.toast.error(function(r){return(0,ru.jsxs)(ru.Fragment,{children:[u,"\xa0",(0,ru.jsx)(B.FaInfo,{cursor:"pointer",onClick:function(){setTimeout(function(){rn(c)},0),ra.toast.dismiss(r.id)}})]})})}}),l=(0,R.removeTypenameFromVariables)();n||ri.warn('[Apollo] No GraphQL URI provided — using "'.concat(rl,'" as default'));var u=new T.HttpLink({uri:n!==null&&n!==void 0?n:rl,credentials:"include"}),c=t?new D.GraphQLWsLink((0,G.createClient)({url:t})):T.ApolloLink.empty(),s=f(c,T.ApolloLink)?(0,T.split)(function(r){var e=r.query;var n=(0,F.getMainDefinition)(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},c,u):u;return s===u&&t&&ri.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,a,l].concat(x(o!==null&&o!==void 0?o:[]),[s])}function rf(r){var e=r.isNextJS,n=r.options,t=r.children,o=r.client,i=r.provider,a=r.cache;var l=n||{},u=l.uri,c=l.wsUrl,s=l.customLinks,p=b(l,["uri","wsUrl","customLinks"]),d=o!==null&&o!==void 0?o:T.ApolloClient;if(typeof d!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var v=i||T.ApolloProvider,y=(0,J.useMemo)(function(){return(0,T.from)(rs({uri:u,wsUrl:c,customLinks:s}))},[u,c,s]),h=(0,J.useMemo)(function(){return f(a,T.InMemoryCache)?a:new T.InMemoryCache},[a]),g=(0,J.useMemo)(function(){return new d(m({link:y,cache:h},p))},[d,y,h,p]);return(0,ru.jsxs)(ru.Fragment,{children:[(0,ru.jsxs)(rt,{children:[e?(0,ru.jsx)(v,{makeClient:function(){return g},children:t}):(0,ru.jsx)(v,{client:g,children:t}),(0,ru.jsx)(X,{})]}),(0,ru.jsx)(ra.Toaster,{position:"top-right"})]})}0&&(module.exports={ApolloProvider:ApolloProvider});
1
+ "use strict";function r(r,e){if(e==null||e>r.length)e=r.length;for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}function e(r){if(Array.isArray(r))return r}function n(e){if(Array.isArray(e))return r(e)}function t(r){if(r===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return r}function o(r,e,n){e=c(e);return g(r,k()?Reflect.construct(e,n||[],c(r).constructor):e.apply(r,n))}function i(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function a(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||false;t.configurable=true;if("value"in t)t.writable=true;Object.defineProperty(r,t.key,t)}}function l(r,e,n){if(e)a(r.prototype,e);if(n)a(r,n);return r}function u(r,e,n){if(e in r){Object.defineProperty(r,e,{value:n,enumerable:true,configurable:true,writable:true})}else{r[e]=n}return r}function c(r){c=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return c(r)}function s(r,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:true,configurable:true}});if(e)w(r,e)}function f(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function p(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function d(r,e){var n=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(n==null)return;var t=[];var o=true;var i=false;var a,l;try{for(n=n.call(r);!(o=(a=n.next()).done);o=true){t.push(a.value);if(e&&t.length===e)break}}catch(r){i=true;l=r}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw l}}return t}function v(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(){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 m(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};var t=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){t=t.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))}t.forEach(function(e){u(r,e,n[e])})}return r}function b(r,e){if(r==null)return{};var n=h(r,e);var t,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(o=0;o<i.length;o++){t=i[o];if(e.indexOf(t)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,t))continue;n[t]=r[t]}}return n}function h(r,e){if(r==null)return{};var n={};var t=Object.keys(r);var o,i;for(i=0;i<t.length;i++){o=t[i];if(e.indexOf(o)>=0)continue;n[o]=r[o]}return n}function g(r,e){if(e&&(O(e)==="object"||typeof e==="function")){return e}return t(r)}function w(r,e){w=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return w(r,e)}function j(r,n){return e(r)||d(r,n)||E(r,n)||v()}function x(r){return n(r)||p(r)||E(r)||y()}function O(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function E(e,n){if(!e)return;if(typeof e==="string")return r(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return r(e,n)}function k(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(k=function(){return!!r})()}var P=Object.create;var S=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var I=function(r,e,n){return e in r?S(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n};var C=function(r,e){for(var n in e)S(r,n,{get:e[n],enumerable:!0})},_=function(r,e,n,t){var o=true,i=false,a=undefined;if(e&&(typeof e==="undefined"?"undefined":O(e))=="object"||typeof e=="function")try{var l=function(){var o=c.value;!N.call(r,o)&&o!==n&&S(r,o,{get:function(){return e[o]},enumerable:!(t=q(e,o))||t.enumerable})};for(var u=A(e)[Symbol.iterator](),c;!(o=(c=u.next()).done);o=true)l()}catch(r){i=true;a=r}finally{try{if(!o&&u.return!=null){u.return()}}finally{if(i){throw a}}}return r};var M=function(r,e,n){return n=r!=null?P(L(r)):{},_(e||!r||!r.__esModule?S(n,"default",{value:r,enumerable:!0}):n,r)},U=function(r){return _(S({},"__esModule",{value:!0}),r)};var T=function(r,e,n){return I(r,(typeof e==="undefined"?"undefined":O(e))!="symbol"?e+"":e,n)};var Q={};C(Q,{ApolloProvider:function(){return rd}});module.exports=U(Q);var R=require("@apollo/client"),D=require("@apollo/client/link/error"),F=require("@apollo/client/link/remove-typename"),G=require("@apollo/client/link/subscriptions"),J=require("@apollo/client/utilities"),B=require("graphql-ws"),H=require("react"),W=require("react-icons/fa6");var V=require("react"),$=require("react-icons/fa6");var z=require("react"),K=(0,z.createContext)(void 0);var X=M(require("../apollo-error/apollo-error.module.scss"),1),Y=require("react/jsx-runtime");function Z(){var r=(0,V.use)(K),e=r===null||r===void 0?void 0:r.error;if(!e)return null;var n=function(r,e){return(e===null||e===void 0?void 0:e.length)?(0,Y.jsxs)("div",{children:[(0,Y.jsxs)("strong",{children:[r,":"]}),(0,Y.jsx)("ul",{children:e.map(function(r){return(0,Y.jsx)("li",{children:r.message},r.message)})})]}):null};return(0,Y.jsx)("div",{className:X.default["modal-backdrop"],children:(0,Y.jsxs)("div",{className:X.default["modal-content"],children:[(0,Y.jsx)("button",{type:"button",className:X.default["btn-close"],onClick:r.hideError,children:"✕"}),(0,Y.jsxs)("div",{className:X.default["error-title"],children:[(0,Y.jsx)("button",{type:"button",className:X.default["btn-retry"],onClick:function(){return window.location.reload()},children:(0,Y.jsx)($.FaRepeat,{})})," ",e.message]}),(0,Y.jsxs)("div",{className:X.default["error-details"],children:[e.networkError&&(0,Y.jsxs)("pre",{className:"network",children:[(0,Y.jsx)("strong",{children:"Network Error:"})," ",e.networkError.message]}),n("GraphQL Errors",x(e.graphQLErrors)),n("Protocol Errors",x(e.protocolErrors)),n("Client Errors",x(e.clientErrors)),e.extraInfo&&(0,Y.jsxs)("pre",{className:"extra",children:[(0,Y.jsx)("strong",{children:"Extra Info:"})," ",JSON.stringify(e.extraInfo,null,4)]})]})]})})}var rr=require("react");var re=require("react");var rn=require("react/jsx-runtime"),rt=null;function ro(r){rt===null||rt===void 0?void 0:rt(r)}function ri(r){var e=r.children;var n=j((0,re.useState)(null),2),t=n[0],o=n[1];(0,re.useEffect)(function(){rt=o},[]);var i=(0,re.useMemo)(function(){return{error:t,showError:o,hideError:function(){return o(null)}}},[t]);return(0,rn.jsx)(K,{value:i,children:e})}var ra=require("consola/browser"),rl={silent:ra.consola.silent,level:ra.consola.level,fatal:ra.consola.fatal,error:ra.consola.error,warn:ra.consola.warn,log:ra.consola.log,info:ra.consola.info,success:ra.consola.success,ready:ra.consola.ready,start:ra.consola.start,box:ra.consola.box,debug:ra.consola.debug,trace:ra.consola.trace,verbose:ra.consola.verbose};var ru=require("react-hot-toast");var rc="/graphql";var rs=require("react/jsx-runtime"),rf=/*#__PURE__*/function(r){s(e,r);function e(){i(this,e);var r;r=o(this,e,arguments);T(r,"count",0);return r}l(e,[{key:"request",value:function r(r,e){var n=this;var t=Date.now();return this.count+=1,e(r).map(function(e){var o=Date.now()-t,i=r.operationName||"Unnamed";return rl.info("[Apollo] #".concat(n.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(R.ApolloLink);function rp(r){var e=r.uri,n=r.wsUrl,t=r.customLinks,o=new rf,i=(0,D.onError)(function(r){var e=r.graphQLErrors,n=r.networkError,t=r.protocolErrors,o=r.operation;var i=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,n=r.locations,t=r.path;rl.error("[GraphQL error] ".concat(i,": ").concat(e,", Location: ").concat(JSON.stringify(n),", Path: ").concat(t))}),t&&t.forEach(function(r){var e=r.message,n=r.extensions;rl.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(n)))}),n&&rl.error("[Network error]: ".concat(n)),e||t||n){var a,l;var u=(e===null||e===void 0?void 0:(a=e[0])===null||a===void 0?void 0:a.message)||(t===null||t===void 0?void 0:(l=t[0])===null||l===void 0?void 0:l.message)||(n===null||n===void 0?void 0:n.message)||"Unexpected error",c=new R.ApolloError({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:u,extraInfo:{operation:o}});ru.toast.error(function(r){return(0,rs.jsxs)(rs.Fragment,{children:[u,"\xa0",(0,rs.jsx)(W.FaInfo,{cursor:"pointer",onClick:function(){setTimeout(function(){ro(c)},0),ru.toast.dismiss(r.id)}})]})})}}),a=(0,F.removeTypenameFromVariables)();e||rl.warn('[Apollo] No GraphQL URI provided — using "'.concat(rc,'" as default'));var l=new R.HttpLink({uri:e!==null&&e!==void 0?e:rc,credentials:"include"}),u=n?new G.GraphQLWsLink((0,B.createClient)({url:n})):R.ApolloLink.empty(),c=f(u,R.ApolloLink)?(0,R.split)(function(r){var e=r.query;var n=(0,J.getMainDefinition)(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},u,l):l;return c===l&&n&&rl.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[o,i,a].concat(x(t!==null&&t!==void 0?t:[]),[c])}function rd(r){var e=r.isNextJS,n=r.options,t=r.children,o=r.client,i=r.provider,a=r.cache;var l=n||{},u=l.uri,c=l.wsUrl,s=l.customLinks,p=b(l,["uri","wsUrl","customLinks"]),d=o!==null&&o!==void 0?o:R.ApolloClient;if(typeof d!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var v=i||R.ApolloProvider,y=(0,H.useMemo)(function(){return(0,R.from)(rp({uri:u!==null&&u!==void 0?u:rc,wsUrl:c!==null&&c!==void 0?c:"",customLinks:s!==null&&s!==void 0?s:[]}))},[u,c,s]),h=(0,H.useMemo)(function(){return f(a,R.InMemoryCache)?a:new R.InMemoryCache},[a]),g=(0,H.useMemo)(function(){return new d(m({link:y,cache:h},p))},[d,y,h,p]);return(0,rs.jsxs)(rs.Fragment,{children:[(0,rs.jsxs)(ri,{children:[e?(0,rs.jsx)(v,{makeClient:function(){return g},children:t}):(0,rs.jsx)(v,{client:g,children:t}),(0,rs.jsx)(Z,{})]}),(0,rs.jsx)(ru.Toaster,{position:"top-right"})]})}0&&(module.exports={ApolloProvider:ApolloProvider});
@@ -1 +1 @@
1
- function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(r){if(Array.isArray(r))return r}function t(e){if(Array.isArray(e))return r(e)}function n(r){if(r===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return r}function o(r,e,t){e=u(e);return w(r,x()?Reflect.construct(e,t||[],u(r).constructor):e.apply(r,t))}function i(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function a(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(r,n.key,n)}}function l(r,e,t){if(e)a(r.prototype,e);if(t)a(r,t);return r}function c(r,e,t){if(e in r){Object.defineProperty(r,e,{value:t,enumerable:true,configurable:true,writable:true})}else{r[e]=t}return r}function u(r){u=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return u(r)}function s(r,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:true,configurable:true}});if(e)g(r,e)}function f(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function p(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function m(r,e){var t=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(t==null)return;var n=[];var o=true;var i=false;var a,l;try{for(t=t.call(r);!(o=(a=t.next()).done);o=true){n.push(a.value);if(e&&n.length===e)break}}catch(r){i=true;l=r}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(i)throw l}}return n}function d(){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 v(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))}n.forEach(function(e){c(r,e,t[e])})}return r}function h(r,e){if(r==null)return{};var t=b(r,e);var n,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(o=0;o<i.length;o++){n=i[o];if(e.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,n))continue;t[n]=r[n]}}return t}function b(r,e){if(r==null)return{};var t={};var n=Object.keys(r);var o,i;for(i=0;i<n.length;i++){o=n[i];if(e.indexOf(o)>=0)continue;t[o]=r[o]}return t}function w(r,e){if(e&&(O(e)==="object"||typeof e==="function")){return e}return n(r)}function g(r,e){g=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return g(r,e)}function E(r,t){return e(r)||m(r,t)||j(r,t)||d()}function k(r){return t(r)||p(r)||j(r)||v()}function O(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function j(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}function x(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(x=function(){return!!r})()}import{ApolloClient as S,ApolloError as A,ApolloLink as P,ApolloProvider as L,from as N,HttpLink as I,InMemoryCache as C,split as _}from"@apollo/client";import{onError as U}from"@apollo/client/link/error";import{removeTypenameFromVariables as T}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as Q}from"@apollo/client/link/subscriptions";import{getMainDefinition as R}from"@apollo/client/utilities";import{createClient as M}from"graphql-ws";import{useMemo as D}from"react";import{FaInfo as q}from"react-icons/fa6";import{use as F}from"react";import{FaRepeat as G}from"react-icons/fa6";import{createContext as J}from"react";var B=J(void 0);import H from"../apollo-error/apollo-error.module.scss";import{jsx as W,jsxs as V}from"react/jsx-runtime";function $(){var r=F(B),e=r===null||r===void 0?void 0:r.error;if(!e)return null;var t=function(r,e){return(e===null||e===void 0?void 0:e.length)?V("div",{children:[V("strong",{children:[r,":"]}),W("ul",{children:e.map(function(r){return W("li",{children:r.message},r.message)})})]}):null};return W("div",{className:H["modal-backdrop"],children:V("div",{className:H["modal-content"],children:[W("button",{type:"button",className:H["btn-close"],onClick:r.hideError,children:"✕"}),V("div",{className:H["error-title"],children:[W("button",{type:"button",className:H["btn-retry"],onClick:function(){return window.location.reload()},children:W(G,{})})," ",e.message]}),V("div",{className:H["error-details"],children:[e.networkError&&V("pre",{className:"network",children:[W("strong",{children:"Network Error:"})," ",e.networkError.message]}),t("GraphQL Errors",k(e.graphQLErrors)),t("Protocol Errors",k(e.protocolErrors)),t("Client Errors",k(e.clientErrors)),e.extraInfo&&V("pre",{className:"extra",children:[W("strong",{children:"Extra Info:"})," ",JSON.stringify(e.extraInfo,null,4)]})]})]})})}import{use as z}from"react";import{useEffect as K,useMemo as X,useState as Y}from"react";import{jsx as Z}from"react/jsx-runtime";var rr=null;function re(r){rr===null||rr===void 0?void 0:rr(r)}function rt(r){var e=r.children;var t=E(Y(null),2),n=t[0],o=t[1];K(function(){rr=o},[]);var i=X(function(){return{error:n,showError:o,hideError:function(){return o(null)}}},[n]);return Z(B,{value:i,children:e})}import{consola as rn}from"consola/browser";var ro={silent:rn.silent,level:rn.level,fatal:rn.fatal,error:rn.error,warn:rn.warn,log:rn.log,info:rn.info,success:rn.success,ready:rn.ready,start:rn.start,box:rn.box,debug:rn.debug,trace:rn.trace,verbose:rn.verbose};import{toast as ri,Toaster as ra}from"react-hot-toast";var rl="/graphql";import{Fragment as rc,jsx as ru,jsxs as rs}from"react/jsx-runtime";var rf=/*#__PURE__*/function(r){"use strict";s(e,r);function e(){i(this,e);var r;r=o(this,e,arguments);r.count=0;return r}l(e,[{key:"request",value:function r(r,e){var t=this;var n=Date.now();return this.count+=1,e(r).map(function(e){var o=Date.now()-n,i=r.operationName||"Unnamed";return ro.info("[Apollo] #".concat(t.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(P);function rp(r){var e=r||{},t=e.uri,n=e.wsUrl,o=e.customLinks,i=new rf,a=U(function(r){var e=r.graphQLErrors,t=r.networkError,n=r.protocolErrors,o=r.operation;var i=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,t=r.locations,n=r.path;ro.error("[GraphQL error] ".concat(i,": ").concat(e,", Location: ").concat(JSON.stringify(t),", Path: ").concat(n))}),n&&n.forEach(function(r){var e=r.message,t=r.extensions;ro.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(t)))}),t&&ro.error("[Network error]: ".concat(t)),e||n||t){var a,l;var c=(e===null||e===void 0?void 0:(a=e[0])===null||a===void 0?void 0:a.message)||(n===null||n===void 0?void 0:(l=n[0])===null||l===void 0?void 0:l.message)||(t===null||t===void 0?void 0:t.message)||"Unexpected error",u=new A({graphQLErrors:e||[],protocolErrors:n||[],clientErrors:[],networkError:t||null,errorMessage:c,extraInfo:{operation:o}});ri.error(function(r){return rs(rc,{children:[c,"\xa0",ru(q,{cursor:"pointer",onClick:function(){setTimeout(function(){re(u)},0),ri.dismiss(r.id)}})]})})}}),l=T();t||ro.warn('[Apollo] No GraphQL URI provided — using "'.concat(rl,'" as default'));var c=new I({uri:t!==null&&t!==void 0?t:rl,credentials:"include"}),u=n?new Q(M({url:n})):P.empty(),s=f(u,P)?_(function(r){var e=r.query;var t=R(e);return t.kind==="OperationDefinition"&&t.operation==="subscription"},u,c):c;return s===c&&n&&ro.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,a,l].concat(k(o!==null&&o!==void 0?o:[]),[s])}function rm(r){var e=r.isNextJS,t=r.options,n=r.children,o=r.client,i=r.provider,a=r.cache;var l=t||{},c=l.uri,u=l.wsUrl,s=l.customLinks,p=h(l,["uri","wsUrl","customLinks"]),m=o!==null&&o!==void 0?o:S;if(typeof m!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var d=i||L,v=D(function(){return N(rp({uri:c,wsUrl:u,customLinks:s}))},[c,u,s]),b=D(function(){return f(a,C)?a:new C},[a]),w=D(function(){return new m(y({link:v,cache:b},p))},[m,v,b,p]);return rs(rc,{children:[rs(rt,{children:[e?ru(d,{makeClient:function(){return w},children:n}):ru(d,{client:w,children:n}),ru($,{})]}),ru(ra,{position:"top-right"})]})}export{rm as ApolloProvider};
1
+ function r(r,e){if(e==null||e>r.length)e=r.length;for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}function e(r){if(Array.isArray(r))return r}function n(e){if(Array.isArray(e))return r(e)}function t(r){if(r===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return r}function o(r,e,n){e=u(e);return w(r,x()?Reflect.construct(e,n||[],u(r).constructor):e.apply(r,n))}function i(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function a(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||false;t.configurable=true;if("value"in t)t.writable=true;Object.defineProperty(r,t.key,t)}}function l(r,e,n){if(e)a(r.prototype,e);if(n)a(r,n);return r}function c(r,e,n){if(e in r){Object.defineProperty(r,e,{value:n,enumerable:true,configurable:true,writable:true})}else{r[e]=n}return r}function u(r){u=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return u(r)}function s(r,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:true,configurable:true}});if(e)g(r,e)}function f(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function p(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function m(r,e){var n=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(n==null)return;var t=[];var o=true;var i=false;var a,l;try{for(n=n.call(r);!(o=(a=n.next()).done);o=true){t.push(a.value);if(e&&t.length===e)break}}catch(r){i=true;l=r}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw l}}return t}function d(){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 v(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};var t=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){t=t.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))}t.forEach(function(e){c(r,e,n[e])})}return r}function b(r,e){if(r==null)return{};var n=h(r,e);var t,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(o=0;o<i.length;o++){t=i[o];if(e.indexOf(t)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,t))continue;n[t]=r[t]}}return n}function h(r,e){if(r==null)return{};var n={};var t=Object.keys(r);var o,i;for(i=0;i<t.length;i++){o=t[i];if(e.indexOf(o)>=0)continue;n[o]=r[o]}return n}function w(r,e){if(e&&(k(e)==="object"||typeof e==="function")){return e}return t(r)}function g(r,e){g=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return g(r,e)}function E(r,n){return e(r)||m(r,n)||j(r,n)||d()}function O(r){return n(r)||p(r)||j(r)||v()}function k(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function j(e,n){if(!e)return;if(typeof e==="string")return r(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return r(e,n)}function x(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(x=function(){return!!r})()}var S=Object.defineProperty;var P=function(r,e,n){return e in r?S(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n};var A=function(r,e,n){return P(r,(typeof e==="undefined"?"undefined":k(e))!="symbol"?e+"":e,n)};import{ApolloClient as L,ApolloError as N,ApolloLink as I,ApolloProvider as C,from as _,HttpLink as U,InMemoryCache as T,split as Q}from"@apollo/client";import{onError as R}from"@apollo/client/link/error";import{removeTypenameFromVariables as M}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as D}from"@apollo/client/link/subscriptions";import{getMainDefinition as q}from"@apollo/client/utilities";import{createClient as F}from"graphql-ws";import{useMemo as G}from"react";import{FaInfo as J}from"react-icons/fa6";import{use as B}from"react";import{FaRepeat as H}from"react-icons/fa6";import{createContext as W}from"react";var V=W(void 0);import $ from"../apollo-error/apollo-error.module.scss";import{jsx as z,jsxs as K}from"react/jsx-runtime";function X(){var r=B(V),e=r===null||r===void 0?void 0:r.error;if(!e)return null;var n=function(r,e){return(e===null||e===void 0?void 0:e.length)?K("div",{children:[K("strong",{children:[r,":"]}),z("ul",{children:e.map(function(r){return z("li",{children:r.message},r.message)})})]}):null};return z("div",{className:$["modal-backdrop"],children:K("div",{className:$["modal-content"],children:[z("button",{type:"button",className:$["btn-close"],onClick:r.hideError,children:"✕"}),K("div",{className:$["error-title"],children:[z("button",{type:"button",className:$["btn-retry"],onClick:function(){return window.location.reload()},children:z(H,{})})," ",e.message]}),K("div",{className:$["error-details"],children:[e.networkError&&K("pre",{className:"network",children:[z("strong",{children:"Network Error:"})," ",e.networkError.message]}),n("GraphQL Errors",O(e.graphQLErrors)),n("Protocol Errors",O(e.protocolErrors)),n("Client Errors",O(e.clientErrors)),e.extraInfo&&K("pre",{className:"extra",children:[z("strong",{children:"Extra Info:"})," ",JSON.stringify(e.extraInfo,null,4)]})]})]})})}import{use as Y}from"react";import{useEffect as Z,useMemo as rr,useState as re}from"react";import{jsx as rn}from"react/jsx-runtime";var rt=null;function ro(r){rt===null||rt===void 0?void 0:rt(r)}function ri(r){var e=r.children;var n=E(re(null),2),t=n[0],o=n[1];Z(function(){rt=o},[]);var i=rr(function(){return{error:t,showError:o,hideError:function(){return o(null)}}},[t]);return rn(V,{value:i,children:e})}import{consola as ra}from"consola/browser";var rl={silent:ra.silent,level:ra.level,fatal:ra.fatal,error:ra.error,warn:ra.warn,log:ra.log,info:ra.info,success:ra.success,ready:ra.ready,start:ra.start,box:ra.box,debug:ra.debug,trace:ra.trace,verbose:ra.verbose};import{toast as rc,Toaster as ru}from"react-hot-toast";var rs="/graphql";import{Fragment as rf,jsx as rp,jsxs as rm}from"react/jsx-runtime";var rd=/*#__PURE__*/function(r){"use strict";s(e,r);function e(){i(this,e);var r;r=o(this,e,arguments);A(r,"count",0);return r}l(e,[{key:"request",value:function r(r,e){var n=this;var t=Date.now();return this.count+=1,e(r).map(function(e){var o=Date.now()-t,i=r.operationName||"Unnamed";return rl.info("[Apollo] #".concat(n.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(I);function rv(r){var e=r.uri,n=r.wsUrl,t=r.customLinks,o=new rd,i=R(function(r){var e=r.graphQLErrors,n=r.networkError,t=r.protocolErrors,o=r.operation;var i=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,n=r.locations,t=r.path;rl.error("[GraphQL error] ".concat(i,": ").concat(e,", Location: ").concat(JSON.stringify(n),", Path: ").concat(t))}),t&&t.forEach(function(r){var e=r.message,n=r.extensions;rl.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(n)))}),n&&rl.error("[Network error]: ".concat(n)),e||t||n){var a,l;var c=(e===null||e===void 0?void 0:(a=e[0])===null||a===void 0?void 0:a.message)||(t===null||t===void 0?void 0:(l=t[0])===null||l===void 0?void 0:l.message)||(n===null||n===void 0?void 0:n.message)||"Unexpected error",u=new N({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:c,extraInfo:{operation:o}});rc.error(function(r){return rm(rf,{children:[c,"\xa0",rp(J,{cursor:"pointer",onClick:function(){setTimeout(function(){ro(u)},0),rc.dismiss(r.id)}})]})})}}),a=M();e||rl.warn('[Apollo] No GraphQL URI provided — using "'.concat(rs,'" as default'));var l=new U({uri:e!==null&&e!==void 0?e:rs,credentials:"include"}),c=n?new D(F({url:n})):I.empty(),u=f(c,I)?Q(function(r){var e=r.query;var n=q(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},c,l):l;return u===l&&n&&rl.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[o,i,a].concat(O(t!==null&&t!==void 0?t:[]),[u])}function ry(r){var e=r.isNextJS,n=r.options,t=r.children,o=r.client,i=r.provider,a=r.cache;var l=n||{},c=l.uri,u=l.wsUrl,s=l.customLinks,p=b(l,["uri","wsUrl","customLinks"]),m=o!==null&&o!==void 0?o:L;if(typeof m!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var d=i||C,v=G(function(){return _(rv({uri:c!==null&&c!==void 0?c:rs,wsUrl:u!==null&&u!==void 0?u:"",customLinks:s!==null&&s!==void 0?s:[]}))},[c,u,s]),h=G(function(){return f(a,T)?a:new T},[a]),w=G(function(){return new m(y({link:v,cache:h},p))},[m,v,h,p]);return rm(rf,{children:[rm(ri,{children:[e?rp(d,{makeClient:function(){return w},children:t}):rp(d,{client:w,children:t}),rp(X,{})]}),rp(ru,{position:"top-right"})]})}export{ry as ApolloProvider};
@@ -1 +1 @@
1
- "use strict";function r(r,e){if(e==null||e>r.length)e=r.length;for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}function e(r){if(Array.isArray(r))return r}function n(e){if(Array.isArray(e))return r(e)}function t(r){if(r===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return r}function o(r,e,n){e=c(e);return g(r,k()?Reflect.construct(e,n||[],c(r).constructor):e.apply(r,n))}function i(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function a(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||false;t.configurable=true;if("value"in t)t.writable=true;Object.defineProperty(r,t.key,t)}}function l(r,e,n){if(e)a(r.prototype,e);if(n)a(r,n);return r}function u(r,e,n){if(e in r){Object.defineProperty(r,e,{value:n,enumerable:true,configurable:true,writable:true})}else{r[e]=n}return r}function c(r){c=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return c(r)}function s(r,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:true,configurable:true}});if(e)w(r,e)}function f(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function p(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function d(r,e){var n=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(n==null)return;var t=[];var o=true;var i=false;var a,l;try{for(n=n.call(r);!(o=(a=n.next()).done);o=true){t.push(a.value);if(e&&t.length===e)break}}catch(r){i=true;l=r}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw l}}return t}function v(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(){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 m(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};var t=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){t=t.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))}t.forEach(function(e){u(r,e,n[e])})}return r}function b(r,e){if(r==null)return{};var n=h(r,e);var t,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(o=0;o<i.length;o++){t=i[o];if(e.indexOf(t)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,t))continue;n[t]=r[t]}}return n}function h(r,e){if(r==null)return{};var n={};var t=Object.keys(r);var o,i;for(i=0;i<t.length;i++){o=t[i];if(e.indexOf(o)>=0)continue;n[o]=r[o]}return n}function g(r,e){if(e&&(O(e)==="object"||typeof e==="function")){return e}return t(r)}function w(r,e){w=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return w(r,e)}function j(r,n){return e(r)||d(r,n)||E(r,n)||v()}function x(r){return n(r)||p(r)||E(r)||y()}function O(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function E(e,n){if(!e)return;if(typeof e==="string")return r(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return r(e,n)}function k(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(k=function(){return!!r})()}var A=Object.create;var P=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var I=function(r,e){for(var n in e)P(r,n,{get:e[n],enumerable:!0})},N=function(r,e,n,t){var o=true,i=false,a=undefined;if(e&&(typeof e==="undefined"?"undefined":O(e))=="object"||typeof e=="function")try{var l=function(){var o=c.value;!_.call(r,o)&&o!==n&&P(r,o,{get:function(){return e[o]},enumerable:!(t=L(e,o))||t.enumerable})};for(var u=S(e)[Symbol.iterator](),c;!(o=(c=u.next()).done);o=true)l()}catch(r){i=true;a=r}finally{try{if(!o&&u.return!=null){u.return()}}finally{if(i){throw a}}}return r};var U=function(r,e,n){return n=r!=null?A(q(r)):{},N(e||!r||!r.__esModule?P(n,"default",{value:r,enumerable:!0}):n,r)},C=function(r){return N(P({},"__esModule",{value:!0}),r)};var R={};I(R,{ApolloProvider:function(){return rf},GRAPHQL_URI_DEFAULT:function(){return rl}});module.exports=C(R);var T=require("@apollo/client"),M=require("@apollo/client/link/error"),Q=require("@apollo/client/link/remove-typename"),D=require("@apollo/client/link/subscriptions"),F=require("@apollo/client/utilities"),G=require("graphql-ws"),H=require("react"),J=require("react-icons/fa6");var B=require("react"),W=require("react-icons/fa6");var V=require("react"),$=(0,V.createContext)(void 0);var z=U(require("../apollo-error/apollo-error.module.scss"),1),K=require("react/jsx-runtime");function X(){var r=(0,B.use)($),e=r===null||r===void 0?void 0:r.error;if(!e)return null;var n=function(r,e){return(e===null||e===void 0?void 0:e.length)?(0,K.jsxs)("div",{children:[(0,K.jsxs)("strong",{children:[r,":"]}),(0,K.jsx)("ul",{children:e.map(function(r){return(0,K.jsx)("li",{children:r.message},r.message)})})]}):null};return(0,K.jsx)("div",{className:z.default["modal-backdrop"],children:(0,K.jsxs)("div",{className:z.default["modal-content"],children:[(0,K.jsx)("button",{type:"button",className:z.default["btn-close"],onClick:r.hideError,children:"✕"}),(0,K.jsxs)("div",{className:z.default["error-title"],children:[(0,K.jsx)("button",{type:"button",className:z.default["btn-retry"],onClick:function(){return window.location.reload()},children:(0,K.jsx)(W.FaRepeat,{})})," ",e.message]}),(0,K.jsxs)("div",{className:z.default["error-details"],children:[e.networkError&&(0,K.jsxs)("pre",{className:"network",children:[(0,K.jsx)("strong",{children:"Network Error:"})," ",e.networkError.message]}),n("GraphQL Errors",x(e.graphQLErrors)),n("Protocol Errors",x(e.protocolErrors)),n("Client Errors",x(e.clientErrors)),e.extraInfo&&(0,K.jsxs)("pre",{className:"extra",children:[(0,K.jsx)("strong",{children:"Extra Info:"})," ",JSON.stringify(e.extraInfo,null,4)]})]})]})})}var Y=require("react");var Z=require("react");var rr=require("react/jsx-runtime"),re=null;function rn(r){re===null||re===void 0?void 0:re(r)}function rt(r){var e=r.children;var n=j((0,Z.useState)(null),2),t=n[0],o=n[1];(0,Z.useEffect)(function(){re=o},[]);var i=(0,Z.useMemo)(function(){return{error:t,showError:o,hideError:function(){return o(null)}}},[t]);return(0,rr.jsx)($,{value:i,children:e})}var ro=require("consola/browser"),ri={silent:ro.consola.silent,level:ro.consola.level,fatal:ro.consola.fatal,error:ro.consola.error,warn:ro.consola.warn,log:ro.consola.log,info:ro.consola.info,success:ro.consola.success,ready:ro.consola.ready,start:ro.consola.start,box:ro.consola.box,debug:ro.consola.debug,trace:ro.consola.trace,verbose:ro.consola.verbose};var ra=require("react-hot-toast");var rl="/graphql";var ru=require("react/jsx-runtime"),rc=/*#__PURE__*/function(r){s(e,r);function e(){i(this,e);var r;r=o(this,e,arguments);r.count=0;return r}l(e,[{key:"request",value:function r(r,e){var n=this;var t=Date.now();return this.count+=1,e(r).map(function(e){var o=Date.now()-t,i=r.operationName||"Unnamed";return ri.info("[Apollo] #".concat(n.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(T.ApolloLink);function rs(r){var e=r||{},n=e.uri,t=e.wsUrl,o=e.customLinks,i=new rc,a=(0,M.onError)(function(r){var e=r.graphQLErrors,n=r.networkError,t=r.protocolErrors,o=r.operation;var i=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,n=r.locations,t=r.path;ri.error("[GraphQL error] ".concat(i,": ").concat(e,", Location: ").concat(JSON.stringify(n),", Path: ").concat(t))}),t&&t.forEach(function(r){var e=r.message,n=r.extensions;ri.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(n)))}),n&&ri.error("[Network error]: ".concat(n)),e||t||n){var a,l;var u=(e===null||e===void 0?void 0:(a=e[0])===null||a===void 0?void 0:a.message)||(t===null||t===void 0?void 0:(l=t[0])===null||l===void 0?void 0:l.message)||(n===null||n===void 0?void 0:n.message)||"Unexpected error",c=new T.ApolloError({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:u,extraInfo:{operation:o}});ra.toast.error(function(r){return(0,ru.jsxs)(ru.Fragment,{children:[u,"\xa0",(0,ru.jsx)(J.FaInfo,{cursor:"pointer",onClick:function(){setTimeout(function(){rn(c)},0),ra.toast.dismiss(r.id)}})]})})}}),l=(0,Q.removeTypenameFromVariables)();n||ri.warn('[Apollo] No GraphQL URI provided — using "'.concat(rl,'" as default'));var u=new T.HttpLink({uri:n!==null&&n!==void 0?n:rl,credentials:"include"}),c=t?new D.GraphQLWsLink((0,G.createClient)({url:t})):T.ApolloLink.empty(),s=f(c,T.ApolloLink)?(0,T.split)(function(r){var e=r.query;var n=(0,F.getMainDefinition)(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},c,u):u;return s===u&&t&&ri.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,a,l].concat(x(o!==null&&o!==void 0?o:[]),[s])}function rf(r){var e=r.isNextJS,n=r.options,t=r.children,o=r.client,i=r.provider,a=r.cache;var l=n||{},u=l.uri,c=l.wsUrl,s=l.customLinks,p=b(l,["uri","wsUrl","customLinks"]),d=o!==null&&o!==void 0?o:T.ApolloClient;if(typeof d!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var v=i||T.ApolloProvider,y=(0,H.useMemo)(function(){return(0,T.from)(rs({uri:u,wsUrl:c,customLinks:s}))},[u,c,s]),h=(0,H.useMemo)(function(){return f(a,T.InMemoryCache)?a:new T.InMemoryCache},[a]),g=(0,H.useMemo)(function(){return new d(m({link:y,cache:h},p))},[d,y,h,p]);return(0,ru.jsxs)(ru.Fragment,{children:[(0,ru.jsxs)(rt,{children:[e?(0,ru.jsx)(v,{makeClient:function(){return g},children:t}):(0,ru.jsx)(v,{client:g,children:t}),(0,ru.jsx)(X,{})]}),(0,ru.jsx)(ra.Toaster,{position:"top-right"})]})}0&&(module.exports={ApolloProvider:ApolloProvider,GRAPHQL_URI_DEFAULT:GRAPHQL_URI_DEFAULT});
1
+ "use strict";function r(r,e){if(e==null||e>r.length)e=r.length;for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}function e(r){if(Array.isArray(r))return r}function n(e){if(Array.isArray(e))return r(e)}function t(r){if(r===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return r}function o(r,e,n){e=c(e);return g(r,k()?Reflect.construct(e,n||[],c(r).constructor):e.apply(r,n))}function i(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function a(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||false;t.configurable=true;if("value"in t)t.writable=true;Object.defineProperty(r,t.key,t)}}function l(r,e,n){if(e)a(r.prototype,e);if(n)a(r,n);return r}function u(r,e,n){if(e in r){Object.defineProperty(r,e,{value:n,enumerable:true,configurable:true,writable:true})}else{r[e]=n}return r}function c(r){c=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return c(r)}function s(r,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:true,configurable:true}});if(e)w(r,e)}function f(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function p(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function d(r,e){var n=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(n==null)return;var t=[];var o=true;var i=false;var a,l;try{for(n=n.call(r);!(o=(a=n.next()).done);o=true){t.push(a.value);if(e&&t.length===e)break}}catch(r){i=true;l=r}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw l}}return t}function v(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(){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 m(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};var t=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){t=t.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))}t.forEach(function(e){u(r,e,n[e])})}return r}function b(r,e){if(r==null)return{};var n=h(r,e);var t,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(o=0;o<i.length;o++){t=i[o];if(e.indexOf(t)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,t))continue;n[t]=r[t]}}return n}function h(r,e){if(r==null)return{};var n={};var t=Object.keys(r);var o,i;for(i=0;i<t.length;i++){o=t[i];if(e.indexOf(o)>=0)continue;n[o]=r[o]}return n}function g(r,e){if(e&&(O(e)==="object"||typeof e==="function")){return e}return t(r)}function w(r,e){w=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return w(r,e)}function j(r,n){return e(r)||d(r,n)||E(r,n)||v()}function x(r){return n(r)||p(r)||E(r)||y()}function O(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function E(e,n){if(!e)return;if(typeof e==="string")return r(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return r(e,n)}function k(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(k=function(){return!!r})()}var A=Object.create;var P=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var I=function(r,e,n){return e in r?P(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n};var N=function(r,e){for(var n in e)P(r,n,{get:e[n],enumerable:!0})},U=function(r,e,n,t){var o=true,i=false,a=undefined;if(e&&(typeof e==="undefined"?"undefined":O(e))=="object"||typeof e=="function")try{var l=function(){var o=c.value;!_.call(r,o)&&o!==n&&P(r,o,{get:function(){return e[o]},enumerable:!(t=L(e,o))||t.enumerable})};for(var u=S(e)[Symbol.iterator](),c;!(o=(c=u.next()).done);o=true)l()}catch(r){i=true;a=r}finally{try{if(!o&&u.return!=null){u.return()}}finally{if(i){throw a}}}return r};var C=function(r,e,n){return n=r!=null?A(q(r)):{},U(e||!r||!r.__esModule?P(n,"default",{value:r,enumerable:!0}):n,r)},R=function(r){return U(P({},"__esModule",{value:!0}),r)};var T=function(r,e,n){return I(r,(typeof e==="undefined"?"undefined":O(e))!="symbol"?e+"":e,n)};var M={};N(M,{ApolloProvider:function(){return rd},GRAPHQL_URI_DEFAULT:function(){return rc}});module.exports=R(M);var Q=require("@apollo/client"),D=require("@apollo/client/link/error"),F=require("@apollo/client/link/remove-typename"),G=require("@apollo/client/link/subscriptions"),H=require("@apollo/client/utilities"),J=require("graphql-ws"),B=require("react"),W=require("react-icons/fa6");var V=require("react"),$=require("react-icons/fa6");var z=require("react"),K=(0,z.createContext)(void 0);var X=C(require("../apollo-error/apollo-error.module.scss"),1),Y=require("react/jsx-runtime");function Z(){var r=(0,V.use)(K),e=r===null||r===void 0?void 0:r.error;if(!e)return null;var n=function(r,e){return(e===null||e===void 0?void 0:e.length)?(0,Y.jsxs)("div",{children:[(0,Y.jsxs)("strong",{children:[r,":"]}),(0,Y.jsx)("ul",{children:e.map(function(r){return(0,Y.jsx)("li",{children:r.message},r.message)})})]}):null};return(0,Y.jsx)("div",{className:X.default["modal-backdrop"],children:(0,Y.jsxs)("div",{className:X.default["modal-content"],children:[(0,Y.jsx)("button",{type:"button",className:X.default["btn-close"],onClick:r.hideError,children:"✕"}),(0,Y.jsxs)("div",{className:X.default["error-title"],children:[(0,Y.jsx)("button",{type:"button",className:X.default["btn-retry"],onClick:function(){return window.location.reload()},children:(0,Y.jsx)($.FaRepeat,{})})," ",e.message]}),(0,Y.jsxs)("div",{className:X.default["error-details"],children:[e.networkError&&(0,Y.jsxs)("pre",{className:"network",children:[(0,Y.jsx)("strong",{children:"Network Error:"})," ",e.networkError.message]}),n("GraphQL Errors",x(e.graphQLErrors)),n("Protocol Errors",x(e.protocolErrors)),n("Client Errors",x(e.clientErrors)),e.extraInfo&&(0,Y.jsxs)("pre",{className:"extra",children:[(0,Y.jsx)("strong",{children:"Extra Info:"})," ",JSON.stringify(e.extraInfo,null,4)]})]})]})})}var rr=require("react");var re=require("react");var rn=require("react/jsx-runtime"),rt=null;function ro(r){rt===null||rt===void 0?void 0:rt(r)}function ri(r){var e=r.children;var n=j((0,re.useState)(null),2),t=n[0],o=n[1];(0,re.useEffect)(function(){rt=o},[]);var i=(0,re.useMemo)(function(){return{error:t,showError:o,hideError:function(){return o(null)}}},[t]);return(0,rn.jsx)(K,{value:i,children:e})}var ra=require("consola/browser"),rl={silent:ra.consola.silent,level:ra.consola.level,fatal:ra.consola.fatal,error:ra.consola.error,warn:ra.consola.warn,log:ra.consola.log,info:ra.consola.info,success:ra.consola.success,ready:ra.consola.ready,start:ra.consola.start,box:ra.consola.box,debug:ra.consola.debug,trace:ra.consola.trace,verbose:ra.consola.verbose};var ru=require("react-hot-toast");var rc="/graphql";var rs=require("react/jsx-runtime"),rf=/*#__PURE__*/function(r){s(e,r);function e(){i(this,e);var r;r=o(this,e,arguments);T(r,"count",0);return r}l(e,[{key:"request",value:function r(r,e){var n=this;var t=Date.now();return this.count+=1,e(r).map(function(e){var o=Date.now()-t,i=r.operationName||"Unnamed";return rl.info("[Apollo] #".concat(n.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(Q.ApolloLink);function rp(r){var e=r.uri,n=r.wsUrl,t=r.customLinks,o=new rf,i=(0,D.onError)(function(r){var e=r.graphQLErrors,n=r.networkError,t=r.protocolErrors,o=r.operation;var i=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,n=r.locations,t=r.path;rl.error("[GraphQL error] ".concat(i,": ").concat(e,", Location: ").concat(JSON.stringify(n),", Path: ").concat(t))}),t&&t.forEach(function(r){var e=r.message,n=r.extensions;rl.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(n)))}),n&&rl.error("[Network error]: ".concat(n)),e||t||n){var a,l;var u=(e===null||e===void 0?void 0:(a=e[0])===null||a===void 0?void 0:a.message)||(t===null||t===void 0?void 0:(l=t[0])===null||l===void 0?void 0:l.message)||(n===null||n===void 0?void 0:n.message)||"Unexpected error",c=new Q.ApolloError({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:u,extraInfo:{operation:o}});ru.toast.error(function(r){return(0,rs.jsxs)(rs.Fragment,{children:[u,"\xa0",(0,rs.jsx)(W.FaInfo,{cursor:"pointer",onClick:function(){setTimeout(function(){ro(c)},0),ru.toast.dismiss(r.id)}})]})})}}),a=(0,F.removeTypenameFromVariables)();e||rl.warn('[Apollo] No GraphQL URI provided — using "'.concat(rc,'" as default'));var l=new Q.HttpLink({uri:e!==null&&e!==void 0?e:rc,credentials:"include"}),u=n?new G.GraphQLWsLink((0,J.createClient)({url:n})):Q.ApolloLink.empty(),c=f(u,Q.ApolloLink)?(0,Q.split)(function(r){var e=r.query;var n=(0,H.getMainDefinition)(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},u,l):l;return c===l&&n&&rl.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[o,i,a].concat(x(t!==null&&t!==void 0?t:[]),[c])}function rd(r){var e=r.isNextJS,n=r.options,t=r.children,o=r.client,i=r.provider,a=r.cache;var l=n||{},u=l.uri,c=l.wsUrl,s=l.customLinks,p=b(l,["uri","wsUrl","customLinks"]),d=o!==null&&o!==void 0?o:Q.ApolloClient;if(typeof d!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var v=i||Q.ApolloProvider,y=(0,B.useMemo)(function(){return(0,Q.from)(rp({uri:u!==null&&u!==void 0?u:rc,wsUrl:c!==null&&c!==void 0?c:"",customLinks:s!==null&&s!==void 0?s:[]}))},[u,c,s]),h=(0,B.useMemo)(function(){return f(a,Q.InMemoryCache)?a:new Q.InMemoryCache},[a]),g=(0,B.useMemo)(function(){return new d(m({link:y,cache:h},p))},[d,y,h,p]);return(0,rs.jsxs)(rs.Fragment,{children:[(0,rs.jsxs)(ri,{children:[e?(0,rs.jsx)(v,{makeClient:function(){return g},children:t}):(0,rs.jsx)(v,{client:g,children:t}),(0,rs.jsx)(Z,{})]}),(0,rs.jsx)(ru.Toaster,{position:"top-right"})]})}0&&(module.exports={ApolloProvider:ApolloProvider,GRAPHQL_URI_DEFAULT:GRAPHQL_URI_DEFAULT});