Socket
Socket
Sign inDemoInstall

@urql/exchange-graphcache

Package Overview
Dependencies
Maintainers
31
Versions
294
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@urql/exchange-graphcache - npm Package Compare versions

Comparing version 2.2.5 to 2.2.6

12

CHANGELOG.md
# @urql/exchange-graphcache
## 2.2.6
### Patch Changes
- ⚠️ Fix cache.inspectFields causing an undefined error for uninitialised or cleared commutative layers, by [@kitten](https://github.com/kitten) (See [#626](https://github.com/FormidableLabs/urql/pull/626))
- Improve Store constructor to accept an options object instead of separate arguments, identical to the cacheExchange options. (This is a patch, not a minor, since we consider Store part of the private API), by [@kitten](https://github.com/kitten) (See [#622](https://github.com/FormidableLabs/urql/pull/622))
- Allow a single field to be invalidated using cache.invalidate using two additional arguments, similar to store.resolve; This is a very small addition, so it's marked as a patch, by [@kitten](https://github.com/kitten) (See [#627](https://github.com/FormidableLabs/urql/pull/627))
- Prevent variables from being filtered and queries from being altered before they're forwarded, which prevented additional untyped variables from being used inside updater functions, by [@kitten](https://github.com/kitten) (See [#629](https://github.com/FormidableLabs/urql/pull/629))
- Expose generated result data on writeOptimistic and passthrough data on write operations, by [@kitten](https://github.com/kitten) (See [#613](https://github.com/FormidableLabs/urql/pull/613))
- Updated dependencies (See [#621](https://github.com/FormidableLabs/urql/pull/621))
- @urql/core@1.10.2
## 2.2.5

@@ -4,0 +16,0 @@

2

dist/types/ast/index.d.ts

@@ -1,4 +0,4 @@

export { getFieldArguments, normalizeVariables } from './variables';
export * from './variables';
export * from './traversal';
export * from './schemaPredicates';
export * from './node';

@@ -5,3 +5,5 @@ import { FieldNode, OperationDefinitionNode } from 'graphql';

export declare const getFieldArguments: (node: FieldNode, vars: Variables) => Variables | null;
/** Returns a filtered form of variables with values missing that the query doesn't require */
export declare const filterVariables: (node: OperationDefinitionNode, input: void | object) => any;
/** Returns a normalized form of variables with defaulted values */
export declare const normalizeVariables: (node: OperationDefinitionNode, input: void | object) => Variables;

@@ -1,3 +0,4 @@

import { OperationRequest } from '../types';
import { Variables, OperationRequest } from '../types';
import { Store } from '../store';
export declare const invalidate: (store: Store, request: OperationRequest) => void;
export declare const invalidateEntity: (entityKey: string, field?: string | undefined, args?: Variables | undefined) => void;

@@ -5,2 +5,3 @@ import { DocumentNode } from 'graphql';

export interface WriteResult {
data: null | Data;
dependencies: Set<string>;

@@ -7,0 +8,0 @@ }

@@ -5,2 +5,9 @@ import { DocumentNode, IntrospectionQuery, GraphQLSchema } from 'graphql';

declare type RootField = 'query' | 'mutation' | 'subscription';
export interface StoreOpts {
updates?: Partial<UpdatesConfig>;
resolvers?: ResolverConfig;
optimistic?: OptimisticMutationConfig;
keys?: KeyingConfig;
schema?: IntrospectionQuery;
}
export declare class Store implements Cache {

@@ -21,3 +28,3 @@ data: InMemoryData.InMemoryData;

};
constructor(rawSchema?: IntrospectionQuery, resolvers?: ResolverConfig, updates?: Partial<UpdatesConfig>, optimisticMutations?: OptimisticMutationConfig, keys?: KeyingConfig);
constructor(opts?: StoreOpts);
keyOfField: (fieldName: string, args?: Variables | null | undefined) => string;

@@ -28,3 +35,3 @@ keyOfEntity(data: Data): string | null;

invalidateQuery(query: string | DocumentNode, variables?: Variables): void;
invalidate(entity: Data | string): void;
invalidate(entity: Data | string, field?: string, args?: Variables): void;
inspectFields(entity: Data | string | null): FieldInfo[];

@@ -31,0 +38,0 @@ updateQuery(input: QueryInput, updater: (data: Data | null) => DataFields | null): void;

@@ -65,4 +65,4 @@ import { DocumentNode, FragmentDefinitionNode } from 'graphql';

invalidateQuery(query: DocumentNode, variables?: Variables): void;
/** invalidate() invalidates an entity */
invalidate(entity: Data | string): void;
/** invalidate() invalidates an entity or a specific field of an entity */
invalidate(entity: Data | string, fieldName?: string, args?: Variables): void;
/** updateQuery() can be used to update the data of a given query using an updater function */

@@ -69,0 +69,0 @@ updateQuery(input: QueryInput, updater: (data: Data | null) => Data | null): void;

@@ -28,12 +28,24 @@ "use strict";

return 0 < d ? c : null;
}, filterVariables = function(a, b) {
if (b && a.variableDefinitions) {
for (var c = makeDict(), d = 0, e = a.variableDefinitions.length; d < e; d++) {
var f = getName(a.variableDefinitions[d].variable);
c[f] = b[f];
}
return c;
}
}, normalizeVariables = function(a, b) {
b = b || {};
var c = makeDict();
if (!b) {
return c;
}
if (a.variableDefinitions) {
for (var d = 0, e = a.variableDefinitions.length; d < e; d++) {
var f = a.variableDefinitions[d], g = getName(f.variable), h = b[g];
void 0 === h && f.defaultValue && (h = graphql.valueFromASTUntyped(f.defaultValue, b));
c[g] = h;
var f = a.variableDefinitions[d], g = getName(f.variable);
c[g] = void 0 === b[g] && f.defaultValue ? graphql.valueFromASTUntyped(f.defaultValue, b) : b[g];
}
}
for (var h in b) {
h in c || (c[h] = b[h]);
}
return c;

@@ -223,3 +235,4 @@ }, helpUrl = "\nhttps://bit.ly/38yWDau#", cache = new Set, currentDebugStack = [], pushDebugNode = function(a, b) {

for (var e = 0, f = currentData.optimisticOrder.length; e < f; e++) {
extractNodeFields(a, b, d.optimistic[currentData.optimisticOrder[e]].get(c));
var g = d.optimistic[currentData.optimisticOrder[e]];
void 0 !== g && extractNodeFields(a, b, g.get(c));
}

@@ -316,2 +329,8 @@ }, gc = function(a) {

deleteLayer(currentData, a);
}, inspectFields = function(a) {
var b = currentData.links, c = currentData.records, d = [], e = new Set;
updateDependencies(a);
extractNodeMapFields(d, e, a, b);
extractNodeMapFields(d, e, a, c);
return d;
}, makeContext = function(a, b, c, d, e, f) {

@@ -387,2 +406,3 @@ return {

var d = getMainOperation(b.query), e = {
data: c,
dependencies: getCurrentDependencies()

@@ -398,2 +418,3 @@ }, f = a.rootFields[d.operation];

var d = {
data: makeDict(),
dependencies: getCurrentDependencies()

@@ -404,4 +425,3 @@ }, e = a.rootFields[c.operation];

a = makeContext(a, normalizeVariables(c, b.variables), getFragments(b.query), e, e, !0);
b = makeDict();
writeSelection(a, e, getSelectionSet(c), b);
writeSelection(a, e, getSelectionSet(c), d.data);
clearDataState();

@@ -469,31 +489,30 @@ return d;

return d || null;
}, Store = function(a, b, c, d, e) {
var f;
}, Store = function(a) {
var b;
this.keyOfField = keyOfField;
this.resolvers = b || {};
this.optimisticMutations = d || {};
this.keys = e || {};
a || (a = {});
this.resolvers = a.resolvers || {};
this.optimisticMutations = a.optimistic || {};
this.keys = a.keys || {};
this.updates = {
Mutation: c && c.Mutation || {},
Subscription: c && c.Subscription || {}
Mutation: a.updates && a.updates.Mutation || {},
Subscription: a.updates && a.updates.Subscription || {}
};
b = "Query";
c = "Mutation";
d = "Subscription";
if (a) {
var g = this.schema = graphql.buildClientSchema(a);
a = g.getQueryType();
e = g.getMutationType();
g = g.getSubscriptionType();
a && (b = a.name);
e && (c = e.name);
var c = "Query", d = "Mutation", e = "Subscription";
if (a.schema) {
var f = this.schema = graphql.buildClientSchema(a.schema);
a = f.getQueryType();
var g = f.getMutationType();
f = f.getSubscriptionType();
a && (c = a.name);
g && (d = g.name);
f && (e = f.name);
}
this.rootFields = {
query: b,
mutation: c,
subscription: d
query: c,
mutation: d,
subscription: e
};
this.rootNames = ((f = {})[b] = "query", f[c] = "mutation", f[d] = "subscription",
f);
this.rootNames = ((b = {})[c] = "query", b[d] = "mutation", b[e] = "subscription",
b);
this.data = function(a) {

@@ -514,3 +533,3 @@ return {

};
}(b);
}(c);
};

@@ -556,20 +575,19 @@

Store.prototype.invalidate = function(a) {
var b = "string" == typeof a ? a : this.keyOfEntity(a);
invariant(b, "production" !== process.env.NODE_ENV ? "object" == "Can't generate a key for invalidate(...).\nYou have to pass an id or _id field or create a custom `keys` field for `" + typeof a ? a.__typename : a + "`." : "", 19);
a = 0;
for (var c = this.inspectFields(b); a < c.length; a += 1) {
var d = c[a];
readLink(b, d.fieldKey) ? writeLink(b, d.fieldKey, void 0) : writeRecord(b, d.fieldKey, void 0);
}
Store.prototype.invalidate = function(a, b, c) {
var d = "string" == typeof a ? a : this.keyOfEntity(a);
invariant(d, "production" !== process.env.NODE_ENV ? "object" == "Can't generate a key for invalidate(...).\nYou have to pass an id or _id field or create a custom `keys` field for `" + typeof a ? a.__typename : a + "`." : "", 19);
!function(a, b, c) {
b = b ? [ {
fieldKey: keyOfField(b, c)
} ] : inspectFields(a);
c = 0;
for (var d = b.length; c < d; c++) {
var e = b[c].fieldKey;
readLink(a, e) ? writeLink(a, e, void 0) : writeRecord(a, e, void 0);
}
}(d, b, c);
};
Store.prototype.inspectFields = function(a) {
return null !== (a = null !== a && "string" != typeof a ? this.keyOfEntity(a) : a) ? function(a) {
var b = currentData.links, c = currentData.records, d = [], e = new Set;
updateDependencies(a);
extractNodeMapFields(d, e, a, b);
extractNodeMapFields(d, e, a, c);
return d;
}(a) : [];
return null !== (a = null !== a && "string" != typeof a ? this.keyOfEntity(a) : a) ? inspectFields(a) : [];
};

@@ -767,21 +785,17 @@

function _ref5(a) {
return addCacheOutcome(a.operation, "miss");
return "query" !== a.operationName || "network-only" === a.context.requestPolicy;
}
function _ref6(a) {
return "miss" === a.outcome;
return addCacheOutcome(a.operation, "miss");
}
function _ref8(a) {
return "miss" !== a.outcome;
function _ref7(a) {
return "miss" === a.outcome && "cache-only" !== a.operation.context.requestPolicy;
}
function _ref9(a) {
return "cache-only" !== a.context.requestPolicy;
return "miss" !== a.outcome || "cache-only" === a.operation.context.requestPolicy;
}
function _ref10(a) {
return !("query" === a.operationName && "network-only" !== a.context.requestPolicy);
}
exports.populateExchange = exchangePopulate.populateExchange;

@@ -806,6 +820,4 @@

}
var e = b.forward, f = b.client;
a || (a = {});
var h, g = new Store(a.schema, a.resolvers, a.updates, a.optimistic, a.keys);
a.storage && (h = a.storage.read().then((function c(b) {
var h, e = b.forward, f = b.client, g = new Store(a);
a && a.storage && (h = a.storage.read().then((function c(b) {
!function(a, b, c) {

@@ -849,2 +861,6 @@ initDataState(a, null);

"query" === a.operationName ? reserveLayer(g.data, a.key) : "teardown" === a.operationName && noopDataState(g.data, a.key);
return _rollupPluginBabelHelpers._extends({}, a, {
variables: a.variables ? filterVariables(getMainOperation(a.query), a.variables) : a.variables,
query: core.formatDocument(a.query)
});
}, w = function(a) {

@@ -864,3 +880,3 @@ var b = a.key;

}, t = function(a) {
var b = query(g, a), c = b.data ? b.partial && "cache-only" !== a.context.requestPolicy ? "partial" : "hit" : "miss";
var b = query(g, a), c = b.data ? b.partial ? "partial" : "hit" : "miss";
b.data && u(a, b.dependencies);

@@ -896,8 +912,9 @@ return {

var b = h ? wonka.mergeMap(wonka.fromArray)(wonka.take(1)(wonka.buffer(wonka.fromPromise(h))(a))) : wonka.empty;
a = wonka.share(wonka.tap(w)(wonka.map(_ref3$1)(wonka.concat([ b, a ]))));
var c = wonka.share(wonka.map(t)(wonka.filter(_ref4$1)(a)));
b = wonka.map(_ref5)(wonka.filter(_ref6)(c));
c = wonka.map(d)(wonka.filter(_ref8)(c));
a = wonka.map(v)(e(wonka.tap(r)(wonka.filter(_ref9)(wonka.merge([ wonka.filter(_ref10)(a), b ])))));
return wonka.merge([ a, c ]);
b = wonka.share(wonka.tap(w)(wonka.map(_ref3$1)(wonka.concat([ b, a ]))));
a = wonka.share(wonka.map(t)(wonka.filter(_ref4$1)(b)));
b = wonka.filter(_ref5)(b);
var c = wonka.map(_ref6)(wonka.filter(_ref7)(a));
a = wonka.map(d)(wonka.filter(_ref9)(a));
b = wonka.map(v)(e(wonka.map(r)(wonka.merge([ b, c ]))));
return wonka.merge([ b, a ]);
};

@@ -904,0 +921,0 @@ };

@@ -1,2 +0,2 @@

"use strict";var e=require("./5329e1b9.cjs.min.js"),t=require("graphql"),n=require("@urql/core"),r=require("wonka"),i=require("@urql/exchange-populate"),o=function(e){return e.name.value},a=function(e){return e.typeCondition.name.value},s=function(e){return e.alias?e.alias.value:o(e)},u=function(e){return e.selectionSet?e.selectionSet.selections:[]},c=function(e){return(e=e.typeCondition)?o(e):null},l=function(e){return e.kind===t.Kind.FIELD},f=function(e){return e.kind===t.Kind.INLINE_FRAGMENT},d=function(){return Object.create(null)},p=function(e,n){var r=d(),i=0;if(e.arguments&&e.arguments.length)for(var a=0,s=e.arguments.length;a<s;a++){var u=e.arguments[a],c=t.valueFromASTUntyped(u.value,n);null!=c&&(r[o(u)]=c,i++)}return 0<i?r:null},y=function(e,n){n=n||{};var r=d();if(e.variableDefinitions)for(var i=0,a=e.variableDefinitions.length;i<a;i++){var s=e.variableDefinitions[i],u=o(s.variable),c=n[u];void 0===c&&s.defaultValue&&(c=t.valueFromASTUntyped(s.defaultValue,n)),r[u]=c}return r};function v(e,t,n){if(!e)throw(e=Error((t||"Minfied Error #"+n+"\n")+"\nhttps://bit.ly/38yWDau#"+n)).name="Graphcache Error",e}var m=function(e){return e.kind===t.Kind.FRAGMENT_DEFINITION};function h(e){return e.kind===t.Kind.OPERATION_DEFINITION}var g=function(e){return v(!!(e=e.definitions.find(h)),"",1),e};function k(e,t){return e[o(t)]=t,e}var x=function(e){return e.definitions.filter(m).reduce(k,{})},_=function(e,n){var r=e.directives;if(!r)return!0;for(var i=0,a=r.length;i<a;i++){var s=r[i];if(("include"===(e=o(s))||"skip"===e)&&s.arguments&&s.arguments[0]&&"if"===o(s.arguments[0]))return n=t.valueFromASTUntyped(s.arguments[0].value,n),"include"===e?!!n:!n}return!0},b=function(e,n,r){return!!(e=S(e,n,r))&&t.isNullableType(e.type)},O=function(e,n,r){return!!(e=S(e,n,r))&&(e=t.isNonNullType(e.type)?e.type.ofType:e.type,t.isListType(e)&&t.isNullableType(e.ofType))},q=function(e,n,r){return!(!r||!n)&&(r===n||(n=e.getType(n),r=e.getType(r),n instanceof t.GraphQLObjectType?n===r:(function(e,n){v(e instanceof t.GraphQLInterfaceType||e instanceof t.GraphQLUnionType,"",5)}(n),w(r),e.isPossibleType(n,r))))},S=function(e,t,n){return w(e=e.getType(t)),e.getFields()[n]};function w(e,n){v(e instanceof t.GraphQLObjectType,"",3)}var N=function(e,t){return t?e+"("+n.stringifyVariables(t)+")":e},E=function(e){var t=e.indexOf("(");return-1<t?{fieldKey:e,fieldName:e.slice(0,t),arguments:JSON.parse(e.slice(t+1,-1))}:{fieldKey:e,fieldName:e,arguments:null}},K=function(e,t){return e+"."+t},T=function(e,t){return e+"|"+t},F="undefined"!=typeof Promise?Promise.prototype.then.bind(Promise.resolve()):function(e){return setTimeout(e,0)},A=null,L=null,B=null,M=null,P=function(){return{optimistic:d(),base:new Map}},R=function(e,t,n){A=e,B=L,L=new Set,t?n||1<e.optimisticOrder.length&&-1<e.optimisticOrder.indexOf(t)?(n||e.commutativeKeys.has(t)||(re(e,t),e.commutativeKeys.add(t)),M=t,ne(e,t)):(M=null,ie(e,t)):M=null},I=function(){var e=A,t=M;if(M=null,t&&-1<e.optimisticOrder.indexOf(t))for(t=e.optimisticOrder.length;0<=--t&&e.refLock[e.optimisticOrder[t]]&&e.commutativeKeys.has(e.optimisticOrder[t]);)se(e.optimisticOrder[t]);L=A=null,!e.gcScheduled&&0<e.gcBatch.size&&(e.gcScheduled=!0,F((function(){H(e)}))),e.storage&&!e.persistenceScheduled&&(e.persistenceScheduled=!0,F((function(){e.storage.write(e.persistenceBatch),e.persistenceScheduled=!1,e.persistenceBatch=d()})))},C=function(e,t,n){R(e,t,n),I()},Q=function(){return v(null!==L,"",2),L},j=function(){return B=L,L=new Set},D=function(){L=B,B=null},G=function(e,t,n,r){var i=(e=M?e.optimistic[M]:e.base).get(t);void 0===i&&e.set(t,i=d()),void 0!==r||M?i[n]=r:delete i[n]},U=function(e,t,n){for(var r,i=0,o=A.optimisticOrder.length;i<o;i++){var a=e.optimistic[A.optimisticOrder[i]];if(a&&void 0!==(r=a.get(t))&&n in r)return r[n]}return void 0!==(r=e.base.get(t))?r[n]:void 0},W=function(e,t,n,r){var i=void 0!==t[n]?t[n]:0;t=t[n]=i+r|0,void 0!==e&&(0>=t?e.add(n):0>=i&&0<t&&e.delete(n))},V=function(e,t,n,r){if("string"==typeof n)W(e,t,n,r);else if(Array.isArray(n))for(var i=0,o=n.length;i<o;i++){var a=n[i];a&&W(e,t,a,r)}},z=function(e,t,n){if(void 0!==n)for(var r in n)t.has(r)||(e.push(E(r)),t.add(r))},J=function(e,t,n,r){z(e,t,r.base.get(n));for(var i=0,o=A.optimisticOrder.length;i<o;i++)z(e,t,r.optimistic[A.optimisticOrder[i]].get(n))},H=function(e){e.gcScheduled=!1,e.gcBatch.forEach((function(t){if(0>=(e.refCount[t]||0)){for(var n in e.refLock){var r=e.refLock[n];if(0<(r[t]||0))return;delete r[t]}if(delete e.refCount[t],e.gcBatch.delete(t),void 0!==(n=e.records.base.get(t))&&(e.records.base.delete(t),e.storage))for(var i in n)n=T("r",K(t,i)),e.persistenceBatch[n]=void 0;if(void 0!==(i=e.links.base.get(t)))for(var o in e.links.base.delete(t),i)e.storage&&(n=T("l",K(t,o)),e.persistenceBatch[n]=void 0),V(e.gcBatch,e.refCount,i[o],-1)}else e.gcBatch.delete(t)}))},X=function(e,t){"__typename"!==t&&(e!==A.queryRootKey?L.add(e):void 0!==t&&L.add(K(e,t)))},Y=function(e,t){return X(e,t),U(A.records,e,t)},Z=function(e,t){return X(e,t),U(A.links,e,t)},$=function(e,t,n){X(e,t),G(A.records,e,t,n),A.storage&&!M&&(e=T("r",K(e,t)),A.persistenceBatch[e]=n)},ee=function(e,t,n){var r=A;if(M)var i=r.refLock[M]||(r.refLock[M]=d()),o=r.links.optimistic[M];else{r.storage&&(i=T("l",K(e,t)),r.persistenceBatch[i]=n),i=r.refCount,o=r.links.base;var a=r.gcBatch}o=(o=o&&o.get(e))&&o[t],X(e,t),G(r.links,e,t,n),V(a,i,o,-1),V(a,i,n,1)},te=function(e,t){e.commutativeKeys.has(t)||(e.optimisticOrder.unshift(t),e.commutativeKeys.add(t))},ne=function(e,t){-1===e.optimisticOrder.indexOf(t)&&e.optimisticOrder.unshift(t),e.refLock[t]||(e.refLock[t]=d(),e.links.optimistic[t]=new Map,e.records.optimistic[t]=new Map)},re=function(e,t){e.refLock[t]&&(delete e.refLock[t],delete e.records.optimistic[t],delete e.links.optimistic[t])},ie=function(e,t){var n=e.optimisticOrder.indexOf(t);-1<n&&(e.optimisticOrder.splice(n,1),e.commutativeKeys.delete(t)),re(e,t)};function oe(e,t){for(var n in e)ee(t,n,e[n])}function ae(e,t){for(var n in e)$(t,n,e[n])}var se=function(e){j();var t=A.links.optimistic[e];t&&t.forEach(oe),(t=A.records.optimistic[e])&&t.forEach(ae),D(),ie(A,e)},ue=function(e,t,n,r,i,o){return{store:e,variables:t,fragments:n,parentTypeName:r,parentKey:i,parentFieldKey:"",fieldName:"",partial:!1,optimistic:!!o}},ce=function(e,t,n,r,i){e.parentTypeName=t,e.parentKey=n,e.parentFieldKey=r,e.fieldName=i},le=function(e,t,n,r){return!(!t||t!==c(e)&&u(e).some((function(e){return!!l(e)&&(e=N(o(e),p(e,r)),!function(e,t){return void 0!==Y(e,t)||void 0!==Z(e,t)}(n,e))})))},fe=function(e,t,n,r){this.typename=e,this.entityKey=t,this.context=r,this.indexStack=[0],this.selectionStack=[n]};fe.prototype.next=function(){for(;0!==this.indexStack.length;){var e=this.indexStack[this.indexStack.length-1]++,t=this.selectionStack[this.selectionStack.length-1];if(e>=t.length)this.indexStack.pop(),this.selectionStack.pop();else if(_(e=t[e],this.context.variables))if(l(e)){if("__typename"!==o(e))return e}else void 0!==(e=f(e)?e:this.context.fragments[o(e)])&&(this.context.store.schema?q(this.context.store.schema,c(e),this.typename):le(e,this.typename,this.entityKey,this.context.variables))&&(this.indexStack.push(0),this.selectionStack.push(u(e)))}};var de=function(e){return void 0===e?null:e},pe=function(e,t,n,r){return R(e.data,r||null),e=ye(e,t,n),I(),e},ye=function(e,t,n){var r=g(t.query),i={dependencies:Q()},o=e.rootFields[r.operation];return e=ue(e,y(r,t.variables),x(t.query),o,o),me(e,o,u(r),n),i},ve=function(e,t,n){R(e.data,n,!0),n=g(t.query);var r={dependencies:Q()},i=e.rootFields[n.operation];return v(i===e.rootFields.mutation,"",10),e=ue(e,y(n,t.variables),x(t.query),i,i,!0),t=d(),me(e,i,u(n),t),I(),r},me=function(e,t,n,r){var i=t===e.store.rootFields.query,a=!i&&!!e.store.rootNames[t],c=a||i?t:r.__typename;if(c){a||i||!t||$(t,"__typename",c),n=new fe(c,t||c,n,e);for(var l;l=n.next();){var f=o(l);i=p(l,e.variables);var y=N(f,i),v=r[s(l)];if(l.selectionSet){if(e.optimistic&&a){if(!(v=e.store.optimisticMutations[f]))continue;ce(e,c,c,y,f),v=de(v(i||d(),e.store,e)),r[f]=v}else v=de(v);if(t&&!a){var m=K(t,y);l=he(e,u(l),v,m),ee(t||c,y,l)}else he(e,u(l),v)}else t&&!a&&$(t||c,y,v);a&&(ce(e,c,c,K(c,y),f),(f=e.store.updates[c][f])&&f(r,i||d(),e.store,e))}}},he=function(e,t,n,r){if(Array.isArray(n)){for(var i=Array(n.length),o=0,a=n.length;o<a;o++){var s=n[o],u=r?K(r,""+o):void 0;s=he(e,t,s,u),i[o]=s}return i}return null===n?null:(i=e.store.keyOfEntity(n),o=n.__typename,!r||void 0!==e.store.keys[n.__typename]||null!==i||"string"!=typeof o||o.endsWith("Connection")||o.endsWith("Edge"),me(e,r=i||r,t,n),r||null)},ge=function(e,n,r,i,o){var a;if(this.keyOfField=N,this.resolvers=n||{},this.optimisticMutations=i||{},this.keys=o||{},this.updates={Mutation:r&&r.Mutation||{},Subscription:r&&r.Subscription||{}},n="Query",r="Mutation",i="Subscription",e){var s=this.schema=t.buildClientSchema(e);e=s.getQueryType(),o=s.getMutationType(),s=s.getSubscriptionType(),e&&(n=e.name),o&&(r=o.name),s&&(i=s.name)}this.rootFields={query:n,mutation:r,subscription:i},this.rootNames=((a={})[n]="query",a[r]="mutation",a[i]="subscription",a),this.data=function(e){return{persistenceScheduled:!1,persistenceBatch:d(),gcScheduled:!1,queryRootKey:e,gcBatch:new Set,refCount:d(),refLock:d(),links:P(),records:P(),commutativeKeys:new Set,optimisticOrder:[],storage:null}}(n)};ge.prototype.keyOfEntity=function(e){var t,n=e.__typename,r=e.id,i=e._id;return n?void 0!==this.rootNames[n]?n:(this.keys[n]?t=this.keys[n](e):null!=r?t=""+r:null!=i&&(t=""+i),t?n+":"+t:null):null},ge.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var n=Y(e,t);return void 0!==n?n:(t=Z(e,t))?t:null},ge.prototype.resolve=function(e,t,n){return this.resolveFieldByKey(e,N(t,n))},ge.prototype.invalidateQuery=function(e,t){!function(e,t){var n=j();xe(e,t),n.forEach((function(t){t.startsWith(e.data.queryRootKey+".")?(t=t.slice((e.data.queryRootKey+".").length),ee(e.data.queryRootKey,t),$(e.data.queryRootKey,t)):e.invalidate(t)})),D(),H(e.data)}(this,n.createRequest(e,t))},ge.prototype.invalidate=function(e){v(e="string"==typeof e?e:this.keyOfEntity(e),"",19);for(var t=0,n=this.inspectFields(e);t<n.length;t+=1){var r=n[t];Z(e,r.fieldKey)?ee(e,r.fieldKey,void 0):$(e,r.fieldKey,void 0)}},ge.prototype.inspectFields=function(e){return null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)?function(e){var t=A.links,n=A.records,r=[],i=new Set;return X(e),J(r,i,e,t),J(r,i,e,n),r}(e):[]},ge.prototype.updateQuery=function(e,t){e=n.createRequest(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&ye(this,e,t)},ge.prototype.readQuery=function(e){return xe(this,n.createRequest(e.query,e.variables)).data},ge.prototype.readFragment=function(e,t,n){return Oe(this,e,t,n)},ge.prototype.writeFragment=function(t,n,r){!function(t,n,r,i){n=x(n);var o=Object.keys(n);if(void 0!==(o=n[o[0]])){var s=a(o);r=e._extends({},{__typename:s},r);var c=t.keyOfEntity(r);c&&(t=ue(t,i||{},n,s,c),me(t,c,u(o),r))}}(this,t,n,r)};var ke=function(e,t,n){return R(e.data,null),e=xe(e,t,n),I(),e},xe=function(e,t,n){var r=g(t.query),i=e.rootFields[r.operation],o=u(r);return e=ue(e,y(r,t.variables),x(t.query),i,i),n=n||d(),n=i!==e.store.rootFields.query?_e(e,i,o,n):qe(e,i,o,n),{dependencies:Q(),partial:void 0!==n&&e.partial,data:void 0===n?null:n}},_e=function(e,t,n,r){if("string"!=typeof r.__typename)return r;t=new fe(t,t,n,e),(n=d()).__typename=r.__typename;for(var i;void 0!==(i=t.next());){var o=s(i),a=r[o];void 0!==i.selectionSet&&null!==a?(a=de(a),n[o]=be(e,u(i),a)):n[o]=a}return n},be=function(e,t,n){if(Array.isArray(n)){for(var r=Array(n.length),i=0,o=n.length;i<o;i++)r[i]=be(e,t,n[i]);return r}return null===n?null:null!==(r=e.store.keyOfEntity(n))?void 0===(e=qe(e,r,t,d()))?null:e:_e(e,n.__typename,t,n)},Oe=function(t,n,r,i){n=x(n);var o=Object.keys(n);if(void 0===(o=n[o[0]]))return null;var s=a(o);return"string"==typeof r||r.__typename||(r.__typename=s),(r="string"!=typeof r?t.keyOfEntity(e._extends({},{__typename:s},r)):r)?(t=ue(t,i||{},n,s,r),qe(t,r,u(o),d())||null):null},qe=function(e,t,n,r,i){var a=e.store,c=t===a.rootFields.query,l=i&&a.keyOfEntity(i)||t;if(!("string"!=typeof(t=c?t:Y(l,"__typename")||i&&i.__typename)||i&&t!==i.__typename)){r.__typename=t,n=new fe(t,l,n,e);for(var f,y=!1,v=!1;void 0!==(f=n.next());){var m=o(f),h=p(f,e.variables),g=s(f),k=N(m,h),x=K(l,k),_=Y(l,k),O=i?i[m]:void 0,q=a.resolvers[t],S=void 0;if(void 0!==O&&void 0===f.selectionSet)S=O;else if(q&&"function"==typeof q[m]){if(ce(e,t,l,x,m),void 0!==_&&(r[g]=_),S=q[m](r,h||d(),a,e),void 0!==f.selectionSet&&(S=Se(e,t,m,x,u(f),r[g]||d(),S)),a.schema&&null===S&&!b(a.schema,t,m))return}else void 0===f.selectionSet?S=_:void 0!==O?S=Se(e,t,m,x,u(f),r[g],O):void 0!==(h=Z(l,k))?S=we(e,h,t,m,u(f),r[g]):"object"==typeof _&&null!==_&&(S=_);if(void 0===S&&a.schema&&b(a.schema,t,m))v=!0,r[g]=null;else{if(void 0===S)return;y=!0,r[g]=S}}return v&&(e.partial=!0),c&&v&&!y?void 0:r}},Se=function(e,t,n,r,i,o,a){if(Array.isArray(a)){var s=e.store;s=!s.schema||O(s.schema,t,n);for(var u=Array(a.length),c=0,l=a.length;c<l;c++){var f=Se(e,t,n,K(r,""+c),i,void 0!==o?o[c]:void 0,a[c]);if(void 0===f&&!s)return;u[c]=void 0!==f?f:null}return u}return null==a?a:Ne(a)?(t=void 0===o?d():o,"string"==typeof a?qe(e,a,i,t):qe(e,r,i,t,a)):void 0},we=function(e,t,n,r,i,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&O(a.schema,n,r);for(var s=Array(t.length),u=0,c=t.length;u<c;u++){var l=we(e,t[u],n,r,i,void 0!==o?o[u]:void 0);if(void 0===l&&!a)return;s[u]=void 0!==l?l:null}return s}return null===t?null:qe(e,t,i,void 0===o?d():o)},Ne=function(e){return"string"==typeof e||"object"==typeof e&&"string"==typeof e.__typename},Ee=function(t,n){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,{cacheOutcome:n})})})},Ke=function(t,n){return e._extends({},t,{context:e._extends({},t.context,{requestPolicy:n})})};function Te(t){return e._extends({},t,{query:n.formatDocument(t.query)})}function Fe(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function Ae(e){return Ee(e.operation,"miss")}function Le(e){return"miss"===e.outcome}function Be(e){return"miss"!==e.outcome}function Me(e){return"cache-only"!==e.context.requestPolicy}function Pe(e){return!("query"===e.operationName&&"network-only"!==e.context.requestPolicy)}exports.populateExchange=i.populateExchange,exports.Store=ge,exports.cacheExchange=function(e){return function(t){function n(e){var t=e.operation,n=e.outcome;return e={operation:Ee(t,n),data:e.data,error:e.error,extensions:e.extensions},("cache-and-network"===t.context.requestPolicy||"cache-first"===t.context.requestPolicy&&"partial"===n)&&(e.stale=!0,o.reexecuteOperation(Ke(t,"network-only"))),e}var i=t.forward,o=t.client;e||(e={});var a,s=new ge(e.schema,e.resolvers,e.updates,e.optimistic,e.keys);e.storage&&(a=e.storage.read().then((function(t){!function(e,t,n){for(var r in R(e,null),n){var i=r.indexOf("."),o=r.slice(2,i);switch(i=r.slice(i+1),r.charCodeAt(0)){case 108:ee(o,i,n[r]);break;case 114:$(o,i,n[r])}}I(),e.storage=t}(s.data,e.storage,t)})));var u=new Map,c=new Map,l=d(),f=function(e,t){t&&t.forEach((function(t){var n=l[t];if(n){l[t]=[],t=0;for(var r=n.length;t<r;t++)e.add(n[t])}}))},p=function(e,t){t.forEach((function(t){if(t!==e.key){var n=c.get(t);n&&(c.delete(t),o.reexecuteOperation(Ke(n,"cache-first")))}}))},y=function(e){"query"===e.operationName?te(s.data,e.key):"teardown"===e.operationName&&C(s.data,e.key)},v=function(e){var t=e.key;if("mutation"===e.operationName&&"network-only"!==e.context.requestPolicy){var n=ve(s,e,t).dependencies;0!==n.size&&(u.set(t,n),t=new Set,f(t,n),p(e,t))}else C(s.data,t,!0)},m=function(e,t){t.forEach((function(t){(l[t]||(l[t]=[])).push(e.key),c.has(e.key)||c.set(e.key,"network-only"===e.context.requestPolicy?Ke(e,"cache-and-network"):e)}))},h=function(e){var t=ke(s,e),n=t.data?t.partial&&"cache-only"!==e.context.requestPolicy?"partial":"hit":"miss";return t.data&&m(e,t.dependencies),{outcome:n,operation:e,data:t.data}},g=function(e){var t=e.operation,n=e.error,r=e.extensions,i=t.key,o=new Set;if("mutation"===t.operationName?(f(o,u.get(i)),u.delete(i)):"subscription"===t.operationName&&te(s.data,t.key),e.data){if(i=pe(s,t,e.data,i).dependencies,f(o,i),i=ke(s,t,e.data),e.data=i.data,"query"===t.operationName){var a=i.dependencies;f(o,a)}}else C(s.data,t.key);return p(e.operation,o),a&&m(e.operation,a),{data:e.data,error:n,extensions:r,operation:t}};return function(e){e=r.share(e);var t=a?r.mergeMap(r.fromArray)(r.take(1)(r.buffer(r.fromPromise(a))(e))):r.empty;e=r.share(r.tap(v)(r.map(Te)(r.concat([t,e]))));var o=r.share(r.map(h)(r.filter(Fe)(e)));return t=r.map(Ae)(r.filter(Le)(o)),o=r.map(n)(r.filter(Be)(o)),e=r.map(g)(i(r.tap(y)(r.filter(Me)(r.merge([r.filter(Pe)(e),t]))))),r.merge([e,o])}}},exports.noopDataState=C,exports.query=ke,exports.reserveLayer=te,exports.write=pe,exports.writeOptimistic=ve;
"use strict";var e=require("./5329e1b9.cjs.min.js"),t=require("graphql"),n=require("@urql/core"),r=require("wonka"),i=require("@urql/exchange-populate"),o=function(e){return e.name.value},a=function(e){return e.typeCondition.name.value},s=function(e){return e.alias?e.alias.value:o(e)},u=function(e){return e.selectionSet?e.selectionSet.selections:[]},c=function(e){return(e=e.typeCondition)?o(e):null},l=function(e){return e.kind===t.Kind.FIELD},f=function(e){return e.kind===t.Kind.INLINE_FRAGMENT},d=function(){return Object.create(null)},p=function(e,n){var r=d(),i=0;if(e.arguments&&e.arguments.length)for(var a=0,s=e.arguments.length;a<s;a++){var u=e.arguments[a],c=t.valueFromASTUntyped(u.value,n);null!=c&&(r[o(u)]=c,i++)}return 0<i?r:null},y=function(e,t){if(t&&e.variableDefinitions){for(var n=d(),r=0,i=e.variableDefinitions.length;r<i;r++){var a=o(e.variableDefinitions[r].variable);n[a]=t[a]}return n}},v=function(e,n){var r=d();if(!n)return r;if(e.variableDefinitions)for(var i=0,a=e.variableDefinitions.length;i<a;i++){var s=e.variableDefinitions[i],u=o(s.variable);r[u]=void 0===n[u]&&s.defaultValue?t.valueFromASTUntyped(s.defaultValue,n):n[u]}for(var c in n)c in r||(r[c]=n[c]);return r};function m(e,t,n){if(!e)throw(e=Error((t||"Minfied Error #"+n+"\n")+"\nhttps://bit.ly/38yWDau#"+n)).name="Graphcache Error",e}var h=function(e){return e.kind===t.Kind.FRAGMENT_DEFINITION};function g(e){return e.kind===t.Kind.OPERATION_DEFINITION}var k=function(e){return m(!!(e=e.definitions.find(g)),"",1),e};function x(e,t){return e[o(t)]=t,e}var b=function(e){return e.definitions.filter(h).reduce(x,{})},_=function(e,n){var r=e.directives;if(!r)return!0;for(var i=0,a=r.length;i<a;i++){var s=r[i];if(("include"===(e=o(s))||"skip"===e)&&s.arguments&&s.arguments[0]&&"if"===o(s.arguments[0]))return n=t.valueFromASTUntyped(s.arguments[0].value,n),"include"===e?!!n:!n}return!0},q=function(e,n,r){return!!(e=w(e,n,r))&&t.isNullableType(e.type)},O=function(e,n,r){return!!(e=w(e,n,r))&&(e=t.isNonNullType(e.type)?e.type.ofType:e.type,t.isListType(e)&&t.isNullableType(e.ofType))},S=function(e,n,r){return!(!r||!n)&&(r===n||(n=e.getType(n),r=e.getType(r),n instanceof t.GraphQLObjectType?n===r:(function(e,n){m(e instanceof t.GraphQLInterfaceType||e instanceof t.GraphQLUnionType,"",5)}(n),N(r),e.isPossibleType(n,r))))},w=function(e,t,n){return N(e=e.getType(t)),e.getFields()[n]};function N(e,n){m(e instanceof t.GraphQLObjectType,"",3)}var E=function(e,t){return t?e+"("+n.stringifyVariables(t)+")":e},K=function(e){var t=e.indexOf("(");return-1<t?{fieldKey:e,fieldName:e.slice(0,t),arguments:JSON.parse(e.slice(t+1,-1))}:{fieldKey:e,fieldName:e,arguments:null}},T=function(e,t){return e+"."+t},F=function(e,t){return e+"|"+t},A="undefined"!=typeof Promise?Promise.prototype.then.bind(Promise.resolve()):function(e){return setTimeout(e,0)},L=null,B=null,M=null,P=null,D=function(){return{optimistic:d(),base:new Map}},R=function(e,t,n){L=e,M=B,B=new Set,t?n||1<e.optimisticOrder.length&&-1<e.optimisticOrder.indexOf(t)?(n||e.commutativeKeys.has(t)||(ie(e,t),e.commutativeKeys.add(t)),P=t,re(e,t)):(P=null,oe(e,t)):P=null},I=function(){var e=L,t=P;if(P=null,t&&-1<e.optimisticOrder.indexOf(t))for(t=e.optimisticOrder.length;0<=--t&&e.refLock[e.optimisticOrder[t]]&&e.commutativeKeys.has(e.optimisticOrder[t]);)ue(e.optimisticOrder[t]);B=L=null,!e.gcScheduled&&0<e.gcBatch.size&&(e.gcScheduled=!0,A((function(){X(e)}))),e.storage&&!e.persistenceScheduled&&(e.persistenceScheduled=!0,A((function(){e.storage.write(e.persistenceBatch),e.persistenceScheduled=!1,e.persistenceBatch=d()})))},C=function(e,t,n){R(e,t,n),I()},Q=function(){return m(null!==B,"",2),B},j=function(){return M=B,B=new Set},G=function(){B=M,M=null},U=function(e,t,n,r){var i=(e=P?e.optimistic[P]:e.base).get(t);void 0===i&&e.set(t,i=d()),void 0!==r||P?i[n]=r:delete i[n]},W=function(e,t,n){for(var r,i=0,o=L.optimisticOrder.length;i<o;i++){var a=e.optimistic[L.optimisticOrder[i]];if(a&&void 0!==(r=a.get(t))&&n in r)return r[n]}return void 0!==(r=e.base.get(t))?r[n]:void 0},V=function(e,t,n,r){var i=void 0!==t[n]?t[n]:0;t=t[n]=i+r|0,void 0!==e&&(0>=t?e.add(n):0>=i&&0<t&&e.delete(n))},z=function(e,t,n,r){if("string"==typeof n)V(e,t,n,r);else if(Array.isArray(n))for(var i=0,o=n.length;i<o;i++){var a=n[i];a&&V(e,t,a,r)}},J=function(e,t,n){if(void 0!==n)for(var r in n)t.has(r)||(e.push(K(r)),t.add(r))},H=function(e,t,n,r){J(e,t,r.base.get(n));for(var i=0,o=L.optimisticOrder.length;i<o;i++){var a=r.optimistic[L.optimisticOrder[i]];void 0!==a&&J(e,t,a.get(n))}},X=function(e){e.gcScheduled=!1,e.gcBatch.forEach((function(t){if(0>=(e.refCount[t]||0)){for(var n in e.refLock){var r=e.refLock[n];if(0<(r[t]||0))return;delete r[t]}if(delete e.refCount[t],e.gcBatch.delete(t),void 0!==(n=e.records.base.get(t))&&(e.records.base.delete(t),e.storage))for(var i in n)n=F("r",T(t,i)),e.persistenceBatch[n]=void 0;if(void 0!==(i=e.links.base.get(t)))for(var o in e.links.base.delete(t),i)e.storage&&(n=F("l",T(t,o)),e.persistenceBatch[n]=void 0),z(e.gcBatch,e.refCount,i[o],-1)}else e.gcBatch.delete(t)}))},Y=function(e,t){"__typename"!==t&&(e!==L.queryRootKey?B.add(e):void 0!==t&&B.add(T(e,t)))},Z=function(e,t){return Y(e,t),W(L.records,e,t)},$=function(e,t){return Y(e,t),W(L.links,e,t)},ee=function(e,t,n){Y(e,t),U(L.records,e,t,n),L.storage&&!P&&(e=F("r",T(e,t)),L.persistenceBatch[e]=n)},te=function(e,t,n){var r=L;if(P)var i=r.refLock[P]||(r.refLock[P]=d()),o=r.links.optimistic[P];else{r.storage&&(i=F("l",T(e,t)),r.persistenceBatch[i]=n),i=r.refCount,o=r.links.base;var a=r.gcBatch}o=(o=o&&o.get(e))&&o[t],Y(e,t),U(r.links,e,t,n),z(a,i,o,-1),z(a,i,n,1)},ne=function(e,t){e.commutativeKeys.has(t)||(e.optimisticOrder.unshift(t),e.commutativeKeys.add(t))},re=function(e,t){-1===e.optimisticOrder.indexOf(t)&&e.optimisticOrder.unshift(t),e.refLock[t]||(e.refLock[t]=d(),e.links.optimistic[t]=new Map,e.records.optimistic[t]=new Map)},ie=function(e,t){e.refLock[t]&&(delete e.refLock[t],delete e.records.optimistic[t],delete e.links.optimistic[t])},oe=function(e,t){var n=e.optimisticOrder.indexOf(t);-1<n&&(e.optimisticOrder.splice(n,1),e.commutativeKeys.delete(t)),ie(e,t)};function ae(e,t){for(var n in e)te(t,n,e[n])}function se(e,t){for(var n in e)ee(t,n,e[n])}var ue=function(e){j();var t=L.links.optimistic[e];t&&t.forEach(ae),(t=L.records.optimistic[e])&&t.forEach(se),G(),oe(L,e)},ce=function(e){var t=L.links,n=L.records,r=[],i=new Set;return Y(e),H(r,i,e,t),H(r,i,e,n),r},le=function(e,t,n,r,i,o){return{store:e,variables:t,fragments:n,parentTypeName:r,parentKey:i,parentFieldKey:"",fieldName:"",partial:!1,optimistic:!!o}},fe=function(e,t,n,r,i){e.parentTypeName=t,e.parentKey=n,e.parentFieldKey=r,e.fieldName=i},de=function(e,t,n,r){return!(!t||t!==c(e)&&u(e).some((function(e){return!!l(e)&&(e=E(o(e),p(e,r)),!function(e,t){return void 0!==Z(e,t)||void 0!==$(e,t)}(n,e))})))},pe=function(e,t,n,r){this.typename=e,this.entityKey=t,this.context=r,this.indexStack=[0],this.selectionStack=[n]};pe.prototype.next=function(){for(;0!==this.indexStack.length;){var e=this.indexStack[this.indexStack.length-1]++,t=this.selectionStack[this.selectionStack.length-1];if(e>=t.length)this.indexStack.pop(),this.selectionStack.pop();else if(_(e=t[e],this.context.variables))if(l(e)){if("__typename"!==o(e))return e}else void 0!==(e=f(e)?e:this.context.fragments[o(e)])&&(this.context.store.schema?S(this.context.store.schema,c(e),this.typename):de(e,this.typename,this.entityKey,this.context.variables))&&(this.indexStack.push(0),this.selectionStack.push(u(e)))}};var ye=function(e){return void 0===e?null:e},ve=function(e,t,n,r){return R(e.data,r||null),e=me(e,t,n),I(),e},me=function(e,t,n){var r=k(t.query),i={data:n,dependencies:Q()},o=e.rootFields[r.operation];return e=le(e,v(r,t.variables),b(t.query),o,o),ge(e,o,u(r),n),i},he=function(e,t,n){R(e.data,n,!0),n=k(t.query);var r={data:d(),dependencies:Q()},i=e.rootFields[n.operation];return m(i===e.rootFields.mutation,"",10),e=le(e,v(n,t.variables),b(t.query),i,i,!0),ge(e,i,u(n),r.data),I(),r},ge=function(e,t,n,r){var i=t===e.store.rootFields.query,a=!i&&!!e.store.rootNames[t],c=a||i?t:r.__typename;if(c){a||i||!t||ee(t,"__typename",c),n=new pe(c,t||c,n,e);for(var l;l=n.next();){var f=o(l);i=p(l,e.variables);var y=E(f,i),v=r[s(l)];if(l.selectionSet){if(e.optimistic&&a){if(!(v=e.store.optimisticMutations[f]))continue;fe(e,c,c,y,f),v=ye(v(i||d(),e.store,e)),r[f]=v}else v=ye(v);if(t&&!a){var m=T(t,y);l=ke(e,u(l),v,m),te(t||c,y,l)}else ke(e,u(l),v)}else t&&!a&&ee(t||c,y,v);a&&(fe(e,c,c,T(c,y),f),(f=e.store.updates[c][f])&&f(r,i||d(),e.store,e))}}},ke=function(e,t,n,r){if(Array.isArray(n)){for(var i=Array(n.length),o=0,a=n.length;o<a;o++){var s=n[o],u=r?T(r,""+o):void 0;s=ke(e,t,s,u),i[o]=s}return i}return null===n?null:(i=e.store.keyOfEntity(n),o=n.__typename,!r||void 0!==e.store.keys[n.__typename]||null!==i||"string"!=typeof o||o.endsWith("Connection")||o.endsWith("Edge"),ge(e,r=i||r,t,n),r||null)},xe=function(e){var n;this.keyOfField=E,e||(e={}),this.resolvers=e.resolvers||{},this.optimisticMutations=e.optimistic||{},this.keys=e.keys||{},this.updates={Mutation:e.updates&&e.updates.Mutation||{},Subscription:e.updates&&e.updates.Subscription||{}};var r="Query",i="Mutation",o="Subscription";if(e.schema){var a=this.schema=t.buildClientSchema(e.schema);e=a.getQueryType();var s=a.getMutationType();a=a.getSubscriptionType(),e&&(r=e.name),s&&(i=s.name),a&&(o=a.name)}this.rootFields={query:r,mutation:i,subscription:o},this.rootNames=((n={})[r]="query",n[i]="mutation",n[o]="subscription",n),this.data=function(e){return{persistenceScheduled:!1,persistenceBatch:d(),gcScheduled:!1,queryRootKey:e,gcBatch:new Set,refCount:d(),refLock:d(),links:D(),records:D(),commutativeKeys:new Set,optimisticOrder:[],storage:null}}(r)};xe.prototype.keyOfEntity=function(e){var t,n=e.__typename,r=e.id,i=e._id;return n?void 0!==this.rootNames[n]?n:(this.keys[n]?t=this.keys[n](e):null!=r?t=""+r:null!=i&&(t=""+i),t?n+":"+t:null):null},xe.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var n=Z(e,t);return void 0!==n?n:(t=$(e,t))?t:null},xe.prototype.resolve=function(e,t,n){return this.resolveFieldByKey(e,E(t,n))},xe.prototype.invalidateQuery=function(e,t){!function(e,t){var n=j();_e(e,t),n.forEach((function(t){t.startsWith(e.data.queryRootKey+".")?(t=t.slice((e.data.queryRootKey+".").length),te(e.data.queryRootKey,t),ee(e.data.queryRootKey,t)):e.invalidate(t)})),G(),X(e.data)}(this,n.createRequest(e,t))},xe.prototype.invalidate=function(e,t,n){m(e="string"==typeof e?e:this.keyOfEntity(e),"",19),function(e,t,n){t=t?[{fieldKey:E(t,n)}]:ce(e),n=0;for(var r=t.length;n<r;n++){var i=t[n].fieldKey;$(e,i)?te(e,i,void 0):ee(e,i,void 0)}}(e,t,n)},xe.prototype.inspectFields=function(e){return null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)?ce(e):[]},xe.prototype.updateQuery=function(e,t){e=n.createRequest(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&me(this,e,t)},xe.prototype.readQuery=function(e){return _e(this,n.createRequest(e.query,e.variables)).data},xe.prototype.readFragment=function(e,t,n){return Se(this,e,t,n)},xe.prototype.writeFragment=function(t,n,r){!function(t,n,r,i){n=b(n);var o=Object.keys(n);if(void 0!==(o=n[o[0]])){var s=a(o);r=e._extends({},{__typename:s},r);var c=t.keyOfEntity(r);c&&(t=le(t,i||{},n,s,c),ge(t,c,u(o),r))}}(this,t,n,r)};var be=function(e,t,n){return R(e.data,null),e=_e(e,t,n),I(),e},_e=function(e,t,n){var r=k(t.query),i=e.rootFields[r.operation],o=u(r);return e=le(e,v(r,t.variables),b(t.query),i,i),n=n||d(),n=i!==e.store.rootFields.query?qe(e,i,o,n):we(e,i,o,n),{dependencies:Q(),partial:void 0!==n&&e.partial,data:void 0===n?null:n}},qe=function(e,t,n,r){if("string"!=typeof r.__typename)return r;t=new pe(t,t,n,e),(n=d()).__typename=r.__typename;for(var i;void 0!==(i=t.next());){var o=s(i),a=r[o];void 0!==i.selectionSet&&null!==a?(a=ye(a),n[o]=Oe(e,u(i),a)):n[o]=a}return n},Oe=function(e,t,n){if(Array.isArray(n)){for(var r=Array(n.length),i=0,o=n.length;i<o;i++)r[i]=Oe(e,t,n[i]);return r}return null===n?null:null!==(r=e.store.keyOfEntity(n))?void 0===(e=we(e,r,t,d()))?null:e:qe(e,n.__typename,t,n)},Se=function(t,n,r,i){n=b(n);var o=Object.keys(n);if(void 0===(o=n[o[0]]))return null;var s=a(o);return"string"==typeof r||r.__typename||(r.__typename=s),(r="string"!=typeof r?t.keyOfEntity(e._extends({},{__typename:s},r)):r)?(t=le(t,i||{},n,s,r),we(t,r,u(o),d())||null):null},we=function(e,t,n,r,i){var a=e.store,c=t===a.rootFields.query,l=i&&a.keyOfEntity(i)||t;if(!("string"!=typeof(t=c?t:Z(l,"__typename")||i&&i.__typename)||i&&t!==i.__typename)){r.__typename=t,n=new pe(t,l,n,e);for(var f,y=!1,v=!1;void 0!==(f=n.next());){var m=o(f),h=p(f,e.variables),g=s(f),k=E(m,h),x=T(l,k),b=Z(l,k),_=i?i[m]:void 0,O=a.resolvers[t],S=void 0;if(void 0!==_&&void 0===f.selectionSet)S=_;else if(O&&"function"==typeof O[m]){if(fe(e,t,l,x,m),void 0!==b&&(r[g]=b),S=O[m](r,h||d(),a,e),void 0!==f.selectionSet&&(S=Ne(e,t,m,x,u(f),r[g]||d(),S)),a.schema&&null===S&&!q(a.schema,t,m))return}else void 0===f.selectionSet?S=b:void 0!==_?S=Ne(e,t,m,x,u(f),r[g],_):void 0!==(h=$(l,k))?S=Ee(e,h,t,m,u(f),r[g]):"object"==typeof b&&null!==b&&(S=b);if(void 0===S&&a.schema&&q(a.schema,t,m))v=!0,r[g]=null;else{if(void 0===S)return;y=!0,r[g]=S}}return v&&(e.partial=!0),c&&v&&!y?void 0:r}},Ne=function(e,t,n,r,i,o,a){if(Array.isArray(a)){var s=e.store;s=!s.schema||O(s.schema,t,n);for(var u=Array(a.length),c=0,l=a.length;c<l;c++){var f=Ne(e,t,n,T(r,""+c),i,void 0!==o?o[c]:void 0,a[c]);if(void 0===f&&!s)return;u[c]=void 0!==f?f:null}return u}return null==a?a:Ke(a)?(t=void 0===o?d():o,"string"==typeof a?we(e,a,i,t):we(e,r,i,t,a)):void 0},Ee=function(e,t,n,r,i,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&O(a.schema,n,r);for(var s=Array(t.length),u=0,c=t.length;u<c;u++){var l=Ee(e,t[u],n,r,i,void 0!==o?o[u]:void 0);if(void 0===l&&!a)return;s[u]=void 0!==l?l:null}return s}return null===t?null:we(e,t,i,void 0===o?d():o)},Ke=function(e){return"string"==typeof e||"object"==typeof e&&"string"==typeof e.__typename},Te=function(t,n){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,{cacheOutcome:n})})})},Fe=function(t,n){return e._extends({},t,{context:e._extends({},t.context,{requestPolicy:n})})};function Ae(t){return e._extends({},t,{query:n.formatDocument(t.query)})}function Le(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function Be(e){return"query"!==e.operationName||"network-only"===e.context.requestPolicy}function Me(e){return Te(e.operation,"miss")}function Pe(e){return"miss"===e.outcome&&"cache-only"!==e.operation.context.requestPolicy}function De(e){return"miss"!==e.outcome||"cache-only"===e.operation.context.requestPolicy}exports.populateExchange=i.populateExchange,exports.Store=xe,exports.cacheExchange=function(t){return function(i){function o(e){var t=e.operation,n=e.outcome;return e={operation:Te(t,n),data:e.data,error:e.error,extensions:e.extensions},("cache-and-network"===t.context.requestPolicy||"cache-first"===t.context.requestPolicy&&"partial"===n)&&(e.stale=!0,u.reexecuteOperation(Fe(t,"network-only"))),e}var a,s=i.forward,u=i.client,c=new xe(t);t&&t.storage&&(a=t.storage.read().then((function(e){!function(e,t,n){for(var r in R(e,null),n){var i=r.indexOf("."),o=r.slice(2,i);switch(i=r.slice(i+1),r.charCodeAt(0)){case 108:te(o,i,n[r]);break;case 114:ee(o,i,n[r])}}I(),e.storage=t}(c.data,t.storage,e)})));var l=new Map,f=new Map,p=d(),v=function(e,t){t&&t.forEach((function(t){var n=p[t];if(n){p[t]=[],t=0;for(var r=n.length;t<r;t++)e.add(n[t])}}))},m=function(e,t){t.forEach((function(t){if(t!==e.key){var n=f.get(t);n&&(f.delete(t),u.reexecuteOperation(Fe(n,"cache-first")))}}))},h=function(t){return"query"===t.operationName?ne(c.data,t.key):"teardown"===t.operationName&&C(c.data,t.key),e._extends({},t,{variables:t.variables?y(k(t.query),t.variables):t.variables,query:n.formatDocument(t.query)})},g=function(e){var t=e.key;if("mutation"===e.operationName&&"network-only"!==e.context.requestPolicy){var n=he(c,e,t).dependencies;0!==n.size&&(l.set(t,n),t=new Set,v(t,n),m(e,t))}else C(c.data,t,!0)},x=function(e,t){t.forEach((function(t){(p[t]||(p[t]=[])).push(e.key),f.has(e.key)||f.set(e.key,"network-only"===e.context.requestPolicy?Fe(e,"cache-and-network"):e)}))},b=function(e){var t=be(c,e),n=t.data?t.partial?"partial":"hit":"miss";return t.data&&x(e,t.dependencies),{outcome:n,operation:e,data:t.data}},_=function(e){var t=e.operation,n=e.error,r=e.extensions,i=t.key,o=new Set;if("mutation"===t.operationName?(v(o,l.get(i)),l.delete(i)):"subscription"===t.operationName&&ne(c.data,t.key),e.data){if(i=ve(c,t,e.data,i).dependencies,v(o,i),i=be(c,t,e.data),e.data=i.data,"query"===t.operationName){var a=i.dependencies;v(o,a)}}else C(c.data,t.key);return m(e.operation,o),a&&x(e.operation,a),{data:e.data,error:n,extensions:r,operation:t}};return function(e){e=r.share(e);var t=a?r.mergeMap(r.fromArray)(r.take(1)(r.buffer(r.fromPromise(a))(e))):r.empty;t=r.share(r.tap(g)(r.map(Ae)(r.concat([t,e])))),e=r.share(r.map(b)(r.filter(Le)(t))),t=r.filter(Be)(t);var n=r.map(Me)(r.filter(Pe)(e));return e=r.map(o)(r.filter(De)(e)),t=r.map(_)(s(r.map(h)(r.merge([t,n])))),r.merge([t,e])}}},exports.noopDataState=C,exports.query=be,exports.reserveLayer=ne,exports.write=ve,exports.writeOptimistic=he;
//# sourceMappingURL=urql-exchange-graphcache.cjs.min.js.map

@@ -34,30 +34,34 @@ import { share, mergeMap, fromArray, take, buffer, fromPromise, empty, tap, map, concat, filter, merge } from "wonka";

function v(a, b) {
b = b || {};
function ba(a, b) {
var c = q();
if (!b) {
return c;
}
if (a.variableDefinitions) {
for (var d = 0, e = a.variableDefinitions.length; d < e; d++) {
var f = a.variableDefinitions[d], g = f.variable.name.value, h = b[g];
void 0 === h && f.defaultValue && (h = valueFromASTUntyped(f.defaultValue, b));
c[g] = h;
var f = a.variableDefinitions[d], g = f.variable.name.value;
c[g] = void 0 === b[g] && f.defaultValue ? valueFromASTUntyped(f.defaultValue, b) : b[g];
}
}
for (var h in b) {
h in c || (c[h] = b[h]);
}
return c;
}
var ba = new Set, w = [];
var ca = new Set, v = [];
function x(a, b) {
function w(a, b) {
var c = "";
b.kind === Kind.INLINE_FRAGMENT ? c = a ? 'Inline Fragment on "' + a + '"' : "Inline Fragment" : b.kind === Kind.OPERATION_DEFINITION ? c = (b.name ? '"' + b.name.value + '"' : "Unnamed") + " " + b.operation : b.kind === Kind.FRAGMENT_DEFINITION && (c = '"' + b.name.value + '" Fragment');
c && w.push(c);
c && v.push(c);
}
function ca() {
return w.length ? "\n(Caused At: " + w.join(", ") + ")" : "";
function da() {
return v.length ? "\n(Caused At: " + v.join(", ") + ")" : "";
}
function B(a, b, c) {
function x(a, b, c) {
if (!a) {
throw a = b || "Minfied Error #" + c + "\n", "production" !== process.env.NODE_ENV && (a += ca()),
throw a = b || "Minfied Error #" + c + "\n", "production" !== process.env.NODE_ENV && (a += da()),
(c = Error(a + "\nhttps://bit.ly/38yWDau#" + c)).name = "Graphcache Error", c;

@@ -67,16 +71,16 @@ }

function F(a, b) {
ba.has(a) || (console.warn(a + ca() + "\nhttps://bit.ly/38yWDau#" + b), ba.add(a));
function B(a, b) {
ca.has(a) || (console.warn(a + da() + "\nhttps://bit.ly/38yWDau#" + b), ca.add(a));
}
function da(a) {
function ea(a) {
return a.kind === Kind.FRAGMENT_DEFINITION;
}
function ea(a) {
function fa(a) {
return a.kind === Kind.OPERATION_DEFINITION;
}
function fa(a) {
B(!!(a = a.definitions.find(ea)), "production" !== process.env.NODE_ENV ? "Invalid GraphQL document: All GraphQL documents must contain an OperationDefinitionnode for a query, subscription, or mutation." : "", 1);
function F(a) {
x(!!(a = a.definitions.find(fa)), "production" !== process.env.NODE_ENV ? "Invalid GraphQL document: All GraphQL documents must contain an OperationDefinitionnode for a query, subscription, or mutation." : "", 1);
return a;

@@ -91,3 +95,3 @@ }

function G(a) {
return a.definitions.filter(da).reduce(ha, {});
return a.definitions.filter(ea).reduce(ha, {});
}

@@ -109,3 +113,3 @@

ka(a = a.getType(b), b);
(a = a.getFields()[c]) || "production" !== process.env.NODE_ENV && F("Invalid field: The field `" + c + "` does not exist on `" + b + "`, but the GraphQL document expects it to exist.\nTraversal will continue, however this may lead to undefined behavior!", 4);
(a = a.getFields()[c]) || "production" !== process.env.NODE_ENV && B("Invalid field: The field `" + c + "` does not exist on `" + b + "`, but the GraphQL document expects it to exist.\nTraversal will continue, however this may lead to undefined behavior!", 4);
return a;

@@ -115,3 +119,3 @@ }

function ka(a, b) {
B(a instanceof GraphQLObjectType, "production" !== process.env.NODE_ENV ? "Invalid Object type: The type `" + b + "` is not an object in the defined schema, but the GraphQL document is traversing it." : "", 3);
x(a instanceof GraphQLObjectType, "production" !== process.env.NODE_ENV ? "Invalid Object type: The type `" + b + "` is not an object in the defined schema, but the GraphQL document is traversing it." : "", 3);
}

@@ -144,3 +148,3 @@

K = new Set;
"production" !== process.env.NODE_ENV && (w.length = 0);
"production" !== process.env.NODE_ENV && (v.length = 0);
b ? c || 1 < a.optimisticOrder.length && -1 < a.optimisticOrder.indexOf(b) ? (c || a.commutativeKeys.has(b) || (na(a, b),

@@ -161,3 +165,3 @@ a.commutativeKeys.add(b)), M = b, -1 === a.optimisticOrder.indexOf(b) && a.optimisticOrder.unshift(b),

K = J = null;
"production" !== process.env.NODE_ENV && (w.length = 0);
"production" !== process.env.NODE_ENV && (v.length = 0);
!c.gcScheduled && 0 < c.gcBatch.size && (c.gcScheduled = !0, ma((function a() {

@@ -179,3 +183,3 @@ pa(c);

function ra() {
B(null !== K, "production" !== process.env.NODE_ENV ? "Invalid Cache call: The cache may only be accessed or mutated duringoperations like write or query, or as part of its resolvers, updaters, or optimistic configs." : "", 2);
x(null !== K, "production" !== process.env.NODE_ENV ? "Invalid Cache call: The cache may only be accessed or mutated duringoperations like write or query, or as part of its resolvers, updaters, or optimistic configs." : "", 2);
return K;

@@ -233,3 +237,4 @@ }

for (var e = 0, f = J.optimisticOrder.length; e < f; e++) {
xa(a, b, d.optimistic[J.optimisticOrder[e]].get(c));
var g = d.optimistic[J.optimisticOrder[e]];
void 0 !== g && xa(a, b, g.get(c));
}

@@ -342,2 +347,10 @@ }

function Ca(a) {
var b = J.links, c = J.records, d = [], e = new Set;
Q(a);
ya(d, e, a, b);
ya(d, e, a, c);
return d;
}
function V(a, b, c, d, e, f) {

@@ -357,3 +370,3 @@ return {

function Ca(a, b, c, d) {
function Da(a, b, c, d) {
if (!b) {

@@ -366,3 +379,3 @@ return !1;

}
"production" !== process.env.NODE_ENV && F("Heuristic Fragment Matching: A fragment is trying to match against the `" + b + "` type, but the type condition is `" + e + "`. Since GraphQL allows for interfaces `" + e + "` may be aninterface.\nA schema needs to be defined for this match to be deterministic, otherwise the fragment will be matched heuristically!", 16);
"production" !== process.env.NODE_ENV && B("Heuristic Fragment Matching: A fragment is trying to match against the `" + b + "` type, but the type condition is `" + e + "`. Since GraphQL allows for interfaces `" + e + "` may be aninterface.\nA schema needs to be defined for this match to be deterministic, otherwise the fragment will be matched heuristically!", 16);
return !n(a).some((function(a) {

@@ -407,6 +420,6 @@ if (a.kind !== Kind.FIELD) {

if (a.kind !== Kind.FIELD) {
void 0 !== (a = a.kind !== Kind.INLINE_FRAGMENT ? this.context.fragments[a.name.value] : a) && ("production" !== process.env.NODE_ENV && x(this.typename, a),
void 0 !== (a = a.kind !== Kind.INLINE_FRAGMENT ? this.context.fragments[a.name.value] : a) && ("production" !== process.env.NODE_ENV && w(this.typename, a),
this.context.store.schema ? (b = this.context.store.schema, c = aa(a), (d = this.typename) && c ? d === c ? b = !0 : (e = b.getType(c),
f = b.getType(d), e instanceof GraphQLObjectType ? b = e === f : (B(e instanceof GraphQLInterfaceType || e instanceof GraphQLUnionType, "production" !== process.env.NODE_ENV ? "Invalid Abstract type: The type `" + c + "` is not an Interface or Union type in the defined schema, but a fragment in the GraphQL document is using it as a type condition." : "", 5),
ka(f, d), b = b.isPossibleType(e, f))) : b = !1) : b = Ca(a, this.typename, this.entityKey, this.context.variables),
f = b.getType(d), e instanceof GraphQLObjectType ? b = e === f : (x(e instanceof GraphQLInterfaceType || e instanceof GraphQLUnionType, "production" !== process.env.NODE_ENV ? "Invalid Abstract type: The type `" + c + "` is not an Interface or Union type in the defined schema, but a fragment in the GraphQL document is using it as a type condition." : "", 5),
ka(f, d), b = b.isPossibleType(e, f))) : b = !1) : b = Da(a, this.typename, this.entityKey, this.context.variables),
b && (this.indexStack.push(0), this.selectionStack.push(n(a))));

@@ -421,5 +434,5 @@ } else if ("__typename" !== a.name.value) {

function Da(a, b, c, d) {
function Ea(a, b, c, d) {
N(a.data, d || null);
a = Ea(a, b, c);
a = Fa(a, b, c);
O();

@@ -429,8 +442,9 @@ return a;

function Ea(a, b, c) {
var d = fa(b.query), e = {
function Fa(a, b, c) {
var d = F(b.query), e = {
data: c,
dependencies: ra()
}, f = a.rootFields[d.operation];
a = V(a, v(d, b.variables), G(b.query), f, f);
"production" !== process.env.NODE_ENV && x(f, d);
a = V(a, ba(d, b.variables), G(b.query), f, f);
"production" !== process.env.NODE_ENV && w(f, d);
X(a, f, n(d), c);

@@ -440,13 +454,12 @@ return e;

function Fa(a, b, c) {
function Ga(a, b, c) {
N(a.data, c, !0);
c = fa(b.query);
c = F(b.query);
var d = {
data: q(),
dependencies: ra()
}, e = a.rootFields[c.operation];
B(e === a.rootFields.mutation, "production" !== process.env.NODE_ENV ? "writeOptimistic(...) was called with an operation that is not a mutation.\nThis case is unsupported and should never occur." : "", 10);
"production" !== process.env.NODE_ENV && x(e, c);
a = V(a, v(c, b.variables), G(b.query), e, e, !0);
b = q();
X(a, e, n(c), b);
x(e === a.rootFields.mutation, "production" !== process.env.NODE_ENV ? "writeOptimistic(...) was called with an operation that is not a mutation.\nThis case is unsupported and should never occur." : "", 10);
"production" !== process.env.NODE_ENV && w(e, c);
X(a = V(a, ba(c, b.variables), G(b.query), e, e, !0), e, n(c), d.data);
O();

@@ -470,3 +483,3 @@ return d;

k = void 0 === h.selectionSet ? "scalar (number, boolean, etc)" : "selection set";
"production" !== process.env.NODE_ENV && F("Invalid undefined: The field at `" + p + "` is `undefined`, but the GraphQL query expects a " + k + " for this field." + e, 13);
"production" !== process.env.NODE_ENV && B("Invalid undefined: The field at `" + p + "` is `undefined`, but the GraphQL query expects a " + k + " for this field." + e, 13);
continue;

@@ -490,3 +503,3 @@ }

}
b && !f ? (m = b + "." + p, U(b || g, p, h = Ga(a, n(h), l, m))) : Ga(a, n(h), l);
b && !f ? (m = b + "." + p, U(b || g, p, h = Ha(a, n(h), l, m))) : Ha(a, n(h), l);
} else {

@@ -501,6 +514,6 @@ b && !f && T(b || g, p, l);

function Ga(a, b, c, d) {
function Ha(a, b, c, d) {
if (Array.isArray(c)) {
for (var e = Array(c.length), f = 0, g = c.length; f < g; f++) {
var h = Ga(a, b, c[f], d ? d + "." + f : void 0);
var h = Ha(a, b, c[f], d ? d + "." + f : void 0);
e[f] = h;

@@ -515,3 +528,3 @@ }

f = c.__typename;
!d || void 0 !== a.store.keys[c.__typename] || null !== e || "string" != typeof f || f.endsWith("Connection") || f.endsWith("Edge") || "PageInfo" === f || "production" !== process.env.NODE_ENV && F("Invalid key: The GraphQL query at the field at `" + d + "` has a selection set, but no key could be generated for the data at this field.\nYou have to request `id` or `_id` fields for all selection sets or create a custom `keys` config for `" + f + "`.\nEntities without keys will be embedded directly on the parent entity. If this is intentional, create a `keys` config for `" + f + "` that always returns null.", 15);
!d || void 0 !== a.store.keys[c.__typename] || null !== e || "string" != typeof f || f.endsWith("Connection") || f.endsWith("Edge") || "PageInfo" === f || "production" !== process.env.NODE_ENV && B("Invalid key: The GraphQL query at the field at `" + d + "` has a selection set, but no key could be generated for the data at this field.\nYou have to request `id` or `_id` fields for all selection sets or create a custom `keys` config for `" + f + "`.\nEntities without keys will be embedded directly on the parent entity. If this is intentional, create a `keys` config for `" + f + "` that always returns null.", 15);
X(a, d = e || d, b, c);

@@ -521,32 +534,31 @@ return d || null;

function Y(a, b, c, d, e) {
var f;
function Y(a) {
var b;
this.keyOfField = I;
this.resolvers = b || {};
this.optimisticMutations = d || {};
this.keys = e || {};
a || (a = {});
this.resolvers = a.resolvers || {};
this.optimisticMutations = a.optimistic || {};
this.keys = a.keys || {};
this.updates = {
Mutation: c && c.Mutation || {},
Subscription: c && c.Subscription || {}
Mutation: a.updates && a.updates.Mutation || {},
Subscription: a.updates && a.updates.Subscription || {}
};
b = "Query";
c = "Mutation";
d = "Subscription";
if (a) {
var g = this.schema = buildClientSchema(a);
a = g.getQueryType();
e = g.getMutationType();
g = g.getSubscriptionType();
a && (b = a.name);
e && (c = e.name);
var c = "Query", d = "Mutation", e = "Subscription";
if (a.schema) {
var f = this.schema = buildClientSchema(a.schema);
a = f.getQueryType();
var g = f.getMutationType();
f = f.getSubscriptionType();
a && (c = a.name);
g && (d = g.name);
f && (e = f.name);
}
this.rootFields = {
query: b,
mutation: c,
subscription: d
query: c,
mutation: d,
subscription: e
};
this.rootNames = ((f = {})[b] = "query", f[c] = "mutation", f[d] = "subscription",
f);
f = b;
this.rootNames = ((b = {})[c] = "query", b[d] = "mutation", b[e] = "subscription",
b);
b = c;
this.data = {

@@ -556,3 +568,3 @@ persistenceScheduled: !1,

gcScheduled: !1,
queryRootKey: f,
queryRootKey: b,
gcBatch: new Set,

@@ -601,5 +613,5 @@ refCount: q(),

Y.prototype.invalidateQuery = function(a, b) {
!function Ha(a, b) {
!function Ia(a, b) {
var c = sa();
Ia(a, b);
Ja(a, b);
c.forEach((function(b) {

@@ -615,9 +627,12 @@ b.startsWith(a.data.queryRootKey + ".") ? (b = b.slice((a.data.queryRootKey + ".").length),

Y.prototype.invalidate = function(a) {
var b = "string" == typeof a ? a : this.keyOfEntity(a);
B(b, "production" !== process.env.NODE_ENV ? "object" == "Can't generate a key for invalidate(...).\nYou have to pass an id or _id field or create a custom `keys` field for `" + typeof a ? a.__typename : a + "`." : "", 19);
a = 0;
for (var c = this.inspectFields(b); a < c.length; a += 1) {
var d = c[a];
S(b, d.fieldKey) ? U(b, d.fieldKey, void 0) : T(b, d.fieldKey, void 0);
Y.prototype.invalidate = function(a, b, c) {
var d = "string" == typeof a ? a : this.keyOfEntity(a);
x(d, "production" !== process.env.NODE_ENV ? "object" == "Can't generate a key for invalidate(...).\nYou have to pass an id or _id field or create a custom `keys` field for `" + typeof a ? a.__typename : a + "`." : "", 19);
a = b ? [ {
fieldKey: I(b, c)
} ] : Ca(d);
b = 0;
for (c = a.length; b < c; b++) {
var e = a[b].fieldKey;
S(d, e) ? U(d, e, void 0) : T(d, e, void 0);
}

@@ -627,12 +642,3 @@ };

Y.prototype.inspectFields = function(a) {
if (null !== (a = null !== a && "string" != typeof a ? this.keyOfEntity(a) : a)) {
var b = J.links, c = J.records, d = [], e = new Set;
Q(a);
ya(d, e, a, b);
ya(d, e, a, c);
a = d;
} else {
a = [];
}
return a;
return null !== (a = null !== a && "string" != typeof a ? this.keyOfEntity(a) : a) ? Ca(a) : [];
};

@@ -642,7 +648,7 @@

a = createRequest(a.query, a.variables);
null !== (b = b(this.readQuery(a))) && Ea(this, a, b);
null !== (b = b(this.readQuery(a))) && Fa(this, a, b);
};
Y.prototype.readQuery = function(a) {
return Ia(this, createRequest(a.query, a.variables)).data;
return Ja(this, createRequest(a.query, a.variables)).data;
};

@@ -654,3 +660,3 @@

if (void 0 === (d = a[d[0]])) {
"production" !== process.env.NODE_ENV && F("readFragment(...) was called with an empty fragment.\nYou have to call it with at least one fragment in your GraphQL document.", 6),
"production" !== process.env.NODE_ENV && B("readFragment(...) was called with an empty fragment.\nYou have to call it with at least one fragment in your GraphQL document.", 6),
c = null;

@@ -662,3 +668,3 @@ } else {

__typename: e
}, b)) : b) ? ("production" !== process.env.NODE_ENV && x(e, d), c = Z(c = V(this, c || {}, a, e, b), b, n(d), q()) || null) : ("production" !== process.env.NODE_ENV && F("Can't generate a key for readFragment(...).\nYou have to pass an `id` or `_id` field or create a custom `keys` config for `" + e + "`.", 7),
}, b)) : b) ? ("production" !== process.env.NODE_ENV && w(e, d), c = Z(c = V(this, c || {}, a, e, b), b, n(d), q()) || null) : ("production" !== process.env.NODE_ENV && B("Can't generate a key for readFragment(...).\nYou have to pass an `id` or `_id` field or create a custom `keys` config for `" + e + "`.", 7),
c = null);

@@ -673,3 +679,3 @@ }

if (void 0 === (d = a[d[0]])) {
"production" !== process.env.NODE_ENV && F("writeFragment(...) was called with an empty fragment.\nYou have to call it with at least one fragment in your GraphQL document.", 11);
"production" !== process.env.NODE_ENV && B("writeFragment(...) was called with an empty fragment.\nYou have to call it with at least one fragment in your GraphQL document.", 11);
} else {

@@ -681,9 +687,9 @@ var e = d.typeCondition.name.value;

var f = this.keyOfEntity(b);
f ? ("production" !== process.env.NODE_ENV && x(e, d), X(c = V(this, c || {}, a, e, f), f, n(d), b)) : "production" !== process.env.NODE_ENV && F("Can't generate a key for writeFragment(...) data.\nYou have to pass an `id` or `_id` field or create a custom `keys` config for `" + e + "`.", 12);
f ? ("production" !== process.env.NODE_ENV && w(e, d), X(c = V(this, c || {}, a, e, f), f, n(d), b)) : "production" !== process.env.NODE_ENV && B("Can't generate a key for writeFragment(...) data.\nYou have to pass an `id` or `_id` field or create a custom `keys` config for `" + e + "`.", 12);
}
};
function Ja(a, b, c) {
function Ka(a, b, c) {
N(a.data, null);
a = Ia(a, b, c);
a = Ja(a, b, c);
O();

@@ -693,8 +699,8 @@ return a;

function Ia(a, b, c) {
var d = fa(b.query), e = a.rootFields[d.operation], f = n(d);
a = V(a, v(d, b.variables), G(b.query), e, e);
"production" !== process.env.NODE_ENV && x(e, d);
function Ja(a, b, c) {
var d = F(b.query), e = a.rootFields[d.operation], f = n(d);
a = V(a, ba(d, b.variables), G(b.query), e, e);
"production" !== process.env.NODE_ENV && w(e, d);
c = c || q();
c = e !== a.store.rootFields.query ? Ka(a, e, f, c) : Z(a, e, f, c);
c = e !== a.store.rootFields.query ? La(a, e, f, c) : Z(a, e, f, c);
return {

@@ -707,3 +713,3 @@ dependencies: ra(),

function Ka(a, b, c, d) {
function La(a, b, c, d) {
if ("string" != typeof d.__typename) {

@@ -716,3 +722,3 @@ return d;

var f = e.alias ? e.alias.value : e.name.value, g = d[f];
void 0 !== e.selectionSet && null !== g ? (g = void 0 === g ? null : g, c[f] = La(a, n(e), g)) : c[f] = g;
void 0 !== e.selectionSet && null !== g ? (g = void 0 === g ? null : g, c[f] = Ma(a, n(e), g)) : c[f] = g;
}

@@ -722,6 +728,6 @@ return c;

function La(a, b, c) {
function Ma(a, b, c) {
if (Array.isArray(c)) {
for (var d = Array(c.length), e = 0, f = c.length; e < f; e++) {
d[e] = La(a, b, c[e]);
d[e] = Ma(a, b, c[e]);
}

@@ -733,3 +739,3 @@ return d;

}
return null !== (d = a.store.keyOfEntity(c)) ? void 0 === (a = Z(a, d, b, q())) ? null : a : Ka(a, c.__typename, b, c);
return null !== (d = a.store.keyOfEntity(c)) ? void 0 === (a = Z(a, d, b, q())) ? null : a : La(a, c.__typename, b, c);
}

@@ -740,3 +746,3 @@

if ("string" != typeof (b = g ? b : R(h, "__typename") || e && e.__typename) || e && b !== e.__typename) {
"production" !== process.env.NODE_ENV && F("Invalid resolver data: The resolver at `" + h + "` returned an invalid typename that could not be reconciled with the cache.", 8);
"production" !== process.env.NODE_ENV && B("Invalid resolver data: The resolver at `" + h + "` returned an invalid typename that could not be reconciled with the cache.", 8);
} else {

@@ -754,10 +760,10 @@ d.__typename = b;

A = D;
var Qa = m;
var Ra = m;
(t = a).parentTypeName = b;
t.parentKey = y;
t.parentFieldKey = A;
t.fieldName = Qa;
t.fieldName = Ra;
void 0 !== z && (d[r] = z);
t = E[m](d, C || q(), f, a);
void 0 !== k.selectionSet && (t = Ma(a, b, m, D, n(k), d[r] || q(), t));
void 0 !== k.selectionSet && (t = Na(a, b, m, D, n(k), d[r] || q(), t));
if (f.schema && null === t && !ia(f.schema, b, m)) {

@@ -767,3 +773,3 @@ return;

} else {
void 0 === k.selectionSet ? t = z : void 0 !== A ? t = Ma(a, b, m, D, n(k), d[r], A) : void 0 !== (C = S(h, y)) ? t = Na(a, C, b, m, n(k), d[r]) : "object" == typeof z && null !== z && (t = z);
void 0 === k.selectionSet ? t = z : void 0 !== A ? t = Na(a, b, m, D, n(k), d[r], A) : void 0 !== (C = S(h, y)) ? t = Oa(a, C, b, m, n(k), d[r]) : "object" == typeof z && null !== z && (t = z);
}

@@ -785,3 +791,3 @@ if (void 0 === t && f.schema && ia(f.schema, b, m)) {

function Ma(a, b, c, d, e, f, g) {
function Na(a, b, c, d, e, f, g) {
if (Array.isArray(g)) {

@@ -791,3 +797,3 @@ var h = a.store;

for (var k = Array(g.length), p = 0, l = g.length; p < l; p++) {
var m = Ma(a, b, c, d + "." + p, e, void 0 !== f ? f[p] : void 0, g[p]);
var m = Na(a, b, c, d + "." + p, e, void 0 !== f ? f[p] : void 0, g[p]);
if (void 0 !== m || h) {

@@ -807,6 +813,6 @@ k[p] = void 0 !== m ? m : null;

}
"production" !== process.env.NODE_ENV && F("Invalid resolver value: The field at `" + d + "` is a scalar (number, boolean, etc), but the GraphQL query expects a selection set for this field.", 9);
"production" !== process.env.NODE_ENV && B("Invalid resolver value: The field at `" + d + "` is a scalar (number, boolean, etc), but the GraphQL query expects a selection set for this field.", 9);
}
function Na(a, b, c, d, e, f) {
function Oa(a, b, c, d, e, f) {
if (Array.isArray(b)) {

@@ -816,3 +822,3 @@ var g = a.store;

for (var h = Array(b.length), k = 0, p = b.length; k < p; k++) {
var l = Na(a, b[k], c, d, e, void 0 !== f ? f[k] : void 0);
var l = Oa(a, b[k], c, d, e, void 0 !== f ? f[k] : void 0);
if (void 0 !== l || g) {

@@ -829,3 +835,3 @@ h[k] = void 0 !== l ? l : null;

function Oa(a, b) {
function Pa(a, b) {
return _extends({}, a, {

@@ -840,3 +846,3 @@ context: _extends({}, a.context, {

function Pa(a, b) {
function Qa(a, b) {
return _extends({}, a, {

@@ -849,3 +855,3 @@ context: _extends({}, a.context, {

function Ra(a) {
function Sa(a) {
return _extends({}, a, {

@@ -856,24 +862,20 @@ query: formatDocument(a.query)

function Sa(a) {
function Ta(a) {
return "query" === a.operationName && "network-only" !== a.context.requestPolicy;
}
function Ta(a) {
return Oa(a.operation, "miss");
}
function Ua(a) {
return "miss" === a.outcome;
return "query" !== a.operationName || "network-only" === a.context.requestPolicy;
}
function Va(a) {
return "miss" !== a.outcome;
return Pa(a.operation, "miss");
}
function Wa(a) {
return "cache-only" !== a.context.requestPolicy;
return "miss" === a.outcome && "cache-only" !== a.operation.context.requestPolicy;
}
function Xa(a) {
return !("query" === a.operationName && "network-only" !== a.context.requestPolicy);
return "miss" !== a.outcome || "cache-only" === a.operation.context.requestPolicy;
}

@@ -887,3 +889,3 @@

if (a.data) {
if (k(g, f = Da(r, b, a.data, f).dependencies), f = Ja(r, b, a.data), a.data = f.data,
if (k(g, f = Ea(r, b, a.data, f).dependencies), f = Ka(r, b, a.data), a.data = f.data,
"query" === b.operationName) {

@@ -906,3 +908,3 @@ var E = f.dependencies;

function d(a) {
var b = Ja(r, a), c = b.data ? b.partial && "cache-only" !== a.context.requestPolicy ? "partial" : "hit" : "miss";
var b = Ka(r, a), c = b.data ? b.partial ? "partial" : "hit" : "miss";
b.data && e(a, b.dependencies);

@@ -918,3 +920,3 @@ return {

(A[b] || (A[b] = [])).push(a.key);
z.has(a.key) || z.set(a.key, "network-only" === a.context.requestPolicy ? Pa(a, "cache-and-network") : a);
z.has(a.key) || z.set(a.key, "network-only" === a.context.requestPolicy ? Qa(a, "cache-and-network") : a);
}));

@@ -925,3 +927,3 @@ }

if ("mutation" === a.operationName && "network-only" !== a.context.requestPolicy) {
var c = Fa(r, a, b).dependencies;
var c = Ga(r, a, b).dependencies;
0 !== c.size && (D.set(b, c), k(b = new Set, c), h(a, b));

@@ -934,2 +936,22 @@ } else {

"query" === a.operationName ? za(r.data, a.key) : "teardown" === a.operationName && P(r.data, a.key);
var b = _extends;
if (a.variables) {
var c = F(a.query);
var d = a.variables;
if (d && c.variableDefinitions) {
for (var e = q(), f = 0, g = c.variableDefinitions.length; f < g; f++) {
var h = c.variableDefinitions[f].variable.name.value;
e[h] = d[h];
}
c = e;
} else {
c = void 0;
}
} else {
c = a.variables;
}
return b({}, a, {
variables: c,
query: formatDocument(a.query)
});
}

@@ -940,3 +962,3 @@ function h(a, b) {

var c = z.get(b);
c && (z.delete(b), C.reexecuteOperation(Pa(c, "cache-first")));
c && (z.delete(b), C.reexecuteOperation(Qa(c, "cache-first")));
}

@@ -960,3 +982,3 @@ }));

a = {
operation: Oa(b, c),
operation: Pa(b, c),
data: a.data,

@@ -967,10 +989,8 @@ error: a.error,

if ("cache-and-network" === b.context.requestPolicy || "cache-first" === b.context.requestPolicy && "partial" === c) {
a.stale = !0, C.reexecuteOperation(Pa(b, "network-only"));
a.stale = !0, C.reexecuteOperation(Qa(b, "network-only"));
}
return a;
}
var m = b.forward, C = b.client;
a || (a = {});
var y, r = new Y(a.schema, a.resolvers, a.updates, a.optimistic, a.keys);
a.storage && (y = a.storage.read().then((function p(b) {
var y, m = b.forward, C = b.client, r = new Y(a);
a && a.storage && (y = a.storage.read().then((function p(b) {
var c = r.data, d = a.storage;

@@ -997,8 +1017,9 @@ N(c, null);

var b = y ? mergeMap(fromArray)(take(1)(buffer(fromPromise(y))(a))) : empty;
a = share(tap(f)(map(Ra)(concat([ b, a ]))));
var e = share(map(d)(filter(Sa)(a)));
b = map(Ta)(filter(Ua)(e));
e = map(l)(filter(Va)(e));
a = map(c)(m(tap(g)(filter(Wa)(merge([ filter(Xa)(a), b ])))));
return merge([ a, e ]);
b = share(tap(f)(map(Sa)(concat([ b, a ]))));
a = share(map(d)(filter(Ta)(b)));
b = filter(Ua)(b);
var e = map(Va)(filter(Wa)(a));
a = map(l)(filter(Xa)(a));
b = map(c)(m(map(g)(merge([ b, e ]))));
return merge([ b, a ]);
};

@@ -1008,3 +1029,3 @@ };

export { Y as Store, cacheExchange, P as noopDataState, Ja as query, za as reserveLayer, Da as write, Fa as writeOptimistic };
export { Y as Store, cacheExchange, P as noopDataState, Ka as query, za as reserveLayer, Ea as write, Ga as writeOptimistic };
//# sourceMappingURL=urql-exchange-graphcache.esm.js.map

@@ -1,2 +0,2 @@

import{share as e,mergeMap as t,fromArray as n,take as i,buffer as r,fromPromise as o,empty as a,tap as s,map as u,concat as c,filter as l,merge as f}from"wonka";import{stringifyVariables as d,createRequest as p,formatDocument as y}from"@urql/core";import{Kind as v,valueFromASTUntyped as m,isNullableType as h,isNonNullType as g,isListType as k,GraphQLObjectType as x,GraphQLInterfaceType as O,GraphQLUnionType as _,buildClientSchema as b}from"graphql";import{_ as S}from"./406259e3.esm.min.js";export{populateExchange}from"@urql/exchange-populate";function q(e){return e.selectionSet?e.selectionSet.selections:[]}function w(e){return(e=e.typeCondition)?e.name.value:null}function N(){return Object.create(null)}function K(e,t){var n=N(),i=0;if(e.arguments&&e.arguments.length)for(var r=0,o=e.arguments.length;r<o;r++){var a=e.arguments[r],s=m(a.value,t);null!=s&&(n[a.name.value]=s,i++)}return 0<i?n:null}function E(e,t){t=t||{};var n=N();if(e.variableDefinitions)for(var i=0,r=e.variableDefinitions.length;i<r;i++){var o=e.variableDefinitions[i],a=o.variable.name.value,s=t[a];void 0===s&&o.defaultValue&&(s=m(o.defaultValue,t)),n[a]=s}return n}function F(e,t,n){if(!e)throw(e=Error((t||"Minfied Error #"+n+"\n")+"\nhttps://bit.ly/38yWDau#"+n)).name="Graphcache Error",e}function T(e){return e.kind===v.FRAGMENT_DEFINITION}function A(e){return e.kind===v.OPERATION_DEFINITION}function B(e){return F(!!(e=e.definitions.find(A)),"",1),e}function M(e,t){return e[t.name.value]=t,e}function L(e){return e.definitions.filter(T).reduce(M,{})}function P(e,t,n){return!!(e=C(e,t,n))&&h(e.type)}function I(e,t,n){return!!(e=C(e,t,n))&&(e=g(e.type)?e.type.ofType:e.type,k(e)&&h(e.ofType))}function C(e,t,n){return F((e=e.getType(t))instanceof x,"",3),e.getFields()[n]}function D(e,t){return t?e+"("+d(t)+")":e}function R(e){var t=e.indexOf("(");return-1<t?{fieldKey:e,fieldName:e.slice(0,t),arguments:JSON.parse(e.slice(t+1,-1))}:{fieldKey:e,fieldName:e,arguments:null}}var j="undefined"!=typeof Promise?Promise.prototype.then.bind(Promise.resolve()):function(e){return setTimeout(e,0)},Q=null,W=null,G=null,z=null;function V(e,t,n){Q=e,G=W,W=new Set,t?n||1<e.optimisticOrder.length&&-1<e.optimisticOrder.indexOf(t)?(n||e.commutativeKeys.has(t)||(le(e,t),e.commutativeKeys.add(t)),z=t,-1===e.optimisticOrder.indexOf(t)&&e.optimisticOrder.unshift(t),e.refLock[t]||(e.refLock[t]=N(),e.links.optimistic[t]=new Map,e.records.optimistic[t]=new Map)):(z=null,fe(e,t)):z=null}function J(){var e=Q,t=z;if(z=null,t&&-1<e.optimisticOrder.indexOf(t))for(t=e.optimisticOrder.length;0<=--t&&e.refLock[e.optimisticOrder[t]]&&e.commutativeKeys.has(e.optimisticOrder[t]);)ye(e.optimisticOrder[t]);W=Q=null,!e.gcScheduled&&0<e.gcBatch.size&&(e.gcScheduled=!0,j((function(){ie(e)}))),e.storage&&!e.persistenceScheduled&&(e.persistenceScheduled=!0,j((function(){e.storage.write(e.persistenceBatch),e.persistenceScheduled=!1,e.persistenceBatch=N()})))}function H(e,t,n){V(e,t,n),J()}function U(){return F(null!==W,"",2),W}function X(){return G=W,W=new Set}function Y(e,t,n,i){var r=(e=z?e.optimistic[z]:e.base).get(t);void 0===r&&e.set(t,r=N()),void 0!==i||z?r[n]=i:delete r[n]}function Z(e,t,n){for(var i,r=0,o=Q.optimisticOrder.length;r<o;r++){var a=e.optimistic[Q.optimisticOrder[r]];if(a&&void 0!==(i=a.get(t))&&n in i)return i[n]}return void 0!==(i=e.base.get(t))?i[n]:void 0}function $(e,t,n,i){var r=void 0!==t[n]?t[n]:0;t=t[n]=r+i|0,void 0!==e&&(0>=t?e.add(n):0>=r&&0<t&&e.delete(n))}function ee(e,t,n,i){if("string"==typeof n)$(e,t,n,i);else if(Array.isArray(n))for(var r=0,o=n.length;r<o;r++){var a=n[r];a&&$(e,t,a,i)}}function te(e,t,n){if(void 0!==n)for(var i in n)t.has(i)||(e.push(R(i)),t.add(i))}function ne(e,t,n,i){te(e,t,i.base.get(n));for(var r=0,o=Q.optimisticOrder.length;r<o;r++)te(e,t,i.optimistic[Q.optimisticOrder[r]].get(n))}function ie(e){e.gcScheduled=!1,e.gcBatch.forEach((function(t){if(0>=(e.refCount[t]||0)){for(var n in e.refLock){var i=e.refLock[n];if(0<(i[t]||0))return;delete i[t]}if(delete e.refCount[t],e.gcBatch.delete(t),void 0!==(n=e.records.base.get(t))&&(e.records.base.delete(t),e.storage))for(var r in n)e.persistenceBatch["r|"+t+"."+r]=void 0;if(void 0!==(r=e.links.base.get(t)))for(var o in e.links.base.delete(t),r)e.storage&&(e.persistenceBatch["l|"+t+"."+o]=void 0),ee(e.gcBatch,e.refCount,r[o],-1)}else e.gcBatch.delete(t)}))}function re(e,t){"__typename"!==t&&(e!==Q.queryRootKey?W.add(e):void 0!==t&&W.add(e+"."+t))}function oe(e,t){return re(e,t),Z(Q.records,e,t)}function ae(e,t){return re(e,t),Z(Q.links,e,t)}function se(e,t,n){re(e,t),Y(Q.records,e,t,n),Q.storage&&!z&&(Q.persistenceBatch["r|"+e+"."+t]=n)}function ue(e,t,n){var i=Q;if(z)var r=i.refLock[z]||(i.refLock[z]=N()),o=i.links.optimistic[z];else{i.storage&&(i.persistenceBatch["l|"+e+"."+t]=n),r=i.refCount,o=i.links.base;var a=i.gcBatch}o=(o=o&&o.get(e))&&o[t],re(e,t),Y(i.links,e,t,n),ee(a,r,o,-1),ee(a,r,n,1)}function ce(e,t){e.commutativeKeys.has(t)||(e.optimisticOrder.unshift(t),e.commutativeKeys.add(t))}function le(e,t){e.refLock[t]&&(delete e.refLock[t],delete e.records.optimistic[t],delete e.links.optimistic[t])}function fe(e,t){var n=e.optimisticOrder.indexOf(t);-1<n&&(e.optimisticOrder.splice(n,1),e.commutativeKeys.delete(t)),le(e,t)}function de(e,t){for(var n in e)ue(t,n,e[n])}function pe(e,t){for(var n in e)se(t,n,e[n])}function ye(e){X();var t=Q.links.optimistic[e];t&&t.forEach(de),(t=Q.records.optimistic[e])&&t.forEach(pe),W=G,G=null,fe(Q,e)}function ve(e,t,n,i,r,o){return{store:e,variables:t,fragments:n,parentTypeName:i,parentKey:r,parentFieldKey:"",fieldName:"",partial:!1,optimistic:!!o}}function me(e,t,n,i){return!(!t||t!==w(e)&&q(e).some((function(e){return e.kind===v.FIELD&&(e=D(e.name.value,K(e,i)),!(void 0!==oe(n,e)||void 0!==ae(n,e)))})))}function he(e,t,n,i){this.typename=e,this.entityKey=t,this.context=i,this.indexStack=[0],this.selectionStack=[n]}function ge(e,t,n,i){return V(e.data,i||null),e=ke(e,t,n),J(),e}function ke(e,t,n){var i=B(t.query),r={dependencies:U()},o=e.rootFields[i.operation];return Oe(e=ve(e,E(i,t.variables),L(t.query),o,o),o,q(i),n),r}function xe(e,t,n){V(e.data,n,!0),n=B(t.query);var i={dependencies:U()},r=e.rootFields[n.operation];return F(r===e.rootFields.mutation,"",10),e=ve(e,E(n,t.variables),L(t.query),r,r,!0),t=N(),Oe(e,r,q(n),t),J(),i}function Oe(e,t,n,i){var r=t===e.store.rootFields.query,o=!r&&!!e.store.rootNames[t],a=o||r?t:i.__typename;if(a){o||r||!t||se(t,"__typename",a),n=new he(a,t||a,n,e);for(var s;s=n.next();){var u=s.name.value,c=D(u,r=K(s,e.variables)),l=i[s.alias?s.alias.value:s.name.value];if(s.selectionSet){if(e.optimistic&&o){if(!(l=e.store.optimisticMutations[u]))continue;var f=e,d=a,p=c,y=u;f.parentTypeName=a,f.parentKey=d,f.parentFieldKey=p,f.fieldName=y,l=l(r||N(),e.store,e),i[u]=l=void 0===l?null:l}else l=void 0===l?null:l;t&&!o?(f=t+"."+c,ue(t||a,c,s=_e(e,q(s),l,f))):_e(e,q(s),l)}else t&&!o&&se(t||a,c,l);o&&(l=a,c=a+"."+c,f=u,(s=e).parentTypeName=a,s.parentKey=l,s.parentFieldKey=c,s.fieldName=f,(u=e.store.updates[a][u])&&u(i,r||N(),e.store,e))}}}function _e(e,t,n,i){if(Array.isArray(n)){for(var r=Array(n.length),o=0,a=n.length;o<a;o++){var s=_e(e,t,n[o],i?i+"."+o:void 0);r[o]=s}return r}return null===n?null:(r=e.store.keyOfEntity(n),o=n.__typename,!i||void 0!==e.store.keys[n.__typename]||null!==r||"string"!=typeof o||o.endsWith("Connection")||o.endsWith("Edge"),Oe(e,i=r||i,t,n),i||null)}function be(e,t,n,i,r){var o;if(this.keyOfField=D,this.resolvers=t||{},this.optimisticMutations=i||{},this.keys=r||{},this.updates={Mutation:n&&n.Mutation||{},Subscription:n&&n.Subscription||{}},t="Query",n="Mutation",i="Subscription",e){var a=this.schema=b(e);e=a.getQueryType(),r=a.getMutationType(),a=a.getSubscriptionType(),e&&(t=e.name),r&&(n=r.name),a&&(i=a.name)}this.rootFields={query:t,mutation:n,subscription:i},this.rootNames=((o={})[t]="query",o[n]="mutation",o[i]="subscription",o),o=t,this.data={persistenceScheduled:!1,persistenceBatch:N(),gcScheduled:!1,queryRootKey:o,gcBatch:new Set,refCount:N(),refLock:N(),links:{optimistic:N(),base:new Map},records:{optimistic:N(),base:new Map},commutativeKeys:new Set,optimisticOrder:[],storage:null}}function Se(e,t,n){return V(e.data,null),e=qe(e,t,n),J(),e}function qe(e,t,n){var i=B(t.query),r=e.rootFields[i.operation],o=q(i);return e=ve(e,E(i,t.variables),L(t.query),r,r),n=n||N(),n=r!==e.store.rootFields.query?we(e,r,o,n):Ke(e,r,o,n),{dependencies:U(),partial:void 0!==n&&e.partial,data:void 0===n?null:n}}function we(e,t,n,i){if("string"!=typeof i.__typename)return i;t=new he(t,t,n,e),(n=N()).__typename=i.__typename;for(var r;void 0!==(r=t.next());){var o=r.alias?r.alias.value:r.name.value,a=i[o];void 0!==r.selectionSet&&null!==a?(a=void 0===a?null:a,n[o]=Ne(e,q(r),a)):n[o]=a}return n}function Ne(e,t,n){if(Array.isArray(n)){for(var i=Array(n.length),r=0,o=n.length;r<o;r++)i[r]=Ne(e,t,n[r]);return i}return null===n?null:null!==(i=e.store.keyOfEntity(n))?void 0===(e=Ke(e,i,t,N()))?null:e:we(e,n.__typename,t,n)}function Ke(e,t,n,i,r){var o=e.store,a=t===o.rootFields.query,s=r&&o.keyOfEntity(r)||t;if(!("string"!=typeof(t=a?t:oe(s,"__typename")||r&&r.__typename)||r&&t!==r.__typename)){i.__typename=t,n=new he(t,s,n,e);for(var u,c=!1,l=!1;void 0!==(u=n.next());){var f=u.name.value,d=K(u,e.variables),p=u.alias?u.alias.value:u.name.value,y=D(f,d),v=s+"."+y,m=oe(s,y),h=r?r[f]:void 0,g=o.resolvers[t],k=void 0;if(void 0!==h&&void 0===u.selectionSet)k=h;else if(g&&"function"==typeof g[f]){y=s,h=v;var x=f;if((k=e).parentTypeName=t,k.parentKey=y,k.parentFieldKey=h,k.fieldName=x,void 0!==m&&(i[p]=m),k=g[f](i,d||N(),o,e),void 0!==u.selectionSet&&(k=Ee(e,t,f,v,q(u),i[p]||N(),k)),o.schema&&null===k&&!P(o.schema,t,f))return}else void 0===u.selectionSet?k=m:void 0!==h?k=Ee(e,t,f,v,q(u),i[p],h):void 0!==(d=ae(s,y))?k=Fe(e,d,t,f,q(u),i[p]):"object"==typeof m&&null!==m&&(k=m);if(void 0===k&&o.schema&&P(o.schema,t,f))l=!0,i[p]=null;else{if(void 0===k)return;c=!0,i[p]=k}}return l&&(e.partial=!0),a&&l&&!c?void 0:i}}function Ee(e,t,n,i,r,o,a){if(Array.isArray(a)){var s=e.store;s=!s.schema||I(s.schema,t,n);for(var u=Array(a.length),c=0,l=a.length;c<l;c++){var f=Ee(e,t,n,i+"."+c,r,void 0!==o?o[c]:void 0,a[c]);if(void 0===f&&!s)return;u[c]=void 0!==f?f:null}return u}return null==a?a:"string"==typeof a||"object"==typeof a&&"string"==typeof a.__typename?(t=void 0===o?N():o,"string"==typeof a?Ke(e,a,r,t):Ke(e,i,r,t,a)):void 0}function Fe(e,t,n,i,r,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&I(a.schema,n,i);for(var s=Array(t.length),u=0,c=t.length;u<c;u++){var l=Fe(e,t[u],n,i,r,void 0!==o?o[u]:void 0);if(void 0===l&&!a)return;s[u]=void 0!==l?l:null}return s}return null===t?null:Ke(e,t,r,void 0===o?N():o)}function Te(e,t){return S({},e,{context:S({},e.context,{meta:S({},e.context.meta,{cacheOutcome:t})})})}function Ae(e,t){return S({},e,{context:S({},e.context,{requestPolicy:t})})}function Be(e){return S({},e,{query:y(e.query)})}function Me(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function Le(e){return Te(e.operation,"miss")}function Pe(e){return"miss"===e.outcome}function Ie(e){return"miss"!==e.outcome}function Ce(e){return"cache-only"!==e.context.requestPolicy}function De(e){return!("query"===e.operationName&&"network-only"!==e.context.requestPolicy)}function Re(d){return function(p){function y(e){var t=e.operation,n=e.error,i=e.extensions,r=t.key,o=new Set;if("mutation"===t.operationName?(x(o,w.get(r)),w.delete(r)):"subscription"===t.operationName&&ce(q.data,t.key),e.data){if(x(o,r=ge(q,t,e.data,r).dependencies),r=Se(q,t,e.data),e.data=r.data,"query"===t.operationName){var a=r.dependencies;x(o,a)}}else H(q.data,t.key);return k(e.operation,o),a&&m(e.operation,a),{data:e.data,error:n,extensions:i,operation:t}}function v(e){var t=Se(q,e),n=t.data?t.partial&&"cache-only"!==e.context.requestPolicy?"partial":"hit":"miss";return t.data&&m(e,t.dependencies),{outcome:n,operation:e,data:t.data}}function m(e,t){t.forEach((function(t){(E[t]||(E[t]=[])).push(e.key),K.has(e.key)||K.set(e.key,"network-only"===e.context.requestPolicy?Ae(e,"cache-and-network"):e)}))}function h(e){var t=e.key;if("mutation"===e.operationName&&"network-only"!==e.context.requestPolicy){var n=xe(q,e,t).dependencies;0!==n.size&&(w.set(t,n),x(t=new Set,n),k(e,t))}else H(q.data,t,!0)}function g(e){"query"===e.operationName?ce(q.data,e.key):"teardown"===e.operationName&&H(q.data,e.key)}function k(e,t){t.forEach((function(t){if(t!==e.key){var n=K.get(t);n&&(K.delete(t),b.reexecuteOperation(Ae(n,"cache-first")))}}))}function x(e,t){t&&t.forEach((function(t){var n=E[t];if(n){E[t]=[],t=0;for(var i=n.length;t<i;t++)e.add(n[t])}}))}function O(e){var t=e.operation,n=e.outcome;return e={operation:Te(t,n),data:e.data,error:e.error,extensions:e.extensions},("cache-and-network"===t.context.requestPolicy||"cache-first"===t.context.requestPolicy&&"partial"===n)&&(e.stale=!0,b.reexecuteOperation(Ae(t,"network-only"))),e}var _=p.forward,b=p.client;d||(d={});var S,q=new be(d.schema,d.resolvers,d.updates,d.optimistic,d.keys);d.storage&&(S=d.storage.read().then((function(e){var t=q.data,n=d.storage;for(var i in V(t,null),e){var r=i.indexOf("."),o=i.slice(2,r);switch(r=i.slice(r+1),i.charCodeAt(0)){case 108:ue(o,r,e[i]);break;case 114:se(o,r,e[i])}}J(),t.storage=n})));var w=new Map,K=new Map,E=N();return function(d){d=e(d);var p=S?t(n)(i(1)(r(o(S))(d))):a;d=e(s(h)(u(Be)(c([p,d]))));var m=e(u(v)(l(Me)(d)));return p=u(Le)(l(Pe)(m)),m=u(O)(l(Ie)(m)),d=u(y)(_(s(g)(l(Ce)(f([l(De)(d),p]))))),f([d,m])}}}he.prototype.next=function(){for(;0!==this.indexStack.length;){var e=this.indexStack[this.indexStack.length-1]++,t=this.selectionStack[this.selectionStack.length-1];if(e>=t.length)this.indexStack.pop(),this.selectionStack.pop();else{e:{var n=this.context.variables,i=(e=t[e]).directives;if(i)for(var r=0,o=i.length;r<o;r++){var a=i[r];if(("include"===(t=a.name.value)||"skip"===t)&&a.arguments&&a.arguments[0]&&"if"===a.arguments[0].name.value){n=m(a.arguments[0].value,n),t="include"===t?!!n:!n;break e}}t=!0}if(t)if(e.kind!==v.FIELD)void 0!==(e=e.kind!==v.INLINE_FRAGMENT?this.context.fragments[e.name.value]:e)&&(this.context.store.schema?(t=this.context.store.schema,i=w(e),(n=this.typename)&&i?n===i?t=!0:(i=t.getType(i),n=t.getType(n),i instanceof x?t=i===n:(F(i instanceof O||i instanceof _,"",5),F(n instanceof x,"",3),t=t.isPossibleType(i,n))):t=!1):t=me(e,this.typename,this.entityKey,this.context.variables),t&&(this.indexStack.push(0),this.selectionStack.push(q(e))));else if("__typename"!==e.name.value)return e}}},be.prototype.keyOfEntity=function(e){var t,n=e.__typename,i=e.id,r=e._id;return n?void 0!==this.rootNames[n]?n:(this.keys[n]?t=this.keys[n](e):null!=i?t=""+i:null!=r&&(t=""+r),t?n+":"+t:null):null},be.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var n=oe(e,t);return void 0!==n?n:(t=ae(e,t))?t:null},be.prototype.resolve=function(e,t,n){return this.resolveFieldByKey(e,D(t,n))},be.prototype.invalidateQuery=function(e,t){!function(e,t){var n=X();qe(e,t),n.forEach((function(t){t.startsWith(e.data.queryRootKey+".")?(t=t.slice((e.data.queryRootKey+".").length),ue(e.data.queryRootKey,t),se(e.data.queryRootKey,t)):e.invalidate(t)})),W=G,G=null,ie(e.data)}(this,p(e,t))},be.prototype.invalidate=function(e){F(e="string"==typeof e?e:this.keyOfEntity(e),"",19);for(var t=0,n=this.inspectFields(e);t<n.length;t+=1){var i=n[t];ae(e,i.fieldKey)?ue(e,i.fieldKey,void 0):se(e,i.fieldKey,void 0)}},be.prototype.inspectFields=function(e){if(null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)){var t=Q.links,n=Q.records,i=[],r=new Set;re(e),ne(i,r,e,t),ne(i,r,e,n),e=i}else e=[];return e},be.prototype.updateQuery=function(e,t){e=p(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&ke(this,e,t)},be.prototype.readQuery=function(e){return qe(this,p(e.query,e.variables)).data},be.prototype.readFragment=function(e,t,n){e=L(e);var i=Object.keys(e);if(void 0===(i=e[i[0]]))n=null;else{var r=i.typeCondition.name.value;"string"==typeof t||t.__typename||(t.__typename=r),n=(t="string"!=typeof t?this.keyOfEntity(S({},{__typename:r},t)):t)&&Ke(n=ve(this,n||{},e,r,t),t,q(i),N())||null}return n},be.prototype.writeFragment=function(e,t,n){e=L(e);var i=Object.keys(e);if(void 0!==(i=e[i[0]])){var r=i.typeCondition.name.value;t=S({},{__typename:r},t);var o=this.keyOfEntity(t);o&&Oe(n=ve(this,n||{},e,r,o),o,q(i),t)}};export{be as Store,Re as cacheExchange,H as noopDataState,Se as query,ce as reserveLayer,ge as write,xe as writeOptimistic};
import{share as e,mergeMap as t,fromArray as n,take as i,buffer as r,fromPromise as o,empty as a,tap as s,map as u,concat as c,filter as l,merge as f}from"wonka";import{stringifyVariables as d,createRequest as p,formatDocument as v}from"@urql/core";import{Kind as y,valueFromASTUntyped as m,isNullableType as h,isNonNullType as g,isListType as k,GraphQLObjectType as b,GraphQLInterfaceType as x,GraphQLUnionType as O,buildClientSchema as _}from"graphql";import{_ as q}from"./406259e3.esm.min.js";export{populateExchange}from"@urql/exchange-populate";function S(e){return e.selectionSet?e.selectionSet.selections:[]}function w(e){return(e=e.typeCondition)?e.name.value:null}function N(){return Object.create(null)}function E(e,t){var n=N(),i=0;if(e.arguments&&e.arguments.length)for(var r=0,o=e.arguments.length;r<o;r++){var a=e.arguments[r],s=m(a.value,t);null!=s&&(n[a.name.value]=s,i++)}return 0<i?n:null}function K(e,t){var n=N();if(!t)return n;if(e.variableDefinitions)for(var i=0,r=e.variableDefinitions.length;i<r;i++){var o=e.variableDefinitions[i],a=o.variable.name.value;n[a]=void 0===t[a]&&o.defaultValue?m(o.defaultValue,t):t[a]}for(var s in t)s in n||(n[s]=t[s]);return n}function F(e,t,n){if(!e)throw(e=Error((t||"Minfied Error #"+n+"\n")+"\nhttps://bit.ly/38yWDau#"+n)).name="Graphcache Error",e}function T(e){return e.kind===y.FRAGMENT_DEFINITION}function A(e){return e.kind===y.OPERATION_DEFINITION}function B(e){return F(!!(e=e.definitions.find(A)),"",1),e}function M(e,t){return e[t.name.value]=t,e}function L(e){return e.definitions.filter(T).reduce(M,{})}function P(e,t,n){return!!(e=I(e,t,n))&&h(e.type)}function D(e,t,n){return!!(e=I(e,t,n))&&(e=g(e.type)?e.type.ofType:e.type,k(e)&&h(e.ofType))}function I(e,t,n){return F((e=e.getType(t))instanceof b,"",3),e.getFields()[n]}function C(e,t){return t?e+"("+d(t)+")":e}function R(e){var t=e.indexOf("(");return-1<t?{fieldKey:e,fieldName:e.slice(0,t),arguments:JSON.parse(e.slice(t+1,-1))}:{fieldKey:e,fieldName:e,arguments:null}}var j="undefined"!=typeof Promise?Promise.prototype.then.bind(Promise.resolve()):function(e){return setTimeout(e,0)},Q=null,W=null,G=null,z=null;function V(e,t,n){Q=e,G=W,W=new Set,t?n||1<e.optimisticOrder.length&&-1<e.optimisticOrder.indexOf(t)?(n||e.commutativeKeys.has(t)||(le(e,t),e.commutativeKeys.add(t)),z=t,-1===e.optimisticOrder.indexOf(t)&&e.optimisticOrder.unshift(t),e.refLock[t]||(e.refLock[t]=N(),e.links.optimistic[t]=new Map,e.records.optimistic[t]=new Map)):(z=null,fe(e,t)):z=null}function J(){var e=Q,t=z;if(z=null,t&&-1<e.optimisticOrder.indexOf(t))for(t=e.optimisticOrder.length;0<=--t&&e.refLock[e.optimisticOrder[t]]&&e.commutativeKeys.has(e.optimisticOrder[t]);)ve(e.optimisticOrder[t]);W=Q=null,!e.gcScheduled&&0<e.gcBatch.size&&(e.gcScheduled=!0,j((function(){ie(e)}))),e.storage&&!e.persistenceScheduled&&(e.persistenceScheduled=!0,j((function(){e.storage.write(e.persistenceBatch),e.persistenceScheduled=!1,e.persistenceBatch=N()})))}function H(e,t,n){V(e,t,n),J()}function U(){return F(null!==W,"",2),W}function X(){return G=W,W=new Set}function Y(e,t,n,i){var r=(e=z?e.optimistic[z]:e.base).get(t);void 0===r&&e.set(t,r=N()),void 0!==i||z?r[n]=i:delete r[n]}function Z(e,t,n){for(var i,r=0,o=Q.optimisticOrder.length;r<o;r++){var a=e.optimistic[Q.optimisticOrder[r]];if(a&&void 0!==(i=a.get(t))&&n in i)return i[n]}return void 0!==(i=e.base.get(t))?i[n]:void 0}function $(e,t,n,i){var r=void 0!==t[n]?t[n]:0;t=t[n]=r+i|0,void 0!==e&&(0>=t?e.add(n):0>=r&&0<t&&e.delete(n))}function ee(e,t,n,i){if("string"==typeof n)$(e,t,n,i);else if(Array.isArray(n))for(var r=0,o=n.length;r<o;r++){var a=n[r];a&&$(e,t,a,i)}}function te(e,t,n){if(void 0!==n)for(var i in n)t.has(i)||(e.push(R(i)),t.add(i))}function ne(e,t,n,i){te(e,t,i.base.get(n));for(var r=0,o=Q.optimisticOrder.length;r<o;r++){var a=i.optimistic[Q.optimisticOrder[r]];void 0!==a&&te(e,t,a.get(n))}}function ie(e){e.gcScheduled=!1,e.gcBatch.forEach((function(t){if(0>=(e.refCount[t]||0)){for(var n in e.refLock){var i=e.refLock[n];if(0<(i[t]||0))return;delete i[t]}if(delete e.refCount[t],e.gcBatch.delete(t),void 0!==(n=e.records.base.get(t))&&(e.records.base.delete(t),e.storage))for(var r in n)e.persistenceBatch["r|"+t+"."+r]=void 0;if(void 0!==(r=e.links.base.get(t)))for(var o in e.links.base.delete(t),r)e.storage&&(e.persistenceBatch["l|"+t+"."+o]=void 0),ee(e.gcBatch,e.refCount,r[o],-1)}else e.gcBatch.delete(t)}))}function re(e,t){"__typename"!==t&&(e!==Q.queryRootKey?W.add(e):void 0!==t&&W.add(e+"."+t))}function oe(e,t){return re(e,t),Z(Q.records,e,t)}function ae(e,t){return re(e,t),Z(Q.links,e,t)}function se(e,t,n){re(e,t),Y(Q.records,e,t,n),Q.storage&&!z&&(Q.persistenceBatch["r|"+e+"."+t]=n)}function ue(e,t,n){var i=Q;if(z)var r=i.refLock[z]||(i.refLock[z]=N()),o=i.links.optimistic[z];else{i.storage&&(i.persistenceBatch["l|"+e+"."+t]=n),r=i.refCount,o=i.links.base;var a=i.gcBatch}o=(o=o&&o.get(e))&&o[t],re(e,t),Y(i.links,e,t,n),ee(a,r,o,-1),ee(a,r,n,1)}function ce(e,t){e.commutativeKeys.has(t)||(e.optimisticOrder.unshift(t),e.commutativeKeys.add(t))}function le(e,t){e.refLock[t]&&(delete e.refLock[t],delete e.records.optimistic[t],delete e.links.optimistic[t])}function fe(e,t){var n=e.optimisticOrder.indexOf(t);-1<n&&(e.optimisticOrder.splice(n,1),e.commutativeKeys.delete(t)),le(e,t)}function de(e,t){for(var n in e)ue(t,n,e[n])}function pe(e,t){for(var n in e)se(t,n,e[n])}function ve(e){X();var t=Q.links.optimistic[e];t&&t.forEach(de),(t=Q.records.optimistic[e])&&t.forEach(pe),W=G,G=null,fe(Q,e)}function ye(e){var t=Q.links,n=Q.records,i=[],r=new Set;return re(e),ne(i,r,e,t),ne(i,r,e,n),i}function me(e,t,n,i,r,o){return{store:e,variables:t,fragments:n,parentTypeName:i,parentKey:r,parentFieldKey:"",fieldName:"",partial:!1,optimistic:!!o}}function he(e,t,n,i){return!(!t||t!==w(e)&&S(e).some((function(e){return e.kind===y.FIELD&&(e=C(e.name.value,E(e,i)),!(void 0!==oe(n,e)||void 0!==ae(n,e)))})))}function ge(e,t,n,i){this.typename=e,this.entityKey=t,this.context=i,this.indexStack=[0],this.selectionStack=[n]}function ke(e,t,n,i){return V(e.data,i||null),e=be(e,t,n),J(),e}function be(e,t,n){var i=B(t.query),r={data:n,dependencies:U()},o=e.rootFields[i.operation];return Oe(e=me(e,K(i,t.variables),L(t.query),o,o),o,S(i),n),r}function xe(e,t,n){V(e.data,n,!0),n=B(t.query);var i={data:N(),dependencies:U()},r=e.rootFields[n.operation];return F(r===e.rootFields.mutation,"",10),Oe(e=me(e,K(n,t.variables),L(t.query),r,r,!0),r,S(n),i.data),J(),i}function Oe(e,t,n,i){var r=t===e.store.rootFields.query,o=!r&&!!e.store.rootNames[t],a=o||r?t:i.__typename;if(a){o||r||!t||se(t,"__typename",a),n=new ge(a,t||a,n,e);for(var s;s=n.next();){var u=s.name.value,c=C(u,r=E(s,e.variables)),l=i[s.alias?s.alias.value:s.name.value];if(s.selectionSet){if(e.optimistic&&o){if(!(l=e.store.optimisticMutations[u]))continue;var f=e,d=a,p=c,v=u;f.parentTypeName=a,f.parentKey=d,f.parentFieldKey=p,f.fieldName=v,l=l(r||N(),e.store,e),i[u]=l=void 0===l?null:l}else l=void 0===l?null:l;t&&!o?(f=t+"."+c,ue(t||a,c,s=_e(e,S(s),l,f))):_e(e,S(s),l)}else t&&!o&&se(t||a,c,l);o&&(l=a,c=a+"."+c,f=u,(s=e).parentTypeName=a,s.parentKey=l,s.parentFieldKey=c,s.fieldName=f,(u=e.store.updates[a][u])&&u(i,r||N(),e.store,e))}}}function _e(e,t,n,i){if(Array.isArray(n)){for(var r=Array(n.length),o=0,a=n.length;o<a;o++){var s=_e(e,t,n[o],i?i+"."+o:void 0);r[o]=s}return r}return null===n?null:(r=e.store.keyOfEntity(n),o=n.__typename,!i||void 0!==e.store.keys[n.__typename]||null!==r||"string"!=typeof o||o.endsWith("Connection")||o.endsWith("Edge"),Oe(e,i=r||i,t,n),i||null)}function qe(e){var t;this.keyOfField=C,e||(e={}),this.resolvers=e.resolvers||{},this.optimisticMutations=e.optimistic||{},this.keys=e.keys||{},this.updates={Mutation:e.updates&&e.updates.Mutation||{},Subscription:e.updates&&e.updates.Subscription||{}};var n="Query",i="Mutation",r="Subscription";if(e.schema){var o=this.schema=_(e.schema);e=o.getQueryType();var a=o.getMutationType();o=o.getSubscriptionType(),e&&(n=e.name),a&&(i=a.name),o&&(r=o.name)}this.rootFields={query:n,mutation:i,subscription:r},this.rootNames=((t={})[n]="query",t[i]="mutation",t[r]="subscription",t),t=n,this.data={persistenceScheduled:!1,persistenceBatch:N(),gcScheduled:!1,queryRootKey:t,gcBatch:new Set,refCount:N(),refLock:N(),links:{optimistic:N(),base:new Map},records:{optimistic:N(),base:new Map},commutativeKeys:new Set,optimisticOrder:[],storage:null}}function Se(e,t,n){return V(e.data,null),e=we(e,t,n),J(),e}function we(e,t,n){var i=B(t.query),r=e.rootFields[i.operation],o=S(i);return e=me(e,K(i,t.variables),L(t.query),r,r),n=n||N(),n=r!==e.store.rootFields.query?Ne(e,r,o,n):Ke(e,r,o,n),{dependencies:U(),partial:void 0!==n&&e.partial,data:void 0===n?null:n}}function Ne(e,t,n,i){if("string"!=typeof i.__typename)return i;t=new ge(t,t,n,e),(n=N()).__typename=i.__typename;for(var r;void 0!==(r=t.next());){var o=r.alias?r.alias.value:r.name.value,a=i[o];void 0!==r.selectionSet&&null!==a?(a=void 0===a?null:a,n[o]=Ee(e,S(r),a)):n[o]=a}return n}function Ee(e,t,n){if(Array.isArray(n)){for(var i=Array(n.length),r=0,o=n.length;r<o;r++)i[r]=Ee(e,t,n[r]);return i}return null===n?null:null!==(i=e.store.keyOfEntity(n))?void 0===(e=Ke(e,i,t,N()))?null:e:Ne(e,n.__typename,t,n)}function Ke(e,t,n,i,r){var o=e.store,a=t===o.rootFields.query,s=r&&o.keyOfEntity(r)||t;if(!("string"!=typeof(t=a?t:oe(s,"__typename")||r&&r.__typename)||r&&t!==r.__typename)){i.__typename=t,n=new ge(t,s,n,e);for(var u,c=!1,l=!1;void 0!==(u=n.next());){var f=u.name.value,d=E(u,e.variables),p=u.alias?u.alias.value:u.name.value,v=C(f,d),y=s+"."+v,m=oe(s,v),h=r?r[f]:void 0,g=o.resolvers[t],k=void 0;if(void 0!==h&&void 0===u.selectionSet)k=h;else if(g&&"function"==typeof g[f]){v=s,h=y;var b=f;if((k=e).parentTypeName=t,k.parentKey=v,k.parentFieldKey=h,k.fieldName=b,void 0!==m&&(i[p]=m),k=g[f](i,d||N(),o,e),void 0!==u.selectionSet&&(k=Fe(e,t,f,y,S(u),i[p]||N(),k)),o.schema&&null===k&&!P(o.schema,t,f))return}else void 0===u.selectionSet?k=m:void 0!==h?k=Fe(e,t,f,y,S(u),i[p],h):void 0!==(d=ae(s,v))?k=Te(e,d,t,f,S(u),i[p]):"object"==typeof m&&null!==m&&(k=m);if(void 0===k&&o.schema&&P(o.schema,t,f))l=!0,i[p]=null;else{if(void 0===k)return;c=!0,i[p]=k}}return l&&(e.partial=!0),a&&l&&!c?void 0:i}}function Fe(e,t,n,i,r,o,a){if(Array.isArray(a)){var s=e.store;s=!s.schema||D(s.schema,t,n);for(var u=Array(a.length),c=0,l=a.length;c<l;c++){var f=Fe(e,t,n,i+"."+c,r,void 0!==o?o[c]:void 0,a[c]);if(void 0===f&&!s)return;u[c]=void 0!==f?f:null}return u}return null==a?a:"string"==typeof a||"object"==typeof a&&"string"==typeof a.__typename?(t=void 0===o?N():o,"string"==typeof a?Ke(e,a,r,t):Ke(e,i,r,t,a)):void 0}function Te(e,t,n,i,r,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&D(a.schema,n,i);for(var s=Array(t.length),u=0,c=t.length;u<c;u++){var l=Te(e,t[u],n,i,r,void 0!==o?o[u]:void 0);if(void 0===l&&!a)return;s[u]=void 0!==l?l:null}return s}return null===t?null:Ke(e,t,r,void 0===o?N():o)}function Ae(e,t){return q({},e,{context:q({},e.context,{meta:q({},e.context.meta,{cacheOutcome:t})})})}function Be(e,t){return q({},e,{context:q({},e.context,{requestPolicy:t})})}function Me(e){return q({},e,{query:v(e.query)})}function Le(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function Pe(e){return"query"!==e.operationName||"network-only"===e.context.requestPolicy}function De(e){return Ae(e.operation,"miss")}function Ie(e){return"miss"===e.outcome&&"cache-only"!==e.operation.context.requestPolicy}function Ce(e){return"miss"!==e.outcome||"cache-only"===e.operation.context.requestPolicy}function Re(d){return function(p){function y(e){var t=e.operation,n=e.error,i=e.extensions,r=t.key,o=new Set;if("mutation"===t.operationName?(x(o,K.get(r)),K.delete(r)):"subscription"===t.operationName&&ce(E.data,t.key),e.data){if(x(o,r=ke(E,t,e.data,r).dependencies),r=Se(E,t,e.data),e.data=r.data,"query"===t.operationName){var a=r.dependencies;x(o,a)}}else H(E.data,t.key);return b(e.operation,o),a&&h(e.operation,a),{data:e.data,error:n,extensions:i,operation:t}}function m(e){var t=Se(E,e),n=t.data?t.partial?"partial":"hit":"miss";return t.data&&h(e,t.dependencies),{outcome:n,operation:e,data:t.data}}function h(e,t){t.forEach((function(t){(T[t]||(T[t]=[])).push(e.key),F.has(e.key)||F.set(e.key,"network-only"===e.context.requestPolicy?Be(e,"cache-and-network"):e)}))}function g(e){var t=e.key;if("mutation"===e.operationName&&"network-only"!==e.context.requestPolicy){var n=xe(E,e,t).dependencies;0!==n.size&&(K.set(t,n),x(t=new Set,n),b(e,t))}else H(E.data,t,!0)}function k(e){"query"===e.operationName?ce(E.data,e.key):"teardown"===e.operationName&&H(E.data,e.key);var t=q;if(e.variables){var n=B(e.query),i=e.variables;if(i&&n.variableDefinitions){for(var r=N(),o=0,a=n.variableDefinitions.length;o<a;o++){var s=n.variableDefinitions[o].variable.name.value;r[s]=i[s]}n=r}else n=void 0}else n=e.variables;return t({},e,{variables:n,query:v(e.query)})}function b(e,t){t.forEach((function(t){if(t!==e.key){var n=F.get(t);n&&(F.delete(t),w.reexecuteOperation(Be(n,"cache-first")))}}))}function x(e,t){t&&t.forEach((function(t){var n=T[t];if(n){T[t]=[],t=0;for(var i=n.length;t<i;t++)e.add(n[t])}}))}function O(e){var t=e.operation,n=e.outcome;return e={operation:Ae(t,n),data:e.data,error:e.error,extensions:e.extensions},("cache-and-network"===t.context.requestPolicy||"cache-first"===t.context.requestPolicy&&"partial"===n)&&(e.stale=!0,w.reexecuteOperation(Be(t,"network-only"))),e}var _,S=p.forward,w=p.client,E=new qe(d);d&&d.storage&&(_=d.storage.read().then((function(e){var t=E.data,n=d.storage;for(var i in V(t,null),e){var r=i.indexOf("."),o=i.slice(2,r);switch(r=i.slice(r+1),i.charCodeAt(0)){case 108:ue(o,r,e[i]);break;case 114:se(o,r,e[i])}}J(),t.storage=n})));var K=new Map,F=new Map,T=N();return function(d){d=e(d);var p=_?t(n)(i(1)(r(o(_))(d))):a;p=e(s(g)(u(Me)(c([p,d])))),d=e(u(m)(l(Le)(p))),p=l(Pe)(p);var v=u(De)(l(Ie)(d));return d=u(O)(l(Ce)(d)),p=u(y)(S(u(k)(f([p,v])))),f([p,d])}}}ge.prototype.next=function(){for(;0!==this.indexStack.length;){var e=this.indexStack[this.indexStack.length-1]++,t=this.selectionStack[this.selectionStack.length-1];if(e>=t.length)this.indexStack.pop(),this.selectionStack.pop();else{e:{var n=this.context.variables,i=(e=t[e]).directives;if(i)for(var r=0,o=i.length;r<o;r++){var a=i[r];if(("include"===(t=a.name.value)||"skip"===t)&&a.arguments&&a.arguments[0]&&"if"===a.arguments[0].name.value){n=m(a.arguments[0].value,n),t="include"===t?!!n:!n;break e}}t=!0}if(t)if(e.kind!==y.FIELD)void 0!==(e=e.kind!==y.INLINE_FRAGMENT?this.context.fragments[e.name.value]:e)&&(this.context.store.schema?(t=this.context.store.schema,i=w(e),(n=this.typename)&&i?n===i?t=!0:(i=t.getType(i),n=t.getType(n),i instanceof b?t=i===n:(F(i instanceof x||i instanceof O,"",5),F(n instanceof b,"",3),t=t.isPossibleType(i,n))):t=!1):t=he(e,this.typename,this.entityKey,this.context.variables),t&&(this.indexStack.push(0),this.selectionStack.push(S(e))));else if("__typename"!==e.name.value)return e}}},qe.prototype.keyOfEntity=function(e){var t,n=e.__typename,i=e.id,r=e._id;return n?void 0!==this.rootNames[n]?n:(this.keys[n]?t=this.keys[n](e):null!=i?t=""+i:null!=r&&(t=""+r),t?n+":"+t:null):null},qe.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var n=oe(e,t);return void 0!==n?n:(t=ae(e,t))?t:null},qe.prototype.resolve=function(e,t,n){return this.resolveFieldByKey(e,C(t,n))},qe.prototype.invalidateQuery=function(e,t){!function(e,t){var n=X();we(e,t),n.forEach((function(t){t.startsWith(e.data.queryRootKey+".")?(t=t.slice((e.data.queryRootKey+".").length),ue(e.data.queryRootKey,t),se(e.data.queryRootKey,t)):e.invalidate(t)})),W=G,G=null,ie(e.data)}(this,p(e,t))},qe.prototype.invalidate=function(e,t,n){F(e="string"==typeof e?e:this.keyOfEntity(e),"",19),t=t?[{fieldKey:C(t,n)}]:ye(e),n=0;for(var i=t.length;n<i;n++){var r=t[n].fieldKey;ae(e,r)?ue(e,r,void 0):se(e,r,void 0)}},qe.prototype.inspectFields=function(e){return null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)?ye(e):[]},qe.prototype.updateQuery=function(e,t){e=p(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&be(this,e,t)},qe.prototype.readQuery=function(e){return we(this,p(e.query,e.variables)).data},qe.prototype.readFragment=function(e,t,n){e=L(e);var i=Object.keys(e);if(void 0===(i=e[i[0]]))n=null;else{var r=i.typeCondition.name.value;"string"==typeof t||t.__typename||(t.__typename=r),n=(t="string"!=typeof t?this.keyOfEntity(q({},{__typename:r},t)):t)&&Ke(n=me(this,n||{},e,r,t),t,S(i),N())||null}return n},qe.prototype.writeFragment=function(e,t,n){e=L(e);var i=Object.keys(e);if(void 0!==(i=e[i[0]])){var r=i.typeCondition.name.value;t=q({},{__typename:r},t);var o=this.keyOfEntity(t);o&&Oe(n=me(this,n||{},e,r,o),o,S(i),t)}};export{qe as Store,Re as cacheExchange,H as noopDataState,Se as query,ce as reserveLayer,ke as write,xe as writeOptimistic};
//# sourceMappingURL=urql-exchange-graphcache.esm.min.js.map

@@ -9,3 +9,3 @@ {

"dependencies": {
"@urql/core": ">=1.10.1",
"@urql/core": ">=1.10.2",
"@urql/exchange-populate": ">=0.1.1",

@@ -12,0 +12,0 @@ "wonka": "^3.2.1 || ^4.0.0"

{
"name": "@urql/exchange-graphcache",
"version": "2.2.5",
"version": "2.2.6",
"description": "A normalized and configurable cache exchange for urql",

@@ -54,3 +54,3 @@ "sideEffects": false,

"prepare": "../../scripts/prepare/index.js",
"prepublishOnly": "run-s clean test build"
"prepublishOnly": "run-s clean build"
},

@@ -62,3 +62,3 @@ "jest": {

"wonka": "^3.2.1 || ^4.0.0",
"@urql/core": ">=1.10.1",
"@urql/core": ">=1.10.2",
"@urql/exchange-populate": ">=0.1.1"

@@ -65,0 +65,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc