@apollo/client 3.4.9 → 3.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apollo-client.cjs.js +24 -52
- package/apollo-client.cjs.js.map +1 -1
- package/apollo-core.cjs.js +22 -16
- package/apollo-core.cjs.js.map +1 -1
- package/apollo-core.cjs.min.js +1 -1
- package/cache/cache.cjs.js +20 -22
- package/cache/cache.cjs.js.map +1 -1
- package/cache/index.d.ts +1 -0
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +1 -2
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.js +1 -1
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/object-canon.d.ts +1 -0
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +1 -0
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +1 -1
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +1 -1
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +1 -1
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +1 -1
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +18 -5
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs.js +47 -34
- package/core/core.cjs.js.map +1 -1
- package/core/index.d.ts.map +1 -1
- package/core/index.js +1 -2
- package/core/index.js.map +1 -1
- package/errors/errors.cjs.js +1 -1
- package/errors/errors.cjs.js.map +1 -1
- package/errors/index.d.ts +1 -0
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +1 -2
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +1 -1
- package/link/core/ApolloLink.js +1 -1
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs.js +4 -6
- package/link/core/core.cjs.js.map +1 -1
- package/link/core/index.d.ts +1 -0
- package/link/core/index.d.ts.map +1 -1
- package/link/core/index.js +1 -2
- package/link/core/index.js.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.d.ts +1 -0
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +1 -0
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs.js +4 -6
- package/link/http/http.cjs.js.map +1 -1
- package/link/http/index.d.ts +1 -0
- package/link/http/index.d.ts.map +1 -1
- package/link/http/index.js +1 -2
- package/link/http/index.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.d.ts.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +1 -3
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.js +5 -6
- package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
- package/link/utils/index.d.ts +1 -0
- package/link/utils/index.d.ts.map +1 -1
- package/link/utils/index.js +1 -2
- package/link/utils/index.js.map +1 -1
- package/link/utils/toPromise.d.ts.map +1 -1
- package/link/utils/toPromise.js +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/utils.cjs.js +3 -5
- package/link/utils/utils.cjs.js.map +1 -1
- package/link/utils/validateOperation.d.ts.map +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/package.json +1 -1
- package/react/context/ApolloConsumer.d.ts.map +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloProvider.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs.js +6 -8
- package/react/context/context.cjs.js.map +1 -1
- package/react/context/index.d.ts +1 -0
- package/react/context/index.d.ts.map +1 -1
- package/react/context/index.js +1 -2
- package/react/context/index.js.map +1 -1
- package/react/data/OperationData.d.ts.map +1 -1
- package/react/data/OperationData.js +1 -1
- package/react/data/OperationData.js.map +1 -1
- package/react/data/QueryData.d.ts.map +1 -1
- package/react/data/QueryData.js +1 -3
- package/react/data/QueryData.js.map +1 -1
- package/react/data/data.cjs.js +6 -11
- package/react/data/data.cjs.js.map +1 -1
- package/react/data/index.d.ts +1 -0
- package/react/data/index.d.ts.map +1 -1
- package/react/data/index.js +1 -2
- package/react/data/index.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs.js +5 -8
- package/react/hoc/hoc.cjs.js.map +1 -1
- package/react/hoc/index.d.ts +1 -0
- package/react/hoc/index.d.ts.map +1 -1
- package/react/hoc/index.js +1 -2
- package/react/hoc/index.js.map +1 -1
- package/react/hoc/withApollo.d.ts.map +1 -1
- package/react/hoc/withApollo.js +1 -1
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs.js +3 -6
- package/react/hooks/hooks.cjs.js.map +1 -1
- package/react/hooks/index.d.ts +1 -0
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js +1 -2
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/useApolloClient.d.ts.map +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +1 -0
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +1 -0
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/utils/useAfterFastRefresh.d.ts +1 -0
- package/react/hooks/utils/useAfterFastRefresh.d.ts.map +1 -1
- package/react/hooks/utils/useAfterFastRefresh.js +1 -0
- package/react/hooks/utils/useAfterFastRefresh.js.map +1 -1
- package/react/hooks/utils/useBaseQuery.d.ts +1 -0
- package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
- package/react/hooks/utils/useBaseQuery.js +1 -0
- package/react/hooks/utils/useBaseQuery.js.map +1 -1
- package/react/index.d.ts +1 -0
- package/react/index.d.ts.map +1 -1
- package/react/index.js +1 -2
- package/react/index.js.map +1 -1
- package/react/parser/index.d.ts.map +1 -1
- package/react/parser/index.js +1 -3
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs.js +9 -11
- package/react/parser/parser.cjs.js.map +1 -1
- package/react/react.cjs.js +2 -2
- package/react/react.cjs.js.map +1 -1
- package/testing/index.d.ts +1 -0
- package/testing/index.d.ts.map +1 -1
- package/testing/index.js +1 -2
- package/testing/index.js.map +1 -1
- package/testing/testing.cjs.js +3 -5
- package/testing/testing.cjs.js.map +1 -1
- package/utilities/globals/DEV.js +2 -2
- package/utilities/globals/DEV.js.map +1 -1
- package/utilities/{common → globals}/global.d.ts +0 -0
- package/utilities/globals/global.d.ts.map +1 -0
- package/utilities/{common → globals}/global.js +0 -0
- package/utilities/globals/global.js.map +1 -0
- package/utilities/globals/globals.cjs.js +56 -0
- package/utilities/globals/globals.cjs.js.map +1 -0
- package/utilities/globals/index.d.ts +4 -2
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +4 -2
- package/utilities/globals/index.js.map +1 -1
- package/utilities/{common → globals}/maybe.d.ts +0 -0
- package/utilities/globals/maybe.d.ts.map +1 -0
- package/utilities/{common → globals}/maybe.js +0 -0
- package/utilities/globals/maybe.js.map +1 -0
- package/utilities/globals/package.json +7 -0
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +1 -1
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +1 -1
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts.map +1 -1
- package/utilities/graphql/getFromAST.js +1 -1
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +1 -1
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +1 -3
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +1 -4
- package/utilities/index.js.map +1 -1
- package/utilities/package.json +1 -3
- package/utilities/testing/mocking/mockLink.d.ts.map +1 -1
- package/utilities/testing/mocking/mockLink.js +1 -1
- package/utilities/testing/mocking/mockLink.js.map +1 -1
- package/utilities/utilities.cjs.js +23 -68
- package/utilities/utilities.cjs.js.map +1 -1
- package/version.js +1 -1
- package/utilities/common/global.d.ts.map +0 -1
- package/utilities/common/global.js.map +0 -1
- package/utilities/common/maybe.d.ts.map +0 -1
- package/utilities/common/maybe.js.map +0 -1
package/apollo-core.cjs.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("ts-invariant"),t=require("ts-invariant/process"),r=require("graphql"),n=require("tslib"),i=require("@wry/equality"),o=require("zen-observable-ts");require("symbol-observable");var a=require("optimism"),s=require("@wry/context"),u=require("@wry/trie"),c=require("graphql-tag");function l(e){try{return e()}catch(e){}}var f=l((function(){return globalThis}))||l((function(){return window}))||l((function(){return self}))||l((function(){return global}))||l((function(){return Function("return this")()})),p="__",h=[p,p].join("DEV");var d=function(){try{return Boolean(!1)}catch(e){return Object.defineProperty(f,h,{value:"production"!==l((function(){return process.env.NODE_ENV})),enumerable:!1,configurable:!0,writable:!0}),f[h]}}();function v(){e.invariant("boolean"==typeof d,38)}function y(t,r){var n=t.directives;return!n||!n.length||function(t){var r=[];t&&t.length&&t.forEach((function(t){if(function(e){var t=e.name.value;return"skip"===t||"include"===t}(t)){var n=t.arguments;t.name.value;e.invariant(n&&1===n.length,40);var i=n[0];e.invariant(i.name&&"if"===i.name.value,41);var o=i.value;e.invariant(o&&("Variable"===o.kind||"BooleanValue"===o.kind),42),r.push({directive:t,ifArgument:i})}}));return r}(n).every((function(t){var n=t.directive,i=t.ifArgument,o=!1;return"Variable"===i.value.kind?(o=r&&r[i.value.name.value],e.invariant(void 0!==o,39)):o=i.value.value,"skip"===n.name.value?!o:o}))}function m(e,t){return function(e){var t=[];return r.visit(e,{Directive:function(e){t.push(e.name.value)}}),t}(t).some((function(t){return e.indexOf(t)>-1}))}function g(e){return e&&m(["client"],e)&&m(["export"],e)}function b(t,r){var i=r,o=[];return t.definitions.forEach((function(t){if("OperationDefinition"===t.kind)throw new e.InvariantError(43);"FragmentDefinition"===t.kind&&o.push(t)})),void 0===i&&(e.invariant(1===o.length,44),i=o[0].name.value),n.__assign(n.__assign({},t),{definitions:n.__spreadArray([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}],t.definitions)})}function _(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function w(t,r){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":var n=r&&r[t.name.value];return e.invariant(n,45),n;default:return null}}function S(e){return null!==e&&"object"==typeof e}function O(e){return{__ref:String(e)}}function k(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function x(t,r,n,i){if(function(e){return"IntValue"===e.kind}(n)||function(e){return"FloatValue"===e.kind}(n))t[r.value]=Number(n.value);else if(function(e){return"BooleanValue"===e.kind}(n)||function(e){return"StringValue"===e.kind}(n))t[r.value]=n.value;else if(function(e){return"ObjectValue"===e.kind}(n)){var o={};n.fields.map((function(e){return x(o,e.name,e.value,i)})),t[r.value]=o}else if(function(e){return"Variable"===e.kind}(n)){var a=(i||{})[n.name.value];t[r.value]=a}else if(function(e){return"ListValue"===e.kind}(n))t[r.value]=n.values.map((function(e){var t={};return x(t,r,e,i),t[r.value]}));else if(function(e){return"EnumValue"===e.kind}(n))t[r.value]=n.value;else{if(!function(e){return"NullValue"===e.kind}(n))throw new e.InvariantError(54);t[r.value]=null}}r.isType(null),t.remove();var E=["connection","include","skip","client","rest","export"],q=Object.assign((function(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 i={};return n.forEach((function(e){i[e]=t[e]})),r.connection.key+"("+R(i)+")"}return r.connection.key}var o=e;if(t){var a=R(t);o+="("+a+")"}return r&&Object.keys(r).forEach((function(e){-1===E.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?o+="@"+e+"("+R(r[e])+")":o+="@"+e)})),o}),{setStringify:function(e){var t=R;return R=e,t}}),R=function(e){return JSON.stringify(e,Q)};function Q(e,t){return S(t)&&!Array.isArray(t)&&(t=Object.keys(t).sort().reduce((function(e,r){return e[r]=t[r],e}),{})),t}function I(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return x(r,n,i,t)})),r}return null}function F(e){return e.alias?e.alias.value:e.name.value}function M(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(P(o)){if("__typename"===o.name.value)return e[F(o)]}else{var a=M(e,w(o,r).selectionSet,r);if("string"==typeof a)return a}}}function P(e){return"Field"===e.kind}function T(e){return"InlineFragment"===e.kind}function C(t){e.invariant(t&&"Document"===t.kind,46);var r=t.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(t){if("OperationDefinition"!==t.kind)throw new e.InvariantError(47);return t}));return e.invariant(r.length<=1,48),t}function D(e){return C(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function j(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||null}function A(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function N(t){var r;C(t);for(var n=0,i=t.definitions;n<i.length;n++){var o=i[n];if("OperationDefinition"===o.kind){var a=o.operation;if("query"===a||"mutation"===a||"subscription"===a)return o}"FragmentDefinition"!==o.kind||r||(r=o)}if(r)return r;throw new e.InvariantError(53)}function L(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&x(t,e.variable.name,e.defaultValue)})),t}function V(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 B={kind:"Field",name:{kind:"Name",value:"__typename"}};function W(e,t){return e.selectionSet.selections.every((function(e){return"FragmentSpread"===e.kind&&W(t[e.name.value],t)}))}function z(t){return W(D(t)||function(t){e.invariant("Document"===t.kind,50),e.invariant(t.definitions.length<=1,51);var r=t.definitions[0];return e.invariant("FragmentDefinition"===r.kind,52),r}(t),_(A(t)))?null:t}function U(e){return function(t){return e.some((function(e){return e.name&&e.name===t.name.value||e.test&&e.test(t)}))}}function K(e,t){var i=Object.create(null),o=[],a=Object.create(null),s=[],u=z(r.visit(t,{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(U(e))))return t.arguments&&t.arguments.forEach((function(e){"Variable"===e.value.kind&&o.push({name:e.value.name.value})})),t.selectionSet&&Y(t.selectionSet).forEach((function(e){s.push({name:e.name.value})})),null}},FragmentSpread:{enter:function(e){a[e.name.value]=!0}},Directive:{enter:function(t){if(U(e)(t))return null}}}));return u&&V(o,(function(e){return!!e.name&&!i[e.name]})).length&&(u=function(e,t){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 z(r.visit(t,{OperationDefinition:{enter:function(t){return n.__assign(n.__assign({},t),{variableDefinitions:t.variableDefinitions?t.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&&V(s,(function(e){return!!e.name&&!a[e.name]})).length&&(u=function(e,t){function n(t){if(e.some((function(e){return e.name===t.name.value})))return null}return z(r.visit(t,{FragmentSpread:{enter:n},FragmentDefinition:{enter:n}}))}(s,u)),u}var J=Object.assign((function(e){return r.visit(C(e),{SelectionSet:{enter:function(e,t,r){if(!r||"OperationDefinition"!==r.kind){var i=e.selections;if(i)if(!i.some((function(e){return P(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var o=r;if(!(P(o)&&o.directives&&o.directives.some((function(e){return"export"===e.name.value}))))return n.__assign(n.__assign({},e),{selections:n.__spreadArray(n.__spreadArray([],i),[B])})}}}}})}),{added:function(e){return e===B}}),H={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 Y(e){var t=[];return e.selections.forEach((function(e){(P(e)||T(e))&&e.selectionSet?Y(e.selectionSet).forEach((function(e){return t.push(e)})):"FragmentSpread"===e.kind&&t.push(e)})),t}function G(e){return"query"===N(e).operation?e:r.visit(e,{OperationDefinition:{enter:function(e){return n.__assign(n.__assign({},e),{operation:"query"})}}})}var $=Object.prototype.hasOwnProperty;function X(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Z(e)}function Z(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new te,i=1;i<r;++i)t=n.merge(t,e[i]);return t}var ee=function(e,t,r){return this.merge(e[r],t[r])},te=function(){function e(e){void 0===e&&(e=ee),this.reconciler=e,this.isObject=S,this.pastCopies=new Set}return e.prototype.merge=function(e,t){for(var r=this,i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];return S(t)&&S(e)?(Object.keys(t).forEach((function(o){if($.call(e,o)){var a=e[o];if(t[o]!==a){var s=r.reconciler.apply(r,n.__spreadArray([e,t,o],i));s!==a&&((e=r.shallowCopyForMerge(e))[o]=s)}}else(e=r.shallowCopyForMerge(e))[o]=t[o]})),e):t},e.prototype.shallowCopyForMerge=function(e){return S(e)&&!this.pastCopies.has(e)&&(e=Array.isArray(e)?e.slice(0):n.__assign({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e)),e},e}(),re=Object.prototype.toString;function ne(e){return ie(e)}function ie(e,t){switch(re.call(e)){case"[object Array]":if((t=t||new Map).has(e))return t.get(e);var r=e.slice(0);return t.set(e,r),r.forEach((function(e,n){r[n]=ie(e,t)})),r;case"[object Object]":if((t=t||new Map).has(e))return t.get(e);var n=Object.create(Object.getPrototypeOf(e));return t.set(e,n),Object.keys(e).forEach((function(r){n[r]=ie(e[r],t)})),n;default:return e}}function oe(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function ae(e,t,r){return new o.Observable((function(n){var i=n.next,o=n.error,a=n.complete,s=0,u=!1,c={then:function(e){return new Promise((function(t){return t(e())}))}};function l(e,t){return e?function(t){++s;var r=function(){return e(t)};c=c.then(r,r).then((function(e){--s,i&&i.call(n,e),u&&f.complete()}),(function(e){throw--s,e})).catch((function(e){o&&o.call(n,e)}))}:function(e){return t&&t.call(n,e)}}var f={next:l(t,i),error:l(r,o),complete:function(){u=!0,s||a&&a.call(n)}},p=e.subscribe(f);return function(){return p.unsubscribe()}}))}function se(e){function t(t){Object.defineProperty(e,t,{value:o.Observable})}return"function"==typeof Symbol&&Symbol.species&&t(Symbol.species),t("@@species"),e}function ue(e){return e&&"function"==typeof e.then}var ce=function(e){function t(t){var r=e.call(this,(function(e){return r.addObserver(e),function(){return r.removeObserver(e)}}))||this;return r.observers=new Set,r.addCount=0,r.promise=new Promise((function(e,t){r.resolve=e,r.reject=t})),r.handlers={next:function(e){null!==r.sub&&(r.latest=["next",e],oe(r.observers,"next",e))},error:function(e){var t=r.sub;null!==t&&(t&&setTimeout((function(){return t.unsubscribe()})),r.sub=null,r.latest=["error",e],r.reject(e),oe(r.observers,"error",e))},complete:function(){if(null!==r.sub){var e=r.sources.shift();e?ue(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(),oe(r.observers,"complete"))}}},r.cancel=function(e){r.reject(e),r.sources=[],r.handlers.complete()},r.promise.catch((function(e){})),"function"==typeof t&&(t=[new o.Observable(t)]),ue(t)?t.then((function(e){return r.start(e)}),r.handlers.error):r.start(t),r}return n.__extends(t,e),t.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},t.prototype.deliverLastMessage=function(e){if(this.latest){var t=this.latest[0],r=e[t];r&&r.call(e,this.latest[1]),null===this.sub&&"next"===t&&e.complete&&e.complete()}},t.prototype.addObserver=function(e){this.observers.has(e)||(this.deliverLastMessage(e),this.observers.add(e),++this.addCount)},t.prototype.removeObserver=function(e,t){this.observers.delete(e)&&--this.addCount<1&&!t&&this.handlers.error(new Error("Observable cancelled prematurely"))},t.prototype.cleanup=function(e){var t=this,r=!1,n=function(){r||(r=!0,t.observers.delete(i),e())},i={next:n,error:n,complete:n},o=this.addCount;this.addObserver(i),this.addCount=o},t}(o.Observable);function le(e){return Array.isArray(e)&&e.length>0}function fe(e){return e.errors&&e.errors.length>0||!1}se(ce);var pe="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product),he="function"==typeof WeakSet;function de(){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}var ve=new Map;function ye(e){var t=ve.get(e)||1;return ve.set(e,t+1),e+":"+t+":"+Math.random().toString(36).slice(2)}function me(e){return new o.Observable((function(t){t.error(e)}))}v();var ge=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 be(e,t){return t?t(e):o.Observable.of()}function _e(e){return"function"==typeof e?new Se(e):e}function we(e){return e.request.length<=1}!function(e){function t(t,r){var n=e.call(this,t)||this;return n.link=r,n}n.__extends(t,e)}(Error);var Se=function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t((function(){return o.Observable.of()}))},t.from=function(e){return 0===e.length?t.empty():e.map(_e).reduce((function(e,t){return e.concat(t)}))},t.split=function(e,r,n){var i=_e(r),a=_e(n||new t(be));return we(i)&&we(a)?new t((function(t){return e(t)?i.request(t)||o.Observable.of():a.request(t)||o.Observable.of()})):new t((function(t,r){return e(t)?i.request(t,r)||o.Observable.of():a.request(t,r)||o.Observable.of()}))},t.execute=function(t,r){return t.request(function(e,t){var r=n.__assign({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){r="function"==typeof e?n.__assign(n.__assign({},r),e(r)):n.__assign(n.__assign({},r),e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return n.__assign({},r)}}),t}(r.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?j(t.query)||void 0:""),t}(function(t){for(var r=["query","operationName","variables","extensions","context"],n=0,i=Object.keys(t);n<i.length;n++){var o=i[n];if(r.indexOf(o)<0)throw new e.InvariantError(26)}return t}(r))))||o.Observable.of()},t.concat=function(e,r){var n=_e(e);if(we(n))return n;var i=_e(r);return we(i)?new t((function(e){return n.request(e,(function(e){return i.request(e)||o.Observable.of()}))||o.Observable.of()})):new t((function(e,t){return n.request(e,(function(e){return i.request(e,t)||o.Observable.of()}))||o.Observable.of()}))},t.prototype.split=function(e,r,n){return this.concat(t.split(e,r,n||new t(be)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(t,r){throw new e.InvariantError(21)},t.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},t.prototype.setOnError=function(e){return this.onError=e,this},t}(),Oe=Se.empty,ke=Se.from,xe=Se.split,Ee=Se.concat,qe=Se.execute,Re=Object.prototype.hasOwnProperty;function Qe(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&&ge(t,r,"Response not successful: Received status code "+t.status),Array.isArray(r)||Re.call(r,"data")||Re.call(r,"errors")||ge(t,r,"Server response was missing for query '"+(Array.isArray(e)?e.map((function(e){return e.operationName})):e.operationName)+"'."),r}))}}var Ie=function(t,r){var n;try{n=JSON.stringify(t)}catch(t){var i=new e.InvariantError(23);throw i.parseError=t,i}return n},Fe={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},Me=function(e,t){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];var a=n.__assign(n.__assign({},t.options),{headers:t.headers,credentials:t.credentials}),s=t.http||{};i.forEach((function(e){a=n.__assign(n.__assign(n.__assign({},a),e.options),{headers:n.__assign(n.__assign({},a.headers),Pe(e.headers))}),e.credentials&&(a.credentials=e.credentials),s=n.__assign(n.__assign({},s),e.http)}));var u=e.operationName,c=e.extensions,l=e.variables,f=e.query,p={operationName:u,variables:l};return s.includeExtensions&&(p.extensions=c),s.includeQuery&&(p.query=r.print(f)),{options:a,body:p}};function Pe(e){if(e){var t=Object.create(null);return Object.keys(Object(e)).forEach((function(r){t[r.toLowerCase()]=e[r]})),t}return e}var Te=function(t){if(!t&&"undefined"==typeof fetch)throw new e.InvariantError(22)},Ce=function(){if("undefined"==typeof AbortController)return{controller:!1,signal:!1};var e=new AbortController;return{controller:e,signal:e.signal}},De=function(e,t){var r=e.getContext().uri;return r||("function"==typeof t?t(e):t||"/graphql")};function je(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=Ie(t.variables)}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=Ie(t.extensions)}catch(e){return{parseError:e}}n("extensions",o)}var a="",s=e,u=e.indexOf("#");-1!==u&&(a=e.substr(u),s=e.substr(0,u));var c=-1===s.indexOf("?")?"?":"&";return{newURI:s+c+r.join("&")+a}}var Ae=l((function(){return fetch})),Ne=function(e){void 0===e&&(e={});var t=e.uri,i=void 0===t?"/graphql":t,a=e.fetch,s=e.includeExtensions,u=e.useGETForQueries,c=e.includeUnusedVariables,f=void 0!==c&&c,p=n.__rest(e,["uri","fetch","includeExtensions","useGETForQueries","includeUnusedVariables"]);var h={http:{includeExtensions:s},options:p.fetchOptions,credentials:p.credentials,headers:p.headers};return new Se((function(e){var t=De(e,i),s=e.getContext(),c={};if(s.clientAwareness){var p=s.clientAwareness,d=p.name,v=p.version;d&&(c["apollographql-client-name"]=d),v&&(c["apollographql-client-version"]=v)}var y,m=n.__assign(n.__assign({},c),s.headers),g={http:s.http,options:s.fetchOptions,credentials:s.credentials,headers:m},b=Me(e,Fe,h,g),_=b.options,w=b.body;if(w.variables&&!f){var S=new Set(Object.keys(w.variables));r.visit(e.query,{Variable:function(e,t,r){r&&"VariableDefinition"!==r.kind&&S.delete(e.name.value)}}),S.size&&(w.variables=n.__assign({},w.variables),S.forEach((function(e){delete w.variables[e]})))}if(!_.signal){var O=Ce(),k=O.controller,x=O.signal;(y=k)&&(_.signal=x)}if(u&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(_.method="GET"),"GET"===_.method){var E=je(t,w),q=E.newURI,R=E.parseError;if(R)return me(R);t=q}else try{_.body=Ie(w)}catch(R){return me(R)}return new o.Observable((function(r){return(a||l((function(){return fetch}))||Ae)(t,_).then((function(t){return e.setContext({response:t}),t})).then(Qe(e)).then((function(e){return r.next(e),r.complete(),e})).catch((function(e){"AbortError"!==e.name&&(e.result&&e.result.errors&&e.result.data&&r.next(e.result),r.error(e))})),function(){y&&y.abort()}}))}))},Le=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,Ne(t).request)||this;return r.options=t,r}return n.__extends(t,e),t}(Se),Ve=function(){function e(){this.getFragmentDoc=a.wrap(b)}return e.prototype.batch=function(e){var t="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;this.performTransaction(e.update,t)},e.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},e.prototype.transformDocument=function(e){return e},e.prototype.identify=function(e){},e.prototype.gc=function(){return[]},e.prototype.modify=function(e){return!1},e.prototype.transformForLink=function(e){return e},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(n.__assign(n.__assign({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(n.__assign(n.__assign({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},e.prototype.writeQuery=function(e){var t=e.id,r=e.data,i=n.__rest(e,["id","data"]);return this.write(Object.assign(i,{dataId:t||"ROOT_QUERY",result:r}))},e.prototype.writeFragment=function(e){var t=e.id,r=e.data,i=e.fragment,o=e.fragmentName,a=n.__rest(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(a,{query:this.getFragmentDoc(i,o),dataId:t,result:r}))},e}();exports.Cache=void 0,exports.Cache||(exports.Cache={});var Be=function(e){function t(r,n,i,o){var a=e.call(this,r)||this;return a.message=r,a.path=n,a.query=i,a.variables=o,a.__proto__=t.prototype,a}return n.__extends(t,e),t}(Error),We=Object.prototype.hasOwnProperty;var ze=/^[_a-z][_0-9a-z]*/i;function Ue(e){var t=e.match(ze);return t?t[0]:e}function Ke(e,t,r){return!!S(t)&&(Array.isArray(t)?t.every((function(t){return Ke(e,t,r)})):e.selections.every((function(e){if(P(e)&&y(e,r)){var n=F(e);return We.call(t,n)&&(!e.selectionSet||Ke(e.selectionSet,t[n],r))}return!0})))}function Je(e){return S(e)&&!k(e)&&!Array.isArray(e)}var He=Object.create(null),Ye=function(){return He},Ge=Object.create(null),$e=function(){function t(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 k(e)?r.get(e.__ref,t):e&&e[t]},this.canRead=function(e){return k(e)?r.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return O(e);if(k(e))return e;var n=r.policies.identify(e)[0];if(n){var i=O(n);return t&&r.merge(n,e),i}}}return t.prototype.toObject=function(){return n.__assign({},this.data)},t.prototype.has=function(e){return void 0!==this.lookup(e,!0)},t.prototype.get=function(e,t){if(this.group.depend(e,t),We.call(this.data,e)){var r=this.data[e];if(r&&We.call(r,t))return r[t]}return"__typename"===t&&We.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof tt?this.parent.get(e,t):void 0},t.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),We.call(this.data,e)?this.data[e]:this instanceof tt?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},t.prototype.merge=function(t,r){var n,i=this;k(t)&&(t=t.__ref),k(r)&&(r=r.__ref);var o="string"==typeof t?this.lookup(n=t):t,a="string"==typeof r?this.lookup(n=r):r;if(a){e.invariant("string"==typeof n,1);var s=new te(nt).merge(o,a);if(this.data[n]=s,s!==o&&(delete this.refs[n],this.group.caching)){var u=Object.create(null);o||(u.__exists=1),Object.keys(a).forEach((function(e){if(!o||o[e]!==s[e]){u[e]=1;var t=Ue(e);t===e||i.policies.hasKeyArgs(s.__typename,t)||(u[t]=1),void 0!==s[e]||i instanceof tt||delete s[e]}})),!u.__typename||o&&o.__typename||this.policies.rootTypenamesById[n]!==s.__typename||delete u.__typename,Object.keys(u).forEach((function(e){return i.group.dirty(n,e)}))}}},t.prototype.modify=function(e,t){var r=this,i=this.lookup(e);if(i){var o=Object.create(null),a=!1,s=!0,u={DELETE:He,INVALIDATE:Ge,isReference:k,toReference:this.toReference,canRead:this.canRead,readField:function(t,n){return r.policies.readField("string"==typeof t?{fieldName:t,from:n||O(e)}:t,{store:r})}};if(Object.keys(i).forEach((function(c){var l=Ue(c),f=i[c];if(void 0!==f){var p="function"==typeof t?t:t[c]||t[l];if(p){var h=p===Ye?He:p(f,n.__assign(n.__assign({},u),{fieldName:l,storeFieldName:c,storage:r.getStorage(e,c)}));h===Ge?r.group.dirty(e,c):(h===He&&(h=void 0),h!==f&&(o[c]=h,a=!0,f=h))}void 0!==f&&(s=!1)}})),a)return this.merge(e,o),s&&(this instanceof tt?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},t.prototype.delete=function(e,t,r){var n,i=this.lookup(e);if(i){var o=this.getFieldValue(i,"__typename"),a=t&&r?this.policies.getStoreFieldName({typename:o,fieldName:t,args:r}):t;return this.modify(e,a?((n={})[a]=Ye,n):Ye)}return!1},t.prototype.evict=function(e){var t=!1;return e.id&&(We.call(this.data,e.id)&&(t=this.delete(e.id,e.fieldName,e.args)),this instanceof tt&&(t=this.parent.evict(e)||t),(e.fieldName||t)&&this.group.dirty(e.id,e.fieldName||"__exists")),t},t.prototype.clear=function(){this.replace(null)},t.prototype.extract=function(){var e=this,t=this.toObject(),r=[];return this.getRootIdSet().forEach((function(t){We.call(e.policies.rootTypenamesById,t)||r.push(t)})),r.length&&(t.__META={extraRootIds:r.sort()}),t},t.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach((function(r){e&&We.call(e,r)||t.delete(r)})),e){var r=e.__META,i=n.__rest(e,["__META"]);Object.keys(i).forEach((function(e){t.merge(e,i[e])})),r&&r.extraRootIds.forEach(this.retain,this)}},t.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},t.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},t.prototype.getRootIdSet=function(e){return void 0===e&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof tt?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},t.prototype.gc=function(){var e=this,t=this.getRootIdSet(),r=this.toObject();t.forEach((function(n){We.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 tt;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},t.prototype.findChildRefIds=function(e){if(!We.call(this.refs,e)){var t=this.refs[e]=Object.create(null),r=this.data[e];if(!r)return t;var n=new Set([r]);n.forEach((function(e){k(e)&&(t[e.__ref]=!0),S(e)&&Object.keys(e).forEach((function(t){var r=e[t];S(r)&&n.add(r)}))}))}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}(),Xe=function(){function e(e,t){void 0===t&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return e.prototype.resetCaching=function(){this.d=this.caching?a.dep():null,this.keyMaker=new u.Trie(pe)},e.prototype.depend=function(e,t){if(this.d){this.d(Ze(e,t));var r=Ue(t);r!==t&&this.d(Ze(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(Ze(e,t),"__exists"===t?"forget":"setDirty")},e}();function Ze(e,t){return t+"#"+e}function et(e,t){it(e)&&e.group.depend(t,"__exists")}!function(e){var t=function(e){function t(t){var r=t.policies,n=t.resultCaching,i=void 0===n||n,o=t.seed,a=e.call(this,r,new Xe(i))||this;return a.stump=new rt(a),a.storageTrie=new u.Trie(pe),o&&a.replace(o),a}return n.__extends(t,e),t.prototype.addLayer=function(e,t){return this.stump.addLayer(e,t)},t.prototype.removeLayer=function(){return this},t.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},t}(e);e.Root=t}($e||($e={}));var tt=function(e){function t(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 n.__extends(t,e),t.prototype.addLayer=function(e,r){return new t(e,this,r,this.group)},t.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){var n=t.data[e],o=r.lookup(e);o?n?n!==o&&Object.keys(n).forEach((function(r){i.equal(n[r],o[r])||t.group.dirty(e,r)})):(t.group.dirty(e,"__exists"),Object.keys(o).forEach((function(r){t.group.dirty(e,r)}))):t.delete(e)})),r):r===this.parent?this:r.addLayer(this.id,this.replay)},t.prototype.toObject=function(){return n.__assign(n.__assign({},this.parent.toObject()),this.data)},t.prototype.findChildRefIds=function(t){var r=this.parent.findChildRefIds(t);return We.call(this.data,t)?n.__assign(n.__assign({},r),e.prototype.findChildRefIds.call(this,t)):r},t.prototype.getStorage=function(){for(var e=this.parent;e.parent;)e=e.parent;return e.getStorage.apply(e,arguments)},t}($e),rt=function(e){function t(t){return e.call(this,"EntityStore.Stump",t,(function(){}),new Xe(t.group.caching,t.group))||this}return n.__extends(t,e),t.prototype.removeLayer=function(){return this},t.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},t}(tt);function nt(e,t,r){var n=e[r],o=t[r];return i.equal(n,o)?n:o}function it(e){return!!(e instanceof $e&&e.group.caching)}var ot,at,st=function(){function e(){this.known=new(he?WeakSet:Set),this.pool=new u.Trie(pe),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return e.prototype.isKnown=function(e){return S(e)&&this.known.has(e)},e.prototype.pass=function(e){if(S(e)){var t=function(e){return S(e)?Array.isArray(e)?e.slice(0):n.__assign({__proto__:Object.getPrototypeOf(e)},e):e}(e);return this.passes.set(t,e),t}return e},e.prototype.admit=function(e){var t=this;if(S(e)){var r=this.passes.get(e);if(r)return r;switch(Object.getPrototypeOf(e)){case Array.prototype:if(this.known.has(e))return e;var n=e.map(this.admit,this);return(s=this.pool.lookupArray(n)).array||this.known.add(s.array=n),s.array;case null:case Object.prototype:if(this.known.has(e))return e;var i=Object.getPrototypeOf(e),o=[i],a=this.sortedKeys(e);o.push(a.json);var s,u=o.length;if(a.sorted.forEach((function(r){o.push(t.admit(e[r]))})),!(s=this.pool.lookupArray(o)).object){var c=s.object=Object.create(i);this.known.add(c),a.sorted.forEach((function(e,t){c[e]=o[u+t]}))}return s.object}}return e},e.prototype.sortedKeys=function(e){var t=Object.keys(e),r=this.pool.lookupArray(t);if(!r.keys){t.sort();var n=JSON.stringify(t);(r.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,r.keys={sorted:t,json:n})}return r.keys},e}(),ut=Object.assign((function(e){if(S(e)){void 0===ot&&ct();var t=ot.admit(e),r=at.get(t);return void 0===r&&at.set(t,r=JSON.stringify(t)),r}return JSON.stringify(e)}),{reset:ct});function ct(){ot=new st,at=new(pe?WeakMap:Map)}function lt(e,t){return new Be(e.message,t.path.slice(),t.query,t.variables)}function ft(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var pt=function(){function t(e){var t=this;this.knownResults=new(pe?WeakMap:Map),this.config=n.__assign(n.__assign({},e),{addTypename:!1!==e.addTypename}),this.canon=e.canon||new st,this.executeSelectionSet=a.wrap((function(e){var r,i=e.context.canonizeResults,o=ft(e);o[3]=!i;var a=(r=t.executeSelectionSet).peek.apply(r,o);return a?i?n.__assign(n.__assign({},a),{result:t.canon.admit(a.result)}):a:(et(e.context.store,e.enclosingRef.__ref),t.execSelectionSetImpl(e))}),{max:this.config.resultCacheMaxSize,keyArgs:ft,makeCacheKey:function(e,t,r,n){if(it(r.store))return r.store.makeCacheKey(e,k(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=a.wrap((function(e){return et(e.context.store,e.enclosingRef.__ref),t.execSubSelectedArrayImpl(e)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var t=e.field,r=e.array,n=e.context;if(it(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return t.prototype.resetCanon=function(){this.canon=new st},t.prototype.diffQueryAgainstStore=function(t){var r,i=t.store,o=t.query,a=t.rootId,s=void 0===a?"ROOT_QUERY":a,u=t.variables,c=t.returnPartialData,l=void 0===c||c,f=t.canonizeResults,p=void 0===f||f,h=this.config.cache.policies;u=n.__assign(n.__assign({},L((r=D(o),e.invariant(r&&"query"===r.operation,49),r))),u);var d=O(s),v=this.executeSelectionSet({selectionSet:N(o).selectionSet,objectOrReference:d,enclosingRef:d,context:{store:i,query:o,policies:h,variables:u,varString:ut(u),canonizeResults:p,fragmentMap:_(A(o)),path:[]}}),y=v.missing&&v.missing.length>0;if(y&&!l)throw v.missing[0];return{result:v.result,missing:v.missing,complete:!y}},t.prototype.isFresh=function(e,t,r,n){if(it(n.store)&&this.knownResults.get(e)===r){var i=this.executeSelectionSet.peek(r,t,n,this.canon.isKnown(e));if(i&&e===i.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(t){var r=this,n=t.selectionSet,i=t.objectOrReference,o=t.enclosingRef,a=t.context;if(k(i)&&!a.policies.rootTypenamesById[i.__ref]&&!a.store.has(i.__ref))return{result:this.canon.empty,missing:[lt(new e.InvariantError(5),a)]};var s=a.variables,u=a.policies,c=a.store,l=[],f={result:null},p=c.getFieldValue(i,"__typename");function h(){return f.missing||(f.missing=[])}function d(e){var t;return e.missing&&(t=h()).push.apply(t,e.missing),e.result}this.config.addTypename&&"string"==typeof p&&!u.rootIdsByTypename[p]&&l.push({__typename:p});var v=new Set(n.selections);v.forEach((function(t){var n;if(y(t,s))if(P(t)){var c=u.readField({fieldName:t.name.value,field:t,variables:a.variables,from:i},a),f=F(t);a.path.push(f),void 0===c?J.added(t)||h().push(lt(new e.InvariantError(6),a)):Array.isArray(c)?c=d(r.executeSubSelectedArray({field:t,array:c,enclosingRef:o,context:a})):t.selectionSet?null!=c&&(c=d(r.executeSelectionSet({selectionSet:t.selectionSet,objectOrReference:c,enclosingRef:k(c)?c:o,context:a}))):a.canonizeResults&&(c=r.canon.pass(c)),void 0!==c&&l.push(((n={})[f]=c,n)),e.invariant(a.path.pop()===f)}else{var m=w(t,a.fragmentMap);m&&u.fragmentMatches(m,p)&&m.selectionSet.selections.forEach(v.add,v)}}));var m=Z(l);return f.result=a.canonizeResults?this.canon.admit(m):m,this.knownResults.set(f.result,n),f},t.prototype.execSubSelectedArrayImpl=function(t){var r,n=this,i=t.field,o=t.array,a=t.enclosingRef,s=t.context;function u(t,n){return t.missing&&(r=r||[]).push.apply(r,t.missing),e.invariant(s.path.pop()===n),t.result}return i.selectionSet&&(o=o.filter(s.store.canRead)),o=o.map((function(t,r){return null===t?null:(s.path.push(r),Array.isArray(t)?u(n.executeSubSelectedArray({field:i,array:t,enclosingRef:a,context:s}),r):i.selectionSet?u(n.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:t,enclosingRef:k(t)?t:a,context:s}),r):(e.invariant(s.path.pop()===r),t))})),{result:s.canonizeResults?this.canon.admit(o):o,missing:r}},t}();var ht=function(){function t(e,t){this.cache=e,this.reader=t}return t.prototype.writeToStore=function(t,r){var i=this,o=r.query,a=r.result,s=r.dataId,u=r.variables,c=r.overwrite,l=D(o),f=new te;u=n.__assign(n.__assign({},L(l)),u);var p={store:t,written:Object.create(null),merge:function(e,t){return f.merge(e,t)},variables:u,varString:ut(u),fragmentMap:_(A(o)),overwrite:!!c,incomingById:new Map,clientOnly:!1},h=this.processSelectionSet({result:a||Object.create(null),dataId:s,selectionSet:l.selectionSet,mergeTree:{map:new Map},context:p});if(!k(h))throw new e.InvariantError(8);return p.incomingById.forEach((function(e,r){var n=e.fields,o=e.mergeTree,a=(e.selections,O(r));if(o&&o.map.size){var s=i.applyMerges(o,a,n,p);if(k(s))return;n=s}t.merge(r,n)})),t.retain(h.__ref),h},t.prototype.processSelectionSet=function(e){var t=this,r=e.dataId,n=e.result,i=e.selectionSet,o=e.context,a=e.mergeTree,s=this.cache.policies,u=s.identify(n,i,o.fragmentMap),c=u[0],l=u[1];if("string"==typeof(r=r||c)){var f=o.written[r]||(o.written[r]=[]),p=O(r);if(f.indexOf(i)>=0)return p;if(f.push(i),this.reader&&this.reader.isFresh(n,p,i,o))return p}var h=Object.create(null);l&&(h=o.merge(h,l));var d=r&&s.rootTypenamesById[r]||M(n,i,o.fragmentMap)||r&&o.store.get(r,"__typename");"string"==typeof d&&(h.__typename=d);var v=new Set(i.selections);if(v.forEach((function(e){var r;if(y(e,o.variables))if(P(e)){var i=F(e),u=n[i],c=o.clientOnly;if(o.clientOnly=c||!(!e.directives||!e.directives.some((function(e){return"client"===e.name.value}))),void 0!==u){var l=s.getStoreFieldName({typename:d,fieldName:e.name.value,field:e,variables:o.variables}),f=vt(a,l),p=t.processFieldValue(u,e,o,f),m=void 0;if(e.selectionSet&&!(m=o.store.getFieldValue(p,"__typename"))&&k(p)){var g=o.incomingById.get(p.__ref);m=g&&g.fields.__typename}var b=s.getMergeFunction(d,e.name.value,m);b?f.info={field:e,typename:d,merge:b}:gt(a,l),h=o.merge(h,((r={})[l]=p,r))}else!o.clientOnly&&J.added(e);o.clientOnly=c}else{var _=w(e,o.fragmentMap);_&&s.fragmentMatches(_,d,n,o.variables)&&_.selectionSet.selections.forEach(v.add,v)}})),"string"==typeof r){var m=o.incomingById.get(r);return m?(m.fields=o.merge(m.fields,h),m.mergeTree=yt(m.mergeTree,a),m.selections.forEach(v.add,v),m.selections=v):o.incomingById.set(r,{fields:h,mergeTree:mt(a)?void 0:a,selections:v}),O(r)}return h},t.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?Array.isArray(e)?e.map((function(e,o){var a=i.processFieldValue(e,t,r,vt(n,o));return gt(n,o),a})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):e},t.prototype.applyMerges=function(t,r,i,o,a){var s,u=this;if(t.map.size&&!k(i)){var c,l=Array.isArray(i)||!k(r)&&!Je(r)?void 0:r,f=i;l&&!a&&(a=[k(l)?l.__ref:l]);var p=function(e,t){return Array.isArray(e)?"number"==typeof t?e[t]:void 0:o.store.getFieldValue(e,String(t))};t.map.forEach((function(t,r){var n=p(l,r),i=p(f,r);if(void 0!==i){a&&a.push(r);var s=u.applyMerges(t,n,i,o,a);s!==i&&(c=c||new Map).set(r,s),a&&e.invariant(a.pop()===r)}})),c&&(i=Array.isArray(f)?f.slice(0):n.__assign({},f),c.forEach((function(e,t){i[t]=e})))}return t.info?this.cache.policies.runMergeFunction(r,i,t.info,o,a&&(s=o.store).getStorage.apply(s,a)):i},t}(),dt=[];function vt(e,t){var r=e.map;return r.has(t)||r.set(t,dt.pop()||{map:new Map}),r.get(t)}function yt(e,t){if(e===t||!t||mt(t))return e;if(!e||mt(e))return t;var r=e.info&&t.info?n.__assign(n.__assign({},e.info),t.info):e.info||t.info,i=e.map.size&&t.map.size,o={info:r,map:i?new Map:e.map.size?e.map:t.map};if(i){var a=new Set(t.map.keys());e.map.forEach((function(e,r){o.map.set(r,yt(e,t.map.get(r))),a.delete(r)})),a.forEach((function(r){o.map.set(r,yt(t.map.get(r),e.map.get(r)))}))}return o}function mt(e){return!e||!(e.info||e.map.size)}function gt(e,t){var r=e.map,n=r.get(t);n&&mt(n)&&(dt.push(n),r.delete(t))}new Set;var bt=new s.Slot,_t=new WeakMap;function wt(e){var t=_t.get(e);return t||_t.set(e,t={vars:new Set,dep:a.dep()}),t}function St(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0){if(e!==o){e=o,t.forEach((function(e){wt(e).dep.dirty(n),Ot(e)}));var a=Array.from(r);r.clear(),a.forEach((function(t){return t(e)}))}}else{var s=bt.getValue();s&&(i(s),wt(s).dep(n))}return e};n.onNextChange=function(e){return r.add(e),function(){r.delete(e)}};var i=n.attachCache=function(e){return t.add(e),wt(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}function Ot(e){e.broadcastWatches&&e.broadcastWatches()}function kt(e){return void 0!==e.args?e.args:e.field?I(e.field,e.variables):null}q.setStringify(ut);var xt=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))},Et=function(){},qt=function(e,t){return t.fieldName},Rt=function(e,t,r){return(0,r.mergeObjects)(e,t)},Qt=function(e,t){return t},It=function(){function t(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=n.__assign({dataIdFromObject:xt},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 t.prototype.identify=function(e,t,r){var n=t&&r?M(e,t,r):e.__typename;if(n===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var i,o={typename:n,selectionSet:t,fragmentMap:r},a=n&&this.getTypePolicy(n),s=a&&a.keyFn||this.config.dataIdFromObject;s;){var u=s(e,o);if(!Array.isArray(u)){i=u;break}s=Tt(u)}return i=i?String(i):void 0,o.keyObject?[i,o.keyObject]:[i]},t.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach((function(r){var i=e[r],o=i.queryType,a=i.mutationType,s=i.subscriptionType,u=n.__rest(i,["queryType","mutationType","subscriptionType"]);o&&t.setRootTypename("Query",r),a&&t.setRootTypename("Mutation",r),s&&t.setRootTypename("Subscription",r),We.call(t.toBeAdded,r)?t.toBeAdded[r].push(u):t.toBeAdded[r]=[u]}))},t.prototype.updateTypePolicy=function(e,t){var r=this,n=this.getTypePolicy(e),i=t.keyFields,o=t.fields;function a(e,t){e.merge="function"==typeof t?t:!0===t?Rt:!1===t?Qt:e.merge}a(n,t.merge),n.keyFn=!1===i?Et:Array.isArray(i)?Tt(i):"function"==typeof i?i:n.keyFn,o&&Object.keys(o).forEach((function(t){var n=r.getFieldPolicy(e,t,!0),i=o[t];if("function"==typeof i)n.read=i;else{var s=i.keyArgs,u=i.read,c=i.merge;n.keyFn=!1===s?qt:Array.isArray(s)?Pt(s):"function"==typeof s?s:n.keyFn,"function"==typeof u&&(n.read=u),a(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||qt)}))},t.prototype.setRootTypename=function(t,r){void 0===r&&(r=t);var n="ROOT_"+t.toUpperCase(),i=this.rootTypenamesById[n];r!==i&&(e.invariant(!i||i===t,2),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[r]=n,this.rootTypenamesById[n]=r)},t.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(ze);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},t.prototype.getTypePolicy=function(e){var t=this;if(!We.call(this.typePolicies,e)){var r=this.typePolicies[e]=Object.create(null);r.fields=Object.create(null);var i=this.supertypeMap.get(e);i&&i.size&&i.forEach((function(e){var i=t.getTypePolicy(e),o=i.fields,a=n.__rest(i,["fields"]);Object.assign(r,a),Object.assign(r.fields,o)}))}var o=this.toBeAdded[e];return o&&o.length&&o.splice(0).forEach((function(r){t.updateTypePolicy(e,r)})),this.typePolicies[e]},t.prototype.getFieldPolicy=function(e,t,r){if(e){var n=this.getTypePolicy(e).fields;return n[t]||r&&(n[t]=Object.create(null))}},t.prototype.getSupertypeSet=function(e,t){var r=this.supertypeMap.get(e);return!r&&t&&this.supertypeMap.set(e,r=new Set),r},t.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 a=this.getSupertypeSet(t,!0),s=[a],u=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&s.indexOf(t)<0&&s.push(t)},c=!(!r||!this.fuzzySubtypes.size),l=0;l<s.length;++l){var f=s[l];if(f.has(o))return a.has(o)||a.add(o),!0;f.forEach(u),c&&l===s.length-1&&Ke(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},t.prototype.hasKeyArgs=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.keyFn)},t.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 a={typename:r,fieldName:n,field:e.field||null,variables:e.variables},s=kt(e);o;){var u=o(s,a);if(!Array.isArray(u)){t=u||n;break}o=Pt(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 x(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 x(n,r,i,t)}))),q(e.name.value,n,r)}(e.field,e.variables):q(n,kt(e))),!1===t?n:n===Ue(t)?t:n+":"+t},t.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=Ue(i),a=t.store.getFieldValue(r,i),s=this.getFieldPolicy(e.typename,o,!1),u=s&&s.read;if(u){var c=Ft(this,r,e,t,t.store.getStorage(k(r)?r.__ref:r,i));return bt.withValue(this.cache,u,[a,c])}return a}},t.prototype.getMergeFunction=function(e,t,r){var n=this.getFieldPolicy(e,t,!1),i=n&&n.merge;return!i&&r&&(i=(n=this.getTypePolicy(r))&&n.merge),i},t.prototype.runMergeFunction=function(e,t,r,n,i){var o=r.field,a=r.typename,s=r.merge;return s===Rt?Mt(n.store)(e,t):s===Qt?t:(n.overwrite&&(e=void 0),s(e,t,Ft(this,void 0,{typename:a,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null))))},t}();function Ft(e,t,r,i,o){var a=e.getStoreFieldName(r),s=Ue(a),u=r.variables||i.variables,c=i.store,l=c.toReference,f=c.canRead;return{args:kt(r),field:r.field||null,fieldName:s,storeFieldName:a,variables:u,isReference:k,toReference:l,storage:o,cache:e.cache,canRead:f,readField:function(r,o){var a;if("string"==typeof r)a={fieldName:r,from:arguments.length>1?o:t};else{if(!S(r))return;a=n.__assign({},r),We.call(r,"from")||(a.from=t)}return void 0===a.variables&&(a.variables=u),e.readField(a,i)},mergeObjects:Mt(i.store)}}function Mt(t){return function(r,i){if(Array.isArray(r)||Array.isArray(i))throw new e.InvariantError(3);if(S(r)&&S(i)){var o=t.getFieldValue(r,"__typename"),a=t.getFieldValue(i,"__typename");if(o&&a&&o!==a)return i;if(k(r)&&Je(i))return t.merge(r.__ref,i),r;if(Je(r)&&k(i))return t.merge(r,i.__ref),i;if(Je(r)&&Je(i))return n.__assign(n.__assign({},r),i)}return i}}function Pt(e){return function(t,r){return t?r.fieldName+":"+JSON.stringify(Dt(t,e,!1)):r.fieldName}}function Tt(e){var t=new u.Trie(pe);return function(r,n){var i;if(n.selectionSet&&n.fragmentMap){var o=t.lookupArray([n.selectionSet,n.fragmentMap]);i=o.aliasMap||(o.aliasMap=Ct(n.selectionSet,n.fragmentMap))}var a=n.keyObject=Dt(r,e,!0,i);return n.typename+":"+JSON.stringify(a)}}function Ct(e,t){var r=Object.create(null),n=new Set([e]);return n.forEach((function(e){e.selections.forEach((function(e){if(P(e)){if(e.alias){var i=e.alias.value,o=e.name.value;if(o!==i)(r.aliases||(r.aliases=Object.create(null)))[o]=i}if(e.selectionSet)(r.subsets||(r.subsets=Object.create(null)))[e.name.value]=Ct(e.selectionSet,t)}else{var a=w(e,t);a&&n.add(a.selectionSet)}}))})),r}function Dt(t,r,n,i){var o,a,s=Object.create(null);return r.forEach((function(r){if(Array.isArray(r)){if("string"==typeof a&&"string"==typeof o){var u=i&&i.subsets,c=u&&u[a];s[a]=Dt(t[o],r,n,c)}}else{var l=i&&i.aliases,f=l&&l[r]||r;We.call(t,f)?s[a=r]=t[o=f]:(e.invariant(!n,4),o=a=void 0)}})),s}var jt={dataIdFromObject:xt,addTypename:!0,resultCaching:!0,typePolicies:{}},At=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.watches=new Set,r.typenameDocumentCache=new Map,r.makeVar=St,r.txCount=0,r.config=n.__assign(n.__assign({},jt),t),r.addTypename=!!r.config.addTypename,r.policies=new It({cache:r,dataIdFromObject:r.config.dataIdFromObject,possibleTypes:r.config.possibleTypes,typePolicies:r.config.typePolicies}),r.init(),r}return n.__extends(t,e),t.prototype.init=function(){var e=this.data=new $e.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=e.stump,this.resetResultCache()},t.prototype.resetResultCache=function(e){var t=this,r=this.storeReader;this.storeWriter=new ht(this,this.storeReader=new pt({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canon:e?void 0:r&&r.canon})),this.maybeBroadcastWatch=a.wrap((function(e,r){return t.broadcastWatch(e,r)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var r=e.optimistic?t.optimisticData:t.data;if(it(r)){var n=e.optimistic,i=e.rootId,o=e.variables;return r.makeCacheKey(e.query,e.callback,ut({optimistic:n,rootId:i,variables:o}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach((function(e){return e.resetCaching()}))},t.prototype.restore=function(e){return this.init(),e&&this.data.replace(e),this},t.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).extract()},t.prototype.read=function(e){var t=e.returnPartialData,r=void 0!==t&&t;try{return this.storeReader.diffQueryAgainstStore(n.__assign(n.__assign({},e),{store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:r})).result||null}catch(e){if(e instanceof Be)return null;throw e}},t.prototype.write=function(e){try{return++this.txCount,this.storeWriter.writeToStore(this.data,e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.modify=function(e){if(We.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()}},t.prototype.diff=function(e){return this.storeReader.diffQueryAgainstStore(n.__assign(n.__assign({},e),{store:e.optimistic?this.optimisticData:this.data,rootId:e.id||"ROOT_QUERY",config:this.config}))},t.prototype.watch=function(e){var t,r=this;return this.watches.size||wt(t=this).vars.forEach((function(e){return e.attachCache(t)})),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){r.watches.delete(e)&&!r.watches.size&&function(e){wt(e).vars.forEach((function(t){return t.forgetCache(e)}))}(r),r.maybeBroadcastWatch.forget(e)}},t.prototype.gc=function(e){ut.reset();var t=this.optimisticData.gc();return e&&!this.txCount&&(e.resetResultCache?this.resetResultCache(e.resetResultIdentities):e.resetResultIdentities&&this.storeReader.resetCanon()),t},t.prototype.retain=function(e,t){return(t?this.optimisticData:this.data).retain(e)},t.prototype.release=function(e,t){return(t?this.optimisticData:this.data).release(e)},t.prototype.identify=function(e){return k(e)?e.__ref:this.policies.identify(e)[0]},t.prototype.evict=function(e){if(!e.id){if(We.call(e,"id"))return!1;e=n.__assign(n.__assign({},e),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.reset=function(){return this.init(),this.broadcastWatches(),ut.reset(),Promise.resolve()},t.prototype.removeOptimistic=function(e){var t=this.optimisticData.removeLayer(e);t!==this.optimisticData&&(this.optimisticData=t,this.broadcastWatches())},t.prototype.batch=function(e){var t=this,r=e.update,i=e.optimistic,o=void 0===i||i,a=e.removeOptimistic,s=e.onWatchUpdated,u=function(e){var n=t,i=n.data,o=n.optimisticData;++t.txCount,e&&(t.data=t.optimisticData=e);try{r(t)}finally{--t.txCount,t.data=i,t.optimisticData=o}},c=new Set;s&&!this.txCount&&this.broadcastWatches(n.__assign(n.__assign({},e),{onWatchUpdated:function(e){return c.add(e),!1}})),"string"==typeof o?this.optimisticData=this.optimisticData.addLayer(o,u):!1===o?u(this.data):u(),"string"==typeof a&&(this.optimisticData=this.optimisticData.removeLayer(a)),s&&c.size?(this.broadcastWatches(n.__assign(n.__assign({},e),{onWatchUpdated:function(e,t){var r=s.call(this,e,t);return!1!==r&&c.delete(e),r}})),c.size&&c.forEach((function(e){return t.maybeBroadcastWatch.dirty(e)}))):this.broadcastWatches(e)},t.prototype.performTransaction=function(e,t){return this.batch({update:e,optimistic:t||null!==t})},t.prototype.transformDocument=function(e){if(this.addTypename){var t=this.typenameDocumentCache.get(e);return t||(t=J(e),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},t.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach((function(r){return t.maybeBroadcastWatch(r,e)}))},t.prototype.broadcastWatch=function(e,t){var r=e.lastDiff,n=this.diff({query:e.query,variables:e.variables,optimistic:e.optimistic});t&&(e.optimistic&&"string"==typeof t.optimistic&&(n.fromOptimisticTransaction=!0),t.onWatchUpdated&&!1===t.onWatchUpdated.call(this,e,n,r))||r&&i.equal(r.result,n.result)||e.callback(e.lastDiff=n,r)},t}(Ve);function Nt(e){return e.hasOwnProperty("graphQLErrors")}v();var Lt,Vt=function(e){function t(r){var n,i,o=r.graphQLErrors,a=r.clientErrors,s=r.networkError,u=r.errorMessage,c=r.extraInfo,l=e.call(this,u)||this;return l.graphQLErrors=o||[],l.clientErrors=a||[],l.networkError=s||null,l.message=u||(i="",(le((n=l).graphQLErrors)||le(n.clientErrors))&&(n.graphQLErrors||[]).concat(n.clientErrors||[]).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$/,"")),l.extraInfo=c,l.__proto__=t.prototype,l}return n.__extends(t,e),t}(Error);function Bt(e){return!!e&&e<7}exports.NetworkStatus=void 0,(Lt=exports.NetworkStatus||(exports.NetworkStatus={}))[Lt.loading=1]="loading",Lt[Lt.setVariables=2]="setVariables",Lt[Lt.fetchMore=3]="fetchMore",Lt[Lt.refetch=4]="refetch",Lt[Lt.poll=6]="poll",Lt[Lt.ready=7]="ready",Lt[Lt.error=8]="error";var Wt=function(t){function r(e){var r=e.queryManager,n=e.queryInfo,i=e.options,o=t.call(this,(function(e){try{var t=e._subscription._observer;t&&!t.error&&(t.error=zt)}catch(e){}var r=!o.observers.size;o.observers.add(e);var n=o.last;return n&&n.error?e.error&&e.error(n.error):n&&n.result&&e.next&&e.next(n.result),r&&o.reobserve().catch((function(){})),function(){o.observers.delete(e)&&!o.observers.size&&o.tearDownQuery()}}))||this;o.observers=new Set,o.subscriptions=new Set,o.isTornDown=!1,o.options=i,o.queryId=n.queryId||r.generateQueryId();var a=D(i.query);return o.queryName=a&&a.name&&a.name.value,o.initialFetchPolicy=i.fetchPolicy||"cache-first",o.queryManager=r,o.queryInfo=n,o}return n.__extends(r,t),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 t=this.getLastResult(!0),r=this.queryInfo.networkStatus||t&&t.networkStatus||exports.NetworkStatus.ready,o=n.__assign(n.__assign({},t),{loading:Bt(r),networkStatus:r});if(!this.queryManager.transform(this.options.query).hasForcedResolvers){var a=this.queryInfo.getDiff();(a.complete||this.options.returnPartialData)&&(o.data=a.result),i.equal(o.data,{})&&(o.data=void 0);var s=this.options.fetchPolicy,u=void 0===s?"cache-first":s;a.complete?(o.networkStatus!==exports.NetworkStatus.loading||"cache-first"!==u&&"cache-only"!==u||(o.networkStatus=exports.NetworkStatus.ready,o.loading=!1),delete o.partial):"no-cache"!==u&&(o.partial=!0)}return e&&this.updateLastResult(o),o},r.prototype.isDifferentFromLastResult=function(e){return!this.last||!i.equal(this.last.result,e)},r.prototype.getLast=function(e,t){var r=this.last;if(r&&r[e]&&(!t||i.equal(r.variables,this.variables)))return r[e]},r.prototype.getLastResult=function(e){return this.getLast("result",e)},r.prototype.getLastError=function(e){return this.getLast("error",e)},r.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},r.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},r.prototype.refetch=function(e){var t={pollInterval:0},r=this.options.fetchPolicy;return"no-cache"===r?t.fetchPolicy="no-cache":"cache-and-network"!==r&&(t.fetchPolicy="network-only"),e&&!i.equal(this.options.variables,e)&&(t.variables=this.options.variables=n.__assign(n.__assign({},this.options.variables),e)),this.queryInfo.resetLastWrite(),this.reobserve(t,exports.NetworkStatus.refetch)},r.prototype.fetchMore=function(e){var t=this,r=n.__assign(n.__assign({},e.query?e:n.__assign(n.__assign(n.__assign({},this.options),e),{variables:n.__assign(n.__assign({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"}),i=this.queryManager.generateQueryId();return r.notifyOnNetworkStatusChange&&(this.queryInfo.networkStatus=exports.NetworkStatus.fetchMore,this.observe()),this.queryManager.fetchQuery(i,r,exports.NetworkStatus.fetchMore).then((function(n){var i=n.data,o=e.updateQuery;return o?t.updateQuery((function(e){return o(e,{fetchMoreResult:i,variables:r.variables})})):t.queryManager.cache.writeQuery({query:r.query,variables:r.variables,data:i}),n})).finally((function(){t.queryManager.stopQuery(i),t.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){return i.equal(this.variables,e)?this.observers.size?this.result():Promise.resolve():(this.options.variables=e,this.observers.size?this.reobserve({fetchPolicy:this.initialFetchPolicy,variables:e},exports.NetworkStatus.setVariables):Promise.resolve())},r.prototype.updateQuery=function(e){var t=this.queryManager,r=e(t.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,{variables:this.variables});r&&(t.cache.writeQuery({query:this.options.query,data:r,variables:this.variables}),t.broadcastQueries())},r.prototype.startPolling=function(e){this.options.pollInterval=e,this.updatePolling()},r.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},r.prototype.fetch=function(e,t){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,e,t)},r.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var r=this.pollingInfo,n=this.options.pollInterval;if(n){if(!r||r.interval!==n){e.invariant(n,12),(r||(this.pollingInfo={})).interval=n;var i=function(){t.pollingInfo&&(Bt(t.queryInfo.networkStatus)?o():t.reobserve({fetchPolicy:"network-only"},exports.NetworkStatus.poll).then(o,o))},o=function(){var e=t.pollingInfo;e&&(clearTimeout(e.timeout),e.timeout=setTimeout(i,e.interval))};o()}}else r&&(clearTimeout(r.timeout),delete this.pollingInfo)}},r.prototype.updateLastResult=function(e,t){return void 0===t&&(t=this.variables),this.last=n.__assign(n.__assign({},this.last),{result:this.queryManager.assumeImmutableResults?e:ne(e),variables:t}),le(e.errors)||delete this.last.error,this.last},r.prototype.reobserve=function(e,t){var r=this;this.isTornDown=!1;var o=t===exports.NetworkStatus.refetch||t===exports.NetworkStatus.fetchMore||t===exports.NetworkStatus.poll,a=this.options.variables,s=o?de(this.options,e):Object.assign(this.options,de(e));o||(this.updatePolling(),e&&e.variables&&!e.fetchPolicy&&!i.equal(e.variables,a)&&(s.fetchPolicy=this.initialFetchPolicy,void 0===t&&(t=exports.NetworkStatus.setVariables)));var u=s.variables&&n.__assign({},s.variables),c=this.fetch(s,t),l={next:function(e){r.reportResult(e,u)},error:function(e){r.reportError(e,u)}};return o||(this.concast&&this.observer&&this.concast.removeObserver(this.observer,!0),this.concast=c,this.observer=l),c.addObserver(l),c.promise},r.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},r.prototype.reportResult=function(e,t){(this.getLastError()||this.isDifferentFromLastResult(e))&&(this.updateLastResult(e,t),oe(this.observers,"next",e))},r.prototype.reportError=function(e,t){var r=n.__assign(n.__assign({},this.getLastResult()),{error:e,errors:e.graphQLErrors,networkStatus:exports.NetworkStatus.error,loading:!1});this.updateLastResult(r,t),oe(this.observers,"error",this.last.error=e)},r.prototype.hasObservers=function(){return this.observers.size>0},r.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},r}(o.Observable);function zt(e){}function Ut(e){var t=e.fetchPolicy,r=void 0===t?"cache-first":t,n=e.nextFetchPolicy;n&&(e.fetchPolicy="function"==typeof n?n.call(e,r):n)}se(Wt);var Kt=function(){function t(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 t.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=X(t.resolvers,e)})):this.resolvers=X(this.resolvers,e)},t.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},t.prototype.getResolvers=function(){return this.resolvers||{}},t.prototype.runResolvers=function(e){var t=e.document,r=e.remoteResult,i=e.context,o=e.variables,a=e.onlyRunForcedResolvers,s=void 0!==a&&a;return n.__awaiter(this,void 0,void 0,(function(){return n.__generator(this,(function(e){return t?[2,this.resolveDocument(t,r.data,i,o,this.fragmentMatcher,s).then((function(e){return n.__assign(n.__assign({},r),{data:e.result})}))]:[2,r]}))}))},t.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(e){return m(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return function(e){C(e);var t=K([{test:function(e){return"client"===e.name.value},remove:!0}],e);return t&&(t=r.visit(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return P(e)&&"__typename"===e.name.value})))return null}}})),t}(e)},t.prototype.prepareContext=function(e){var t=this.cache;return n.__assign(n.__assign({},e),{cache:t,getCacheKey:function(e){return t.identify(e)}})},t.prototype.addExportedVariables=function(e,t,r){return void 0===t&&(t={}),void 0===r&&(r={}),n.__awaiter(this,void 0,void 0,(function(){return n.__generator(this,(function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(r),t).then((function(e){return n.__assign(n.__assign({},t),e.exportedVariables)}))]:[2,n.__assign({},t)]}))}))},t.prototype.shouldForceResolvers=function(e){var t=!1;return r.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 r.BREAK}}}),t},t.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:G(e),variables:t,returnPartialData:!0,optimistic:!1}).result},t.prototype.resolveDocument=function(e,t,r,i,o,a){return void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o=function(){return!0}),void 0===a&&(a=!1),n.__awaiter(this,void 0,void 0,(function(){var s,u,c,l,f,p,h,d,v;return n.__generator(this,(function(y){return s=N(e),u=A(e),c=_(u),l=s.operation,f=l?l.charAt(0).toUpperCase()+l.slice(1):"Query",h=(p=this).cache,d=p.client,v={fragmentMap:c,context:n.__assign(n.__assign({},r),{cache:h,client:d}),variables:i,fragmentMatcher:o,defaultOperationType:f,exportedVariables:{},onlyRunForcedResolvers:a},[2,this.resolveSelectionSet(s.selectionSet,t,v).then((function(e){return{result:e,exportedVariables:v.exportedVariables}}))]}))}))},t.prototype.resolveSelectionSet=function(t,r,i){return n.__awaiter(this,void 0,void 0,(function(){var o,a,s,u,c,l=this;return n.__generator(this,(function(f){return o=i.fragmentMap,a=i.context,s=i.variables,u=[r],c=function(t){return n.__awaiter(l,void 0,void 0,(function(){var c,l;return n.__generator(this,(function(n){return y(t,s)?P(t)?[2,this.resolveField(t,r,i).then((function(e){var r;void 0!==e&&u.push(((r={})[F(t)]=e,r))}))]:(T(t)?c=t:(c=o[t.name.value],e.invariant(c,11)),c&&c.typeCondition&&(l=c.typeCondition.name.value,i.fragmentMatcher(r,l,a))?[2,this.resolveSelectionSet(c.selectionSet,r,i).then((function(e){u.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(t.selections.map(c)).then((function(){return Z(u)}))]}))}))},t.prototype.resolveField=function(e,t,r){return n.__awaiter(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,f,p,h=this;return n.__generator(this,(function(n){return i=r.variables,o=e.name.value,a=F(e),s=o!==a,u=t[a]||t[o],c=Promise.resolve(u),r.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(l=t.__typename||r.defaultOperationType,(f=this.resolvers&&this.resolvers[l])&&(p=f[s?o:a])&&(c=Promise.resolve(bt.withValue(this.cache,p,[t,I(e,i),r.context,{field:e,fragmentMap:r.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&&(r.exportedVariables[e.value.value]=t)}))})),e.selectionSet?null==t?t:Array.isArray(t)?h.resolveSubSelectedArray(e,t,r):e.selectionSet?h.resolveSelectionSet(e.selectionSet,t,r):void 0:t}))]}))}))},t.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})))},t}(),Jt=new(pe?WeakMap:Map);function Ht(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return Jt.set(e,(Jt.get(e)+1)%1e15),r.apply(this,arguments)})}function Yt(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var Gt=function(){function e(e,t){void 0===t&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var r=this.cache=e.cache;Jt.has(r)||(Jt.set(r,0),Ht(r,"evict"),Ht(r,"modify"),Ht(r,"reset"))}return e.prototype.init=function(e){var t=e.networkStatus||exports.NetworkStatus.loading;return this.variables&&this.networkStatus!==exports.NetworkStatus.loading&&!i.equal(this.variables,e.variables)&&(t=exports.NetworkStatus.setVariables),i.equal(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},e.prototype.reset=function(){Yt(this),this.lastDiff=void 0,this.dirty=!1},e.prototype.getDiff=function(e){void 0===e&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&i.equal(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var r=this.observableQuery;if(r&&"no-cache"===r.options.fetchPolicy)return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},e.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},e.prototype.getDiffOptions=function(e){void 0===e&&(e=this.variables);var t=this.observableQuery;return{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:!t||!1!==t.options.canonizeResults}},e.prototype.setDiff=function(e){var t=this,r=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),this.dirty||i.equal(r&&r.result,e&&e.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;Yt(this),this.shouldNotify()&&this.listeners.forEach((function(t){return t(e)})),this.dirty=!1},e.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Bt(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if("cache-only"!==e&&"cache-and-network"!==e)return!1}return!0},e.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=e.prototype.cancel,this.subscriptions.forEach((function(e){return e.unsubscribe()}));var t=this.observableQuery;t&&t.stopPolling()}},e.prototype.cancel=function(){},e.prototype.updateWatch=function(e){var t=this;void 0===e&&(e=this.variables);var r=this.observableQuery;if(!r||"no-cache"!==r.options.fetchPolicy){var o=n.__assign(n.__assign({},this.getDiffOptions(e)),{watcher:this,callback:function(e){return t.setDiff(e)}});this.lastWatch&&i.equal(o,this.lastWatch)||(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=o))}},e.prototype.resetLastWrite=function(){this.lastWrite=void 0},e.prototype.shouldWrite=function(e,t){var r=this.lastWrite;return!(r&&r.dmCount===Jt.get(this.cache)&&i.equal(t,r.variables)&&i.equal(e.data,r.result.data))},e.prototype.markResult=function(e,t,r){var n=this;this.graphQLErrors=le(e.errors)?e.errors:[],this.reset(),"no-cache"===t.fetchPolicy?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(t.variables)):0!==r&&($t(e,t.errorPolicy)?this.cache.performTransaction((function(i){if(n.shouldWrite(e,t.variables))i.writeQuery({query:n.document,data:e.data,variables:t.variables,overwrite:1===r}),n.lastWrite={result:e,variables:t.variables,dmCount:Jt.get(n.cache)};else if(n.lastDiff&&n.lastDiff.diff.complete)return void(e.data=n.lastDiff.diff.result);var o=n.getDiffOptions(t.variables),a=i.diff(o);n.stopped||n.updateWatch(t.variables),n.updateLastDiff(a,o),a.complete&&(e.data=a.result)})):this.lastWrite=void 0)},e.prototype.markReady=function(){return this.networkError=null,this.networkStatus=exports.NetworkStatus.ready},e.prototype.markError=function(e){return this.networkStatus=exports.NetworkStatus.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}();function $t(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!fe(e);return!n&&r&&e.data&&(n=!0),n}var Xt=Object.prototype.hasOwnProperty,Zt=function(){function t(e){var t=e.cache,r=e.link,n=e.queryDeduplication,i=void 0!==n&&n,o=e.onBroadcast,a=e.ssrMode,s=void 0!==a&&a,u=e.clientAwareness,c=void 0===u?{}:u,l=e.localState,f=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(pe?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=r,this.queryDeduplication=i,this.clientAwareness=c,this.localState=l||new Kt({cache:t}),this.ssrMode=s,this.assumeImmutableResults=!!f,(this.onBroadcast=o)&&(this.mutationStore=Object.create(null))}return t.prototype.stop=function(){var t=this;this.queries.forEach((function(e,r){t.stopQueryNoBroadcast(r)})),this.cancelPendingFetches(new e.InvariantError(13))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach((function(t){return t(e)})),this.fetchCancelFns.clear()},t.prototype.mutate=function(t){var r=t.mutation,i=t.variables,o=t.optimisticResponse,a=t.updateQueries,s=t.refetchQueries,u=void 0===s?[]:s,c=t.awaitRefetchQueries,l=void 0!==c&&c,f=t.update,p=t.onQueryUpdated,h=t.errorPolicy,d=void 0===h?"none":h,v=t.fetchPolicy,y=void 0===v?"network-only":v,m=t.keepRootFields,g=t.context;return n.__awaiter(this,void 0,void 0,(function(){var t,s,c;return n.__generator(this,(function(h){switch(h.label){case 0:return e.invariant(r,14),e.invariant("network-only"===y||"no-cache"===y,15),t=this.generateMutationId(),r=this.transform(r).document,i=this.getVariables(r,i),this.transform(r).hasClientExports?[4,this.localState.addExportedVariables(r,i,g)]:[3,2];case 1:i=h.sent(),h.label=2;case 2:return s=this.mutationStore&&(this.mutationStore[t]={mutation:r,variables:i,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:t,document:r,variables:i,fetchPolicy:y,errorPolicy:d,context:g,updateQueries:a,update:f,keepRootFields:m}),this.broadcastQueries(),c=this,[2,new Promise((function(e,h){return ae(c.getObservableFromLink(r,n.__assign(n.__assign({},g),{optimisticResponse:o}),i,!1),(function(e){if(fe(e)&&"none"===d)throw new Vt({graphQLErrors:e.errors});s&&(s.loading=!1,s.error=null);var h=n.__assign({},e);return"function"==typeof u&&(u=u(h)),"ignore"===d&&fe(h)&&delete h.errors,c.markMutationResult({mutationId:t,result:h,document:r,variables:i,fetchPolicy:y,errorPolicy:d,context:g,update:f,updateQueries:a,awaitRefetchQueries:l,refetchQueries:u,removeOptimistic:o?t:void 0,onQueryUpdated:p,keepRootFields:m})})).subscribe({next:function(t){c.broadcastQueries(),e(t)},error:function(e){s&&(s.loading=!1,s.error=e),o&&c.cache.removeOptimistic(t),c.broadcastQueries(),h(e instanceof Vt?e:new Vt({networkError:e}))}})}))]}}))}))},t.prototype.markMutationResult=function(e,t){var r=this;void 0===t&&(t=this.cache);var i=e.result,o=[],a="no-cache"===e.fetchPolicy;if(!a&&$t(i,e.errorPolicy)){o.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables});var s=e.updateQueries;s&&this.queries.forEach((function(e,n){var a=e.observableQuery,u=a&&a.queryName;if(u&&Xt.call(s,u)){var c=s[u],l=r.queries.get(n),f=l.document,p=l.variables,h=t.diff({query:f,variables:p,returnPartialData:!0,optimistic:!1}),d=h.result;if(h.complete&&d){var v=c(d,{mutationResult:i,queryName:f&&j(f)||void 0,queryVariables:p});v&&o.push({result:v,dataId:"ROOT_QUERY",query:f,variables:p})}}}))}if(o.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var u=[];if(this.refetchQueries({updateCache:function(t){a||o.forEach((function(e){return t.write(e)}));var s=e.update;if(s){if(!a){var u=t.diff({id:"ROOT_MUTATION",query:r.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});u.complete&&(i=n.__assign(n.__assign({},i),{data:u.result}))}s(t,i,{context:e.context,variables:e.variables})}a||e.keepRootFields||t.modify({id:"ROOT_MUTATION",fields:function(e,t){var r=t.fieldName,n=t.DELETE;return"__typename"===r?e:n}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach((function(e){return u.push(e)})),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(u).then((function(){return i}))}return Promise.resolve(i)},t.prototype.markMutationOptimistic=function(e,t){var r=this,i="function"==typeof e?e(t.variables):e;return this.cache.recordOptimisticTransaction((function(e){try{r.markMutationResult(n.__assign(n.__assign({},t),{result:{data:i}}),e)}catch(e){}}),t.mutationId)},t.prototype.fetchQuery=function(e,t,r){return this.fetchQueryObservable(e,t,r).promise},t.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},t.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},t.prototype.transform=function(e){var t,r=this.transformCache;if(!r.has(e)){var i=this.cache.transformDocument(e),o=(t=this.cache.transformForLink(i),K([H],C(t))),a=this.localState.clientQuery(i),s=o&&this.localState.serverQuery(o),u={document:i,hasClientExports:g(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:s,defaultVars:L(D(i)),asQuery:n.__assign(n.__assign({},i),{definitions:i.definitions.map((function(e){return"OperationDefinition"===e.kind&&"query"!==e.operation?n.__assign(n.__assign({},e),{operation:"query"}):e}))})},c=function(e){e&&!r.has(e)&&r.set(e,u)};c(e),c(i),c(a),c(s)}return r.get(e)},t.prototype.getVariables=function(e,t){return n.__assign(n.__assign({},this.transform(e).defaultVars),t)},t.prototype.watchQuery=function(e){void 0===(e=n.__assign(n.__assign({},e),{variables:this.getVariables(e.query,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var t=new Gt(this),r=new Wt({queryManager:this,queryInfo:t,options:e});return this.queries.set(r.queryId,t),t.init({document:e.query,observableQuery:r,variables:e.variables}),r},t.prototype.query=function(t,r){var n=this;return void 0===r&&(r=this.generateQueryId()),e.invariant(t.query,16),e.invariant("Document"===t.query.kind,17),e.invariant(!t.returnPartialData,18),e.invariant(!t.pollInterval,19),this.fetchQuery(r,t).finally((function(){return n.stopQuery(r)}))},t.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},t.prototype.generateRequestId=function(){return this.requestIdCounter++},t.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},t.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},t.prototype.clearStore=function(){return this.cancelPendingFetches(new e.InvariantError(20)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=exports.NetworkStatus.loading:e.stop()})),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset()},t.prototype.resetStore=function(){var e=this;return this.clearStore().then((function(){return e.reFetchObservableQueries()}))},t.prototype.getObservableQueries=function(t){var r=this;void 0===t&&(t="active");var i=new Map,o=new Map,a=new Set;return Array.isArray(t)&&t.forEach((function(e){var t;"string"==typeof e?o.set(e,!1):S(t=e)&&"Document"===t.kind&&Array.isArray(t.definitions)?o.set(r.transform(e).document,!1):S(e)&&e.query&&a.add(e)})),this.queries.forEach((function(e,r){var n=e.observableQuery,a=e.document;if(n){if("all"===t)return void i.set(r,n);var s=n.queryName;if("standby"===n.options.fetchPolicy||!n.hasObservers())return;("active"===t||s&&o.has(s)||a&&o.has(a))&&(i.set(r,n),s&&o.set(s,!0),a&&o.set(a,!0))}})),a.size&&a.forEach((function(t){var o=ye("legacyOneTimeQuery"),a=r.getQuery(o).init({document:t.query,variables:t.variables}),s=new Wt({queryManager:r,queryInfo:a,options:n.__assign(n.__assign({},t),{fetchPolicy:"network-only"})});e.invariant(s.queryId===o),a.setObservableQuery(s),i.set(o,s)})),i},t.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var r=[];return this.getObservableQueries(e?"all":"active").forEach((function(n,i){var o=n.options.fetchPolicy;n.resetLastResults(),(e||"standby"!==o&&"cache-only"!==o)&&r.push(n.refetch()),t.getQuery(i).setDiff(null)})),this.broadcastQueries(),Promise.all(r)},t.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},t.prototype.startGraphQLSubscription=function(e){var t=this,r=e.query,n=e.fetchPolicy,i=e.errorPolicy,a=e.variables,s=e.context,u=void 0===s?{}:s;r=this.transform(r).document,a=this.getVariables(r,a);var c=function(e){return t.getObservableFromLink(r,u,e).map((function(o){if("no-cache"!==n&&($t(o,i)&&t.cache.write({query:r,result:o.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries()),fe(o))throw new Vt({graphQLErrors:o.errors});return o}))};if(this.transform(r).hasClientExports){var l=this.localState.addExportedVariables(r,a,u).then(c);return new o.Observable((function(e){var t=null;return l.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return c(a)},t.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},t.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.getQuery(e).stop(),this.queries.delete(e)},t.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},t.prototype.getLocalState=function(){return this.localState},t.prototype.getObservableFromLink=function(e,t,r,i){var a,s,u=this;void 0===i&&(i=null!==(a=null==t?void 0:t.queryDeduplication)&&void 0!==a?a:this.queryDeduplication);var c=this.transform(e).serverQuery;if(c){var l=this.inFlightLinkObservables,f=this.link,p={query:c,variables:r,operationName:j(c)||void 0,context:this.prepareContext(n.__assign(n.__assign({},t),{forceFetch:!i}))};if(t=p.context,i){var h=l.get(c)||new Map;l.set(c,h);var d=ut(r);if(!(s=h.get(d))){var v=new ce([qe(f,p)]);h.set(d,s=v),v.cleanup((function(){h.delete(d)&&h.size<1&&l.delete(c)}))}}else s=new ce([qe(f,p)])}else s=new ce([o.Observable.of({data:{}})]),t=this.prepareContext(t);var y=this.transform(e).clientQuery;return y&&(s=ae(s,(function(e){return u.localState.runResolvers({document:y,remoteResult:e,context:t,variables:r})}))),s},t.prototype.getResultsFromLink=function(e,t,r){var n=e.lastRequestId=this.generateRequestId();return ae(this.getObservableFromLink(e.document,r.context,r.variables),(function(i){var o=le(i.errors);if(n>=e.lastRequestId){if(o&&"none"===r.errorPolicy)throw e.markError(new Vt({graphQLErrors:i.errors}));e.markResult(i,r,t),e.markReady()}var a={data:i.data,loading:!1,networkStatus:e.networkStatus||exports.NetworkStatus.ready};return o&&"ignore"!==r.errorPolicy&&(a.errors=i.errors),a}),(function(t){var r=Nt(t)?t:new Vt({networkError:t});throw n>=e.lastRequestId&&e.markError(r),r}))},t.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),a=this.getQuery(e),s=t.fetchPolicy,u=void 0===s?"cache-first":s,c=t.errorPolicy,l=void 0===c?"none":c,f=t.returnPartialData,p=void 0!==f&&f,h=t.notifyOnNetworkStatusChange,d=void 0!==h&&h,v=t.context,y=void 0===v?{}:v,m=Object.assign({},t,{query:i,variables:o,fetchPolicy:u,errorPolicy:l,returnPartialData:p,notifyOnNetworkStatusChange:d,context:y}),g=function(e){return m.variables=e,n.fetchQueryByPolicy(a,m,r)};this.fetchCancelFns.set(e,(function(e){setTimeout((function(){return b.cancel(e)}))}));var b=new ce(this.transform(m.query).hasClientExports?this.localState.addExportedVariables(m.query,m.variables,m.context).then(g):g(m.variables));return b.cleanup((function(){n.fetchCancelFns.delete(e),Ut(t)})),b},t.prototype.refetchQueries=function(e){var t=this,r=e.updateCache,n=e.include,i=e.optimistic,o=void 0!==i&&i,a=e.removeOptimistic,s=void 0===a?o?ye("refetchQueries"):void 0:a,u=e.onQueryUpdated,c=new Map;n&&this.getObservableQueries(n).forEach((function(e,r){c.set(r,{oq:e,lastDiff:t.getQuery(r).getDiff()})}));var l=new Map;return r&&this.cache.batch({update:r,optimistic:o&&s||!1,removeOptimistic:s,onWatchUpdated:function(e,t,r){var n=e.watcher instanceof Gt&&e.watcher.observableQuery;if(n){if(u){c.delete(n.queryId);var i=u(n,t,r);return!0===i&&(i=n.refetch()),!1!==i&&l.set(n,i),!1}null!==u&&c.set(n.queryId,{oq:n,lastDiff:r,diff:t})}}}),c.size&&c.forEach((function(e,r){var n,i=e.oq,o=e.lastDiff,a=e.diff;if(u){if(!a){var s=i.queryInfo;s.reset(),a=s.getDiff()}n=u(i,a,o)}u&&!0!==n||(n=i.refetch()),!1!==n&&l.set(i,n),r.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(r)})),s&&this.cache.removeOptimistic(s),l},t.prototype.fetchQueryByPolicy=function(e,t,r){var i=this,a=t.query,s=t.variables,u=t.fetchPolicy,c=t.refetchWritePolicy,l=t.errorPolicy,f=t.returnPartialData,p=t.context,h=t.notifyOnNetworkStatusChange,d=e.networkStatus;e.init({document:a,variables:s,networkStatus:r});var v=function(){return e.getDiff(s)},y=function(t,r){void 0===r&&(r=e.networkStatus||exports.NetworkStatus.loading);var u=t.result;var c=function(e){return o.Observable.of(n.__assign({data:e,loading:Bt(r),networkStatus:r},t.complete?null:{partial:!0}))};return u&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:u},context:p,variables:s,onlyRunForcedResolvers:!0}).then((function(e){return c(e.data||void 0)})):c(u)},m="no-cache"===u?0:r===exports.NetworkStatus.refetch&&"merge"!==c?1:2,g=function(){return i.getResultsFromLink(e,m,{variables:s,context:p,fetchPolicy:u,errorPolicy:l})},b=h&&"number"==typeof d&&d!==r&&Bt(r);switch(u){default:case"cache-first":return(_=v()).complete?[y(_,e.markReady())]:f||b?[y(_),g()]:[g()];case"cache-and-network":var _;return(_=v()).complete||f||b?[y(_),g()]:[g()];case"cache-only":return[y(v(),e.markReady())];case"network-only":return b?[y(v()),g()]:[g()];case"no-cache":return b?[y(e.getDiff()),g()]:[g()];case"standby":return[]}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Gt(this,e)),this.queries.get(e)},t.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return n.__assign(n.__assign({},t),{clientAwareness:this.clientAwareness})},t}();function er(e,t){return de(e,t,t.variables&&{variables:n.__assign(n.__assign({},e.variables),t.variables)})}var tr=function(){function t(t){var r=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=t.uri,i=t.credentials,o=t.headers,a=t.cache,s=t.ssrMode,u=void 0!==s&&s,c=t.ssrForceFetchDelay,l=void 0===c?0:c,f=t.connectToDevTools,p=void 0===f?"object"==typeof window&&!window.__APOLLO_CLIENT__&&!1:f,h=t.queryDeduplication,d=void 0===h||h,v=t.defaultOptions,y=t.assumeImmutableResults,m=void 0!==y&&y,g=t.resolvers,b=t.typeDefs,_=t.fragmentMatcher,w=t.name,S=t.version,O=t.link;if(O||(O=n?new Le({uri:n,credentials:i,headers:o}):Se.empty()),!a)throw new e.InvariantError(9);this.link=O,this.cache=a,this.disableNetworkFetches=u||l>0,this.queryDeduplication=d,this.defaultOptions=v||{},this.typeDefs=b,l&&setTimeout((function(){return r.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),p&&"object"==typeof window&&(window.__APOLLO_CLIENT__=this),this.version="3.4.9",this.localState=new Kt({cache:a,client:this,resolvers:g,fragmentMatcher:_}),this.queryManager=new Zt({cache:this.cache,link:this.link,queryDeduplication:d,ssrMode:u,clientAwareness:{name:w,version:S},localState:this.localState,assumeImmutableResults:m,onBroadcast:p?function(){r.devToolsHookCb&&r.devToolsHookCb({action:{},state:{queries:r.queryManager.getQueryStore(),mutations:r.queryManager.mutationStore||{}},dataWithOptimisticResults:r.cache.extract(!0)})}:void 0})}return t.prototype.stop=function(){this.queryManager.stop()},t.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=er(this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=n.__assign(n.__assign({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},t.prototype.query=function(t){return this.defaultOptions.query&&(t=er(this.defaultOptions.query,t)),e.invariant("cache-and-network"!==t.fetchPolicy,10),this.disableNetworkFetches&&"network-only"===t.fetchPolicy&&(t=n.__assign(n.__assign({},t),{fetchPolicy:"cache-first"})),this.queryManager.query(t)},t.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=er(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},t.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},t.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},t.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},t.prototype.writeQuery=function(e){this.cache.writeQuery(e),this.queryManager.broadcastQueries()},t.prototype.writeFragment=function(e){this.cache.writeFragment(e),this.queryManager.broadcastQueries()},t.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},t.prototype.__requestRaw=function(e){return qe(this.link,e)},t.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()}))},t.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()})))}))},t.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},t.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},t.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},t.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),r=[],n=[];t.forEach((function(e,t){r.push(t),n.push(e)}));var i=Promise.all(n);return i.queries=r,i.results=n,i.catch((function(e){})),i},t.prototype.getObservableQueries=function(e){return void 0===e&&(e="active"),this.queryManager.getObservableQueries(e)},t.prototype.extract=function(e){return this.cache.extract(e)},t.prototype.restore=function(e){return this.cache.restore(e)},t.prototype.addResolvers=function(e){this.localState.addResolvers(e)},t.prototype.setResolvers=function(e){this.localState.setResolvers(e)},t.prototype.getResolvers=function(){return this.localState.getResolvers()},t.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},t.prototype.setLink=function(e){this.link=this.queryManager.link=e},t}();v(),e.setVerbosity(d?"log":"silent"),exports.setLogVerbosity=e.setVerbosity,exports.Observable=o.Observable,exports.disableExperimentalFragmentVariables=c.disableExperimentalFragmentVariables,exports.disableFragmentWarnings=c.disableFragmentWarnings,exports.enableExperimentalFragmentVariables=c.enableExperimentalFragmentVariables,exports.gql=c.gql,exports.resetCaches=c.resetCaches,exports.ApolloCache=Ve,exports.ApolloClient=tr,exports.ApolloError=Vt,exports.ApolloLink=Se,exports.HttpLink=Le,exports.InMemoryCache=At,exports.MissingFieldError=Be,exports.ObservableQuery=Wt,exports.applyNextFetchPolicy=Ut,exports.checkFetcher=Te,exports.concat=Ee,exports.createHttpLink=Ne,exports.createSignalIfSupported=Ce,exports.defaultDataIdFromObject=xt,exports.empty=Oe,exports.execute=qe,exports.fallbackHttpConfig=Fe,exports.from=ke,exports.fromError=me,exports.fromPromise=function(e){return new o.Observable((function(t){e.then((function(e){t.next(e),t.complete()})).catch(t.error.bind(t))}))},exports.isApolloError=Nt,exports.isReference=k,exports.makeReference=O,exports.makeVar=St,exports.mergeOptions=er,exports.parseAndCheckHttpResponse=Qe,exports.rewriteURIForGET=je,exports.selectHttpOptionsAndBody=Me,exports.selectURI=De,exports.serializeFetchParameter=Ie,exports.split=xe,exports.throwServerError=ge,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})}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("ts-invariant"),t=require("ts-invariant/process"),r=require("graphql"),n=require("tslib"),i=require("@wry/equality"),o=require("zen-observable-ts");require("symbol-observable");var a=require("optimism"),s=require("@wry/context"),u=require("@wry/trie"),c=require("graphql-tag");function l(e){try{return e()}catch(e){}}var f=l((function(){return globalThis}))||l((function(){return window}))||l((function(){return self}))||l((function(){return global}))||l((function(){return Function("return this")()})),p="__",h=[p,p].join("DEV");var d=function(){try{return Boolean(!1)}catch(e){return Object.defineProperty(f,h,{value:"production"!==l((function(){return process.env.NODE_ENV})),enumerable:!1,configurable:!0,writable:!0}),f[h]}}();function v(t,r){var n=t.directives;return!n||!n.length||function(t){var r=[];t&&t.length&&t.forEach((function(t){if(function(e){var t=e.name.value;return"skip"===t||"include"===t}(t)){var n=t.arguments;t.name.value;e.invariant(n&&1===n.length,40);var i=n[0];e.invariant(i.name&&"if"===i.name.value,41);var o=i.value;e.invariant(o&&("Variable"===o.kind||"BooleanValue"===o.kind),42),r.push({directive:t,ifArgument:i})}}));return r}(n).every((function(t){var n=t.directive,i=t.ifArgument,o=!1;return"Variable"===i.value.kind?(o=r&&r[i.value.name.value],e.invariant(void 0!==o,39)):o=i.value.value,"skip"===n.name.value?!o:o}))}function y(e,t){return function(e){var t=[];return r.visit(e,{Directive:function(e){t.push(e.name.value)}}),t}(t).some((function(t){return e.indexOf(t)>-1}))}function m(e){return e&&y(["client"],e)&&y(["export"],e)}function g(t,r){var i=r,o=[];return t.definitions.forEach((function(t){if("OperationDefinition"===t.kind)throw new e.InvariantError(43);"FragmentDefinition"===t.kind&&o.push(t)})),void 0===i&&(e.invariant(1===o.length,44),i=o[0].name.value),n.__assign(n.__assign({},t),{definitions:n.__spreadArray([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}],t.definitions)})}function b(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function _(t,r){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":var n=r&&r[t.name.value];return e.invariant(n,45),n;default:return null}}function w(e){return null!==e&&"object"==typeof e}function S(e){return{__ref:String(e)}}function O(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function k(t,r,n,i){if(function(e){return"IntValue"===e.kind}(n)||function(e){return"FloatValue"===e.kind}(n))t[r.value]=Number(n.value);else if(function(e){return"BooleanValue"===e.kind}(n)||function(e){return"StringValue"===e.kind}(n))t[r.value]=n.value;else if(function(e){return"ObjectValue"===e.kind}(n)){var o={};n.fields.map((function(e){return k(o,e.name,e.value,i)})),t[r.value]=o}else if(function(e){return"Variable"===e.kind}(n)){var a=(i||{})[n.name.value];t[r.value]=a}else if(function(e){return"ListValue"===e.kind}(n))t[r.value]=n.values.map((function(e){var t={};return k(t,r,e,i),t[r.value]}));else if(function(e){return"EnumValue"===e.kind}(n))t[r.value]=n.value;else{if(!function(e){return"NullValue"===e.kind}(n))throw new e.InvariantError(54);t[r.value]=null}}r.isType(null),t.remove();var x=["connection","include","skip","client","rest","export"],E=Object.assign((function(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 i={};return n.forEach((function(e){i[e]=t[e]})),r.connection.key+"("+q(i)+")"}return r.connection.key}var o=e;if(t){var a=q(t);o+="("+a+")"}return r&&Object.keys(r).forEach((function(e){-1===x.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?o+="@"+e+"("+q(r[e])+")":o+="@"+e)})),o}),{setStringify:function(e){var t=q;return q=e,t}}),q=function(e){return JSON.stringify(e,R)};function R(e,t){return w(t)&&!Array.isArray(t)&&(t=Object.keys(t).sort().reduce((function(e,r){return e[r]=t[r],e}),{})),t}function Q(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return k(r,n,i,t)})),r}return null}function I(e){return e.alias?e.alias.value:e.name.value}function F(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(M(o)){if("__typename"===o.name.value)return e[I(o)]}else{var a=F(e,_(o,r).selectionSet,r);if("string"==typeof a)return a}}}function M(e){return"Field"===e.kind}function P(e){return"InlineFragment"===e.kind}function T(t){e.invariant(t&&"Document"===t.kind,46);var r=t.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(t){if("OperationDefinition"!==t.kind)throw new e.InvariantError(47);return t}));return e.invariant(r.length<=1,48),t}function C(e){return T(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function D(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||null}function j(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function A(t){var r=C(t);return e.invariant(r&&"query"===r.operation,49),r}function N(t){var r;T(t);for(var n=0,i=t.definitions;n<i.length;n++){var o=i[n];if("OperationDefinition"===o.kind){var a=o.operation;if("query"===a||"mutation"===a||"subscription"===a)return o}"FragmentDefinition"!==o.kind||r||(r=o)}if(r)return r;throw new e.InvariantError(53)}function L(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&k(t,e.variable.name,e.defaultValue)})),t}function V(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 B={kind:"Field",name:{kind:"Name",value:"__typename"}};function W(e,t){return e.selectionSet.selections.every((function(e){return"FragmentSpread"===e.kind&&W(t[e.name.value],t)}))}function z(t){return W(C(t)||function(t){e.invariant("Document"===t.kind,50),e.invariant(t.definitions.length<=1,51);var r=t.definitions[0];return e.invariant("FragmentDefinition"===r.kind,52),r}(t),b(j(t)))?null:t}function U(e){return function(t){return e.some((function(e){return e.name&&e.name===t.name.value||e.test&&e.test(t)}))}}function K(e,t){var i=Object.create(null),o=[],a=Object.create(null),s=[],u=z(r.visit(t,{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(U(e))))return t.arguments&&t.arguments.forEach((function(e){"Variable"===e.value.kind&&o.push({name:e.value.name.value})})),t.selectionSet&&Y(t.selectionSet).forEach((function(e){s.push({name:e.name.value})})),null}},FragmentSpread:{enter:function(e){a[e.name.value]=!0}},Directive:{enter:function(t){if(U(e)(t))return null}}}));return u&&V(o,(function(e){return!!e.name&&!i[e.name]})).length&&(u=function(e,t){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 z(r.visit(t,{OperationDefinition:{enter:function(t){return n.__assign(n.__assign({},t),{variableDefinitions:t.variableDefinitions?t.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&&V(s,(function(e){return!!e.name&&!a[e.name]})).length&&(u=function(e,t){function n(t){if(e.some((function(e){return e.name===t.name.value})))return null}return z(r.visit(t,{FragmentSpread:{enter:n},FragmentDefinition:{enter:n}}))}(s,u)),u}var J=Object.assign((function(e){return r.visit(T(e),{SelectionSet:{enter:function(e,t,r){if(!r||"OperationDefinition"!==r.kind){var i=e.selections;if(i)if(!i.some((function(e){return M(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var o=r;if(!(M(o)&&o.directives&&o.directives.some((function(e){return"export"===e.name.value}))))return n.__assign(n.__assign({},e),{selections:n.__spreadArray(n.__spreadArray([],i),[B])})}}}}})}),{added:function(e){return e===B}}),H={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 Y(e){var t=[];return e.selections.forEach((function(e){(M(e)||P(e))&&e.selectionSet?Y(e.selectionSet).forEach((function(e){return t.push(e)})):"FragmentSpread"===e.kind&&t.push(e)})),t}function G(e){return"query"===N(e).operation?e:r.visit(e,{OperationDefinition:{enter:function(e){return n.__assign(n.__assign({},e),{operation:"query"})}}})}var $=Object.prototype.hasOwnProperty;function X(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Z(e)}function Z(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new te,i=1;i<r;++i)t=n.merge(t,e[i]);return t}var ee=function(e,t,r){return this.merge(e[r],t[r])},te=function(){function e(e){void 0===e&&(e=ee),this.reconciler=e,this.isObject=w,this.pastCopies=new Set}return e.prototype.merge=function(e,t){for(var r=this,i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];return w(t)&&w(e)?(Object.keys(t).forEach((function(o){if($.call(e,o)){var a=e[o];if(t[o]!==a){var s=r.reconciler.apply(r,n.__spreadArray([e,t,o],i));s!==a&&((e=r.shallowCopyForMerge(e))[o]=s)}}else(e=r.shallowCopyForMerge(e))[o]=t[o]})),e):t},e.prototype.shallowCopyForMerge=function(e){return w(e)&&!this.pastCopies.has(e)&&(e=Array.isArray(e)?e.slice(0):n.__assign({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e)),e},e}(),re=Object.prototype.toString;function ne(e){return ie(e)}function ie(e,t){switch(re.call(e)){case"[object Array]":if((t=t||new Map).has(e))return t.get(e);var r=e.slice(0);return t.set(e,r),r.forEach((function(e,n){r[n]=ie(e,t)})),r;case"[object Object]":if((t=t||new Map).has(e))return t.get(e);var n=Object.create(Object.getPrototypeOf(e));return t.set(e,n),Object.keys(e).forEach((function(r){n[r]=ie(e[r],t)})),n;default:return e}}function oe(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function ae(e,t,r){return new o.Observable((function(n){var i=n.next,o=n.error,a=n.complete,s=0,u=!1,c={then:function(e){return new Promise((function(t){return t(e())}))}};function l(e,t){return e?function(t){++s;var r=function(){return e(t)};c=c.then(r,r).then((function(e){--s,i&&i.call(n,e),u&&f.complete()}),(function(e){throw--s,e})).catch((function(e){o&&o.call(n,e)}))}:function(e){return t&&t.call(n,e)}}var f={next:l(t,i),error:l(r,o),complete:function(){u=!0,s||a&&a.call(n)}},p=e.subscribe(f);return function(){return p.unsubscribe()}}))}function se(e){function t(t){Object.defineProperty(e,t,{value:o.Observable})}return"function"==typeof Symbol&&Symbol.species&&t(Symbol.species),t("@@species"),e}function ue(e){return e&&"function"==typeof e.then}var ce=function(e){function t(t){var r=e.call(this,(function(e){return r.addObserver(e),function(){return r.removeObserver(e)}}))||this;return r.observers=new Set,r.addCount=0,r.promise=new Promise((function(e,t){r.resolve=e,r.reject=t})),r.handlers={next:function(e){null!==r.sub&&(r.latest=["next",e],oe(r.observers,"next",e))},error:function(e){var t=r.sub;null!==t&&(t&&setTimeout((function(){return t.unsubscribe()})),r.sub=null,r.latest=["error",e],r.reject(e),oe(r.observers,"error",e))},complete:function(){if(null!==r.sub){var e=r.sources.shift();e?ue(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(),oe(r.observers,"complete"))}}},r.cancel=function(e){r.reject(e),r.sources=[],r.handlers.complete()},r.promise.catch((function(e){})),"function"==typeof t&&(t=[new o.Observable(t)]),ue(t)?t.then((function(e){return r.start(e)}),r.handlers.error):r.start(t),r}return n.__extends(t,e),t.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},t.prototype.deliverLastMessage=function(e){if(this.latest){var t=this.latest[0],r=e[t];r&&r.call(e,this.latest[1]),null===this.sub&&"next"===t&&e.complete&&e.complete()}},t.prototype.addObserver=function(e){this.observers.has(e)||(this.deliverLastMessage(e),this.observers.add(e),++this.addCount)},t.prototype.removeObserver=function(e,t){this.observers.delete(e)&&--this.addCount<1&&!t&&this.handlers.error(new Error("Observable cancelled prematurely"))},t.prototype.cleanup=function(e){var t=this,r=!1,n=function(){r||(r=!0,t.observers.delete(i),e())},i={next:n,error:n,complete:n},o=this.addCount;this.addObserver(i),this.addCount=o},t}(o.Observable);function le(e){return Array.isArray(e)&&e.length>0}function fe(e){return e.errors&&e.errors.length>0||!1}se(ce);var pe="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product),he="function"==typeof WeakSet;function de(){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}var ve=new Map;function ye(e){var t=ve.get(e)||1;return ve.set(e,t+1),e+":"+t+":"+Math.random().toString(36).slice(2)}function me(e){return new o.Observable((function(t){t.error(e)}))}var ge=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 be(e,t){return t?t(e):o.Observable.of()}function _e(e){return"function"==typeof e?new Se(e):e}function we(e){return e.request.length<=1}!function(e){function t(t,r){var n=e.call(this,t)||this;return n.link=r,n}n.__extends(t,e)}(Error);var Se=function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t((function(){return o.Observable.of()}))},t.from=function(e){return 0===e.length?t.empty():e.map(_e).reduce((function(e,t){return e.concat(t)}))},t.split=function(e,r,n){var i=_e(r),a=_e(n||new t(be));return we(i)&&we(a)?new t((function(t){return e(t)?i.request(t)||o.Observable.of():a.request(t)||o.Observable.of()})):new t((function(t,r){return e(t)?i.request(t,r)||o.Observable.of():a.request(t,r)||o.Observable.of()}))},t.execute=function(t,r){return t.request(function(e,t){var r=n.__assign({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){r="function"==typeof e?n.__assign(n.__assign({},r),e(r)):n.__assign(n.__assign({},r),e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return n.__assign({},r)}}),t}(r.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?D(t.query)||void 0:""),t}(function(t){for(var r=["query","operationName","variables","extensions","context"],n=0,i=Object.keys(t);n<i.length;n++){var o=i[n];if(r.indexOf(o)<0)throw new e.InvariantError(26)}return t}(r))))||o.Observable.of()},t.concat=function(e,r){var n=_e(e);if(we(n))return n;var i=_e(r);return we(i)?new t((function(e){return n.request(e,(function(e){return i.request(e)||o.Observable.of()}))||o.Observable.of()})):new t((function(e,t){return n.request(e,(function(e){return i.request(e,t)||o.Observable.of()}))||o.Observable.of()}))},t.prototype.split=function(e,r,n){return this.concat(t.split(e,r,n||new t(be)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(t,r){throw new e.InvariantError(21)},t.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},t.prototype.setOnError=function(e){return this.onError=e,this},t}(),Oe=Se.empty,ke=Se.from,xe=Se.split,Ee=Se.concat,qe=Se.execute,Re=Object.prototype.hasOwnProperty;function Qe(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&&ge(t,r,"Response not successful: Received status code "+t.status),Array.isArray(r)||Re.call(r,"data")||Re.call(r,"errors")||ge(t,r,"Server response was missing for query '"+(Array.isArray(e)?e.map((function(e){return e.operationName})):e.operationName)+"'."),r}))}}var Ie=function(t,r){var n;try{n=JSON.stringify(t)}catch(t){var i=new e.InvariantError(23);throw i.parseError=t,i}return n},Fe={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},Me=function(e,t){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];var a=n.__assign(n.__assign({},t.options),{headers:t.headers,credentials:t.credentials}),s=t.http||{};i.forEach((function(e){a=n.__assign(n.__assign(n.__assign({},a),e.options),{headers:n.__assign(n.__assign({},a.headers),Pe(e.headers))}),e.credentials&&(a.credentials=e.credentials),s=n.__assign(n.__assign({},s),e.http)}));var u=e.operationName,c=e.extensions,l=e.variables,f=e.query,p={operationName:u,variables:l};return s.includeExtensions&&(p.extensions=c),s.includeQuery&&(p.query=r.print(f)),{options:a,body:p}};function Pe(e){if(e){var t=Object.create(null);return Object.keys(Object(e)).forEach((function(r){t[r.toLowerCase()]=e[r]})),t}return e}var Te=function(t){if(!t&&"undefined"==typeof fetch)throw new e.InvariantError(22)},Ce=function(){if("undefined"==typeof AbortController)return{controller:!1,signal:!1};var e=new AbortController;return{controller:e,signal:e.signal}},De=function(e,t){var r=e.getContext().uri;return r||("function"==typeof t?t(e):t||"/graphql")};function je(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=Ie(t.variables)}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=Ie(t.extensions)}catch(e){return{parseError:e}}n("extensions",o)}var a="",s=e,u=e.indexOf("#");-1!==u&&(a=e.substr(u),s=e.substr(0,u));var c=-1===s.indexOf("?")?"?":"&";return{newURI:s+c+r.join("&")+a}}var Ae=l((function(){return fetch})),Ne=function(e){void 0===e&&(e={});var t=e.uri,i=void 0===t?"/graphql":t,a=e.fetch,s=e.includeExtensions,u=e.useGETForQueries,c=e.includeUnusedVariables,f=void 0!==c&&c,p=n.__rest(e,["uri","fetch","includeExtensions","useGETForQueries","includeUnusedVariables"]);var h={http:{includeExtensions:s},options:p.fetchOptions,credentials:p.credentials,headers:p.headers};return new Se((function(e){var t=De(e,i),s=e.getContext(),c={};if(s.clientAwareness){var p=s.clientAwareness,d=p.name,v=p.version;d&&(c["apollographql-client-name"]=d),v&&(c["apollographql-client-version"]=v)}var y,m=n.__assign(n.__assign({},c),s.headers),g={http:s.http,options:s.fetchOptions,credentials:s.credentials,headers:m},b=Me(e,Fe,h,g),_=b.options,w=b.body;if(w.variables&&!f){var S=new Set(Object.keys(w.variables));r.visit(e.query,{Variable:function(e,t,r){r&&"VariableDefinition"!==r.kind&&S.delete(e.name.value)}}),S.size&&(w.variables=n.__assign({},w.variables),S.forEach((function(e){delete w.variables[e]})))}if(!_.signal){var O=Ce(),k=O.controller,x=O.signal;(y=k)&&(_.signal=x)}if(u&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(_.method="GET"),"GET"===_.method){var E=je(t,w),q=E.newURI,R=E.parseError;if(R)return me(R);t=q}else try{_.body=Ie(w)}catch(R){return me(R)}return new o.Observable((function(r){return(a||l((function(){return fetch}))||Ae)(t,_).then((function(t){return e.setContext({response:t}),t})).then(Qe(e)).then((function(e){return r.next(e),r.complete(),e})).catch((function(e){"AbortError"!==e.name&&(e.result&&e.result.errors&&e.result.data&&r.next(e.result),r.error(e))})),function(){y&&y.abort()}}))}))},Le=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,Ne(t).request)||this;return r.options=t,r}return n.__extends(t,e),t}(Se),Ve=function(){function e(){this.getFragmentDoc=a.wrap(g)}return e.prototype.batch=function(e){var t="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;this.performTransaction(e.update,t)},e.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},e.prototype.transformDocument=function(e){return e},e.prototype.identify=function(e){},e.prototype.gc=function(){return[]},e.prototype.modify=function(e){return!1},e.prototype.transformForLink=function(e){return e},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(n.__assign(n.__assign({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(n.__assign(n.__assign({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},e.prototype.writeQuery=function(e){var t=e.id,r=e.data,i=n.__rest(e,["id","data"]);return this.write(Object.assign(i,{dataId:t||"ROOT_QUERY",result:r}))},e.prototype.writeFragment=function(e){var t=e.id,r=e.data,i=e.fragment,o=e.fragmentName,a=n.__rest(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(a,{query:this.getFragmentDoc(i,o),dataId:t,result:r}))},e}();exports.Cache=void 0,exports.Cache||(exports.Cache={});var Be=function(e){function t(r,n,i,o){var a=e.call(this,r)||this;return a.message=r,a.path=n,a.query=i,a.variables=o,a.__proto__=t.prototype,a}return n.__extends(t,e),t}(Error),We=Object.prototype.hasOwnProperty;var ze=/^[_a-z][_0-9a-z]*/i;function Ue(e){var t=e.match(ze);return t?t[0]:e}function Ke(e,t,r){return!!w(t)&&(Array.isArray(t)?t.every((function(t){return Ke(e,t,r)})):e.selections.every((function(e){if(M(e)&&v(e,r)){var n=I(e);return We.call(t,n)&&(!e.selectionSet||Ke(e.selectionSet,t[n],r))}return!0})))}function Je(e){return w(e)&&!O(e)&&!Array.isArray(e)}var He=Object.create(null),Ye=function(){return He},Ge=Object.create(null),$e=function(){function t(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 O(e)?r.get(e.__ref,t):e&&e[t]},this.canRead=function(e){return O(e)?r.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return S(e);if(O(e))return e;var n=r.policies.identify(e)[0];if(n){var i=S(n);return t&&r.merge(n,e),i}}}return t.prototype.toObject=function(){return n.__assign({},this.data)},t.prototype.has=function(e){return void 0!==this.lookup(e,!0)},t.prototype.get=function(e,t){if(this.group.depend(e,t),We.call(this.data,e)){var r=this.data[e];if(r&&We.call(r,t))return r[t]}return"__typename"===t&&We.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof tt?this.parent.get(e,t):void 0},t.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),We.call(this.data,e)?this.data[e]:this instanceof tt?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},t.prototype.merge=function(t,r){var n,i=this;O(t)&&(t=t.__ref),O(r)&&(r=r.__ref);var o="string"==typeof t?this.lookup(n=t):t,a="string"==typeof r?this.lookup(n=r):r;if(a){e.invariant("string"==typeof n,1);var s=new te(nt).merge(o,a);if(this.data[n]=s,s!==o&&(delete this.refs[n],this.group.caching)){var u=Object.create(null);o||(u.__exists=1),Object.keys(a).forEach((function(e){if(!o||o[e]!==s[e]){u[e]=1;var t=Ue(e);t===e||i.policies.hasKeyArgs(s.__typename,t)||(u[t]=1),void 0!==s[e]||i instanceof tt||delete s[e]}})),!u.__typename||o&&o.__typename||this.policies.rootTypenamesById[n]!==s.__typename||delete u.__typename,Object.keys(u).forEach((function(e){return i.group.dirty(n,e)}))}}},t.prototype.modify=function(e,t){var r=this,i=this.lookup(e);if(i){var o=Object.create(null),a=!1,s=!0,u={DELETE:He,INVALIDATE:Ge,isReference:O,toReference:this.toReference,canRead:this.canRead,readField:function(t,n){return r.policies.readField("string"==typeof t?{fieldName:t,from:n||S(e)}:t,{store:r})}};if(Object.keys(i).forEach((function(c){var l=Ue(c),f=i[c];if(void 0!==f){var p="function"==typeof t?t:t[c]||t[l];if(p){var h=p===Ye?He:p(f,n.__assign(n.__assign({},u),{fieldName:l,storeFieldName:c,storage:r.getStorage(e,c)}));h===Ge?r.group.dirty(e,c):(h===He&&(h=void 0),h!==f&&(o[c]=h,a=!0,f=h))}void 0!==f&&(s=!1)}})),a)return this.merge(e,o),s&&(this instanceof tt?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},t.prototype.delete=function(e,t,r){var n,i=this.lookup(e);if(i){var o=this.getFieldValue(i,"__typename"),a=t&&r?this.policies.getStoreFieldName({typename:o,fieldName:t,args:r}):t;return this.modify(e,a?((n={})[a]=Ye,n):Ye)}return!1},t.prototype.evict=function(e){var t=!1;return e.id&&(We.call(this.data,e.id)&&(t=this.delete(e.id,e.fieldName,e.args)),this instanceof tt&&(t=this.parent.evict(e)||t),(e.fieldName||t)&&this.group.dirty(e.id,e.fieldName||"__exists")),t},t.prototype.clear=function(){this.replace(null)},t.prototype.extract=function(){var e=this,t=this.toObject(),r=[];return this.getRootIdSet().forEach((function(t){We.call(e.policies.rootTypenamesById,t)||r.push(t)})),r.length&&(t.__META={extraRootIds:r.sort()}),t},t.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach((function(r){e&&We.call(e,r)||t.delete(r)})),e){var r=e.__META,i=n.__rest(e,["__META"]);Object.keys(i).forEach((function(e){t.merge(e,i[e])})),r&&r.extraRootIds.forEach(this.retain,this)}},t.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},t.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},t.prototype.getRootIdSet=function(e){return void 0===e&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof tt?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},t.prototype.gc=function(){var e=this,t=this.getRootIdSet(),r=this.toObject();t.forEach((function(n){We.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 tt;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},t.prototype.findChildRefIds=function(e){if(!We.call(this.refs,e)){var t=this.refs[e]=Object.create(null),r=this.data[e];if(!r)return t;var n=new Set([r]);n.forEach((function(e){O(e)&&(t[e.__ref]=!0),w(e)&&Object.keys(e).forEach((function(t){var r=e[t];w(r)&&n.add(r)}))}))}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}(),Xe=function(){function e(e,t){void 0===t&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return e.prototype.resetCaching=function(){this.d=this.caching?a.dep():null,this.keyMaker=new u.Trie(pe)},e.prototype.depend=function(e,t){if(this.d){this.d(Ze(e,t));var r=Ue(t);r!==t&&this.d(Ze(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(Ze(e,t),"__exists"===t?"forget":"setDirty")},e}();function Ze(e,t){return t+"#"+e}function et(e,t){it(e)&&e.group.depend(t,"__exists")}!function(e){var t=function(e){function t(t){var r=t.policies,n=t.resultCaching,i=void 0===n||n,o=t.seed,a=e.call(this,r,new Xe(i))||this;return a.stump=new rt(a),a.storageTrie=new u.Trie(pe),o&&a.replace(o),a}return n.__extends(t,e),t.prototype.addLayer=function(e,t){return this.stump.addLayer(e,t)},t.prototype.removeLayer=function(){return this},t.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},t}(e);e.Root=t}($e||($e={}));var tt=function(e){function t(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 n.__extends(t,e),t.prototype.addLayer=function(e,r){return new t(e,this,r,this.group)},t.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){var n=t.data[e],o=r.lookup(e);o?n?n!==o&&Object.keys(n).forEach((function(r){i.equal(n[r],o[r])||t.group.dirty(e,r)})):(t.group.dirty(e,"__exists"),Object.keys(o).forEach((function(r){t.group.dirty(e,r)}))):t.delete(e)})),r):r===this.parent?this:r.addLayer(this.id,this.replay)},t.prototype.toObject=function(){return n.__assign(n.__assign({},this.parent.toObject()),this.data)},t.prototype.findChildRefIds=function(t){var r=this.parent.findChildRefIds(t);return We.call(this.data,t)?n.__assign(n.__assign({},r),e.prototype.findChildRefIds.call(this,t)):r},t.prototype.getStorage=function(){for(var e=this.parent;e.parent;)e=e.parent;return e.getStorage.apply(e,arguments)},t}($e),rt=function(e){function t(t){return e.call(this,"EntityStore.Stump",t,(function(){}),new Xe(t.group.caching,t.group))||this}return n.__extends(t,e),t.prototype.removeLayer=function(){return this},t.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},t}(tt);function nt(e,t,r){var n=e[r],o=t[r];return i.equal(n,o)?n:o}function it(e){return!!(e instanceof $e&&e.group.caching)}var ot,at,st=function(){function e(){this.known=new(he?WeakSet:Set),this.pool=new u.Trie(pe),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return e.prototype.isKnown=function(e){return w(e)&&this.known.has(e)},e.prototype.pass=function(e){if(w(e)){var t=function(e){return w(e)?Array.isArray(e)?e.slice(0):n.__assign({__proto__:Object.getPrototypeOf(e)},e):e}(e);return this.passes.set(t,e),t}return e},e.prototype.admit=function(e){var t=this;if(w(e)){var r=this.passes.get(e);if(r)return r;switch(Object.getPrototypeOf(e)){case Array.prototype:if(this.known.has(e))return e;var n=e.map(this.admit,this);return(s=this.pool.lookupArray(n)).array||this.known.add(s.array=n),s.array;case null:case Object.prototype:if(this.known.has(e))return e;var i=Object.getPrototypeOf(e),o=[i],a=this.sortedKeys(e);o.push(a.json);var s,u=o.length;if(a.sorted.forEach((function(r){o.push(t.admit(e[r]))})),!(s=this.pool.lookupArray(o)).object){var c=s.object=Object.create(i);this.known.add(c),a.sorted.forEach((function(e,t){c[e]=o[u+t]}))}return s.object}}return e},e.prototype.sortedKeys=function(e){var t=Object.keys(e),r=this.pool.lookupArray(t);if(!r.keys){t.sort();var n=JSON.stringify(t);(r.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,r.keys={sorted:t,json:n})}return r.keys},e}(),ut=Object.assign((function(e){if(w(e)){void 0===ot&&ct();var t=ot.admit(e),r=at.get(t);return void 0===r&&at.set(t,r=JSON.stringify(t)),r}return JSON.stringify(e)}),{reset:ct});function ct(){ot=new st,at=new(pe?WeakMap:Map)}function lt(e,t){return new Be(e.message,t.path.slice(),t.query,t.variables)}function ft(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var pt=function(){function t(e){var t=this;this.knownResults=new(pe?WeakMap:Map),this.config=n.__assign(n.__assign({},e),{addTypename:!1!==e.addTypename}),this.canon=e.canon||new st,this.executeSelectionSet=a.wrap((function(e){var r,i=e.context.canonizeResults,o=ft(e);o[3]=!i;var a=(r=t.executeSelectionSet).peek.apply(r,o);return a?i?n.__assign(n.__assign({},a),{result:t.canon.admit(a.result)}):a:(et(e.context.store,e.enclosingRef.__ref),t.execSelectionSetImpl(e))}),{max:this.config.resultCacheMaxSize,keyArgs:ft,makeCacheKey:function(e,t,r,n){if(it(r.store))return r.store.makeCacheKey(e,O(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=a.wrap((function(e){return et(e.context.store,e.enclosingRef.__ref),t.execSubSelectedArrayImpl(e)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var t=e.field,r=e.array,n=e.context;if(it(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return t.prototype.resetCanon=function(){this.canon=new st},t.prototype.diffQueryAgainstStore=function(e){var t=e.store,r=e.query,i=e.rootId,o=void 0===i?"ROOT_QUERY":i,a=e.variables,s=e.returnPartialData,u=void 0===s||s,c=e.canonizeResults,l=void 0===c||c,f=this.config.cache.policies;a=n.__assign(n.__assign({},L(A(r))),a);var p=S(o),h=this.executeSelectionSet({selectionSet:N(r).selectionSet,objectOrReference:p,enclosingRef:p,context:{store:t,query:r,policies:f,variables:a,varString:ut(a),canonizeResults:l,fragmentMap:b(j(r)),path:[]}}),d=h.missing&&h.missing.length>0;if(d&&!u)throw h.missing[0];return{result:h.result,missing:h.missing,complete:!d}},t.prototype.isFresh=function(e,t,r,n){if(it(n.store)&&this.knownResults.get(e)===r){var i=this.executeSelectionSet.peek(r,t,n,this.canon.isKnown(e));if(i&&e===i.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(t){var r=this,n=t.selectionSet,i=t.objectOrReference,o=t.enclosingRef,a=t.context;if(O(i)&&!a.policies.rootTypenamesById[i.__ref]&&!a.store.has(i.__ref))return{result:this.canon.empty,missing:[lt(new e.InvariantError(5),a)]};var s=a.variables,u=a.policies,c=a.store,l=[],f={result:null},p=c.getFieldValue(i,"__typename");function h(){return f.missing||(f.missing=[])}function d(e){var t;return e.missing&&(t=h()).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);y.forEach((function(t){var n;if(v(t,s))if(M(t)){var c=u.readField({fieldName:t.name.value,field:t,variables:a.variables,from:i},a),f=I(t);a.path.push(f),void 0===c?J.added(t)||h().push(lt(new e.InvariantError(6),a)):Array.isArray(c)?c=d(r.executeSubSelectedArray({field:t,array:c,enclosingRef:o,context:a})):t.selectionSet?null!=c&&(c=d(r.executeSelectionSet({selectionSet:t.selectionSet,objectOrReference:c,enclosingRef:O(c)?c:o,context:a}))):a.canonizeResults&&(c=r.canon.pass(c)),void 0!==c&&l.push(((n={})[f]=c,n)),e.invariant(a.path.pop()===f)}else{var m=_(t,a.fragmentMap);m&&u.fragmentMatches(m,p)&&m.selectionSet.selections.forEach(y.add,y)}}));var m=Z(l);return f.result=a.canonizeResults?this.canon.admit(m):m,this.knownResults.set(f.result,n),f},t.prototype.execSubSelectedArrayImpl=function(t){var r,n=this,i=t.field,o=t.array,a=t.enclosingRef,s=t.context;function u(t,n){return t.missing&&(r=r||[]).push.apply(r,t.missing),e.invariant(s.path.pop()===n),t.result}return i.selectionSet&&(o=o.filter(s.store.canRead)),o=o.map((function(t,r){return null===t?null:(s.path.push(r),Array.isArray(t)?u(n.executeSubSelectedArray({field:i,array:t,enclosingRef:a,context:s}),r):i.selectionSet?u(n.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:t,enclosingRef:O(t)?t:a,context:s}),r):(e.invariant(s.path.pop()===r),t))})),{result:s.canonizeResults?this.canon.admit(o):o,missing:r}},t}();var ht=function(){function t(e,t){this.cache=e,this.reader=t}return t.prototype.writeToStore=function(t,r){var i=this,o=r.query,a=r.result,s=r.dataId,u=r.variables,c=r.overwrite,l=C(o),f=new te;u=n.__assign(n.__assign({},L(l)),u);var p={store:t,written:Object.create(null),merge:function(e,t){return f.merge(e,t)},variables:u,varString:ut(u),fragmentMap:b(j(o)),overwrite:!!c,incomingById:new Map,clientOnly:!1},h=this.processSelectionSet({result:a||Object.create(null),dataId:s,selectionSet:l.selectionSet,mergeTree:{map:new Map},context:p});if(!O(h))throw new e.InvariantError(8);return p.incomingById.forEach((function(e,r){var n=e.fields,o=e.mergeTree,a=(e.selections,S(r));if(o&&o.map.size){var s=i.applyMerges(o,a,n,p);if(O(s))return;n=s}t.merge(r,n)})),t.retain(h.__ref),h},t.prototype.processSelectionSet=function(e){var t=this,r=e.dataId,n=e.result,i=e.selectionSet,o=e.context,a=e.mergeTree,s=this.cache.policies,u=s.identify(n,i,o.fragmentMap),c=u[0],l=u[1];if("string"==typeof(r=r||c)){var f=o.written[r]||(o.written[r]=[]),p=S(r);if(f.indexOf(i)>=0)return p;if(f.push(i),this.reader&&this.reader.isFresh(n,p,i,o))return p}var h=Object.create(null);l&&(h=o.merge(h,l));var d=r&&s.rootTypenamesById[r]||F(n,i,o.fragmentMap)||r&&o.store.get(r,"__typename");"string"==typeof d&&(h.__typename=d);var y=new Set(i.selections);if(y.forEach((function(e){var r;if(v(e,o.variables))if(M(e)){var i=I(e),u=n[i],c=o.clientOnly;if(o.clientOnly=c||!(!e.directives||!e.directives.some((function(e){return"client"===e.name.value}))),void 0!==u){var l=s.getStoreFieldName({typename:d,fieldName:e.name.value,field:e,variables:o.variables}),f=vt(a,l),p=t.processFieldValue(u,e,o,f),m=void 0;if(e.selectionSet&&!(m=o.store.getFieldValue(p,"__typename"))&&O(p)){var g=o.incomingById.get(p.__ref);m=g&&g.fields.__typename}var b=s.getMergeFunction(d,e.name.value,m);b?f.info={field:e,typename:d,merge:b}:gt(a,l),h=o.merge(h,((r={})[l]=p,r))}else!o.clientOnly&&J.added(e);o.clientOnly=c}else{var w=_(e,o.fragmentMap);w&&s.fragmentMatches(w,d,n,o.variables)&&w.selectionSet.selections.forEach(y.add,y)}})),"string"==typeof r){var m=o.incomingById.get(r);return m?(m.fields=o.merge(m.fields,h),m.mergeTree=yt(m.mergeTree,a),m.selections.forEach(y.add,y),m.selections=y):o.incomingById.set(r,{fields:h,mergeTree:mt(a)?void 0:a,selections:y}),S(r)}return h},t.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?Array.isArray(e)?e.map((function(e,o){var a=i.processFieldValue(e,t,r,vt(n,o));return gt(n,o),a})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):e},t.prototype.applyMerges=function(t,r,i,o,a){var s,u=this;if(t.map.size&&!O(i)){var c,l=Array.isArray(i)||!O(r)&&!Je(r)?void 0:r,f=i;l&&!a&&(a=[O(l)?l.__ref:l]);var p=function(e,t){return Array.isArray(e)?"number"==typeof t?e[t]:void 0:o.store.getFieldValue(e,String(t))};t.map.forEach((function(t,r){var n=p(l,r),i=p(f,r);if(void 0!==i){a&&a.push(r);var s=u.applyMerges(t,n,i,o,a);s!==i&&(c=c||new Map).set(r,s),a&&e.invariant(a.pop()===r)}})),c&&(i=Array.isArray(f)?f.slice(0):n.__assign({},f),c.forEach((function(e,t){i[t]=e})))}return t.info?this.cache.policies.runMergeFunction(r,i,t.info,o,a&&(s=o.store).getStorage.apply(s,a)):i},t}(),dt=[];function vt(e,t){var r=e.map;return r.has(t)||r.set(t,dt.pop()||{map:new Map}),r.get(t)}function yt(e,t){if(e===t||!t||mt(t))return e;if(!e||mt(e))return t;var r=e.info&&t.info?n.__assign(n.__assign({},e.info),t.info):e.info||t.info,i=e.map.size&&t.map.size,o={info:r,map:i?new Map:e.map.size?e.map:t.map};if(i){var a=new Set(t.map.keys());e.map.forEach((function(e,r){o.map.set(r,yt(e,t.map.get(r))),a.delete(r)})),a.forEach((function(r){o.map.set(r,yt(t.map.get(r),e.map.get(r)))}))}return o}function mt(e){return!e||!(e.info||e.map.size)}function gt(e,t){var r=e.map,n=r.get(t);n&&mt(n)&&(dt.push(n),r.delete(t))}new Set;var bt=new s.Slot,_t=new WeakMap;function wt(e){var t=_t.get(e);return t||_t.set(e,t={vars:new Set,dep:a.dep()}),t}function St(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0){if(e!==o){e=o,t.forEach((function(e){wt(e).dep.dirty(n),Ot(e)}));var a=Array.from(r);r.clear(),a.forEach((function(t){return t(e)}))}}else{var s=bt.getValue();s&&(i(s),wt(s).dep(n))}return e};n.onNextChange=function(e){return r.add(e),function(){r.delete(e)}};var i=n.attachCache=function(e){return t.add(e),wt(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}function Ot(e){e.broadcastWatches&&e.broadcastWatches()}function kt(e){return void 0!==e.args?e.args:e.field?Q(e.field,e.variables):null}E.setStringify(ut);var xt=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))},Et=function(){},qt=function(e,t){return t.fieldName},Rt=function(e,t,r){return(0,r.mergeObjects)(e,t)},Qt=function(e,t){return t},It=function(){function t(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=n.__assign({dataIdFromObject:xt},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 t.prototype.identify=function(e,t,r){var n=t&&r?F(e,t,r):e.__typename;if(n===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var i,o={typename:n,selectionSet:t,fragmentMap:r},a=n&&this.getTypePolicy(n),s=a&&a.keyFn||this.config.dataIdFromObject;s;){var u=s(e,o);if(!Array.isArray(u)){i=u;break}s=Tt(u)}return i=i?String(i):void 0,o.keyObject?[i,o.keyObject]:[i]},t.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach((function(r){var i=e[r],o=i.queryType,a=i.mutationType,s=i.subscriptionType,u=n.__rest(i,["queryType","mutationType","subscriptionType"]);o&&t.setRootTypename("Query",r),a&&t.setRootTypename("Mutation",r),s&&t.setRootTypename("Subscription",r),We.call(t.toBeAdded,r)?t.toBeAdded[r].push(u):t.toBeAdded[r]=[u]}))},t.prototype.updateTypePolicy=function(e,t){var r=this,n=this.getTypePolicy(e),i=t.keyFields,o=t.fields;function a(e,t){e.merge="function"==typeof t?t:!0===t?Rt:!1===t?Qt:e.merge}a(n,t.merge),n.keyFn=!1===i?Et:Array.isArray(i)?Tt(i):"function"==typeof i?i:n.keyFn,o&&Object.keys(o).forEach((function(t){var n=r.getFieldPolicy(e,t,!0),i=o[t];if("function"==typeof i)n.read=i;else{var s=i.keyArgs,u=i.read,c=i.merge;n.keyFn=!1===s?qt:Array.isArray(s)?Pt(s):"function"==typeof s?s:n.keyFn,"function"==typeof u&&(n.read=u),a(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||qt)}))},t.prototype.setRootTypename=function(t,r){void 0===r&&(r=t);var n="ROOT_"+t.toUpperCase(),i=this.rootTypenamesById[n];r!==i&&(e.invariant(!i||i===t,2),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[r]=n,this.rootTypenamesById[n]=r)},t.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(ze);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},t.prototype.getTypePolicy=function(e){var t=this;if(!We.call(this.typePolicies,e)){var r=this.typePolicies[e]=Object.create(null);r.fields=Object.create(null);var i=this.supertypeMap.get(e);i&&i.size&&i.forEach((function(e){var i=t.getTypePolicy(e),o=i.fields,a=n.__rest(i,["fields"]);Object.assign(r,a),Object.assign(r.fields,o)}))}var o=this.toBeAdded[e];return o&&o.length&&o.splice(0).forEach((function(r){t.updateTypePolicy(e,r)})),this.typePolicies[e]},t.prototype.getFieldPolicy=function(e,t,r){if(e){var n=this.getTypePolicy(e).fields;return n[t]||r&&(n[t]=Object.create(null))}},t.prototype.getSupertypeSet=function(e,t){var r=this.supertypeMap.get(e);return!r&&t&&this.supertypeMap.set(e,r=new Set),r},t.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 a=this.getSupertypeSet(t,!0),s=[a],u=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&s.indexOf(t)<0&&s.push(t)},c=!(!r||!this.fuzzySubtypes.size),l=0;l<s.length;++l){var f=s[l];if(f.has(o))return a.has(o)||a.add(o),!0;f.forEach(u),c&&l===s.length-1&&Ke(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},t.prototype.hasKeyArgs=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.keyFn)},t.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 a={typename:r,fieldName:n,field:e.field||null,variables:e.variables},s=kt(e);o;){var u=o(s,a);if(!Array.isArray(u)){t=u||n;break}o=Pt(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 k(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 k(n,r,i,t)}))),E(e.name.value,n,r)}(e.field,e.variables):E(n,kt(e))),!1===t?n:n===Ue(t)?t:n+":"+t},t.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=Ue(i),a=t.store.getFieldValue(r,i),s=this.getFieldPolicy(e.typename,o,!1),u=s&&s.read;if(u){var c=Ft(this,r,e,t,t.store.getStorage(O(r)?r.__ref:r,i));return bt.withValue(this.cache,u,[a,c])}return a}},t.prototype.getMergeFunction=function(e,t,r){var n=this.getFieldPolicy(e,t,!1),i=n&&n.merge;return!i&&r&&(i=(n=this.getTypePolicy(r))&&n.merge),i},t.prototype.runMergeFunction=function(e,t,r,n,i){var o=r.field,a=r.typename,s=r.merge;return s===Rt?Mt(n.store)(e,t):s===Qt?t:(n.overwrite&&(e=void 0),s(e,t,Ft(this,void 0,{typename:a,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null))))},t}();function Ft(e,t,r,i,o){var a=e.getStoreFieldName(r),s=Ue(a),u=r.variables||i.variables,c=i.store,l=c.toReference,f=c.canRead;return{args:kt(r),field:r.field||null,fieldName:s,storeFieldName:a,variables:u,isReference:O,toReference:l,storage:o,cache:e.cache,canRead:f,readField:function(r,o){var a;if("string"==typeof r)a={fieldName:r,from:arguments.length>1?o:t};else{if(!w(r))return;a=n.__assign({},r),We.call(r,"from")||(a.from=t)}return void 0===a.variables&&(a.variables=u),e.readField(a,i)},mergeObjects:Mt(i.store)}}function Mt(t){return function(r,i){if(Array.isArray(r)||Array.isArray(i))throw new e.InvariantError(3);if(w(r)&&w(i)){var o=t.getFieldValue(r,"__typename"),a=t.getFieldValue(i,"__typename");if(o&&a&&o!==a)return i;if(O(r)&&Je(i))return t.merge(r.__ref,i),r;if(Je(r)&&O(i))return t.merge(r,i.__ref),i;if(Je(r)&&Je(i))return n.__assign(n.__assign({},r),i)}return i}}function Pt(e){return function(t,r){return t?r.fieldName+":"+JSON.stringify(Dt(t,e,!1)):r.fieldName}}function Tt(e){var t=new u.Trie(pe);return function(r,n){var i;if(n.selectionSet&&n.fragmentMap){var o=t.lookupArray([n.selectionSet,n.fragmentMap]);i=o.aliasMap||(o.aliasMap=Ct(n.selectionSet,n.fragmentMap))}var a=n.keyObject=Dt(r,e,!0,i);return n.typename+":"+JSON.stringify(a)}}function Ct(e,t){var r=Object.create(null),n=new Set([e]);return n.forEach((function(e){e.selections.forEach((function(e){if(M(e)){if(e.alias){var i=e.alias.value,o=e.name.value;if(o!==i)(r.aliases||(r.aliases=Object.create(null)))[o]=i}if(e.selectionSet)(r.subsets||(r.subsets=Object.create(null)))[e.name.value]=Ct(e.selectionSet,t)}else{var a=_(e,t);a&&n.add(a.selectionSet)}}))})),r}function Dt(t,r,n,i){var o,a,s=Object.create(null);return r.forEach((function(r){if(Array.isArray(r)){if("string"==typeof a&&"string"==typeof o){var u=i&&i.subsets,c=u&&u[a];s[a]=Dt(t[o],r,n,c)}}else{var l=i&&i.aliases,f=l&&l[r]||r;We.call(t,f)?s[a=r]=t[o=f]:(e.invariant(!n,4),o=a=void 0)}})),s}var jt={dataIdFromObject:xt,addTypename:!0,resultCaching:!0,typePolicies:{}},At=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.watches=new Set,r.typenameDocumentCache=new Map,r.makeVar=St,r.txCount=0,r.config=n.__assign(n.__assign({},jt),t),r.addTypename=!!r.config.addTypename,r.policies=new It({cache:r,dataIdFromObject:r.config.dataIdFromObject,possibleTypes:r.config.possibleTypes,typePolicies:r.config.typePolicies}),r.init(),r}return n.__extends(t,e),t.prototype.init=function(){var e=this.data=new $e.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=e.stump,this.resetResultCache()},t.prototype.resetResultCache=function(e){var t=this,r=this.storeReader;this.storeWriter=new ht(this,this.storeReader=new pt({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canon:e?void 0:r&&r.canon})),this.maybeBroadcastWatch=a.wrap((function(e,r){return t.broadcastWatch(e,r)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var r=e.optimistic?t.optimisticData:t.data;if(it(r)){var n=e.optimistic,i=e.rootId,o=e.variables;return r.makeCacheKey(e.query,e.callback,ut({optimistic:n,rootId:i,variables:o}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach((function(e){return e.resetCaching()}))},t.prototype.restore=function(e){return this.init(),e&&this.data.replace(e),this},t.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).extract()},t.prototype.read=function(e){var t=e.returnPartialData,r=void 0!==t&&t;try{return this.storeReader.diffQueryAgainstStore(n.__assign(n.__assign({},e),{store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:r})).result||null}catch(e){if(e instanceof Be)return null;throw e}},t.prototype.write=function(e){try{return++this.txCount,this.storeWriter.writeToStore(this.data,e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.modify=function(e){if(We.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()}},t.prototype.diff=function(e){return this.storeReader.diffQueryAgainstStore(n.__assign(n.__assign({},e),{store:e.optimistic?this.optimisticData:this.data,rootId:e.id||"ROOT_QUERY",config:this.config}))},t.prototype.watch=function(e){var t,r=this;return this.watches.size||wt(t=this).vars.forEach((function(e){return e.attachCache(t)})),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){r.watches.delete(e)&&!r.watches.size&&function(e){wt(e).vars.forEach((function(t){return t.forgetCache(e)}))}(r),r.maybeBroadcastWatch.forget(e)}},t.prototype.gc=function(e){ut.reset();var t=this.optimisticData.gc();return e&&!this.txCount&&(e.resetResultCache?this.resetResultCache(e.resetResultIdentities):e.resetResultIdentities&&this.storeReader.resetCanon()),t},t.prototype.retain=function(e,t){return(t?this.optimisticData:this.data).retain(e)},t.prototype.release=function(e,t){return(t?this.optimisticData:this.data).release(e)},t.prototype.identify=function(e){return O(e)?e.__ref:this.policies.identify(e)[0]},t.prototype.evict=function(e){if(!e.id){if(We.call(e,"id"))return!1;e=n.__assign(n.__assign({},e),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.reset=function(){return this.init(),this.broadcastWatches(),ut.reset(),Promise.resolve()},t.prototype.removeOptimistic=function(e){var t=this.optimisticData.removeLayer(e);t!==this.optimisticData&&(this.optimisticData=t,this.broadcastWatches())},t.prototype.batch=function(e){var t=this,r=e.update,i=e.optimistic,o=void 0===i||i,a=e.removeOptimistic,s=e.onWatchUpdated,u=function(e){var n=t,i=n.data,o=n.optimisticData;++t.txCount,e&&(t.data=t.optimisticData=e);try{r(t)}finally{--t.txCount,t.data=i,t.optimisticData=o}},c=new Set;s&&!this.txCount&&this.broadcastWatches(n.__assign(n.__assign({},e),{onWatchUpdated:function(e){return c.add(e),!1}})),"string"==typeof o?this.optimisticData=this.optimisticData.addLayer(o,u):!1===o?u(this.data):u(),"string"==typeof a&&(this.optimisticData=this.optimisticData.removeLayer(a)),s&&c.size?(this.broadcastWatches(n.__assign(n.__assign({},e),{onWatchUpdated:function(e,t){var r=s.call(this,e,t);return!1!==r&&c.delete(e),r}})),c.size&&c.forEach((function(e){return t.maybeBroadcastWatch.dirty(e)}))):this.broadcastWatches(e)},t.prototype.performTransaction=function(e,t){return this.batch({update:e,optimistic:t||null!==t})},t.prototype.transformDocument=function(e){if(this.addTypename){var t=this.typenameDocumentCache.get(e);return t||(t=J(e),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},t.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach((function(r){return t.maybeBroadcastWatch(r,e)}))},t.prototype.broadcastWatch=function(e,t){var r=e.lastDiff,n=this.diff({query:e.query,variables:e.variables,optimistic:e.optimistic});t&&(e.optimistic&&"string"==typeof t.optimistic&&(n.fromOptimisticTransaction=!0),t.onWatchUpdated&&!1===t.onWatchUpdated.call(this,e,n,r))||r&&i.equal(r.result,n.result)||e.callback(e.lastDiff=n,r)},t}(Ve);function Nt(e){return e.hasOwnProperty("graphQLErrors")}var Lt,Vt=function(e){function t(r){var n,i,o=r.graphQLErrors,a=r.clientErrors,s=r.networkError,u=r.errorMessage,c=r.extraInfo,l=e.call(this,u)||this;return l.graphQLErrors=o||[],l.clientErrors=a||[],l.networkError=s||null,l.message=u||(i="",(le((n=l).graphQLErrors)||le(n.clientErrors))&&(n.graphQLErrors||[]).concat(n.clientErrors||[]).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$/,"")),l.extraInfo=c,l.__proto__=t.prototype,l}return n.__extends(t,e),t}(Error);function Bt(e){return!!e&&e<7}exports.NetworkStatus=void 0,(Lt=exports.NetworkStatus||(exports.NetworkStatus={}))[Lt.loading=1]="loading",Lt[Lt.setVariables=2]="setVariables",Lt[Lt.fetchMore=3]="fetchMore",Lt[Lt.refetch=4]="refetch",Lt[Lt.poll=6]="poll",Lt[Lt.ready=7]="ready",Lt[Lt.error=8]="error";var Wt=Object.assign,zt=(Object.hasOwnProperty,function(t){function r(e){var r=e.queryManager,n=e.queryInfo,i=e.options,o=t.call(this,(function(e){try{var t=e._subscription._observer;t&&!t.error&&(t.error=Ut)}catch(e){}var r=!o.observers.size;o.observers.add(e);var n=o.last;return n&&n.error?e.error&&e.error(n.error):n&&n.result&&e.next&&e.next(n.result),r&&o.reobserve().catch((function(){})),function(){o.observers.delete(e)&&!o.observers.size&&o.tearDownQuery()}}))||this;o.observers=new Set,o.subscriptions=new Set,o.isTornDown=!1,o.options=i,o.queryId=n.queryId||r.generateQueryId();var a=C(i.query);return o.queryName=a&&a.name&&a.name.value,o.initialFetchPolicy=i.fetchPolicy||"cache-first",o.queryManager=r,o.queryInfo=n,o}return n.__extends(r,t),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 t=this.getLastResult(!0),r=this.queryInfo.networkStatus||t&&t.networkStatus||exports.NetworkStatus.ready,o=n.__assign(n.__assign({},t),{loading:Bt(r),networkStatus:r}),a=this.options.fetchPolicy,s=void 0===a?"cache-first":a;if((t||"network-only"!==s&&"no-cache"!==s&&"standby"!==s)&&!this.queryManager.transform(this.options.query).hasForcedResolvers){var u=this.queryInfo.getDiff();(u.complete||this.options.returnPartialData)&&(o.data=u.result),i.equal(o.data,{})&&(o.data=void 0),u.complete?(o.networkStatus!==exports.NetworkStatus.loading||"cache-first"!==s&&"cache-only"!==s||(o.networkStatus=exports.NetworkStatus.ready,o.loading=!1),delete o.partial):"no-cache"!==s&&(o.partial=!0)}return e&&this.updateLastResult(o),o},r.prototype.isDifferentFromLastResult=function(e){return!this.last||!i.equal(this.last.result,e)},r.prototype.getLast=function(e,t){var r=this.last;if(r&&r[e]&&(!t||i.equal(r.variables,this.variables)))return r[e]},r.prototype.getLastResult=function(e){return this.getLast("result",e)},r.prototype.getLastError=function(e){return this.getLast("error",e)},r.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},r.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},r.prototype.refetch=function(e){var t={pollInterval:0},r=this.options.fetchPolicy;return"no-cache"===r?t.fetchPolicy="no-cache":"cache-and-network"!==r&&(t.fetchPolicy="network-only"),e&&!i.equal(this.options.variables,e)&&(t.variables=this.options.variables=n.__assign(n.__assign({},this.options.variables),e)),this.queryInfo.resetLastWrite(),this.reobserve(t,exports.NetworkStatus.refetch)},r.prototype.fetchMore=function(e){var t=this,r=n.__assign(n.__assign({},e.query?e:n.__assign(n.__assign(n.__assign({},this.options),e),{variables:n.__assign(n.__assign({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"}),i=this.queryManager.generateQueryId();return r.notifyOnNetworkStatusChange&&(this.queryInfo.networkStatus=exports.NetworkStatus.fetchMore,this.observe()),this.queryManager.fetchQuery(i,r,exports.NetworkStatus.fetchMore).then((function(n){var i=n.data,o=e.updateQuery;return o?t.updateQuery((function(e){return o(e,{fetchMoreResult:i,variables:r.variables})})):t.queryManager.cache.writeQuery({query:r.query,variables:r.variables,data:i}),n})).finally((function(){t.queryManager.stopQuery(i),t.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){return i.equal(this.variables,e)?this.observers.size?this.result():Promise.resolve():(this.options.variables=e,this.observers.size?this.reobserve({fetchPolicy:this.initialFetchPolicy,variables:e},exports.NetworkStatus.setVariables):Promise.resolve())},r.prototype.updateQuery=function(e){var t=this.queryManager,r=e(t.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,{variables:this.variables});r&&(t.cache.writeQuery({query:this.options.query,data:r,variables:this.variables}),t.broadcastQueries())},r.prototype.startPolling=function(e){this.options.pollInterval=e,this.updatePolling()},r.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},r.prototype.fetch=function(e,t){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,e,t)},r.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var r=this.pollingInfo,n=this.options.pollInterval;if(n){if(!r||r.interval!==n){e.invariant(n,12),(r||(this.pollingInfo={})).interval=n;var i=function(){t.pollingInfo&&(Bt(t.queryInfo.networkStatus)?o():t.reobserve({fetchPolicy:"network-only"},exports.NetworkStatus.poll).then(o,o))},o=function(){var e=t.pollingInfo;e&&(clearTimeout(e.timeout),e.timeout=setTimeout(i,e.interval))};o()}}else r&&(clearTimeout(r.timeout),delete this.pollingInfo)}},r.prototype.updateLastResult=function(e,t){return void 0===t&&(t=this.variables),this.last=n.__assign(n.__assign({},this.last),{result:this.queryManager.assumeImmutableResults?e:ne(e),variables:t}),le(e.errors)||delete this.last.error,this.last},r.prototype.reobserve=function(e,t){var r=this;this.isTornDown=!1;var o=t===exports.NetworkStatus.refetch||t===exports.NetworkStatus.fetchMore||t===exports.NetworkStatus.poll,a=this.options.variables,s=o?de(this.options,e):Wt(this.options,de(e));o||(this.updatePolling(),e&&e.variables&&!e.fetchPolicy&&!i.equal(e.variables,a)&&(s.fetchPolicy=this.initialFetchPolicy,void 0===t&&(t=exports.NetworkStatus.setVariables)));var u=s.variables&&n.__assign({},s.variables),c=this.fetch(s,t),l={next:function(e){r.reportResult(e,u)},error:function(e){r.reportError(e,u)}};return o||(this.concast&&this.observer&&this.concast.removeObserver(this.observer,!0),this.concast=c,this.observer=l),c.addObserver(l),c.promise},r.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},r.prototype.reportResult=function(e,t){(this.getLastError()||this.isDifferentFromLastResult(e))&&(this.updateLastResult(e,t),oe(this.observers,"next",e))},r.prototype.reportError=function(e,t){var r=n.__assign(n.__assign({},this.getLastResult()),{error:e,errors:e.graphQLErrors,networkStatus:exports.NetworkStatus.error,loading:!1});this.updateLastResult(r,t),oe(this.observers,"error",this.last.error=e)},r.prototype.hasObservers=function(){return this.observers.size>0},r.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},r}(o.Observable));function Ut(e){}function Kt(e){var t=e.fetchPolicy,r=void 0===t?"cache-first":t,n=e.nextFetchPolicy;n&&(e.fetchPolicy="function"==typeof n?n.call(e,r):n)}se(zt);var Jt=function(){function t(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 t.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=X(t.resolvers,e)})):this.resolvers=X(this.resolvers,e)},t.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},t.prototype.getResolvers=function(){return this.resolvers||{}},t.prototype.runResolvers=function(e){var t=e.document,r=e.remoteResult,i=e.context,o=e.variables,a=e.onlyRunForcedResolvers,s=void 0!==a&&a;return n.__awaiter(this,void 0,void 0,(function(){return n.__generator(this,(function(e){return t?[2,this.resolveDocument(t,r.data,i,o,this.fragmentMatcher,s).then((function(e){return n.__assign(n.__assign({},r),{data:e.result})}))]:[2,r]}))}))},t.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(e){return y(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return function(e){T(e);var t=K([{test:function(e){return"client"===e.name.value},remove:!0}],e);return t&&(t=r.visit(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return M(e)&&"__typename"===e.name.value})))return null}}})),t}(e)},t.prototype.prepareContext=function(e){var t=this.cache;return n.__assign(n.__assign({},e),{cache:t,getCacheKey:function(e){return t.identify(e)}})},t.prototype.addExportedVariables=function(e,t,r){return void 0===t&&(t={}),void 0===r&&(r={}),n.__awaiter(this,void 0,void 0,(function(){return n.__generator(this,(function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(r),t).then((function(e){return n.__assign(n.__assign({},t),e.exportedVariables)}))]:[2,n.__assign({},t)]}))}))},t.prototype.shouldForceResolvers=function(e){var t=!1;return r.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 r.BREAK}}}),t},t.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:G(e),variables:t,returnPartialData:!0,optimistic:!1}).result},t.prototype.resolveDocument=function(e,t,r,i,o,a){return void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o=function(){return!0}),void 0===a&&(a=!1),n.__awaiter(this,void 0,void 0,(function(){var s,u,c,l,f,p,h,d,v;return n.__generator(this,(function(y){return s=N(e),u=j(e),c=b(u),l=s.operation,f=l?l.charAt(0).toUpperCase()+l.slice(1):"Query",h=(p=this).cache,d=p.client,v={fragmentMap:c,context:n.__assign(n.__assign({},r),{cache:h,client:d}),variables:i,fragmentMatcher:o,defaultOperationType:f,exportedVariables:{},onlyRunForcedResolvers:a},[2,this.resolveSelectionSet(s.selectionSet,t,v).then((function(e){return{result:e,exportedVariables:v.exportedVariables}}))]}))}))},t.prototype.resolveSelectionSet=function(t,r,i){return n.__awaiter(this,void 0,void 0,(function(){var o,a,s,u,c,l=this;return n.__generator(this,(function(f){return o=i.fragmentMap,a=i.context,s=i.variables,u=[r],c=function(t){return n.__awaiter(l,void 0,void 0,(function(){var c,l;return n.__generator(this,(function(n){return v(t,s)?M(t)?[2,this.resolveField(t,r,i).then((function(e){var r;void 0!==e&&u.push(((r={})[I(t)]=e,r))}))]:(P(t)?c=t:(c=o[t.name.value],e.invariant(c,11)),c&&c.typeCondition&&(l=c.typeCondition.name.value,i.fragmentMatcher(r,l,a))?[2,this.resolveSelectionSet(c.selectionSet,r,i).then((function(e){u.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(t.selections.map(c)).then((function(){return Z(u)}))]}))}))},t.prototype.resolveField=function(e,t,r){return n.__awaiter(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,f,p,h=this;return n.__generator(this,(function(n){return i=r.variables,o=e.name.value,a=I(e),s=o!==a,u=t[a]||t[o],c=Promise.resolve(u),r.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(l=t.__typename||r.defaultOperationType,(f=this.resolvers&&this.resolvers[l])&&(p=f[s?o:a])&&(c=Promise.resolve(bt.withValue(this.cache,p,[t,Q(e,i),r.context,{field:e,fragmentMap:r.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&&(r.exportedVariables[e.value.value]=t)}))})),e.selectionSet?null==t?t:Array.isArray(t)?h.resolveSubSelectedArray(e,t,r):e.selectionSet?h.resolveSelectionSet(e.selectionSet,t,r):void 0:t}))]}))}))},t.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})))},t}(),Ht=new(pe?WeakMap:Map);function Yt(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return Ht.set(e,(Ht.get(e)+1)%1e15),r.apply(this,arguments)})}function Gt(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var $t=function(){function e(e,t){void 0===t&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var r=this.cache=e.cache;Ht.has(r)||(Ht.set(r,0),Yt(r,"evict"),Yt(r,"modify"),Yt(r,"reset"))}return e.prototype.init=function(e){var t=e.networkStatus||exports.NetworkStatus.loading;return this.variables&&this.networkStatus!==exports.NetworkStatus.loading&&!i.equal(this.variables,e.variables)&&(t=exports.NetworkStatus.setVariables),i.equal(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},e.prototype.reset=function(){Gt(this),this.lastDiff=void 0,this.dirty=!1},e.prototype.getDiff=function(e){void 0===e&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&i.equal(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var r=this.observableQuery;if(r&&"no-cache"===r.options.fetchPolicy)return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},e.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},e.prototype.getDiffOptions=function(e){void 0===e&&(e=this.variables);var t=this.observableQuery;return{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:!t||!1!==t.options.canonizeResults}},e.prototype.setDiff=function(e){var t=this,r=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),this.dirty||i.equal(r&&r.result,e&&e.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;Gt(this),this.shouldNotify()&&this.listeners.forEach((function(t){return t(e)})),this.dirty=!1},e.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Bt(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if("cache-only"!==e&&"cache-and-network"!==e)return!1}return!0},e.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=e.prototype.cancel,this.subscriptions.forEach((function(e){return e.unsubscribe()}));var t=this.observableQuery;t&&t.stopPolling()}},e.prototype.cancel=function(){},e.prototype.updateWatch=function(e){var t=this;void 0===e&&(e=this.variables);var r=this.observableQuery;if(!r||"no-cache"!==r.options.fetchPolicy){var o=n.__assign(n.__assign({},this.getDiffOptions(e)),{watcher:this,callback:function(e){return t.setDiff(e)}});this.lastWatch&&i.equal(o,this.lastWatch)||(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=o))}},e.prototype.resetLastWrite=function(){this.lastWrite=void 0},e.prototype.shouldWrite=function(e,t){var r=this.lastWrite;return!(r&&r.dmCount===Ht.get(this.cache)&&i.equal(t,r.variables)&&i.equal(e.data,r.result.data))},e.prototype.markResult=function(e,t,r){var n=this;this.graphQLErrors=le(e.errors)?e.errors:[],this.reset(),"no-cache"===t.fetchPolicy?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(t.variables)):0!==r&&(Xt(e,t.errorPolicy)?this.cache.performTransaction((function(i){if(n.shouldWrite(e,t.variables))i.writeQuery({query:n.document,data:e.data,variables:t.variables,overwrite:1===r}),n.lastWrite={result:e,variables:t.variables,dmCount:Ht.get(n.cache)};else if(n.lastDiff&&n.lastDiff.diff.complete)return void(e.data=n.lastDiff.diff.result);var o=n.getDiffOptions(t.variables),a=i.diff(o);n.stopped||n.updateWatch(t.variables),n.updateLastDiff(a,o),a.complete&&(e.data=a.result)})):this.lastWrite=void 0)},e.prototype.markReady=function(){return this.networkError=null,this.networkStatus=exports.NetworkStatus.ready},e.prototype.markError=function(e){return this.networkStatus=exports.NetworkStatus.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}();function Xt(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!fe(e);return!n&&r&&e.data&&(n=!0),n}var Zt=Object.prototype.hasOwnProperty,er=function(){function t(e){var t=e.cache,r=e.link,n=e.queryDeduplication,i=void 0!==n&&n,o=e.onBroadcast,a=e.ssrMode,s=void 0!==a&&a,u=e.clientAwareness,c=void 0===u?{}:u,l=e.localState,f=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(pe?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=r,this.queryDeduplication=i,this.clientAwareness=c,this.localState=l||new Jt({cache:t}),this.ssrMode=s,this.assumeImmutableResults=!!f,(this.onBroadcast=o)&&(this.mutationStore=Object.create(null))}return t.prototype.stop=function(){var t=this;this.queries.forEach((function(e,r){t.stopQueryNoBroadcast(r)})),this.cancelPendingFetches(new e.InvariantError(13))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach((function(t){return t(e)})),this.fetchCancelFns.clear()},t.prototype.mutate=function(t){var r=t.mutation,i=t.variables,o=t.optimisticResponse,a=t.updateQueries,s=t.refetchQueries,u=void 0===s?[]:s,c=t.awaitRefetchQueries,l=void 0!==c&&c,f=t.update,p=t.onQueryUpdated,h=t.errorPolicy,d=void 0===h?"none":h,v=t.fetchPolicy,y=void 0===v?"network-only":v,m=t.keepRootFields,g=t.context;return n.__awaiter(this,void 0,void 0,(function(){var t,s,c;return n.__generator(this,(function(h){switch(h.label){case 0:return e.invariant(r,14),e.invariant("network-only"===y||"no-cache"===y,15),t=this.generateMutationId(),r=this.transform(r).document,i=this.getVariables(r,i),this.transform(r).hasClientExports?[4,this.localState.addExportedVariables(r,i,g)]:[3,2];case 1:i=h.sent(),h.label=2;case 2:return s=this.mutationStore&&(this.mutationStore[t]={mutation:r,variables:i,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:t,document:r,variables:i,fetchPolicy:y,errorPolicy:d,context:g,updateQueries:a,update:f,keepRootFields:m}),this.broadcastQueries(),c=this,[2,new Promise((function(e,h){return ae(c.getObservableFromLink(r,n.__assign(n.__assign({},g),{optimisticResponse:o}),i,!1),(function(e){if(fe(e)&&"none"===d)throw new Vt({graphQLErrors:e.errors});s&&(s.loading=!1,s.error=null);var h=n.__assign({},e);return"function"==typeof u&&(u=u(h)),"ignore"===d&&fe(h)&&delete h.errors,c.markMutationResult({mutationId:t,result:h,document:r,variables:i,fetchPolicy:y,errorPolicy:d,context:g,update:f,updateQueries:a,awaitRefetchQueries:l,refetchQueries:u,removeOptimistic:o?t:void 0,onQueryUpdated:p,keepRootFields:m})})).subscribe({next:function(t){c.broadcastQueries(),e(t)},error:function(e){s&&(s.loading=!1,s.error=e),o&&c.cache.removeOptimistic(t),c.broadcastQueries(),h(e instanceof Vt?e:new Vt({networkError:e}))}})}))]}}))}))},t.prototype.markMutationResult=function(e,t){var r=this;void 0===t&&(t=this.cache);var i=e.result,o=[],a="no-cache"===e.fetchPolicy;if(!a&&Xt(i,e.errorPolicy)){o.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables});var s=e.updateQueries;s&&this.queries.forEach((function(e,n){var a=e.observableQuery,u=a&&a.queryName;if(u&&Zt.call(s,u)){var c=s[u],l=r.queries.get(n),f=l.document,p=l.variables,h=t.diff({query:f,variables:p,returnPartialData:!0,optimistic:!1}),d=h.result;if(h.complete&&d){var v=c(d,{mutationResult:i,queryName:f&&D(f)||void 0,queryVariables:p});v&&o.push({result:v,dataId:"ROOT_QUERY",query:f,variables:p})}}}))}if(o.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var u=[];if(this.refetchQueries({updateCache:function(t){a||o.forEach((function(e){return t.write(e)}));var s=e.update;if(s){if(!a){var u=t.diff({id:"ROOT_MUTATION",query:r.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});u.complete&&(i=n.__assign(n.__assign({},i),{data:u.result}))}s(t,i,{context:e.context,variables:e.variables})}a||e.keepRootFields||t.modify({id:"ROOT_MUTATION",fields:function(e,t){var r=t.fieldName,n=t.DELETE;return"__typename"===r?e:n}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach((function(e){return u.push(e)})),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(u).then((function(){return i}))}return Promise.resolve(i)},t.prototype.markMutationOptimistic=function(e,t){var r=this,i="function"==typeof e?e(t.variables):e;return this.cache.recordOptimisticTransaction((function(e){try{r.markMutationResult(n.__assign(n.__assign({},t),{result:{data:i}}),e)}catch(e){}}),t.mutationId)},t.prototype.fetchQuery=function(e,t,r){return this.fetchQueryObservable(e,t,r).promise},t.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},t.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},t.prototype.transform=function(e){var t,r=this.transformCache;if(!r.has(e)){var i=this.cache.transformDocument(e),o=(t=this.cache.transformForLink(i),K([H],T(t))),a=this.localState.clientQuery(i),s=o&&this.localState.serverQuery(o),u={document:i,hasClientExports:m(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:s,defaultVars:L(C(i)),asQuery:n.__assign(n.__assign({},i),{definitions:i.definitions.map((function(e){return"OperationDefinition"===e.kind&&"query"!==e.operation?n.__assign(n.__assign({},e),{operation:"query"}):e}))})},c=function(e){e&&!r.has(e)&&r.set(e,u)};c(e),c(i),c(a),c(s)}return r.get(e)},t.prototype.getVariables=function(e,t){return n.__assign(n.__assign({},this.transform(e).defaultVars),t)},t.prototype.watchQuery=function(e){void 0===(e=n.__assign(n.__assign({},e),{variables:this.getVariables(e.query,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var t=new $t(this),r=new zt({queryManager:this,queryInfo:t,options:e});return this.queries.set(r.queryId,t),t.init({document:e.query,observableQuery:r,variables:e.variables}),r},t.prototype.query=function(t,r){var n=this;return void 0===r&&(r=this.generateQueryId()),e.invariant(t.query,16),e.invariant("Document"===t.query.kind,17),e.invariant(!t.returnPartialData,18),e.invariant(!t.pollInterval,19),this.fetchQuery(r,t).finally((function(){return n.stopQuery(r)}))},t.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},t.prototype.generateRequestId=function(){return this.requestIdCounter++},t.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},t.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},t.prototype.clearStore=function(){return this.cancelPendingFetches(new e.InvariantError(20)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=exports.NetworkStatus.loading:e.stop()})),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset()},t.prototype.resetStore=function(){var e=this;return this.clearStore().then((function(){return e.reFetchObservableQueries()}))},t.prototype.getObservableQueries=function(t){var r=this;void 0===t&&(t="active");var i=new Map,o=new Map,a=new Set;return Array.isArray(t)&&t.forEach((function(e){var t;"string"==typeof e?o.set(e,!1):w(t=e)&&"Document"===t.kind&&Array.isArray(t.definitions)?o.set(r.transform(e).document,!1):w(e)&&e.query&&a.add(e)})),this.queries.forEach((function(e,r){var n=e.observableQuery,a=e.document;if(n){if("all"===t)return void i.set(r,n);var s=n.queryName;if("standby"===n.options.fetchPolicy||!n.hasObservers())return;("active"===t||s&&o.has(s)||a&&o.has(a))&&(i.set(r,n),s&&o.set(s,!0),a&&o.set(a,!0))}})),a.size&&a.forEach((function(t){var o=ye("legacyOneTimeQuery"),a=r.getQuery(o).init({document:t.query,variables:t.variables}),s=new zt({queryManager:r,queryInfo:a,options:n.__assign(n.__assign({},t),{fetchPolicy:"network-only"})});e.invariant(s.queryId===o),a.setObservableQuery(s),i.set(o,s)})),i},t.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var r=[];return this.getObservableQueries(e?"all":"active").forEach((function(n,i){var o=n.options.fetchPolicy;n.resetLastResults(),(e||"standby"!==o&&"cache-only"!==o)&&r.push(n.refetch()),t.getQuery(i).setDiff(null)})),this.broadcastQueries(),Promise.all(r)},t.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},t.prototype.startGraphQLSubscription=function(e){var t=this,r=e.query,n=e.fetchPolicy,i=e.errorPolicy,a=e.variables,s=e.context,u=void 0===s?{}:s;r=this.transform(r).document,a=this.getVariables(r,a);var c=function(e){return t.getObservableFromLink(r,u,e).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()),fe(o))throw new Vt({graphQLErrors:o.errors});return o}))};if(this.transform(r).hasClientExports){var l=this.localState.addExportedVariables(r,a,u).then(c);return new o.Observable((function(e){var t=null;return l.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return c(a)},t.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},t.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.getQuery(e).stop(),this.queries.delete(e)},t.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},t.prototype.getLocalState=function(){return this.localState},t.prototype.getObservableFromLink=function(e,t,r,i){var a,s,u=this;void 0===i&&(i=null!==(a=null==t?void 0:t.queryDeduplication)&&void 0!==a?a:this.queryDeduplication);var c=this.transform(e).serverQuery;if(c){var l=this.inFlightLinkObservables,f=this.link,p={query:c,variables:r,operationName:D(c)||void 0,context:this.prepareContext(n.__assign(n.__assign({},t),{forceFetch:!i}))};if(t=p.context,i){var h=l.get(c)||new Map;l.set(c,h);var d=ut(r);if(!(s=h.get(d))){var v=new ce([qe(f,p)]);h.set(d,s=v),v.cleanup((function(){h.delete(d)&&h.size<1&&l.delete(c)}))}}else s=new ce([qe(f,p)])}else s=new ce([o.Observable.of({data:{}})]),t=this.prepareContext(t);var y=this.transform(e).clientQuery;return y&&(s=ae(s,(function(e){return u.localState.runResolvers({document:y,remoteResult:e,context:t,variables:r})}))),s},t.prototype.getResultsFromLink=function(e,t,r){var n=e.lastRequestId=this.generateRequestId();return ae(this.getObservableFromLink(e.document,r.context,r.variables),(function(i){var o=le(i.errors);if(n>=e.lastRequestId){if(o&&"none"===r.errorPolicy)throw e.markError(new Vt({graphQLErrors:i.errors}));e.markResult(i,r,t),e.markReady()}var a={data:i.data,loading:!1,networkStatus:e.networkStatus||exports.NetworkStatus.ready};return o&&"ignore"!==r.errorPolicy&&(a.errors=i.errors),a}),(function(t){var r=Nt(t)?t:new Vt({networkError:t});throw n>=e.lastRequestId&&e.markError(r),r}))},t.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),a=this.getQuery(e),s=t.fetchPolicy,u=void 0===s?"cache-first":s,c=t.errorPolicy,l=void 0===c?"none":c,f=t.returnPartialData,p=void 0!==f&&f,h=t.notifyOnNetworkStatusChange,d=void 0!==h&&h,v=t.context,y=void 0===v?{}:v,m=Object.assign({},t,{query:i,variables:o,fetchPolicy:u,errorPolicy:l,returnPartialData:p,notifyOnNetworkStatusChange:d,context:y}),g=function(e){return m.variables=e,n.fetchQueryByPolicy(a,m,r)};this.fetchCancelFns.set(e,(function(e){setTimeout((function(){return b.cancel(e)}))}));var b=new ce(this.transform(m.query).hasClientExports?this.localState.addExportedVariables(m.query,m.variables,m.context).then(g):g(m.variables));return b.cleanup((function(){n.fetchCancelFns.delete(e),Kt(t)})),b},t.prototype.refetchQueries=function(e){var t=this,r=e.updateCache,n=e.include,i=e.optimistic,o=void 0!==i&&i,a=e.removeOptimistic,s=void 0===a?o?ye("refetchQueries"):void 0:a,u=e.onQueryUpdated,c=new Map;n&&this.getObservableQueries(n).forEach((function(e,r){c.set(r,{oq:e,lastDiff:t.getQuery(r).getDiff()})}));var l=new Map;return r&&this.cache.batch({update:r,optimistic:o&&s||!1,removeOptimistic:s,onWatchUpdated:function(e,t,r){var n=e.watcher instanceof $t&&e.watcher.observableQuery;if(n){if(u){c.delete(n.queryId);var i=u(n,t,r);return!0===i&&(i=n.refetch()),!1!==i&&l.set(n,i),!1}null!==u&&c.set(n.queryId,{oq:n,lastDiff:r,diff:t})}}}),c.size&&c.forEach((function(e,r){var n,i=e.oq,o=e.lastDiff,a=e.diff;if(u){if(!a){var s=i.queryInfo;s.reset(),a=s.getDiff()}n=u(i,a,o)}u&&!0!==n||(n=i.refetch()),!1!==n&&l.set(i,n),r.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(r)})),s&&this.cache.removeOptimistic(s),l},t.prototype.fetchQueryByPolicy=function(e,t,r){var i=this,a=t.query,s=t.variables,u=t.fetchPolicy,c=t.refetchWritePolicy,l=t.errorPolicy,f=t.returnPartialData,p=t.context,h=t.notifyOnNetworkStatusChange,d=e.networkStatus;e.init({document:a,variables:s,networkStatus:r});var v=function(){return e.getDiff(s)},y=function(t,r){void 0===r&&(r=e.networkStatus||exports.NetworkStatus.loading);var u=t.result;var c=function(e){return o.Observable.of(n.__assign({data:e,loading:Bt(r),networkStatus:r},t.complete?null:{partial:!0}))};return u&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:u},context:p,variables:s,onlyRunForcedResolvers:!0}).then((function(e){return c(e.data||void 0)})):c(u)},m="no-cache"===u?0:r===exports.NetworkStatus.refetch&&"merge"!==c?1:2,g=function(){return i.getResultsFromLink(e,m,{variables:s,context:p,fetchPolicy:u,errorPolicy:l})},b=h&&"number"==typeof d&&d!==r&&Bt(r);switch(u){default:case"cache-first":return(_=v()).complete?[y(_,e.markReady())]:f||b?[y(_),g()]:[g()];case"cache-and-network":var _;return(_=v()).complete||f||b?[y(_),g()]:[g()];case"cache-only":return[y(v(),e.markReady())];case"network-only":return b?[y(v()),g()]:[g()];case"no-cache":return b?[y(e.getDiff()),g()]:[g()];case"standby":return[]}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new $t(this,e)),this.queries.get(e)},t.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return n.__assign(n.__assign({},t),{clientAwareness:this.clientAwareness})},t}();function tr(e,t){return de(e,t,t.variables&&{variables:n.__assign(n.__assign({},e.variables),t.variables)})}var rr=function(){function t(t){var r=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=t.uri,i=t.credentials,o=t.headers,a=t.cache,s=t.ssrMode,u=void 0!==s&&s,c=t.ssrForceFetchDelay,l=void 0===c?0:c,f=t.connectToDevTools,p=void 0===f?"object"==typeof window&&!window.__APOLLO_CLIENT__&&!1:f,h=t.queryDeduplication,d=void 0===h||h,v=t.defaultOptions,y=t.assumeImmutableResults,m=void 0!==y&&y,g=t.resolvers,b=t.typeDefs,_=t.fragmentMatcher,w=t.name,S=t.version,O=t.link;if(O||(O=n?new Le({uri:n,credentials:i,headers:o}):Se.empty()),!a)throw new e.InvariantError(9);this.link=O,this.cache=a,this.disableNetworkFetches=u||l>0,this.queryDeduplication=d,this.defaultOptions=v||{},this.typeDefs=b,l&&setTimeout((function(){return r.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),p&&"object"==typeof window&&(window.__APOLLO_CLIENT__=this),this.version="3.4.10",this.localState=new Jt({cache:a,client:this,resolvers:g,fragmentMatcher:_}),this.queryManager=new er({cache:this.cache,link:this.link,queryDeduplication:d,ssrMode:u,clientAwareness:{name:w,version:S},localState:this.localState,assumeImmutableResults:m,onBroadcast:p?function(){r.devToolsHookCb&&r.devToolsHookCb({action:{},state:{queries:r.queryManager.getQueryStore(),mutations:r.queryManager.mutationStore||{}},dataWithOptimisticResults:r.cache.extract(!0)})}:void 0})}return t.prototype.stop=function(){this.queryManager.stop()},t.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=tr(this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=n.__assign(n.__assign({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},t.prototype.query=function(t){return this.defaultOptions.query&&(t=tr(this.defaultOptions.query,t)),e.invariant("cache-and-network"!==t.fetchPolicy,10),this.disableNetworkFetches&&"network-only"===t.fetchPolicy&&(t=n.__assign(n.__assign({},t),{fetchPolicy:"cache-first"})),this.queryManager.query(t)},t.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=tr(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},t.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},t.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},t.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},t.prototype.writeQuery=function(e){this.cache.writeQuery(e),this.queryManager.broadcastQueries()},t.prototype.writeFragment=function(e){this.cache.writeFragment(e),this.queryManager.broadcastQueries()},t.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},t.prototype.__requestRaw=function(e){return qe(this.link,e)},t.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()}))},t.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()})))}))},t.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},t.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},t.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},t.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),r=[],n=[];t.forEach((function(e,t){r.push(t),n.push(e)}));var i=Promise.all(n);return i.queries=r,i.results=n,i.catch((function(e){})),i},t.prototype.getObservableQueries=function(e){return void 0===e&&(e="active"),this.queryManager.getObservableQueries(e)},t.prototype.extract=function(e){return this.cache.extract(e)},t.prototype.restore=function(e){return this.cache.restore(e)},t.prototype.addResolvers=function(e){this.localState.addResolvers(e)},t.prototype.setResolvers=function(e){this.localState.setResolvers(e)},t.prototype.getResolvers=function(){return this.localState.getResolvers()},t.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},t.prototype.setLink=function(e){this.link=this.queryManager.link=e},t}();e.setVerbosity(d?"log":"silent"),exports.setLogVerbosity=e.setVerbosity,exports.Observable=o.Observable,exports.disableExperimentalFragmentVariables=c.disableExperimentalFragmentVariables,exports.disableFragmentWarnings=c.disableFragmentWarnings,exports.enableExperimentalFragmentVariables=c.enableExperimentalFragmentVariables,exports.gql=c.gql,exports.resetCaches=c.resetCaches,exports.ApolloCache=Ve,exports.ApolloClient=rr,exports.ApolloError=Vt,exports.ApolloLink=Se,exports.HttpLink=Le,exports.InMemoryCache=At,exports.MissingFieldError=Be,exports.ObservableQuery=zt,exports.applyNextFetchPolicy=Kt,exports.checkFetcher=Te,exports.concat=Ee,exports.createHttpLink=Ne,exports.createSignalIfSupported=Ce,exports.defaultDataIdFromObject=xt,exports.empty=Oe,exports.execute=qe,exports.fallbackHttpConfig=Fe,exports.from=ke,exports.fromError=me,exports.fromPromise=function(e){return new o.Observable((function(t){e.then((function(e){t.next(e),t.complete()})).catch(t.error.bind(t))}))},exports.isApolloError=Nt,exports.isReference=O,exports.makeReference=S,exports.makeVar=St,exports.mergeOptions=tr,exports.parseAndCheckHttpResponse=Qe,exports.rewriteURIForGET=je,exports.selectHttpOptionsAndBody=Me,exports.selectURI=De,exports.serializeFetchParameter=Ie,exports.split=xe,exports.throwServerError=ge,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})}))};
|