@apollo/client 3.3.10 → 3.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/apollo-client.cjs.js +39 -30
  2. package/apollo-client.cjs.js.map +1 -1
  3. package/apollo-client.cjs.min.js +1 -1
  4. package/cache/cache.cjs.js +4 -1
  5. package/cache/cache.cjs.js.map +1 -1
  6. package/cache/inmemory/policies.d.ts +2 -2
  7. package/cache/inmemory/policies.d.ts.map +1 -1
  8. package/cache/inmemory/policies.js +4 -1
  9. package/cache/inmemory/policies.js.map +1 -1
  10. package/cache/inmemory/writeToStore.js.map +1 -1
  11. package/core/QueryInfo.d.ts.map +1 -1
  12. package/core/QueryInfo.js +1 -0
  13. package/core/QueryInfo.js.map +1 -1
  14. package/core/QueryManager.d.ts.map +1 -1
  15. package/core/QueryManager.js +1 -0
  16. package/core/QueryManager.js.map +1 -1
  17. package/core/core.cjs.js +3 -1
  18. package/core/core.cjs.js.map +1 -1
  19. package/invariantErrorCodes.js +1 -1
  20. package/link/http/createHttpLink.d.ts.map +1 -1
  21. package/link/http/createHttpLink.js +1 -1
  22. package/link/http/createHttpLink.js.map +1 -1
  23. package/link/http/http.cjs.js +1 -2
  24. package/link/http/http.cjs.js.map +1 -1
  25. package/package.json +17 -17
  26. package/react/data/SubscriptionData.d.ts.map +1 -1
  27. package/react/data/SubscriptionData.js +9 -5
  28. package/react/data/SubscriptionData.js.map +1 -1
  29. package/react/data/data.cjs.js +9 -5
  30. package/react/data/data.cjs.js.map +1 -1
  31. package/react/hooks/hooks.cjs.js +11 -18
  32. package/react/hooks/hooks.cjs.js.map +1 -1
  33. package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
  34. package/react/hooks/utils/useBaseQuery.js +11 -18
  35. package/react/hooks/utils/useBaseQuery.js.map +1 -1
  36. package/react/ssr/RenderPromises.d.ts +1 -0
  37. package/react/ssr/RenderPromises.d.ts.map +1 -1
  38. package/react/ssr/RenderPromises.js +4 -0
  39. package/react/ssr/RenderPromises.js.map +1 -1
  40. package/react/ssr/getDataFromTree.d.ts.map +1 -1
  41. package/react/ssr/getDataFromTree.js +2 -0
  42. package/react/ssr/getDataFromTree.js.map +1 -1
  43. package/react/ssr/ssr.cjs.js +6 -0
  44. package/react/ssr/ssr.cjs.js.map +1 -1
  45. package/react/types/types.d.ts +1 -0
  46. package/react/types/types.d.ts.map +1 -1
  47. package/react/types/types.js.map +1 -1
  48. package/testing/testing.cjs.js +14 -6
  49. package/testing/testing.cjs.js.map +1 -1
  50. package/utilities/observables/Observable.d.ts +0 -5
  51. package/utilities/observables/Observable.d.ts.map +1 -1
  52. package/utilities/observables/Observable.js +5 -1
  53. package/utilities/observables/Observable.js.map +1 -1
  54. package/utilities/observables/asyncMap.d.ts.map +1 -1
  55. package/utilities/observables/asyncMap.js +11 -3
  56. package/utilities/observables/asyncMap.js.map +1 -1
  57. package/utilities/testing/mocking/MockedProvider.d.ts +1 -1
  58. package/utilities/testing/mocking/MockedProvider.d.ts.map +1 -1
  59. package/utilities/testing/mocking/MockedProvider.js +1 -1
  60. package/utilities/testing/mocking/MockedProvider.js.map +1 -1
  61. package/utilities/testing/mocking/mockSubscriptionLink.js +2 -2
  62. package/utilities/testing/mocking/mockSubscriptionLink.js.map +1 -1
  63. package/utilities/utilities.cjs.js +11 -3
  64. package/utilities/utilities.cjs.js.map +1 -1
  65. package/version.js +1 -1
