Socket
Socket
Sign inDemoInstall

@urql/exchange-graphcache

Package Overview
Dependencies
Maintainers
4
Versions
296
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.0 to 2.2.1

dist/types/ast/node.d.ts

8

CHANGELOG.md
# @urql/exchange-graphcache
## 2.2.1
### Patch Changes
- Remove the shared package, this will fix the types file generation for graphcache, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#579](https://github.com/FormidableLabs/urql/pull/579))
- Updated dependencies (See [#577](https://github.com/FormidableLabs/urql/pull/577))
- @urql/core@1.9.2
## 2.2.0

@@ -4,0 +12,0 @@

1

dist/types/ast/index.d.ts
export { getFieldArguments, normalizeVariables } from './variables';
export * from './traversal';
export * from './schemaPredicates';
export * from './node';

2

dist/types/operations/invalidate.d.ts

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

import { SelectionSet } from 'shared';
import { SelectionSet } from '../ast/node';
import { OperationRequest, Variables, Fragments } from '../types';

@@ -3,0 +3,0 @@ import { Store } from '../store';

import { FieldNode } from 'graphql';
import { SelectionSet } from 'shared';
import { SelectionSet } from '../ast';
import { Store } from '../store';

@@ -4,0 +4,0 @@ import { Fragments, Variables, DataField, NullArray, Data } from '../types';

@@ -17,22 +17,3 @@ "use strict";

return a.kind === graphql.Kind.INLINE_FRAGMENT;
}, helpUrl = "\nhttps://github.com/FormidableLabs/urql/tree/master/exchanges/graphcache/help.md#", cache = new Set, currentDebugStack = [], pushDebugNode = function(a, b) {
var c = "";
b.kind === graphql.Kind.INLINE_FRAGMENT ? c = a ? 'Inline Fragment on "' + a + '"' : "Inline Fragment" : b.kind === graphql.Kind.OPERATION_DEFINITION ? c = (b.name ? '"' + b.name.value + '"' : "Unnamed") + " " + b.operation : b.kind === graphql.Kind.FRAGMENT_DEFINITION && (c = '"' + b.name.value + '" Fragment');
c && currentDebugStack.push(c);
}, getDebugOutput = function() {
return currentDebugStack.length ? "\n(Caused At: " + currentDebugStack.join(", ") + ")" : "";
};
function invariant(a, b, c) {
if (!a) {
throw a = b || "Minfied Error #" + c + "\n", "production" !== process.env.NODE_ENV && (a += getDebugOutput()),
(c = Error(a + helpUrl + c)).name = "Graphcache Error", c;
}
}
function warn(a, b) {
cache.has(a) || (console.warn(a + getDebugOutput() + helpUrl + b), cache.add(a));
}
var makeDict = function() {
}, makeDict = function() {
return Object.create(null);

@@ -65,3 +46,22 @@ }, getFieldArguments = function(a, b) {

}), makeDict());
}, isFragmentNode = function(a) {
}, helpUrl = "\nhttps://bit.ly/38yWDau#", cache = new Set, currentDebugStack = [], pushDebugNode = function(a, b) {
var c = "";
b.kind === graphql.Kind.INLINE_FRAGMENT ? c = a ? 'Inline Fragment on "' + a + '"' : "Inline Fragment" : b.kind === graphql.Kind.OPERATION_DEFINITION ? c = (b.name ? '"' + b.name.value + '"' : "Unnamed") + " " + b.operation : b.kind === graphql.Kind.FRAGMENT_DEFINITION && (c = '"' + b.name.value + '" Fragment');
c && currentDebugStack.push(c);
}, getDebugOutput = function() {
return currentDebugStack.length ? "\n(Caused At: " + currentDebugStack.join(", ") + ")" : "";
};
function invariant(a, b, c) {
if (!a) {
throw a = b || "Minfied Error #" + c + "\n", "production" !== process.env.NODE_ENV && (a += getDebugOutput()),
(c = Error(a + helpUrl + c)).name = "Graphcache Error", c;
}
}
function warn(a, b) {
cache.has(a) || (console.warn(a + getDebugOutput() + helpUrl + b), cache.add(a));
}
var isFragmentNode = function(a) {
return a.kind === graphql.Kind.FRAGMENT_DEFINITION;

@@ -738,8 +738,8 @@ };

