@apollo/client 3.2.0-beta.9 → 3.2.2

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 (79) hide show
  1. package/LICENSE +1 -1
  2. package/apollo-client.cjs.js +161 -102
  3. package/apollo-client.cjs.js.map +1 -1
  4. package/apollo-client.cjs.min.js +1 -1
  5. package/cache/cache.cjs.js +117 -64
  6. package/cache/cache.cjs.js.map +1 -1
  7. package/cache/core/types/common.d.ts +3 -0
  8. package/cache/core/types/common.d.ts.map +1 -1
  9. package/cache/core/types/common.js.map +1 -1
  10. package/cache/inmemory/entityStore.d.ts +5 -1
  11. package/cache/inmemory/entityStore.d.ts.map +1 -1
  12. package/cache/inmemory/entityStore.js +32 -19
  13. package/cache/inmemory/entityStore.js.map +1 -1
  14. package/cache/inmemory/helpers.d.ts +3 -1
  15. package/cache/inmemory/helpers.d.ts.map +1 -1
  16. package/cache/inmemory/helpers.js +19 -3
  17. package/cache/inmemory/helpers.js.map +1 -1
  18. package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
  19. package/cache/inmemory/inMemoryCache.js +3 -2
  20. package/cache/inmemory/inMemoryCache.js.map +1 -1
  21. package/cache/inmemory/policies.d.ts +6 -5
  22. package/cache/inmemory/policies.d.ts.map +1 -1
  23. package/cache/inmemory/policies.js +57 -26
  24. package/cache/inmemory/policies.js.map +1 -1
  25. package/cache/inmemory/readFromStore.d.ts +1 -2
  26. package/cache/inmemory/readFromStore.d.ts.map +1 -1
  27. package/cache/inmemory/readFromStore.js +5 -14
  28. package/cache/inmemory/readFromStore.js.map +1 -1
  29. package/cache/inmemory/types.d.ts +2 -1
  30. package/cache/inmemory/types.d.ts.map +1 -1
  31. package/cache/inmemory/writeToStore.d.ts.map +1 -1
  32. package/cache/inmemory/writeToStore.js +4 -3
  33. package/cache/inmemory/writeToStore.js.map +1 -1
  34. package/core/ApolloClient.js +2 -2
  35. package/core/LocalState.js +1 -1
  36. package/core/ObservableQuery.d.ts.map +1 -1
  37. package/core/ObservableQuery.js +9 -10
  38. package/core/ObservableQuery.js.map +1 -1
  39. package/core/QueryInfo.d.ts +2 -1
  40. package/core/QueryInfo.d.ts.map +1 -1
  41. package/core/QueryInfo.js +11 -7
  42. package/core/QueryInfo.js.map +1 -1
  43. package/core/QueryManager.d.ts +1 -1
  44. package/core/QueryManager.d.ts.map +1 -1
  45. package/core/QueryManager.js +17 -14
  46. package/core/QueryManager.js.map +1 -1
  47. package/core/Reobserver.js +1 -1
  48. package/core/core.cjs.js +39 -33
  49. package/core/core.cjs.js.map +1 -1
  50. package/core/types.d.ts +1 -1
  51. package/core/types.d.ts.map +1 -1
  52. package/core/watchQueryOptions.d.ts +1 -0
  53. package/core/watchQueryOptions.d.ts.map +1 -1
  54. package/invariantErrorCodes.js +32 -28
  55. package/link/core/ApolloLink.js +1 -1
  56. package/link/core/core.cjs.js +1 -1
  57. package/link/core/core.cjs.js.map +1 -1
  58. package/link/http/checkFetcher.js +1 -1
  59. package/link/http/http.cjs.js +2 -2
  60. package/link/http/http.cjs.js.map +1 -1
  61. package/link/http/serializeFetchParameter.js +1 -1
  62. package/link/persisted-queries/index.d.ts +30 -0
  63. package/link/persisted-queries/index.d.ts.map +1 -0
  64. package/link/persisted-queries/index.js +154 -0
  65. package/link/persisted-queries/index.js.map +1 -0
  66. package/link/persisted-queries/package.json +6 -0
  67. package/link/persisted-queries/persisted-queries.cjs.js +155 -0
  68. package/link/persisted-queries/persisted-queries.cjs.js.map +1 -0
  69. package/package.json +15 -10
  70. package/react/data/QueryData.js +2 -2
  71. package/react/data/QueryData.js.map +1 -1
  72. package/react/data/data.cjs.js +2 -2
  73. package/react/data/data.cjs.js.map +1 -1
  74. package/utilities/policies/pagination.d.ts +21 -12
  75. package/utilities/policies/pagination.d.ts.map +1 -1
  76. package/utilities/policies/pagination.js +49 -37
  77. package/utilities/policies/pagination.js.map +1 -1
  78. package/utilities/utilities.cjs.js +48 -37
  79. package/utilities/utilities.cjs.js.map +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/language/visitor"),i=e(require("fast-json-stable-stringify")),o=e(require("zen-observable"));require("symbol-observable");var s=require("graphql/language/printer"),a=require("@wry/equality"),u=require("optimism"),c=require("@wry/context"),l=e(require("graphql-tag")),f=require("react"),p=e(f);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 v(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&&v(["client"],e)&&v(["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 m(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 _(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 q(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[k(o)]}else{var s=q(e,m(o,r).selectionSet,r);if("string"==typeof s)return s}}}function E(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 I(e){return Q(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function F(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||null}function M(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function P(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 D(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 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 N(e){return function e(t,r){return t.selectionSet.selections.every((function(t){return"FragmentSpread"===t.kind&&e(r[t.name.value],r)}))}(I(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(M(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 A(e,r){var i=Object.create(null),o=[],s=Object.create(null),a=[],u=N(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)||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(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 N(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 N(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 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])})}}}}})}L.added=function(e){return e===T};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 B(e){return"query"===P(e).operation?e:n.visit(e,{OperationDefinition:{enter:function(e){return t.__assign(t.__assign({},e),{operation:"query"})}}})}var W=Object.prototype.hasOwnProperty;function z(){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(W.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 X(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function Z(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)}},f=e.subscribe(l);return function(){return f.unsubscribe()}}))}function $(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.promise=new Promise((function(e,t){r.resolve=e,r.reject=t})),r.handlers={next:function(e){null!==r.sub&&(r.latest=["next",e],X(r.observers,"next",e))},error:function(e){null!==r.sub&&(r.sub&&r.sub.unsubscribe(),r.sub=null,r.latest=["error",e],r.reject(e),X(r.observers,"error",e))},complete:function(){if(null!==r.sub){var e=r.sources.shift();e?$(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(),X(r.observers,"complete"))}}},r.cancel=function(e){r.reject(e),r.sources=[],r.handlers.complete()},r.promise.catch((function(e){})),$(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.addObserver=function(e){if(!this.observers.has(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()}this.observers.add(e)}},r.prototype.removeObserver=function(e,t){if(this.observers.delete(e)&&this.observers.size<1){if(t)return;this.sub&&(this.sub.unsubscribe(),this.reject(new Error("Observable cancelled prematurely"))),this.sub=null}},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};this.addObserver(i)},r}(o);function te(e){return Array.isArray(e)&&e.length>0}function re(e){return e.errors&&e.errors.length>0||!1}"function"==typeof Symbol&&Symbol.species&&Object.defineProperty(ee,Symbol.species,{value:o});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?F(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(23)},e.prototype.onError=function(e){throw e},e.prototype.setOnError=function(e){return this.onError=e,this},e}(),fe=le.empty,pe=le.from,he=le.split,ve=le.concat,de=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 me=function(e,t){var n;try{n=JSON.stringify(e)}catch(e){var i=new r.InvariantError(25);throw i.parseError=e,i}return n},ge={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},_e=function(e,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var o=t.__assign(t.__assign({},r.options),{headers:r.headers,credentials:r.credentials}),a=r.http||{};n.forEach((function(e){o=t.__assign(t.__assign(t.__assign({},o),e.options),{headers:t.__assign(t.__assign({},o.headers),e.headers)}),e.credentials&&(o.credentials=e.credentials),a=t.__assign(t.__assign({},a),e.http)}));var u=e.operationName,c=e.extensions,l=e.variables,f=e.query,p={operationName:u,variables:l};return a.includeExtensions&&(p.extensions=c),a.includeQuery&&(p.query=s.print(f)),{options:o,body:p}},Se=function(e){if(!e&&"undefined"==typeof fetch)throw new r.InvariantError(24)},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=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 ke=function(e){void 0===e&&(e={});var r=e.uri,n=void 0===r?"/graphql":r,i=e.fetch,s=e.includeExtensions,a=e.useGETForQueries,u=t.__rest(e,["uri","fetch","includeExtensions","useGETForQueries"]);Se(i),i||(i=fetch);var c={http:{includeExtensions:s},options:u.fetchOptions,credentials:u.credentials,headers:u.headers};return new le((function(e){var r=we(e,n),s=e.getContext(),u={};if(s.clientAwareness){var l=s.clientAwareness,f=l.name,p=l.version;f&&(u["apollographql-client-name"]=f),p&&(u["apollographql-client-version"]=p)}var h,v=t.__assign(t.__assign({},u),s.headers),d={http:s.http,options:s.fetchOptions,credentials:s.credentials,headers:v},y=_e(e,ge,c,d),b=y.options,m=y.body;if(!b.signal){var g=Oe(),_=g.controller,S=g.signal;(h=_)&&(b.signal=S)}if(a&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(b.method="GET"),"GET"===b.method){var O=xe(r,m),w=O.newURI,x=O.parseError;if(x)return oe(x);r=w}else try{b.body=me(m)}catch(x){return oe(x)}return new o((function(t){return i(r,b).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(){h&&h.abort()}}))}))},qe=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 Ee(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),Ie=function(){function e(){this.store={}}return e.prototype.getStore=function(){return this.store},e.prototype.get=function(e){return this.store[e]},e.prototype.initMutation=function(e,t,r){this.store[e]={mutation:t,variables:r||{},loading:!0,error:null}},e.prototype.markMutationError=function(e,t){var r=this.store[e];r&&(r.loading=!1,r.error=t)},e.prototype.markMutationResult=function(e){var t=this.store[e];t&&(t.loading=!1,t.error=null)},e.prototype.reset=function(){this.store={}},e}();function Fe(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 Me=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,22),!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}(),Pe=function(e){function n(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),X(s.observers,"next",e))},error:function(e){s.updateLastResult(t.__assign(t.__assign({},s.lastResult),{errors:e.graphQLErrors,networkStatus:exports.NetworkStatus.error,loading:!1})),X(s.observers,"error",s.lastError=e)}},s.isTornDown=!1,s.options=o,s.queryId=n.generateQueryId();var a=I(o.query);return s.queryName=a&&a.name&&a.name.value,s.queryManager=n,s.queryInfo=i,s}return t.__extends(n,e),Object.defineProperty(n.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),n.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)}))},n.prototype.getCurrentResult=function(e){void 0===e&&(e=!0);var r=this.lastResult,n=this.lastError,i=this.queryInfo.networkStatus||exports.NetworkStatus.ready,o=t.__assign(t.__assign({},n?{error:n}:r),{loading:Fe(i),networkStatus:i});if(this.isTornDown)return o;var s=this.options.fetchPolicy,a=void 0===s?"cache-first":s;if("no-cache"===a||"network-only"===a)delete o.partial;else if(!o.data||!this.queryManager.transform(this.options.query).hasForcedResolvers){var u=this.queryInfo.getDiff();o.data=u.complete||this.options.returnPartialData?u.result:void 0,u.complete?(o.networkStatus!==exports.NetworkStatus.loading||"cache-first"!==a&&"cache-only"!==a||(o.networkStatus=exports.NetworkStatus.ready,o.loading=!1),delete o.partial):o.partial=!0}return e&&this.updateLastResult(o),o},n.prototype.isDifferentFromLastResult=function(e){return!a.equal(this.lastResultSnapshot,e)},n.prototype.getLastResult=function(){return this.lastResult},n.prototype.getLastError=function(){return this.lastError},n.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},n.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},n.prototype.refetch=function(e){var n=this.options.fetchPolicy;if("cache-only"===n)return Promise.reject(new r.InvariantError(13));var i={pollInterval:0};return"no-cache"!==n&&"cache-and-network"!==n&&(i.fetchPolicy="network-only",i.nextFetchPolicy=n||"cache-first"),e&&!a.equal(this.options.variables,e)&&(i.variables=this.options.variables=t.__assign(t.__assign({},this.options.variables),e)),this.newReobserver(!1).reobserve(i,exports.NetworkStatus.refetch)},n.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()}))},n.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()}},n.prototype.setOptions=function(e){return this.reobserve(e)},n.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)},n.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())},n.prototype.startPolling=function(e){this.getReobserver().updateOptions({pollInterval:e})},n.prototype.stopPolling=function(){this.reobserver&&this.reobserver.updateOptions({pollInterval:0})},n.prototype.updateLastResult=function(e){var t=this.lastResult;return this.lastResult=e,this.lastResultSnapshot=this.queryManager.assumeImmutableResults?e:Y(e),te(e.errors)||delete this.lastError,t},n.prototype.onSubscribe=function(e){var t=this;if(e===this.observer)return function(){};try{var r=e._subscription._observer;r&&!r.error&&(r.error=De)}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()}},n.prototype.getReobserver=function(){return this.reobserver||(this.reobserver=this.newReobserver(!0))},n.prototype.newReobserver=function(e){var r=this,n=this.queryManager,i=this.queryId;return n.setObservableQuery(this),new Me(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!Fe(r.queryInfo.networkStatus)})},n.prototype.reobserve=function(e,t){return this.isTornDown=!1,this.getReobserver().reobserve(e,t)},n.prototype.observe=function(){this.observer.next(this.getCurrentResult(!1))},n.prototype.tearDownQuery=function(){var e=this.queryManager;this.reobserver&&(this.reobserver.stop(),delete this.reobserver),this.isTornDown=!0,this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),e.stopQuery(this.queryId),this.observers.clear()},n}(o);function De(e){}var Ce=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=!1),this.read({rootId:e.id||"ROOT_QUERY",query:e.query,variables:e.variables,optimistic:t})},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.read({query:this.getFragmentDoc(e.fragment,e.fragmentName),variables:e.variables,rootId:e.id,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},Ne=Object.prototype.hasOwnProperty;var je=/^[_A-Za-z0-9]+/;function Ae(e){var t=e.match(je);return t?t[0]:e}function Le(e){return null!==e&&"object"==typeof e&&!_(e)&&!Array.isArray(e)}function Ve(e){var t=e&&e.__field;return t&&E(t)}var Be=function(e,t,r){var n=e[r],i=t[r];return Ve(n)?(n.__value=this.merge(n.__value,Ve(i)?i.__value:i),n):Ve(i)?(i.__value=this.merge(n,i.__value),i):this.merge(n,i)},We=Object.create(null),ze=function(){return We},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 g(e);if(_(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),Ne.call(this.data,e)){var r=this.data[e];if(r&&Ne.call(r,t))return r[t]}return"__typename"===t&&Ne.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"),Ne.call(this.data,e)?this.data[e]:this instanceof Ge?this.parent.lookup(e,t):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){n&&n[e]===i[e]||(o[Ae(e)]=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,t){var r=this,n=this.lookup(e);if(n){var i=Object.create(null),o=!1,s=!0,a=function(t,n){return r.policies.readField("string"==typeof t?{fieldName:t,from:n||g(e)}:t,{store:r})};if(Object.keys(n).forEach((function(e){var u=Ae(e),c=n[e];if(void 0!==c){var l="function"==typeof t?t:t[e]||t[u];if(l){var f=l===ze?We:l(c,{DELETE:We,fieldName:u,storeFieldName:e,isReference:_,toReference:r.toReference,canRead:r.canRead,readField:a});f===We&&(f=void 0),f!==c&&(i[e]=f,o=!0,c=f)}void 0!==c&&(s=!1)}})),o)return this.merge(e,i),s&&(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]=ze,n):ze)}return!1},e.prototype.evict=function(e){var t=!1;return e.id&&(Ne.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.replace=function(e){var t=this;Object.keys(this.data).forEach((function(r){e&&Ne.call(e,r)||t.delete(r)})),e&&Object.keys(e).forEach((function(r){t.merge(r,e[r])}))},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),e},e.prototype.gc=function(){var e=this,t=this.getRootIdSet(),r=this.toObject();t.forEach((function(n){Ne.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(!Ne.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(ne),this.d=e?u.dep():null}return e.prototype.depend=function(e,t){this.d&&this.d(Je(e,t))},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(Je(e,t))},e}();function Je(e,t){return Ae(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.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}(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 Ne.call(this.data,r)?t.__assign(t.__assign({},n),e.prototype.findChildRefIds.call(this,r)):n},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 Xe(e,t){return new Te(e.message,t.path.slice(),t.query,t.clientOnly,t.variables)}var Ze=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.readQueryFromStore=function(e){return this.diffQueryAgainstStore(t.__assign(t.__assign({},e),{returnPartialData:!1})).result},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,f=this.config.cache.policies;u=t.__assign(t.__assign({},D((n=I(o),r.invariant(n&&"query"===n.operation,48),n))),u);var p=this.executeSelectionSet({selectionSet:P(o).selectionSet,objectOrReference:g(a),context:{store:i,query:o,policies:f,variables:u,varString:JSON.stringify(u),fragmentMap:b(M(o)),path:[],clientOnly:!1}}),h=p.missing&&p.missing.length>0;if(h&&!l)throw p.missing[0];return{result:p.result,missing:p.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:[Xe(new r.InvariantError(4),o)]};var s=o.fragmentMap,a=o.variables,u=o.policies,c=o.store,l=[],f={result:null},p=c.getFieldValue(i,"__typename");function v(){return f.missing||(f.missing=[])}function d(e){var t;return e.missing&&(t=v()).push.apply(t,e.missing),e.result}this.config.addTypename&&"string"==typeof p&&!u.rootIdsByTypename[p]&&l.push({__typename:p});var y=new Set(n.selections);return y.forEach((function(e){var n;if(h(e,a))if(E(e)){var c=u.readField({fieldName:e.name.value,field:e,variables:o.variables,from:i},o),f=k(e);o.path.push(f);var b=o.clientOnly;o.clientOnly=b||!(!e.directives||!e.directives.some((function(e){return"client"===e.name.value}))),void 0===c?L.added(e)||v().push(Xe(new r.InvariantError(5),o)):Array.isArray(c)?c=d(t.executeSubSelectedArray({field:e,array:c,context:o})):e.selectionSet&&null!=c&&(c=d(t.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:c,context:o}))),void 0!==c&&l.push(((n={})[f]=c,n)),o.clientOnly=b,r.invariant(o.path.pop()===f)}else{var m=void 0;R(e)?m=e:r.invariant(m=s[e.name.value],6),u.fragmentMatches(m,p)&&m.selectionSet.selections.forEach(y.add,y)}})),f.result=U(l),this.knownResults.set(f.result,n),f},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 $e=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=I(n),c=new G(Be);a=t.__assign(t.__assign({},D(u)),a);var l=this.processSelectionSet({result:i||Object.create(null),dataId:o,selectionSet:u.selectionSet,context:{store:s,written:Object.create(null),merge:function(e,t){return c.merge(e,t)},variables:a,varString:JSON.stringify(a),fragmentMap:b(M(n))}});if(!_(l))throw new r.InvariantError(8);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.out,u=void 0===a?{shouldApplyMerges:!1}:a,c=this.cache.policies,l=c.identify(i,o,s.fragmentMap),f=l[0],p=l[1];if("string"==typeof(n=n||f)){var d=s.written[n]||(s.written[n]=[]),y=g(n);if(d.indexOf(o)>=0)return y;if(d.push(o),this.reader&&this.reader.isFresh(i,y,o,s))return y}var b=Object.create(null);p&&(b=s.merge(b,p));var _=n&&c.rootTypenamesById[n]||q(i,o,s.fragmentMap)||n&&s.store.get(n,"__typename");"string"==typeof _&&(b.__typename=_);var S=new Set(o.selections);if(S.forEach((function(e){var n;if(h(e,s.variables))if(E(e)){var o=k(e),a=i[o];if(void 0!==a){var l=c.getStoreFieldName({typename:_,fieldName:e.name.value,field:e,variables:s.variables}),f=t.processFieldValue(a,e,s,u);c.hasMergeFunction(_,e.name.value)&&(f={__field:e,__typename:_,__value:f},u.shouldApplyMerges=!0),b=s.merge(b,((n={})[l]=f,n))}else if(c.usingPossibleTypes&&!v(["defer","client"],e))throw new r.InvariantError(9)}else{var p=m(e,s.fragmentMap);p&&c.fragmentMatches(p,_)&&p.selectionSet.selections.forEach(S.add,S)}})),"string"==typeof n){var O=g(n);return u.shouldApplyMerges&&(b=c.applyMerges(O,b,s)),s.store.merge(n,b),O}return b},e.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?Array.isArray(e)?e.map((function(e){return i.processFieldValue(e,t,r,n)})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,out:n}):e},e}();new Set;var et=u.dep(),tt=new c.Slot;function rt(e,t){var r=[];e.forEach((function(e){return r.push(e)})),e.clear(),r.forEach(t)}function nt(e){var t=new Set,r=new Set,n=function(i){if(arguments.length>0)e!==i&&(e=i,et.dirty(n),t.forEach(it),rt(r,(function(t){return t(e)})));else{var o=tt.getValue();o&&t.add(o),et(n)}return e};return n.onNextChange=function(e){return r.add(e),function(){r.delete(e)}},n}function it(e){e.broadcastWatches&&e.broadcastWatches()}function ot(e){return void 0!==e.args?e.args:e.field?x(e.field,e.variables):null}var st=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))},at=function(){},ut=function(e,t){return t.fieldName},ct=function(e,t,r){return(0,r.mergeObjects)(e,t)},lt=function(e,t){return t},ft=function(){function e(e){this.config=e,this.typePolicies=Object.create(null),this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.storageTrie=new u.KeyTrie(!0),this.config=t.__assign({dataIdFromObject:st},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?q(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=this.getTypePolicy(n,!1),a=s&&s.keyFn||this.config.dataIdFromObject;a;){var u=a(e,o);if(!Array.isArray(u)){i=u;break}a=vt(u)}return i=i&&String(i),o.keyObject?[i,o.keyObject]:[i]},e.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach((function(r){var n=t.getTypePolicy(r,!0),i=e[r],o=i.keyFields,s=i.fields;i.queryType&&t.setRootTypename("Query",r),i.mutationType&&t.setRootTypename("Mutation",r),i.subscriptionType&&t.setRootTypename("Subscription",r),n.keyFn=!1===o?at:Array.isArray(o)?vt(o):"function"==typeof o?o:n.keyFn,s&&Object.keys(s).forEach((function(e){var n=t.getFieldPolicy(r,e,!0),i=s[e];if("function"==typeof i)n.read=i;else{var o=i.keyArgs,a=i.read,u=i.merge;n.keyFn=!1===o?ut:Array.isArray(o)?ht(o):"function"==typeof o?o:n.keyFn,"function"==typeof a&&(n.read=a),n.merge="function"==typeof u?u:!0===u?ct:!1===u?lt:n.merge}n.read&&n.merge&&(n.keyFn=n.keyFn||ut)}))}))},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){var n=t.getSubtypeSet(r,!0);e[r].forEach(n.add,n)}))},e.prototype.getTypePolicy=function(e,t){if(e)return this.typePolicies[e]||t&&(this.typePolicies[e]=Object.create(null))},e.prototype.getSubtypeSet=function(e,t){var r=this.getTypePolicy(e,t);if(r)return r.subtypes||(t?r.subtypes=new Set:void 0)},e.prototype.getFieldPolicy=function(e,t,r){var n=this.getTypePolicy(e,r);if(n){var i=n.fields||r&&(n.fields=Object.create(null));if(i)return i[t]||r&&(i[t]=Object.create(null))}},e.prototype.fragmentMatches=function(e,t){var r=this;if(!e.typeCondition)return!0;if(!t)return!1;var n=e.typeCondition.name.value;if(t===n)return!0;if(this.usingPossibleTypes)for(var i=[this.getSubtypeSet(n,!1)],o=0;o<i.length;++o){var s=i[o];if(s){if(s.has(t))return!0;s.forEach((function(e){var t=r.getSubtypeSet(e,!1);t&&i.indexOf(t)<0&&i.push(t)}))}}return!1},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=ot(e);o;){var u=o(a,s);if(!Array.isArray(u)){t=u||n;break}o=ht(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,ot(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=pt(this,r,e,t,this.storageTrie.lookup(_(r)?r.__ref:r,i));return tt.withValue(this.cache,u,[s,c])}return s}},e.prototype.hasMergeFunction=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.merge)},e.prototype.applyMerges=function(e,r,n,i){var o=this;if(Ve(r)){var s=r.__field,a=s.name.value,u=this.getFieldPolicy(r.__typename,a,!1).merge,c=i?this.storageTrie.lookupArray(i):null;r=u(e,r.__value,pt(this,void 0,{typename:r.__typename,fieldName:a,field:s,variables:n.variables},n,c))}if(Array.isArray(r))return r.map((function(e){return o.applyMerges(void 0,e,n)}));if(Le(r)){var l,f=e,p=r,h=_(f)?f.__ref:"object"==typeof f&&f;if(Object.keys(p).forEach((function(e){var t=p[e],r=o.applyMerges(n.store.getFieldValue(f,e),t,n,h?[h,e]:void 0);r!==t&&((l=l||Object.create(null))[e]=r)})),l)return t.__assign(t.__assign({},p),l)}return r},e}();function pt(e,n,i,o,s){var a=e.getStoreFieldName(i),u=Ae(a),c=i.variables||o.variables,l=o.store,f=l.getFieldValue,p=l.toReference,h=l.canRead;return{args:ot(i),field:i.field||null,fieldName:u,storeFieldName:a,variables:c,isReference:_,toReference:p,storage:s,cache:e.cache,canRead:h,readField:function(r,i){var s="string"==typeof r?{fieldName:r,from:i}:t.__assign({},r);return void 0===s.from&&(s.from=n),void 0===s.variables&&(s.variables=c),e.readField(s,o)},mergeObjects: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 s=f(n,"__typename"),a=f(i,"__typename"),u=s&&a&&s!==a,c=e.applyMerges(u?void 0:n,i,o);return!u&&Le(n)&&Le(c)?t.__assign(t.__assign({},n),c):c}return i}}}function ht(e){return function(t,r){return t?r.fieldName+":"+JSON.stringify(dt(t,e)):r.fieldName}}function vt(e){var t=new u.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=m(t,r);a&&i.add(a.selectionSet)}}))})),n}(n.selectionSet,n.fragmentMap))}var s=n.keyObject=dt(r,e,i);return n.typename+":"+JSON.stringify(s)}}function dt(e,t,n){var i,o=Object.create(null);return t.forEach((function(t){if(Array.isArray(t)){if("string"==typeof i){var s=n&&n.subsets,a=s&&s[i];o[i]=dt(e[i],t,a)}}else{var u=n&&n.aliases,c=u&&u[t]||t;r.invariant(Ne.call(e,c),3),o[i=t]=e[c]}})),o}var yt={dataIdFromObject:st,addTypename:!0,resultCaching:!0,typePolicies:{}},bt=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=nt,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({},yt),r),n.addTypename=!!n.config.addTypename,n.policies=new ft({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 $e(n,n.storeReader=new Ze({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).toObject()},r.prototype.read=function(e){var t=e.optimistic?this.optimisticData:this.data;return("string"!=typeof e.rootId||t.has(e.rootId))&&this.storeReader.readQueryFromStore({store:t,query:e.query,variables:e.variables,rootId:e.rootId,config:this.config})||null},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(Ne.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.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){t.watches.delete(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(Ne.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}(Ce),mt=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=z(t.resolvers,e)})):this.resolvers=z(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 v(["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 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:B(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,f,p,h,v,d;return t.__generator(this,(function(y){return a=P(e),u=M(e),c=b(u),l=a.operation,f=l?l.charAt(0).toUpperCase()+l.slice(1):"Query",h=(p=this).cache,v=p.client,d={fragmentMap:c,context:t.__assign(t.__assign({},n),{cache:h,client:v}),variables:i,fragmentMatcher:o,defaultOperationType:f,exportedVariables:{},onlyRunForcedResolvers:s},[2,this.resolveSelectionSet(a.selectionSet,r,d).then((function(e){return{result:e,exportedVariables:d.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(f){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)?E(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,12)),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,f,p,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,(f=this.resolvers&&this.resolvers[l])&&(p=f[a?o:s])&&(c=Promise.resolve(tt.withValue(this.cache,p,[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}(),gt=new(ne?WeakMap:Map);function _t(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return gt.set(e,(gt.get(e)+1)%1e15),r.apply(this,arguments)})}var St=function(){function e(e){this.cache=e,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.dirty=!1,this.diff=null,this.observableQuery=null,gt.has(e)||(gt.set(e,0),_t(e,"evict"),_t(e,"modify"))}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.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;this.notifyTimeout&&(clearTimeout(this.notifyTimeout),this.notifyTimeout=void 0),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(Fe(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(){this.cancel(),delete this.cancel;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===gt.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;if(this.graphQLErrors=te(e.errors)?e.errors:[],"no-cache"===t.fetchPolicy)this.diff={result:e.data,complete:!0};else if(r){var i="ignore"===t.errorPolicy||"all"===t.errorPolicy,o=!re(e);!o&&i&&e.data&&(o=!0),o?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:gt.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.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,e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}(),Ot=Object.prototype.hasOwnProperty,wt=function(){function e(e){var t=e.cache,r=e.link,n=e.queryDeduplication,i=void 0!==n&&n,o=e.onBroadcast,s=void 0===o?function(){}:o,a=e.ssrMode,u=void 0!==a&&a,c=e.clientAwareness,l=void 0===c?{}:c,f=e.localState,p=e.assumeImmutableResults;this.mutationStore=new Ie,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.onBroadcast=s,this.clientAwareness=l,this.localState=f||new mt({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!p}return e.prototype.stop=function(){var e=this;this.queries.forEach((function(t,r){e.stopQueryNoBroadcast(r)})),this.cancelPendingFetches(new r.InvariantError(14))},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,f=e.update,p=e.errorPolicy,h=void 0===p?"none":p,v=e.fetchPolicy,d=e.context,y=void 0===d?{}:d;return t.__awaiter(this,void 0,void 0,(function(){var e,a,c,p,d=this;return t.__generator(this,(function(b){switch(b.label){case 0:return r.invariant(n,15),r.invariant(!v||"no-cache"===v,16),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=b.sent(),b.label=2;case 2:return a=function(){var e={};return s&&d.queries.forEach((function(t,r){var n=t.observableQuery;if(n){var i=n.queryName;i&&Ot.call(s,i)&&(e[r]={updater:s[i],queryInfo:d.queries.get(r)})}})),e},this.mutationStore.initMutation(e,n,i),o&&(c="function"==typeof o?o(i):o,this.cache.recordOptimisticTransaction((function(t){try{xt({mutationId:e,result:{data:c},document:n,variables:i,queryUpdatersById:a(),update:f},t)}catch(e){}}),e)),this.broadcastQueries(),p=this,[2,new Promise((function(r,s){var c,d;p.getObservableFromLink(n,t.__assign(t.__assign({},y),{optimisticResponse:o}),i,!1).subscribe({next:function(t){if(re(t)&&"none"===h)d=new Qe({graphQLErrors:t.errors});else{if(p.mutationStore.markMutationResult(e),"no-cache"!==v)try{xt({mutationId:e,result:t,document:n,variables:i,queryUpdatersById:a(),update:f},p.cache)}catch(e){return void(d=new Qe({networkError:e}))}c=t}},error:function(t){p.mutationStore.markMutationError(e,t),o&&p.cache.removeOptimistic(e),p.broadcastQueries(),s(new Qe({networkError:t}))},complete:function(){if(d&&p.mutationStore.markMutationError(e,d),o&&p.cache.removeOptimistic(e),p.broadcastQueries(),d)s(d);else{"function"==typeof u&&(u=u(c));var t=[];te(u)&&u.forEach((function(e){if("string"==typeof e)p.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(p.query(r))}})),Promise.all(l?t:[]).then((function(){"ignore"===h&&c&&re(c)&&delete c.errors,r(c)}),s)}}})}))]}}))}))},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:d(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:o,serverQuery:s,defaultVars:D(I(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 St(this.cache),n=new Pe({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,17),r.invariant("Document"===e.query.kind,18),r.invariant(!e.returnPartialData,19),r.invariant(!e.pollInterval,20);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(21)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=exports.NetworkStatus.loading:e.stop()})),this.mutationStore.reset(),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){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.variables,s=e.context,a=void 0===s?{}:s;r=this.transform(r).document,i=this.getVariables(r,i);var u=function(e){return t.getObservableFromLink(r,a,e,!1).map((function(i){if(n&&"no-cache"===n||(re(i)||t.cache.write({query:r,result:i.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries()),re(i))throw new Qe({graphQLErrors:i.errors});return i}))};if(this.transform(r).hasClientExports){var c=this.localState.addExportedVariables(r,i,a).then(u);return new o((function(e){var t=null;return c.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return u(i)},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).subscriptions.forEach((function(e){return e.unsubscribe()})),this.queries.delete(e)},e.prototype.broadcastQueries=function(){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,f=this.link,p={query:c,variables:n,operationName:F(c)||void 0,context:this.prepareContext(t.__assign(t.__assign({},r),{forceFetch:!i}))};if(r=p.context,i){var h=l.get(c)||new Map;l.set(c,h);var v=JSON.stringify(n);if(!(a=h.get(v))){var d=new ee([de(f,p)]);h.set(v,a=d),d.cleanup((function(){h.delete(v)&&h.size<1&&l.delete(c)}))}}else a=new ee([de(f,p)])}else a=new ee([o.of({data:{}})]),r=this.prepareContext(r);var y=this.transform(e).clientQuery;return y&&(a=Z(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 Z(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=Ee(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,f=void 0===l?"none":l,p=t.returnPartialData,h=void 0!==p&&p,v=t.notifyOnNetworkStatusChange,d=void 0!==v&&v,y=t.context,b=void 0===y?{}:y;("cache-first"===c||"cache-and-network"===c||"network-only"===c||"no-cache"===c)&&d&&"number"==typeof a&&a!==r&&Fe(r)&&("cache-first"!==c&&(c="cache-and-network"),h=!0);var m=Object.assign({},t,{query:i,variables:o,fetchPolicy:c,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:d,context:b}),g=function(e){return m.variables=e,n.fetchQueryByPolicy(s,m,r)};this.fetchCancelFns.set(e,(function(e){Promise.resolve().then((function(){return _.cancel(e)}))}));var _=new ee(this.transform(m.query).hasClientExports?this.localState.addExportedVariables(m.query,m.variables,m.context).then(g):g(m.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,f=r.context;e.init({document:s,variables:a,lastRequestId:this.generateRequestId(),networkStatus:n});var p=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:Fe(n),networkStatus:n},r.complete?null:{partial:!0}))};return i.transform(s).hasForcedResolvers?i.localState.runResolvers({document:s,remoteResult:{data:u},context:f,variables:a,onlyRunForcedResolvers:!0}).then((function(e){return c(e.data)})):c(u)},v=function(t){return i.getResultsFromLink(e,t,{variables:a,context:f,fetchPolicy:u,errorPolicy:c})};switch(u){default:case"cache-first":return(d=p()).complete?[h(d,e.markReady())]:l?[h(d),v(!0)]:[v(!0)];case"cache-and-network":var d;return(d=p()).complete||l?[h(d),v(!0)]:[v(!0)];case"cache-only":return[h(p(),e.markReady())];case"network-only":return[v(!0)];case"no-cache":return[v(!1)];case"standby":return[]}},e.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new St(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 xt(e,t){if(!re(e.result)){var r=[{result:e.result.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}],n=e.queryUpdatersById;n&&Object.keys(n).forEach((function(i){var o=n[i],s=o.updater,a=o.queryInfo,u=a.document,c=a.variables,l=t.diff({query:u,variables:c,returnPartialData:!0,optimistic:!1}),f=l.result;if(l.complete&&f){var p=s(f,{mutationResult:e.result,queryName:F(u)||void 0,queryVariables:c});p&&r.push({result:p,dataId:"ROOT_QUERY",query:u,variables:c})}})),t.performTransaction((function(t){r.forEach((function(e){return t.write(e)}));var n=e.update;n&&n(t,e.result)}),null)}}var kt=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,f=e.connectToDevTools,p=e.queryDeduplication,h=void 0===p||p,v=e.defaultOptions,d=e.assumeImmutableResults,y=void 0!==d&&d,b=e.resolvers,m=e.typeDefs,g=e.fragmentMatcher,_=e.name,S=e.version,O=e.link;if(O||(O=n?new qe({uri:n,credentials:i,headers:o}):le.empty()),!s)throw new r.InvariantError(10);this.link=O,this.cache=s,this.disableNetworkFetches=u||l>0,this.queryDeduplication=h,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);void 0!==f&&(f&&"undefined"!=typeof window)&&(window.__APOLLO_CLIENT__=this),this.version="local",this.localState=new mt({cache:s,client:this,resolvers:b,fragmentMatcher:g}),this.queryManager=new wt({cache:this.cache,link:this.link,queryDeduplication:h,ssrMode:u,clientAwareness:{name:_,version:S},localState:this.localState,assumeImmutableResults:y,onBroadcast:function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore.getStore()},dataWithOptimisticResults:t.cache.extract(!0)})}})}return e.prototype.stop=function(){this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=ie(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=ie(this.defaultOptions.query,e)),r.invariant("cache-and-network"!==e.fetchPolicy,11),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=ie(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 de(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}(),qt=l.resetCaches,Et=l.disableFragmentWarnings,Rt=l.enableExperimentalFragmentVariables,Qt=l.disableExperimentalFragmentVariables,It="function"==typeof Symbol&&Symbol.for?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function Ft(){Object.defineProperty(p,It,{value:p.createContext({}),enumerable:!1,configurable:!0,writable:!1})}function Mt(){return p[It]||Ft(),p[It]}var Pt;(Pt=exports.DocumentType||(exports.DocumentType={}))[Pt.Query=0]="Query",Pt[Pt.Mutation=1]="Mutation",Pt[Pt.Subscription=2]="Subscription";var Dt=new Map;function Ct(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 Tt(e){var t,n,i=Dt.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 f={name:l.name&&"Name"===l.name.kind?l.name.value:"data",type:n,variables:t};return Dt.set(e,f),f}var Nt=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=Tt(e);Ct(t),Ct(n.type);r.invariant(n.type===t,30)},e}(),jt=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}(Nt),At=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(ie(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&&a.equal(this.previousResult,e)||(this.setResult(e),this.previousResult=e)},r}(Nt),Lt=function(e){function r(r){var n=r.options,i=r.context,o=r.onNewData,s=e.call(this,n,i)||this;return s.previousData={},s.runLazy=!1,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,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 f=s.currentObservable.options.fetchPolicy;if(r.partialRefetch&&a&&(!i||0===Object.keys(i).length)&&"cache-only"!==f)return Object.assign(e,{loading:!0,networkStatus:exports.NetworkStatus.loading}),e.refetch(),e}}return e.client=s.client,s.setOptions(r,!0),s.previousData.loading=s.previousData.result&&s.previousData.result.loading||!1,s.previousData.result=e,s.currentObservable&&s.currentObservable.resetQueryStoreErrors(),e},s.obsRefetch=function(e){return s.currentObservable.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.previousData.query)&&(this.removeQuerySubscription(),this.previousData.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(),delete this.currentObservable,delete this.previousData.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=!1===this.getOptions().ssr,n=this.refreshClient().client.disableNetworkFetches,i=t.__assign({loading:!0,networkStatus:exports.NetworkStatus.loading,called:!0,data:void 0,stale:!1,client:this.client},this.observableQueryFields());return r&&(this.ssrInitiated()||n)?(this.previousData.result=i,i):(this.ssrInitiated()&&(e=this.context.renderPromises.addQueryPromise(this,this.getQueryResult)||i),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.previousData.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.getOptions().skip)if(this.currentObservable){var e=t.__assign(t.__assign({},this.prepareObservableQueryOptions()),{children:null});a.equal(e,this.previousData.observableQueryOptions)||(this.previousData.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.previousData.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.previousData.result;(n&&n.loading||!a.equal(r,t.previousData.error))&&(t.previousData.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.previousData.result){var e=this.previousData.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.previousData.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.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}(Nt);function Vt(e,r,n){void 0===n&&(n=!1);var i=f.useContext(Mt()),o=f.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=f.useRef(),p=l.current||new Lt({options:c,context:i,onNewData:function(){p.ssrInitiated()?u():Promise.resolve().then(u)}});p.setOptions(c),p.context=i,p.ssrInitiated()&&!l.current&&(l.current=p);var h,v,d,y={options:t.__assign(t.__assign({},c),{onError:void 0,onCompleted:void 0}),context:i,tick:s},b=(h=function(){return n?p.executeLazy():p.execute()},v=y,(d=f.useRef()).current&&a.equal(v,d.current.key)||(d.current={key:v,value:h()}),d.current.value),m=n?b[1]:b;return f.useEffect((function(){return l.current||(l.current=p),function(){return p.cleanup()}}),[]),f.useEffect((function(){return p.afterExecute({lazy:n})}),[m.loading,m.networkStatus,m.error,m.data]),b}exports.Observable=o,exports.gql=l,exports.ApolloCache=Ce,exports.ApolloClient=kt,exports.ApolloConsumer=function(e){var t=Mt();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=Mt();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=qe,exports.InMemoryCache=bt,exports.MissingFieldError=Te,exports.ObservableQuery=Pe,exports.checkFetcher=Se,exports.concat=ve,exports.createHttpLink=ke,exports.createSignalIfSupported=Oe,exports.defaultDataIdFromObject=st,exports.disableExperimentalFragmentVariables=Qt,exports.disableFragmentWarnings=Et,exports.empty=fe,exports.enableExperimentalFragmentVariables=Rt,exports.execute=de,exports.fallbackHttpConfig=ge,exports.from=pe,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=Mt,exports.isApolloError=Ee,exports.isReference=_,exports.makeReference=g,exports.makeVar=nt,exports.operationName=Ct,exports.parseAndCheckHttpResponse=be,exports.parser=Tt,exports.resetApolloContext=Ft,exports.resetCaches=qt,exports.rewriteURIForGET=xe,exports.selectHttpOptionsAndBody=_e,exports.selectURI=we,exports.serializeFetchParameter=me,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(Mt()).client;return r.invariant(e,33),e},exports.useLazyQuery=function(e,t){return Vt(e,t,!0)},exports.useMutation=function(e,r){var n=f.useContext(Mt()),i=f.useState({called:!1,loading:!1}),o=i[0],s=i[1],a=r?t.__assign(t.__assign({},r),{mutation:e}):{mutation:e},u=f.useRef(),c=(u.current||(u.current=new At({options:a,context:n,result:o,setResult:s})),u.current);return c.setOptions(a),c.context=n,f.useEffect((function(){return c.afterExecute()})),c.execute(o)},exports.useQuery=function(e,t){return Vt(e,t,!1)},exports.useReactiveVar=function(e){var t=e(),r=e.onNextChange(f.useState(t)[1]);return f.useEffect((function(){return r}),[]),t},exports.useSubscription=function(e,r){var n=f.useContext(Mt()),i=r?t.__assign(t.__assign({},r),{subscription:e}):{subscription:e},o=f.useState({loading:!i.skip,error:void 0,data:void 0}),s=o[0],a=o[1],u=f.useRef(),c=(u.current||(u.current=new jt({options:i,context:n,setResult:a})),u.current);return c.setOptions(i,!0),c.context=n,f.useEffect((function(){return c.afterExecute()})),f.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/language/visitor"),i=e(require("fast-json-stable-stringify")),o=e(require("zen-observable"));require("symbol-observable");var s=require("graphql/language/printer"),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 v(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&&v(["client"],e)&&v(["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 q(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[k(o)]}else{var s=q(e,g(o,r).selectionSet,r);if("string"==typeof s)return s}}}function E(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 I(e){return Q(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 F(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function P(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 D(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 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 N(e){return function e(t,r){return t.selectionSet.selections.every((function(t){return"FragmentSpread"===t.kind&&e(r[t.name.value],r)}))}(I(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(F(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 A(e,r){var i=Object.create(null),o=[],s=Object.create(null),a=[],u=N(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)||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(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 N(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 N(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 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])})}}}}})}L.added=function(e){return e===T};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"===P(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 X(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;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){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.promise=new Promise((function(e,t){r.resolve=e,r.reject=t})),r.handlers={next:function(e){null!==r.sub&&(r.latest=["next",e],X(r.observers,"next",e))},error:function(e){null!==r.sub&&(r.sub&&r.sub.unsubscribe(),r.sub=null,r.latest=["error",e],r.reject(e),X(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(),X(r.observers,"complete"))}}},r.cancel=function(e){r.reject(e),r.sources=[],r.handlers.complete()},r.promise.catch((function(e){})),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.addObserver=function(e){if(!this.observers.has(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()}this.observers.add(e)}},r.prototype.removeObserver=function(e,t){if(this.observers.delete(e)&&this.observers.size<1){if(t)return;this.sub&&(this.sub.unsubscribe(),this.reject(new Error("Observable cancelled prematurely"))),this.sub=null}},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};this.addObserver(i)},r}(o);function te(e){return Array.isArray(e)&&e.length>0}function re(e){return e.errors&&e.errors.length>0||!1}"function"==typeof Symbol&&Symbol.species&&Object.defineProperty(ee,Symbol.species,{value:o});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){throw e},e.prototype.setOnError=function(e){return this.onError=e,this},e}(),pe=le.empty,fe=le.from,he=le.split,ve=le.concat,de=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 n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var o=t.__assign(t.__assign({},r.options),{headers:r.headers,credentials:r.credentials}),a=r.http||{};n.forEach((function(e){o=t.__assign(t.__assign(t.__assign({},o),e.options),{headers:t.__assign(t.__assign({},o.headers),e.headers)}),e.credentials&&(o.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=s.print(p)),{options:o,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,n=void 0===r?"/graphql":r,i=e.fetch,s=e.includeExtensions,a=e.useGETForQueries,u=t.__rest(e,["uri","fetch","includeExtensions","useGETForQueries"]);Se(i),i||(i=fetch);var c={http:{includeExtensions:s},options:u.fetchOptions,credentials:u.credentials,headers:u.headers};return new le((function(e){var r=we(e,n),s=e.getContext(),u={};if(s.clientAwareness){var l=s.clientAwareness,p=l.name,f=l.version;p&&(u["apollographql-client-name"]=p),f&&(u["apollographql-client-version"]=f)}var h,v=t.__assign(t.__assign({},u),s.headers),d={http:s.http,options:s.fetchOptions,credentials:s.credentials,headers:v},y=_e(e,me,c,d),b=y.options,g=y.body;if(!b.signal){var m=Oe(),_=m.controller,S=m.signal;(h=_)&&(b.signal=S)}if(a&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(b.method="GET"),"GET"===b.method){var O=xe(r,g),w=O.newURI,x=O.parseError;if(x)return oe(x);r=w}else try{b.body=ge(g)}catch(x){return oe(x)}return new o((function(t){return i(r,b).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(){h&&h.abort()}}))}))},qe=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 Ee(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),Ie=function(){function e(){this.store={}}return e.prototype.getStore=function(){return this.store},e.prototype.get=function(e){return this.store[e]},e.prototype.initMutation=function(e,t,r){this.store[e]={mutation:t,variables:r||{},loading:!0,error:null}},e.prototype.markMutationError=function(e,t){var r=this.store[e];r&&(r.loading=!1,r.error=t)},e.prototype.markMutationResult=function(e){var t=this.store[e];t&&(t.loading=!1,t.error=null)},e.prototype.reset=function(){this.store={}},e}();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 Fe=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}(),Pe=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),X(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})),X(s.observers,"error",s.lastError=e)}},s.isTornDown=!1,s.options=o,s.queryId=n.generateQueryId();var a=I(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!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),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=De)}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 Fe(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.tearDownQuery=function(){var e=this.queryManager;this.reobserver&&(this.reobserver.stop(),delete this.reobserver),this.isTornDown=!0,this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),e.stopQuery(this.queryId),this.observers.clear()},r}(o);function De(e){}var Ce=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=!1),this.read({rootId:e.id||"ROOT_QUERY",query:e.query,variables:e.variables,optimistic:t})},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.read({query:this.getFragmentDoc(e.fragment,e.fragmentName),variables:e.variables,rootId:e.id,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},Ne=Object.prototype.hasOwnProperty;var je=/^[_a-z][_0-9a-z]*/i;function Ae(e){var t=e.match(je);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(E(e)&&h(e,r)){var n=k(e);return Ne.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)}function ze(e){var t=e&&e.__field;return t&&E(t)}var Be=function(e,t,r){var n=e[r],i=t[r];return ze(n)?(n.__value=this.merge(n.__value,ze(i)?i.__value:i),n):ze(i)?(i.__value=this.merge(n,i.__value),i):this.merge(n,i)},We=Object.create(null),Ue=function(){return We},Ke=Object.create(null),Je=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),Ne.call(this.data,e)){var r=this.data[e];if(r&&Ne.call(r,t))return r[t]}return"__typename"===t&&Ne.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof Ye?this.parent.get(e,t):void 0},e.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),Ne.call(this.data,e)?this.data[e]:this instanceof Ye?this.parent.lookup(e,t):void 0},e.prototype.merge=function(e,t){var r=this,n=this.lookup(e),i=new G(Xe).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){n&&n[e]===i[e]||(o[Ae(e)]=1,void 0!==i[e]||r instanceof Ye||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:We,INVALIDATE:Ke,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===Ue?We:f(p,t.__assign(t.__assign({},u),{fieldName:l,storeFieldName:c,storage:n.getStorage(e,c)}));h===Ke?n.group.dirty(e,c):(h===We&&(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 Ye?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]=Ue,n):Ue)}return!1},e.prototype.evict=function(e){var t=!1;return e.id&&(Ne.call(this.data,e.id)&&(t=this.delete(e.id,e.fieldName,e.args)),this instanceof Ye&&(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.replace=function(e){var t=this;Object.keys(this.data).forEach((function(r){e&&Ne.call(e,r)||t.delete(r)})),e&&Object.keys(e).forEach((function(r){t.merge(r,e[r])}))},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 Ye&&this.parent.getRootIdSet(e),e},e.prototype.gc=function(){var e=this,t=this.getRootIdSet(),r=this.toObject();t.forEach((function(n){Ne.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 Ye;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},e.prototype.findChildRefIds=function(e){if(!Ne.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}(),Ge=function(){function e(e){this.caching=e,this.d=null,this.keyMaker=new u.KeyTrie(ne),this.d=e?u.dep():null}return e.prototype.depend=function(e,t){this.d&&this.d(He(e,t))},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(He(e,t))},e}();function He(e,t){return Ae(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 Ge(i))||this;return s.storageTrie=new u.KeyTrie(ne),s.sharedLayerGroup=new Ge(i),o&&s.replace(o),s}return t.__extends(r,e),r.prototype.addLayer=function(e,t){return new Ye(e,this,t,this.sharedLayerGroup)},r.prototype.removeLayer=function(){return this},r.prototype.getStorage=function(e,t){return this.storageTrie.lookup(e,t)},r}(e);e.Root=r}(Je||(Je={}));var Ye=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 Ne.call(this.data,r)?t.__assign(t.__assign({},n),e.prototype.findChildRefIds.call(this,r)):n},r.prototype.getStorage=function(e,t){return this.parent.getStorage(e,t)},r}(Je);function Xe(e,t,r){var n=e[r],i=t[r];return a.equal(n,i)?n:i}function $e(e){return!!(e instanceof Je&&e.group.caching)}function Ze(e,t){return new Te(e.message,t.path.slice(),t.query,t.clientOnly,t.variables)}var et=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($e(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($e(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({},D((n=I(o),r.invariant(n&&"query"===n.operation,48),n))),u);var f=this.executeSelectionSet({selectionSet:P(o).selectionSet,objectOrReference:m(a),context:{store:i,query:o,policies:p,variables:u,varString:JSON.stringify(u),fragmentMap:b(F(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($e(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:[Ze(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 v(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 d=new Set(n.selections);return d.forEach((function(e){var n;if(h(e,s))if(E(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(Ze(new r.InvariantError(5),o)):Array.isArray(u)?u=v(t.executeSubSelectedArray({field:e,array:u,context:o})):e.selectionSet&&null!=u&&(u=v(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(d.add,d)}})),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 tt=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=I(n),c=new G(Be);a=t.__assign(t.__assign({},D(u)),a);var l=this.processSelectionSet({result:i||Object.create(null),dataId:o,selectionSet:u.selectionSet,context:{store:s,written:Object.create(null),merge:function(e,t){return c.merge(e,t)},variables:a,varString:JSON.stringify(a),fragmentMap:b(F(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.out,u=void 0===a?{shouldApplyMerges:!1}:a,c=this.cache.policies,l=c.identify(i,o,s.fragmentMap),p=l[0],f=l[1];if("string"==typeof(n=n||p)){var d=s.written[n]||(s.written[n]=[]),y=m(n);if(d.indexOf(o)>=0)return y;if(d.push(o),this.reader&&this.reader.isFresh(i,y,o,s))return y}var b=Object.create(null);f&&(b=s.merge(b,f));var _=n&&c.rootTypenamesById[n]||q(i,o,s.fragmentMap)||n&&s.store.get(n,"__typename");"string"==typeof _&&(b.__typename=_);var S=new Set(o.selections);if(S.forEach((function(e){var n;if(h(e,s.variables))if(E(e)){var o=k(e),a=i[o];if(void 0!==a){var l=c.getStoreFieldName({typename:_,fieldName:e.name.value,field:e,variables:s.variables}),p=t.processFieldValue(a,e,s,u);c.hasMergeFunction(_,e.name.value)&&(p={__field:e,__typename:_,__value:p},u.shouldApplyMerges=!0),b=s.merge(b,((n={})[l]=p,n))}else if(c.usingPossibleTypes&&!v(["defer","client"],e))throw new r.InvariantError(8)}else{var f=g(e,s.fragmentMap);f&&c.fragmentMatches(f,_,i,s.variables)&&f.selectionSet.selections.forEach(S.add,S)}})),"string"==typeof n){var O=m(n);return u.shouldApplyMerges&&(b=c.applyMerges(O,b,s)),s.store.merge(n,b),O}return b},e.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?Array.isArray(e)?e.map((function(e){return i.processFieldValue(e,t,r,n)})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,out:n}):e},e}();new Set;var rt=u.dep(),nt=new c.Slot;function it(e,t){var r=[];e.forEach((function(e){return r.push(e)})),e.clear(),r.forEach(t)}function ot(e){var t=new Set,r=new Set,n=function(i){if(arguments.length>0)e!==i&&(e=i,rt.dirty(n),t.forEach(st),it(r,(function(t){return t(e)})));else{var o=nt.getValue();o&&t.add(o),rt(n)}return e};return n.onNextChange=function(e){return r.add(e),function(){r.delete(e)}},n}function st(e){e.broadcastWatches&&e.broadcastWatches()}function at(e){return void 0!==e.args?e.args:e.field?x(e.field,e.variables):null}var ut=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))},ct=function(){},lt=function(e,t){return t.fieldName},pt=function(e,t,r){return(0,r.mergeObjects)(e,t)},ft=function(e,t){return t},ht=function(){function e(e){this.config=e,this.typePolicies=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:ut},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?q(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=this.getTypePolicy(n,!1),a=s&&s.keyFn||this.config.dataIdFromObject;a;){var u=a(e,o);if(!Array.isArray(u)){i=u;break}a=yt(u)}return i=i&&String(i),o.keyObject?[i,o.keyObject]:[i]},e.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach((function(r){var n=t.getTypePolicy(r,!0),i=e[r],o=i.keyFields,s=i.fields;i.queryType&&t.setRootTypename("Query",r),i.mutationType&&t.setRootTypename("Mutation",r),i.subscriptionType&&t.setRootTypename("Subscription",r),n.keyFn=!1===o?ct:Array.isArray(o)?yt(o):"function"==typeof o?o:n.keyFn,s&&Object.keys(s).forEach((function(e){var n=t.getFieldPolicy(r,e,!0),i=s[e];if("function"==typeof i)n.read=i;else{var o=i.keyArgs,a=i.read,u=i.merge;n.keyFn=!1===o?lt:Array.isArray(o)?dt(o):"function"==typeof o?o:n.keyFn,"function"==typeof a&&(n.read=a),n.merge="function"==typeof u?u:!0===u?pt:!1===u?ft:n.merge}n.read&&n.merge&&(n.keyFn=n.keyFn||lt)}))}))},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,t){if(e)return this.typePolicies[e]||t&&(this.typePolicies[e]=Object.create(null))},e.prototype.getFieldPolicy=function(e,t,r){var n=this.getTypePolicy(e,r);if(n){var i=n.fields||r&&(n.fields=Object.create(null));if(i)return i[t]||r&&(i[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.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=at(e);o;){var u=o(a,s);if(!Array.isArray(u)){t=u||n;break}o=dt(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,at(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=vt(this,r,e,t,t.store.getStorage(_(r)?r.__ref:r,i));return nt.withValue(this.cache,u,[s,c])}return s}},e.prototype.hasMergeFunction=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.merge)},e.prototype.applyMerges=function(e,r,n,i){var o,s=this;if(ze(r)){var a=r.__field,u=a.name.value;r=(0,this.getFieldPolicy(r.__typename,u,!1).merge)(e,r.__value,vt(this,void 0,{typename:r.__typename,fieldName:u,field:a,variables:n.variables},n,i?(o=n.store).getStorage.apply(o,i):Object.create(null)))}if(Array.isArray(r))return r.map((function(e){return s.applyMerges(void 0,e,n)}));if(Ve(r)){var c,l=e,p=r,f=_(l)?l.__ref:"object"==typeof l&&l;if(Object.keys(p).forEach((function(e){var t=p[e],r=s.applyMerges(n.store.getFieldValue(l,e),t,n,f?[f,e]:void 0);r!==t&&((c=c||Object.create(null))[e]=r)})),c)return t.__assign(t.__assign({},p),c)}return r},e}();function vt(e,n,i,o,s){var a=e.getStoreFieldName(i),u=Ae(a),c=i.variables||o.variables,l=o.store,p=l.getFieldValue,f=l.toReference,h=l.canRead;return{args:at(i),field:i.field||null,fieldName:u,storeFieldName:a,variables:c,isReference:_,toReference:f,storage:s,cache:e.cache,canRead:h,readField:function(r,i){var s="string"==typeof r?{fieldName:r,from:i}:t.__assign({},r);return void 0===s.from&&(s.from=n),void 0===s.variables&&(s.variables=c),e.readField(s,o)},mergeObjects: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 s=p(n,"__typename"),a=p(i,"__typename"),u=s&&a&&s!==a,c=e.applyMerges(u?void 0:n,i,o);return!u&&Ve(n)&&Ve(c)?t.__assign(t.__assign({},n),c):c}return i}}}function dt(e){return function(t,r){return t?r.fieldName+":"+JSON.stringify(bt(t,e)):r.fieldName}}function yt(e){var t=new u.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=g(t,r);a&&i.add(a.selectionSet)}}))})),n}(n.selectionSet,n.fragmentMap))}var s=n.keyObject=bt(r,e,i);return n.typename+":"+JSON.stringify(s)}}function bt(e,t,n){var i,o=Object.create(null);return t.forEach((function(t){if(Array.isArray(t)){if("string"==typeof i){var s=n&&n.subsets,a=s&&s[i];o[i]=bt(e[i],t,a)}}else{var u=n&&n.aliases,c=u&&u[t]||t;r.invariant(Ne.call(e,c),3),o[i=t]=e[c]}})),o}var gt={dataIdFromObject:ut,addTypename:!0,resultCaching:!0,typePolicies:{}},mt=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=ot,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($e(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({},gt),r),n.addTypename=!!n.config.addTypename,n.policies=new ht({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.data=new Je.Root({policies:n.policies,resultCaching:n.config.resultCaching}),n.optimisticData=n.data,n.storeWriter=new tt(n,n.storeReader=new et({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).toObject()},r.prototype.read=function(e){var t=e.optimistic?this.optimisticData:this.data;return("string"!=typeof e.rootId||t.has(e.rootId))&&this.storeReader.diffQueryAgainstStore({store:t,query:e.query,variables:e.variables,rootId:e.rootId,config:this.config,returnPartialData:!1}).result||null},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(Ne.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.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){t.watches.delete(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(Ne.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}(Ce),_t=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 v(["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 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: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,v,d;return t.__generator(this,(function(y){return a=P(e),u=F(e),c=b(u),l=a.operation,p=l?l.charAt(0).toUpperCase()+l.slice(1):"Query",h=(f=this).cache,v=f.client,d={fragmentMap:c,context:t.__assign(t.__assign({},n),{cache:h,client:v}),variables:i,fragmentMatcher:o,defaultOperationType:p,exportedVariables:{},onlyRunForcedResolvers:s},[2,this.resolveSelectionSet(a.selectionSet,r,d).then((function(e){return{result:e,exportedVariables:d.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)?E(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}(),St=new(ne?WeakMap:Map);function Ot(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return St.set(e,(St.get(e)+1)%1e15),r.apply(this,arguments)})}var wt=function(){function e(e){this.cache=e,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.dirty=!1,this.diff=null,this.observableQuery=null,St.has(e)||(St.set(e,0),Ot(e,"evict"),Ot(e,"modify"))}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.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;this.notifyTimeout&&(clearTimeout(this.notifyTimeout),this.notifyTimeout=void 0),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(){this.cancel(),delete this.cancel;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===St.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=te(e.errors)?e.errors:[],"no-cache"===t.fetchPolicy?this.diff={result:e.data,complete:!0}:r&&(xt(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:St.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.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,e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}();function xt(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 kt=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=void 0===o?function(){}:o,a=e.ssrMode,u=void 0!==a&&a,c=e.clientAwareness,l=void 0===c?{}:c,p=e.localState,f=e.assumeImmutableResults;this.mutationStore=new Ie,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.onBroadcast=s,this.clientAwareness=l,this.localState=p||new _t({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!f}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,v=e.fetchPolicy,d=e.context,y=void 0===d?{}:d;return t.__awaiter(this,void 0,void 0,(function(){var e,a,c,f,d=this;return t.__generator(this,(function(b){switch(b.label){case 0:return r.invariant(n,13),r.invariant(!v||"no-cache"===v,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=b.sent(),b.label=2;case 2:return a=function(){var e={};return s&&d.queries.forEach((function(t,r){var n=t.observableQuery;if(n){var i=n.queryName;i&&kt.call(s,i)&&(e[r]={updater:s[i],queryInfo:d.queries.get(r)})}})),e},this.mutationStore.initMutation(e,n,i),o&&(c="function"==typeof o?o(i):o,this.cache.recordOptimisticTransaction((function(t){try{Et({mutationId:e,result:{data:c},document:n,variables:i,errorPolicy:h,queryUpdatersById:a(),update:p},t)}catch(e){}}),e)),this.broadcastQueries(),f=this,[2,new Promise((function(r,s){var c,d;f.getObservableFromLink(n,t.__assign(t.__assign({},y),{optimisticResponse:o}),i,!1).subscribe({next:function(t){if(re(t)&&"none"===h)d=new Qe({graphQLErrors:t.errors});else{if(f.mutationStore.markMutationResult(e),"no-cache"!==v)try{Et({mutationId:e,result:t,document:n,variables:i,errorPolicy:h,queryUpdatersById:a(),update:p},f.cache)}catch(e){return void(d=new Qe({networkError:e}))}c=t}},error:function(t){f.mutationStore.markMutationError(e,t),o&&f.cache.removeOptimistic(e),f.broadcastQueries(),s(new Qe({networkError:t}))},complete:function(){if(d&&f.mutationStore.markMutationError(e,d),o&&f.cache.removeOptimistic(e),f.broadcastQueries(),d)s(d);else{"function"==typeof u&&(u=u(c));var t=[];te(u)&&u.forEach((function(e){if("string"==typeof e)f.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(f.query(r))}})),Promise.all(l?t:[]).then((function(){"ignore"===h&&c&&re(c)&&delete c.errors,r(c)}),s)}}})}))]}}))}))},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:d(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:o,serverQuery:s,defaultVars:D(I(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 wt(this.cache),n=new Pe({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.reset(),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){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&&(xt(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).subscriptions.forEach((function(e){return e.unsubscribe()})),this.queries.delete(e)},e.prototype.broadcastQueries=function(){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 v=JSON.stringify(n);if(!(a=h.get(v))){var d=new ee([de(p,f)]);h.set(v,a=d),d.cleanup((function(){h.delete(v)&&h.size<1&&l.delete(c)}))}}else a=new ee([de(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=Ee(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,v=t.notifyOnNetworkStatusChange,d=void 0!==v&&v,y=t.context,b=void 0===y?{}:y;("cache-first"===c||"cache-and-network"===c||"network-only"===c||"no-cache"===c)&&d&&"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:d,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)},v=function(t){return i.getResultsFromLink(e,t,{variables:a,context:p,fetchPolicy:u,errorPolicy:c})};switch(u){default:case"cache-first":return(d=f()).complete?[h(d,e.markReady())]:l?[h(d),v(!0)]:[v(!0)];case"cache-and-network":var d;return(d=f()).complete||l?[h(d),v(!0)]:[v(!0)];case"cache-only":return[h(f(),e.markReady())];case"network-only":return[v(!0)];case"no-cache":return[v(!1)];case"standby":return[]}},e.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new wt(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 Et(e,t){if(xt(e.result,e.errorPolicy)){var r=[{result:e.result.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}],n=e.queryUpdatersById;n&&Object.keys(n).forEach((function(i){var o=n[i],s=o.updater,a=o.queryInfo,u=a.document,c=a.variables,l=t.diff({query:u,variables:c,returnPartialData:!0,optimistic:!1}),p=l.result;if(l.complete&&p){var f=s(p,{mutationResult:e.result,queryName:M(u)||void 0,queryVariables:c});f&&r.push({result:f,dataId:"ROOT_QUERY",query:u,variables:c})}})),t.performTransaction((function(t){r.forEach((function(e){return t.write(e)}));var n=e.update;n&&n(t,e.result)}),null)}}var Rt=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=e.queryDeduplication,h=void 0===f||f,v=e.defaultOptions,d=e.assumeImmutableResults,y=void 0!==d&&d,b=e.resolvers,g=e.typeDefs,m=e.fragmentMatcher,_=e.name,S=e.version,O=e.link;if(O||(O=n?new qe({uri:n,credentials:i,headers:o}):le.empty()),!s)throw new r.InvariantError(9);this.link=O,this.cache=s,this.disableNetworkFetches=u||l>0,this.queryDeduplication=h,this.defaultOptions=v||{},this.typeDefs=g,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);void 0!==p&&(p&&"undefined"!=typeof window)&&(window.__APOLLO_CLIENT__=this),this.version="local",this.localState=new _t({cache:s,client:this,resolvers:b,fragmentMatcher:m}),this.queryManager=new qt({cache:this.cache,link:this.link,queryDeduplication:h,ssrMode:u,clientAwareness:{name:_,version:S},localState:this.localState,assumeImmutableResults:y,onBroadcast:function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore.getStore()},dataWithOptimisticResults:t.cache.extract(!0)})}})}return e.prototype.stop=function(){this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=ie(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=ie(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=ie(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 de(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}(),Qt=l.resetCaches,It=l.disableFragmentWarnings,Mt=l.enableExperimentalFragmentVariables,Ft=l.disableExperimentalFragmentVariables,Pt="function"==typeof Symbol&&Symbol.for?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function Dt(){Object.defineProperty(f,Pt,{value:f.createContext({}),enumerable:!1,configurable:!0,writable:!1})}function Ct(){return f[Pt]||Dt(),f[Pt]}var Tt;(Tt=exports.DocumentType||(exports.DocumentType={}))[Tt.Query=0]="Query",Tt[Tt.Mutation=1]="Mutation",Tt[Tt.Subscription=2]="Subscription";var Nt=new Map;function jt(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 At(e){var t,n,i=Nt.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 Nt.set(e,p),p}var Lt=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=At(e);jt(t),jt(n.type);r.invariant(n.type===t,30)},e}(),Vt=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}(Lt),zt=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(ie(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&&a.equal(this.previousResult,e)||(this.setResult(e),this.previousResult=e)},r}(Lt),Bt=function(e){function r(r){var n=r.options,i=r.context,o=r.onNewData,s=e.call(this,n,i)||this;return s.previousData={},s.runLazy=!1,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,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}}return e.client=s.client,s.setOptions(r,!0),s.previousData.loading=s.previousData.result&&s.previousData.result.loading||!1,s.previousData.result=e,s.currentObservable&&s.currentObservable.resetQueryStoreErrors(),e},s.obsRefetch=function(e){return s.currentObservable.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.previousData.query)&&(this.removeQuerySubscription(),this.previousData.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(),delete this.currentObservable,delete this.previousData.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=!1===this.getOptions().ssr,n=this.refreshClient().client.disableNetworkFetches,i=t.__assign({loading:!0,networkStatus:exports.NetworkStatus.loading,called:!0,data:void 0,stale:!1,client:this.client},this.observableQueryFields());return r&&(this.ssrInitiated()||n)?(this.previousData.result=i,i):(this.ssrInitiated()&&(e=this.context.renderPromises.addQueryPromise(this,this.getQueryResult)||i),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.previousData.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.previousData.observableQueryOptions)||(this.previousData.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.previousData.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.previousData.result;(n&&n.loading||!a.equal(r,t.previousData.error))&&(t.previousData.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.previousData.result){var e=this.previousData.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.previousData.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.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}(Lt);function Wt(e,r,n){void 0===n&&(n=!1);var i=p.useContext(Ct()),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 Bt({options:c,context:i,onNewData:function(){f.ssrInitiated()?u():Promise.resolve().then(u)}});f.setOptions(c),f.context=i,f.ssrInitiated()&&!l.current&&(l.current=f);var h,v,d,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()},v=y,(d=p.useRef()).current&&a.equal(v,d.current.key)||(d.current={key:v,value:h()}),d.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.Observable=o,exports.gql=l,exports.ApolloCache=Ce,exports.ApolloClient=Rt,exports.ApolloConsumer=function(e){var t=Ct();return f.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=Ct();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=mt,exports.MissingFieldError=Te,exports.ObservableQuery=Pe,exports.checkFetcher=Se,exports.concat=ve,exports.createHttpLink=ke,exports.createSignalIfSupported=Oe,exports.defaultDataIdFromObject=ut,exports.disableExperimentalFragmentVariables=Ft,exports.disableFragmentWarnings=It,exports.empty=pe,exports.enableExperimentalFragmentVariables=Mt,exports.execute=de,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=Ct,exports.isApolloError=Ee,exports.isReference=_,exports.makeReference=m,exports.makeVar=ot,exports.operationName=jt,exports.parseAndCheckHttpResponse=be,exports.parser=At,exports.resetApolloContext=Dt,exports.resetCaches=Qt,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=f.useContext(Ct()).client;return r.invariant(e,33),e},exports.useLazyQuery=function(e,t){return Wt(e,t,!0)},exports.useMutation=function(e,r){var n=p.useContext(Ct()),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 zt({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 Wt(e,t,!1)},exports.useReactiveVar=function(e){var t=e(),r=e.onNextChange(p.useState(t)[1]);return p.useEffect((function(){return r}),[]),t},exports.useSubscription=function(e,r){var n=p.useContext(Ct()),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 Vt({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)};