@@ -1 +1 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("ts-invariant"),n=require("graphql"),i=e(require("fast-json-stable-stringify")),o=e(require("zen-observable"));require("symbol-observable");var s=require("graphql/language/visitor"),a=require("@wry/equality"),u=require("optimism"),c=require("@wry/context"),l=e(require("graphql-tag")),p=require("react"),f=e(p);function h(e,t){var n=e.directives;return!n||!n.length||function(e){var t=[];e&&e.length&&e.forEach((function(e){if(function(e){var t=e.name.value;return"skip"===t||"include"===t}(e)){var n=e.arguments;e.name.value;r.invariant(n&&1===n.length,39);var i=n[0];r.invariant(i.name&&"if"===i.name.value,40);var o=i.value;r.invariant(o&&("Variable"===o.kind||"BooleanValue"===o.kind),41),t.push({directive:e,ifArgument:i})}}));return t}(n).every((function(e){var n=e.directive,i=e.ifArgument,o=!1;return"Variable"===i.value.kind?(o=t&&t[i.value.name.value],r.invariant(void 0!==o,38)):o=i.value.value,"skip"===n.name.value?!o:o}))}function d(e,t){return function(e){var t=[];return n.visit(e,{Directive:function(e){t.push(e.name.value)}}),t}(t).some((function(t){return e.indexOf(t)>-1}))}function v(e){return e&&d(["client"],e)&&d(["export"],e)}function y(e,n){var i=n,o=[];return e.definitions.forEach((function(e){if("OperationDefinition"===e.kind)throw new r.InvariantError(42);"FragmentDefinition"===e.kind&&o.push(e)})),void 0===i&&(r.invariant(1===o.length,43),i=o[0].name.value),t.__assign(t.__assign({},e),{definitions:t.__spreadArrays([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}],e.definitions)})}function b(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function g(e,t){switch(e.kind){case"InlineFragment":return e;case"FragmentSpread":var n=t&&t[e.name.value];return r.invariant(n,44),n;default:return null}}function m(e){return{__ref:String(e)}}function _(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function S(e,t,n,i){if(function(e){return"IntValue"===e.kind}(n)||function(e){return"FloatValue"===e.kind}(n))e[t.value]=Number(n.value);else if(function(e){return"BooleanValue"===e.kind}(n)||function(e){return"StringValue"===e.kind}(n))e[t.value]=n.value;else if(function(e){return"ObjectValue"===e.kind}(n)){var o={};n.fields.map((function(e){return S(o,e.name,e.value,i)})),e[t.value]=o}else if(function(e){return"Variable"===e.kind}(n)){var s=(i||{})[n.name.value];e[t.value]=s}else if(function(e){return"ListValue"===e.kind}(n))e[t.value]=n.values.map((function(e){var r={};return S(r,t,e,i),r[t.value]}));else if(function(e){return"EnumValue"===e.kind}(n))e[t.value]=n.value;else{if(!function(e){return"NullValue"===e.kind}(n))throw new r.InvariantError(53);e[t.value]=null}}var O=["connection","include","skip","client","rest","export"];function w(e,t,r){if(t&&r&&r.connection&&r.connection.key){if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var o={};return n.forEach((function(e){o[e]=t[e]})),r.connection.key+"("+JSON.stringify(o)+")"}return r.connection.key}var s=e;if(t){var a=i(t);s+="("+a+")"}return r&&Object.keys(r).forEach((function(e){-1===O.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?s+="@"+e+"("+JSON.stringify(r[e])+")":s+="@"+e)})),s}function x(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return S(r,n,i,t)})),r}return null}function k(e){return e.alias?e.alias.value:e.name.value}function E(e,t,r){if("string"==typeof e.__typename)return e.__typename;for(var n=0,i=t.selections;n<i.length;n++){var o=i[n];if(q(o)){if("__typename"===o.name.value)return e[k(o)]}else{var s=E(e,g(o,r).selectionSet,r);if("string"==typeof s)return s}}}function q(e){return"Field"===e.kind}function R(e){return"InlineFragment"===e.kind}function Q(e){r.invariant(e&&"Document"===e.kind,45);var t=e.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(e){if("OperationDefinition"!==e.kind)throw new r.InvariantError(46);return e}));return r.invariant(t.length<=1,47),e}function M(e){return Q(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function I(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||null}function P(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function F(e){var t;Q(e);for(var n=0,i=e.definitions;n<i.length;n++){var o=i[n];if("OperationDefinition"===o.kind){var s=o.operation;if("query"===s||"mutation"===s||"subscription"===s)return o}"FragmentDefinition"!==o.kind||t||(t=o)}if(t)return t;throw new r.InvariantError(52)}function C(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&S(t,e.variable.name,e.defaultValue)})),t}function T(e,t,r){var n=0;return e.forEach((function(r,i){t.call(this,r,i,e)&&(e[n++]=r)}),r),e.length=n,e}var D={kind:"Field",name:{kind:"Name",value:"__typename"}};function j(e){return function e(t,r){return t.selectionSet.selections.every((function(t){return"FragmentSpread"===t.kind&&e(r[t.name.value],r)}))}(M(e)||function(e){r.invariant("Document"===e.kind,49),r.invariant(e.definitions.length<=1,50);var t=e.definitions[0];return r.invariant("FragmentDefinition"===t.kind,51),t}(e),b(P(e)))?null:e}function N(e){return function(t){return e.some((function(e){return e.name&&e.name===t.name.value||e.test&&e.test(t)}))}}function A(e,r){var i=Object.create(null),o=[],s=Object.create(null),a=[],u=j(n.visit(r,{Variable:{enter:function(e,t,r){"VariableDefinition"!==r.kind&&(i[e.name.value]=!0)}},Field:{enter:function(t){if(e&&t.directives&&(e.some((function(e){return e.remove}))&&t.directives&&t.directives.some(N(e))))return t.arguments&&t.arguments.forEach((function(e){"Variable"===e.value.kind&&o.push({name:e.value.name.value})})),t.selectionSet&&function e(t){var r=[];return t.selections.forEach((function(t){(q(t)||R(t))&&t.selectionSet?e(t.selectionSet).forEach((function(e){return r.push(e)})):"FragmentSpread"===t.kind&&r.push(t)})),r}(t.selectionSet).forEach((function(e){a.push({name:e.name.value})})),null}},FragmentSpread:{enter:function(e){s[e.name.value]=!0}},Directive:{enter:function(t){if(N(e)(t))return null}}}));return u&&T(o,(function(e){return!!e.name&&!i[e.name]})).length&&(u=function(e,r){var i=function(e){return function(t){return e.some((function(e){return t.value&&"Variable"===t.value.kind&&t.value.name&&(e.name===t.value.name.value||e.test&&e.test(t))}))}}(e);return j(n.visit(r,{OperationDefinition:{enter:function(r){return t.__assign(t.__assign({},r),{variableDefinitions:r.variableDefinitions?r.variableDefinitions.filter((function(t){return!e.some((function(e){return e.name===t.variable.name.value}))})):[]})}},Field:{enter:function(t){if(e.some((function(e){return e.remove}))){var r=0;if(t.arguments&&t.arguments.forEach((function(e){i(e)&&(r+=1)})),1===r)return null}}},Argument:{enter:function(e){if(i(e))return null}}}))}(o,u)),u&&T(a,(function(e){return!!e.name&&!s[e.name]})).length&&(u=function(e,t){function r(t){if(e.some((function(e){return e.name===t.name.value})))return null}return j(n.visit(t,{FragmentSpread:{enter:r},FragmentDefinition:{enter:r}}))}(a,u)),u}function L(e){return n.visit(Q(e),{SelectionSet:{enter:function(e,r,n){if(!n||"OperationDefinition"!==n.kind){var i=e.selections;if(i)if(!i.some((function(e){return q(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var o=n;if(!(q(o)&&o.directives&&o.directives.some((function(e){return"export"===e.name.value}))))return t.__assign(t.__assign({},e),{selections:t.__spreadArrays(i,[D])})}}}}})}L.added=function(e){return e===D};var V={test:function(e){var t="connection"===e.name.value;return t&&(!e.arguments||e.arguments.some((function(e){return"key"===e.name.value}))),t}};function z(e){return"query"===F(e).operation?e:n.visit(e,{OperationDefinition:{enter:function(e){return t.__assign(t.__assign({},e),{operation:"query"})}}})}var B=Object.prototype.hasOwnProperty;function W(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return U(e)}function U(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new G,i=1;i<r;++i)t=n.merge(t,e[i]);return t}function K(e){return null!==e&&"object"==typeof e}var J=function(e,t,r){return this.merge(e[r],t[r])},G=function(){function e(e){void 0===e&&(e=J),this.reconciler=e,this.isObject=K,this.pastCopies=new Set}return e.prototype.merge=function(e,r){for(var n=this,i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];return K(r)&&K(e)?(Object.keys(r).forEach((function(o){if(B.call(e,o)){var s=e[o];if(r[o]!==s){var a=n.reconciler.apply(n,t.__spreadArrays([e,r,o],i));a!==s&&((e=n.shallowCopyForMerge(e))[o]=a)}}else(e=n.shallowCopyForMerge(e))[o]=r[o]})),e):r},e.prototype.shallowCopyForMerge=function(e){return K(e)&&!this.pastCopies.has(e)&&(e=Array.isArray(e)?e.slice(0):t.__assign({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e)),e},e}(),H=Object.prototype.toString;function Y(e){return function e(t,r){switch(H.call(t)){case"[object Array]":if((r=r||new Map).has(t))return r.get(t);var n=t.slice(0);return r.set(t,n),n.forEach((function(t,i){n[i]=e(t,r)})),n;case"[object Object]":if((r=r||new Map).has(t))return r.get(t);var i=Object.create(Object.getPrototypeOf(t));return r.set(t,i),Object.keys(t).forEach((function(n){i[n]=e(t[n],r)})),i;default:return t}}(e)}function $(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function X(e,t,r){return new o((function(n){var i=n.next,o=n.error,s=n.complete,a=0,u=!1;function c(e,t){return e?function(t){++a,new Promise((function(r){return r(e(t))})).then((function(e){--a,i&&i.call(n,e),u&&l.complete()}),(function(e){--a,o&&o.call(n,e)}))}:function(e){return t&&t.call(n,e)}}var l={next:c(t,i),error:c(r,o),complete:function(){u=!0,a||s&&s.call(n)}},p=e.subscribe(l);return function(){return p.unsubscribe()}}))}function Z(e){function t(t){Object.defineProperty(e,t,{value:o})}return"function"==typeof Symbol&&Symbol.species&&t(Symbol.species),t("@@species"),e}function ee(e){return e&&"function"==typeof e.then}var te=function(e){function r(t){var r=e.call(this,(function(e){return r.addObserver(e),function(){return r.removeObserver(e)}}))||this;return r.observers=new Set,r.addCount=0,r.promise=new Promise((function(e,t){r.resolve=e,r.reject=t})),r.handlers={next:function(e){null!==r.sub&&(r.latest=["next",e],$(r.observers,"next",e))},error:function(e){var t=r.sub;null!==t&&(t&&Promise.resolve().then((function(){return t.unsubscribe()})),r.sub=null,r.latest=["error",e],r.reject(e),$(r.observers,"error",e))},complete:function(){if(null!==r.sub){var e=r.sources.shift();e?ee(e)?e.then((function(e){return r.sub=e.subscribe(r.handlers)})):r.sub=e.subscribe(r.handlers):(r.sub=null,r.latest&&"next"===r.latest[0]?r.resolve(r.latest[1]):r.resolve(),$(r.observers,"complete"))}}},r.cancel=function(e){r.reject(e),r.sources=[],r.handlers.complete()},r.promise.catch((function(e){})),"function"==typeof t&&(t=[new o(t)]),ee(t)?t.then((function(e){return r.start(e)}),r.handlers.error):r.start(t),r}return t.__extends(r,e),r.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},r.prototype.deliverLastMessage=function(e){if(this.latest){var t=this.latest[0],r=e[t];r&&r.call(e,this.latest[1]),null===this.sub&&"next"===t&&e.complete&&e.complete()}},r.prototype.addObserver=function(e){this.observers.has(e)||(this.deliverLastMessage(e),this.observers.add(e),++this.addCount)},r.prototype.removeObserver=function(e,t){this.observers.delete(e)&&--this.addCount<1&&!t&&this.handlers.error(new Error("Observable cancelled prematurely"))},r.prototype.cleanup=function(e){var t=this,r=!1,n=function(){r||(r=!0,t.observers.delete(i),e())},i={next:n,error:n,complete:n},o=this.addCount;this.addObserver(i),this.addCount=o},r}(o);function re(e){return Array.isArray(e)&&e.length>0}function ne(e){return e.errors&&e.errors.length>0||!1}Z(te);var ie="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product);function oe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Object.create(null);return e.forEach((function(e){e&&Object.keys(e).forEach((function(t){var n=e[t];void 0!==n&&(r[t]=n)}))})),r}function se(e){return new o((function(t){t.error(e)}))}var ae=function(e,t,r){var n=new Error(r);throw n.name="ServerError",n.response=e,n.statusCode=e.status,n.result=t,n};function ue(e,t){return t?t(e):o.of()}function ce(e){return"function"==typeof e?new pe(e):e}function le(e){return e.request.length<=1}!function(e){function r(t,r){var n=e.call(this,t)||this;return n.link=r,n}t.__extends(r,e)}(Error);var pe=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e((function(){return o.of()}))},e.from=function(t){return 0===t.length?e.empty():t.map(ce).reduce((function(e,t){return e.concat(t)}))},e.split=function(t,r,n){var i=ce(r),s=ce(n||new e(ue));return le(i)&&le(s)?new e((function(e){return t(e)?i.request(e)||o.of():s.request(e)||o.of()})):new e((function(e,r){return t(e)?i.request(e,r)||o.of():s.request(e,r)||o.of()}))},e.execute=function(e,n){return e.request(function(e,r){var n=t.__assign({},e);return Object.defineProperty(r,"setContext",{enumerable:!1,value:function(e){n="function"==typeof e?t.__assign(t.__assign({},n),e(n)):t.__assign(t.__assign({},n),e)}}),Object.defineProperty(r,"getContext",{enumerable:!1,value:function(){return t.__assign({},n)}}),r}(n.context,function(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?I(t.query)||void 0:""),t}(function(e){for(var t=["query","operationName","variables","extensions","context"],n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];if(t.indexOf(o)<0)throw new r.InvariantError(26)}return e}(n))))||o.of()},e.concat=function(t,r){var n=ce(t);if(le(n))return n;var i=ce(r);return le(i)?new e((function(e){return n.request(e,(function(e){return i.request(e)||o.of()}))||o.of()})):new e((function(e,t){return n.request(e,(function(e){return i.request(e,t)||o.of()}))||o.of()}))},e.prototype.split=function(t,r,n){return this.concat(e.split(t,r,n||new e(ue)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw new r.InvariantError(21)},e.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},e.prototype.setOnError=function(e){return this.onError=e,this},e}(),fe=pe.empty,he=pe.from,de=pe.split,ve=pe.concat,ye=pe.execute,be=Object.prototype.hasOwnProperty;function ge(e){return function(t){return t.text().then((function(e){try{return JSON.parse(e)}catch(n){var r=n;throw r.name="ServerParseError",r.response=t,r.statusCode=t.status,r.bodyText=e,r}})).then((function(r){return t.status>=300&&ae(t,r,"Response not successful: Received status code "+t.status),Array.isArray(r)||be.call(r,"data")||be.call(r,"errors")||ae(t,r,"Server response was missing for query '"+(Array.isArray(e)?e.map((function(e){return e.operationName})):e.operationName)+"'."),r}))}}var me=function(e,t){var n;try{n=JSON.stringify(e)}catch(e){var i=new r.InvariantError(23);throw i.parseError=e,i}return n},_e={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},Se=function(e,r){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];var s=t.__assign(t.__assign({},r.options),{headers:r.headers,credentials:r.credentials}),a=r.http||{};i.forEach((function(e){s=t.__assign(t.__assign(t.__assign({},s),e.options),{headers:t.__assign(t.__assign({},s.headers),e.headers)}),e.credentials&&(s.credentials=e.credentials),a=t.__assign(t.__assign({},a),e.http)}));var u=e.operationName,c=e.extensions,l=e.variables,p=e.query,f={operationName:u,variables:l};return a.includeExtensions&&(f.extensions=c),a.includeQuery&&(f.query=n.print(p)),{options:s,body:f}},Oe=function(e){if(!e&&"undefined"==typeof fetch)throw new r.InvariantError(22)},we=function(){if("undefined"==typeof AbortController)return{controller:!1,signal:!1};var e=new AbortController;return{controller:e,signal:e.signal}},xe=function(e,t){var r=e.getContext().uri;return r||("function"==typeof t?t(e):t||"/graphql")};function ke(e,t){var r=[],n=function(e,t){r.push(e+"="+encodeURIComponent(t))};if("query"in t&&n("query",t.query),t.operationName&&n("operationName",t.operationName),t.variables){var i=void 0;try{i=me(t.variables)}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=me(t.extensions)}catch(e){return{parseError:e}}n("extensions",o)}var s="",a=e,u=e.indexOf("#");-1!==u&&(s=e.substr(u),a=e.substr(0,u));var c=-1===a.indexOf("?")?"?":"&";return{newURI:a+c+r.join("&")+s}}var Ee=function(e){void 0===e&&(e={});var r=e.uri,n=void 0===r?"/graphql":r,i=e.fetch,a=e.includeExtensions,u=e.useGETForQueries,c=e.includeUnusedVariables,l=void 0!==c&&c,p=t.__rest(e,["uri","fetch","includeExtensions","useGETForQueries","includeUnusedVariables"]);Oe(i),i||(i=fetch);var f={http:{includeExtensions:a},options:p.fetchOptions,credentials:p.credentials,headers:p.headers};return new pe((function(e){var r=xe(e,n),a=e.getContext(),c={};if(a.clientAwareness){var p=a.clientAwareness,h=p.name,d=p.version;h&&(c["apollographql-client-name"]=h),d&&(c["apollographql-client-version"]=d)}var v,y=t.__assign(t.__assign({},c),a.headers),b={http:a.http,options:a.fetchOptions,credentials:a.credentials,headers:y},g=Se(e,_e,f,b),m=g.options,_=g.body;if(_.variables&&!l){var S=new Set(Object.keys(_.variables));s.visit(e.query,{Variable:function(e,t,r){r&&"VariableDefinition"!==r.kind&&S.delete(e.name.value)}}),S.size&&(_.variables=t.__assign({},_.variables),S.forEach((function(e){delete _.variables[e]})))}if(!m.signal){var O=we(),w=O.controller,x=O.signal;(v=w)&&(m.signal=x)}if(u&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(m.method="GET"),"GET"===m.method){var k=ke(r,_),E=k.newURI,q=k.parseError;if(q)return se(q);r=E}else try{m.body=me(_)}catch(q){return se(q)}return new o((function(t){return i(r,m).then((function(t){return e.setContext({response:t}),t})).then(ge(e)).then((function(e){return t.next(e),t.complete(),e})).catch((function(e){"AbortError"!==e.name&&(e.result&&e.result.errors&&e.result.data&&t.next(e.result),t.error(e))})),function(){v&&v.abort()}}))}))},qe=function(e){function r(t){void 0===t&&(t={});var r=e.call(this,Ee(t).request)||this;return r.options=t,r}return t.__extends(r,e),r}(pe);function Re(e){return e.hasOwnProperty("graphQLErrors")}var Qe,Me=function(e){function r(t){var n,i,o=t.graphQLErrors,s=t.networkError,a=t.errorMessage,u=t.extraInfo,c=e.call(this,a)||this;return c.graphQLErrors=o||[],c.networkError=s||null,c.message=a||(i="",re((n=c).graphQLErrors)&&n.graphQLErrors.forEach((function(e){var t=e?e.message:"Error message not found.";i+=t+"\n"})),n.networkError&&(i+=n.networkError.message+"\n"),i=i.replace(/\n$/,"")),c.extraInfo=u,c.__proto__=r.prototype,c}return t.__extends(r,e),r}(Error);function Ie(e){return!!e&&e<7}(Qe=exports.NetworkStatus||(exports.NetworkStatus={}))[Qe.loading=1]="loading",Qe[Qe.setVariables=2]="setVariables",Qe[Qe.fetchMore=3]="fetchMore",Qe[Qe.refetch=4]="refetch",Qe[Qe.poll=6]="poll",Qe[Qe.ready=7]="ready",Qe[Qe.error=8]="error";var Pe=function(){function e(e,t,r,n){this.observer=e,this.options=t,this.fetch=r,this.shouldFetch=n}return e.prototype.reobserve=function(e,t){e?this.updateOptions(e):this.updatePolling();var r=this.fetch(this.options,t);return this.concast&&this.concast.removeObserver(this.observer,!0),r.addObserver(this.observer),(this.concast=r).promise},e.prototype.updateOptions=function(e){return Object.assign(this.options,oe(e)),this.updatePolling(),this},e.prototype.stop=function(){this.concast&&(this.concast.removeObserver(this.observer),delete this.concast),this.pollingInfo&&(clearTimeout(this.pollingInfo.timeout),this.options.pollInterval=0,this.updatePolling())},e.prototype.updatePolling=function(){var e=this,t=this.pollingInfo,n=this.options.pollInterval;if(n){if((!t||t.interval!==n)&&(r.invariant(n,20),!1!==this.shouldFetch)){(t||(this.pollingInfo={})).interval=n;var i=function(){e.pollingInfo&&(e.shouldFetch&&e.shouldFetch()?e.reobserve({fetchPolicy:"network-only",nextFetchPolicy:e.options.fetchPolicy||"cache-first"},exports.NetworkStatus.poll).then(o,o):o())},o=function(){var t=e.pollingInfo;t&&(clearTimeout(t.timeout),t.timeout=setTimeout(i,t.interval))};o()}}else t&&(clearTimeout(t.timeout),delete this.pollingInfo)},e}(),Fe=function(e){function r(r){var n=r.queryManager,i=r.queryInfo,o=r.options,s=e.call(this,(function(e){return s.onSubscribe(e)}))||this;s.observers=new Set,s.subscriptions=new Set,s.observer={next:function(e){(s.lastError||s.isDifferentFromLastResult(e))&&(s.updateLastResult(e),$(s.observers,"next",e))},error:function(e){s.updateLastResult(t.__assign(t.__assign({},s.lastResult),{error:e,errors:e.graphQLErrors,networkStatus:exports.NetworkStatus.error,loading:!1})),$(s.observers,"error",s.lastError=e)}},s.isTornDown=!1,s.options=o,s.queryId=n.generateQueryId();var a=M(o.query);return s.queryName=a&&a.name&&a.name.value,s.queryManager=n,s.queryInfo=i,s}return t.__extends(r,e),Object.defineProperty(r.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),r.prototype.result=function(){var e=this;return new Promise((function(t,r){var n={next:function(r){t(r),e.observers.delete(n),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout((function(){i.unsubscribe()}),0)},error:r},i=e.subscribe(n)}))},r.prototype.getCurrentResult=function(e){void 0===e&&(e=!0);var r=this.lastResult,n=this.queryInfo.networkStatus||r&&r.networkStatus||exports.NetworkStatus.ready,i=t.__assign(t.__assign({},r),{loading:Ie(n),networkStatus:n});if(this.isTornDown)return i;var o=this.options.fetchPolicy,s=void 0===o?"cache-first":o;if("no-cache"===s||"network-only"===s)delete i.partial;else if(!i.data||!this.queryManager.transform(this.options.query).hasForcedResolvers){var a=this.queryInfo.getDiff();i.data=a.complete||this.options.returnPartialData?a.result:void 0,a.complete?(i.networkStatus!==exports.NetworkStatus.loading||"cache-first"!==s&&"cache-only"!==s||(i.networkStatus=exports.NetworkStatus.ready,i.loading=!1),delete i.partial):i.partial=!0}return e&&this.updateLastResult(i),i},r.prototype.isDifferentFromLastResult=function(e){return!a.equal(this.lastResultSnapshot,e)},r.prototype.getLastResult=function(){return this.lastResult},r.prototype.getLastError=function(){return this.lastError},r.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},r.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},r.prototype.refetch=function(e){var r={pollInterval:0},n=this.options.fetchPolicy;return"no-cache"!==n&&"cache-and-network"!==n&&(r.fetchPolicy="network-only",r.nextFetchPolicy=n||"cache-first"),e&&!a.equal(this.options.variables,e)&&(r.variables=this.options.variables=t.__assign(t.__assign({},this.options.variables),e)),this.newReobserver(!1).reobserve(r,exports.NetworkStatus.refetch)},r.prototype.fetchMore=function(e){var r=this,n=t.__assign(t.__assign({},e.query?e:t.__assign(t.__assign(t.__assign({},this.options),e),{variables:t.__assign(t.__assign({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"}),i=this.queryManager.generateQueryId();return n.notifyOnNetworkStatusChange&&(this.queryInfo.networkStatus=exports.NetworkStatus.fetchMore,this.observe()),this.queryManager.fetchQuery(i,n,exports.NetworkStatus.fetchMore).then((function(t){var i=t.data,o=e.updateQuery;return o?r.updateQuery((function(e){return o(e,{fetchMoreResult:i,variables:n.variables})})):r.queryManager.cache.writeQuery({query:n.query,variables:n.variables,data:i}),t})).finally((function(){r.queryManager.stopQuery(i),r.reobserve()}))},r.prototype.subscribeToMore=function(e){var t=this,r=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:function(r){var n=e.updateQuery;n&&t.updateQuery((function(e,t){var i=t.variables;return n(e,{subscriptionData:r,variables:i})}))},error:function(t){e.onError&&e.onError(t)}});return this.subscriptions.add(r),function(){t.subscriptions.delete(r)&&r.unsubscribe()}},r.prototype.setOptions=function(e){return this.reobserve(e)},r.prototype.setVariables=function(e){if(a.equal(this.variables,e))return this.observers.size?this.result():Promise.resolve();if(this.options.variables=e,!this.observers.size)return Promise.resolve();var t=this.options.fetchPolicy,r=void 0===t?"cache-first":t,n={fetchPolicy:r,variables:e};return"cache-first"!==r&&"no-cache"!==r&&"network-only"!==r&&(n.fetchPolicy="cache-and-network",n.nextFetchPolicy=r),this.reobserve(n,exports.NetworkStatus.setVariables)},r.prototype.updateQuery=function(e){var t,r=this.queryManager,n=e(r.cache.diff({query:this.options.query,variables:this.variables,previousResult:null===(t=this.lastResult)||void 0===t?void 0:t.data,returnPartialData:!0,optimistic:!1}).result,{variables:this.variables});n&&(r.cache.writeQuery({query:this.options.query,data:n,variables:this.variables}),r.broadcastQueries())},r.prototype.startPolling=function(e){this.getReobserver().updateOptions({pollInterval:e})},r.prototype.stopPolling=function(){this.reobserver&&this.reobserver.updateOptions({pollInterval:0})},r.prototype.updateLastResult=function(e){var t=this.lastResult;return this.lastResult=e,this.lastResultSnapshot=this.queryManager.assumeImmutableResults?e:Y(e),re(e.errors)||delete this.lastError,t},r.prototype.onSubscribe=function(e){var t=this;if(e===this.observer)return function(){};try{var r=e._subscription._observer;r&&!r.error&&(r.error=Ce)}catch(e){}var n=!this.observers.size;return this.observers.add(e),this.lastError?e.error&&e.error(this.lastError):this.lastResult&&e.next&&e.next(this.lastResult),n&&this.reobserve().catch((function(e){})),function(){t.observers.delete(e)&&!t.observers.size&&t.tearDownQuery()}},r.prototype.getReobserver=function(){return this.reobserver||(this.reobserver=this.newReobserver(!0))},r.prototype.newReobserver=function(e){var r=this,n=this.queryManager,i=this.queryId;return n.setObservableQuery(this),new Pe(this.observer,e?this.options:t.__assign({},this.options),(function(e,t){return n.setObservableQuery(r),n.fetchQueryObservable(i,e,t)}),!n.ssrMode&&function(){return!Ie(r.queryInfo.networkStatus)})},r.prototype.reobserve=function(e,t){return this.isTornDown=!1,this.getReobserver().reobserve(e,t)},r.prototype.observe=function(){this.observer.next(this.getCurrentResult(!1))},r.prototype.hasObservers=function(){return this.observers.size>0},r.prototype.tearDownQuery=function(){this.isTornDown||(this.reobserver&&(this.reobserver.stop(),delete this.reobserver),this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},r}(o);function Ce(e){}Z(Fe);var Te=function(){function e(){this.getFragmentDoc=u.wrap(y)}return e.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},e.prototype.transformDocument=function(e){return e},e.prototype.identify=function(e){},e.prototype.gc=function(){return[]},e.prototype.modify=function(e){return!1},e.prototype.transformForLink=function(e){return e},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read({rootId:e.id||"ROOT_QUERY",query:e.query,variables:e.variables,returnPartialData:e.returnPartialData,optimistic:t})},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read({query:this.getFragmentDoc(e.fragment,e.fragmentName),variables:e.variables,rootId:e.id,returnPartialData:e.returnPartialData,optimistic:t})},e.prototype.writeQuery=function(e){return this.write({dataId:e.id||"ROOT_QUERY",result:e.data,query:e.query,variables:e.variables,broadcast:e.broadcast})},e.prototype.writeFragment=function(e){return this.write({dataId:e.id,result:e.data,variables:e.variables,query:this.getFragmentDoc(e.fragment,e.fragmentName),broadcast:e.broadcast})},e}();exports.Cache||(exports.Cache={});var De=function(e,t,r,n,i){this.message=e,this.path=t,this.query=r,this.clientOnly=n,this.variables=i},je=Object.prototype.hasOwnProperty;var Ne=/^[_a-z][_0-9a-z]*/i;function Ae(e){var t=e.match(Ne);return t?t[0]:e}function Le(e,t,r){return!(!t||"object"!=typeof t)&&(Array.isArray(t)?t.every((function(t){return Le(e,t,r)})):e.selections.every((function(e){if(q(e)&&h(e,r)){var n=k(e);return je.call(t,n)&&(!e.selectionSet||Le(e.selectionSet,t[n],r))}return!0})))}function Ve(e){return null!==e&&"object"==typeof e&&!_(e)&&!Array.isArray(e)}var ze=Object.create(null),Be=function(){return ze},We=Object.create(null),Ue=function(){function e(e,t){var r=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(e,t){return _(e)?r.get(e.__ref,t):e&&e[t]},this.canRead=function(e){return _(e)?r.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return m(e);if(_(e))return e;var n=r.policies.identify(e)[0];if(n){var i=m(n);return t&&r.merge(n,e),i}}}return e.prototype.toObject=function(){return t.__assign({},this.data)},e.prototype.has=function(e){return void 0!==this.lookup(e,!0)},e.prototype.get=function(e,t){if(this.group.depend(e,t),je.call(this.data,e)){var r=this.data[e];if(r&&je.call(r,t))return r[t]}return"__typename"===t&&je.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof Ge?this.parent.get(e,t):void 0},e.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),je.call(this.data,e)?this.data[e]:this instanceof Ge?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},e.prototype.merge=function(e,t){var r=this,n=this.lookup(e),i=new G(He).merge(n,t);if(this.data[e]=i,i!==n&&(delete this.refs[e],this.group.caching)){var o=Object.create(null);n||(o.__exists=1),Object.keys(t).forEach((function(e){if(!n||n[e]!==i[e]){o[e]=1;var t=Ae(e);t===e||r.policies.hasKeyArgs(i.__typename,t)||(o[t]=1),void 0!==i[e]||r instanceof Ge||delete i[e]}})),Object.keys(o).forEach((function(t){return r.group.dirty(e,t)}))}},e.prototype.modify=function(e,r){var n=this,i=this.lookup(e);if(i){var o=Object.create(null),s=!1,a=!0,u={DELETE:ze,INVALIDATE:We,isReference:_,toReference:this.toReference,canRead:this.canRead,readField:function(t,r){return n.policies.readField("string"==typeof t?{fieldName:t,from:r||m(e)}:t,{store:n})}};if(Object.keys(i).forEach((function(c){var l=Ae(c),p=i[c];if(void 0!==p){var f="function"==typeof r?r:r[c]||r[l];if(f){var h=f===Be?ze:f(p,t.__assign(t.__assign({},u),{fieldName:l,storeFieldName:c,storage:n.getStorage(e,c)}));h===We?n.group.dirty(e,c):(h===ze&&(h=void 0),h!==p&&(o[c]=h,s=!0,p=h))}void 0!==p&&(a=!1)}})),s)return this.merge(e,o),a&&(this instanceof Ge?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},e.prototype.delete=function(e,t,r){var n,i=this.lookup(e);if(i){var o=this.getFieldValue(i,"__typename"),s=t&&r?this.policies.getStoreFieldName({typename:o,fieldName:t,args:r}):t;return this.modify(e,s?((n={})[s]=Be,n):Be)}return!1},e.prototype.evict=function(e){var t=!1;return e.id&&(je.call(this.data,e.id)&&(t=this.delete(e.id,e.fieldName,e.args)),this instanceof Ge&&(t=this.parent.evict(e)||t),(e.fieldName||t)&&this.group.dirty(e.id,e.fieldName||"__exists")),t},e.prototype.clear=function(){this.replace(null)},e.prototype.extract=function(){var e=this,t=this.toObject(),r=[];return this.getRootIdSet().forEach((function(t){je.call(e.policies.rootTypenamesById,t)||r.push(t)})),r.length&&(t.__META={extraRootIds:r.sort()}),t},e.prototype.replace=function(e){var r=this;if(Object.keys(this.data).forEach((function(t){e&&je.call(e,t)||r.delete(t)})),e){var n=e.__META,i=t.__rest(e,["__META"]);Object.keys(i).forEach((function(e){r.merge(e,i[e])})),n&&n.extraRootIds.forEach(this.retain,this)}},e.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},e.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},e.prototype.getRootIdSet=function(e){return void 0===e&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Ge?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},e.prototype.gc=function(){var e=this,t=this.getRootIdSet(),r=this.toObject();t.forEach((function(n){je.call(r,n)&&(Object.keys(e.findChildRefIds(n)).forEach(t.add,t),delete r[n])}));var n=Object.keys(r);if(n.length){for(var i=this;i instanceof Ge;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},e.prototype.findChildRefIds=function(e){if(!je.call(this.refs,e)){var t=this.refs[e]=Object.create(null),r=new Set([this.data[e]]),n=function(e){return null!==e&&"object"==typeof e};r.forEach((function(e){_(e)?t[e.__ref]=!0:n(e)&&Object.values(e).filter(n).forEach(r.add,r)}))}return this.refs[e]},e.prototype.makeCacheKey=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.group.keyMaker.lookupArray(e)},e}(),Ke=function(){function e(e){this.caching=e,this.d=null,this.keyMaker=new u.KeyTrie(ie),this.d=e?u.dep():null}return e.prototype.depend=function(e,t){if(this.d){this.d(Je(e,t));var r=Ae(t);r!==t&&this.d(Je(e,r))}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(Je(e,t))},e}();function Je(e,t){return t+"#"+e}!function(e){var r=function(e){function r(t){var r=t.policies,n=t.resultCaching,i=void 0===n||n,o=t.seed,s=e.call(this,r,new Ke(i))||this;return s.storageTrie=new u.KeyTrie(ie),s.sharedLayerGroup=new Ke(i),o&&s.replace(o),s}return t.__extends(r,e),r.prototype.addLayer=function(e,t){return new Ge(e,this,t,this.sharedLayerGroup)},r.prototype.removeLayer=function(){return this},r.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},r}(e);e.Root=r}(Ue||(Ue={}));var Ge=function(e){function r(t,r,n,i){var o=e.call(this,r.policies,i)||this;return o.id=t,o.parent=r,o.replay=n,o.group=i,n(o),o}return t.__extends(r,e),r.prototype.addLayer=function(e,t){return new r(e,this,t,this.group)},r.prototype.removeLayer=function(e){var t=this,r=this.parent.removeLayer(e);return e===this.id?(this.group.caching&&Object.keys(this.data).forEach((function(e){t.data[e]!==r.lookup(e)&&t.delete(e)})),r):r===this.parent?this:r.addLayer(this.id,this.replay)},r.prototype.toObject=function(){return t.__assign(t.__assign({},this.parent.toObject()),this.data)},r.prototype.findChildRefIds=function(r){var n=this.parent.findChildRefIds(r);return je.call(this.data,r)?t.__assign(t.__assign({},n),e.prototype.findChildRefIds.call(this,r)):n},r.prototype.getStorage=function(){for(var e=this.parent;e.parent;)e=e.parent;return e.getStorage.apply(e,arguments)},r}(Ue);function He(e,t,r){var n=e[r],i=t[r];return a.equal(n,i)?n:i}function Ye(e){return!!(e instanceof Ue&&e.group.caching)}function $e(e,t){return new De(e.message,t.path.slice(),t.query,t.clientOnly,t.variables)}var Xe=function(){function e(e){var r=this;this.config=e,this.executeSelectionSet=u.wrap((function(e){return r.execSelectionSetImpl(e)}),{keyArgs:function(e){return[e.selectionSet,e.objectOrReference,e.context]},makeCacheKey:function(e,t,r){if(Ye(r.store))return r.store.makeCacheKey(e,_(t)?t.__ref:t,r.varString)}}),this.knownResults=new WeakMap,this.executeSubSelectedArray=u.wrap((function(e){return r.execSubSelectedArrayImpl(e)}),{makeCacheKey:function(e){var t=e.field,r=e.array,n=e.context;if(Ye(n.store))return n.store.makeCacheKey(t,r,n.varString)}}),this.config=t.__assign({addTypename:!0},e)}return e.prototype.diffQueryAgainstStore=function(e){var n,i=e.store,o=e.query,s=e.rootId,a=void 0===s?"ROOT_QUERY":s,u=e.variables,c=e.returnPartialData,l=void 0===c||c,p=this.config.cache.policies;u=t.__assign(t.__assign({},C((n=M(o),r.invariant(n&&"query"===n.operation,48),n))),u);var f=this.executeSelectionSet({selectionSet:F(o).selectionSet,objectOrReference:m(a),context:{store:i,query:o,policies:p,variables:u,varString:JSON.stringify(u),fragmentMap:b(P(o)),path:[],clientOnly:!1}}),h=f.missing&&f.missing.length>0;if(h&&!l)throw f.missing[0];return{result:f.result,missing:f.missing,complete:!h}},e.prototype.isFresh=function(e,t,r,n){if(Ye(n.store)&&this.knownResults.get(e)===r){var i=this.executeSelectionSet.peek(r,t,n);if(i&&e===i.result)return!0}return!1},e.prototype.execSelectionSetImpl=function(e){var t=this,n=e.selectionSet,i=e.objectOrReference,o=e.context;if(_(i)&&!o.policies.rootTypenamesById[i.__ref]&&!o.store.has(i.__ref))return{result:{},missing:[$e(new r.InvariantError(4),o)]};var s=o.variables,a=o.policies,u=o.store,c=[],l={result:null},p=u.getFieldValue(i,"__typename");function f(){return l.missing||(l.missing=[])}function d(e){var t;return e.missing&&(t=f()).push.apply(t,e.missing),e.result}this.config.addTypename&&"string"==typeof p&&!a.rootIdsByTypename[p]&&c.push({__typename:p});var v=new Set(n.selections);return v.forEach((function(e){var n;if(h(e,s))if(q(e)){var u=a.readField({fieldName:e.name.value,field:e,variables:o.variables,from:i},o),l=k(e);o.path.push(l);var y=o.clientOnly;o.clientOnly=y||!(!e.directives||!e.directives.some((function(e){return"client"===e.name.value}))),void 0===u?L.added(e)||f().push($e(new r.InvariantError(5),o)):Array.isArray(u)?u=d(t.executeSubSelectedArray({field:e,array:u,context:o})):e.selectionSet&&null!=u&&(u=d(t.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:u,context:o}))),void 0!==u&&c.push(((n={})[l]=u,n)),o.clientOnly=y,r.invariant(o.path.pop()===l)}else{var b=g(e,o.fragmentMap);b&&a.fragmentMatches(b,p)&&b.selectionSet.selections.forEach(v.add,v)}})),l.result=U(c),this.knownResults.set(l.result,n),l},e.prototype.execSubSelectedArrayImpl=function(e){var t,n=this,i=e.field,o=e.array,s=e.context;function a(e,n){return e.missing&&(t=t||[]).push.apply(t,e.missing),r.invariant(s.path.pop()===n),e.result}return i.selectionSet&&(o=o.filter(s.store.canRead)),{result:o=o.map((function(e,t){return null===e?null:(s.path.push(t),Array.isArray(e)?a(n.executeSubSelectedArray({field:i,array:e,context:s}),t):i.selectionSet?a(n.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:e,context:s}),t):(r.invariant(s.path.pop()===t),e))})),missing:t}},e}();var Ze=function(){function e(e,t){this.cache=e,this.reader=t}return e.prototype.writeToStore=function(e){var n=e.query,i=e.result,o=e.dataId,s=e.store,a=e.variables,u=M(n),c=new G;a=t.__assign(t.__assign({},C(u)),a);var l=this.processSelectionSet({result:i||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:{store:s,written:Object.create(null),merge:function(e,t){return c.merge(e,t)},variables:a,varString:JSON.stringify(a),fragmentMap:b(P(n))}});if(!_(l))throw new r.InvariantError(7);return s.retain(l.__ref),l},e.prototype.processSelectionSet=function(e){var t=this,n=e.dataId,i=e.result,o=e.selectionSet,s=e.context,a=e.mergeTree,u=this.cache.policies,c=u.identify(i,o,s.fragmentMap),l=c[0],p=c[1];if("string"==typeof(n=n||l)){var f=s.written[n]||(s.written[n]=[]),v=m(n);if(f.indexOf(o)>=0)return v;if(f.push(o),this.reader&&this.reader.isFresh(i,v,o,s))return v}var y=Object.create(null);p&&(y=s.merge(y,p));var b=n&&u.rootTypenamesById[n]||E(i,o,s.fragmentMap)||n&&s.store.get(n,"__typename");"string"==typeof b&&(y.__typename=b);var _=new Set(o.selections);if(_.forEach((function(e){var n;if(h(e,s.variables))if(q(e)){var o=k(e),c=i[o];if(void 0!==c){var l=u.getStoreFieldName({typename:b,fieldName:e.name.value,field:e,variables:s.variables}),p=tt(a,l),f=t.processFieldValue(c,e,s,p),v=e.selectionSet&&s.store.getFieldValue(f,"__typename")||void 0,m=u.getMergeFunction(b,e.name.value,v);m?p.info={field:e,typename:b,merge:m}:rt(a,l),y=s.merge(y,((n={})[l]=f,n))}else if(u.usingPossibleTypes&&!d(["defer","client"],e))throw new r.InvariantError(8)}else{var S=g(e,s.fragmentMap);S&&u.fragmentMatches(S,b,i,s.variables)&&S.selectionSet.selections.forEach(_.add,_)}})),"string"==typeof n){var S=m(n);return a.map.size&&(y=this.applyMerges(a,S,y,s)),s.store.merge(n,y),S}return y},e.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?Array.isArray(e)?e.map((function(e,o){var s=i.processFieldValue(e,t,r,tt(n,o));return rt(n,o),s})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):e},e.prototype.applyMerges=function(e,n,i,o,s){var a,u=this;if(e.map.size&&!_(i)){var c,l=Array.isArray(i)||!_(n)&&!Ve(n)?void 0:n,p=i;l&&!s&&(s=[_(l)?l.__ref:l]);var f=function(e,t){return Array.isArray(e)?"number"==typeof t?e[t]:void 0:o.store.getFieldValue(e,String(t))};e.map.forEach((function(e,t){s&&s.push(t);var n=f(l,t),i=f(p,t),a=u.applyMerges(e,n,i,o,s);a!==i&&(c=c||new Map).set(t,a),s&&r.invariant(s.pop()===t)})),c&&(i=Array.isArray(p)?p.slice(0):t.__assign({},p),c.forEach((function(e,t){i[t]=e})))}return e.info?this.cache.policies.runMergeFunction(n,i,e.info,o,s&&(a=o.store).getStorage.apply(a,s)):i},e}(),et=[];function tt(e,t){var r=e.map;return r.has(t)||r.set(t,et.pop()||{map:new Map}),r.get(t)}function rt(e,t){var r=e.map,n=r.get(t);!n||n.info||n.map.size||(et.push(n),r.delete(t))}new Set;var nt=new c.Slot;function it(e,t){if(e.size){var r=[];e.forEach((function(e){return r.push(e)})),e.clear(),r.forEach(t)}}var ot=new WeakMap;function st(e){var t=ot.get(e);return t||ot.set(e,t={vars:new Set,dep:u.dep()}),t}function at(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0)e!==o&&(e=o,t.forEach((function(e){st(e).dep.dirty(n),ut(e)})),it(r,(function(t){return t(e)})));else{var s=nt.getValue();s&&(i(s),st(s).dep(n))}return e};n.onNextChange=function(e){return r.add(e),function(){r.delete(e)}};var i=n.attachCache=function(e){return t.add(e),st(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}function ut(e){e.broadcastWatches&&e.broadcastWatches()}function ct(e){return void 0!==e.args?e.args:e.field?x(e.field,e.variables):null}var lt=function(e,t){var r=e.__typename,n=e.id,i=e._id;if("string"==typeof r&&(t&&(t.keyObject=void 0!==n?{id:n}:void 0!==i?{_id:i}:void 0),void 0===n&&(n=i),void 0!==n))return r+":"+("number"==typeof n||"string"==typeof n?n:JSON.stringify(n))},pt=function(){},ft=function(e,t){return t.fieldName},ht=function(e,t,r){return(0,r.mergeObjects)(e,t)},dt=function(e,t){return t},vt=function(){function e(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=t.__assign({dataIdFromObject:lt},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return e.prototype.identify=function(e,t,r){var n=t&&r?E(e,t,r):e.__typename;if(n===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var i,o={typename:n,selectionSet:t,fragmentMap:r},s=n&&this.getTypePolicy(n),a=s&&s.keyFn||this.config.dataIdFromObject;a;){var u=a(e,o);if(!Array.isArray(u)){i=u;break}a=mt(u)}return i=i&&String(i),o.keyObject?[i,o.keyObject]:[i]},e.prototype.addTypePolicies=function(e){var r=this;Object.keys(e).forEach((function(n){var i=e[n],o=i.queryType,s=i.mutationType,a=i.subscriptionType,u=t.__rest(i,["queryType","mutationType","subscriptionType"]);o&&r.setRootTypename("Query",n),s&&r.setRootTypename("Mutation",n),a&&r.setRootTypename("Subscription",n),je.call(r.toBeAdded,n)?r.toBeAdded[n].push(u):r.toBeAdded[n]=[u]}))},e.prototype.updateTypePolicy=function(e,t){var r=this,n=this.getTypePolicy(e),i=t.keyFields,o=t.fields;function s(e,t){e.merge="function"==typeof t?t:!0===t?ht:!1===t?dt:e.merge}s(n,t.merge),n.keyFn=!1===i?pt:Array.isArray(i)?mt(i):"function"==typeof i?i:n.keyFn,o&&Object.keys(o).forEach((function(t){var n=r.getFieldPolicy(e,t,!0),i=o[t];if("function"==typeof i)n.read=i;else{var a=i.keyArgs,u=i.read,c=i.merge;n.keyFn=!1===a?ft:Array.isArray(a)?gt(a):"function"==typeof a?a:n.keyFn,"function"==typeof u&&(n.read=u),s(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||ft)}))},e.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==i&&(r.invariant(!i||i===e,1),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[t]=n,this.rootTypenamesById[n]=t)},e.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach((function(r){t.getSupertypeSet(r,!0),e[r].forEach((function(e){t.getSupertypeSet(e,!0).add(r);var n=e.match(Ne);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},e.prototype.getTypePolicy=function(e){var r=this;if(!je.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(e);i&&i.size&&i.forEach((function(e){var i=r.getTypePolicy(e),o=i.fields,s=t.__rest(i,["fields"]);Object.assign(n,s),Object.assign(n.fields,o)}))}var o=this.toBeAdded[e];return o&&o.length&&this.updateTypePolicy(e,oe.apply(void 0,o.splice(0))),this.typePolicies[e]},e.prototype.getFieldPolicy=function(e,t,r){if(e){var n=this.getTypePolicy(e).fields;return n[t]||r&&(n[t]=Object.create(null))}},e.prototype.getSupertypeSet=function(e,t){var r=this.supertypeMap.get(e);return!r&&t&&this.supertypeMap.set(e,r=new Set),r},e.prototype.fragmentMatches=function(e,t,r,n){var i=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),a=[s],u=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&a.indexOf(t)<0&&a.push(t)},c=!(!r||!this.fuzzySubtypes.size),l=0;l<a.length;++l){var p=a[l];if(p.has(o))return s.has(o)||s.add(o),!0;p.forEach(u),c&&l===a.length-1&&Le(e.selectionSet,r,n)&&(c=!1,!0,this.fuzzySubtypes.forEach((function(e,r){var n=t.match(e);n&&n[0]===t&&u(r)})))}return!1},e.prototype.hasKeyArgs=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.keyFn)},e.prototype.getStoreFieldName=function(e){var t,r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),o=i&&i.keyFn;if(o&&r)for(var s={typename:r,fieldName:n,field:e.field||null,variables:e.variables},a=ct(e);o;){var u=o(a,s);if(!Array.isArray(u)){t=u||n;break}o=gt(u)}return void 0===t&&(t=e.field?function(e,t){var r=null;e.directives&&(r={},e.directives.forEach((function(e){r[e.name.value]={},e.arguments&&e.arguments.forEach((function(n){var i=n.name,o=n.value;return S(r[e.name.value],i,o,t)}))})));var n=null;return e.arguments&&e.arguments.length&&(n={},e.arguments.forEach((function(e){var r=e.name,i=e.value;return S(n,r,i,t)}))),w(e.name.value,n,r)}(e.field,e.variables):w(n,ct(e))),n===Ae(t)?t:n+":"+t},e.prototype.readField=function(e,t){var r=e.from;if(r&&(e.field||e.fieldName)){if(void 0===e.typename){var n=t.store.getFieldValue(r,"__typename");n&&(e.typename=n)}var i=this.getStoreFieldName(e),o=Ae(i),s=t.store.getFieldValue(r,i),a=this.getFieldPolicy(e.typename,o,!1),u=a&&a.read;if(u){var c=yt(this,r,e,t,t.store.getStorage(_(r)?r.__ref:r,i));return nt.withValue(this.cache,u,[s,c])}return s}},e.prototype.getMergeFunction=function(e,t,r){var n=this.getFieldPolicy(e,t,!1),i=n&&n.merge;return!i&&r&&(i=(n=this.getTypePolicy(r))&&n.merge),i},e.prototype.runMergeFunction=function(e,t,r,n,i){var o=r.field,s=r.typename,a=r.merge;return a===ht?bt(n.store.getFieldValue)(e,t):a===dt?t:a(e,t,yt(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null)))},e}();function yt(e,r,n,i,o){var s=e.getStoreFieldName(n),a=Ae(s),u=n.variables||i.variables,c=i.store,l=c.getFieldValue,p=c.toReference,f=c.canRead;return{args:ct(n),field:n.field||null,fieldName:a,storeFieldName:s,variables:u,isReference:_,toReference:p,storage:o,cache:e.cache,canRead:f,readField:function(n,o){var s="string"==typeof n?{fieldName:n,from:o}:t.__assign({},n);return void 0===s.from&&(s.from=r),void 0===s.variables&&(s.variables=u),e.readField(s,i)},mergeObjects:bt(l)}}function bt(e){return function(n,i){if(Array.isArray(n)||Array.isArray(i))throw new r.InvariantError(2);if(n&&"object"==typeof n&&i&&"object"==typeof i){var o=e(n,"__typename"),s=e(i,"__typename");return!(o&&s&&o!==s)&&Ve(n)&&Ve(i)?t.__assign(t.__assign({},n),i):i}return i}}function gt(e){return function(t,r){return t?r.fieldName+":"+JSON.stringify(_t(t,e,!1)):r.fieldName}}function mt(e){var t=new u.KeyTrie(ie);return function(r,n){var i;if(n.selectionSet&&n.fragmentMap){var o=t.lookupArray([n.selectionSet,n.fragmentMap]);i=o.aliasMap||(o.aliasMap=function e(t,r){var n=Object.create(null),i=new Set([t]);return i.forEach((function(t){t.selections.forEach((function(t){if(q(t)){if(t.alias){var o=t.alias.value,s=t.name.value;if(s!==o)(n.aliases||(n.aliases=Object.create(null)))[s]=o}if(t.selectionSet)(n.subsets||(n.subsets=Object.create(null)))[t.name.value]=e(t.selectionSet,r)}else{var a=g(t,r);a&&i.add(a.selectionSet)}}))})),n}(n.selectionSet,n.fragmentMap))}var s=n.keyObject=_t(r,e,!0,i);return n.typename+":"+JSON.stringify(s)}}function _t(e,t,n,i){var o,s=Object.create(null);return t.forEach((function(t){if(Array.isArray(t)){if("string"==typeof o){var a=i&&i.subsets,u=a&&a[o];s[o]=_t(e[o],t,n,u)}}else{var c=i&&i.aliases,l=c&&c[t]||t;je.call(e,l)?s[o=t]=e[l]:(r.invariant(!n,3),o=void 0)}})),s}var St={dataIdFromObject:lt,addTypename:!0,resultCaching:!0,typePolicies:{}},Ot=function(e){function r(r){void 0===r&&(r={});var n=e.call(this)||this;return n.watches=new Set,n.typenameDocumentCache=new Map,n.makeVar=at,n.txCount=0,n.maybeBroadcastWatch=u.wrap((function(e,t){return n.broadcastWatch.call(n,e,!!t)}),{makeCacheKey:function(e){var t=e.optimistic?n.optimisticData:n.data;if(Ye(t)){var r=e.optimistic,i=e.rootId,o=e.variables;return t.makeCacheKey(e.query,e.callback,JSON.stringify({optimistic:r,rootId:i,variables:o}))}}}),n.watchDep=u.dep(),n.config=t.__assign(t.__assign({},St),r),n.addTypename=!!n.config.addTypename,n.policies=new vt({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.data=new Ue.Root({policies:n.policies,resultCaching:n.config.resultCaching}),n.optimisticData=n.data,n.storeWriter=new Ze(n,n.storeReader=new Xe({cache:n,addTypename:n.addTypename})),n}return t.__extends(r,e),r.prototype.restore=function(e){return e&&this.data.replace(e),this},r.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).extract()},r.prototype.read=function(e){var t=e.returnPartialData,r=void 0!==t&&t;try{return this.storeReader.diffQueryAgainstStore({store:e.optimistic?this.optimisticData:this.data,query:e.query,variables:e.variables,rootId:e.rootId,config:this.config,returnPartialData:r}).result||null}catch(e){if(e instanceof De)return null;throw e}},r.prototype.write=function(e){try{return++this.txCount,this.storeWriter.writeToStore({store:this.data,query:e.query,result:e.result,dataId:e.dataId,variables:e.variables})}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},r.prototype.modify=function(e){if(je.call(e,"id")&&!e.id)return!1;var t=e.optimistic?this.optimisticData:this.data;try{return++this.txCount,t.modify(e.id||"ROOT_QUERY",e.fields)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},r.prototype.diff=function(e){return this.storeReader.diffQueryAgainstStore({store:e.optimistic?this.optimisticData:this.data,rootId:e.id||"ROOT_QUERY",query:e.query,variables:e.variables,returnPartialData:e.returnPartialData,config:this.config})},r.prototype.watch=function(e){var t=this;return this.watches.size||function(e){st(e).vars.forEach((function(t){return t.attachCache(e)}))}(this),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){t.watches.delete(e)&&!t.watches.size&&function(e){st(e).vars.forEach((function(t){return t.forgetCache(e)}))}(t),t.watchDep.dirty(e),t.maybeBroadcastWatch.forget(e)}},r.prototype.gc=function(){return this.optimisticData.gc()},r.prototype.retain=function(e,t){return(t?this.optimisticData:this.data).retain(e)},r.prototype.release=function(e,t){return(t?this.optimisticData:this.data).release(e)},r.prototype.identify=function(e){return _(e)?e.__ref:this.policies.identify(e)[0]},r.prototype.evict=function(e){if(!e.id){if(je.call(e,"id"))return!1;e=t.__assign(t.__assign({},e),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},r.prototype.reset=function(){return this.data.clear(),this.optimisticData=this.data,this.broadcastWatches(),Promise.resolve()},r.prototype.removeOptimistic=function(e){var t=this.optimisticData.removeLayer(e);t!==this.optimisticData&&(this.optimisticData=t,this.broadcastWatches())},r.prototype.performTransaction=function(e,t){var r=this,n=function(t){var n=r,i=n.data,o=n.optimisticData;++r.txCount,t&&(r.data=r.optimisticData=t);try{e(r)}finally{--r.txCount,r.data=i,r.optimisticData=o}},i=!1;"string"==typeof t?(this.optimisticData=this.optimisticData.addLayer(t,n),i=!0):null===t?n(this.data):n(),this.broadcastWatches(i)},r.prototype.transformDocument=function(e){if(this.addTypename){var t=this.typenameDocumentCache.get(e);return t||(t=L(e),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},r.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach((function(r){return t.maybeBroadcastWatch(r,e)}))},r.prototype.broadcastWatch=function(e,t){this.watchDep.dirty(e),this.watchDep(e);var r=this.diff({query:e.query,variables:e.variables,optimistic:e.optimistic});e.optimistic&&t&&(r.fromOptimisticTransaction=!0),e.callback(r)},r}(Te),wt=function(){function e(e){var t=e.cache,r=e.client,n=e.resolvers,i=e.fragmentMatcher;this.cache=t,r&&(this.client=r),n&&this.addResolvers(n),i&&this.setFragmentMatcher(i)}return e.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=W(t.resolvers,e)})):this.resolvers=W(this.resolvers,e)},e.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},e.prototype.getResolvers=function(){return this.resolvers||{}},e.prototype.runResolvers=function(e){var r=e.document,n=e.remoteResult,i=e.context,o=e.variables,s=e.onlyRunForcedResolvers,a=void 0!==s&&s;return t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(e){return r?[2,this.resolveDocument(r,n.data,i,o,this.fragmentMatcher,a).then((function(e){return t.__assign(t.__assign({},n),{data:e.result})}))]:[2,n]}))}))},e.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},e.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},e.prototype.clientQuery=function(e){return d(["client"],e)&&this.resolvers?e:null},e.prototype.serverQuery=function(e){return function(e){Q(e);var t=A([{test:function(e){return"client"===e.name.value},remove:!0}],e);return t&&(t=n.visit(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return q(e)&&"__typename"===e.name.value})))return null}}})),t}(e)},e.prototype.prepareContext=function(e){var r=this.cache;return t.__assign(t.__assign({},e),{cache:r,getCacheKey:function(e){return r.identify(e)}})},e.prototype.addExportedVariables=function(e,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,r)||{},this.prepareContext(n),r).then((function(e){return t.__assign(t.__assign({},r),e.exportedVariables)}))]:[2,t.__assign({},r)]}))}))},e.prototype.shouldForceResolvers=function(e){var t=!1;return n.visit(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some((function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value}))))return n.BREAK}}}),t},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:z(e),variables:t,returnPartialData:!0,optimistic:!1}).result},e.prototype.resolveDocument=function(e,r,n,i,o,s){return void 0===n&&(n={}),void 0===i&&(i={}),void 0===o&&(o=function(){return!0}),void 0===s&&(s=!1),t.__awaiter(this,void 0,void 0,(function(){var a,u,c,l,p,f,h,d,v;return t.__generator(this,(function(y){return a=F(e),u=P(e),c=b(u),l=a.operation,p=l?l.charAt(0).toUpperCase()+l.slice(1):"Query",h=(f=this).cache,d=f.client,v={fragmentMap:c,context:t.__assign(t.__assign({},n),{cache:h,client:d}),variables:i,fragmentMatcher:o,defaultOperationType:p,exportedVariables:{},onlyRunForcedResolvers:s},[2,this.resolveSelectionSet(a.selectionSet,r,v).then((function(e){return{result:e,exportedVariables:v.exportedVariables}}))]}))}))},e.prototype.resolveSelectionSet=function(e,n,i){return t.__awaiter(this,void 0,void 0,(function(){var o,s,a,u,c,l=this;return t.__generator(this,(function(p){return o=i.fragmentMap,s=i.context,a=i.variables,u=[n],c=function(e){return t.__awaiter(l,void 0,void 0,(function(){var c,l;return t.__generator(this,(function(t){return h(e,a)?q(e)?[2,this.resolveField(e,n,i).then((function(t){var r;void 0!==t&&u.push(((r={})[k(e)]=t,r))}))]:(R(e)?c=e:(c=o[e.name.value],r.invariant(c,11)),c&&c.typeCondition&&(l=c.typeCondition.name.value,i.fragmentMatcher(n,l,s))?[2,this.resolveSelectionSet(c.selectionSet,n,i).then((function(e){u.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(e.selections.map(c)).then((function(){return U(u)}))]}))}))},e.prototype.resolveField=function(e,r,n){return t.__awaiter(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,p,f,h=this;return t.__generator(this,(function(t){return i=n.variables,o=e.name.value,s=k(e),a=o!==s,u=r[s]||r[o],c=Promise.resolve(u),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(l=r.__typename||n.defaultOperationType,(p=this.resolvers&&this.resolvers[l])&&(f=p[a?o:s])&&(c=Promise.resolve(nt.withValue(this.cache,f,[r,x(e,i),n.context,{field:e,fragmentMap:n.fragmentMap}])))),[2,c.then((function(t){return void 0===t&&(t=u),e.directives&&e.directives.forEach((function(e){"export"===e.name.value&&e.arguments&&e.arguments.forEach((function(e){"as"===e.name.value&&"StringValue"===e.value.kind&&(n.exportedVariables[e.value.value]=t)}))})),e.selectionSet?null==t?t:Array.isArray(t)?h.resolveSubSelectedArray(e,t,n):e.selectionSet?h.resolveSelectionSet(e.selectionSet,t,n):void 0:t}))]}))}))},e.prototype.resolveSubSelectedArray=function(e,t,r){var n=this;return Promise.all(t.map((function(t){return null===t?null:Array.isArray(t)?n.resolveSubSelectedArray(e,t,r):e.selectionSet?n.resolveSelectionSet(e.selectionSet,t,r):void 0})))},e}(),xt=new(ie?WeakMap:Map);function kt(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return xt.set(e,(xt.get(e)+1)%1e15),r.apply(this,arguments)})}function Et(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var qt=function(){function e(e){this.cache=e,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.diff=null,this.observableQuery=null,xt.has(e)||(xt.set(e,0),kt(e,"evict"),kt(e,"modify"),kt(e,"reset"))}return e.prototype.init=function(e){var t=e.networkStatus||exports.NetworkStatus.loading;return this.variables&&this.networkStatus!==exports.NetworkStatus.loading&&!a.equal(this.variables,e.variables)&&(t=exports.NetworkStatus.setVariables),a.equal(e.variables,this.variables)||(this.diff=null),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},e.prototype.reset=function(){Et(this),this.diff=null,this.dirty=!1},e.prototype.getDiff=function(e){return void 0===e&&(e=this.variables),this.diff&&a.equal(e,this.variables)?this.diff:(this.updateWatch(this.variables=e),this.diff=this.cache.diff({query:this.document,variables:e,returnPartialData:!0,optimistic:!0}))},e.prototype.setDiff=function(e){var t=this,r=this.diff;this.diff=e,this.dirty||(e&&e.result)===(r&&r.result)||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout((function(){return t.notify()}),0)))},e.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){t.getDiff().fromOptimisticTransaction?e.observe():e.reobserve()})):delete this.oqListener)},e.prototype.notify=function(){var e=this;Et(this),this.shouldNotify()&&this.listeners.forEach((function(t){return t(e)})),this.dirty=!1},e.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Ie(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if("cache-only"!==e&&"cache-and-network"!==e)return!1}return!0},e.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.cancel(),delete this.cancel,this.subscriptions.forEach((function(e){return e.unsubscribe()}));var e=this.observableQuery;e&&e.stopPolling()}},e.prototype.cancel=function(){},e.prototype.updateWatch=function(e){var t=this;void 0===e&&(e=this.variables);var r=this.observableQuery;r&&"no-cache"===r.options.fetchPolicy||this.lastWatch&&this.lastWatch.query===this.document&&a.equal(e,this.lastWatch.variables)||(this.cancel(),this.cancel=this.cache.watch(this.lastWatch={query:this.document,variables:e,optimistic:!0,callback:function(e){return t.setDiff(e)}}))},e.prototype.shouldWrite=function(e,t){var r=this.lastWrite;return!(r&&r.dmCount===xt.get(this.cache)&&a.equal(t,r.variables)&&a.equal(e.data,r.result.data))},e.prototype.markResult=function(e,t,r){var n=this;this.graphQLErrors=re(e.errors)?e.errors:[],this.reset(),"no-cache"===t.fetchPolicy?this.diff={result:e.data,complete:!0}:!this.stopped&&r&&(Rt(e,t.errorPolicy)?this.cache.performTransaction((function(r){if(n.shouldWrite(e,t.variables))r.writeQuery({query:n.document,data:e.data,variables:t.variables}),n.lastWrite={result:e,variables:t.variables,dmCount:xt.get(n.cache)};else if(n.diff&&n.diff.complete)return void(e.data=n.diff.result);var i=r.diff({query:n.document,variables:t.variables,returnPartialData:!0,optimistic:!0});n.stopped||n.updateWatch(t.variables),n.diff=i,i.complete&&(e.data=i.result)})):this.lastWrite=void 0)},e.prototype.markReady=function(){return this.networkError=null,this.networkStatus=exports.NetworkStatus.ready},e.prototype.markError=function(e){return this.networkStatus=exports.NetworkStatus.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}();function Rt(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!ne(e);return!n&&r&&e.data&&(n=!0),n}var Qt=Object.prototype.hasOwnProperty,Mt=function(){function e(e){var t=e.cache,r=e.link,n=e.queryDeduplication,i=void 0!==n&&n,o=e.onBroadcast,s=e.ssrMode,a=void 0!==s&&s,u=e.clientAwareness,c=void 0===u?{}:u,l=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(ie?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=r,this.queryDeduplication=i,this.clientAwareness=c,this.localState=l||new wt({cache:t}),this.ssrMode=a,this.assumeImmutableResults=!!p,(this.onBroadcast=o)&&(this.mutationStore=Object.create(null))}return e.prototype.stop=function(){var e=this;this.queries.forEach((function(t,r){e.stopQueryNoBroadcast(r)})),this.cancelPendingFetches(new r.InvariantError(12))},e.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach((function(t){return t(e)})),this.fetchCancelFns.clear()},e.prototype.mutate=function(e){var n=e.mutation,i=e.variables,o=e.optimisticResponse,s=e.updateQueries,a=e.refetchQueries,u=void 0===a?[]:a,c=e.awaitRefetchQueries,l=void 0!==c&&c,p=e.update,f=e.errorPolicy,h=void 0===f?"none":f,d=e.fetchPolicy,v=e.context,y=void 0===v?{}:v;return t.__awaiter(this,void 0,void 0,(function(){var e,a,c;return t.__generator(this,(function(f){switch(f.label){case 0:return r.invariant(n,13),r.invariant(!d||"no-cache"===d,14),e=this.generateMutationId(),n=this.transform(n).document,i=this.getVariables(n,i),this.transform(n).hasClientExports?[4,this.localState.addExportedVariables(n,i,y)]:[3,2];case 1:i=f.sent(),f.label=2;case 2:return a=this.mutationStore&&(this.mutationStore[e]={mutation:n,variables:i,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:e,document:n,variables:i,errorPolicy:h,updateQueries:s,update:p}),this.broadcastQueries(),c=this,[2,new Promise((function(r,f){var v,b;c.getObservableFromLink(n,t.__assign(t.__assign({},y),{optimisticResponse:o}),i,!1).subscribe({next:function(t){if(ne(t)&&"none"===h)b=new Me({graphQLErrors:t.errors});else{if(a&&(a.loading=!1,a.error=null),"no-cache"!==d)try{c.markMutationResult({mutationId:e,result:t,document:n,variables:i,errorPolicy:h,updateQueries:s,update:p})}catch(e){return void(b=new Me({networkError:e}))}v=t}},error:function(t){a&&(a.loading=!1,a.error=t),o&&c.cache.removeOptimistic(e),c.broadcastQueries(),f(new Me({networkError:t}))},complete:function(){if(b&&a&&(a.loading=!1,a.error=b),o&&c.cache.removeOptimistic(e),c.broadcastQueries(),b)f(b);else{"function"==typeof u&&(u=u(v));var t=[];re(u)&&u.forEach((function(e){if("string"==typeof e)c.queries.forEach((function(r){var n=r.observableQuery;n&&n.queryName===e&&t.push(n.refetch())}));else{var r={query:e.query,variables:e.variables,fetchPolicy:"network-only"};e.context&&(r.context=e.context),t.push(c.query(r))}})),Promise.all(l?t:[]).then((function(){"ignore"===h&&v&&ne(v)&&delete v.errors,r(v)}),f)}}})}))]}}))}))},e.prototype.markMutationResult=function(e,t){var r=this;if(void 0===t&&(t=this.cache),Rt(e.result,e.errorPolicy)){var n=[{result:e.result.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}],i=e.updateQueries;i&&this.queries.forEach((function(o,s){var a=o.observableQuery,u=a&&a.queryName;if(u&&Qt.call(i,u)){var c=i[u],l=r.queries.get(s),p=l.document,f=l.variables,h=t.diff({query:p,variables:f,returnPartialData:!0,optimistic:!1}),d=h.result;if(h.complete&&d){var v=c(d,{mutationResult:e.result,queryName:p&&I(p)||void 0,queryVariables:f});v&&n.push({result:v,dataId:"ROOT_QUERY",query:p,variables:f})}}})),t.performTransaction((function(t){n.forEach((function(e){return t.write(e)}));var r=e.update;r&&r(t,e.result)}),null)}},e.prototype.markMutationOptimistic=function(e,r){var n=this,i="function"==typeof e?e(r.variables):e;return this.cache.recordOptimisticTransaction((function(e){try{n.markMutationResult(t.__assign(t.__assign({},r),{result:{data:i}}),e)}catch(e){}}),r.mutationId)},e.prototype.fetchQuery=function(e,t,r){return this.fetchQueryObservable(e,t,r).promise},e.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach((function(t,r){e[r]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}})),e},e.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},e.prototype.transform=function(e){var t,r=this.transformCache;if(!r.has(e)){var n=this.cache.transformDocument(e),i=(t=this.cache.transformForLink(n),A([V],Q(t))),o=this.localState.clientQuery(n),s=i&&this.localState.serverQuery(i),a={document:n,hasClientExports:v(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:o,serverQuery:s,defaultVars:C(M(n))},u=function(e){e&&!r.has(e)&&r.set(e,a)};u(e),u(n),u(o),u(s)}return r.get(e)},e.prototype.getVariables=function(e,r){return t.__assign(t.__assign({},this.transform(e).defaultVars),r)},e.prototype.watchQuery=function(e){void 0===(e=t.__assign(t.__assign({},e),{variables:this.getVariables(e.query,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var r=new qt(this.cache),n=new Fe({queryManager:this,queryInfo:r,options:e});return this.queries.set(n.queryId,r),r.init({document:e.query,observableQuery:n,variables:e.variables}),n},e.prototype.query=function(e){var t=this;r.invariant(e.query,15),r.invariant("Document"===e.query.kind,16),r.invariant(!e.returnPartialData,17),r.invariant(!e.pollInterval,18);var n=this.generateQueryId();return this.fetchQuery(n,e).finally((function(){return t.stopQuery(n)}))},e.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},e.prototype.generateRequestId=function(){return this.requestIdCounter++},e.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},e.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},e.prototype.clearStore=function(){return this.cancelPendingFetches(new r.InvariantError(19)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=exports.NetworkStatus.loading:e.stop()})),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset()},e.prototype.resetStore=function(){var e=this;return this.clearStore().then((function(){return e.reFetchObservableQueries()}))},e.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var r=[];return this.queries.forEach((function(n,i){var o=n.observableQuery;if(o&&o.hasObservers()){var s=o.options.fetchPolicy;o.resetLastResults(),"cache-only"===s||!e&&"standby"===s||r.push(o.refetch()),t.getQuery(i).setDiff(null)}})),this.broadcastQueries(),Promise.all(r)},e.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},e.prototype.startGraphQLSubscription=function(e){var t=this,r=e.query,n=e.fetchPolicy,i=e.errorPolicy,s=e.variables,a=e.context,u=void 0===a?{}:a;r=this.transform(r).document,s=this.getVariables(r,s);var c=function(e){return t.getObservableFromLink(r,u,e,!1).map((function(o){if("no-cache"!==n&&(Rt(o,i)&&t.cache.write({query:r,result:o.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries()),ne(o))throw new Me({graphQLErrors:o.errors});return o}))};if(this.transform(r).hasClientExports){var l=this.localState.addExportedVariables(r,s,u).then(c);return new o((function(e){var t=null;return l.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return c(s)},e.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},e.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.getQuery(e).stop(),this.queries.delete(e)},e.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},e.prototype.getLocalState=function(){return this.localState},e.prototype.getObservableFromLink=function(e,r,n,i){var s,a,u=this;void 0===i&&(i=null!==(s=null==r?void 0:r.queryDeduplication)&&void 0!==s?s:this.queryDeduplication);var c=this.transform(e).serverQuery;if(c){var l=this.inFlightLinkObservables,p=this.link,f={query:c,variables:n,operationName:I(c)||void 0,context:this.prepareContext(t.__assign(t.__assign({},r),{forceFetch:!i}))};if(r=f.context,i){var h=l.get(c)||new Map;l.set(c,h);var d=JSON.stringify(n);if(!(a=h.get(d))){var v=new te([ye(p,f)]);h.set(d,a=v),v.cleanup((function(){h.delete(d)&&h.size<1&&l.delete(c)}))}}else a=new te([ye(p,f)])}else a=new te([o.of({data:{}})]),r=this.prepareContext(r);var y=this.transform(e).clientQuery;return y&&(a=X(a,(function(e){return u.localState.runResolvers({document:y,remoteResult:e,context:r,variables:n})}))),a},e.prototype.getResultsFromLink=function(e,t,r){var n=e.lastRequestId;return X(this.getObservableFromLink(e.document,r.context,r.variables),(function(i){var o=re(i.errors);if(n>=e.lastRequestId){if(o&&"none"===r.errorPolicy)throw e.markError(new Me({graphQLErrors:i.errors}));e.markResult(i,r,t),e.markReady()}var s={data:i.data,loading:!1,networkStatus:e.networkStatus||exports.NetworkStatus.ready};return o&&"ignore"!==r.errorPolicy&&(s.errors=i.errors),s}),(function(t){var r=Re(t)?t:new Me({networkError:t});throw n>=e.lastRequestId&&e.markError(r),r}))},e.prototype.fetchQueryObservable=function(e,t,r){var n=this;void 0===r&&(r=exports.NetworkStatus.loading);var i=this.transform(t.query).document,o=this.getVariables(i,t.variables),s=this.getQuery(e),a=s.networkStatus,u=t.fetchPolicy,c=void 0===u?"cache-first":u,l=t.errorPolicy,p=void 0===l?"none":l,f=t.returnPartialData,h=void 0!==f&&f,d=t.notifyOnNetworkStatusChange,v=void 0!==d&&d,y=t.context,b=void 0===y?{}:y;("cache-first"===c||"cache-and-network"===c||"network-only"===c||"no-cache"===c)&&v&&"number"==typeof a&&a!==r&&Ie(r)&&("cache-first"!==c&&(c="cache-and-network"),h=!0);var g=Object.assign({},t,{query:i,variables:o,fetchPolicy:c,errorPolicy:p,returnPartialData:h,notifyOnNetworkStatusChange:v,context:b}),m=function(e){return g.variables=e,n.fetchQueryByPolicy(s,g,r)};this.fetchCancelFns.set(e,(function(e){Promise.resolve().then((function(){return _.cancel(e)}))}));var _=new te(this.transform(g.query).hasClientExports?this.localState.addExportedVariables(g.query,g.variables,g.context).then(m):m(g.variables));return _.cleanup((function(){n.fetchCancelFns.delete(e);var r=t.nextFetchPolicy;r&&(t.nextFetchPolicy=void 0,t.fetchPolicy="function"==typeof r?r.call(t,t.fetchPolicy||"cache-first"):r)})),_},e.prototype.fetchQueryByPolicy=function(e,r,n){var i=this,s=r.query,a=r.variables,u=r.fetchPolicy,c=r.errorPolicy,l=r.returnPartialData,p=r.context;e.init({document:s,variables:a,lastRequestId:this.generateRequestId(),networkStatus:n});var f=function(){return e.getDiff(a)},h=function(r,n){void 0===n&&(n=e.networkStatus||exports.NetworkStatus.loading);var u=r.result;var c=function(e){return o.of(t.__assign({data:e,loading:Ie(n),networkStatus:n},r.complete?null:{partial:!0}))};return i.transform(s).hasForcedResolvers?i.localState.runResolvers({document:s,remoteResult:{data:u},context:p,variables:a,onlyRunForcedResolvers:!0}).then((function(e){return c(e.data)})):c(u)},d=function(t){return i.getResultsFromLink(e,t,{variables:a,context:p,fetchPolicy:u,errorPolicy:c})};switch(u){default:case"cache-first":return(v=f()).complete?[h(v,e.markReady())]:l?[h(v),d(!0)]:[d(!0)];case"cache-and-network":var v;return(v=f()).complete||l?[h(v),d(!0)]:[d(!0)];case"cache-only":return[h(f(),e.markReady())];case"network-only":return[d(!0)];case"no-cache":return[d(!1)];case"standby":return[]}},e.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new qt(this.cache)),this.queries.get(e)},e.prototype.prepareContext=function(e){void 0===e&&(e={});var r=this.localState.prepareContext(e);return t.__assign(t.__assign({},r),{clientAwareness:this.clientAwareness})},e}();function It(e,r){return oe(e,r,r.variables&&{variables:t.__assign(t.__assign({},e.variables),r.variables)})}var Pt=function(){function e(e){var t=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=e.credentials,o=e.headers,s=e.cache,a=e.ssrMode,u=void 0!==a&&a,c=e.ssrForceFetchDelay,l=void 0===c?0:c,p=e.connectToDevTools,f=void 0===p?"object"==typeof window&&!window.__APOLLO_CLIENT__&&!1:p,h=e.queryDeduplication,d=void 0===h||h,v=e.defaultOptions,y=e.assumeImmutableResults,b=void 0!==y&&y,g=e.resolvers,m=e.typeDefs,_=e.fragmentMatcher,S=e.name,O=e.version,w=e.link;if(w||(w=n?new qe({uri:n,credentials:i,headers:o}):pe.empty()),!s)throw new r.InvariantError(9);this.link=w,this.cache=s,this.disableNetworkFetches=u||l>0,this.queryDeduplication=d,this.defaultOptions=v||{},this.typeDefs=m,l&&setTimeout((function(){return t.disableNetworkFetches=!1}),l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),f&&"object"==typeof window&&(window.__APOLLO_CLIENT__=this),this.version="3.3.10",this.localState=new wt({cache:s,client:this,resolvers:g,fragmentMatcher:_}),this.queryManager=new Mt({cache:this.cache,link:this.link,queryDeduplication:d,ssrMode:u,clientAwareness:{name:S,version:O},localState:this.localState,assumeImmutableResults:b,onBroadcast:f?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return e.prototype.stop=function(){this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=It(this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=t.__assign(t.__assign({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=It(this.defaultOptions.query,e)),r.invariant("cache-and-network"!==e.fetchPolicy,10),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=t.__assign(t.__assign({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=It(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},e.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},e.prototype.writeQuery=function(e){this.cache.writeQuery(e),this.queryManager.broadcastQueries()},e.prototype.writeFragment=function(e){this.cache.writeFragment(e),this.queryManager.broadcastQueries()},e.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},e.prototype.__requestRaw=function(e){return ye(this.link,e)},e.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.resetStoreCallbacks.map((function(e){return e()})))})).then((function(){return e.reFetchObservableQueries()}))},e.prototype.clearStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.clearStoreCallbacks.map((function(e){return e()})))}))},e.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},e.prototype.extract=function(e){return this.cache.extract(e)},e.prototype.restore=function(e){return this.cache.restore(e)},e.prototype.addResolvers=function(e){this.localState.addResolvers(e)},e.prototype.setResolvers=function(e){this.localState.setResolvers(e)},e.prototype.getResolvers=function(){return this.localState.getResolvers()},e.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},e.prototype.setLink=function(e){this.link=this.queryManager.link=e},e}();r.setVerbosity("log");var Ft=l.resetCaches,Ct=l.disableFragmentWarnings,Tt=l.enableExperimentalFragmentVariables,Dt=l.disableExperimentalFragmentVariables,jt=new(ie?WeakMap:Map);function Nt(){var e=jt.get(f.createContext);return e||((e=f.createContext({})).displayName="ApolloContext",jt.set(f.createContext,e)),e}var At;(At=exports.DocumentType||(exports.DocumentType={}))[At.Query=0]="Query",At[At.Mutation=1]="Mutation",At[At.Subscription=2]="Subscription";var Lt=new Map;function Vt(e){var t;switch(e){case exports.DocumentType.Query:t="Query";break;case exports.DocumentType.Mutation:t="Mutation";break;case exports.DocumentType.Subscription:t="Subscription"}return t}function zt(e){var t,n,i=Lt.get(e);if(i)return i;r.invariant(!!e&&!!e.kind,34);var o=e.definitions.filter((function(e){return"FragmentDefinition"===e.kind})),s=e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&"query"===e.operation})),a=e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})),u=e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&"subscription"===e.operation}));r.invariant(!o.length||s.length||a.length||u.length,35),r.invariant(s.length+a.length+u.length<=1,36),n=s.length?exports.DocumentType.Query:exports.DocumentType.Mutation,s.length||a.length||(n=exports.DocumentType.Subscription);var c=s.length?s:a.length?a:u;r.invariant(1===c.length,37);var l=c[0];t=l.variableDefinitions||[];var p={name:l.name&&"Name"===l.name.kind?l.name.value:"data",type:n,variables:t};return Lt.set(e,p),p}var Bt=function(){function e(e,t){this.isMounted=!1,this.previousOptions={},this.context={},this.options={},this.options=e||{},this.context=t||{}}return e.prototype.getOptions=function(){return this.options},e.prototype.setOptions=function(e,t){void 0===t&&(t=!1),t&&!a.equal(this.options,e)&&(this.previousOptions=this.options),this.options=e},e.prototype.unmount=function(){this.isMounted=!1},e.prototype.refreshClient=function(){var e=this.options&&this.options.client||this.context&&this.context.client;r.invariant(!!e,29);var t=!1;return e!==this.client&&(t=!0,this.client=e,this.cleanup()),{client:this.client,isNew:t}},e.prototype.verifyDocumentType=function(e,t){var n=zt(e);Vt(t),Vt(n.type);r.invariant(n.type===t,30)},e}(),Wt=function(e){function r(t){var r=t.options,n=t.context,i=t.setResult,o=e.call(this,r,n)||this;return o.currentObservable={},o.setResult=i,o.initialize(r),o}return t.__extends(r,e),r.prototype.execute=function(e){if(!0===this.getOptions().skip)return this.cleanup(),{loading:!1,error:void 0,data:void 0,variables:this.getOptions().variables};var r=e;this.refreshClient().isNew&&(r=this.getLoadingResult());var n=this.getOptions().shouldResubscribe;return"function"==typeof n&&(n=!!n(this.getOptions())),!1!==n&&this.previousOptions&&Object.keys(this.previousOptions).length>0&&(this.previousOptions.subscription!==this.getOptions().subscription||!a.equal(this.previousOptions.variables,this.getOptions().variables)||this.previousOptions.skip!==this.getOptions().skip)&&(this.cleanup(),r=this.getLoadingResult()),this.initialize(this.getOptions()),this.startSubscription(),this.previousOptions=this.getOptions(),t.__assign(t.__assign({},r),{variables:this.getOptions().variables})},r.prototype.afterExecute=function(){this.isMounted=!0},r.prototype.cleanup=function(){this.endSubscription(),delete this.currentObservable.query},r.prototype.initialize=function(e){this.currentObservable.query||!0===this.getOptions().skip||(this.currentObservable.query=this.refreshClient().client.subscribe({query:e.subscription,variables:e.variables,fetchPolicy:e.fetchPolicy}))},r.prototype.startSubscription=function(){this.currentObservable.subscription||(this.currentObservable.subscription=this.currentObservable.query.subscribe({next:this.updateCurrentData.bind(this),error:this.updateError.bind(this),complete:this.completeSubscription.bind(this)}))},r.prototype.getLoadingResult=function(){return{loading:!0,error:void 0,data:void 0}},r.prototype.updateResult=function(e){this.isMounted&&this.setResult(e)},r.prototype.updateCurrentData=function(e){var t=this.getOptions().onSubscriptionData;this.updateResult({data:e.data,loading:!1,error:void 0}),t&&t({client:this.refreshClient().client,subscriptionData:e})},r.prototype.updateError=function(e){this.updateResult({error:e,loading:!1})},r.prototype.completeSubscription=function(){var e=this.getOptions().onSubscriptionComplete;e&&e(),this.endSubscription()},r.prototype.endSubscription=function(){this.currentObservable.subscription&&(this.currentObservable.subscription.unsubscribe(),delete this.currentObservable.subscription)},r}(Bt),Ut=function(e){function r(t){var r=t.options,n=t.context,i=t.result,o=t.setResult,s=e.call(this,r,n)||this;return s.runMutation=function(e){void 0===e&&(e={}),s.onMutationStart();var t=s.generateNewMutationId();return s.mutate(e).then((function(e){return s.onMutationCompleted(e,t),e})).catch((function(e){if(s.onMutationError(e,t),!s.getOptions().onError)throw e}))},s.verifyDocumentType(r.mutation,exports.DocumentType.Mutation),s.result=i,s.setResult=o,s.mostRecentMutationId=0,s}return t.__extends(r,e),r.prototype.execute=function(e){return this.isMounted=!0,this.verifyDocumentType(this.getOptions().mutation,exports.DocumentType.Mutation),[this.runMutation,t.__assign(t.__assign({},e),{client:this.refreshClient().client})]},r.prototype.afterExecute=function(){return this.isMounted=!0,this.unmount.bind(this)},r.prototype.cleanup=function(){},r.prototype.mutate=function(e){return this.refreshClient().client.mutate(It(this.getOptions(),e))},r.prototype.onMutationStart=function(){this.result.loading||this.getOptions().ignoreResults||this.updateResult({loading:!0,error:void 0,data:void 0,called:!0})},r.prototype.onMutationCompleted=function(e,t){var r=this.getOptions(),n=r.onCompleted,i=r.ignoreResults,o=e.data,s=e.errors,a=s&&s.length>0?new Me({graphQLErrors:s}):void 0;this.isMostRecentMutation(t)&&!i&&this.updateResult({called:!0,loading:!1,data:o,error:a}),n&&n(o)},r.prototype.onMutationError=function(e,t){var r=this.getOptions().onError;this.isMostRecentMutation(t)&&this.updateResult({loading:!1,error:e,data:void 0,called:!0}),r&&r(e)},r.prototype.generateNewMutationId=function(){return++this.mostRecentMutationId},r.prototype.isMostRecentMutation=function(e){return this.mostRecentMutationId===e},r.prototype.updateResult=function(e){!this.isMounted||this.previousResult&&a.equal(this.previousResult,e)||(this.setResult(e),this.previousResult=e)},r}(Bt),Kt=function(e){function r(r){var n=r.options,i=r.context,o=r.onNewData,s=e.call(this,n,i)||this;return s.runLazy=!1,s.previous=Object.create(null),s.runLazyQuery=function(e){s.cleanup(),s.runLazy=!0,s.lazyOptions=e,s.onNewData()},s.getQueryResult=function(){var e=s.observableQueryFields(),r=s.getOptions();if(r.skip)e=t.__assign(t.__assign({},e),{data:void 0,error:void 0,loading:!1,networkStatus:exports.NetworkStatus.ready,called:!0});else if(s.currentObservable){var n=s.currentObservable.getCurrentResult(),i=n.data,o=n.loading,a=n.partial,u=n.networkStatus,c=n.errors,l=n.error;if(c&&c.length>0&&(l=new Me({graphQLErrors:c})),e=t.__assign(t.__assign({},e),{data:i,loading:o,networkStatus:u,error:l,called:!0}),o);else if(l)Object.assign(e,{data:(s.currentObservable.getLastResult()||{}).data});else{var p=s.currentObservable.options.fetchPolicy;if(r.partialRefetch&&a&&(!i||0===Object.keys(i).length)&&"cache-only"!==p)return Object.assign(e,{loading:!0,networkStatus:exports.NetworkStatus.loading}),e.refetch(),e}}e.client=s.client,s.setOptions(r,!0);var f=s.previous.result;return s.previous.loading=f&&f.loading||!1,e.previousData=f&&(f.data||f.previousData),s.previous.result=e,s.currentObservable&&s.currentObservable.resetQueryStoreErrors(),e},s.obsRefetch=function(e){var t;return null===(t=s.currentObservable)||void 0===t?void 0:t.refetch(e)},s.obsFetchMore=function(e){return s.currentObservable.fetchMore(e)},s.obsUpdateQuery=function(e){return s.currentObservable.updateQuery(e)},s.obsStartPolling=function(e){var t;null===(t=s.currentObservable)||void 0===t||t.startPolling(e)},s.obsStopPolling=function(){var e;null===(e=s.currentObservable)||void 0===e||e.stopPolling()},s.obsSubscribeToMore=function(e){return s.currentObservable.subscribeToMore(e)},s.onNewData=o,s}return t.__extends(r,e),r.prototype.execute=function(){this.refreshClient();var e=this.getOptions(),t=e.skip,r=e.query;return(t||r!==this.previous.query)&&(this.removeQuerySubscription(),this.removeObservable(!t),this.previous.query=r),this.updateObservableQuery(),this.isMounted&&this.startQuerySubscription(),this.getExecuteSsrResult()||this.getExecuteResult()},r.prototype.executeLazy=function(){return this.runLazy?[this.runLazyQuery,this.execute()]:[this.runLazyQuery,{loading:!1,networkStatus:exports.NetworkStatus.ready,called:!1,data:void 0}]},r.prototype.fetchData=function(){var e=this,t=this.getOptions();return!t.skip&&!1!==t.ssr&&new Promise((function(t){return e.startQuerySubscription(t)}))},r.prototype.afterExecute=function(e){var t=(void 0===e?{}:e).lazy,r=void 0!==t&&t;return this.isMounted=!0,r&&!this.runLazy||this.handleErrorOrCompleted(),this.previousOptions=this.getOptions(),this.unmount.bind(this)},r.prototype.cleanup=function(){this.removeQuerySubscription(),this.removeObservable(!0),delete this.previous.result},r.prototype.getOptions=function(){var r=e.prototype.getOptions.call(this);return this.lazyOptions&&(r.variables=t.__assign(t.__assign({},r.variables),this.lazyOptions.variables),r.context=t.__assign(t.__assign({},r.context),this.lazyOptions.context)),this.runLazy&&delete r.skip,r},r.prototype.ssrInitiated=function(){return this.context&&this.context.renderPromises},r.prototype.getExecuteResult=function(){var e=this.getQueryResult();return this.startQuerySubscription(),e},r.prototype.getExecuteSsrResult=function(){var e,r=this.getOptions(),n=r.ssr,i=r.skip,o=!1===n,s=this.refreshClient().client.disableNetworkFetches,a=t.__assign({loading:!0,networkStatus:exports.NetworkStatus.loading,called:!0,data:void 0,stale:!1,client:this.client},this.observableQueryFields());return o&&(this.ssrInitiated()||s)?(this.previous.result=a,a):(this.ssrInitiated()&&(e=i?this.getQueryResult():this.context.renderPromises.addQueryPromise(this,this.getQueryResult)||a),e)},r.prototype.prepareObservableQueryOptions=function(){var e=this.getOptions();this.verifyDocumentType(e.query,exports.DocumentType.Query);var r=e.displayName||"Query";return!this.ssrInitiated()||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e.fetchPolicy="cache-first"),t.__assign(t.__assign({},e),{displayName:r,context:e.context})},r.prototype.initializeObservableQuery=function(){if(this.ssrInitiated()&&(this.currentObservable=this.context.renderPromises.getSSRObservable(this.getOptions())),!this.currentObservable){var e=this.prepareObservableQueryOptions();this.previous.observableQueryOptions=t.__assign(t.__assign({},e),{children:null}),this.currentObservable=this.refreshClient().client.watchQuery(t.__assign({},e)),this.ssrInitiated()&&this.context.renderPromises.registerSSRObservable(this.currentObservable,e)}},r.prototype.updateObservableQuery=function(){if(this.currentObservable){if(!this.getOptions().skip){var e=t.__assign(t.__assign({},this.prepareObservableQueryOptions()),{children:null});a.equal(e,this.previous.observableQueryOptions)||(this.previous.observableQueryOptions=e,this.currentObservable.setOptions(e).catch((function(){})))}}else this.initializeObservableQuery()},r.prototype.startQuerySubscription=function(e){var t=this;void 0===e&&(e=this.onNewData),this.currentSubscription||this.getOptions().skip||(this.currentSubscription=this.currentObservable.subscribe({next:function(r){var n=r.loading,i=r.networkStatus,o=r.data,s=t.previous.result;s&&s.loading===n&&s.networkStatus===i&&a.equal(s.data,o)||e()},error:function(r){if(t.resubscribeToQuery(),!r.hasOwnProperty("graphQLErrors"))throw r;var n=t.previous.result;(n&&n.loading||!a.equal(r,t.previous.error))&&(t.previous.error=r,e())}}))},r.prototype.resubscribeToQuery=function(){this.removeQuerySubscription();var e=this.currentObservable;if(e){var t=e.getLastError(),r=e.getLastResult();e.resetLastResults(),this.startQuerySubscription(),Object.assign(e,{lastError:t,lastResult:r})}},r.prototype.handleErrorOrCompleted=function(){if(this.currentObservable&&this.previous.result){var e=this.previous.result,t=e.data,r=e.loading,n=e.error;if(!r){var i=this.getOptions(),o=i.query,s=i.variables,u=i.onCompleted,c=i.onError,l=i.skip;if(this.previousOptions&&!this.previous.loading&&a.equal(this.previousOptions.query,o)&&a.equal(this.previousOptions.variables,s))return;!u||n||l?c&&n&&c(n):u(t)}}},r.prototype.removeQuerySubscription=function(){this.currentSubscription&&(this.currentSubscription.unsubscribe(),delete this.currentSubscription)},r.prototype.removeObservable=function(e){this.currentObservable&&(this.currentObservable.tearDownQuery(),e&&delete this.currentObservable)},r.prototype.observableQueryFields=function(){var e;return{variables:null===(e=this.currentObservable)||void 0===e?void 0:e.variables,refetch:this.obsRefetch,fetchMore:this.obsFetchMore,updateQuery:this.obsUpdateQuery,startPolling:this.obsStartPolling,stopPolling:this.obsStopPolling,subscribeToMore:this.obsSubscribeToMore}},r}(Bt);function Jt(e,r,n){void 0===n&&(n=!1);var i=p.useContext(Nt()),o=p.useReducer((function(e){return e+1}),0),s=o[0],u=o[1],c=r?t.__assign(t.__assign({},r),{query:e}):{query:e},l=p.useRef(),f=l.current||new Kt({options:c,context:i,onNewData:function(){!f.ssrInitiated()&&l.current?Promise.resolve().then(u):u()}});f.setOptions(c),f.context=i,f.ssrInitiated()&&!l.current&&(l.current=f);var h,d,v,y={options:t.__assign(t.__assign({},c),{onError:void 0,onCompleted:void 0}),context:i,tick:s},b=(h=function(){return n?f.executeLazy():f.execute()},d=y,(v=p.useRef()).current&&a.equal(d,v.current.key)||(v.current={key:d,value:h()}),v.current.value),g=n?b[1]:b;return p.useEffect((function(){return l.current||(l.current=f),function(){return f.cleanup()}}),[]),p.useEffect((function(){return f.afterExecute({lazy:n})}),[g.loading,g.networkStatus,g.error,g.data]),b}exports.setLogVerbosity=r.setVerbosity,exports.Observable=o,exports.gql=l,exports.ApolloCache=Te,exports.ApolloClient=Pt,exports.ApolloConsumer=function(e){var t=Nt();return f.createElement(t.Consumer,null,(function(t){return r.invariant(t&&t.client,27),e.children(t.client)}))},exports.ApolloError=Me,exports.ApolloLink=pe,exports.ApolloProvider=function(e){var t=e.client,n=e.children,i=Nt();return f.createElement(i.Consumer,null,(function(e){return void 0===e&&(e={}),t&&e.client!==t&&(e=Object.assign({},e,{client:t})),r.invariant(e.client,28),f.createElement(i.Provider,{value:e},n)}))},exports.HttpLink=qe,exports.InMemoryCache=Ot,exports.MissingFieldError=De,exports.ObservableQuery=Fe,exports.checkFetcher=Oe,exports.concat=ve,exports.createHttpLink=Ee,exports.createSignalIfSupported=we,exports.defaultDataIdFromObject=lt,exports.disableExperimentalFragmentVariables=Dt,exports.disableFragmentWarnings=Ct,exports.empty=fe,exports.enableExperimentalFragmentVariables=Tt,exports.execute=ye,exports.fallbackHttpConfig=_e,exports.from=he,exports.fromError=se,exports.fromPromise=function(e){return new o((function(t){e.then((function(e){t.next(e),t.complete()})).catch(t.error.bind(t))}))},exports.getApolloContext=Nt,exports.isApolloError=Re,exports.isReference=_,exports.makeReference=m,exports.makeVar=at,exports.mergeOptions=It,exports.operationName=Vt,exports.parseAndCheckHttpResponse=ge,exports.parser=zt,exports.resetApolloContext=Nt,exports.resetCaches=Ft,exports.rewriteURIForGET=ke,exports.selectHttpOptionsAndBody=Se,exports.selectURI=xe,exports.serializeFetchParameter=me,exports.split=de,exports.throwServerError=ae,exports.toPromise=function(e){var t=!1;return new Promise((function(r,n){e.subscribe({next:function(e){t||(t=!0,r(e))},error:n})}))},exports.useApolloClient=function(){var e=f.useContext(Nt()).client;return r.invariant(e,33),e},exports.useLazyQuery=function(e,t){return Jt(e,t,!0)},exports.useMutation=function(e,r){var n=p.useContext(Nt()),i=p.useState({called:!1,loading:!1}),o=i[0],s=i[1],a=r?t.__assign(t.__assign({},r),{mutation:e}):{mutation:e},u=p.useRef(),c=(u.current||(u.current=new Ut({options:a,context:n,result:o,setResult:s})),u.current);return c.setOptions(a),c.context=n,p.useEffect((function(){return c.afterExecute()})),c.execute(o)},exports.useQuery=function(e,t){return Jt(e,t,!1)},exports.useReactiveVar=function(e){var t=e(),r=p.useState(t)[1];return p.useEffect((function(){return e.onNextChange(r)}),[t]),p.useEffect((function(){r(e())}),[]),t},exports.useSubscription=function(e,r){var n=p.useContext(Nt()),i=r?t.__assign(t.__assign({},r),{subscription:e}):{subscription:e},o=p.useState({loading:!i.skip,error:void 0,data:void 0}),s=o[0],a=o[1],u=p.useRef(),c=(u.current||(u.current=new Wt({options:i,context:n,setResult:a})),u.current);return c.setOptions(i,!0),c.context=n,p.useEffect((function(){return c.afterExecute()})),p.useEffect((function(){return c.cleanup.bind(c)}),[]),c.execute(s)};
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("ts-invariant"),n=require("graphql"),i=e(require("fast-json-stable-stringify")),o=e(require("zen-observable"));require("symbol-observable");var s=require("@wry/equality"),a=require("optimism"),u=require("@wry/context"),c=e(require("graphql-tag")),l=require("react"),p=e(l);function f(e,t){var n=e.directives;return!n||!n.length||function(e){var t=[];e&&e.length&&e.forEach((function(e){if(function(e){var t=e.name.value;return"skip"===t||"include"===t}(e)){var n=e.arguments;e.name.value;r.invariant(n&&1===n.length,39);var i=n[0];r.invariant(i.name&&"if"===i.name.value,40);var o=i.value;r.invariant(o&&("Variable"===o.kind||"BooleanValue"===o.kind),41),t.push({directive:e,ifArgument:i})}}));return t}(n).every((function(e){var n=e.directive,i=e.ifArgument,o=!1;return"Variable"===i.value.kind?(o=t&&t[i.value.name.value],r.invariant(void 0!==o,38)):o=i.value.value,"skip"===n.name.value?!o:o}))}function h(e,t){return function(e){var t=[];return n.visit(e,{Directive:function(e){t.push(e.name.value)}}),t}(t).some((function(t){return e.indexOf(t)>-1}))}function d(e){return e&&h(["client"],e)&&h(["export"],e)}function v(e,n){var i=n,o=[];return e.definitions.forEach((function(e){if("OperationDefinition"===e.kind)throw new r.InvariantError(42);"FragmentDefinition"===e.kind&&o.push(e)})),void 0===i&&(r.invariant(1===o.length,43),i=o[0].name.value),t.__assign(t.__assign({},e),{definitions:t.__spreadArrays([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}],e.definitions)})}function y(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function b(e,t){switch(e.kind){case"InlineFragment":return e;case"FragmentSpread":var n=t&&t[e.name.value];return r.invariant(n,44),n;default:return null}}function g(e){return{__ref:String(e)}}function m(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function _(e,t,n,i){if(function(e){return"IntValue"===e.kind}(n)||function(e){return"FloatValue"===e.kind}(n))e[t.value]=Number(n.value);else if(function(e){return"BooleanValue"===e.kind}(n)||function(e){return"StringValue"===e.kind}(n))e[t.value]=n.value;else if(function(e){return"ObjectValue"===e.kind}(n)){var o={};n.fields.map((function(e){return _(o,e.name,e.value,i)})),e[t.value]=o}else if(function(e){return"Variable"===e.kind}(n)){var s=(i||{})[n.name.value];e[t.value]=s}else if(function(e){return"ListValue"===e.kind}(n))e[t.value]=n.values.map((function(e){var r={};return _(r,t,e,i),r[t.value]}));else if(function(e){return"EnumValue"===e.kind}(n))e[t.value]=n.value;else{if(!function(e){return"NullValue"===e.kind}(n))throw new r.InvariantError(53);e[t.value]=null}}var S=["connection","include","skip","client","rest","export"];function O(e,t,r){if(t&&r&&r.connection&&r.connection.key){if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var o={};return n.forEach((function(e){o[e]=t[e]})),r.connection.key+"("+JSON.stringify(o)+")"}return r.connection.key}var s=e;if(t){var a=i(t);s+="("+a+")"}return r&&Object.keys(r).forEach((function(e){-1===S.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?s+="@"+e+"("+JSON.stringify(r[e])+")":s+="@"+e)})),s}function w(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return _(r,n,i,t)})),r}return null}function x(e){return e.alias?e.alias.value:e.name.value}function k(e,t,r){if("string"==typeof e.__typename)return e.__typename;for(var n=0,i=t.selections;n<i.length;n++){var o=i[n];if(E(o)){if("__typename"===o.name.value)return e[x(o)]}else{var s=k(e,b(o,r).selectionSet,r);if("string"==typeof s)return s}}}function E(e){return"Field"===e.kind}function q(e){return"InlineFragment"===e.kind}function R(e){r.invariant(e&&"Document"===e.kind,45);var t=e.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(e){if("OperationDefinition"!==e.kind)throw new r.InvariantError(46);return e}));return r.invariant(t.length<=1,47),e}function Q(e){return R(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function M(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||null}function P(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function I(e){var t;R(e);for(var n=0,i=e.definitions;n<i.length;n++){var o=i[n];if("OperationDefinition"===o.kind){var s=o.operation;if("query"===s||"mutation"===s||"subscription"===s)return o}"FragmentDefinition"!==o.kind||t||(t=o)}if(t)return t;throw new r.InvariantError(52)}function F(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&_(t,e.variable.name,e.defaultValue)})),t}function C(e,t,r){var n=0;return e.forEach((function(r,i){t.call(this,r,i,e)&&(e[n++]=r)}),r),e.length=n,e}var T={kind:"Field",name:{kind:"Name",value:"__typename"}};function D(e){return function e(t,r){return t.selectionSet.selections.every((function(t){return"FragmentSpread"===t.kind&&e(r[t.name.value],r)}))}(Q(e)||function(e){r.invariant("Document"===e.kind,49),r.invariant(e.definitions.length<=1,50);var t=e.definitions[0];return r.invariant("FragmentDefinition"===t.kind,51),t}(e),y(P(e)))?null:e}function j(e){return function(t){return e.some((function(e){return e.name&&e.name===t.name.value||e.test&&e.test(t)}))}}function N(e,r){var i=Object.create(null),o=[],s=Object.create(null),a=[],u=D(n.visit(r,{Variable:{enter:function(e,t,r){"VariableDefinition"!==r.kind&&(i[e.name.value]=!0)}},Field:{enter:function(t){if(e&&t.directives&&(e.some((function(e){return e.remove}))&&t.directives&&t.directives.some(j(e))))return t.arguments&&t.arguments.forEach((function(e){"Variable"===e.value.kind&&o.push({name:e.value.name.value})})),t.selectionSet&&function e(t){var r=[];return t.selections.forEach((function(t){(E(t)||q(t))&&t.selectionSet?e(t.selectionSet).forEach((function(e){return r.push(e)})):"FragmentSpread"===t.kind&&r.push(t)})),r}(t.selectionSet).forEach((function(e){a.push({name:e.name.value})})),null}},FragmentSpread:{enter:function(e){s[e.name.value]=!0}},Directive:{enter:function(t){if(j(e)(t))return null}}}));return u&&C(o,(function(e){return!!e.name&&!i[e.name]})).length&&(u=function(e,r){var i=function(e){return function(t){return e.some((function(e){return t.value&&"Variable"===t.value.kind&&t.value.name&&(e.name===t.value.name.value||e.test&&e.test(t))}))}}(e);return D(n.visit(r,{OperationDefinition:{enter:function(r){return t.__assign(t.__assign({},r),{variableDefinitions:r.variableDefinitions?r.variableDefinitions.filter((function(t){return!e.some((function(e){return e.name===t.variable.name.value}))})):[]})}},Field:{enter:function(t){if(e.some((function(e){return e.remove}))){var r=0;if(t.arguments&&t.arguments.forEach((function(e){i(e)&&(r+=1)})),1===r)return null}}},Argument:{enter:function(e){if(i(e))return null}}}))}(o,u)),u&&C(a,(function(e){return!!e.name&&!s[e.name]})).length&&(u=function(e,t){function r(t){if(e.some((function(e){return e.name===t.name.value})))return null}return D(n.visit(t,{FragmentSpread:{enter:r},FragmentDefinition:{enter:r}}))}(a,u)),u}function A(e){return n.visit(R(e),{SelectionSet:{enter:function(e,r,n){if(!n||"OperationDefinition"!==n.kind){var i=e.selections;if(i)if(!i.some((function(e){return E(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var o=n;if(!(E(o)&&o.directives&&o.directives.some((function(e){return"export"===e.name.value}))))return t.__assign(t.__assign({},e),{selections:t.__spreadArrays(i,[T])})}}}}})}A.added=function(e){return e===T};var L={test:function(e){var t="connection"===e.name.value;return t&&(!e.arguments||e.arguments.some((function(e){return"key"===e.name.value}))),t}};function V(e){return"query"===I(e).operation?e:n.visit(e,{OperationDefinition:{enter:function(e){return t.__assign(t.__assign({},e),{operation:"query"})}}})}var z=Object.prototype.hasOwnProperty;function B(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return W(e)}function W(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new J,i=1;i<r;++i)t=n.merge(t,e[i]);return t}function U(e){return null!==e&&"object"==typeof e}var K=function(e,t,r){return this.merge(e[r],t[r])},J=function(){function e(e){void 0===e&&(e=K),this.reconciler=e,this.isObject=U,this.pastCopies=new Set}return e.prototype.merge=function(e,r){for(var n=this,i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];return U(r)&&U(e)?(Object.keys(r).forEach((function(o){if(z.call(e,o)){var s=e[o];if(r[o]!==s){var a=n.reconciler.apply(n,t.__spreadArrays([e,r,o],i));a!==s&&((e=n.shallowCopyForMerge(e))[o]=a)}}else(e=n.shallowCopyForMerge(e))[o]=r[o]})),e):r},e.prototype.shallowCopyForMerge=function(e){return U(e)&&!this.pastCopies.has(e)&&(e=Array.isArray(e)?e.slice(0):t.__assign({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e)),e},e}(),G=Object.prototype.toString;function H(e){return function e(t,r){switch(G.call(t)){case"[object Array]":if((r=r||new Map).has(t))return r.get(t);var n=t.slice(0);return r.set(t,n),n.forEach((function(t,i){n[i]=e(t,r)})),n;case"[object Object]":if((r=r||new Map).has(t))return r.get(t);var i=Object.create(Object.getPrototypeOf(t));return r.set(t,i),Object.keys(t).forEach((function(n){i[n]=e(t[n],r)})),i;default:return t}}(e)}function Y(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function $(e,t,r){return new o((function(n){var i=n.next,o=n.error,s=n.complete,a=0,u=!1,c={then:function(e){return new Promise((function(t){return t(e())}))}};function l(e,t){return e?function(t){++a;var r=function(){return e(t)};c=c.then(r,r).then((function(e){--a,i&&i.call(n,e),u&&p.complete()}),(function(e){throw--a,e})).catch((function(e){o&&o.call(n,e)}))}:function(e){return t&&t.call(n,e)}}var p={next:l(t,i),error:l(r,o),complete:function(){u=!0,a||s&&s.call(n)}},f=e.subscribe(p);return function(){return f.unsubscribe()}}))}function X(e){function t(t){Object.defineProperty(e,t,{value:o})}return"function"==typeof Symbol&&Symbol.species&&t(Symbol.species),t("@@species"),e}function Z(e){return e&&"function"==typeof e.then}var ee=function(e){function r(t){var r=e.call(this,(function(e){return r.addObserver(e),function(){return r.removeObserver(e)}}))||this;return r.observers=new Set,r.addCount=0,r.promise=new Promise((function(e,t){r.resolve=e,r.reject=t})),r.handlers={next:function(e){null!==r.sub&&(r.latest=["next",e],Y(r.observers,"next",e))},error:function(e){var t=r.sub;null!==t&&(t&&Promise.resolve().then((function(){return t.unsubscribe()})),r.sub=null,r.latest=["error",e],r.reject(e),Y(r.observers,"error",e))},complete:function(){if(null!==r.sub){var e=r.sources.shift();e?Z(e)?e.then((function(e){return r.sub=e.subscribe(r.handlers)})):r.sub=e.subscribe(r.handlers):(r.sub=null,r.latest&&"next"===r.latest[0]?r.resolve(r.latest[1]):r.resolve(),Y(r.observers,"complete"))}}},r.cancel=function(e){r.reject(e),r.sources=[],r.handlers.complete()},r.promise.catch((function(e){})),"function"==typeof t&&(t=[new o(t)]),Z(t)?t.then((function(e){return r.start(e)}),r.handlers.error):r.start(t),r}return t.__extends(r,e),r.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},r.prototype.deliverLastMessage=function(e){if(this.latest){var t=this.latest[0],r=e[t];r&&r.call(e,this.latest[1]),null===this.sub&&"next"===t&&e.complete&&e.complete()}},r.prototype.addObserver=function(e){this.observers.has(e)||(this.deliverLastMessage(e),this.observers.add(e),++this.addCount)},r.prototype.removeObserver=function(e,t){this.observers.delete(e)&&--this.addCount<1&&!t&&this.handlers.error(new Error("Observable cancelled prematurely"))},r.prototype.cleanup=function(e){var t=this,r=!1,n=function(){r||(r=!0,t.observers.delete(i),e())},i={next:n,error:n,complete:n},o=this.addCount;this.addObserver(i),this.addCount=o},r}(o);function te(e){return Array.isArray(e)&&e.length>0}function re(e){return e.errors&&e.errors.length>0||!1}X(ee);var ne="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product);function ie(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Object.create(null);return e.forEach((function(e){e&&Object.keys(e).forEach((function(t){var n=e[t];void 0!==n&&(r[t]=n)}))})),r}function oe(e){return new o((function(t){t.error(e)}))}var se=function(e,t,r){var n=new Error(r);throw n.name="ServerError",n.response=e,n.statusCode=e.status,n.result=t,n};function ae(e,t){return t?t(e):o.of()}function ue(e){return"function"==typeof e?new le(e):e}function ce(e){return e.request.length<=1}!function(e){function r(t,r){var n=e.call(this,t)||this;return n.link=r,n}t.__extends(r,e)}(Error);var le=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e((function(){return o.of()}))},e.from=function(t){return 0===t.length?e.empty():t.map(ue).reduce((function(e,t){return e.concat(t)}))},e.split=function(t,r,n){var i=ue(r),s=ue(n||new e(ae));return ce(i)&&ce(s)?new e((function(e){return t(e)?i.request(e)||o.of():s.request(e)||o.of()})):new e((function(e,r){return t(e)?i.request(e,r)||o.of():s.request(e,r)||o.of()}))},e.execute=function(e,n){return e.request(function(e,r){var n=t.__assign({},e);return Object.defineProperty(r,"setContext",{enumerable:!1,value:function(e){n="function"==typeof e?t.__assign(t.__assign({},n),e(n)):t.__assign(t.__assign({},n),e)}}),Object.defineProperty(r,"getContext",{enumerable:!1,value:function(){return t.__assign({},n)}}),r}(n.context,function(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?M(t.query)||void 0:""),t}(function(e){for(var t=["query","operationName","variables","extensions","context"],n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];if(t.indexOf(o)<0)throw new r.InvariantError(26)}return e}(n))))||o.of()},e.concat=function(t,r){var n=ue(t);if(ce(n))return n;var i=ue(r);return ce(i)?new e((function(e){return n.request(e,(function(e){return i.request(e)||o.of()}))||o.of()})):new e((function(e,t){return n.request(e,(function(e){return i.request(e,t)||o.of()}))||o.of()}))},e.prototype.split=function(t,r,n){return this.concat(e.split(t,r,n||new e(ae)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw new r.InvariantError(21)},e.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},e.prototype.setOnError=function(e){return this.onError=e,this},e}(),pe=le.empty,fe=le.from,he=le.split,de=le.concat,ve=le.execute,ye=Object.prototype.hasOwnProperty;function be(e){return function(t){return t.text().then((function(e){try{return JSON.parse(e)}catch(n){var r=n;throw r.name="ServerParseError",r.response=t,r.statusCode=t.status,r.bodyText=e,r}})).then((function(r){return t.status>=300&&se(t,r,"Response not successful: Received status code "+t.status),Array.isArray(r)||ye.call(r,"data")||ye.call(r,"errors")||se(t,r,"Server response was missing for query '"+(Array.isArray(e)?e.map((function(e){return e.operationName})):e.operationName)+"'."),r}))}}var ge=function(e,t){var n;try{n=JSON.stringify(e)}catch(e){var i=new r.InvariantError(23);throw i.parseError=e,i}return n},me={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},_e=function(e,r){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];var s=t.__assign(t.__assign({},r.options),{headers:r.headers,credentials:r.credentials}),a=r.http||{};i.forEach((function(e){s=t.__assign(t.__assign(t.__assign({},s),e.options),{headers:t.__assign(t.__assign({},s.headers),e.headers)}),e.credentials&&(s.credentials=e.credentials),a=t.__assign(t.__assign({},a),e.http)}));var u=e.operationName,c=e.extensions,l=e.variables,p=e.query,f={operationName:u,variables:l};return a.includeExtensions&&(f.extensions=c),a.includeQuery&&(f.query=n.print(p)),{options:s,body:f}},Se=function(e){if(!e&&"undefined"==typeof fetch)throw new r.InvariantError(22)},Oe=function(){if("undefined"==typeof AbortController)return{controller:!1,signal:!1};var e=new AbortController;return{controller:e,signal:e.signal}},we=function(e,t){var r=e.getContext().uri;return r||("function"==typeof t?t(e):t||"/graphql")};function xe(e,t){var r=[],n=function(e,t){r.push(e+"="+encodeURIComponent(t))};if("query"in t&&n("query",t.query),t.operationName&&n("operationName",t.operationName),t.variables){var i=void 0;try{i=ge(t.variables)}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=ge(t.extensions)}catch(e){return{parseError:e}}n("extensions",o)}var s="",a=e,u=e.indexOf("#");-1!==u&&(s=e.substr(u),a=e.substr(0,u));var c=-1===a.indexOf("?")?"?":"&";return{newURI:a+c+r.join("&")+s}}var ke=function(e){void 0===e&&(e={});var r=e.uri,i=void 0===r?"/graphql":r,s=e.fetch,a=e.includeExtensions,u=e.useGETForQueries,c=e.includeUnusedVariables,l=void 0!==c&&c,p=t.__rest(e,["uri","fetch","includeExtensions","useGETForQueries","includeUnusedVariables"]);Se(s),s||(s=fetch);var f={http:{includeExtensions:a},options:p.fetchOptions,credentials:p.credentials,headers:p.headers};return new le((function(e){var r=we(e,i),a=e.getContext(),c={};if(a.clientAwareness){var p=a.clientAwareness,h=p.name,d=p.version;h&&(c["apollographql-client-name"]=h),d&&(c["apollographql-client-version"]=d)}var v,y=t.__assign(t.__assign({},c),a.headers),b={http:a.http,options:a.fetchOptions,credentials:a.credentials,headers:y},g=_e(e,me,f,b),m=g.options,_=g.body;if(_.variables&&!l){var S=new Set(Object.keys(_.variables));n.visit(e.query,{Variable:function(e,t,r){r&&"VariableDefinition"!==r.kind&&S.delete(e.name.value)}}),S.size&&(_.variables=t.__assign({},_.variables),S.forEach((function(e){delete _.variables[e]})))}if(!m.signal){var O=Oe(),w=O.controller,x=O.signal;(v=w)&&(m.signal=x)}if(u&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(m.method="GET"),"GET"===m.method){var k=xe(r,_),E=k.newURI,q=k.parseError;if(q)return oe(q);r=E}else try{m.body=ge(_)}catch(q){return oe(q)}return new o((function(t){return s(r,m).then((function(t){return e.setContext({response:t}),t})).then(be(e)).then((function(e){return t.next(e),t.complete(),e})).catch((function(e){"AbortError"!==e.name&&(e.result&&e.result.errors&&e.result.data&&t.next(e.result),t.error(e))})),function(){v&&v.abort()}}))}))},Ee=function(e){function r(t){void 0===t&&(t={});var r=e.call(this,ke(t).request)||this;return r.options=t,r}return t.__extends(r,e),r}(le);function qe(e){return e.hasOwnProperty("graphQLErrors")}var Re,Qe=function(e){function r(t){var n,i,o=t.graphQLErrors,s=t.networkError,a=t.errorMessage,u=t.extraInfo,c=e.call(this,a)||this;return c.graphQLErrors=o||[],c.networkError=s||null,c.message=a||(i="",te((n=c).graphQLErrors)&&n.graphQLErrors.forEach((function(e){var t=e?e.message:"Error message not found.";i+=t+"\n"})),n.networkError&&(i+=n.networkError.message+"\n"),i=i.replace(/\n$/,"")),c.extraInfo=u,c.__proto__=r.prototype,c}return t.__extends(r,e),r}(Error);function Me(e){return!!e&&e<7}(Re=exports.NetworkStatus||(exports.NetworkStatus={}))[Re.loading=1]="loading",Re[Re.setVariables=2]="setVariables",Re[Re.fetchMore=3]="fetchMore",Re[Re.refetch=4]="refetch",Re[Re.poll=6]="poll",Re[Re.ready=7]="ready",Re[Re.error=8]="error";var Pe=function(){function e(e,t,r,n){this.observer=e,this.options=t,this.fetch=r,this.shouldFetch=n}return e.prototype.reobserve=function(e,t){e?this.updateOptions(e):this.updatePolling();var r=this.fetch(this.options,t);return this.concast&&this.concast.removeObserver(this.observer,!0),r.addObserver(this.observer),(this.concast=r).promise},e.prototype.updateOptions=function(e){return Object.assign(this.options,ie(e)),this.updatePolling(),this},e.prototype.stop=function(){this.concast&&(this.concast.removeObserver(this.observer),delete this.concast),this.pollingInfo&&(clearTimeout(this.pollingInfo.timeout),this.options.pollInterval=0,this.updatePolling())},e.prototype.updatePolling=function(){var e=this,t=this.pollingInfo,n=this.options.pollInterval;if(n){if((!t||t.interval!==n)&&(r.invariant(n,20),!1!==this.shouldFetch)){(t||(this.pollingInfo={})).interval=n;var i=function(){e.pollingInfo&&(e.shouldFetch&&e.shouldFetch()?e.reobserve({fetchPolicy:"network-only",nextFetchPolicy:e.options.fetchPolicy||"cache-first"},exports.NetworkStatus.poll).then(o,o):o())},o=function(){var t=e.pollingInfo;t&&(clearTimeout(t.timeout),t.timeout=setTimeout(i,t.interval))};o()}}else t&&(clearTimeout(t.timeout),delete this.pollingInfo)},e}(),Ie=function(e){function r(r){var n=r.queryManager,i=r.queryInfo,o=r.options,s=e.call(this,(function(e){return s.onSubscribe(e)}))||this;s.observers=new Set,s.subscriptions=new Set,s.observer={next:function(e){(s.lastError||s.isDifferentFromLastResult(e))&&(s.updateLastResult(e),Y(s.observers,"next",e))},error:function(e){s.updateLastResult(t.__assign(t.__assign({},s.lastResult),{error:e,errors:e.graphQLErrors,networkStatus:exports.NetworkStatus.error,loading:!1})),Y(s.observers,"error",s.lastError=e)}},s.isTornDown=!1,s.options=o,s.queryId=n.generateQueryId();var a=Q(o.query);return s.queryName=a&&a.name&&a.name.value,s.queryManager=n,s.queryInfo=i,s}return t.__extends(r,e),Object.defineProperty(r.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),r.prototype.result=function(){var e=this;return new Promise((function(t,r){var n={next:function(r){t(r),e.observers.delete(n),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout((function(){i.unsubscribe()}),0)},error:r},i=e.subscribe(n)}))},r.prototype.getCurrentResult=function(e){void 0===e&&(e=!0);var r=this.lastResult,n=this.queryInfo.networkStatus||r&&r.networkStatus||exports.NetworkStatus.ready,i=t.__assign(t.__assign({},r),{loading:Me(n),networkStatus:n});if(this.isTornDown)return i;var o=this.options.fetchPolicy,s=void 0===o?"cache-first":o;if("no-cache"===s||"network-only"===s)delete i.partial;else if(!i.data||!this.queryManager.transform(this.options.query).hasForcedResolvers){var a=this.queryInfo.getDiff();i.data=a.complete||this.options.returnPartialData?a.result:void 0,a.complete?(i.networkStatus!==exports.NetworkStatus.loading||"cache-first"!==s&&"cache-only"!==s||(i.networkStatus=exports.NetworkStatus.ready,i.loading=!1),delete i.partial):i.partial=!0}return e&&this.updateLastResult(i),i},r.prototype.isDifferentFromLastResult=function(e){return!s.equal(this.lastResultSnapshot,e)},r.prototype.getLastResult=function(){return this.lastResult},r.prototype.getLastError=function(){return this.lastError},r.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},r.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},r.prototype.refetch=function(e){var r={pollInterval:0},n=this.options.fetchPolicy;return"no-cache"!==n&&"cache-and-network"!==n&&(r.fetchPolicy="network-only",r.nextFetchPolicy=n||"cache-first"),e&&!s.equal(this.options.variables,e)&&(r.variables=this.options.variables=t.__assign(t.__assign({},this.options.variables),e)),this.newReobserver(!1).reobserve(r,exports.NetworkStatus.refetch)},r.prototype.fetchMore=function(e){var r=this,n=t.__assign(t.__assign({},e.query?e:t.__assign(t.__assign(t.__assign({},this.options),e),{variables:t.__assign(t.__assign({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"}),i=this.queryManager.generateQueryId();return n.notifyOnNetworkStatusChange&&(this.queryInfo.networkStatus=exports.NetworkStatus.fetchMore,this.observe()),this.queryManager.fetchQuery(i,n,exports.NetworkStatus.fetchMore).then((function(t){var i=t.data,o=e.updateQuery;return o?r.updateQuery((function(e){return o(e,{fetchMoreResult:i,variables:n.variables})})):r.queryManager.cache.writeQuery({query:n.query,variables:n.variables,data:i}),t})).finally((function(){r.queryManager.stopQuery(i),r.reobserve()}))},r.prototype.subscribeToMore=function(e){var t=this,r=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:function(r){var n=e.updateQuery;n&&t.updateQuery((function(e,t){var i=t.variables;return n(e,{subscriptionData:r,variables:i})}))},error:function(t){e.onError&&e.onError(t)}});return this.subscriptions.add(r),function(){t.subscriptions.delete(r)&&r.unsubscribe()}},r.prototype.setOptions=function(e){return this.reobserve(e)},r.prototype.setVariables=function(e){if(s.equal(this.variables,e))return this.observers.size?this.result():Promise.resolve();if(this.options.variables=e,!this.observers.size)return Promise.resolve();var t=this.options.fetchPolicy,r=void 0===t?"cache-first":t,n={fetchPolicy:r,variables:e};return"cache-first"!==r&&"no-cache"!==r&&"network-only"!==r&&(n.fetchPolicy="cache-and-network",n.nextFetchPolicy=r),this.reobserve(n,exports.NetworkStatus.setVariables)},r.prototype.updateQuery=function(e){var t,r=this.queryManager,n=e(r.cache.diff({query:this.options.query,variables:this.variables,previousResult:null===(t=this.lastResult)||void 0===t?void 0:t.data,returnPartialData:!0,optimistic:!1}).result,{variables:this.variables});n&&(r.cache.writeQuery({query:this.options.query,data:n,variables:this.variables}),r.broadcastQueries())},r.prototype.startPolling=function(e){this.getReobserver().updateOptions({pollInterval:e})},r.prototype.stopPolling=function(){this.reobserver&&this.reobserver.updateOptions({pollInterval:0})},r.prototype.updateLastResult=function(e){var t=this.lastResult;return this.lastResult=e,this.lastResultSnapshot=this.queryManager.assumeImmutableResults?e:H(e),te(e.errors)||delete this.lastError,t},r.prototype.onSubscribe=function(e){var t=this;if(e===this.observer)return function(){};try{var r=e._subscription._observer;r&&!r.error&&(r.error=Fe)}catch(e){}var n=!this.observers.size;return this.observers.add(e),this.lastError?e.error&&e.error(this.lastError):this.lastResult&&e.next&&e.next(this.lastResult),n&&this.reobserve().catch((function(e){})),function(){t.observers.delete(e)&&!t.observers.size&&t.tearDownQuery()}},r.prototype.getReobserver=function(){return this.reobserver||(this.reobserver=this.newReobserver(!0))},r.prototype.newReobserver=function(e){var r=this,n=this.queryManager,i=this.queryId;return n.setObservableQuery(this),new Pe(this.observer,e?this.options:t.__assign({},this.options),(function(e,t){return n.setObservableQuery(r),n.fetchQueryObservable(i,e,t)}),!n.ssrMode&&function(){return!Me(r.queryInfo.networkStatus)})},r.prototype.reobserve=function(e,t){return this.isTornDown=!1,this.getReobserver().reobserve(e,t)},r.prototype.observe=function(){this.observer.next(this.getCurrentResult(!1))},r.prototype.hasObservers=function(){return this.observers.size>0},r.prototype.tearDownQuery=function(){this.isTornDown||(this.reobserver&&(this.reobserver.stop(),delete this.reobserver),this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},r}(o);function Fe(e){}X(Ie);var Ce=function(){function e(){this.getFragmentDoc=a.wrap(v)}return e.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},e.prototype.transformDocument=function(e){return e},e.prototype.identify=function(e){},e.prototype.gc=function(){return[]},e.prototype.modify=function(e){return!1},e.prototype.transformForLink=function(e){return e},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read({rootId:e.id||"ROOT_QUERY",query:e.query,variables:e.variables,returnPartialData:e.returnPartialData,optimistic:t})},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read({query:this.getFragmentDoc(e.fragment,e.fragmentName),variables:e.variables,rootId:e.id,returnPartialData:e.returnPartialData,optimistic:t})},e.prototype.writeQuery=function(e){return this.write({dataId:e.id||"ROOT_QUERY",result:e.data,query:e.query,variables:e.variables,broadcast:e.broadcast})},e.prototype.writeFragment=function(e){return this.write({dataId:e.id,result:e.data,variables:e.variables,query:this.getFragmentDoc(e.fragment,e.fragmentName),broadcast:e.broadcast})},e}();exports.Cache||(exports.Cache={});var Te=function(e,t,r,n,i){this.message=e,this.path=t,this.query=r,this.clientOnly=n,this.variables=i},De=Object.prototype.hasOwnProperty;var je=/^[_a-z][_0-9a-z]*/i;function Ne(e){var t=e.match(je);return t?t[0]:e}function Ae(e,t,r){return!(!t||"object"!=typeof t)&&(Array.isArray(t)?t.every((function(t){return Ae(e,t,r)})):e.selections.every((function(e){if(E(e)&&f(e,r)){var n=x(e);return De.call(t,n)&&(!e.selectionSet||Ae(e.selectionSet,t[n],r))}return!0})))}function Le(e){return null!==e&&"object"==typeof e&&!m(e)&&!Array.isArray(e)}var Ve=Object.create(null),ze=function(){return Ve},Be=Object.create(null),We=function(){function e(e,t){var r=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(e,t){return m(e)?r.get(e.__ref,t):e&&e[t]},this.canRead=function(e){return m(e)?r.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return g(e);if(m(e))return e;var n=r.policies.identify(e)[0];if(n){var i=g(n);return t&&r.merge(n,e),i}}}return e.prototype.toObject=function(){return t.__assign({},this.data)},e.prototype.has=function(e){return void 0!==this.lookup(e,!0)},e.prototype.get=function(e,t){if(this.group.depend(e,t),De.call(this.data,e)){var r=this.data[e];if(r&&De.call(r,t))return r[t]}return"__typename"===t&&De.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof Je?this.parent.get(e,t):void 0},e.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),De.call(this.data,e)?this.data[e]:this instanceof Je?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},e.prototype.merge=function(e,t){var r=this,n=this.lookup(e),i=new J(Ge).merge(n,t);if(this.data[e]=i,i!==n&&(delete this.refs[e],this.group.caching)){var o=Object.create(null);n||(o.__exists=1),Object.keys(t).forEach((function(e){if(!n||n[e]!==i[e]){o[e]=1;var t=Ne(e);t===e||r.policies.hasKeyArgs(i.__typename,t)||(o[t]=1),void 0!==i[e]||r instanceof Je||delete i[e]}})),Object.keys(o).forEach((function(t){return r.group.dirty(e,t)}))}},e.prototype.modify=function(e,r){var n=this,i=this.lookup(e);if(i){var o=Object.create(null),s=!1,a=!0,u={DELETE:Ve,INVALIDATE:Be,isReference:m,toReference:this.toReference,canRead:this.canRead,readField:function(t,r){return n.policies.readField("string"==typeof t?{fieldName:t,from:r||g(e)}:t,{store:n})}};if(Object.keys(i).forEach((function(c){var l=Ne(c),p=i[c];if(void 0!==p){var f="function"==typeof r?r:r[c]||r[l];if(f){var h=f===ze?Ve:f(p,t.__assign(t.__assign({},u),{fieldName:l,storeFieldName:c,storage:n.getStorage(e,c)}));h===Be?n.group.dirty(e,c):(h===Ve&&(h=void 0),h!==p&&(o[c]=h,s=!0,p=h))}void 0!==p&&(a=!1)}})),s)return this.merge(e,o),a&&(this instanceof Je?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},e.prototype.delete=function(e,t,r){var n,i=this.lookup(e);if(i){var o=this.getFieldValue(i,"__typename"),s=t&&r?this.policies.getStoreFieldName({typename:o,fieldName:t,args:r}):t;return this.modify(e,s?((n={})[s]=ze,n):ze)}return!1},e.prototype.evict=function(e){var t=!1;return e.id&&(De.call(this.data,e.id)&&(t=this.delete(e.id,e.fieldName,e.args)),this instanceof Je&&(t=this.parent.evict(e)||t),(e.fieldName||t)&&this.group.dirty(e.id,e.fieldName||"__exists")),t},e.prototype.clear=function(){this.replace(null)},e.prototype.extract=function(){var e=this,t=this.toObject(),r=[];return this.getRootIdSet().forEach((function(t){De.call(e.policies.rootTypenamesById,t)||r.push(t)})),r.length&&(t.__META={extraRootIds:r.sort()}),t},e.prototype.replace=function(e){var r=this;if(Object.keys(this.data).forEach((function(t){e&&De.call(e,t)||r.delete(t)})),e){var n=e.__META,i=t.__rest(e,["__META"]);Object.keys(i).forEach((function(e){r.merge(e,i[e])})),n&&n.extraRootIds.forEach(this.retain,this)}},e.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},e.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},e.prototype.getRootIdSet=function(e){return void 0===e&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Je?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},e.prototype.gc=function(){var e=this,t=this.getRootIdSet(),r=this.toObject();t.forEach((function(n){De.call(r,n)&&(Object.keys(e.findChildRefIds(n)).forEach(t.add,t),delete r[n])}));var n=Object.keys(r);if(n.length){for(var i=this;i instanceof Je;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},e.prototype.findChildRefIds=function(e){if(!De.call(this.refs,e)){var t=this.refs[e]=Object.create(null),r=new Set([this.data[e]]),n=function(e){return null!==e&&"object"==typeof e};r.forEach((function(e){m(e)?t[e.__ref]=!0:n(e)&&Object.values(e).filter(n).forEach(r.add,r)}))}return this.refs[e]},e.prototype.makeCacheKey=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.group.keyMaker.lookupArray(e)},e}(),Ue=function(){function e(e){this.caching=e,this.d=null,this.keyMaker=new a.KeyTrie(ne),this.d=e?a.dep():null}return e.prototype.depend=function(e,t){if(this.d){this.d(Ke(e,t));var r=Ne(t);r!==t&&this.d(Ke(e,r))}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(Ke(e,t))},e}();function Ke(e,t){return t+"#"+e}!function(e){var r=function(e){function r(t){var r=t.policies,n=t.resultCaching,i=void 0===n||n,o=t.seed,s=e.call(this,r,new Ue(i))||this;return s.storageTrie=new a.KeyTrie(ne),s.sharedLayerGroup=new Ue(i),o&&s.replace(o),s}return t.__extends(r,e),r.prototype.addLayer=function(e,t){return new Je(e,this,t,this.sharedLayerGroup)},r.prototype.removeLayer=function(){return this},r.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},r}(e);e.Root=r}(We||(We={}));var Je=function(e){function r(t,r,n,i){var o=e.call(this,r.policies,i)||this;return o.id=t,o.parent=r,o.replay=n,o.group=i,n(o),o}return t.__extends(r,e),r.prototype.addLayer=function(e,t){return new r(e,this,t,this.group)},r.prototype.removeLayer=function(e){var t=this,r=this.parent.removeLayer(e);return e===this.id?(this.group.caching&&Object.keys(this.data).forEach((function(e){t.data[e]!==r.lookup(e)&&t.delete(e)})),r):r===this.parent?this:r.addLayer(this.id,this.replay)},r.prototype.toObject=function(){return t.__assign(t.__assign({},this.parent.toObject()),this.data)},r.prototype.findChildRefIds=function(r){var n=this.parent.findChildRefIds(r);return De.call(this.data,r)?t.__assign(t.__assign({},n),e.prototype.findChildRefIds.call(this,r)):n},r.prototype.getStorage=function(){for(var e=this.parent;e.parent;)e=e.parent;return e.getStorage.apply(e,arguments)},r}(We);function Ge(e,t,r){var n=e[r],i=t[r];return s.equal(n,i)?n:i}function He(e){return!!(e instanceof We&&e.group.caching)}function Ye(e,t){return new Te(e.message,t.path.slice(),t.query,t.clientOnly,t.variables)}var $e=function(){function e(e){var r=this;this.config=e,this.executeSelectionSet=a.wrap((function(e){return r.execSelectionSetImpl(e)}),{keyArgs:function(e){return[e.selectionSet,e.objectOrReference,e.context]},makeCacheKey:function(e,t,r){if(He(r.store))return r.store.makeCacheKey(e,m(t)?t.__ref:t,r.varString)}}),this.knownResults=new WeakMap,this.executeSubSelectedArray=a.wrap((function(e){return r.execSubSelectedArrayImpl(e)}),{makeCacheKey:function(e){var t=e.field,r=e.array,n=e.context;if(He(n.store))return n.store.makeCacheKey(t,r,n.varString)}}),this.config=t.__assign({addTypename:!0},e)}return e.prototype.diffQueryAgainstStore=function(e){var n,i=e.store,o=e.query,s=e.rootId,a=void 0===s?"ROOT_QUERY":s,u=e.variables,c=e.returnPartialData,l=void 0===c||c,p=this.config.cache.policies;u=t.__assign(t.__assign({},F((n=Q(o),r.invariant(n&&"query"===n.operation,48),n))),u);var f=this.executeSelectionSet({selectionSet:I(o).selectionSet,objectOrReference:g(a),context:{store:i,query:o,policies:p,variables:u,varString:JSON.stringify(u),fragmentMap:y(P(o)),path:[],clientOnly:!1}}),h=f.missing&&f.missing.length>0;if(h&&!l)throw f.missing[0];return{result:f.result,missing:f.missing,complete:!h}},e.prototype.isFresh=function(e,t,r,n){if(He(n.store)&&this.knownResults.get(e)===r){var i=this.executeSelectionSet.peek(r,t,n);if(i&&e===i.result)return!0}return!1},e.prototype.execSelectionSetImpl=function(e){var t=this,n=e.selectionSet,i=e.objectOrReference,o=e.context;if(m(i)&&!o.policies.rootTypenamesById[i.__ref]&&!o.store.has(i.__ref))return{result:{},missing:[Ye(new r.InvariantError(4),o)]};var s=o.variables,a=o.policies,u=o.store,c=[],l={result:null},p=u.getFieldValue(i,"__typename");function h(){return l.missing||(l.missing=[])}function d(e){var t;return e.missing&&(t=h()).push.apply(t,e.missing),e.result}this.config.addTypename&&"string"==typeof p&&!a.rootIdsByTypename[p]&&c.push({__typename:p});var v=new Set(n.selections);return v.forEach((function(e){var n;if(f(e,s))if(E(e)){var u=a.readField({fieldName:e.name.value,field:e,variables:o.variables,from:i},o),l=x(e);o.path.push(l);var y=o.clientOnly;o.clientOnly=y||!(!e.directives||!e.directives.some((function(e){return"client"===e.name.value}))),void 0===u?A.added(e)||h().push(Ye(new r.InvariantError(5),o)):Array.isArray(u)?u=d(t.executeSubSelectedArray({field:e,array:u,context:o})):e.selectionSet&&null!=u&&(u=d(t.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:u,context:o}))),void 0!==u&&c.push(((n={})[l]=u,n)),o.clientOnly=y,r.invariant(o.path.pop()===l)}else{var g=b(e,o.fragmentMap);g&&a.fragmentMatches(g,p)&&g.selectionSet.selections.forEach(v.add,v)}})),l.result=W(c),this.knownResults.set(l.result,n),l},e.prototype.execSubSelectedArrayImpl=function(e){var t,n=this,i=e.field,o=e.array,s=e.context;function a(e,n){return e.missing&&(t=t||[]).push.apply(t,e.missing),r.invariant(s.path.pop()===n),e.result}return i.selectionSet&&(o=o.filter(s.store.canRead)),{result:o=o.map((function(e,t){return null===e?null:(s.path.push(t),Array.isArray(e)?a(n.executeSubSelectedArray({field:i,array:e,context:s}),t):i.selectionSet?a(n.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:e,context:s}),t):(r.invariant(s.path.pop()===t),e))})),missing:t}},e}();var Xe=function(){function e(e,t){this.cache=e,this.reader=t}return e.prototype.writeToStore=function(e){var n=e.query,i=e.result,o=e.dataId,s=e.store,a=e.variables,u=Q(n),c=new J;a=t.__assign(t.__assign({},F(u)),a);var l=this.processSelectionSet({result:i||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:{store:s,written:Object.create(null),merge:function(e,t){return c.merge(e,t)},variables:a,varString:JSON.stringify(a),fragmentMap:y(P(n))}});if(!m(l))throw new r.InvariantError(7);return s.retain(l.__ref),l},e.prototype.processSelectionSet=function(e){var t=this,n=e.dataId,i=e.result,o=e.selectionSet,s=e.context,a=e.mergeTree,u=this.cache.policies,c=u.identify(i,o,s.fragmentMap),l=c[0],p=c[1];if("string"==typeof(n=n||l)){var d=s.written[n]||(s.written[n]=[]),v=g(n);if(d.indexOf(o)>=0)return v;if(d.push(o),this.reader&&this.reader.isFresh(i,v,o,s))return v}var y=Object.create(null);p&&(y=s.merge(y,p));var m=n&&u.rootTypenamesById[n]||k(i,o,s.fragmentMap)||n&&s.store.get(n,"__typename");"string"==typeof m&&(y.__typename=m);var _=new Set(o.selections);if(_.forEach((function(e){var n;if(f(e,s.variables))if(E(e)){var o=x(e),c=i[o];if(void 0!==c){var l=u.getStoreFieldName({typename:m,fieldName:e.name.value,field:e,variables:s.variables}),p=et(a,l),d=t.processFieldValue(c,e,s,p),v=e.selectionSet&&s.store.getFieldValue(d,"__typename")||void 0,g=u.getMergeFunction(m,e.name.value,v);g?p.info={field:e,typename:m,merge:g}:tt(a,l),y=s.merge(y,((n={})[l]=d,n))}else if(u.usingPossibleTypes&&!h(["defer","client"],e))throw new r.InvariantError(8)}else{var S=b(e,s.fragmentMap);S&&u.fragmentMatches(S,m,i,s.variables)&&S.selectionSet.selections.forEach(_.add,_)}})),"string"==typeof n){var S=g(n);return a.map.size&&(y=this.applyMerges(a,S,y,s)),s.store.merge(n,y),S}return y},e.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?Array.isArray(e)?e.map((function(e,o){var s=i.processFieldValue(e,t,r,et(n,o));return tt(n,o),s})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):e},e.prototype.applyMerges=function(e,n,i,o,s){var a,u=this;if(e.map.size&&!m(i)){var c,l=Array.isArray(i)||!m(n)&&!Le(n)?void 0:n,p=i;l&&!s&&(s=[m(l)?l.__ref:l]);var f=function(e,t){return Array.isArray(e)?"number"==typeof t?e[t]:void 0:o.store.getFieldValue(e,String(t))};e.map.forEach((function(e,t){s&&s.push(t);var n=f(l,t),i=f(p,t),a=u.applyMerges(e,n,i,o,s);a!==i&&(c=c||new Map).set(t,a),s&&r.invariant(s.pop()===t)})),c&&(i=Array.isArray(p)?p.slice(0):t.__assign({},p),c.forEach((function(e,t){i[t]=e})))}return e.info?this.cache.policies.runMergeFunction(n,i,e.info,o,s&&(a=o.store).getStorage.apply(a,s)):i},e}(),Ze=[];function et(e,t){var r=e.map;return r.has(t)||r.set(t,Ze.pop()||{map:new Map}),r.get(t)}function tt(e,t){var r=e.map,n=r.get(t);!n||n.info||n.map.size||(Ze.push(n),r.delete(t))}new Set;var rt=new u.Slot;function nt(e,t){if(e.size){var r=[];e.forEach((function(e){return r.push(e)})),e.clear(),r.forEach(t)}}var it=new WeakMap;function ot(e){var t=it.get(e);return t||it.set(e,t={vars:new Set,dep:a.dep()}),t}function st(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0)e!==o&&(e=o,t.forEach((function(e){ot(e).dep.dirty(n),at(e)})),nt(r,(function(t){return t(e)})));else{var s=rt.getValue();s&&(i(s),ot(s).dep(n))}return e};n.onNextChange=function(e){return r.add(e),function(){r.delete(e)}};var i=n.attachCache=function(e){return t.add(e),ot(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}function at(e){e.broadcastWatches&&e.broadcastWatches()}function ut(e){return void 0!==e.args?e.args:e.field?w(e.field,e.variables):null}var ct=function(e,t){var r=e.__typename,n=e.id,i=e._id;if("string"==typeof r&&(t&&(t.keyObject=void 0!==n?{id:n}:void 0!==i?{_id:i}:void 0),void 0===n&&(n=i),void 0!==n))return r+":"+("number"==typeof n||"string"==typeof n?n:JSON.stringify(n))},lt=function(){},pt=function(e,t){return t.fieldName},ft=function(e,t,r){return(0,r.mergeObjects)(e,t)},ht=function(e,t){return t},dt=function(){function e(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=t.__assign({dataIdFromObject:ct},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return e.prototype.identify=function(e,t,r){var n=t&&r?k(e,t,r):e.__typename;if(n===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var i,o={typename:n,selectionSet:t,fragmentMap:r},s=n&&this.getTypePolicy(n),a=s&&s.keyFn||this.config.dataIdFromObject;a;){var u=a(e,o);if(!Array.isArray(u)){i=u;break}a=gt(u)}return i=i?String(i):void 0,o.keyObject?[i,o.keyObject]:[i]},e.prototype.addTypePolicies=function(e){var r=this;Object.keys(e).forEach((function(n){var i=e[n],o=i.queryType,s=i.mutationType,a=i.subscriptionType,u=t.__rest(i,["queryType","mutationType","subscriptionType"]);o&&r.setRootTypename("Query",n),s&&r.setRootTypename("Mutation",n),a&&r.setRootTypename("Subscription",n),De.call(r.toBeAdded,n)?r.toBeAdded[n].push(u):r.toBeAdded[n]=[u]}))},e.prototype.updateTypePolicy=function(e,t){var r=this,n=this.getTypePolicy(e),i=t.keyFields,o=t.fields;function s(e,t){e.merge="function"==typeof t?t:!0===t?ft:!1===t?ht:e.merge}s(n,t.merge),n.keyFn=!1===i?lt:Array.isArray(i)?gt(i):"function"==typeof i?i:n.keyFn,o&&Object.keys(o).forEach((function(t){var n=r.getFieldPolicy(e,t,!0),i=o[t];if("function"==typeof i)n.read=i;else{var a=i.keyArgs,u=i.read,c=i.merge;n.keyFn=!1===a?pt:Array.isArray(a)?bt(a):"function"==typeof a?a:n.keyFn,"function"==typeof u&&(n.read=u),s(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||pt)}))},e.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==i&&(r.invariant(!i||i===e,1),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[t]=n,this.rootTypenamesById[n]=t)},e.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach((function(r){t.getSupertypeSet(r,!0),e[r].forEach((function(e){t.getSupertypeSet(e,!0).add(r);var n=e.match(je);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},e.prototype.getTypePolicy=function(e){var r=this;if(!De.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(e);i&&i.size&&i.forEach((function(e){var i=r.getTypePolicy(e),o=i.fields,s=t.__rest(i,["fields"]);Object.assign(n,s),Object.assign(n.fields,o)}))}var o=this.toBeAdded[e];return o&&o.length&&this.updateTypePolicy(e,ie.apply(void 0,o.splice(0))),this.typePolicies[e]},e.prototype.getFieldPolicy=function(e,t,r){if(e){var n=this.getTypePolicy(e).fields;return n[t]||r&&(n[t]=Object.create(null))}},e.prototype.getSupertypeSet=function(e,t){var r=this.supertypeMap.get(e);return!r&&t&&this.supertypeMap.set(e,r=new Set),r},e.prototype.fragmentMatches=function(e,t,r,n){var i=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),a=[s],u=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&a.indexOf(t)<0&&a.push(t)},c=!(!r||!this.fuzzySubtypes.size),l=0;l<a.length;++l){var p=a[l];if(p.has(o))return s.has(o)||s.add(o),!0;p.forEach(u),c&&l===a.length-1&&Ae(e.selectionSet,r,n)&&(c=!1,!0,this.fuzzySubtypes.forEach((function(e,r){var n=t.match(e);n&&n[0]===t&&u(r)})))}return!1},e.prototype.hasKeyArgs=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.keyFn)},e.prototype.getStoreFieldName=function(e){var t,r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),o=i&&i.keyFn;if(o&&r)for(var s={typename:r,fieldName:n,field:e.field||null,variables:e.variables},a=ut(e);o;){var u=o(a,s);if(!Array.isArray(u)){t=u||n;break}o=bt(u)}return void 0===t&&(t=e.field?function(e,t){var r=null;e.directives&&(r={},e.directives.forEach((function(e){r[e.name.value]={},e.arguments&&e.arguments.forEach((function(n){var i=n.name,o=n.value;return _(r[e.name.value],i,o,t)}))})));var n=null;return e.arguments&&e.arguments.length&&(n={},e.arguments.forEach((function(e){var r=e.name,i=e.value;return _(n,r,i,t)}))),O(e.name.value,n,r)}(e.field,e.variables):O(n,ut(e))),!1===t?n:n===Ne(t)?t:n+":"+t},e.prototype.readField=function(e,t){var r=e.from;if(r&&(e.field||e.fieldName)){if(void 0===e.typename){var n=t.store.getFieldValue(r,"__typename");n&&(e.typename=n)}var i=this.getStoreFieldName(e),o=Ne(i),s=t.store.getFieldValue(r,i),a=this.getFieldPolicy(e.typename,o,!1),u=a&&a.read;if(u){var c=vt(this,r,e,t,t.store.getStorage(m(r)?r.__ref:r,i));return rt.withValue(this.cache,u,[s,c])}return s}},e.prototype.getMergeFunction=function(e,t,r){var n=this.getFieldPolicy(e,t,!1),i=n&&n.merge;return!i&&r&&(i=(n=this.getTypePolicy(r))&&n.merge),i},e.prototype.runMergeFunction=function(e,t,r,n,i){var o=r.field,s=r.typename,a=r.merge;return a===ft?yt(n.store.getFieldValue)(e,t):a===ht?t:a(e,t,vt(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null)))},e}();function vt(e,r,n,i,o){var s=e.getStoreFieldName(n),a=Ne(s),u=n.variables||i.variables,c=i.store,l=c.getFieldValue,p=c.toReference,f=c.canRead;return{args:ut(n),field:n.field||null,fieldName:a,storeFieldName:s,variables:u,isReference:m,toReference:p,storage:o,cache:e.cache,canRead:f,readField:function(n,o){var s="string"==typeof n?{fieldName:n,from:o}:t.__assign({},n);return void 0===s.from&&(s.from=r),void 0===s.variables&&(s.variables=u),e.readField(s,i)},mergeObjects:yt(l)}}function yt(e){return function(n,i){if(Array.isArray(n)||Array.isArray(i))throw new r.InvariantError(2);if(n&&"object"==typeof n&&i&&"object"==typeof i){var o=e(n,"__typename"),s=e(i,"__typename");return!(o&&s&&o!==s)&&Le(n)&&Le(i)?t.__assign(t.__assign({},n),i):i}return i}}function bt(e){return function(t,r){return t?r.fieldName+":"+JSON.stringify(mt(t,e,!1)):r.fieldName}}function gt(e){var t=new a.KeyTrie(ne);return function(r,n){var i;if(n.selectionSet&&n.fragmentMap){var o=t.lookupArray([n.selectionSet,n.fragmentMap]);i=o.aliasMap||(o.aliasMap=function e(t,r){var n=Object.create(null),i=new Set([t]);return i.forEach((function(t){t.selections.forEach((function(t){if(E(t)){if(t.alias){var o=t.alias.value,s=t.name.value;if(s!==o)(n.aliases||(n.aliases=Object.create(null)))[s]=o}if(t.selectionSet)(n.subsets||(n.subsets=Object.create(null)))[t.name.value]=e(t.selectionSet,r)}else{var a=b(t,r);a&&i.add(a.selectionSet)}}))})),n}(n.selectionSet,n.fragmentMap))}var s=n.keyObject=mt(r,e,!0,i);return n.typename+":"+JSON.stringify(s)}}function mt(e,t,n,i){var o,s=Object.create(null);return t.forEach((function(t){if(Array.isArray(t)){if("string"==typeof o){var a=i&&i.subsets,u=a&&a[o];s[o]=mt(e[o],t,n,u)}}else{var c=i&&i.aliases,l=c&&c[t]||t;De.call(e,l)?s[o=t]=e[l]:(r.invariant(!n,3),o=void 0)}})),s}var _t={dataIdFromObject:ct,addTypename:!0,resultCaching:!0,typePolicies:{}},St=function(e){function r(r){void 0===r&&(r={});var n=e.call(this)||this;return n.watches=new Set,n.typenameDocumentCache=new Map,n.makeVar=st,n.txCount=0,n.maybeBroadcastWatch=a.wrap((function(e,t){return n.broadcastWatch.call(n,e,!!t)}),{makeCacheKey:function(e){var t=e.optimistic?n.optimisticData:n.data;if(He(t)){var r=e.optimistic,i=e.rootId,o=e.variables;return t.makeCacheKey(e.query,e.callback,JSON.stringify({optimistic:r,rootId:i,variables:o}))}}}),n.watchDep=a.dep(),n.config=t.__assign(t.__assign({},_t),r),n.addTypename=!!n.config.addTypename,n.policies=new dt({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.data=new We.Root({policies:n.policies,resultCaching:n.config.resultCaching}),n.optimisticData=n.data,n.storeWriter=new Xe(n,n.storeReader=new $e({cache:n,addTypename:n.addTypename})),n}return t.__extends(r,e),r.prototype.restore=function(e){return e&&this.data.replace(e),this},r.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).extract()},r.prototype.read=function(e){var t=e.returnPartialData,r=void 0!==t&&t;try{return this.storeReader.diffQueryAgainstStore({store:e.optimistic?this.optimisticData:this.data,query:e.query,variables:e.variables,rootId:e.rootId,config:this.config,returnPartialData:r}).result||null}catch(e){if(e instanceof Te)return null;throw e}},r.prototype.write=function(e){try{return++this.txCount,this.storeWriter.writeToStore({store:this.data,query:e.query,result:e.result,dataId:e.dataId,variables:e.variables})}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},r.prototype.modify=function(e){if(De.call(e,"id")&&!e.id)return!1;var t=e.optimistic?this.optimisticData:this.data;try{return++this.txCount,t.modify(e.id||"ROOT_QUERY",e.fields)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},r.prototype.diff=function(e){return this.storeReader.diffQueryAgainstStore({store:e.optimistic?this.optimisticData:this.data,rootId:e.id||"ROOT_QUERY",query:e.query,variables:e.variables,returnPartialData:e.returnPartialData,config:this.config})},r.prototype.watch=function(e){var t=this;return this.watches.size||function(e){ot(e).vars.forEach((function(t){return t.attachCache(e)}))}(this),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){t.watches.delete(e)&&!t.watches.size&&function(e){ot(e).vars.forEach((function(t){return t.forgetCache(e)}))}(t),t.watchDep.dirty(e),t.maybeBroadcastWatch.forget(e)}},r.prototype.gc=function(){return this.optimisticData.gc()},r.prototype.retain=function(e,t){return(t?this.optimisticData:this.data).retain(e)},r.prototype.release=function(e,t){return(t?this.optimisticData:this.data).release(e)},r.prototype.identify=function(e){return m(e)?e.__ref:this.policies.identify(e)[0]},r.prototype.evict=function(e){if(!e.id){if(De.call(e,"id"))return!1;e=t.__assign(t.__assign({},e),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},r.prototype.reset=function(){return this.data.clear(),this.optimisticData=this.data,this.broadcastWatches(),Promise.resolve()},r.prototype.removeOptimistic=function(e){var t=this.optimisticData.removeLayer(e);t!==this.optimisticData&&(this.optimisticData=t,this.broadcastWatches())},r.prototype.performTransaction=function(e,t){var r=this,n=function(t){var n=r,i=n.data,o=n.optimisticData;++r.txCount,t&&(r.data=r.optimisticData=t);try{e(r)}finally{--r.txCount,r.data=i,r.optimisticData=o}},i=!1;"string"==typeof t?(this.optimisticData=this.optimisticData.addLayer(t,n),i=!0):null===t?n(this.data):n(),this.broadcastWatches(i)},r.prototype.transformDocument=function(e){if(this.addTypename){var t=this.typenameDocumentCache.get(e);return t||(t=A(e),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},r.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach((function(r){return t.maybeBroadcastWatch(r,e)}))},r.prototype.broadcastWatch=function(e,t){this.watchDep.dirty(e),this.watchDep(e);var r=this.diff({query:e.query,variables:e.variables,optimistic:e.optimistic});e.optimistic&&t&&(r.fromOptimisticTransaction=!0),e.callback(r)},r}(Ce),Ot=function(){function e(e){var t=e.cache,r=e.client,n=e.resolvers,i=e.fragmentMatcher;this.cache=t,r&&(this.client=r),n&&this.addResolvers(n),i&&this.setFragmentMatcher(i)}return e.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=B(t.resolvers,e)})):this.resolvers=B(this.resolvers,e)},e.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},e.prototype.getResolvers=function(){return this.resolvers||{}},e.prototype.runResolvers=function(e){var r=e.document,n=e.remoteResult,i=e.context,o=e.variables,s=e.onlyRunForcedResolvers,a=void 0!==s&&s;return t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(e){return r?[2,this.resolveDocument(r,n.data,i,o,this.fragmentMatcher,a).then((function(e){return t.__assign(t.__assign({},n),{data:e.result})}))]:[2,n]}))}))},e.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},e.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},e.prototype.clientQuery=function(e){return h(["client"],e)&&this.resolvers?e:null},e.prototype.serverQuery=function(e){return function(e){R(e);var t=N([{test:function(e){return"client"===e.name.value},remove:!0}],e);return t&&(t=n.visit(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return E(e)&&"__typename"===e.name.value})))return null}}})),t}(e)},e.prototype.prepareContext=function(e){var r=this.cache;return t.__assign(t.__assign({},e),{cache:r,getCacheKey:function(e){return r.identify(e)}})},e.prototype.addExportedVariables=function(e,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,r)||{},this.prepareContext(n),r).then((function(e){return t.__assign(t.__assign({},r),e.exportedVariables)}))]:[2,t.__assign({},r)]}))}))},e.prototype.shouldForceResolvers=function(e){var t=!1;return n.visit(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some((function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value}))))return n.BREAK}}}),t},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:V(e),variables:t,returnPartialData:!0,optimistic:!1}).result},e.prototype.resolveDocument=function(e,r,n,i,o,s){return void 0===n&&(n={}),void 0===i&&(i={}),void 0===o&&(o=function(){return!0}),void 0===s&&(s=!1),t.__awaiter(this,void 0,void 0,(function(){var a,u,c,l,p,f,h,d,v;return t.__generator(this,(function(b){return a=I(e),u=P(e),c=y(u),l=a.operation,p=l?l.charAt(0).toUpperCase()+l.slice(1):"Query",h=(f=this).cache,d=f.client,v={fragmentMap:c,context:t.__assign(t.__assign({},n),{cache:h,client:d}),variables:i,fragmentMatcher:o,defaultOperationType:p,exportedVariables:{},onlyRunForcedResolvers:s},[2,this.resolveSelectionSet(a.selectionSet,r,v).then((function(e){return{result:e,exportedVariables:v.exportedVariables}}))]}))}))},e.prototype.resolveSelectionSet=function(e,n,i){return t.__awaiter(this,void 0,void 0,(function(){var o,s,a,u,c,l=this;return t.__generator(this,(function(p){return o=i.fragmentMap,s=i.context,a=i.variables,u=[n],c=function(e){return t.__awaiter(l,void 0,void 0,(function(){var c,l;return t.__generator(this,(function(t){return f(e,a)?E(e)?[2,this.resolveField(e,n,i).then((function(t){var r;void 0!==t&&u.push(((r={})[x(e)]=t,r))}))]:(q(e)?c=e:(c=o[e.name.value],r.invariant(c,11)),c&&c.typeCondition&&(l=c.typeCondition.name.value,i.fragmentMatcher(n,l,s))?[2,this.resolveSelectionSet(c.selectionSet,n,i).then((function(e){u.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(e.selections.map(c)).then((function(){return W(u)}))]}))}))},e.prototype.resolveField=function(e,r,n){return t.__awaiter(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,p,f,h=this;return t.__generator(this,(function(t){return i=n.variables,o=e.name.value,s=x(e),a=o!==s,u=r[s]||r[o],c=Promise.resolve(u),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(l=r.__typename||n.defaultOperationType,(p=this.resolvers&&this.resolvers[l])&&(f=p[a?o:s])&&(c=Promise.resolve(rt.withValue(this.cache,f,[r,w(e,i),n.context,{field:e,fragmentMap:n.fragmentMap}])))),[2,c.then((function(t){return void 0===t&&(t=u),e.directives&&e.directives.forEach((function(e){"export"===e.name.value&&e.arguments&&e.arguments.forEach((function(e){"as"===e.name.value&&"StringValue"===e.value.kind&&(n.exportedVariables[e.value.value]=t)}))})),e.selectionSet?null==t?t:Array.isArray(t)?h.resolveSubSelectedArray(e,t,n):e.selectionSet?h.resolveSelectionSet(e.selectionSet,t,n):void 0:t}))]}))}))},e.prototype.resolveSubSelectedArray=function(e,t,r){var n=this;return Promise.all(t.map((function(t){return null===t?null:Array.isArray(t)?n.resolveSubSelectedArray(e,t,r):e.selectionSet?n.resolveSelectionSet(e.selectionSet,t,r):void 0})))},e}(),wt=new(ne?WeakMap:Map);function xt(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return wt.set(e,(wt.get(e)+1)%1e15),r.apply(this,arguments)})}function kt(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var Et=function(){function e(e){this.cache=e,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.diff=null,this.observableQuery=null,wt.has(e)||(wt.set(e,0),xt(e,"evict"),xt(e,"modify"),xt(e,"reset"))}return e.prototype.init=function(e){var t=e.networkStatus||exports.NetworkStatus.loading;return this.variables&&this.networkStatus!==exports.NetworkStatus.loading&&!s.equal(this.variables,e.variables)&&(t=exports.NetworkStatus.setVariables),s.equal(e.variables,this.variables)||(this.diff=null),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},e.prototype.reset=function(){kt(this),this.diff=null,this.dirty=!1},e.prototype.getDiff=function(e){return void 0===e&&(e=this.variables),this.diff&&s.equal(e,this.variables)?this.diff:(this.updateWatch(this.variables=e),this.diff=this.cache.diff({query:this.document,variables:e,returnPartialData:!0,optimistic:!0}))},e.prototype.setDiff=function(e){var t=this,r=this.diff;this.diff=e,this.dirty||(e&&e.result)===(r&&r.result)||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout((function(){return t.notify()}),0)))},e.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){t.getDiff().fromOptimisticTransaction?e.observe():e.reobserve()})):delete this.oqListener)},e.prototype.notify=function(){var e=this;kt(this),this.shouldNotify()&&this.listeners.forEach((function(t){return t(e)})),this.dirty=!1},e.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Me(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if("cache-only"!==e&&"cache-and-network"!==e)return!1}return!0},e.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),delete this.cancel,this.subscriptions.forEach((function(e){return e.unsubscribe()}));var e=this.observableQuery;e&&e.stopPolling()}},e.prototype.cancel=function(){},e.prototype.updateWatch=function(e){var t=this;void 0===e&&(e=this.variables);var r=this.observableQuery;r&&"no-cache"===r.options.fetchPolicy||this.lastWatch&&this.lastWatch.query===this.document&&s.equal(e,this.lastWatch.variables)||(this.cancel(),this.cancel=this.cache.watch(this.lastWatch={query:this.document,variables:e,optimistic:!0,callback:function(e){return t.setDiff(e)}}))},e.prototype.shouldWrite=function(e,t){var r=this.lastWrite;return!(r&&r.dmCount===wt.get(this.cache)&&s.equal(t,r.variables)&&s.equal(e.data,r.result.data))},e.prototype.markResult=function(e,t,r){var n=this;this.graphQLErrors=te(e.errors)?e.errors:[],this.reset(),"no-cache"===t.fetchPolicy?this.diff={result:e.data,complete:!0}:!this.stopped&&r&&(qt(e,t.errorPolicy)?this.cache.performTransaction((function(r){if(n.shouldWrite(e,t.variables))r.writeQuery({query:n.document,data:e.data,variables:t.variables}),n.lastWrite={result:e,variables:t.variables,dmCount:wt.get(n.cache)};else if(n.diff&&n.diff.complete)return void(e.data=n.diff.result);var i=r.diff({query:n.document,variables:t.variables,returnPartialData:!0,optimistic:!0});n.stopped||n.updateWatch(t.variables),n.diff=i,i.complete&&(e.data=i.result)})):this.lastWrite=void 0)},e.prototype.markReady=function(){return this.networkError=null,this.networkStatus=exports.NetworkStatus.ready},e.prototype.markError=function(e){return this.networkStatus=exports.NetworkStatus.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}();function qt(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!re(e);return!n&&r&&e.data&&(n=!0),n}var Rt=Object.prototype.hasOwnProperty,Qt=function(){function e(e){var t=e.cache,r=e.link,n=e.queryDeduplication,i=void 0!==n&&n,o=e.onBroadcast,s=e.ssrMode,a=void 0!==s&&s,u=e.clientAwareness,c=void 0===u?{}:u,l=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(ne?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=r,this.queryDeduplication=i,this.clientAwareness=c,this.localState=l||new Ot({cache:t}),this.ssrMode=a,this.assumeImmutableResults=!!p,(this.onBroadcast=o)&&(this.mutationStore=Object.create(null))}return e.prototype.stop=function(){var e=this;this.queries.forEach((function(t,r){e.stopQueryNoBroadcast(r)})),this.cancelPendingFetches(new r.InvariantError(12))},e.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach((function(t){return t(e)})),this.fetchCancelFns.clear()},e.prototype.mutate=function(e){var n=e.mutation,i=e.variables,o=e.optimisticResponse,s=e.updateQueries,a=e.refetchQueries,u=void 0===a?[]:a,c=e.awaitRefetchQueries,l=void 0!==c&&c,p=e.update,f=e.errorPolicy,h=void 0===f?"none":f,d=e.fetchPolicy,v=e.context,y=void 0===v?{}:v;return t.__awaiter(this,void 0,void 0,(function(){var e,a,c;return t.__generator(this,(function(f){switch(f.label){case 0:return r.invariant(n,13),r.invariant(!d||"no-cache"===d,14),e=this.generateMutationId(),n=this.transform(n).document,i=this.getVariables(n,i),this.transform(n).hasClientExports?[4,this.localState.addExportedVariables(n,i,y)]:[3,2];case 1:i=f.sent(),f.label=2;case 2:return a=this.mutationStore&&(this.mutationStore[e]={mutation:n,variables:i,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:e,document:n,variables:i,errorPolicy:h,updateQueries:s,update:p}),this.broadcastQueries(),c=this,[2,new Promise((function(r,f){var v,b;c.getObservableFromLink(n,t.__assign(t.__assign({},y),{optimisticResponse:o}),i,!1).subscribe({next:function(t){if(re(t)&&"none"===h)b=new Qe({graphQLErrors:t.errors});else{if(a&&(a.loading=!1,a.error=null),"no-cache"!==d)try{c.markMutationResult({mutationId:e,result:t,document:n,variables:i,errorPolicy:h,updateQueries:s,update:p})}catch(e){return void(b=new Qe({networkError:e}))}v=t}},error:function(t){a&&(a.loading=!1,a.error=t),o&&c.cache.removeOptimistic(e),c.broadcastQueries(),f(new Qe({networkError:t}))},complete:function(){if(b&&a&&(a.loading=!1,a.error=b),o&&c.cache.removeOptimistic(e),c.broadcastQueries(),b)f(b);else{"function"==typeof u&&(u=u(v));var t=[];te(u)&&u.forEach((function(e){if("string"==typeof e)c.queries.forEach((function(r){var n=r.observableQuery;n&&n.hasObservers()&&n.queryName===e&&t.push(n.refetch())}));else{var r={query:e.query,variables:e.variables,fetchPolicy:"network-only"};e.context&&(r.context=e.context),t.push(c.query(r))}})),Promise.all(l?t:[]).then((function(){"ignore"===h&&v&&re(v)&&delete v.errors,r(v)}),f)}}})}))]}}))}))},e.prototype.markMutationResult=function(e,t){var r=this;if(void 0===t&&(t=this.cache),qt(e.result,e.errorPolicy)){var n=[{result:e.result.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}],i=e.updateQueries;i&&this.queries.forEach((function(o,s){var a=o.observableQuery,u=a&&a.queryName;if(u&&Rt.call(i,u)){var c=i[u],l=r.queries.get(s),p=l.document,f=l.variables,h=t.diff({query:p,variables:f,returnPartialData:!0,optimistic:!1}),d=h.result;if(h.complete&&d){var v=c(d,{mutationResult:e.result,queryName:p&&M(p)||void 0,queryVariables:f});v&&n.push({result:v,dataId:"ROOT_QUERY",query:p,variables:f})}}})),t.performTransaction((function(t){n.forEach((function(e){return t.write(e)}));var r=e.update;r&&r(t,e.result)}),null)}},e.prototype.markMutationOptimistic=function(e,r){var n=this,i="function"==typeof e?e(r.variables):e;return this.cache.recordOptimisticTransaction((function(e){try{n.markMutationResult(t.__assign(t.__assign({},r),{result:{data:i}}),e)}catch(e){}}),r.mutationId)},e.prototype.fetchQuery=function(e,t,r){return this.fetchQueryObservable(e,t,r).promise},e.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach((function(t,r){e[r]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}})),e},e.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},e.prototype.transform=function(e){var t,r=this.transformCache;if(!r.has(e)){var n=this.cache.transformDocument(e),i=(t=this.cache.transformForLink(n),N([L],R(t))),o=this.localState.clientQuery(n),s=i&&this.localState.serverQuery(i),a={document:n,hasClientExports:d(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:o,serverQuery:s,defaultVars:F(Q(n))},u=function(e){e&&!r.has(e)&&r.set(e,a)};u(e),u(n),u(o),u(s)}return r.get(e)},e.prototype.getVariables=function(e,r){return t.__assign(t.__assign({},this.transform(e).defaultVars),r)},e.prototype.watchQuery=function(e){void 0===(e=t.__assign(t.__assign({},e),{variables:this.getVariables(e.query,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var r=new Et(this.cache),n=new Ie({queryManager:this,queryInfo:r,options:e});return this.queries.set(n.queryId,r),r.init({document:e.query,observableQuery:n,variables:e.variables}),n},e.prototype.query=function(e){var t=this;r.invariant(e.query,15),r.invariant("Document"===e.query.kind,16),r.invariant(!e.returnPartialData,17),r.invariant(!e.pollInterval,18);var n=this.generateQueryId();return this.fetchQuery(n,e).finally((function(){return t.stopQuery(n)}))},e.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},e.prototype.generateRequestId=function(){return this.requestIdCounter++},e.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},e.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},e.prototype.clearStore=function(){return this.cancelPendingFetches(new r.InvariantError(19)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=exports.NetworkStatus.loading:e.stop()})),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset()},e.prototype.resetStore=function(){var e=this;return this.clearStore().then((function(){return e.reFetchObservableQueries()}))},e.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var r=[];return this.queries.forEach((function(n,i){var o=n.observableQuery;if(o&&o.hasObservers()){var s=o.options.fetchPolicy;o.resetLastResults(),"cache-only"===s||!e&&"standby"===s||r.push(o.refetch()),t.getQuery(i).setDiff(null)}})),this.broadcastQueries(),Promise.all(r)},e.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},e.prototype.startGraphQLSubscription=function(e){var t=this,r=e.query,n=e.fetchPolicy,i=e.errorPolicy,s=e.variables,a=e.context,u=void 0===a?{}:a;r=this.transform(r).document,s=this.getVariables(r,s);var c=function(e){return t.getObservableFromLink(r,u,e,!1).map((function(o){if("no-cache"!==n&&(qt(o,i)&&t.cache.write({query:r,result:o.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries()),re(o))throw new Qe({graphQLErrors:o.errors});return o}))};if(this.transform(r).hasClientExports){var l=this.localState.addExportedVariables(r,s,u).then(c);return new o((function(e){var t=null;return l.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return c(s)},e.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},e.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.getQuery(e).stop(),this.queries.delete(e)},e.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},e.prototype.getLocalState=function(){return this.localState},e.prototype.getObservableFromLink=function(e,r,n,i){var s,a,u=this;void 0===i&&(i=null!==(s=null==r?void 0:r.queryDeduplication)&&void 0!==s?s:this.queryDeduplication);var c=this.transform(e).serverQuery;if(c){var l=this.inFlightLinkObservables,p=this.link,f={query:c,variables:n,operationName:M(c)||void 0,context:this.prepareContext(t.__assign(t.__assign({},r),{forceFetch:!i}))};if(r=f.context,i){var h=l.get(c)||new Map;l.set(c,h);var d=JSON.stringify(n);if(!(a=h.get(d))){var v=new ee([ve(p,f)]);h.set(d,a=v),v.cleanup((function(){h.delete(d)&&h.size<1&&l.delete(c)}))}}else a=new ee([ve(p,f)])}else a=new ee([o.of({data:{}})]),r=this.prepareContext(r);var y=this.transform(e).clientQuery;return y&&(a=$(a,(function(e){return u.localState.runResolvers({document:y,remoteResult:e,context:r,variables:n})}))),a},e.prototype.getResultsFromLink=function(e,t,r){var n=e.lastRequestId;return $(this.getObservableFromLink(e.document,r.context,r.variables),(function(i){var o=te(i.errors);if(n>=e.lastRequestId){if(o&&"none"===r.errorPolicy)throw e.markError(new Qe({graphQLErrors:i.errors}));e.markResult(i,r,t),e.markReady()}var s={data:i.data,loading:!1,networkStatus:e.networkStatus||exports.NetworkStatus.ready};return o&&"ignore"!==r.errorPolicy&&(s.errors=i.errors),s}),(function(t){var r=qe(t)?t:new Qe({networkError:t});throw n>=e.lastRequestId&&e.markError(r),r}))},e.prototype.fetchQueryObservable=function(e,t,r){var n=this;void 0===r&&(r=exports.NetworkStatus.loading);var i=this.transform(t.query).document,o=this.getVariables(i,t.variables),s=this.getQuery(e),a=s.networkStatus,u=t.fetchPolicy,c=void 0===u?"cache-first":u,l=t.errorPolicy,p=void 0===l?"none":l,f=t.returnPartialData,h=void 0!==f&&f,d=t.notifyOnNetworkStatusChange,v=void 0!==d&&d,y=t.context,b=void 0===y?{}:y;("cache-first"===c||"cache-and-network"===c||"network-only"===c||"no-cache"===c)&&v&&"number"==typeof a&&a!==r&&Me(r)&&("cache-first"!==c&&(c="cache-and-network"),h=!0);var g=Object.assign({},t,{query:i,variables:o,fetchPolicy:c,errorPolicy:p,returnPartialData:h,notifyOnNetworkStatusChange:v,context:b}),m=function(e){return g.variables=e,n.fetchQueryByPolicy(s,g,r)};this.fetchCancelFns.set(e,(function(e){Promise.resolve().then((function(){return _.cancel(e)}))}));var _=new ee(this.transform(g.query).hasClientExports?this.localState.addExportedVariables(g.query,g.variables,g.context).then(m):m(g.variables));return _.cleanup((function(){n.fetchCancelFns.delete(e);var r=t.nextFetchPolicy;r&&(t.nextFetchPolicy=void 0,t.fetchPolicy="function"==typeof r?r.call(t,t.fetchPolicy||"cache-first"):r)})),_},e.prototype.fetchQueryByPolicy=function(e,r,n){var i=this,s=r.query,a=r.variables,u=r.fetchPolicy,c=r.errorPolicy,l=r.returnPartialData,p=r.context;e.init({document:s,variables:a,lastRequestId:this.generateRequestId(),networkStatus:n});var f=function(){return e.getDiff(a)},h=function(r,n){void 0===n&&(n=e.networkStatus||exports.NetworkStatus.loading);var u=r.result;var c=function(e){return o.of(t.__assign({data:e,loading:Me(n),networkStatus:n},r.complete?null:{partial:!0}))};return i.transform(s).hasForcedResolvers?i.localState.runResolvers({document:s,remoteResult:{data:u},context:p,variables:a,onlyRunForcedResolvers:!0}).then((function(e){return c(e.data)})):c(u)},d=function(t){return i.getResultsFromLink(e,t,{variables:a,context:p,fetchPolicy:u,errorPolicy:c})};switch(u){default:case"cache-first":return(v=f()).complete?[h(v,e.markReady())]:l?[h(v),d(!0)]:[d(!0)];case"cache-and-network":var v;return(v=f()).complete||l?[h(v),d(!0)]:[d(!0)];case"cache-only":return[h(f(),e.markReady())];case"network-only":return[d(!0)];case"no-cache":return[d(!1)];case"standby":return[]}},e.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Et(this.cache)),this.queries.get(e)},e.prototype.prepareContext=function(e){void 0===e&&(e={});var r=this.localState.prepareContext(e);return t.__assign(t.__assign({},r),{clientAwareness:this.clientAwareness})},e}();function Mt(e,r){return ie(e,r,r.variables&&{variables:t.__assign(t.__assign({},e.variables),r.variables)})}var Pt=function(){function e(e){var t=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=e.credentials,o=e.headers,s=e.cache,a=e.ssrMode,u=void 0!==a&&a,c=e.ssrForceFetchDelay,l=void 0===c?0:c,p=e.connectToDevTools,f=void 0===p?"object"==typeof window&&!window.__APOLLO_CLIENT__&&!1:p,h=e.queryDeduplication,d=void 0===h||h,v=e.defaultOptions,y=e.assumeImmutableResults,b=void 0!==y&&y,g=e.resolvers,m=e.typeDefs,_=e.fragmentMatcher,S=e.name,O=e.version,w=e.link;if(w||(w=n?new Ee({uri:n,credentials:i,headers:o}):le.empty()),!s)throw new r.InvariantError(9);this.link=w,this.cache=s,this.disableNetworkFetches=u||l>0,this.queryDeduplication=d,this.defaultOptions=v||{},this.typeDefs=m,l&&setTimeout((function(){return t.disableNetworkFetches=!1}),l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),f&&"object"==typeof window&&(window.__APOLLO_CLIENT__=this),this.version="3.3.14",this.localState=new Ot({cache:s,client:this,resolvers:g,fragmentMatcher:_}),this.queryManager=new Qt({cache:this.cache,link:this.link,queryDeduplication:d,ssrMode:u,clientAwareness:{name:S,version:O},localState:this.localState,assumeImmutableResults:b,onBroadcast:f?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return e.prototype.stop=function(){this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Mt(this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=t.__assign(t.__assign({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=Mt(this.defaultOptions.query,e)),r.invariant("cache-and-network"!==e.fetchPolicy,10),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=t.__assign(t.__assign({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Mt(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},e.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},e.prototype.writeQuery=function(e){this.cache.writeQuery(e),this.queryManager.broadcastQueries()},e.prototype.writeFragment=function(e){this.cache.writeFragment(e),this.queryManager.broadcastQueries()},e.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},e.prototype.__requestRaw=function(e){return ve(this.link,e)},e.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.resetStoreCallbacks.map((function(e){return e()})))})).then((function(){return e.reFetchObservableQueries()}))},e.prototype.clearStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.clearStoreCallbacks.map((function(e){return e()})))}))},e.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},e.prototype.extract=function(e){return this.cache.extract(e)},e.prototype.restore=function(e){return this.cache.restore(e)},e.prototype.addResolvers=function(e){this.localState.addResolvers(e)},e.prototype.setResolvers=function(e){this.localState.setResolvers(e)},e.prototype.getResolvers=function(){return this.localState.getResolvers()},e.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},e.prototype.setLink=function(e){this.link=this.queryManager.link=e},e}();r.setVerbosity("log");var It=c.resetCaches,Ft=c.disableFragmentWarnings,Ct=c.enableExperimentalFragmentVariables,Tt=c.disableExperimentalFragmentVariables,Dt=new(ne?WeakMap:Map);function jt(){var e=Dt.get(p.createContext);return e||((e=p.createContext({})).displayName="ApolloContext",Dt.set(p.createContext,e)),e}var Nt;(Nt=exports.DocumentType||(exports.DocumentType={}))[Nt.Query=0]="Query",Nt[Nt.Mutation=1]="Mutation",Nt[Nt.Subscription=2]="Subscription";var At=new Map;function Lt(e){var t;switch(e){case exports.DocumentType.Query:t="Query";break;case exports.DocumentType.Mutation:t="Mutation";break;case exports.DocumentType.Subscription:t="Subscription"}return t}function Vt(e){var t,n,i=At.get(e);if(i)return i;r.invariant(!!e&&!!e.kind,34);var o=e.definitions.filter((function(e){return"FragmentDefinition"===e.kind})),s=e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&"query"===e.operation})),a=e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})),u=e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&"subscription"===e.operation}));r.invariant(!o.length||s.length||a.length||u.length,35),r.invariant(s.length+a.length+u.length<=1,36),n=s.length?exports.DocumentType.Query:exports.DocumentType.Mutation,s.length||a.length||(n=exports.DocumentType.Subscription);var c=s.length?s:a.length?a:u;r.invariant(1===c.length,37);var l=c[0];t=l.variableDefinitions||[];var p={name:l.name&&"Name"===l.name.kind?l.name.value:"data",type:n,variables:t};return At.set(e,p),p}var zt=function(){function e(e,t){this.isMounted=!1,this.previousOptions={},this.context={},this.options={},this.options=e||{},this.context=t||{}}return e.prototype.getOptions=function(){return this.options},e.prototype.setOptions=function(e,t){void 0===t&&(t=!1),t&&!s.equal(this.options,e)&&(this.previousOptions=this.options),this.options=e},e.prototype.unmount=function(){this.isMounted=!1},e.prototype.refreshClient=function(){var e=this.options&&this.options.client||this.context&&this.context.client;r.invariant(!!e,29);var t=!1;return e!==this.client&&(t=!0,this.client=e,this.cleanup()),{client:this.client,isNew:t}},e.prototype.verifyDocumentType=function(e,t){var n=Vt(e);Lt(t),Lt(n.type);r.invariant(n.type===t,30)},e}(),Bt=function(e){function r(t){var r=t.options,n=t.context,i=t.setResult,o=e.call(this,r,n)||this;return o.currentObservable={},o.setResult=i,o.initialize(r),o}return t.__extends(r,e),r.prototype.execute=function(e){if(!0===this.getOptions().skip)return this.cleanup(),{loading:!1,error:void 0,data:void 0,variables:this.getOptions().variables};var r=e;this.refreshClient().isNew&&(r=this.getLoadingResult());var n=this.getOptions().shouldResubscribe;return"function"==typeof n&&(n=!!n(this.getOptions())),!1!==n&&this.previousOptions&&Object.keys(this.previousOptions).length>0&&(this.previousOptions.subscription!==this.getOptions().subscription||!s.equal(this.previousOptions.variables,this.getOptions().variables)||this.previousOptions.skip!==this.getOptions().skip)&&(this.cleanup(),r=this.getLoadingResult()),this.initialize(this.getOptions()),this.startSubscription(),this.previousOptions=this.getOptions(),t.__assign(t.__assign({},r),{variables:this.getOptions().variables})},r.prototype.afterExecute=function(){this.isMounted=!0},r.prototype.cleanup=function(){this.endSubscription(),delete this.currentObservable.query},r.prototype.initialize=function(e){this.currentObservable.query||!0===this.getOptions().skip||(this.currentObservable.query=this.refreshClient().client.subscribe({query:e.subscription,variables:e.variables,fetchPolicy:e.fetchPolicy,context:e.context}))},r.prototype.startSubscription=function(){this.currentObservable.subscription||(this.currentObservable.subscription=this.currentObservable.query.subscribe({next:this.updateCurrentData.bind(this),error:this.updateError.bind(this),complete:this.completeSubscription.bind(this)}))},r.prototype.getLoadingResult=function(){return{loading:!0,error:void 0,data:void 0}},r.prototype.updateResult=function(e){this.isMounted&&this.setResult(e)},r.prototype.updateCurrentData=function(e){var t=this.getOptions().onSubscriptionData;this.updateResult({data:e.data,loading:!1,error:void 0}),t&&t({client:this.refreshClient().client,subscriptionData:e})},r.prototype.updateError=function(e){this.updateResult({error:e,loading:!1})},r.prototype.completeSubscription=function(){var e=this;Promise.resolve().then((function(){var t=e.getOptions().onSubscriptionComplete;t&&t(),e.endSubscription()}))},r.prototype.endSubscription=function(){this.currentObservable.subscription&&(this.currentObservable.subscription.unsubscribe(),delete this.currentObservable.subscription)},r}(zt),Wt=function(e){function r(t){var r=t.options,n=t.context,i=t.result,o=t.setResult,s=e.call(this,r,n)||this;return s.runMutation=function(e){void 0===e&&(e={}),s.onMutationStart();var t=s.generateNewMutationId();return s.mutate(e).then((function(e){return s.onMutationCompleted(e,t),e})).catch((function(e){if(s.onMutationError(e,t),!s.getOptions().onError)throw e}))},s.verifyDocumentType(r.mutation,exports.DocumentType.Mutation),s.result=i,s.setResult=o,s.mostRecentMutationId=0,s}return t.__extends(r,e),r.prototype.execute=function(e){return this.isMounted=!0,this.verifyDocumentType(this.getOptions().mutation,exports.DocumentType.Mutation),[this.runMutation,t.__assign(t.__assign({},e),{client:this.refreshClient().client})]},r.prototype.afterExecute=function(){return this.isMounted=!0,this.unmount.bind(this)},r.prototype.cleanup=function(){},r.prototype.mutate=function(e){return this.refreshClient().client.mutate(Mt(this.getOptions(),e))},r.prototype.onMutationStart=function(){this.result.loading||this.getOptions().ignoreResults||this.updateResult({loading:!0,error:void 0,data:void 0,called:!0})},r.prototype.onMutationCompleted=function(e,t){var r=this.getOptions(),n=r.onCompleted,i=r.ignoreResults,o=e.data,s=e.errors,a=s&&s.length>0?new Qe({graphQLErrors:s}):void 0;this.isMostRecentMutation(t)&&!i&&this.updateResult({called:!0,loading:!1,data:o,error:a}),n&&n(o)},r.prototype.onMutationError=function(e,t){var r=this.getOptions().onError;this.isMostRecentMutation(t)&&this.updateResult({loading:!1,error:e,data:void 0,called:!0}),r&&r(e)},r.prototype.generateNewMutationId=function(){return++this.mostRecentMutationId},r.prototype.isMostRecentMutation=function(e){return this.mostRecentMutationId===e},r.prototype.updateResult=function(e){!this.isMounted||this.previousResult&&s.equal(this.previousResult,e)||(this.setResult(e),this.previousResult=e)},r}(zt),Ut=function(e){function r(r){var n=r.options,i=r.context,o=r.onNewData,s=e.call(this,n,i)||this;return s.runLazy=!1,s.previous=Object.create(null),s.runLazyQuery=function(e){s.cleanup(),s.runLazy=!0,s.lazyOptions=e,s.onNewData()},s.getQueryResult=function(){var e=s.observableQueryFields(),r=s.getOptions();if(r.skip)e=t.__assign(t.__assign({},e),{data:void 0,error:void 0,loading:!1,networkStatus:exports.NetworkStatus.ready,called:!0});else if(s.currentObservable){var n=s.currentObservable.getCurrentResult(),i=n.data,o=n.loading,a=n.partial,u=n.networkStatus,c=n.errors,l=n.error;if(c&&c.length>0&&(l=new Qe({graphQLErrors:c})),e=t.__assign(t.__assign({},e),{data:i,loading:o,networkStatus:u,error:l,called:!0}),o);else if(l)Object.assign(e,{data:(s.currentObservable.getLastResult()||{}).data});else{var p=s.currentObservable.options.fetchPolicy;if(r.partialRefetch&&a&&(!i||0===Object.keys(i).length)&&"cache-only"!==p)return Object.assign(e,{loading:!0,networkStatus:exports.NetworkStatus.loading}),e.refetch(),e}}e.client=s.client,s.setOptions(r,!0);var f=s.previous.result;return s.previous.loading=f&&f.loading||!1,e.previousData=f&&(f.data||f.previousData),s.previous.result=e,s.currentObservable&&s.currentObservable.resetQueryStoreErrors(),e},s.obsRefetch=function(e){var t;return null===(t=s.currentObservable)||void 0===t?void 0:t.refetch(e)},s.obsFetchMore=function(e){return s.currentObservable.fetchMore(e)},s.obsUpdateQuery=function(e){return s.currentObservable.updateQuery(e)},s.obsStartPolling=function(e){var t;null===(t=s.currentObservable)||void 0===t||t.startPolling(e)},s.obsStopPolling=function(){var e;null===(e=s.currentObservable)||void 0===e||e.stopPolling()},s.obsSubscribeToMore=function(e){return s.currentObservable.subscribeToMore(e)},s.onNewData=o,s}return t.__extends(r,e),r.prototype.execute=function(){this.refreshClient();var e=this.getOptions(),t=e.skip,r=e.query;return(t||r!==this.previous.query)&&(this.removeQuerySubscription(),this.removeObservable(!t),this.previous.query=r),this.updateObservableQuery(),this.isMounted&&this.startQuerySubscription(),this.getExecuteSsrResult()||this.getExecuteResult()},r.prototype.executeLazy=function(){return this.runLazy?[this.runLazyQuery,this.execute()]:[this.runLazyQuery,{loading:!1,networkStatus:exports.NetworkStatus.ready,called:!1,data:void 0}]},r.prototype.fetchData=function(){var e=this,t=this.getOptions();return!t.skip&&!1!==t.ssr&&new Promise((function(t){return e.startQuerySubscription(t)}))},r.prototype.afterExecute=function(e){var t=(void 0===e?{}:e).lazy,r=void 0!==t&&t;return this.isMounted=!0,r&&!this.runLazy||this.handleErrorOrCompleted(),this.previousOptions=this.getOptions(),this.unmount.bind(this)},r.prototype.cleanup=function(){this.removeQuerySubscription(),this.removeObservable(!0),delete this.previous.result},r.prototype.getOptions=function(){var r=e.prototype.getOptions.call(this);return this.lazyOptions&&(r.variables=t.__assign(t.__assign({},r.variables),this.lazyOptions.variables),r.context=t.__assign(t.__assign({},r.context),this.lazyOptions.context)),this.runLazy&&delete r.skip,r},r.prototype.ssrInitiated=function(){return this.context&&this.context.renderPromises},r.prototype.getExecuteResult=function(){var e=this.getQueryResult();return this.startQuerySubscription(),e},r.prototype.getExecuteSsrResult=function(){var e,r=this.getOptions(),n=r.ssr,i=r.skip,o=!1===n,s=this.refreshClient().client.disableNetworkFetches,a=t.__assign({loading:!0,networkStatus:exports.NetworkStatus.loading,called:!0,data:void 0,stale:!1,client:this.client},this.observableQueryFields());return o&&(this.ssrInitiated()||s)?(this.previous.result=a,a):(this.ssrInitiated()&&(e=i?this.getQueryResult():this.context.renderPromises.addQueryPromise(this,this.getQueryResult)||a),e)},r.prototype.prepareObservableQueryOptions=function(){var e=this.getOptions();this.verifyDocumentType(e.query,exports.DocumentType.Query);var r=e.displayName||"Query";return!this.ssrInitiated()||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e.fetchPolicy="cache-first"),t.__assign(t.__assign({},e),{displayName:r,context:e.context})},r.prototype.initializeObservableQuery=function(){if(this.ssrInitiated()&&(this.currentObservable=this.context.renderPromises.getSSRObservable(this.getOptions())),!this.currentObservable){var e=this.prepareObservableQueryOptions();this.previous.observableQueryOptions=t.__assign(t.__assign({},e),{children:null}),this.currentObservable=this.refreshClient().client.watchQuery(t.__assign({},e)),this.ssrInitiated()&&this.context.renderPromises.registerSSRObservable(this.currentObservable,e)}},r.prototype.updateObservableQuery=function(){if(this.currentObservable){if(!this.getOptions().skip){var e=t.__assign(t.__assign({},this.prepareObservableQueryOptions()),{children:null});s.equal(e,this.previous.observableQueryOptions)||(this.previous.observableQueryOptions=e,this.currentObservable.setOptions(e).catch((function(){})))}}else this.initializeObservableQuery()},r.prototype.startQuerySubscription=function(e){var t=this;void 0===e&&(e=this.onNewData),this.currentSubscription||this.getOptions().skip||(this.currentSubscription=this.currentObservable.subscribe({next:function(r){var n=r.loading,i=r.networkStatus,o=r.data,a=t.previous.result;a&&a.loading===n&&a.networkStatus===i&&s.equal(a.data,o)||e()},error:function(r){if(t.resubscribeToQuery(),!r.hasOwnProperty("graphQLErrors"))throw r;var n=t.previous.result;(n&&n.loading||!s.equal(r,t.previous.error))&&(t.previous.error=r,e())}}))},r.prototype.resubscribeToQuery=function(){this.removeQuerySubscription();var e=this.currentObservable;if(e){var t=e.getLastError(),r=e.getLastResult();e.resetLastResults(),this.startQuerySubscription(),Object.assign(e,{lastError:t,lastResult:r})}},r.prototype.handleErrorOrCompleted=function(){if(this.currentObservable&&this.previous.result){var e=this.previous.result,t=e.data,r=e.loading,n=e.error;if(!r){var i=this.getOptions(),o=i.query,a=i.variables,u=i.onCompleted,c=i.onError,l=i.skip;if(this.previousOptions&&!this.previous.loading&&s.equal(this.previousOptions.query,o)&&s.equal(this.previousOptions.variables,a))return;!u||n||l?c&&n&&c(n):u(t)}}},r.prototype.removeQuerySubscription=function(){this.currentSubscription&&(this.currentSubscription.unsubscribe(),delete this.currentSubscription)},r.prototype.removeObservable=function(e){this.currentObservable&&(this.currentObservable.tearDownQuery(),e&&delete this.currentObservable)},r.prototype.observableQueryFields=function(){var e;return{variables:null===(e=this.currentObservable)||void 0===e?void 0:e.variables,refetch:this.obsRefetch,fetchMore:this.obsFetchMore,updateQuery:this.obsUpdateQuery,startPolling:this.obsStartPolling,stopPolling:this.obsStopPolling,subscribeToMore:this.obsSubscribeToMore}},r}(zt);function Kt(e,r,n){void 0===n&&(n=!1);var i=l.useContext(jt()),o=l.useReducer((function(e){return e+1}),0),a=o[0],u=o[1],c=r?t.__assign(t.__assign({},r),{query:e}):{query:e},p=l.useRef(),f=p.current||(p.current=new Ut({options:c,context:i,onNewData:function(){f.ssrInitiated()?u():Promise.resolve().then((function(){return p.current&&u()}))}}));f.setOptions(c),f.context=i;var h,d,v,y={options:t.__assign(t.__assign({},c),{onError:void 0,onCompleted:void 0}),context:i,tick:a},b=(h=function(){return n?f.executeLazy():f.execute()},d=y,(v=l.useRef()).current&&s.equal(d,v.current.key)||(v.current={key:d,value:h()}),v.current.value),g=n?b[1]:b;return l.useEffect((function(){return function(){return f.cleanup()}}),[]),l.useEffect((function(){return f.afterExecute({lazy:n})}),[g.loading,g.networkStatus,g.error,g.data]),b}exports.setLogVerbosity=r.setVerbosity,exports.Observable=o,exports.gql=c,exports.ApolloCache=Ce,exports.ApolloClient=Pt,exports.ApolloConsumer=function(e){var t=jt();return p.createElement(t.Consumer,null,(function(t){return r.invariant(t&&t.client,27),e.children(t.client)}))},exports.ApolloError=Qe,exports.ApolloLink=le,exports.ApolloProvider=function(e){var t=e.client,n=e.children,i=jt();return p.createElement(i.Consumer,null,(function(e){return void 0===e&&(e={}),t&&e.client!==t&&(e=Object.assign({},e,{client:t})),r.invariant(e.client,28),p.createElement(i.Provider,{value:e},n)}))},exports.HttpLink=Ee,exports.InMemoryCache=St,exports.MissingFieldError=Te,exports.ObservableQuery=Ie,exports.checkFetcher=Se,exports.concat=de,exports.createHttpLink=ke,exports.createSignalIfSupported=Oe,exports.defaultDataIdFromObject=ct,exports.disableExperimentalFragmentVariables=Tt,exports.disableFragmentWarnings=Ft,exports.empty=pe,exports.enableExperimentalFragmentVariables=Ct,exports.execute=ve,exports.fallbackHttpConfig=me,exports.from=fe,exports.fromError=oe,exports.fromPromise=function(e){return new o((function(t){e.then((function(e){t.next(e),t.complete()})).catch(t.error.bind(t))}))},exports.getApolloContext=jt,exports.isApolloError=qe,exports.isReference=m,exports.makeReference=g,exports.makeVar=st,exports.mergeOptions=Mt,exports.operationName=Lt,exports.parseAndCheckHttpResponse=be,exports.parser=Vt,exports.resetApolloContext=jt,exports.resetCaches=It,exports.rewriteURIForGET=xe,exports.selectHttpOptionsAndBody=_e,exports.selectURI=we,exports.serializeFetchParameter=ge,exports.split=he,exports.throwServerError=se,exports.toPromise=function(e){var t=!1;return new Promise((function(r,n){e.subscribe({next:function(e){t||(t=!0,r(e))},error:n})}))},exports.useApolloClient=function(){var e=p.useContext(jt()).client;return r.invariant(e,33),e},exports.useLazyQuery=function(e,t){return Kt(e,t,!0)},exports.useMutation=function(e,r){var n=l.useContext(jt()),i=l.useState({called:!1,loading:!1}),o=i[0],s=i[1],a=r?t.__assign(t.__assign({},r),{mutation:e}):{mutation:e},u=l.useRef(),c=(u.current||(u.current=new Wt({options:a,context:n,result:o,setResult:s})),u.current);return c.setOptions(a),c.context=n,l.useEffect((function(){return c.afterExecute()})),c.execute(o)},exports.useQuery=function(e,t){return Kt(e,t,!1)},exports.useReactiveVar=function(e){var t=e(),r=l.useState(t)[1];return l.useEffect((function(){return e.onNextChange(r)}),[t]),l.useEffect((function(){r(e())}),[]),t},exports.useSubscription=function(e,r){var n=l.useContext(jt()),i=r?t.__assign(t.__assign({},r),{subscription:e}):{subscription:e},o=l.useState({loading:!i.skip,error:void 0,data:void 0}),s=o[0],a=o[1],u=l.useRef(),c=(u.current||(u.current=new Bt({options:i,context:n,setResult:a})),u.current);return c.setOptions(i,!0),c.context=n,l.useEffect((function(){return c.afterExecute()})),l.useEffect((function(){return c.cleanup.bind(c)}),[]),c.execute(s)};
@@ -1153,7 +1153,7 @@ var Policies = (function () {
1153
1153
  break;
1154
1154
  }
1155
1155
  }
1156
- id = id && String(id);
1156
+ id = id ? String(id) : void 0;
1157
1157
  return context.keyObject ? [id, context.keyObject] : [id];
1158
1158
  };
1159
1159
  Policies.prototype.addTypePolicies = function (typePolicies) {
@@ -1359,6 +1359,9 @@ var Policies = (function () {
1359
1359
  ? utilities.storeKeyNameFromField(fieldSpec.field, fieldSpec.variables)
1360
1360
  : utilities.getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec));
1361
1361
  }
1362
+ if (storeFieldName === false) {
1363
+ return fieldName;
1364
+ }
1362
1365
  return fieldName === fieldNameFromStoreName(storeFieldName)
1363
1366
  ? storeFieldName
1364
1367
  : fieldName + ":" + storeFieldName;