for (var h, k = !1, n = !1; void 0 !== (h = c.next()); ) {
var m = getName(h), p = getFieldArguments(h, a.variables), t = getFieldAlias(h), C = keyOfField(m, p), u = readRecord(b, C), B = joinKeys(b, C);
var m = getName(h), p = getFieldArguments(h, a.variables), t = getFieldAlias(h), A = keyOfField(m, p), u = readRecord(b, A), z = joinKeys(b, A);
"production" !== process.env.NODE_ENV && e.schema && g && isFieldAvailableOnType(e.schema, g, m);
var q = void 0, G = e.resolvers[g];
if (void 0 !== G && "function" == typeof G[m]) {
if (a.parentTypeName = g, a.parentKey = b, a.parentFieldKey = B, a.fieldName = m,
void 0 !== u && (d[t] = u), q = G[m](d, p || makeDict(), e, a), void 0 !== h.selectionSet && (q = resolveResolverResult(a, g, m, B, getSelectionSet(h), d[t] || makeDict(), q)),
var q = void 0, E = e.resolvers[g];
if (void 0 !== E && "function" == typeof E[m]) {
if (a.parentTypeName = g, a.parentKey = b, a.parentFieldKey = z, a.fieldName = m,
void 0 !== u && (d[t] = u), q = E[m](d, p || makeDict(), e, a), void 0 !== h.selectionSet && (q = resolveResolverResult(a, g, m, z, getSelectionSet(h), d[t] || makeDict(), q)),
e.schema && null === q && !isFieldNullable(e.schema, g, m)) {

@@ -749,3 +749,3 @@ return;

} else {
void 0 === h.selectionSet ? q = u : void 0 !== (p = readLink(b, C)) ? q = resolveLink(a, p, g, m, getSelectionSet(h), d[t]) : "object" == typeof u && null !== u && (q = u);
void 0 === h.selectionSet ? q = u : void 0 !== (p = readLink(b, A)) ? q = resolveLink(a, p, g, m, getSelectionSet(h), d[t]) : "object" == typeof u && null !== u && (q = u);
}

@@ -793,6 +793,6 @@ if (void 0 === q && e.schema && isFieldNullable(e.schema, g, m)) {

for (var k = !1, n = !1; void 0 !== (g = c.next()); ) {
var m = getName(g), p = getFieldAlias(g), t = keyOfField(m, getFieldArguments(g, a.variables)), C = joinKeys(b, t), u = readRecord(b, t), B = e[m];
var m = getName(g), p = getFieldAlias(g), t = keyOfField(m, getFieldArguments(g, a.variables)), A = joinKeys(b, t), u = readRecord(b, t), z = e[m];
"production" !== process.env.NODE_ENV && f.schema && h && isFieldAvailableOnType(f.schema, h, m);
var q = void 0;
void 0 !== B && void 0 === g.selectionSet ? q = B : void 0 === g.selectionSet ? q = u : void 0 !== B ? q = resolveResolverResult(a, h, m, C, getSelectionSet(g), d[p], B) : void 0 !== (t = readLink(b, t)) ? q = resolveLink(a, t, h, m, getSelectionSet(g), d[p]) : "object" == typeof u && null !== u && (q = u);
void 0 !== z && void 0 === g.selectionSet ? q = z : void 0 === g.selectionSet ? q = u : void 0 !== z ? q = resolveResolverResult(a, h, m, A, getSelectionSet(g), d[p], z) : void 0 !== (t = readLink(b, t)) ? q = resolveLink(a, t, h, m, getSelectionSet(g), d[p]) : "object" == typeof u && null !== u && (q = u);
if (void 0 === q && void 0 !== f.schema && isFieldNullable(f.schema, h, m)) {

@@ -899,13 +899,9 @@ n = !0, d[p] = null;

var v = new Set, w = [];
var v = new Set;
function x() {
return w.length ? "\n(Caused At: " + w.join(", ") + ")" : "";
}
function A(a) {
function y(a) {
return "populate" !== a.name.value;
}
function D(a, b) {
function B(a, b) {
"FragmentDefinition" === b.kind && a.add(b.name.value);

@@ -915,3 +911,3 @@ return a;

function E(a, b, c, d) {
function C(a, b, c, d) {
function e(a, b) {

@@ -922,5 +918,5 @@ if (!(b = c[b.name])) {

for (var e = 0, f = b.length; e < f; e++) {
for (var n = b[e].fragment, m = n.name.value, B = F(n), q = 0, G = B.length; q < G; q++) {
var H = B[q];
k.has(H) || (g[H] = d[H]);
for (var n = b[e].fragment, m = n.name.value, z = D(n), q = 0, E = z.length; q < E; q++) {
var F = z[q];
k.has(F) || (g[F] = d[F]);
}

@@ -930,3 +926,3 @@ h[m] = n;

kind: graphql.Kind.FRAGMENT_SPREAD,
name: z(m)
name: x(m)
});

@@ -941,6 +937,6 @@ }

if (b.directives) {
var c = b.directives.filter(A);
var c = b.directives.filter(y);
if (c.length !== b.directives.length) {
var d = r(f.getType());
graphql.isCompositeType(d) ? d = graphql.isAbstractType(d) ? a.getPossibleTypes(d) : [ d ] : ("production" !== process.env.NODE_ENV && (v.has("Invalid type: The type ` + type + ` is used with @populate but does not exist.") || (console.warn("Invalid type: The type ` + type + ` is used with @populate but does not exist." + x() + "\nhttps://github.com/FormidableLabs/urql/tree/master/exchanges/graphcache/help.md#17"),
graphql.isCompositeType(d) ? d = graphql.isAbstractType(d) ? a.getPossibleTypes(d) : [ d ] : ("production" !== process.env.NODE_ENV && (v.has("Invalid type: The type ` + type + ` is used with @populate but does not exist.") || (console.warn("Invalid type: The type ` + type + ` is used with @populate but does not exist.\nhttps://bit.ly/38yWDau#17"),
v.add("Invalid type: The type ` + type + ` is used with @populate but does not exist."))),

@@ -952,3 +948,3 @@ d = []);

kind: graphql.Kind.FIELD,
name: z("__typename")
name: x("__typename")
} ];

@@ -968,3 +964,3 @@ return l({}, b, {

enter: function(a) {
a.definitions.reduce(D, k);
a.definitions.reduce(B, k);
},

@@ -987,3 +983,3 @@ leave: function(a) {

function z(a) {
function x(a) {
return {

@@ -995,3 +991,3 @@ kind: graphql.Kind.NAME,

function F(a) {
function D(a) {
var b = [];

@@ -1059,3 +1055,3 @@ graphql.visit(a, {

}));
}, C = function(a, b) {
}, A = function(a, b) {
b.forEach((function(b) {

@@ -1072,3 +1068,3 @@ if (b !== a.key) {

}(g.data, a.key) : "teardown" === a.operationName && clearLayer(g.data, a.key);
}, B = function(a) {
}, z = function(a) {
if (function(a) {

@@ -1080,3 +1076,3 @@ return function(a) {

var b = a.key, c = writeOptimistic(g, a, b).dependencies;
0 !== c.size && (n.set(b, c), b = new Set, t(b, c), C(a, b));
0 !== c.size && (n.set(b, c), b = new Set, t(b, c), A(a, b));
}

@@ -1088,3 +1084,3 @@ }, q = function(a, b) {

}));
}, G = function(a) {
}, E = function(a) {
var b = query(g, a), c = b.data, e = b.dependencies;

@@ -1098,3 +1094,3 @@ b = b.partial;

};
}, H = function(a) {
}, F = function(a) {
var b = a.operation, c = a.error, e = a.extensions, d = isQueryOperation(b), f = a.data, h = b.key, p = new Set;

@@ -1113,3 +1109,3 @@ d || (t(p, n.get(h)), n.delete(h), clearLayer(g.data, h));

d && t(p, k);
C(a.operation, p);
A(a.operation, p);
d && void 0 !== k && q(a.operation, k);

@@ -1126,7 +1122,7 @@ return {

var b = k ? wonka.mergeMap(wonka.fromArray)(wonka.take(1)(wonka.buffer(wonka.fromPromise(k))(a))) : wonka.empty;
a = wonka.share(wonka.tap(B)(wonka.map(addTypeNames)(wonka.concat([ b, a ]))));
var c = wonka.share(wonka.map(G)(wonka.filter(_ref3$1)(a)));
a = wonka.share(wonka.tap(z)(wonka.map(addTypeNames)(wonka.concat([ b, a ]))));
var c = wonka.share(wonka.map(E)(wonka.filter(_ref3$1)(a)));
b = wonka.map(_ref4$1)(wonka.filter(_ref5)(c));
c = wonka.map(d)(wonka.filter(_ref7)(c));
a = wonka.map(H)(e(wonka.tap(u)(wonka.filter(_ref8)(wonka.merge([ wonka.filter(_ref9)(a), b ])))));
a = wonka.map(F)(e(wonka.tap(u)(wonka.filter(_ref8)(wonka.merge([ wonka.filter(_ref9)(a), b ])))));
return wonka.merge([ a, c ]);

@@ -1151,3 +1147,3 @@ };

n.add(b);
c = (a = function y(a, b) {
c = (a = function w(a, b) {
var c = [], d = [], e = new graphql.TypeInfo(a);

@@ -1159,4 +1155,3 @@ graphql.visit(b, graphql.visitWithTypeInfo(e, {

if (!b || graphql.isAbstractType(b)) {
throw a = ("production" !== process.env.NODE_ENV ? "Invalid TypeInfo state: Found no flat schema type when one was expected." : "") || "Minfied Error #18\n",
"production" !== process.env.NODE_ENV && (a += x()), (a = Error(a + "\nhttps://github.com/FormidableLabs/urql/tree/master/exchanges/graphcache/help.md#18")).name = "Graphcache Error",
throw (a = Error((("production" !== process.env.NODE_ENV ? "Invalid TypeInfo state: Found no flat schema type when one was expected." : "") || "Minfied Error #18\n") + "\nhttps://bit.ly/38yWDau#18")).name = "Graphcache Error",
a;

@@ -1169,5 +1164,5 @@ }

kind: graphql.Kind.NAMED_TYPE,
name: z(b)
name: x(b)
},
name: z(b + "_PopulateFragment_"),
name: x(b + "_PopulateFragment_"),
selectionSet: a.selectionSet

@@ -1207,3 +1202,3 @@ });

return l({}, a, {
query: E(k, a.query, c, p)
query: C(k, a.query, c, p)
});

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

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

var ba = new Set, w = [];
function x(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);
}
function ca() {
return w.length ? "\n(Caused At: " + w.join(", ") + ")" : "";
}
function y(a, b, c) {
if (!a) {
throw a = b || "Minfied Error #" + c + "\n", "production" !== process.env.NODE_ENV && (a += ca()),
(c = Error(a + "\nhttps://github.com/FormidableLabs/urql/tree/master/exchanges/graphcache/help.md#" + c)).name = "Graphcache Error",
c;
}
}
function z(a, b) {
ba.has(a) || (console.warn(a + ca() + "\nhttps://github.com/FormidableLabs/urql/tree/master/exchanges/graphcache/help.md#" + b),
ba.add(a));
}
function C() {
function w() {
return Object.create(null);
}
function D(a, b) {
function x(a, b) {
if (void 0 === a.arguments || 0 === a.arguments.length) {
return null;
}
for (var c = C(), d = 0, e = 0, f = a.arguments.length; e < f; e++) {
for (var c = w(), d = 0, e = 0, f = a.arguments.length; e < f; e++) {
var g = a.arguments[e], h = valueFromASTUntyped(g.value, b);

@@ -62,3 +37,3 @@ null != h && (c[g.name.value] = h, d++);

function E(a, b) {
function y(a, b) {
if (void 0 === a.variableDefinitions) {

@@ -79,5 +54,28 @@ return {};

return a;
}), C());
}), w());
}
var ba = new Set, z = [];
function C(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 && z.push(c);
}
function ca() {
return z.length ? "\n(Caused At: " + z.join(", ") + ")" : "";
}
function D(a, b, c) {
if (!a) {
throw a = b || "Minfied Error #" + c + "\n", "production" !== process.env.NODE_ENV && (a += ca()),
(c = Error(a + "\nhttps://bit.ly/38yWDau#" + c)).name = "Graphcache Error", c;
}
}
function E(a, b) {
ba.has(a) || (console.warn(a + ca() + "\nhttps://bit.ly/38yWDau#" + b), ba.add(a));
}
function da(a) {

@@ -92,3 +90,3 @@ return a.kind === Kind.FRAGMENT_DEFINITION;

function G(a) {
y(!!(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);
D(!!(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);
return a;

@@ -121,3 +119,3 @@ }

if (void 0 === (a = a.getFields()[c])) {
"production" !== process.env.NODE_ENV && z("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);
"production" !== process.env.NODE_ENV && E("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);
} else {

@@ -129,3 +127,3 @@ return a;

function ja(a, b) {
y(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);
D(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);
}

@@ -157,5 +155,5 @@

M = new Set;
"production" !== process.env.NODE_ENV && (w.length = 0);
"production" !== process.env.NODE_ENV && (z.length = 0);
b ? c || 1 < a.commutativeKeys.size && a.commutativeKeys.has(b) ? (N = b, -1 === a.optimisticOrder.indexOf(b) && a.optimisticOrder.unshift(b),
a.refLock[b] || (a.refLock[b] = C(), a.links.optimistic[b] = new Map, a.records.optimistic[b] = new Map)) : (N = null,
a.refLock[b] || (a.refLock[b] = w(), a.links.optimistic[b] = new Map, a.records.optimistic[b] = new Map)) : (N = null,
P(a, b)) : N = null;

@@ -185,3 +183,3 @@ }

M = L = null;
"production" !== process.env.NODE_ENV && (w.length = 0);
"production" !== process.env.NODE_ENV && (z.length = 0);
!c.gcScheduled && 0 < c.gcBatch.size && (c.gcScheduled = !0, la((function a() {

@@ -193,3 +191,3 @@ ma(c);

c.persistenceScheduled = !1;
c.persistenceBatch = C();
c.persistenceBatch = w();
})));

@@ -199,3 +197,3 @@ }

function oa() {
y(null !== M, "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);
D(null !== M, "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 M;

@@ -206,3 +204,3 @@ }

var e = (a = N ? a.optimistic[N] : a.base).get(b);
void 0 === e && a.set(b, e = C());
void 0 === e && a.set(b, e = w());
void 0 !== d || N ? e[c] = d : delete e[c];

@@ -306,3 +304,3 @@ }

if (N) {
var e = d.refLock[N] || (d.refLock[N] = C());
var e = d.refLock[N] || (d.refLock[N] = w());
var f = d.links.optimistic[N];

@@ -355,3 +353,3 @@ } else {

}
"production" !== process.env.NODE_ENV && z("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 && E("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 !r(a).some((function(a) {

@@ -361,3 +359,3 @@ if (a.kind !== Kind.FIELD) {

}
a = K(a.name.value, D(a, d));
a = K(a.name.value, x(a, d));
return !(void 0 !== S(c, a) || void 0 !== T(c, a));

@@ -398,5 +396,5 @@ }));

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 && C(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),
h = b.getType(d), e instanceof GraphQLObjectType ? b = e === h : (y(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),
h = b.getType(d), e instanceof GraphQLObjectType ? b = e === h : (D(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),
ja(h, d), b = b.isPossibleType(e, h))) : b = !1) : b = ya(a, this.typename, this.entityKey, this.context.variables),

@@ -433,6 +431,6 @@ b && (this.indexStack.push(0), this.selectionStack.push(r(a))));

store: a,
variables: E(d, b.variables),
variables: y(d, b.variables),
fragments: H(b.query)
};
"production" !== process.env.NODE_ENV && x(g, d);
"production" !== process.env.NODE_ENV && C(g, d);
g === a.store.getRootKey("query") ? Ba(a, g, f, c) : Ca(a, g, f, c);

@@ -449,4 +447,4 @@ return e;

var e = a.getRootKey("mutation"), f = a.getRootKey(d.operation);
y(f === e, "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(f, d);
D(f === e, "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 && C(f, d);
a = {

@@ -457,3 +455,3 @@ parentTypeName: e,

fieldName: "",
variables: E(d, b.variables),
variables: y(d, b.variables),
fragments: H(b.query),

@@ -463,3 +461,3 @@ store: a,

};
b = C();
b = w();
d = new W(f, f, r(d), a);

@@ -471,5 +469,5 @@ for (var g; void 0 !== (g = d.next()); ) {

a.fieldName = h;
Ea(a, X(k = k((f = D(g, a.variables)) || C(), a.store, a)), r(g));
Ea(a, X(k = k((f = x(g, a.variables)) || w(), a.store, a)), r(g));
b[h] = k;
void 0 !== (g = a.store.updates[e][h]) && g(b, f || C(), a.store, a);
void 0 !== (g = a.store.updates[e][h]) && g(b, f || w(), a.store, a);
}

@@ -486,3 +484,3 @@ }

if (void 0 === (e = b[e[0]])) {
return "production" !== process.env.NODE_ENV ? z("writeFragment(...) was called with an empty fragment.\nYou have to call it with at least one fragment in your GraphQL document.", 11) : void 0;
return "production" !== process.env.NODE_ENV ? E("writeFragment(...) was called with an empty fragment.\nYou have to call it with at least one fragment in your GraphQL document.", 11) : void 0;
}

@@ -495,5 +493,5 @@ var f = e.typeCondition.name.value;

if (!g) {
return "production" !== process.env.NODE_ENV ? z("Can't generate a key for writeFragment(...) data.\nYou have to pass an `id` or `_id` field or create a custom `keys` config for `" + f + "`.", 12) : void 0;
return "production" !== process.env.NODE_ENV ? E("Can't generate a key for writeFragment(...) data.\nYou have to pass an `id` or `_id` field or create a custom `keys` config for `" + f + "`.", 12) : void 0;
}
"production" !== process.env.NODE_ENV && x(f, e);
"production" !== process.env.NODE_ENV && C(f, e);
Ba({

@@ -516,3 +514,3 @@ parentTypeName: f,

for (var f; void 0 !== (f = c.next()); ) {
var g = f.name.value, h = D(f, a.variables);
var g = f.name.value, h = x(f, a.variables);
h = K(g, h);

@@ -524,3 +522,3 @@ var k = d[p(f)], m = b + "." + h;

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

@@ -549,3 +547,3 @@ } else {

g = d.__typename;
void 0 !== a.store.keys[d.__typename] || null !== e || "string" != typeof g || g.endsWith("Connection") || g.endsWith("Edge") || "PageInfo" === g || "production" !== process.env.NODE_ENV && z("Invalid key: The GraphQL query at the field at `" + b + "` 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 `" + g + "`.\nEntities without keys will be embedded directly on the parent entity. If this is intentional, create a `keys` config for `" + g + "` that always returns null.", 15);
void 0 !== a.store.keys[d.__typename] || null !== e || "string" != typeof g || g.endsWith("Connection") || g.endsWith("Edge") || "PageInfo" === g || "production" !== process.env.NODE_ENV && E("Invalid key: The GraphQL query at the field at `" + b + "` 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 `" + g + "`.\nEntities without keys will be embedded directly on the parent entity. If this is intentional, create a `keys` config for `" + g + "` that always returns null.", 15);
Ba(a, f, c, d);

@@ -559,3 +557,3 @@ return f;

for (var f; void 0 !== (f = c.next()); ) {
var g = f.name.value, h = D(f, a.variables);
var g = f.name.value, h = x(f, a.variables);
var k = K(g, h);

@@ -567,3 +565,3 @@ k = b + "." + k;

e && (a.parentTypeName = b, a.parentKey = b, a.parentFieldKey = k, a.fieldName = g,
void 0 !== (f = a.store.updates[b][g]) && f(d, h || C(), a.store, a));
void 0 !== (f = a.store.updates[b][g]) && f(d, h || w(), a.store, a));
}

@@ -615,14 +613,14 @@ }

persistenceScheduled: !1,
persistenceBatch: C(),
persistenceBatch: w(),
gcScheduled: !1,
queryRootKey: a,
gcBatch: new Set,
refCount: C(),
refLock: C(),
refCount: w(),
refLock: w(),
links: {
optimistic: C(),
optimistic: w(),
base: new Map
},
records: {
optimistic: C(),
optimistic: w(),
base: new Map

@@ -679,3 +677,3 @@ },

for (var e; void 0 !== (e = c.next()); ) {
var f = e.name.value, g = K(f, D(e, a.variables));
var f = e.name.value, g = K(f, x(e, a.variables));
"production" !== process.env.NODE_ENV && a.store.schema && d && J(a.store.schema, d, f);

@@ -695,3 +693,3 @@ if (void 0 === e.selectionSet) {

}(b = {
variables: E(a = G((b = createRequest(a, b)).query), b.variables),
variables: y(a = G((b = createRequest(a, b)).query), b.variables),
fragments: H(b.query),

@@ -704,3 +702,3 @@ store: this

var b = "string" == typeof a ? a : this.keyOfEntity(a);
y(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);
D(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;

@@ -739,3 +737,3 @@ for (var c = this.inspectFields(b); a < c.length; a += 1) {

if (void 0 === (d = a[d[0]])) {
"production" !== process.env.NODE_ENV && z("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 && E("readFragment(...) was called with an empty fragment.\nYou have to call it with at least one fragment in your GraphQL document.", 6),
c = null;

@@ -747,3 +745,3 @@ } else {

__typename: e
}, b)) : b) ? ("production" !== process.env.NODE_ENV && x(e, d), c = Z({
}, b)) : b) ? ("production" !== process.env.NODE_ENV && C(e, d), c = Z({
parentTypeName: e,

@@ -757,3 +755,3 @@ parentKey: b,

store: this
}, b, r(d), C()) || null) : ("production" !== process.env.NODE_ENV && z("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, r(d), w()) || null) : ("production" !== process.env.NODE_ENV && E("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);

@@ -783,8 +781,8 @@ }

store: a,
variables: E(d, b.variables),
variables: y(d, b.variables),
fragments: H(b.query),
partial: !1
};
"production" !== process.env.NODE_ENV && x(e, d);
c = c || C();
"production" !== process.env.NODE_ENV && C(e, d);
c = c || w();
c = e !== a.store.getRootKey("query") ? Ka(a, e, f, c) : Z(a, e, f, c);

@@ -803,3 +801,3 @@ return {

b = new W(b, b, c, a);
(c = C()).__typename = d.__typename;
(c = w()).__typename = d.__typename;
for (var e; void 0 !== (e = b.next()); ) {

@@ -822,3 +820,3 @@ var f = p(e), g = d[f];

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

@@ -832,3 +830,3 @@

for (var h, k = !1, m = !1; void 0 !== (h = c.next()); ) {
var l = h.name.value, t = D(h, a.variables), q = p(h), u = K(l, t), v = S(b, u), A = b + "." + u;
var l = h.name.value, t = x(h, a.variables), q = p(h), u = K(l, t), v = S(b, u), A = b + "." + u;
"production" !== process.env.NODE_ENV && e.schema && g && J(e.schema, g, l);

@@ -838,3 +836,3 @@ var n = void 0, B = e.resolvers[g];

if (a.parentTypeName = g, a.parentKey = b, a.parentFieldKey = A, a.fieldName = l,
void 0 !== v && (d[q] = v), n = B[l](d, t || C(), e, a), void 0 !== h.selectionSet && (n = Ma(a, g, l, A, r(h), d[q] || C(), n)),
void 0 !== v && (d[q] = v), n = B[l](d, t || w(), e, a), void 0 !== h.selectionSet && (n = Ma(a, g, l, A, r(h), d[q] || w(), n)),
e.schema && null === n && !ha(e.schema, g, l)) {

@@ -879,3 +877,3 @@ return;

if ("string" == typeof g || "object" == typeof g && "string" == typeof g.__typename) {
b = void 0 === f ? C() : f;
b = void 0 === f ? w() : f;
if ("string" == typeof g) {

@@ -885,3 +883,3 @@ a = Z(a, g, e, b);

a: if (d = (c = a.store).keyOfEntity(g) || d, h = g.__typename, "string" != typeof (f = S(d, "__typename") || h) || h && f !== h) {
"production" !== process.env.NODE_ENV && z("Invalid resolver data: The resolver at `" + d + "` returned an invalid typename that could not be reconciled with the cache.", 8),
"production" !== process.env.NODE_ENV && E("Invalid resolver data: The resolver at `" + d + "` returned an invalid typename that could not be reconciled with the cache.", 8),
a = void 0;

@@ -894,3 +892,3 @@ } else {

t = p(h);
var q = K(l, D(h, a.variables)), u = d + "." + q, v = S(d, q), A = g[l];
var q = K(l, x(h, a.variables)), u = d + "." + q, v = S(d, q), A = g[l];
"production" !== process.env.NODE_ENV && c.schema && f && J(c.schema, f, l);

@@ -914,3 +912,3 @@ var n = void 0;

}
"production" !== process.env.NODE_ENV && z("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 && E("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);
}

@@ -932,3 +930,3 @@

}
return null === b ? null : Z(a, b, e, void 0 === f ? C() : f);
return null === b ? null : Z(a, b, e, void 0 === f ? w() : f);
}

@@ -1006,13 +1004,9 @@

var ab = new Set, bb = [];
var ab = new Set;
function cb() {
return bb.length ? "\n(Caused At: " + bb.join(", ") + ")" : "";
}
function fb(a) {
function db(a) {
return "populate" !== a.name.value;
}
function gb(a, b) {
function eb(a, b) {
"FragmentDefinition" === b.kind && a.add(b.name.value);

@@ -1022,3 +1016,3 @@ return a;

function hb(a, b, c, d) {
function fb(a, b, c, d) {
function e(a, b) {

@@ -1029,3 +1023,3 @@ if (!(b = c[b.name])) {

for (var e = 0, f = b.length; e < f; e++) {
for (var u = b[e].fragment, m = u.name.value, l = ib(u), n = 0, B = l.length; n < B; n++) {
for (var u = b[e].fragment, m = u.name.value, l = gb(u), n = 0, B = l.length; n < B; n++) {
var F = l[n];

@@ -1037,3 +1031,3 @@ k.has(F) || (g[F] = d[F]);

kind: Kind.FRAGMENT_SPREAD,
name: eb(m)
name: cb(m)
});

@@ -1048,6 +1042,6 @@ }

if (b.directives) {
var c = b.directives.filter(fb);
var c = b.directives.filter(db);
if (c.length !== b.directives.length) {
var d = $a(f.getType());
isCompositeType(d) ? d = isAbstractType(d) ? a.getPossibleTypes(d) : [ d ] : ("production" !== process.env.NODE_ENV && (ab.has("Invalid type: The type ` + type + ` is used with @populate but does not exist.") || (console.warn("Invalid type: The type ` + type + ` is used with @populate but does not exist." + cb() + "\nhttps://github.com/FormidableLabs/urql/tree/master/exchanges/graphcache/help.md#17"),
isCompositeType(d) ? d = isAbstractType(d) ? a.getPossibleTypes(d) : [ d ] : ("production" !== process.env.NODE_ENV && (ab.has("Invalid type: The type ` + type + ` is used with @populate but does not exist.") || (console.warn("Invalid type: The type ` + type + ` is used with @populate but does not exist.\nhttps://bit.ly/38yWDau#17"),
ab.add("Invalid type: The type ` + type + ` is used with @populate but does not exist."))),

@@ -1059,3 +1053,3 @@ d = []);

kind: Kind.FIELD,
name: eb("__typename")
name: cb("__typename")
} ];

@@ -1075,3 +1069,3 @@ return Za({}, b, {

enter: function(a) {
a.definitions.reduce(gb, k);
a.definitions.reduce(eb, k);
},

@@ -1094,3 +1088,3 @@ leave: function(a) {

function eb(a) {
function cb(a) {
return {

@@ -1102,3 +1096,3 @@ kind: Kind.NAME,

function ib(a) {
function gb(a) {
var b = [];

@@ -1226,3 +1220,3 @@ visit(a, {

}
var n = new Map, B = new Map, F = C();
var n = new Map, B = new Map, F = w();
return function(a) {

@@ -1251,3 +1245,3 @@ a = share(a);

m.add(b);
c = (a = function db(a, b) {
c = (a = function bb(a, b) {
var c = [], d = [], e = new TypeInfo(a);

@@ -1259,4 +1253,3 @@ visit(b, visitWithTypeInfo(e, {

if (!b || isAbstractType(b)) {
throw a = ("production" !== process.env.NODE_ENV ? "Invalid TypeInfo state: Found no flat schema type when one was expected." : "") || "Minfied Error #18\n",
"production" !== process.env.NODE_ENV && (a += cb()), (a = Error(a + "\nhttps://github.com/FormidableLabs/urql/tree/master/exchanges/graphcache/help.md#18")).name = "Graphcache Error",
throw (a = Error((("production" !== process.env.NODE_ENV ? "Invalid TypeInfo state: Found no flat schema type when one was expected." : "") || "Minfied Error #18\n") + "\nhttps://bit.ly/38yWDau#18")).name = "Graphcache Error",
a;

@@ -1269,5 +1262,5 @@ }

kind: Kind.NAMED_TYPE,
name: eb(b)
name: cb(b)
},
name: eb(b + "_PopulateFragment_"),
name: cb(b + "_PopulateFragment_"),
selectionSet: a.selectionSet

@@ -1307,3 +1300,3 @@ });

return Za({}, a, {
query: hb(k, a.query, c, t)
query: fb(k, a.query, c, t)
});

@@ -1310,0 +1303,0 @@ }

@@ -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 v,formatDocument as p}from"@urql/core";import{Kind as y,valueFromASTUntyped as m,isNullableType as h,isNonNullType as g,isListType as k,GraphQLObjectType as b,GraphQLInterfaceType as S,GraphQLUnionType as _,buildClientSchema as O,visit as K,visitWithTypeInfo as w,isWrappingType as N,isCompositeType as x,isAbstractType as q,TypeInfo as E}from"graphql";import{_ as F}from"./406259e3.esm.min.js";function T(e){return void 0!==e.alias?e.alias.value:e.name.value}function A(e){return void 0!==e.selectionSet?e.selectionSet.selections:[]}function M(e){return void 0!==(e=e.typeCondition)?e.name.value:null}function R(e,t,n){if(!e)throw(e=Error((t||"Minfied Error #"+n+"\n")+"\nhttps://github.com/FormidableLabs/urql/tree/master/exchanges/graphcache/help.md#"+n)).name="Graphcache Error",e}function L(){return Object.create(null)}function P(e,t){if(void 0===e.arguments||0===e.arguments.length)return null;for(var n=L(),i=0,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 B(e,t){if(void 0===e.variableDefinitions)return{};var n=t||{};return e.variableDefinitions.reduce((function(e,t){var i=t.variable.name.value,r=n[i];if(void 0===r){if(void 0===t.defaultValue)return e;r=m(t.defaultValue,n)}return e[i]=r,e}),L())}function I(e){return e.kind===y.FRAGMENT_DEFINITION}function D(e){return e.kind===y.OPERATION_DEFINITION}function j(e){return R(!!(e=e.definitions.find(D)),"",1),e}function C(e,t){return e[t.name.value]=t,e}function Q(e){return e.definitions.filter(I).reduce(C,{})}function G(e,t,n){return void 0!==(e=V(e,t,n))&&h(e.type)}function z(e,t,n){return void 0!==(e=V(e,t,n))&&(e=g(e.type)?e.type.ofType:e.type,k(e)&&h(e.ofType))}function V(e,t,n){if(R((e=e.getType(t))instanceof b,"",3),void 0!==(n=e.getFields()[n]))return n}function W(e,t){return t?e+"("+d(t)+")":e}function J(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 Y="undefined"!=typeof Promise?Promise.prototype.then.bind(Promise.resolve()):function(e){return setTimeout(e,0)},H=null,U=null,X=null;function Z(e,t,n){H=e,U=new Set,t?n||1<e.commutativeKeys.size&&e.commutativeKeys.has(t)?(X=t,-1===e.optimisticOrder.indexOf(t)&&e.optimisticOrder.unshift(t),e.refLock[t]||(e.refLock[t]=L(),e.links.optimistic[t]=new Map,e.records.optimistic[t]=new Map)):(X=null,ve(e,t)):X=null}function $(){var e,t,n=H,i=X;if(X=null,i&&n.commutativeKeys.has(i)){var r=n.optimisticOrder.length-n.commutativeKeys.size;if(n.optimisticOrder[n.optimisticOrder.length-1]===i){i=[];for(var o=n.optimisticOrder.length;r<o;r++){var a=n.optimisticOrder[r];if(!n.refLock[a])break;i.unshift(a)}for(o=0,r=i.length;o<r;o++)t=void 0,(t=H.links.optimistic[e=i[o]])&&t.forEach(pe),(t=H.records.optimistic[e])&&t.forEach(ye),ve(H,e)}}U=H=null,!n.gcScheduled&&0<n.gcBatch.size&&(n.gcScheduled=!0,Y((function(){se(n)}))),n.storage&&!n.persistenceScheduled&&(n.persistenceScheduled=!0,Y((function(){n.storage.write(n.persistenceBatch),n.persistenceScheduled=!1,n.persistenceBatch=L()})))}function ee(){return R(null!==U,"",2),U}function te(e,t,n,i){var r=(e=X?e.optimistic[X]:e.base).get(t);void 0===r&&e.set(t,r=L()),void 0!==i||X?r[n]=i:delete r[n]}function ne(e,t,n){for(var i,r=0,o=H.optimisticOrder.length;r<o;r++){var a=e.optimistic[H.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 ie(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 re(e,t,n,i){if("string"==typeof n)ie(e,t,n,i);else if(Array.isArray(n))for(var r=0,o=n.length;r<o;r++){var a=n[r];a&&ie(e,t,a,i)}}function oe(e,t,n){if(void 0!==n)for(var i in n)t.has(i)||(e.push(J(i)),t.add(i))}function ae(e,t,n,i){oe(e,t,i.base.get(n));for(var r=0,o=H.optimisticOrder.length;r<o;r++)oe(e,t,i.optimistic[H.optimisticOrder[r]].get(n))}function se(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),re(e.gcBatch,e.refCount,r[o],-1)}else e.gcBatch.delete(t)}))}function ue(e,t){"__typename"!==t&&(e!==H.queryRootKey?U.add(e):void 0!==t&&U.add(e+"."+t))}function ce(e,t){return ue(e,t),ne(H.records,e,t)}function le(e,t){return ue(e,t),ne(H.links,e,t)}function fe(e,t,n){ue(e,t),te(H.records,e,t,n),H.storage&&!X&&(H.persistenceBatch["r|"+e+"."+t]=n)}function de(e,t,n){var i=H;if(X)var r=i.refLock[X]||(i.refLock[X]=L()),o=i.links.optimistic[X];else{i.storage&&(i.persistenceBatch["l|"+e+"."+t]=n),r=i.refCount,o=i.links.base;var a=i.gcBatch}o=void 0!==(o=void 0!==o?o.get(e):void 0)?o[t]:null,ue(e,t),te(i.links,e,t,n),re(a,r,o,-1),re(a,r,n,1)}function ve(e,t){var n=e.optimisticOrder.indexOf(t);-1<n&&(e.optimisticOrder.splice(n,1),e.commutativeKeys.delete(t)),e.refLock[t]&&(delete e.refLock[t],delete e.records.optimistic[t],delete e.links.optimistic[t])}function pe(e,t){for(var n in e)de(t,n,e[n])}function ye(e,t){for(var n in e)fe(t,n,e[n])}function me(e,t,n,i){return!(!t||t!==M(e)&&A(e).some((function(e){return e.kind===y.FIELD&&(e=W(e.name.value,P(e,i)),!(void 0!==ce(n,e)||void 0!==le(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){return void 0===e?null:e}function ke(e,t,n,i){return Z(e.data,i||null),e=be(e,t,n),$(),e}function be(e,t,n){var i=j(t.query),r={dependencies:ee()},o=A(i),a=e.getRootKey(i.operation);return a===(e={parentTypeName:a,parentKey:a,parentFieldKey:"",fieldName:"",store:e,variables:B(i,t.variables),fragments:Q(t.query)}).store.getRootKey("query")?Oe(e,a,o,n):we(e,a,o,n),r}function Se(e,t,n){Z(e.data,n,!0);var i=j(t.query);n={dependencies:ee()};var r,o=e.getRootKey("mutation"),a=e.getRootKey(i.operation);for(R(a===o,"",10),e={parentTypeName:o,parentKey:o,parentFieldKey:"",fieldName:"",variables:B(i,t.variables),fragments:Q(t.query),store:e,optimistic:!0},t=L(),i=new he(a,a,A(i),e);void 0!==(r=i.next());)if(void 0!==r.selectionSet){var s=r.name.value,u=e.store.optimisticMutations[s];void 0!==u&&(e.fieldName=s,Ne(e,ge(u=u((a=P(r,e.variables))||L(),e.store,e)),A(r)),t[s]=u,void 0!==(r=e.store.updates[o][s])&&r(t,a||L(),e.store,e))}return $(),n}function _e(e,t,n,i){t=Q(t);var r=Object.keys(t);if(void 0!==(r=t[r[0]])){var o=r.typeCondition.name.value;n=F({},{__typename:o},n);var a=e.keyOfEntity(n);a&&Oe({parentTypeName:o,parentKey:a,parentFieldKey:"",fieldName:"",variables:i||{},fragments:t,store:e},a,A(r),n)}}function Oe(e,t,n,i){var r=t===e.store.getRootKey("query")?t:i.__typename;if("string"==typeof r)for(fe(t,"__typename",r),n=new he(r,t,n,e);void 0!==(r=n.next());){var o=r.name.value,a=P(r,e.variables);o=W(o,a);var s=i[T(r)];a=t+"."+o,void 0===r.selectionSet?fe(t,o,s):(s=ge(s),de(t,o,r=Ke(e,a,A(r),s)))}}function Ke(e,t,n,i){if(Array.isArray(i)){for(var r=Array(i.length),o=0,a=i.length;o<a;o++){var s=Ke(e,t+"."+o,n,i[o]);r[o]=s}return r}return null===i?null:(t=null!==(r=e.store.keyOfEntity(i))?r:t,o=i.__typename,void 0!==e.store.keys[i.__typename]||null!==r||"string"!=typeof o||o.endsWith("Connection")||o.endsWith("Edge"),Oe(e,t,n,i),t)}function we(e,t,n,i){var r,o=t===e.store.getRootKey("mutation")||t===e.store.getRootKey("subscription");for(n=new he(t,t,n,e);void 0!==(r=n.next());){var a=r.name.value,s=P(r,e.variables),u=W(a,s);u=t+"."+u,void 0!==r.selectionSet&&Ne(e,ge(i[T(r)]),A(r)),o&&(e.parentTypeName=t,e.parentKey=t,e.parentFieldKey=u,e.fieldName=a,void 0!==(r=e.store.updates[t][a])&&r(i,s||L(),e.store,e))}}function Ne(e,t,n){if(Array.isArray(t)){for(var i=Array(t.length),r=0,o=t.length;r<o;r++)i[r]=Ne(e,t[r],n);return i}null!==t&&(null!==(i=e.store.keyOfEntity(t))?Oe(e,i,n,t):we(e,t.__typename,n,t))}function xe(e,t,n,i,r){var o,a=this;this.gcScheduled=!1,this.gc=function(){se(a.data),a.gcScheduled=!1},this.keyOfField=W,this.resolvers=t||{},this.optimisticMutations=i||{},this.keys=r||{},this.updates={Mutation:n&&n.Mutation||{},Subscription:n&&n.Subscription||{}},e?(n=(t=this.schema=O(e)).getQueryType(),e=t.getMutationType(),t=t.getSubscriptionType(),this.rootFields={query:n=n?n.name:"Query",mutation:e=e?e.name:"Mutation",subscription:t=t?t.name:"Subscription"},this.rootNames=((o={})[n]="query",o[e]="mutation",o[t]="subscription",o)):(this.rootFields={query:"Query",mutation:"Mutation",subscription:"Subscription"},this.rootNames={Query:"query",Mutation:"mutation",Subscription:"subscription"}),this.data=function(e){return{persistenceScheduled:!1,persistenceBatch:L(),gcScheduled:!1,queryRootKey:e,gcBatch:new Set,refCount:L(),refLock:L(),links:{optimistic:L(),base:new Map},records:{optimistic:L(),base:new Map},commutativeKeys:new Set,optimisticOrder:[],storage:null}}(this.getRootKey("query"))}function qe(e,t,n){return Z(e.data,null),e=Ee(e,t,n),$(),e}function Ee(e,t,n){var i=j(t.query),r=e.getRootKey(i.operation),o=A(i);return e={parentTypeName:r,parentKey:r,parentFieldKey:"",fieldName:"",store:e,variables:B(i,t.variables),fragments:Q(t.query),partial:!1},n=n||L(),n=r!==e.store.getRootKey("query")?Fe(e,r,o,n):Ae(e,r,o,n),{dependencies:ee(),partial:void 0!==n&&e.partial,data:void 0===n?null:n}}function Fe(e,t,n,i){if("string"!=typeof i.__typename)return i;t=new he(t,t,n,e),(n=L()).__typename=i.__typename;for(var r;void 0!==(r=t.next());){var o=T(r),a=i[o];void 0!==r.selectionSet&&null!==a?(a=ge(a),n[o]=Te(e,A(r),a)):n[o]=a}return n}function Te(e,t,n){if(Array.isArray(n)){for(var i=Array(n.length),r=0,o=n.length;r<o;r++)i[r]=Te(e,t,n[r]);return i}return null===n?null:null!==(i=e.store.keyOfEntity(n))?void 0===(e=Ae(e,i,t,L()))?null:e:Fe(e,n.__typename,t,n)}function Ae(e,t,n,i){var r=e.store,o=t===r.getRootKey("query"),a=o?t:ce(t,"__typename");if("string"==typeof a){i.__typename=a,n=new he(a,t,n,e);for(var s,u=!1,c=!1;void 0!==(s=n.next());){var l=s.name.value,f=P(s,e.variables),d=T(s),v=W(l,f),p=ce(t,v),y=t+"."+v,m=void 0,h=r.resolvers[a];if(void 0!==h&&"function"==typeof h[l]){if(e.parentTypeName=a,e.parentKey=t,e.parentFieldKey=y,e.fieldName=l,void 0!==p&&(i[d]=p),m=h[l](i,f||L(),r,e),void 0!==s.selectionSet&&(m=Me(e,a,l,y,A(s),i[d]||L(),m)),r.schema&&null===m&&!G(r.schema,a,l))return}else void 0===s.selectionSet?m=p:void 0!==(f=le(t,v))?m=Re(e,f,a,l,A(s),i[d]):"object"==typeof p&&null!==p&&(m=p);if(void 0===m&&r.schema&&G(r.schema,a,l))c=!0,i[d]=null;else{if(void 0===m)return;u=!0,i[d]=m}}return c&&(e.partial=!0),o&&c&&!u?void 0:i}}function Me(e,t,n,i,r,o,a){if(Array.isArray(a)){var s=e.store;s=!s.schema||z(s.schema,t,n);for(var u=Array(a.length),c=0,l=a.length;c<l;c++){var f=Me(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}if(null==a)return a;if("string"==typeof a||"object"==typeof a&&"string"==typeof a.__typename){if(t=void 0===o?L():o,"string"==typeof a)e=Ae(e,a,r,t);else e:if(i=(n=e.store).keyOfEntity(a)||i,s=a.__typename,"string"!=typeof(o=ce(i,"__typename")||s)||s&&o!==s)e=void 0;else{for(t.__typename=o,r=new he(o,i,r,e),c=u=!1;void 0!==(s=r.next());){l=s.name.value,f=T(s);var d=W(l,P(s,e.variables)),v=i+"."+d,p=ce(i,d),y=a[l],m=void 0;if(void 0!==y&&void 0===s.selectionSet?m=y:void 0===s.selectionSet?m=p:void 0!==y?m=Me(e,o,l,v,A(s),t[f],y):void 0!==(d=le(i,d))?m=Re(e,d,o,l,A(s),t[f]):"object"==typeof p&&null!==p&&(m=p),void 0===m&&void 0!==n.schema&&G(n.schema,o,l))c=!0,t[f]=null;else{if(void 0===m){e=void 0;break e}u=!0,t[f]=m}}c&&(e.partial=!0),e=u?t:void 0}return e}}function Re(e,t,n,i,r,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&z(a.schema,n,i);for(var s=Array(t.length),u=0,c=t.length;u<c;u++){var l=Re(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:Ae(e,t,r,void 0===o?L():o)}function Le(e,t){return F({},e,{context:F({},e.context,{meta:F({},e.context.meta,{cacheOutcome:t})})})}function Pe(e){return F({},e,{query:p(e.query)})}function Be(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function Ie(e,t){return F({},e,{context:F({},e.context,{requestPolicy:t})})}function De(e){return Be(e)}function je(e){return Le(e.operation,e.outcome)}function Ce(e){return"miss"===e.outcome}function Qe(e){return"miss"!==e.outcome}function Ge(e){return"cache-only"!==e.context.requestPolicy}function ze(e){return!Be(e)}function Ve(e){for(var t=arguments,n=1;n<arguments.length;n++){var i,r=t[n];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}function We(){return(We=Object.assign||Ve).apply(this,arguments)}function Je(e){return N(e)?Je(e.ofType):e||null}function Ye(e){return"populate"!==e.name.value}function He(e,t){return"FragmentDefinition"===t.kind&&e.add(t.name.value),e}function Ue(e,t,n,i){function r(e,t){if(!(t=n[t.name]))return e;for(var r=0,o=t.length;r<o;r++){for(var c=t[r].fragment,l=c.name.value,f=Ze(c),d=0,v=f.length;d<v;d++){var p=f[d];u.has(p)||(a[p]=i[p])}s[l]=c,e.push({kind:y.FRAGMENT_SPREAD,name:Xe(l)})}return e}var o=new E(e),a=Object.create(null),s=Object.create(null),u=new Set;return K(t,w(o,{Field:{enter:function(t){if(t.directives){var n=t.directives.filter(Ye);if(n.length!==t.directives.length){var i=Je(o.getType());i=(i=x(i)?q(i)?e.getPossibleTypes(i):[i]:[]).reduce(r,[]);var a=void 0!==t.selectionSet?t.selectionSet.selections:[];return i=0!==a.length+i.length?i.concat(a):[{kind:y.FIELD,name:Xe("__typename")}],We({},t,{directives:n,selectionSet:{kind:y.SELECTION_SET,selections:i}})}}}},Document:{enter:function(e){e.definitions.reduce(He,u)},leave:function(e){var t,n=[].concat(e.definitions);for(t in s)n.push(s[t]);for(var i in a)n.push(a[i]);return We({},e,{definitions:n})}}}))}function Xe(e){return{kind:y.NAME,value:e}}function Ze(e){var t=[];return K(e,{FragmentSpread:function(e){t.push(e.name.value)}}),t}function $e(d){return function(v){function p(e){var t=e.operation,n=e.error,i=e.extensions,r="query"===t.operationName,o=e.data,a=t.key,s=new Set;if(r||(b(s,x.get(a)),x.delete(a),ve(K.data,a)),null!=o){var u=ke(K,t,o,a).dependencies;if(r){o=(a=qe(K,t)).data;var c=a.dependencies}else o=qe(K,t,o).data}return b(s,u),r&&b(s,c),k(e.operation,s),r&&void 0!==c&&m(e.operation,c),{data:o,error:n,extensions:i,operation:t}}function y(e){var t=qe(K,e),n=t.data,i=t.dependencies;return t=t.partial,null===n?i="miss":(m(e,i),i=t&&"cache-only"!==e.context.requestPolicy?"partial":"hit"),{outcome:i,operation:e,data:n}}function m(e,t){t.forEach((function(t){(E[t]||(E[t]=[])).push(e.key),q.has(e.key)||q.set(e.key,"network-only"===e.context.requestPolicy?Ie(e,"cache-and-network"):e)}))}function h(e){if("mutation"===e.operationName&&"network-only"!==e.context.requestPolicy){var t=e.key,n=Se(K,e,t).dependencies;0!==n.size&&(x.set(t,n),b(t=new Set,n),k(e,t))}}function g(e){if("query"===e.operationName){var t=K.data;t.commutativeKeys.has(e=e.key)||(t.optimisticOrder.splice(t.optimisticOrder.length-t.commutativeKeys.size,0,e),t.commutativeKeys.add(e))}else"teardown"===e.operationName&&ve(K.data,e.key)}function k(e,t){t.forEach((function(t){if(t!==e.key){var n=q.get(t);void 0!==n&&(q.delete(t),O.reexecuteOperation(Ie(n,"cache-first")))}}))}function b(e,t){void 0!==t&&t.forEach((function(t){var n=E[t];if(void 0!==n){E[t]=[],t=0;for(var i=n.length;t<i;t++)e.add(n[t])}}))}function S(e){var t=e.operation,n=e.outcome,i=t.context.requestPolicy;return e={operation:Le(t,n),data:e.data,error:e.error,extensions:e.extensions},("cache-and-network"===i||"cache-first"===i&&"partial"===n)&&(e.stale=!0,O.reexecuteOperation(Ie(t,"network-only"))),e}var _=v.forward,O=v.client;d||(d={});var K=new xe(d.schema,d.resolvers,d.updates,d.optimistic,d.keys);if(d.storage)var w=d.storage,N=w.read().then((function(e){var t=K.data,n=w;for(var i in Z(t,null),e){var r=i.indexOf("."),o=i.slice(2,r);switch(r=i.slice(r+1),i.charCodeAt(0)){case 108:de(o,r,e[i]);break;case 114:fe(o,r,e[i])}}$(),t.storage=n}));var x=new Map,q=new Map,E=L();return function(d){d=e(d);var v=N?t(n)(i(1)(r(o(N))(d))):a;d=e(s(h)(u(Pe)(c([v,d]))));var m=e(u(y)(l(De)(d)));return v=u(je)(l(Ce)(m)),m=u(S)(l(Qe)(m)),d=u(p)(_(s(g)(l(Ge)(f([l(ze)(d),v]))))),f([d,m])}}}function et(e){var t=e.schema;return function(e){function n(e){"teardown"===e.operationName&&f.delete(e.key)}function i(e){var t=e.key,n=e.query;if("query"===e.operationName&&(f.add(t),!l.has(t))){l.add(t),n=(e=function(e,t){var n=[],i=[],r=new E(e);return K(t,w(r,{Field:function(e){if(e.selectionSet){var t=Je(r.getType());if(!t||q(t))throw e="Minfied Error #18\n",(e=Error(e+"\nhttps://github.com/FormidableLabs/urql/tree/master/exchanges/graphcache/help.md#18")).name="Graphcache Error",e;t=t.toString(),i.push({kind:y.FRAGMENT_DEFINITION,typeCondition:{kind:y.NAMED_TYPE,name:Xe(t)},name:Xe(t+"_PopulateFragment_"),selectionSet:e.selectionSet})}},FragmentDefinition:function(e){n.push(e)}})),[n,i]}(c,n))[0],e=e[1];for(var i=0,r=n.length;i<r;i++){var o=n[i];d[o.name.value]=o}for(n=0,i=e.length;n<i;n++)o=v[o=(r=e[n]).typeCondition.name.value]||(v[o]=[]),r.name.value+=o.length,o.push({key:t,fragment:r})}}function r(e){if("mutation"!==e.operationName)return e;var t,n=Object.create(null);for(t in v)n[t]=v[t].filter(o);return We({},e,{query:Ue(c,e.query,n,d)})}function o(e){return f.has(e.key)}var a=e.forward,c=O(t),l=new Set,f=new Set,d=Object.create(null),v=Object.create(null);return function(e){return a(u(r)(s(n)(s(i)(e))))}}}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=t[e];e:{t=this.context.variables;var n=e.directives;if(void 0!==n)for(var i=0,r=n.length;i<r;i++){var o=n[i],a=o.name.value,s="include"===a;if((s||"skip"===a)&&(o=o.arguments?o.arguments[0]:null)&&"if"===o.name.value&&("boolean"==typeof(o=m(o.value,t))||null===o)){t=s?!!o:!o;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=M(e),(n=this.typename)&&i?n===i?t=!0:(i=t.getType(i),n=t.getType(n),i instanceof b?t=i===n:(R(i instanceof S||i instanceof _,"",5),R(n instanceof b,"",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(A(e))));else if("__typename"!==e.name.value)return e}}},xe.prototype.getRootKey=function(e){return this.rootFields[e]},xe.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},xe.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var n=ce(e,t);return void 0!==n?n:(t=le(e,t))?t:null},xe.prototype.resolve=function(e,t,n){return this.resolveFieldByKey(e,W(t,n))},xe.prototype.invalidateQuery=function(e,t){!function e(t,n,i){if("Query"!==n){var r=ce(n,"__typename");if("string"!=typeof r)return;fe(n,"__typename",void 0)}else r=n;for(i=new he(r,n,i,t);void 0!==(r=i.next());){var o=W(r.name.value,P(r,t.variables));if(void 0===r.selectionSet)fe(n,o,void 0);else{r=A(r);var a=le(n,o);if(de(n,o,void 0),fe(n,o,void 0),Array.isArray(a)){o=0;for(var s=a.length;o<s;o++){var u=a[o];null!==u&&e(t,u,r)}}else a&&e(t,a,r)}}}(t={variables:B(e=j((t=v(e,t)).query),t.variables),fragments:Q(t.query),store:this},t.store.getRootKey("query"),A(e))},xe.prototype.invalidate=function(e){R(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];le(e,i.fieldKey)?de(e,i.fieldKey,void 0):fe(e,i.fieldKey,void 0)}},xe.prototype.inspectFields=function(e){if(null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)){var t=H.links,n=H.records,i=[],r=new Set;ue(e),ae(i,r,e,t),ae(i,r,e,n),e=i}else e=[];return e},xe.prototype.updateQuery=function(e,t){e=v(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&be(this,e,t)},xe.prototype.readQuery=function(e){return Ee(this,v(e.query,e.variables)).data},xe.prototype.readFragment=function(e,t,n){e=Q(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(F({},{__typename:r},t)):t)&&Ae({parentTypeName:r,parentKey:t,parentFieldKey:"",fieldName:"",variables:n||{},fragments:e,partial:!1,store:this},t,A(i),L())||null}return n},xe.prototype.writeFragment=function(e,t,n){_e(this,e,t,n)};export{xe as Store,$e as cacheExchange,$ as clearDataState,Z as initDataState,et as populateExchange,qe as query,Ee as read,ke as write,_e as writeFragment,Se 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 v,formatDocument as p}from"@urql/core";import{Kind as y,valueFromASTUntyped as m,isNullableType as h,isNonNullType as g,isListType as k,GraphQLObjectType as b,GraphQLInterfaceType as S,GraphQLUnionType as _,buildClientSchema as O,visit as K,visitWithTypeInfo as w,isWrappingType as N,isCompositeType as x,isAbstractType as E,TypeInfo as q}from"graphql";import{_ as F}from"./406259e3.esm.min.js";function T(e){return void 0!==e.alias?e.alias.value:e.name.value}function A(e){return void 0!==e.selectionSet?e.selectionSet.selections:[]}function M(e){return void 0!==(e=e.typeCondition)?e.name.value:null}function R(){return Object.create(null)}function D(e,t){if(void 0===e.arguments||0===e.arguments.length)return null;for(var n=R(),i=0,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 P(e,t){if(void 0===e.variableDefinitions)return{};var n=t||{};return e.variableDefinitions.reduce((function(e,t){var i=t.variable.name.value,r=n[i];if(void 0===r){if(void 0===t.defaultValue)return e;r=m(t.defaultValue,n)}return e[i]=r,e}),R())}function B(e,t,n){if(!e)throw(e=Error((t||"Minfied Error #"+n+"\n")+"\nhttps://bit.ly/38yWDau#"+n)).name="Graphcache Error",e}function I(e){return e.kind===y.FRAGMENT_DEFINITION}function L(e){return e.kind===y.OPERATION_DEFINITION}function j(e){return B(!!(e=e.definitions.find(L)),"",1),e}function C(e,t){return e[t.name.value]=t,e}function Q(e){return e.definitions.filter(I).reduce(C,{})}function G(e,t,n){return void 0!==(e=W(e,t,n))&&h(e.type)}function z(e,t,n){return void 0!==(e=W(e,t,n))&&(e=g(e.type)?e.type.ofType:e.type,k(e)&&h(e.ofType))}function W(e,t,n){if(B((e=e.getType(t))instanceof b,"",3),void 0!==(n=e.getFields()[n]))return n}function V(e,t){return t?e+"("+d(t)+")":e}function J(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 Y="undefined"!=typeof Promise?Promise.prototype.then.bind(Promise.resolve()):function(e){return setTimeout(e,0)},H=null,U=null,X=null;function Z(e,t,n){H=e,U=new Set,t?n||1<e.commutativeKeys.size&&e.commutativeKeys.has(t)?(X=t,-1===e.optimisticOrder.indexOf(t)&&e.optimisticOrder.unshift(t),e.refLock[t]||(e.refLock[t]=R(),e.links.optimistic[t]=new Map,e.records.optimistic[t]=new Map)):(X=null,ve(e,t)):X=null}function $(){var e,t,n=H,i=X;if(X=null,i&&n.commutativeKeys.has(i)){var r=n.optimisticOrder.length-n.commutativeKeys.size;if(n.optimisticOrder[n.optimisticOrder.length-1]===i){i=[];for(var o=n.optimisticOrder.length;r<o;r++){var a=n.optimisticOrder[r];if(!n.refLock[a])break;i.unshift(a)}for(o=0,r=i.length;o<r;o++)t=void 0,(t=H.links.optimistic[e=i[o]])&&t.forEach(pe),(t=H.records.optimistic[e])&&t.forEach(ye),ve(H,e)}}U=H=null,!n.gcScheduled&&0<n.gcBatch.size&&(n.gcScheduled=!0,Y((function(){se(n)}))),n.storage&&!n.persistenceScheduled&&(n.persistenceScheduled=!0,Y((function(){n.storage.write(n.persistenceBatch),n.persistenceScheduled=!1,n.persistenceBatch=R()})))}function ee(){return B(null!==U,"",2),U}function te(e,t,n,i){var r=(e=X?e.optimistic[X]:e.base).get(t);void 0===r&&e.set(t,r=R()),void 0!==i||X?r[n]=i:delete r[n]}function ne(e,t,n){for(var i,r=0,o=H.optimisticOrder.length;r<o;r++){var a=e.optimistic[H.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 ie(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 re(e,t,n,i){if("string"==typeof n)ie(e,t,n,i);else if(Array.isArray(n))for(var r=0,o=n.length;r<o;r++){var a=n[r];a&&ie(e,t,a,i)}}function oe(e,t,n){if(void 0!==n)for(var i in n)t.has(i)||(e.push(J(i)),t.add(i))}function ae(e,t,n,i){oe(e,t,i.base.get(n));for(var r=0,o=H.optimisticOrder.length;r<o;r++)oe(e,t,i.optimistic[H.optimisticOrder[r]].get(n))}function se(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),re(e.gcBatch,e.refCount,r[o],-1)}else e.gcBatch.delete(t)}))}function ue(e,t){"__typename"!==t&&(e!==H.queryRootKey?U.add(e):void 0!==t&&U.add(e+"."+t))}function ce(e,t){return ue(e,t),ne(H.records,e,t)}function le(e,t){return ue(e,t),ne(H.links,e,t)}function fe(e,t,n){ue(e,t),te(H.records,e,t,n),H.storage&&!X&&(H.persistenceBatch["r|"+e+"."+t]=n)}function de(e,t,n){var i=H;if(X)var r=i.refLock[X]||(i.refLock[X]=R()),o=i.links.optimistic[X];else{i.storage&&(i.persistenceBatch["l|"+e+"."+t]=n),r=i.refCount,o=i.links.base;var a=i.gcBatch}o=void 0!==(o=void 0!==o?o.get(e):void 0)?o[t]:null,ue(e,t),te(i.links,e,t,n),re(a,r,o,-1),re(a,r,n,1)}function ve(e,t){var n=e.optimisticOrder.indexOf(t);-1<n&&(e.optimisticOrder.splice(n,1),e.commutativeKeys.delete(t)),e.refLock[t]&&(delete e.refLock[t],delete e.records.optimistic[t],delete e.links.optimistic[t])}function pe(e,t){for(var n in e)de(t,n,e[n])}function ye(e,t){for(var n in e)fe(t,n,e[n])}function me(e,t,n,i){return!(!t||t!==M(e)&&A(e).some((function(e){return e.kind===y.FIELD&&(e=V(e.name.value,D(e,i)),!(void 0!==ce(n,e)||void 0!==le(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){return void 0===e?null:e}function ke(e,t,n,i){return Z(e.data,i||null),e=be(e,t,n),$(),e}function be(e,t,n){var i=j(t.query),r={dependencies:ee()},o=A(i),a=e.getRootKey(i.operation);return a===(e={parentTypeName:a,parentKey:a,parentFieldKey:"",fieldName:"",store:e,variables:P(i,t.variables),fragments:Q(t.query)}).store.getRootKey("query")?Oe(e,a,o,n):we(e,a,o,n),r}function Se(e,t,n){Z(e.data,n,!0);var i=j(t.query);n={dependencies:ee()};var r,o=e.getRootKey("mutation"),a=e.getRootKey(i.operation);for(B(a===o,"",10),e={parentTypeName:o,parentKey:o,parentFieldKey:"",fieldName:"",variables:P(i,t.variables),fragments:Q(t.query),store:e,optimistic:!0},t=R(),i=new he(a,a,A(i),e);void 0!==(r=i.next());)if(void 0!==r.selectionSet){var s=r.name.value,u=e.store.optimisticMutations[s];void 0!==u&&(e.fieldName=s,Ne(e,ge(u=u((a=D(r,e.variables))||R(),e.store,e)),A(r)),t[s]=u,void 0!==(r=e.store.updates[o][s])&&r(t,a||R(),e.store,e))}return $(),n}function _e(e,t,n,i){t=Q(t);var r=Object.keys(t);if(void 0!==(r=t[r[0]])){var o=r.typeCondition.name.value;n=F({},{__typename:o},n);var a=e.keyOfEntity(n);a&&Oe({parentTypeName:o,parentKey:a,parentFieldKey:"",fieldName:"",variables:i||{},fragments:t,store:e},a,A(r),n)}}function Oe(e,t,n,i){var r=t===e.store.getRootKey("query")?t:i.__typename;if("string"==typeof r)for(fe(t,"__typename",r),n=new he(r,t,n,e);void 0!==(r=n.next());){var o=r.name.value,a=D(r,e.variables);o=V(o,a);var s=i[T(r)];a=t+"."+o,void 0===r.selectionSet?fe(t,o,s):(s=ge(s),de(t,o,r=Ke(e,a,A(r),s)))}}function Ke(e,t,n,i){if(Array.isArray(i)){for(var r=Array(i.length),o=0,a=i.length;o<a;o++){var s=Ke(e,t+"."+o,n,i[o]);r[o]=s}return r}return null===i?null:(t=null!==(r=e.store.keyOfEntity(i))?r:t,o=i.__typename,void 0!==e.store.keys[i.__typename]||null!==r||"string"!=typeof o||o.endsWith("Connection")||o.endsWith("Edge"),Oe(e,t,n,i),t)}function we(e,t,n,i){var r,o=t===e.store.getRootKey("mutation")||t===e.store.getRootKey("subscription");for(n=new he(t,t,n,e);void 0!==(r=n.next());){var a=r.name.value,s=D(r,e.variables),u=V(a,s);u=t+"."+u,void 0!==r.selectionSet&&Ne(e,ge(i[T(r)]),A(r)),o&&(e.parentTypeName=t,e.parentKey=t,e.parentFieldKey=u,e.fieldName=a,void 0!==(r=e.store.updates[t][a])&&r(i,s||R(),e.store,e))}}function Ne(e,t,n){if(Array.isArray(t)){for(var i=Array(t.length),r=0,o=t.length;r<o;r++)i[r]=Ne(e,t[r],n);return i}null!==t&&(null!==(i=e.store.keyOfEntity(t))?Oe(e,i,n,t):we(e,t.__typename,n,t))}function xe(e,t,n,i,r){var o,a=this;this.gcScheduled=!1,this.gc=function(){se(a.data),a.gcScheduled=!1},this.keyOfField=V,this.resolvers=t||{},this.optimisticMutations=i||{},this.keys=r||{},this.updates={Mutation:n&&n.Mutation||{},Subscription:n&&n.Subscription||{}},e?(n=(t=this.schema=O(e)).getQueryType(),e=t.getMutationType(),t=t.getSubscriptionType(),this.rootFields={query:n=n?n.name:"Query",mutation:e=e?e.name:"Mutation",subscription:t=t?t.name:"Subscription"},this.rootNames=((o={})[n]="query",o[e]="mutation",o[t]="subscription",o)):(this.rootFields={query:"Query",mutation:"Mutation",subscription:"Subscription"},this.rootNames={Query:"query",Mutation:"mutation",Subscription:"subscription"}),this.data=function(e){return{persistenceScheduled:!1,persistenceBatch:R(),gcScheduled:!1,queryRootKey:e,gcBatch:new Set,refCount:R(),refLock:R(),links:{optimistic:R(),base:new Map},records:{optimistic:R(),base:new Map},commutativeKeys:new Set,optimisticOrder:[],storage:null}}(this.getRootKey("query"))}function Ee(e,t,n){return Z(e.data,null),e=qe(e,t,n),$(),e}function qe(e,t,n){var i=j(t.query),r=e.getRootKey(i.operation),o=A(i);return e={parentTypeName:r,parentKey:r,parentFieldKey:"",fieldName:"",store:e,variables:P(i,t.variables),fragments:Q(t.query),partial:!1},n=n||R(),n=r!==e.store.getRootKey("query")?Fe(e,r,o,n):Ae(e,r,o,n),{dependencies:ee(),partial:void 0!==n&&e.partial,data:void 0===n?null:n}}function Fe(e,t,n,i){if("string"!=typeof i.__typename)return i;t=new he(t,t,n,e),(n=R()).__typename=i.__typename;for(var r;void 0!==(r=t.next());){var o=T(r),a=i[o];void 0!==r.selectionSet&&null!==a?(a=ge(a),n[o]=Te(e,A(r),a)):n[o]=a}return n}function Te(e,t,n){if(Array.isArray(n)){for(var i=Array(n.length),r=0,o=n.length;r<o;r++)i[r]=Te(e,t,n[r]);return i}return null===n?null:null!==(i=e.store.keyOfEntity(n))?void 0===(e=Ae(e,i,t,R()))?null:e:Fe(e,n.__typename,t,n)}function Ae(e,t,n,i){var r=e.store,o=t===r.getRootKey("query"),a=o?t:ce(t,"__typename");if("string"==typeof a){i.__typename=a,n=new he(a,t,n,e);for(var s,u=!1,c=!1;void 0!==(s=n.next());){var l=s.name.value,f=D(s,e.variables),d=T(s),v=V(l,f),p=ce(t,v),y=t+"."+v,m=void 0,h=r.resolvers[a];if(void 0!==h&&"function"==typeof h[l]){if(e.parentTypeName=a,e.parentKey=t,e.parentFieldKey=y,e.fieldName=l,void 0!==p&&(i[d]=p),m=h[l](i,f||R(),r,e),void 0!==s.selectionSet&&(m=Me(e,a,l,y,A(s),i[d]||R(),m)),r.schema&&null===m&&!G(r.schema,a,l))return}else void 0===s.selectionSet?m=p:void 0!==(f=le(t,v))?m=Re(e,f,a,l,A(s),i[d]):"object"==typeof p&&null!==p&&(m=p);if(void 0===m&&r.schema&&G(r.schema,a,l))c=!0,i[d]=null;else{if(void 0===m)return;u=!0,i[d]=m}}return c&&(e.partial=!0),o&&c&&!u?void 0:i}}function Me(e,t,n,i,r,o,a){if(Array.isArray(a)){var s=e.store;s=!s.schema||z(s.schema,t,n);for(var u=Array(a.length),c=0,l=a.length;c<l;c++){var f=Me(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}if(null==a)return a;if("string"==typeof a||"object"==typeof a&&"string"==typeof a.__typename){if(t=void 0===o?R():o,"string"==typeof a)e=Ae(e,a,r,t);else e:if(i=(n=e.store).keyOfEntity(a)||i,s=a.__typename,"string"!=typeof(o=ce(i,"__typename")||s)||s&&o!==s)e=void 0;else{for(t.__typename=o,r=new he(o,i,r,e),c=u=!1;void 0!==(s=r.next());){l=s.name.value,f=T(s);var d=V(l,D(s,e.variables)),v=i+"."+d,p=ce(i,d),y=a[l],m=void 0;if(void 0!==y&&void 0===s.selectionSet?m=y:void 0===s.selectionSet?m=p:void 0!==y?m=Me(e,o,l,v,A(s),t[f],y):void 0!==(d=le(i,d))?m=Re(e,d,o,l,A(s),t[f]):"object"==typeof p&&null!==p&&(m=p),void 0===m&&void 0!==n.schema&&G(n.schema,o,l))c=!0,t[f]=null;else{if(void 0===m){e=void 0;break e}u=!0,t[f]=m}}c&&(e.partial=!0),e=u?t:void 0}return e}}function Re(e,t,n,i,r,o){if(Array.isArray(t)){var a=e.store;a=a.schema&&z(a.schema,n,i);for(var s=Array(t.length),u=0,c=t.length;u<c;u++){var l=Re(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:Ae(e,t,r,void 0===o?R():o)}function De(e,t){return F({},e,{context:F({},e.context,{meta:F({},e.context.meta,{cacheOutcome:t})})})}function Pe(e){return F({},e,{query:p(e.query)})}function Be(e){return"query"===e.operationName&&"network-only"!==e.context.requestPolicy}function Ie(e,t){return F({},e,{context:F({},e.context,{requestPolicy:t})})}function Le(e){return Be(e)}function je(e){return De(e.operation,e.outcome)}function Ce(e){return"miss"===e.outcome}function Qe(e){return"miss"!==e.outcome}function Ge(e){return"cache-only"!==e.context.requestPolicy}function ze(e){return!Be(e)}function We(e){for(var t=arguments,n=1;n<arguments.length;n++){var i,r=t[n];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}function Ve(){return(Ve=Object.assign||We).apply(this,arguments)}function Je(e){return N(e)?Je(e.ofType):e||null}function Ye(e){return"populate"!==e.name.value}function He(e,t){return"FragmentDefinition"===t.kind&&e.add(t.name.value),e}function Ue(e,t,n,i){function r(e,t){if(!(t=n[t.name]))return e;for(var r=0,o=t.length;r<o;r++){for(var c=t[r].fragment,l=c.name.value,f=Ze(c),d=0,v=f.length;d<v;d++){var p=f[d];u.has(p)||(a[p]=i[p])}s[l]=c,e.push({kind:y.FRAGMENT_SPREAD,name:Xe(l)})}return e}var o=new q(e),a=Object.create(null),s=Object.create(null),u=new Set;return K(t,w(o,{Field:{enter:function(t){if(t.directives){var n=t.directives.filter(Ye);if(n.length!==t.directives.length){var i=Je(o.getType());i=(i=x(i)?E(i)?e.getPossibleTypes(i):[i]:[]).reduce(r,[]);var a=void 0!==t.selectionSet?t.selectionSet.selections:[];return i=0!==a.length+i.length?i.concat(a):[{kind:y.FIELD,name:Xe("__typename")}],Ve({},t,{directives:n,selectionSet:{kind:y.SELECTION_SET,selections:i}})}}}},Document:{enter:function(e){e.definitions.reduce(He,u)},leave:function(e){var t,n=[].concat(e.definitions);for(t in s)n.push(s[t]);for(var i in a)n.push(a[i]);return Ve({},e,{definitions:n})}}}))}function Xe(e){return{kind:y.NAME,value:e}}function Ze(e){var t=[];return K(e,{FragmentSpread:function(e){t.push(e.name.value)}}),t}function $e(d){return function(v){function p(e){var t=e.operation,n=e.error,i=e.extensions,r="query"===t.operationName,o=e.data,a=t.key,s=new Set;if(r||(b(s,x.get(a)),x.delete(a),ve(K.data,a)),null!=o){var u=ke(K,t,o,a).dependencies;if(r){o=(a=Ee(K,t)).data;var c=a.dependencies}else o=Ee(K,t,o).data}return b(s,u),r&&b(s,c),k(e.operation,s),r&&void 0!==c&&m(e.operation,c),{data:o,error:n,extensions:i,operation:t}}function y(e){var t=Ee(K,e),n=t.data,i=t.dependencies;return t=t.partial,null===n?i="miss":(m(e,i),i=t&&"cache-only"!==e.context.requestPolicy?"partial":"hit"),{outcome:i,operation:e,data:n}}function m(e,t){t.forEach((function(t){(q[t]||(q[t]=[])).push(e.key),E.has(e.key)||E.set(e.key,"network-only"===e.context.requestPolicy?Ie(e,"cache-and-network"):e)}))}function h(e){if("mutation"===e.operationName&&"network-only"!==e.context.requestPolicy){var t=e.key,n=Se(K,e,t).dependencies;0!==n.size&&(x.set(t,n),b(t=new Set,n),k(e,t))}}function g(e){if("query"===e.operationName){var t=K.data;t.commutativeKeys.has(e=e.key)||(t.optimisticOrder.splice(t.optimisticOrder.length-t.commutativeKeys.size,0,e),t.commutativeKeys.add(e))}else"teardown"===e.operationName&&ve(K.data,e.key)}function k(e,t){t.forEach((function(t){if(t!==e.key){var n=E.get(t);void 0!==n&&(E.delete(t),O.reexecuteOperation(Ie(n,"cache-first")))}}))}function b(e,t){void 0!==t&&t.forEach((function(t){var n=q[t];if(void 0!==n){q[t]=[],t=0;for(var i=n.length;t<i;t++)e.add(n[t])}}))}function S(e){var t=e.operation,n=e.outcome,i=t.context.requestPolicy;return e={operation:De(t,n),data:e.data,error:e.error,extensions:e.extensions},("cache-and-network"===i||"cache-first"===i&&"partial"===n)&&(e.stale=!0,O.reexecuteOperation(Ie(t,"network-only"))),e}var _=v.forward,O=v.client;d||(d={});var K=new xe(d.schema,d.resolvers,d.updates,d.optimistic,d.keys);if(d.storage)var w=d.storage,N=w.read().then((function(e){var t=K.data,n=w;for(var i in Z(t,null),e){var r=i.indexOf("."),o=i.slice(2,r);switch(r=i.slice(r+1),i.charCodeAt(0)){case 108:de(o,r,e[i]);break;case 114:fe(o,r,e[i])}}$(),t.storage=n}));var x=new Map,E=new Map,q=R();return function(d){d=e(d);var v=N?t(n)(i(1)(r(o(N))(d))):a;d=e(s(h)(u(Pe)(c([v,d]))));var m=e(u(y)(l(Le)(d)));return v=u(je)(l(Ce)(m)),m=u(S)(l(Qe)(m)),d=u(p)(_(s(g)(l(Ge)(f([l(ze)(d),v]))))),f([d,m])}}}function et(e){var t=e.schema;return function(e){function n(e){"teardown"===e.operationName&&f.delete(e.key)}function i(e){var t=e.key,n=e.query;if("query"===e.operationName&&(f.add(t),!l.has(t))){l.add(t),n=(e=function(e,t){var n=[],i=[],r=new q(e);return K(t,w(r,{Field:function(e){if(e.selectionSet){var t=Je(r.getType());if(!t||E(t))throw(e=Error("Minfied Error #18\n\nhttps://bit.ly/38yWDau#18")).name="Graphcache Error",e;t=t.toString(),i.push({kind:y.FRAGMENT_DEFINITION,typeCondition:{kind:y.NAMED_TYPE,name:Xe(t)},name:Xe(t+"_PopulateFragment_"),selectionSet:e.selectionSet})}},FragmentDefinition:function(e){n.push(e)}})),[n,i]}(c,n))[0],e=e[1];for(var i=0,r=n.length;i<r;i++){var o=n[i];d[o.name.value]=o}for(n=0,i=e.length;n<i;n++)o=v[o=(r=e[n]).typeCondition.name.value]||(v[o]=[]),r.name.value+=o.length,o.push({key:t,fragment:r})}}function r(e){if("mutation"!==e.operationName)return e;var t,n=Object.create(null);for(t in v)n[t]=v[t].filter(o);return Ve({},e,{query:Ue(c,e.query,n,d)})}function o(e){return f.has(e.key)}var a=e.forward,c=O(t),l=new Set,f=new Set,d=Object.create(null),v=Object.create(null);return function(e){return a(u(r)(s(n)(s(i)(e))))}}}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=t[e];e:{t=this.context.variables;var n=e.directives;if(void 0!==n)for(var i=0,r=n.length;i<r;i++){var o=n[i],a=o.name.value,s="include"===a;if((s||"skip"===a)&&(o=o.arguments?o.arguments[0]:null)&&"if"===o.name.value&&("boolean"==typeof(o=m(o.value,t))||null===o)){t=s?!!o:!o;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=M(e),(n=this.typename)&&i?n===i?t=!0:(i=t.getType(i),n=t.getType(n),i instanceof b?t=i===n:(B(i instanceof S||i instanceof _,"",5),B(n instanceof b,"",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(A(e))));else if("__typename"!==e.name.value)return e}}},xe.prototype.getRootKey=function(e){return this.rootFields[e]},xe.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},xe.prototype.resolveFieldByKey=function(e,t){if(null===(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e))return null;var n=ce(e,t);return void 0!==n?n:(t=le(e,t))?t:null},xe.prototype.resolve=function(e,t,n){return this.resolveFieldByKey(e,V(t,n))},xe.prototype.invalidateQuery=function(e,t){!function e(t,n,i){if("Query"!==n){var r=ce(n,"__typename");if("string"!=typeof r)return;fe(n,"__typename",void 0)}else r=n;for(i=new he(r,n,i,t);void 0!==(r=i.next());){var o=V(r.name.value,D(r,t.variables));if(void 0===r.selectionSet)fe(n,o,void 0);else{r=A(r);var a=le(n,o);if(de(n,o,void 0),fe(n,o,void 0),Array.isArray(a)){o=0;for(var s=a.length;o<s;o++){var u=a[o];null!==u&&e(t,u,r)}}else a&&e(t,a,r)}}}(t={variables:P(e=j((t=v(e,t)).query),t.variables),fragments:Q(t.query),store:this},t.store.getRootKey("query"),A(e))},xe.prototype.invalidate=function(e){B(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];le(e,i.fieldKey)?de(e,i.fieldKey,void 0):fe(e,i.fieldKey,void 0)}},xe.prototype.inspectFields=function(e){if(null!==(e=null!==e&&"string"!=typeof e?this.keyOfEntity(e):e)){var t=H.links,n=H.records,i=[],r=new Set;ue(e),ae(i,r,e,t),ae(i,r,e,n),e=i}else e=[];return e},xe.prototype.updateQuery=function(e,t){e=v(e.query,e.variables),null!==(t=t(this.readQuery(e)))&&be(this,e,t)},xe.prototype.readQuery=function(e){return qe(this,v(e.query,e.variables)).data},xe.prototype.readFragment=function(e,t,n){e=Q(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(F({},{__typename:r},t)):t)&&Ae({parentTypeName:r,parentKey:t,parentFieldKey:"",fieldName:"",variables:n||{},fragments:e,partial:!1,store:this},t,A(i),R())||null}return n},xe.prototype.writeFragment=function(e,t,n){_e(this,e,t,n)};export{xe as Store,$e as cacheExchange,$ as clearDataState,Z as initDataState,et as populateExchange,Ee as query,qe as read,ke as write,_e as writeFragment,Se as writeOptimistic};
//# sourceMappingURL=urql-exchange-graphcache.esm.min.js.map

@@ -9,5 +9,5 @@ {

"dependencies": {
"@urql/core": ">=1.9.1",
"@urql/core": ">=1.9.2",
"wonka": "^3.2.1 || ^4.0.0"
}
}
{
"name": "@urql/exchange-graphcache",
"version": "2.2.0",
"version": "2.2.1",
"description": "A normalized and configurable cache exchange for urql",

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

"wonka": "^3.2.1 || ^4.0.0",
"@urql/core": ">=1.9.1"
"@urql/core": ">=1.9.2"
},

@@ -64,0 +64,0 @@ "peerDependencies": {

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