@cyberskill/shared 1.64.0 → 1.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/react/apollo-client.cjs +1 -1
- package/dist/react/apollo-client.js +1 -1
- package/dist/react/apollo-error.cjs +1 -1
- package/dist/react/apollo-error.js +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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,t,o,i,a){try{var s=r[i](a);var u=s.value}catch(r){n(r);return}if(s.done){e(u)}else{Promise.resolve(u).then(t,o)}}function i(r){return function(){var e=this,n=arguments;return new Promise(function(t,i){var a=r.apply(e,n);function s(r){o(a,t,i,s,u,"next",r)}function u(r){o(a,t,i,s,u,"throw",r)}s(undefined)})}}function a(r,e,n){e=f(e);return O(r,L()?Reflect.construct(e,n||[],f(r).constructor):e.apply(r,n))}function s(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function u(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)u(r.prototype,e);if(n)u(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 f(r){f=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return f(r)}function v(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)x(r,e)}function d(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,s;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;s=r}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw s}}return t}function h(){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 g(){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){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);if(e){t=t.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})}n.push.apply(n,t)}return n}function w(r,e){e=e!=null?e:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(r,Object.getOwnPropertyDescriptors(e))}else{b(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}function E(r,e){if(r==null)return{};var n=k(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 k(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 O(r,e){if(e&&(S(e)==="object"||typeof e==="function")){return e}return t(r)}function x(r,e){x=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return x(r,e)}function j(r,n){return e(r)||m(r,n)||P(r,n)||h()}function N(r){return n(r)||p(r)||P(r)||g()}function S(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function P(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 L(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(L=function(){return!!r})()}function I(r,e){var n,t,o,i,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(r){return function(e){return u([r,e])}}function u(i){if(n)throw new TypeError("Generator is already executing.");while(a)try{if(n=1,t&&(o=i[0]&2?t["return"]:i[0]?t["throw"]||((o=t["return"])&&o.call(t),0):t.next)&&!(o=o.call(t,i[1])).done)return o;if(t=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:a.label++;return{value:i[1],done:false};case 5:a.label++;t=i[1];i=[0];continue;case 7:i=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){a=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(i[0]===6&&a.label<o[1]){a.label=o[1];o=i;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(i);break}if(o[2])a.ops.pop();a.trys.pop();continue}i=e.call(r,a)}catch(r){i=[6,r];t=0}finally{n=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}import{ApolloClient as C,ApolloError as A,ApolloLink as _,ApolloProvider as D,from as T,HttpLink as U,InMemoryCache as M,split as R}from"@apollo/client";import{onError as Q}from"@apollo/client/link/error";import{removeTypenameFromVariables as V}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as G}from"@apollo/client/link/subscriptions";import{getMainDefinition as z}from"@apollo/client/utilities";import{createClient as J}from"graphql-ws";import{useMemo as F}from"react";import{toast as q,Toaster as B}from"react-hot-toast";import{FaExpand as H}from"react-icons/fa6";var W="/graphql";import{consola as Z}from"consola/browser";var $={silent:Z.silent,level:Z.level,fatal:Z.fatal,error:Z.error,warn:Z.warn,log:Z.log,info:Z.info,success:Z.success,ready:Z.ready,start:Z.start,box:Z.box,debug:Z.debug,trace:Z.trace,verbose:Z.verbose};import{createContext as K,use as X,useEffect as Y,useMemo as rr,useState as re}from"react";import{FaRepeat as rn}from"react-icons/fa6";import rt from"./apollo-error.module.scss";import{jsx as ro,jsxs as ri}from"react/jsx-runtime";var ra=K(void 0);function rs(){var r=X(ra);if(!r)throw new Error("useApolloErrorViewer must be used within ApolloErrorViewerProvider");return r}var ru=null;function rl(r){ru=r}function rc(r){ru&&ru(r)}function rf(r){var e=r.children;var n=j(re(null),2),t=n[0],o=n[1];Y(function(){rl(o)},[]);var i=rr(function(){return{error:t,showError:o,hideError:function(){return o(null)}}},[t]);return ro(ra,{value:i,children:e})}function rv(){var r,e,n;var t=X(ra);if(!t||!t.error)return null;var o=t.error,i=t.hideError;return ro("div",{className:rt["modal-backdrop"],children:ri("div",{className:rt["modal-content"],children:[ro("button",{type:"button",className:rt["btn-close"],onClick:i,children:"✕"}),ro("div",{className:rt["error-title"],children:o.message}),ri("div",{className:rt["error-details"],children:[o.networkError&&ri("pre",{className:"network",children:[ro("strong",{children:"Network Error:"}),"\xa0",o.networkError.message]}),((r=o.graphQLErrors)===null||r===void 0?void 0:r.length)>0&&ri("div",{children:[ro("strong",{children:"GraphQL Errors:"}),ro("ul",{children:o.graphQLErrors.map(function(r){return ro("li",{children:r.message},r.message)})})]}),((e=o.protocolErrors)===null||e===void 0?void 0:e.length)>0&&ri("div",{children:[ro("strong",{children:"Protocol Errors:"}),ro("ul",{children:o.protocolErrors.map(function(r){return ro("li",{children:r.message},r.message)})})]}),((n=o.clientErrors)===null||n===void 0?void 0:n.length)>0&&ri("div",{children:[ro("strong",{children:"Client Errors:"}),ro("ul",{children:o.clientErrors.map(function(r){return ro("li",{children:r.message},r.message)})})]}),o.extraInfo&&ri("pre",{className:"extra",children:[ro("strong",{children:"Extra Info:"}),"\xa0",JSON.stringify(o.extraInfo,null,4)]})]}),ro("button",{type:"button",className:rt["btn-retry"],onClick:function(){return window.location.reload()},children:ro(rn,{})})]})})}import{Fragment as rd,jsx as rp,jsxs as rm}from"react/jsx-runtime";var rh=/*#__PURE__*/function(r){"use strict";v(e,r);function e(){s(this,e);var r;r=a(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 $.info("[Apollo] #".concat(n.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(_);function rg(r){var e=r||{},n=e.uri,t=e.wsUrl,o=e.customLinks,i=new rh,a=Q(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;$.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;$.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(n)))}),n&&$.error("[Network error]: ".concat(n)),e||t||n){var a,s;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:(s=t[0])===null||s===void 0?void 0:s.message)||(n===null||n===void 0?void 0:n.message)||"Unexpected error",l=new A({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:u,extraInfo:{operation:o}});q.error(function(r){return rm(rd,{children:[u,"\xa0",rp(H,{onClick:function(){setTimeout(function(){rc(l)},0),q.dismiss(r.id)}})]})})}}),s=V();n||$.warn('[Apollo] No GraphQL URI provided — using "'.concat(W,'" as default'));var u=new U({uri:n!==null&&n!==void 0?n:W,credentials:"include"}),l=t?new G(J({url:t})):_.empty(),c=d(l,_)?R(function(r){var e=r.query;var n=z(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},l,u):u;return c===u&&t&&$.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,a,s].concat(N(o!==null&&o!==void 0?o:[]),[c])}function ry(r){var e=r.isNextJS,n=r.options,t=r.children,o=r.client,i=r.provider,a=r.cache;var s=n||{},u=s.uri,l=s.wsUrl,c=s.customLinks,f=E(s,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:C)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var v=i||D,p=F(function(){return T(rg({uri:u,wsUrl:l,customLinks:c}))},[u,l,c]),m=F(function(){return new C(y({link:p,cache:d(a,M)?a:new M},f))},[p,a,f]),h=e?rp(v,{makeClient:function(){return m},children:t}):rp(v,{client:m,children:t});return e?rp(v,{makeClient:function(){return m},children:t}):rm(rd,{children:[rm(rf,{children:[h,rp(rv,{})]}),rp(B,{position:"top-right"})]})}import rb from"classnames";import{createContext as rw,use as rE,useCallback as rk,useMemo as rO,useState as rx}from"react";import rj from"./loading.module.scss";import{jsx as rN,jsxs as rS}from"react/jsx-runtime";var rP=rw(void 0);function rL(){var r=rE(rP);if(!r)throw new Error("useLoading must be used within a LoadingProvider");return r}function rI(r){var e=r.full,n=e===void 0?!1:e,t=r.block,o=t===void 0?!1:t,i=r.className,a=i===void 0?"":i,s=r.message,u=s===void 0?"Loading":s,l=E(r,["full","block","className","message"]);function c(){return rS("div",w(y({className:rj.container},l),{children:[rN("div",{className:rj.ring}),rN("div",{className:rj.ring}),rN("div",{className:rj.ring}),rN("div",{className:rj.ring}),u&&rN("div",{className:rj.message,children:u})]}))}return n?rN("div",{className:rb(rj.fullscreen,a),children:c()}):o?rN("div",{className:rb(rj.block,a),children:c()}):c()}function rC(r){var e=r.children;var n=j(rx(!1),2),t=n[0],o=n[1],i=j(rx(!1),2),a=i[0],s=i[1],u=rk(function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),s(r)},[]),l=rk(function(){o(!1),s(!1)},[]),c=rO(function(){return{isLoading:t,isGlobalLoading:a,showLoading:u,hideLoading:l}},[t,a,u,l]);return rN(rP,{value:c,children:t?rN(rI,{full:a}):e})}import{NextIntlClientProvider as rA,useTranslations as r_}from"next-intl";import{createContext as rD,use as rT,useMemo as rU}from"react";import{useCallback as rM,useEffect as rR,useState as rQ}from"react";var rV={serialize:function(r){return JSON.stringify(r,function(r,e){return d(e,Date)?{__type:"Date",value:e.toISOString()}:e})},deserialize:function(r){return JSON.parse(r,function(r,e){return(e===null||e===void 0?void 0:e.__type)==="Date"?new Date(e.value):e})}};import rG from"localforage";var rz={get:function r(r){return i(function(){var e;return I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rG.getItem(r)];case 1:return[2,n.sent()];case 2:e=n.sent();return[2,($.error('[Storage:get] Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return i(function(){var n;return I(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,rG.setItem(r,e)];case 1:t.sent();return[3,3];case 2:n=t.sent();$.error('[Storage:set] Error setting key "'.concat(r,'":'),n);return[3,3];case 3:return[2]}})})()},remove:function r(r){return i(function(){var e;return I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rG.removeItem(r)];case 1:n.sent();return[3,3];case 2:e=n.sent();$.error('[Storage:remove] Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},keys:function r(){return i(function(){var r,e;return I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rG.keys()];case 1:return[2,(r=n.sent())!==null&&r!==void 0?r:[]];case 2:e=n.sent();return[2,($.error("[Storage:keys] Error getting keys:",e),[])];case 3:return[2]}})})()}};function rJ(r,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rV;var t=j(rQ(e),2),o=t[0],a=t[1],s=j(rQ(!1),2),u=s[0],l=s[1];rR(function(){var t=!0;return i(function(){var o,i,s,u;return I(this,function(c){switch(c.label){case 0:c.trys.push([0,6,7,8]);return[4,rz.get(r)];case 1:o=c.sent();if(!t)return[3,5];if(!(o!==null))return[3,2];i=n.deserialize(o);a(i);return[3,5];case 2:if(!(e!==void 0))return[3,4];s=n.serialize(e);return[4,rz.set(r,s)];case 3:c.sent(),a(e);return[3,5];case 4:a(void 0);c.label=5;case 5:return[3,8];case 6:u=c.sent();$.error('Error loading value for key "'.concat(r,'":'),u),t&&a(e);return[3,8];case 7:t&&l(!0);return[7];case 8:return[2]}})})(),function(){t=!1,l(!1)}},[r,e,n]),rR(function(){if(!u)return;i(function(){var e,t;return I(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);if(!(o!==void 0))return[3,2];e=n.serialize(o);return[4,rz.set(r,e)];case 1:i.sent();i.label=2;case 2:return[3,4];case 3:t=i.sent();$.error('Error saving value for key "'.concat(r,'":'),t);return[3,4];case 4:return[2]}})})()},[o,r,n,u]);var c=rM(function(r){a(function(e){return typeof r=="function"?r(e):r})},[]),f=rM(/*#__PURE__*/i(function(){var e;return I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rz.remove(r)];case 1:n.sent(),a(void 0);return[3,3];case 2:e=n.sent();$.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})}),[r]);return{value:o,set:c,remove:f}}import{Fragment as rF,jsx as rq}from"react/jsx-runtime";var rB=rD(void 0);function rH(){var r=rT(rB);if(!r)throw new Error("useNextIntl must be used within a NextIntlProvider");return r}var rW=r_;function rZ(r){var e=function(e){var n;var t=rH(),o=t.currentLanguage,i=e.messages,a=e.languages,s="en",u=i[(o===null||o===void 0?void 0:o.value)||s],l=(n=a.find(function(r){return r.value===(o===null||o===void 0?void 0:o.value)}))===null||n===void 0?void 0:n.timezone;return i?rq(rA,{locale:(o===null||o===void 0?void 0:o.value)||s,messages:u,timeZone:l,children:rq(r,y({},e))}):($.warn("Missing messages for language: ".concat((o===null||o===void 0?void 0:o.value)||s)),null)};return e.displayName="withNextIntl(".concat(r.displayName||r.name||"Component",")"),e}function r$(r){var e=r.children;return rq(rF,{children:e})}var rK=rZ(r$);function rX(r){var e=r.children,n=r.languages,t=r.messages;var o;var i=rJ("lang",(o=n===null||n===void 0?void 0:n[0])!==null&&o!==void 0?o:{}),a=i.value,s=i.set,u=rU(function(){return{languages:n,currentLanguage:a,setCurrentLanguage:s}},[n,s,a]);return rq(rB,{value:u,children:rq(rK,{languages:n,messages:t,children:e})})}export{rv as ApolloErrorViewerModal,rf as ApolloErrorViewerProvider,ry as ApolloProvider,rI as Loading,rP as LoadingContext,rC as LoadingProvider,rB as NextIntlContext,rX as NextIntlProvider,rl as registerApolloErrorViewerCallback,rc as showGlobalApolloError,rs as useApolloErrorViewer,rL as useLoading,rH as useNextIntl,rJ as useStorage,rW as useTranslateNextIntl,rZ as withNextIntl};
|
|
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,t,o,a,i){try{var s=r[a](i);var u=s.value}catch(r){n(r);return}if(s.done){e(u)}else{Promise.resolve(u).then(t,o)}}function a(r){return function(){var e=this,n=arguments;return new Promise(function(t,a){var i=r.apply(e,n);function s(r){o(i,t,a,s,u,"next",r)}function u(r){o(i,t,a,s,u,"throw",r)}s(undefined)})}}function i(r,e,n){e=f(e);return O(r,L()?Reflect.construct(e,n||[],f(r).constructor):e.apply(r,n))}function s(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function u(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)u(r.prototype,e);if(n)u(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 f(r){f=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return f(r)}function v(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)x(r,e)}function d(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 a=false;var i,s;try{for(n=n.call(r);!(o=(i=n.next()).done);o=true){t.push(i.value);if(e&&t.length===e)break}}catch(r){a=true;s=r}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(a)throw s}}return t}function h(){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 g(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){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);if(e){t=t.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})}n.push.apply(n,t)}return n}function w(r,e){e=e!=null?e:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(r,Object.getOwnPropertyDescriptors(e))}else{b(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}function E(r,e){if(r==null)return{};var n=k(r,e);var t,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(o=0;o<a.length;o++){t=a[o];if(e.indexOf(t)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,t))continue;n[t]=r[t]}}return n}function k(r,e){if(r==null)return{};var n={};var t=Object.keys(r);var o,a;for(a=0;a<t.length;a++){o=t[a];if(e.indexOf(o)>=0)continue;n[o]=r[o]}return n}function O(r,e){if(e&&(S(e)==="object"||typeof e==="function")){return e}return t(r)}function x(r,e){x=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return x(r,e)}function j(r,n){return e(r)||m(r,n)||P(r,n)||h()}function N(r){return n(r)||p(r)||P(r)||y()}function S(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function P(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 L(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(L=function(){return!!r})()}function I(r,e){var n,t,o,a,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(r){return function(e){return u([r,e])}}function u(a){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,t&&(o=a[0]&2?t["return"]:a[0]?t["throw"]||((o=t["return"])&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;if(t=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;t=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=e.call(r,i)}catch(r){a=[6,r];t=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}import{ApolloClient as C,ApolloError as A,ApolloLink as _,ApolloProvider as D,from as T,HttpLink as U,InMemoryCache as M,split as R}from"@apollo/client";import{onError as V}from"@apollo/client/link/error";import{removeTypenameFromVariables as G}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as Q}from"@apollo/client/link/subscriptions";import{getMainDefinition as z}from"@apollo/client/utilities";import{createClient as J}from"graphql-ws";import{useMemo as F}from"react";import{toast as q,Toaster as B}from"react-hot-toast";import{FaInfo as H}from"react-icons/fa6";var W="/graphql";import{consola as Z}from"consola/browser";var $={silent:Z.silent,level:Z.level,fatal:Z.fatal,error:Z.error,warn:Z.warn,log:Z.log,info:Z.info,success:Z.success,ready:Z.ready,start:Z.start,box:Z.box,debug:Z.debug,trace:Z.trace,verbose:Z.verbose};import{createContext as K,use as X,useEffect as Y,useMemo as rr,useState as re}from"react";import{FaRepeat as rn}from"react-icons/fa6";import rt from"./apollo-error.module.scss";import{jsx as ro,jsxs as ra}from"react/jsx-runtime";var ri=K(void 0);function rs(){var r=X(ri);if(!r)throw new Error("useApolloErrorViewer must be used within ApolloErrorViewerProvider");return r}var ru=null;function rl(r){ru=r}function rc(r){ru===null||ru===void 0?void 0:ru(r)}function rf(r){var e=r.children;var n=j(re(null),2),t=n[0],o=n[1];Y(function(){rl(o)},[]);var a=rr(function(){return{error:t,showError:o,hideError:function(){return o(null)}}},[t]);return ro(ri,{value:a,children:e})}function rv(){var r=X(ri),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)?ra("div",{children:[ra("strong",{children:[r,":"]}),ro("ul",{children:e.map(function(r){return ro("li",{children:r.message},r.message)})})]}):null};return ro("div",{className:rt["modal-backdrop"],children:ra("div",{className:rt["modal-content"],children:[ro("button",{type:"button",className:rt["btn-close"],onClick:r.hideError,children:"✕"}),ra("div",{className:rt["error-title"],children:[ro("button",{type:"button",className:rt["btn-retry"],onClick:function(){return window.location.reload()},children:ro(rn,{})}),e.message]}),ra("div",{className:rt["error-details"],children:[e.networkError&&ra("pre",{className:"network",children:[ro("strong",{children:"Network Error:"})," ",e.networkError.message]}),n("GraphQL Errors",N(e.graphQLErrors)),n("Protocol Errors",N(e.protocolErrors)),n("Client Errors",N(e.clientErrors)),e.extraInfo&&ra("pre",{className:"extra",children:[ro("strong",{children:"Extra Info:"})," ",JSON.stringify(e.extraInfo,null,4)]})]})]})})}import{Fragment as rd,jsx as rp,jsxs as rm}from"react/jsx-runtime";var rh=/*#__PURE__*/function(r){"use strict";v(e,r);function e(){s(this,e);var r;r=i(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,a=r.operationName||"Unnamed";return $.info("[Apollo] #".concat(n.count,": ").concat(a," (").concat(o,"ms)")),e})}}]);return e}(_);function ry(r){var e=r||{},n=e.uri,t=e.wsUrl,o=e.customLinks,a=new rh,i=V(function(r){var e=r.graphQLErrors,n=r.networkError,t=r.protocolErrors,o=r.operation;var a=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,n=r.locations,t=r.path;$.error("[GraphQL error] ".concat(a,": ").concat(e,", Location: ").concat(JSON.stringify(n),", Path: ").concat(t))}),t&&t.forEach(function(r){var e=r.message,n=r.extensions;$.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(n)))}),n&&$.error("[Network error]: ".concat(n)),e||t||n){var i,s;var u=(e===null||e===void 0?void 0:(i=e[0])===null||i===void 0?void 0:i.message)||(t===null||t===void 0?void 0:(s=t[0])===null||s===void 0?void 0:s.message)||(n===null||n===void 0?void 0:n.message)||"Unexpected error",l=new A({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:u,extraInfo:{operation:o}});q.error(function(r){return rm(rd,{children:[u,"\xa0",rp(H,{onClick:function(){setTimeout(function(){rc(l)},0),q.dismiss(r.id)}})]})})}}),s=G();n||$.warn('[Apollo] No GraphQL URI provided — using "'.concat(W,'" as default'));var u=new U({uri:n!==null&&n!==void 0?n:W,credentials:"include"}),l=t?new Q(J({url:t})):_.empty(),c=d(l,_)?R(function(r){var e=r.query;var n=z(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},l,u):u;return c===u&&t&&$.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[a,i,s].concat(N(o!==null&&o!==void 0?o:[]),[c])}function rg(r){var e=r.isNextJS,n=r.options,t=r.children,o=r.client,a=r.provider,i=r.cache;var s=n||{},u=s.uri,l=s.wsUrl,c=s.customLinks,f=E(s,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:C)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var v=a||D,p=F(function(){return T(ry({uri:u,wsUrl:l,customLinks:c}))},[u,l,c]),m=F(function(){return new C(g({link:p,cache:d(i,M)?i:new M},f))},[p,i,f]),h=e?rp(v,{makeClient:function(){return m},children:t}):rp(v,{client:m,children:t});return e?rp(v,{makeClient:function(){return m},children:t}):rm(rd,{children:[rm(rf,{children:[h,rp(rv,{})]}),rp(B,{position:"top-right"})]})}import rb from"classnames";import{createContext as rw,use as rE,useCallback as rk,useMemo as rO,useState as rx}from"react";import rj from"./loading.module.scss";import{jsx as rN,jsxs as rS}from"react/jsx-runtime";var rP=rw(void 0);function rL(){var r=rE(rP);if(!r)throw new Error("useLoading must be used within a LoadingProvider");return r}function rI(r){var e=r.full,n=e===void 0?!1:e,t=r.block,o=t===void 0?!1:t,a=r.className,i=a===void 0?"":a,s=r.message,u=s===void 0?"Loading":s,l=E(r,["full","block","className","message"]);function c(){return rS("div",w(g({className:rj.container},l),{children:[rN("div",{className:rj.ring}),rN("div",{className:rj.ring}),rN("div",{className:rj.ring}),rN("div",{className:rj.ring}),u&&rN("div",{className:rj.message,children:u})]}))}return n?rN("div",{className:rb(rj.fullscreen,i),children:c()}):o?rN("div",{className:rb(rj.block,i),children:c()}):c()}function rC(r){var e=r.children;var n=j(rx(!1),2),t=n[0],o=n[1],a=j(rx(!1),2),i=a[0],s=a[1],u=rk(function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),s(r)},[]),l=rk(function(){o(!1),s(!1)},[]),c=rO(function(){return{isLoading:t,isGlobalLoading:i,showLoading:u,hideLoading:l}},[t,i,u,l]);return rN(rP,{value:c,children:t?rN(rI,{full:i}):e})}import{NextIntlClientProvider as rA,useTranslations as r_}from"next-intl";import{createContext as rD,use as rT,useMemo as rU}from"react";import{useCallback as rM,useEffect as rR,useState as rV}from"react";var rG={serialize:function(r){return JSON.stringify(r,function(r,e){return d(e,Date)?{__type:"Date",value:e.toISOString()}:e})},deserialize:function(r){return JSON.parse(r,function(r,e){return(e===null||e===void 0?void 0:e.__type)==="Date"?new Date(e.value):e})}};import rQ from"localforage";var rz={get:function r(r){return a(function(){var e;return I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rQ.getItem(r)];case 1:return[2,n.sent()];case 2:e=n.sent();return[2,($.error('[Storage:get] Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return a(function(){var n;return I(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,rQ.setItem(r,e)];case 1:t.sent();return[3,3];case 2:n=t.sent();$.error('[Storage:set] Error setting key "'.concat(r,'":'),n);return[3,3];case 3:return[2]}})})()},remove:function r(r){return a(function(){var e;return I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rQ.removeItem(r)];case 1:n.sent();return[3,3];case 2:e=n.sent();$.error('[Storage:remove] Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},keys:function r(){return a(function(){var r,e;return I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rQ.keys()];case 1:return[2,(r=n.sent())!==null&&r!==void 0?r:[]];case 2:e=n.sent();return[2,($.error("[Storage:keys] Error getting keys:",e),[])];case 3:return[2]}})})()}};function rJ(r,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rG;var t=j(rV(e),2),o=t[0],i=t[1],s=j(rV(!1),2),u=s[0],l=s[1];rR(function(){var t=!0;return a(function(){var o,a,s,u;return I(this,function(c){switch(c.label){case 0:c.trys.push([0,6,7,8]);return[4,rz.get(r)];case 1:o=c.sent();if(!t)return[3,5];if(!(o!==null))return[3,2];a=n.deserialize(o);i(a);return[3,5];case 2:if(!(e!==void 0))return[3,4];s=n.serialize(e);return[4,rz.set(r,s)];case 3:c.sent(),i(e);return[3,5];case 4:i(void 0);c.label=5;case 5:return[3,8];case 6:u=c.sent();$.error('Error loading value for key "'.concat(r,'":'),u),t&&i(e);return[3,8];case 7:t&&l(!0);return[7];case 8:return[2]}})})(),function(){t=!1,l(!1)}},[r,e,n]),rR(function(){if(!u)return;a(function(){var e,t;return I(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);if(!(o!==void 0))return[3,2];e=n.serialize(o);return[4,rz.set(r,e)];case 1:a.sent();a.label=2;case 2:return[3,4];case 3:t=a.sent();$.error('Error saving value for key "'.concat(r,'":'),t);return[3,4];case 4:return[2]}})})()},[o,r,n,u]);var c=rM(function(r){i(function(e){return typeof r=="function"?r(e):r})},[]),f=rM(/*#__PURE__*/a(function(){var e;return I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rz.remove(r)];case 1:n.sent(),i(void 0);return[3,3];case 2:e=n.sent();$.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})}),[r]);return{value:o,set:c,remove:f}}import{Fragment as rF,jsx as rq}from"react/jsx-runtime";var rB=rD(void 0);function rH(){var r=rT(rB);if(!r)throw new Error("useNextIntl must be used within a NextIntlProvider");return r}var rW=r_;function rZ(r){var e=function(e){var n;var t=rH(),o=t.currentLanguage,a=e.messages,i=e.languages,s="en",u=a[(o===null||o===void 0?void 0:o.value)||s],l=(n=i.find(function(r){return r.value===(o===null||o===void 0?void 0:o.value)}))===null||n===void 0?void 0:n.timezone;return a?rq(rA,{locale:(o===null||o===void 0?void 0:o.value)||s,messages:u,timeZone:l,children:rq(r,g({},e))}):($.warn("Missing messages for language: ".concat((o===null||o===void 0?void 0:o.value)||s)),null)};return e.displayName="withNextIntl(".concat(r.displayName||r.name||"Component",")"),e}function r$(r){var e=r.children;return rq(rF,{children:e})}var rK=rZ(r$);function rX(r){var e=r.children,n=r.languages,t=r.messages;var o;var a=rJ("lang",(o=n===null||n===void 0?void 0:n[0])!==null&&o!==void 0?o:{}),i=a.value,s=a.set,u=rU(function(){return{languages:n,currentLanguage:i,setCurrentLanguage:s}},[n,s,i]);return rq(rB,{value:u,children:rq(rK,{languages:n,messages:t,children:e})})}export{rv as ApolloErrorViewerModal,rf as ApolloErrorViewerProvider,rg as ApolloProvider,rI as Loading,rP as LoadingContext,rC as LoadingProvider,rB as NextIntlContext,rX as NextIntlProvider,rl as registerApolloErrorViewerCallback,rc as showGlobalApolloError,rs as useApolloErrorViewer,rL as useLoading,rH as useNextIntl,rJ as useStorage,rW as useTranslateNextIntl,rZ as withNextIntl};
|