From 7dbc8f095186a236ba01db4cd78b0a4db4263b0f Mon Sep 17 00:00:00 2001 From: Boudewijn van Groos Date: Mon, 27 Sep 2021 13:36:28 +0200 Subject: [PATCH] Fix reject on introspection failure --- dist/vuex-orm-graphql.cjs.js | 10 +++++-- dist/vuex-orm-graphql.esm-bundler.js | 31 ++++++++++++--------- dist/vuex-orm-graphql.esm.js | 31 ++++++++++++--------- dist/vuex-orm-graphql.esm.prod.js | 31 ++++++++++++--------- dist/vuex-orm-graphql.global.js | 10 +++++-- dist/vuex-orm-graphql.global.prod.js | 2 +- src/common/context.ts | 40 +++++++++++++++------------- 7 files changed, 93 insertions(+), 62 deletions(-) diff --git a/dist/vuex-orm-graphql.cjs.js b/dist/vuex-orm-graphql.cjs.js index 4eeced2e..d8be0df8 100644 --- a/dist/vuex-orm-graphql.cjs.js +++ b/dist/vuex-orm-graphql.cjs.js @@ -14853,10 +14853,11 @@ var Context = /** @class */ (function () { return __generator(this, function (_a) { if (!this.schemaWillBeLoaded) { this.schemaWillBeLoaded = new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () { - var context, result; + var context, result, e_1; return __generator(this, function (_a) { switch (_a.label) { case 0: + _a.trys.push([0, 2, , 3]); this.logger.log("Fetching GraphQL Schema initially ..."); this.connectionMode = this.adapter.getConnectionMode(); context = { @@ -14871,7 +14872,12 @@ var Context = /** @class */ (function () { this.processSchema(); this.logger.log("Schema procession done!"); resolve(this.schema); - return [2 /*return*/]; + return [3 /*break*/, 3]; + case 2: + e_1 = _a.sent(); + reject(e_1); + return [3 /*break*/, 3]; + case 3: return [2 /*return*/]; } }); }); }); diff --git a/dist/vuex-orm-graphql.esm-bundler.js b/dist/vuex-orm-graphql.esm-bundler.js index 44130eec..86bb321b 100644 --- a/dist/vuex-orm-graphql.esm-bundler.js +++ b/dist/vuex-orm-graphql.esm-bundler.js @@ -14866,19 +14866,24 @@ class Context { async loadSchema() { if (!this.schemaWillBeLoaded) { this.schemaWillBeLoaded = new Promise(async (resolve, reject) => { - this.logger.log("Fetching GraphQL Schema initially ..."); - this.connectionMode = this.adapter.getConnectionMode(); - // We send a custom header along with the request. This is required for our test suite to mock the schema request. - const context = { - headers: { "X-GraphQL-Introspection-Query": "true" } - }; - const result = await this.apollo.simpleQuery(introspectionQuery, {}, true, context); - this.schema = new Schema(result.data.__schema); - this.logger.log("GraphQL Schema successful fetched", result); - this.logger.log("Starting to process the schema ..."); - this.processSchema(); - this.logger.log("Schema procession done!"); - resolve(this.schema); + try { + this.logger.log("Fetching GraphQL Schema initially ..."); + this.connectionMode = this.adapter.getConnectionMode(); + // We send a custom header along with the request. This is required for our test suite to mock the schema request. + const context = { + headers: { "X-GraphQL-Introspection-Query": "true" } + }; + const result = await this.apollo.simpleQuery(introspectionQuery, {}, true, context); + this.schema = new Schema(result.data.__schema); + this.logger.log("GraphQL Schema successful fetched", result); + this.logger.log("Starting to process the schema ..."); + this.processSchema(); + this.logger.log("Schema procession done!"); + resolve(this.schema); + } + catch (e) { + reject(e); + } }); } return this.schemaWillBeLoaded; diff --git a/dist/vuex-orm-graphql.esm.js b/dist/vuex-orm-graphql.esm.js index 44130eec..86bb321b 100644 --- a/dist/vuex-orm-graphql.esm.js +++ b/dist/vuex-orm-graphql.esm.js @@ -14866,19 +14866,24 @@ class Context { async loadSchema() { if (!this.schemaWillBeLoaded) { this.schemaWillBeLoaded = new Promise(async (resolve, reject) => { - this.logger.log("Fetching GraphQL Schema initially ..."); - this.connectionMode = this.adapter.getConnectionMode(); - // We send a custom header along with the request. This is required for our test suite to mock the schema request. - const context = { - headers: { "X-GraphQL-Introspection-Query": "true" } - }; - const result = await this.apollo.simpleQuery(introspectionQuery, {}, true, context); - this.schema = new Schema(result.data.__schema); - this.logger.log("GraphQL Schema successful fetched", result); - this.logger.log("Starting to process the schema ..."); - this.processSchema(); - this.logger.log("Schema procession done!"); - resolve(this.schema); + try { + this.logger.log("Fetching GraphQL Schema initially ..."); + this.connectionMode = this.adapter.getConnectionMode(); + // We send a custom header along with the request. This is required for our test suite to mock the schema request. + const context = { + headers: { "X-GraphQL-Introspection-Query": "true" } + }; + const result = await this.apollo.simpleQuery(introspectionQuery, {}, true, context); + this.schema = new Schema(result.data.__schema); + this.logger.log("GraphQL Schema successful fetched", result); + this.logger.log("Starting to process the schema ..."); + this.processSchema(); + this.logger.log("Schema procession done!"); + resolve(this.schema); + } + catch (e) { + reject(e); + } }); } return this.schemaWillBeLoaded; diff --git a/dist/vuex-orm-graphql.esm.prod.js b/dist/vuex-orm-graphql.esm.prod.js index 44130eec..86bb321b 100644 --- a/dist/vuex-orm-graphql.esm.prod.js +++ b/dist/vuex-orm-graphql.esm.prod.js @@ -14866,19 +14866,24 @@ class Context { async loadSchema() { if (!this.schemaWillBeLoaded) { this.schemaWillBeLoaded = new Promise(async (resolve, reject) => { - this.logger.log("Fetching GraphQL Schema initially ..."); - this.connectionMode = this.adapter.getConnectionMode(); - // We send a custom header along with the request. This is required for our test suite to mock the schema request. - const context = { - headers: { "X-GraphQL-Introspection-Query": "true" } - }; - const result = await this.apollo.simpleQuery(introspectionQuery, {}, true, context); - this.schema = new Schema(result.data.__schema); - this.logger.log("GraphQL Schema successful fetched", result); - this.logger.log("Starting to process the schema ..."); - this.processSchema(); - this.logger.log("Schema procession done!"); - resolve(this.schema); + try { + this.logger.log("Fetching GraphQL Schema initially ..."); + this.connectionMode = this.adapter.getConnectionMode(); + // We send a custom header along with the request. This is required for our test suite to mock the schema request. + const context = { + headers: { "X-GraphQL-Introspection-Query": "true" } + }; + const result = await this.apollo.simpleQuery(introspectionQuery, {}, true, context); + this.schema = new Schema(result.data.__schema); + this.logger.log("GraphQL Schema successful fetched", result); + this.logger.log("Starting to process the schema ..."); + this.processSchema(); + this.logger.log("Schema procession done!"); + resolve(this.schema); + } + catch (e) { + reject(e); + } }); } return this.schemaWillBeLoaded; diff --git a/dist/vuex-orm-graphql.global.js b/dist/vuex-orm-graphql.global.js index 1fcd3ebf..87954d4f 100644 --- a/dist/vuex-orm-graphql.global.js +++ b/dist/vuex-orm-graphql.global.js @@ -14852,10 +14852,11 @@ var VuexORMGraphQLPlugin = (function (exports) { return __generator(this, function (_a) { if (!this.schemaWillBeLoaded) { this.schemaWillBeLoaded = new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () { - var context, result; + var context, result, e_1; return __generator(this, function (_a) { switch (_a.label) { case 0: + _a.trys.push([0, 2, , 3]); this.logger.log("Fetching GraphQL Schema initially ..."); this.connectionMode = this.adapter.getConnectionMode(); context = { @@ -14870,7 +14871,12 @@ var VuexORMGraphQLPlugin = (function (exports) { this.processSchema(); this.logger.log("Schema procession done!"); resolve(this.schema); - return [2 /*return*/]; + return [3 /*break*/, 3]; + case 2: + e_1 = _a.sent(); + reject(e_1); + return [3 /*break*/, 3]; + case 3: return [2 /*return*/]; } }); }); }); diff --git a/dist/vuex-orm-graphql.global.prod.js b/dist/vuex-orm-graphql.global.prod.js index be0fff08..09a05c73 100644 --- a/dist/vuex-orm-graphql.global.prod.js +++ b/dist/vuex-orm-graphql.global.prod.js @@ -12,4 +12,4 @@ var VuexORMGraphQLPlugin=function(e){"use strict"; See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. - ***************************************************************************** */var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,n)};function n(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]2)return"[Array]";for(var n=Math.min(10,e.length),r=e.length-n,i=[],o=0;o1&&i.push("... ".concat(r," more items"));return"["+i.join(", ")+"]"}(e,n);return function(e,t){var n=Object.keys(e);if(0===n.length)return"{}";if(t.length>2)return"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var n=e.constructor.name;if("string"==typeof n&&""!==n)return n}return t}(e)+"]";return"{ "+n.map((function(n){return n+": "+l(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function f(e,t){if(!Boolean(e))throw new Error(t)}function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.prototype.toString;e.prototype.toJSON=t,e.prototype.inspect=t,s&&(e.prototype[s]=t)}function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){for(var n,r=/\r\n|[\n\r]/g,i=1,o=t+1;(n=r.exec(e.body))&&n.index120){for(var p=Math.floor(u/80),h=u%80,d=[],v=0;v0||f(0,"line in locationOffset is 1-indexed and must be positive"),this.locationOffset.column>0||f(0,"column in locationOffset is 1-indexed and must be positive")};function k(e){var t=e.split(/\r\n|[\n\r]/g),n=function(e){for(var t=null,n=1;n0&&S(t[0]);)t.shift();for(;t.length>0&&S(t[t.length-1]);)t.pop();return t.join("\n")}function N(e){for(var t=0;t",EOF:"",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function I(){return this.lastToken=this.token,this.token=this.lookahead()}function x(){var e=this.token;if(e.kind!==T.EOF)do{e=e.next||(e.next=R(this,e))}while(e.kind===T.COMMENT);return e}function D(e,t,n,r,i,o,a){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=a,this.prev=o,this.next=null}function A(e){return isNaN(e)?T.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function R(e,t){var n=e.source,r=n.body,i=r.length,o=function(e,t,n){var r=e.length,i=t;for(;i=i)return new D(T.EOF,i,i,a,s,t);var u=r.charCodeAt(o);switch(u){case 33:return new D(T.BANG,o,o+1,a,s,t);case 35:return function(e,t,n,r,i){var o,a=e.body,s=t;do{o=a.charCodeAt(++s)}while(!isNaN(o)&&(o>31||9===o));return new D(T.COMMENT,t,s,n,r,i,a.slice(t+1,s))}(n,o,a,s,t);case 36:return new D(T.DOLLAR,o,o+1,a,s,t);case 38:return new D(T.AMP,o,o+1,a,s,t);case 40:return new D(T.PAREN_L,o,o+1,a,s,t);case 41:return new D(T.PAREN_R,o,o+1,a,s,t);case 46:if(46===r.charCodeAt(o+1)&&46===r.charCodeAt(o+2))return new D(T.SPREAD,o,o+3,a,s,t);break;case 58:return new D(T.COLON,o,o+1,a,s,t);case 61:return new D(T.EQUALS,o,o+1,a,s,t);case 64:return new D(T.AT,o,o+1,a,s,t);case 91:return new D(T.BRACKET_L,o,o+1,a,s,t);case 93:return new D(T.BRACKET_R,o,o+1,a,s,t);case 123:return new D(T.BRACE_L,o,o+1,a,s,t);case 124:return new D(T.PIPE,o,o+1,a,s,t);case 125:return new D(T.BRACE_R,o,o+1,a,s,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return function(e,t,n,r,i){var o=e.body,a=o.length,s=t+1,u=0;for(;s!==a&&!isNaN(u=o.charCodeAt(s))&&(95===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122);)++s;return new D(T.NAME,t,s,n,r,i,o.slice(t,s))}(n,o,a,s,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return function(e,t,n,r,i,o){var a=e.body,s=n,u=t,c=!1;45===s&&(s=a.charCodeAt(++u));if(48===s){if((s=a.charCodeAt(++u))>=48&&s<=57)throw E(e,u,"Invalid number, unexpected digit after 0: ".concat(A(s),"."))}else u=M(e,u,s),s=a.charCodeAt(u);46===s&&(c=!0,s=a.charCodeAt(++u),u=M(e,u,s),s=a.charCodeAt(u));69!==s&&101!==s||(c=!0,43!==(s=a.charCodeAt(++u))&&45!==s||(s=a.charCodeAt(++u)),u=M(e,u,s),s=a.charCodeAt(u));if(46===s||69===s||101===s)throw E(e,u,"Invalid number, expected digit but got: ".concat(A(s),"."));return new D(c?T.FLOAT:T.INT,t,u,r,i,o,a.slice(t,u))}(n,o,u,a,s,t);case 34:return 34===r.charCodeAt(o+1)&&34===r.charCodeAt(o+2)?function(e,t,n,r,i,o){var a=e.body,s=t+3,u=s,c=0,l="";for(;s=48&&o<=57){do{o=r.charCodeAt(++i)}while(o>=48&&o<=57);return i}throw E(e,i,"Invalid number, expected digit but got: ".concat(A(o),"."))}function F(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}p(D,(function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}));var j=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function C(e,t){return new Q(e,t).parseDocument()}var Q=function(){function e(e,t){var n="string"==typeof e?new O(e):e;n instanceof O||f(0,"Must provide Source. Received: ".concat(c(n))),this._lexer=function(e,t){var n=new D(T.SOF,0,0,0,0,null);return{source:e,options:t,lastToken:n,token:n,line:1,lineStart:0,advance:I,lookahead:x}}(n),this._options=t||{}}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(T.NAME);return{kind:w.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:w.DOCUMENT,definitions:this.many(T.SOF,this.parseDefinition,T.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(T.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(T.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var e=this._lexer.token;if(this.peek(T.BRACE_L))return{kind:w.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(T.NAME)&&(t=this.parseName()),{kind:w.OPERATION_DEFINITION,operation:n,name:t,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseOperationType=function(){var e=this.expectToken(T.NAME);switch(e.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(e)},t.parseVariableDefinitions=function(){return this.optionalMany(T.PAREN_L,this.parseVariableDefinition,T.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:w.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(T.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(T.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(e)}},t.parseVariable=function(){var e=this._lexer.token;return this.expectToken(T.DOLLAR),{kind:w.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:w.SELECTION_SET,selections:this.many(T.BRACE_L,this.parseSelection,T.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(T.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,r=this.parseName();return this.expectOptionalToken(T.COLON)?(e=r,t=this.parseName()):t=r,{kind:w.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(T.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(T.PAREN_L,t,T.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(T.COLON),{kind:w.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:w.ARGUMENT,name:this.parseName(),value:(this.expectToken(T.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(T.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(T.NAME)?{kind:w.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:w.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseFragmentDefinition=function(){var e=this._lexer.token;return this.expectKeyword("fragment"),this._options.experimentalFragmentVariables?{kind:w.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}:{kind:w.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseFragmentName=function(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(e){var t=this._lexer.token;switch(t.kind){case T.BRACKET_L:return this.parseList(e);case T.BRACE_L:return this.parseObject(e);case T.INT:return this._lexer.advance(),{kind:w.INT,value:t.value,loc:this.loc(t)};case T.FLOAT:return this._lexer.advance(),{kind:w.FLOAT,value:t.value,loc:this.loc(t)};case T.STRING:case T.BLOCK_STRING:return this.parseStringLiteral();case T.NAME:return"true"===t.value||"false"===t.value?(this._lexer.advance(),{kind:w.BOOLEAN,value:"true"===t.value,loc:this.loc(t)}):"null"===t.value?(this._lexer.advance(),{kind:w.NULL,loc:this.loc(t)}):(this._lexer.advance(),{kind:w.ENUM,value:t.value,loc:this.loc(t)});case T.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:w.STRING,value:e.value,block:e.kind===T.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:w.LIST,values:this.any(T.BRACKET_L,(function(){return t.parseValueLiteral(e)}),T.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:w.OBJECT,fields:this.any(T.BRACE_L,(function(){return t.parseObjectField(e)}),T.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(T.COLON),{kind:w.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(T.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(T.AT),{kind:w.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(T.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(T.BRACKET_R),e={kind:w.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(T.BANG)?{kind:w.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:w.NAMED_TYPE,name:this.parseName(),loc:this.loc(e)}},t.parseTypeSystemDefinition=function(){var e=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(e.kind===T.NAME)switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(e)},t.peekDescription=function(){return this.peek(T.STRING)||this.peek(T.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var e=this._lexer.token;this.expectKeyword("schema");var t=this.parseDirectives(!0),n=this.many(T.BRACE_L,this.parseOperationTypeDefinition,T.BRACE_R);return{kind:w.SCHEMA_DEFINITION,directives:t,operationTypes:n,loc:this.loc(e)}},t.parseOperationTypeDefinition=function(){var e=this._lexer.token,t=this.parseOperationType();this.expectToken(T.COLON);var n=this.parseNamedType();return{kind:w.OPERATION_TYPE_DEFINITION,operation:t,type:n,loc:this.loc(e)}},t.parseScalarTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");var n=this.parseName(),r=this.parseDirectives(!0);return{kind:w.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");var n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:w.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o,loc:this.loc(e)}},t.parseImplementsInterfaces=function(){var e=[];if(this.expectOptionalKeyword("implements")){this.expectOptionalToken(T.AMP);do{e.push(this.parseNamedType())}while(this.expectOptionalToken(T.AMP)||this._options.allowLegacySDLImplementsInterfaces&&this.peek(T.NAME))}return e},t.parseFieldsDefinition=function(){return this._options.allowLegacySDLEmptyFields&&this.peek(T.BRACE_L)&&this._lexer.lookahead().kind===T.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(T.BRACE_L,this.parseFieldDefinition,T.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(T.COLON);var i=this.parseTypeReference(),o=this.parseDirectives(!0);return{kind:w.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:o,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(T.PAREN_L,this.parseInputValueDef,T.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(T.COLON);var r,i=this.parseTypeReference();this.expectOptionalToken(T.EQUALS)&&(r=this.parseValueLiteral(!0));var o=this.parseDirectives(!0);return{kind:w.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:o,loc:this.loc(e)}},t.parseInterfaceTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();return{kind:w.INTERFACE_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i,loc:this.loc(e)}},t.parseUnionTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseUnionMemberTypes();return{kind:w.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){var e=[];if(this.expectOptionalToken(T.EQUALS)){this.expectOptionalToken(T.PIPE);do{e.push(this.parseNamedType())}while(this.expectOptionalToken(T.PIPE))}return e},t.parseEnumTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseEnumValuesDefinition();return{kind:w.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(T.BRACE_L,this.parseEnumValueDefinition,T.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseDirectives(!0);return{kind:w.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseInputObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseInputFieldsDefinition();return{kind:w.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(T.BRACE_L,this.parseInputValueDef,T.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===T.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)},t.parseSchemaExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var t=this.parseDirectives(!0),n=this.optionalMany(T.BRACE_L,this.parseOperationTypeDefinition,T.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:w.SCHEMA_EXTENSION,directives:t,operationTypes:n,loc:this.loc(e)}},t.parseScalarTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var t=this.parseName(),n=this.parseDirectives(!0);if(0===n.length)throw this.unexpected();return{kind:w.SCALAR_TYPE_EXTENSION,name:t,directives:n,loc:this.loc(e)}},t.parseObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return{kind:w.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInterfaceTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:w.INTERFACE_TYPE_EXTENSION,name:t,directives:n,fields:r,loc:this.loc(e)}},t.parseUnionTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:w.UNION_TYPE_EXTENSION,name:t,directives:n,types:r,loc:this.loc(e)}},t.parseEnumTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:w.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r,loc:this.loc(e)}},t.parseInputObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:w.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r,loc:this.loc(e)}},t.parseDirectiveDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(T.AT);var n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var o=this.parseDirectiveLocations();return{kind:w.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:o,loc:this.loc(e)}},t.parseDirectiveLocations=function(){this.expectOptionalToken(T.PIPE);var e=[];do{e.push(this.parseDirectiveLocation())}while(this.expectOptionalToken(T.PIPE));return e},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==j[t.value])return t;throw this.unexpected(e)},t.loc=function(e){if(!this._options.noLocation)return new q(e,this._lexer.lastToken,this._lexer.source)},t.peek=function(e){return this._lexer.token.kind===e},t.expectToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw E(this._lexer.source,t.start,"Expected ".concat(e,", found ").concat(P(t)))},t.expectOptionalToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t},t.expectKeyword=function(e){var t=this._lexer.token;if(t.kind!==T.NAME||t.value!==e)throw E(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(P(t)));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===T.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=e||this._lexer.token;return E(this._lexer.source,t.start,"Unexpected ".concat(P(t)))},t.any=function(e,t,n){this.expectToken(e);for(var r=[];!this.expectOptionalToken(n);)r.push(t.call(this));return r},t.optionalMany=function(e,t,n){if(this.expectOptionalToken(e)){var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}return[]},t.many=function(e,t,n){this.expectToken(e);var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r},e}();function q(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}function P(e){var t=e.value;return t?"".concat(e.kind,' "').concat(t,'"'):e.kind}p(q,(function(){return{start:this.start,end:this.end}}));var V=Object.freeze({__proto__:null,parse:C,parseValue:function(e,t){var n=new Q(e,t);n.expectToken(T.SOF);var r=n.parseValueLiteral(!1);return n.expectToken(T.EOF),r},parseType:function(e,t){var n=new Q(e,t);n.expectToken(T.SOF);var r=n.parseTypeReference();return n.expectToken(T.EOF),r}}),L={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},$=Object.freeze({});function B(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:L,r=void 0,i=Array.isArray(e),o=[e],a=-1,s=[],u=void 0,l=void 0,f=void 0,p=[],h=[],d=e;do{var v=++a===o.length,y=v&&0!==s.length;if(v){if(l=0===h.length?void 0:p[p.length-1],u=f,f=h.pop(),y){if(i)u=u.slice();else{for(var m={},g=0,b=Object.keys(u);g1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=-1===e.indexOf("\n"),i=" "===e[0]||"\t"===e[0],o='"'===e[e.length-1],a=!r||o||n,s="";return!a||r&&i||(s+="\n"+t),s+=t?e.replace(/\n/g,"\n"+t):e,a&&(s+="\n"),'"""'+s.replace(/"""/g,'\\"""')+'"""'}(n,"description"===t?"":" "):JSON.stringify(n)},BooleanValue:function(e){return e.value?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){return e.value},ListValue:function(e){return"["+W(e.values,", ")+"]"},ObjectValue:function(e){return"{"+W(e.fields,", ")+"}"},ObjectField:function(e){return e.name+": "+e.value},Directive:function(e){return"@"+e.name+H("(",W(e.arguments,", "),")")},NamedType:function(e){return e.name},ListType:function(e){return"["+e.type+"]"},NonNullType:function(e){return e.type+"!"},SchemaDefinition:function(e){var t=e.directives,n=e.operationTypes;return W(["schema",W(t," "),J(n)]," ")},OperationTypeDefinition:function(e){return e.operation+": "+e.type},ScalarTypeDefinition:Y((function(e){return W(["scalar",e.name,W(e.directives," ")]," ")})),ObjectTypeDefinition:Y((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return W(["type",t,H("implements ",W(n," & ")),W(r," "),J(i)]," ")})),FieldDefinition:Y((function(e){var t=e.name,n=e.arguments,r=e.type,i=e.directives;return t+(ee(n)?H("(\n",X(W(n,"\n")),"\n)"):H("(",W(n,", "),")"))+": "+r+H(" ",W(i," "))})),InputValueDefinition:Y((function(e){var t=e.name,n=e.type,r=e.defaultValue,i=e.directives;return W([t+": "+n,H("= ",r),W(i," ")]," ")})),InterfaceTypeDefinition:Y((function(e){var t=e.name,n=e.directives,r=e.fields;return W(["interface",t,W(n," "),J(r)]," ")})),UnionTypeDefinition:Y((function(e){var t=e.name,n=e.directives,r=e.types;return W(["union",t,W(n," "),r&&0!==r.length?"= "+W(r," | "):""]," ")})),EnumTypeDefinition:Y((function(e){var t=e.name,n=e.directives,r=e.values;return W(["enum",t,W(n," "),J(r)]," ")})),EnumValueDefinition:Y((function(e){return W([e.name,W(e.directives," ")]," ")})),InputObjectTypeDefinition:Y((function(e){var t=e.name,n=e.directives,r=e.fields;return W(["input",t,W(n," "),J(r)]," ")})),DirectiveDefinition:Y((function(e){var t=e.name,n=e.arguments,r=e.repeatable,i=e.locations;return"directive @"+t+(ee(n)?H("(\n",X(W(n,"\n")),"\n)"):H("(",W(n,", "),")"))+(r?" repeatable":"")+" on "+W(i," | ")})),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return W(["extend schema",W(t," "),J(n)]," ")},ScalarTypeExtension:function(e){return W(["extend scalar",e.name,W(e.directives," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return W(["extend type",t,H("implements ",W(n," & ")),W(r," "),J(i)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return W(["extend interface",t,W(n," "),J(r)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,r=e.types;return W(["extend union",t,W(n," "),r&&0!==r.length?"= "+W(r," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,r=e.values;return W(["extend enum",t,W(n," "),J(r)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return W(["extend input",t,W(n," "),J(r)]," ")}};function Y(e){return function(t){return W([t.description,e(t)],"\n")}}function W(e,t){return e?e.filter((function(e){return e})).join(t||""):""}function J(e){return e&&0!==e.length?"{\n"+X(W(e,"\n"))+"\n}":""}function H(e,t,n){return t?e+t+(n||""):""}function X(e){return e&&" "+e.replace(/\n/g,"\n ")}function Z(e){return-1!==e.indexOf("\n")}function ee(e){return e&&e.some(Z)}var te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ne(e,t){return e(t={exports:{}},t.exports),t.exports}var re=ne((function(e,t){var n="[object Arguments]",r="[object Map]",i="[object Object]",o="[object Set]",a=/^\[object .+?Constructor\]$/,s=/^(?:0|[1-9]\d*)$/,u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u[n]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u[r]=u["[object Number]"]=u[i]=u["[object RegExp]"]=u[o]=u["[object String]"]=u["[object WeakMap]"]=!1;var c="object"==typeof te&&te&&te.Object===Object&&te,l="object"==typeof self&&self&&self.Object===Object&&self,f=c||l||Function("return this")(),p=t&&!t.nodeType&&t,h=p&&e&&!e.nodeType&&e,d=h&&h.exports===p,v=d&&c.process,y=function(){try{return v&&v.binding&&v.binding("util")}catch(e){}}(),m=y&&y.isTypedArray;function g(e,t){for(var n=-1,r=null==e?0:e.length;++ns))return!1;var c=o.get(e);if(c&&o.get(t))return c==t;var l=-1,f=!0,p=2&n?new oe:void 0;for(o.set(e,t),o.set(t,e);++l-1},re.prototype.set=function(e,t){var n=this.__data__,r=ue(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ie.prototype.clear=function(){this.size=0,this.__data__={hash:new ne,map:new(B||re),string:new ne}},ie.prototype.delete=function(e){var t=ye(this,e).delete(e);return this.size-=t?1:0,t},ie.prototype.get=function(e){return ye(this,e).get(e)},ie.prototype.has=function(e){return ye(this,e).has(e)},ie.prototype.set=function(e,t){var n=ye(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},oe.prototype.add=oe.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},oe.prototype.has=function(e){return this.__data__.has(e)},ae.prototype.clear=function(){this.__data__=new re,this.size=0},ae.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},ae.prototype.get=function(e){return this.__data__.get(e)},ae.prototype.has=function(e){return this.__data__.has(e)},ae.prototype.set=function(e,t){var n=this.__data__;if(n instanceof re){var r=n.__data__;if(!B||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ie(r)}return n.set(e,t),this.size=n.size,this};var ge=P?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991}function Ie(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function xe(e){return null!=e&&"object"==typeof e}var De=m?function(e){return function(t){return e(t)}}(m):function(e){return xe(e)&&Te(e.length)&&!!u[ce(e)]};function Ae(e){return null!=(t=e)&&Te(t.length)&&!Se(t)?se(e):he(e);var t}e.exports=function(e,t){return fe(e,t)}})),ie=ne((function(e,t){var n="[object Arguments]",r="[object Function]",i="[object GeneratorFunction]",o="[object Map]",a="[object Set]",s=/\w*$/,u=/^\[object .+?Constructor\]$/,c=/^(?:0|[1-9]\d*)$/,l={};l[n]=l["[object Array]"]=l["[object ArrayBuffer]"]=l["[object DataView]"]=l["[object Boolean]"]=l["[object Date]"]=l["[object Float32Array]"]=l["[object Float64Array]"]=l["[object Int8Array]"]=l["[object Int16Array]"]=l["[object Int32Array]"]=l[o]=l["[object Number]"]=l["[object Object]"]=l["[object RegExp]"]=l[a]=l["[object String]"]=l["[object Symbol]"]=l["[object Uint8Array]"]=l["[object Uint8ClampedArray]"]=l["[object Uint16Array]"]=l["[object Uint32Array]"]=!0,l["[object Error]"]=l[r]=l["[object WeakMap]"]=!1;var f="object"==typeof te&&te&&te.Object===Object&&te,p="object"==typeof self&&self&&self.Object===Object&&self,h=f||p||Function("return this")(),d=t&&!t.nodeType&&t,v=d&&e&&!e.nodeType&&e,y=v&&v.exports===d;function m(e,t){return e.set(t[0],t[1]),e}function g(e,t){return e.add(t),e}function b(e,t,n,r){var i=-1,o=e?e.length:0;for(r&&o&&(n=e[++i]);++i-1},oe.prototype.set=function(e,t){var n=this.__data__,r=le(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},ae.prototype.clear=function(){this.__data__={hash:new ie,map:new(G||oe),string:new ie}},ae.prototype.delete=function(e){return ve(this,e).delete(e)},ae.prototype.get=function(e){return ve(this,e).get(e)},ae.prototype.has=function(e){return ve(this,e).has(e)},ae.prototype.set=function(e,t){return ve(this,e).set(e,t),this},se.prototype.clear=function(){this.__data__=new oe},se.prototype.delete=function(e){return this.__data__.delete(e)},se.prototype.get=function(e){return this.__data__.get(e)},se.prototype.has=function(e){return this.__data__.has(e)},se.prototype.set=function(e,t){var n=this.__data__;if(n instanceof oe){var r=n.__data__;if(!G||r.length<199)return r.push([e,t]),this;n=this.__data__=new ae(r)}return n.set(e,t),this};var me=L?_(L,Object):function(){return[]},ge=function(e){return R.call(e)};function be(e,t){return!!(t=null==t?9007199254740991:t)&&("number"==typeof e||c.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991}(e.length)&&!Se(e)}var Ne=$||function(){return!1};function Se(e){var t=Te(e)?R.call(e):"";return t==r||t==i}function Te(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ie(e){return ke(e)?ue(e):function(e){if(!Ee(e))return B(e);var t=[];for(var n in Object(e))A.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return fe(e,!1,!0)}})),oe=ne((function(e,t){!function(t,n){e.exports=n()}(0,(function(){var e=[],t=[],n={},r={},i={};function o(e){return"string"==typeof e?new RegExp("^"+e+"$","i"):e}function a(e,t){return e===t?t:e===e.toUpperCase()?t.toUpperCase():e[0]===e[0].toUpperCase()?t.charAt(0).toUpperCase()+t.substr(1).toLowerCase():t.toLowerCase()}function s(e,t){return e.replace(/\$(\d{1,2})/g,(function(e,n){return t[n]||""}))}function u(e,t){return e.replace(t[0],(function(n,r){var i=s(t[1],arguments);return a(""===n?e[r-1]:n,i)}))}function c(e,t,r){if(!e.length||n.hasOwnProperty(e))return t;for(var i=r.length;i--;){var o=r[i];if(o[0].test(t))return u(t,o)}return t}function l(e,t,n){return function(r){var i=r.toLowerCase();return t.hasOwnProperty(i)?a(r,i):e.hasOwnProperty(i)?a(r,e[i]):c(i,r,n)}}function f(e,t,n,r){return function(r){var i=r.toLowerCase();return!!t.hasOwnProperty(i)||!e.hasOwnProperty(i)&&c(i,i,n)===i}}function p(e,t,n){return(n?t+" ":"")+(1===t?p.singular(e):p.plural(e))}return p.plural=l(i,r,e),p.isPlural=f(i,r,e),p.singular=l(r,i,t),p.isSingular=f(r,i,t),p.addPluralRule=function(t,n){e.push([o(t),n])},p.addSingularRule=function(e,n){t.push([o(e),n])},p.addUncountableRule=function(e){"string"!=typeof e?(p.addPluralRule(e,"$0"),p.addSingularRule(e,"$0")):n[e.toLowerCase()]=!0},p.addIrregularRule=function(e,t){t=t.toLowerCase(),e=e.toLowerCase(),i[e]=t,r[t]=e},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["whiskey","whiskies"]].forEach((function(e){return p.addIrregularRule(e[0],e[1])})),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|tlas|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[emjzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|octop|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/(m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach((function(e){return p.addPluralRule(e[0],e[1])})),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/(m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|tlas|gas|(?:her|at|gr)o|ris)(?:es)?$/i,"$1"],[/(analy|ba|diagno|parenthe|progno|synop|the|empha|cri)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|octop|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach((function(e){return p.addSingularRule(e[0],e[1])})),["adulthood","advice","agenda","aid","alcohol","ammo","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","flounder","fun","gallows","garbage","graffiti","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","manga","news","pike","plankton","pliers","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","species","staff","swine","tennis","traffic","transporation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(p.addUncountableRule),p}))})),ae=oe.plural,se=oe.singular;function ue(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ce(e){return e.charAt(0).toLowerCase()+e.slice(1)}function le(e){return z(fe(e))}function fe(e){return"string"==typeof e?C(e):e}function pe(e){return e.loc.source.body}function he(e){return null!==e&&!(e instanceof Array)&&"object"==typeof e}function de(e,t){if(!e)return{};for(var n=-1,r=t.length,i={};++n=0)return!0;var t=_r.getInstance(),n=!1;return this.getRelations().forEach((function(r){return!(r instanceof t.components.BelongsTo||r instanceof t.components.HasOne)||r.foreignKey!==e||(n=!0,!1)})),n},e.prototype.getRelations=function(){var t=new Map;return this.fields.forEach((function(n,r){e.isFieldAttribute(n)||t.set(r,n)})),t},e.prototype.isTypeFieldOfPolymorphicRelation=function(e){var t=this,n=_r.getInstance(),r=!1;return n.models.forEach((function(i){return!r&&(i.getRelations().forEach((function(i){if(i instanceof n.components.MorphMany||i instanceof n.components.MorphedByMany||i instanceof n.components.MorphOne||i instanceof n.components.MorphTo||i instanceof n.components.MorphToMany){var o=i.related;if(i.type===e&&o&&o.entity===t.baseModel.entity)return r=!0,!1}return!0})),!0)})),r},e.prototype.getRecordWithId=function(e){return this.baseModel.query().withAllRecursive().where("id",me(e)).first()},e.prototype.shouldEagerLoadRelation=function(e,t,n){var r=_r.getInstance();if(t instanceof r.components.HasOne||t instanceof r.components.BelongsTo||t instanceof r.components.MorphOne)return!0;var i=this.baseModel.eagerLoad||[];return Array.prototype.push.apply(i,this.baseModel.eagerSync||[]),void 0!==i.find((function(t){return t===n.singularName||t===n.pluralName||t===e}))},e.prototype.shouldEagerSaveRelation=function(e,t,n){if(t instanceof _r.getInstance().components.BelongsTo)return!0;var r=this.baseModel.eagerSave||[];return Array.prototype.push.apply(r,this.baseModel.eagerSync||[]),void 0!==r.find((function(t){return t===n.singularName||t===n.pluralName||t===e}))},e.prototype.$addMock=function(e){return!this.$findMock(e.action,e.options)&&(this.mocks[e.action]||(this.mocks[e.action]=[]),this.mocks[e.action].push(e),!0)},e.prototype.$findMock=function(e,t){return this.mocks[e]&&this.mocks[e].find((function(e){return!e.options||!t||ve(de(t,Object.keys(e.options)),e.options||{})}))||null},e.prototype.$mockHook=function(e,t){var n,r=null,i=this.$findMock(e,t);return i&&(r=i.returnValue instanceof Function?i.returnValue():i.returnValue||null),r?(r instanceof Array?r.forEach((function(e){return e.$isPersisted=!0})):r.$isPersisted=!0,(n={})[this.pluralName]=r,n):null},e}(),Ee=Object.setPrototypeOf,we=void 0===Ee?function(e,t){return e.__proto__=t,e}:Ee,_e=function(e){function t(n){void 0===n&&(n="Invariant Violation");var r=e.call(this,"number"==typeof n?"Invariant Violation: "+n+" (see https://github.com/apollographql/invariant-packages)":n)||this;return r.framesToPop=1,r.name="Invariant Violation",we(r,t.prototype),r}return n(t,e),t}(Error);function Oe(e,t){if(!e)throw new _e(t)}function ke(e){return function(){return console[e].apply(console,arguments)}}!function(e){e.warn=ke("warn"),e.error=ke("error")}(Oe||(Oe={}));var Ne={env:{}};if("object"==typeof process)Ne=process;else try{Function("stub","process = stub")(Ne)}catch(e){}var Se=Object.prototype,Te=Se.toString,Ie=Se.hasOwnProperty,xe=new Map;function De(e,t){try{return function e(t,n){if(t===n)return!0;var r=Te.call(t),i=Te.call(n);if(r!==i)return!1;switch(r){case"[object Array]":if(t.length!==n.length)return!1;case"[object Object]":if(Ae(t,n))return!0;var o=Object.keys(t),a=Object.keys(n),s=o.length;if(s!==a.length)return!1;for(var u=0;u0){var r=n.connection.filter?n.connection.filter:[];r.sort();var i=t,o={};return r.forEach((function(e){o[e]=i[e]})),n.connection.key+"("+JSON.stringify(o)+")"}return n.connection.key}var a=e;if(t){var s=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var n,r="boolean"==typeof t.cycles&&t.cycles,i=t.cmp&&(n=t.cmp,function(e){return function(t,r){var i={key:t,value:e[t]},o={key:r,value:e[r]};return n(i,o)}}),o=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var n,a;if(Array.isArray(t)){for(a="[",n=0;n-1}))}function Ue(e){return e&&Be(["client"],e)&&Be(["export"],e)}function Ge(e){var t=e.name.value;return"skip"===t||"include"===t}function ze(e,t){var n=t,i=[];return e.definitions.forEach((function(e){if("OperationDefinition"===e.kind)throw"production"===process.env.NODE_ENV?new _e(5):new _e("Found a "+e.operation+" operation"+(e.name?" named '"+e.name.value+"'":"")+". No operations are allowed when using a fragment as a query. Only fragments are allowed.");"FragmentDefinition"===e.kind&&i.push(e)})),void 0===n&&("production"===process.env.NODE_ENV?Oe(1===i.length,6):Oe(1===i.length,"Found "+i.length+" fragments. `fragmentName` must be provided when there is not exactly 1 fragment."),n=i[0].name.value),r(r({},e),{definitions:a([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:n}}]}}],e.definitions)})}function Ke(e){for(var t=[],n=1;n1){var r=[];t=wt(t,r);for(var i=1;i1,i=!1,o=arguments[1],a=o;return new n((function(n){return t.subscribe({next:function(t){var o=!i;if(i=!0,!o||r)try{a=e(a,t)}catch(e){return n.error(e)}else a=t},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(a),n.complete()}})}))}},{key:"concat",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r=0&&i.splice(e,1),a()}});i.push(o)},error:function(e){r.error(e)},complete:function(){a()}});function a(){o.closed&&0===i.length&&r.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),o.unsubscribe()}}))}},{key:c,value:function(){return this}}],[{key:"from",value:function(t){var n="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var r=f(t,c);if(r){var i=r.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return h(i)&&i.constructor===n?i:new n((function(e){return i.subscribe(e)}))}if(a("iterator")&&(r=f(t,u)))return new n((function(e){v((function(){if(!e.closed){var n=!0,i=!1,o=void 0;try{for(var a,s=r.call(t)[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(e.next(u),e.closed)return}}catch(e){i=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}e.complete()}}))}));if(Array.isArray(t))return new n((function(e){v((function(){if(!e.closed){for(var n=0;n0}var $t,Bt=function(e){function t(n){var r,i,o=n.graphQLErrors,a=n.networkError,s=n.errorMessage,u=n.extraInfo,c=e.call(this,s)||this;return c.graphQLErrors=o||[],c.networkError=a||null,c.message=s||(i="",Lt((r=c).graphQLErrors)&&r.graphQLErrors.forEach((function(e){var t=e?e.message:"Error message not found.";i+="GraphQL error: "+t+"\n"})),r.networkError&&(i+="Network error: "+r.networkError.message+"\n"),i=i.replace(/\n$/,"")),c.extraInfo=u,c.__proto__=t.prototype,c}return n(t,e),t}(Error);!function(e){e[e.normal=1]="normal",e[e.refetch=2]="refetch",e[e.poll=3]="poll"}($t||($t={}));var Ut=function(e){function t(t){var n=t.queryManager,r=t.options,i=t.shouldSubscribe,o=void 0===i||i,a=e.call(this,(function(e){return a.onSubscribe(e)}))||this;a.observers=new Set,a.subscriptions=new Set,a.isTornDown=!1,a.options=r,a.variables=r.variables||{},a.queryId=n.generateQueryId(),a.shouldSubscribe=o;var s=We(r.query);return a.queryName=s&&s.name&&s.name.value,a.queryManager=n,a}return n(t,e),t.prototype.result=function(){var e=this;return new Promise((function(t,n){var r={next:function(n){t(n),e.observers.delete(r),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout((function(){i.unsubscribe()}),0)},error:n},i=e.subscribe(r)}))},t.prototype.currentResult=function(){var e=this.getCurrentResult();return void 0===e.data&&(e.data={}),e},t.prototype.getCurrentResult=function(){if(this.isTornDown){var e=this.lastResult;return{data:!this.lastError&&e&&e.data||void 0,error:this.lastError,loading:!1,networkStatus:Qt.error}}var t,n,i,o=this.queryManager.getCurrentQueryResult(this),a=o.data,s=o.partial,u=this.queryManager.queryStore.get(this.queryId),c=this.options.fetchPolicy,l="network-only"===c||"no-cache"===c;if(u){var f=u.networkStatus;if(n=u,void 0===(i=this.options.errorPolicy)&&(i="none"),n&&(n.networkError||"none"===i&&Lt(n.graphQLErrors)))return{data:void 0,loading:!1,networkStatus:f,error:new Bt({graphQLErrors:u.graphQLErrors,networkError:u.networkError})};u.variables&&(this.options.variables=r(r({},this.options.variables),u.variables),this.variables=this.options.variables),t={data:a,loading:Pt(f),networkStatus:f},u.graphQLErrors&&"all"===this.options.errorPolicy&&(t.errors=u.graphQLErrors)}else{var p=l||s&&"cache-only"!==c;t={data:a,loading:p,networkStatus:p?Qt.loading:Qt.ready}}return s||this.updateLastResult(r(r({},t),{stale:!1})),r(r({},t),{partial:s})},t.prototype.isDifferentFromLastResult=function(e){var t=this.lastResultSnapshot;return!(t&&e&&t.networkStatus===e.networkStatus&&t.stale===e.stale&&De(t.data,e.data))},t.prototype.getLastResult=function(){return this.lastResult},t.prototype.getLastError=function(){return this.lastError},t.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},t.prototype.resetQueryStoreErrors=function(){var e=this.queryManager.queryStore.get(this.queryId);e&&(e.networkError=null,e.graphQLErrors=[])},t.prototype.refetch=function(e){var t=this.options.fetchPolicy;return"cache-only"===t?Promise.reject("production"===process.env.NODE_ENV?new _e(3):new _e("cache-only fetchPolicy option should not be used together with query refetch.")):("no-cache"!==t&&"cache-and-network"!==t&&(t="network-only"),De(this.variables,e)||(this.variables=r(r({},this.variables),e)),De(this.options.variables,this.variables)||(this.options.variables=r(r({},this.options.variables),this.variables)),this.queryManager.fetchQuery(this.queryId,r(r({},this.options),{fetchPolicy:t}),$t.refetch))},t.prototype.fetchMore=function(e){var t=this;"production"===process.env.NODE_ENV?Oe(e.updateQuery,4):Oe(e.updateQuery,"updateQuery option is required. This function defines how to update the query data with the new results.");var n=r(r({},e.query?e:r(r(r({},this.options),e),{variables:r(r({},this.variables),e.variables)})),{fetchPolicy:"network-only"}),i=this.queryManager.generateQueryId();return this.queryManager.fetchQuery(i,n,$t.normal,this.queryId).then((function(r){return t.updateQuery((function(t){return e.updateQuery(t,{fetchMoreResult:r.data,variables:n.variables})})),t.queryManager.stopQuery(i),r}),(function(e){throw t.queryManager.stopQuery(i),e}))},t.prototype.subscribeToMore=function(e){var t=this,n=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables}).subscribe({next:function(n){var r=e.updateQuery;r&&t.updateQuery((function(e,t){var i=t.variables;return r(e,{subscriptionData:n,variables:i})}))},error:function(t){e.onError?e.onError(t):"production"===process.env.NODE_ENV||Oe.error("Unhandled GraphQL subscription error",t)}});return this.subscriptions.add(n),function(){t.subscriptions.delete(n)&&n.unsubscribe()}},t.prototype.setOptions=function(e){var t=this.options.fetchPolicy;this.options=r(r({},this.options),e),e.pollInterval?this.startPolling(e.pollInterval):0===e.pollInterval&&this.stopPolling();var n=e.fetchPolicy;return this.setVariables(this.options.variables,t!==n&&("cache-only"===t||"standby"===t||"network-only"===n),e.fetchResults)},t.prototype.setVariables=function(e,t,n){return void 0===t&&(t=!1),void 0===n&&(n=!0),this.isTornDown=!1,e=e||this.variables,!t&&De(e,this.variables)?this.observers.size&&n?this.result():Promise.resolve():(this.variables=this.options.variables=e,this.observers.size?this.queryManager.fetchQuery(this.queryId,this.options):Promise.resolve())},t.prototype.updateQuery=function(e){var t=this.queryManager,n=t.getQueryWithPreviousResult(this.queryId),r=n.previousResult,i=n.variables,o=n.document,a=ht((function(){return e(r,{variables:i})}));a&&(t.dataStore.markUpdateQueryResult(o,i,a),t.broadcastQueries())},t.prototype.stopPolling=function(){this.queryManager.stopPollingQuery(this.queryId),this.options.pollInterval=void 0},t.prototype.startPolling=function(e){Kt(this),this.options.pollInterval=e,this.queryManager.startPollingQuery(this.options,this.queryId)},t.prototype.updateLastResult=function(e){var t=this.lastResult;return this.lastResult=e,this.lastResultSnapshot=this.queryManager.assumeImmutableResults?e:lt(e),t},t.prototype.onSubscribe=function(e){var t=this;try{var n=e._subscription._observer;n&&!n.error&&(n.error=Gt)}catch(e){}var r=!this.observers.size;return this.observers.add(e),e.next&&this.lastResult&&e.next(this.lastResult),e.error&&this.lastError&&e.error(this.lastError),r&&this.setUpQuery(),function(){t.observers.delete(e)&&!t.observers.size&&t.tearDownQuery()}},t.prototype.setUpQuery=function(){var e=this,t=this.queryManager,n=this.queryId;this.shouldSubscribe&&t.addObservableQuery(n,this),this.options.pollInterval&&(Kt(this),t.startPollingQuery(this.options,n));var i=function(t){e.updateLastResult(r(r({},e.lastResult),{errors:t.graphQLErrors,networkStatus:Qt.error,loading:!1})),zt(e.observers,"error",e.lastError=t)};t.observeQuery(n,this.options,{next:function(n){if(e.lastError||e.isDifferentFromLastResult(n)){var r=e.updateLastResult(n),i=e.options,o=i.query,a=i.variables,s=i.fetchPolicy;t.transform(o).hasClientExports?t.getLocalState().addExportedVariables(o,a).then((function(i){var a=e.variables;e.variables=e.options.variables=i,!n.loading&&r&&"cache-only"!==s&&t.transform(o).serverQuery&&!De(a,i)?e.refetch():zt(e.observers,"next",n)})):zt(e.observers,"next",n)}},error:i}).catch(i)},t.prototype.tearDownQuery=function(){var e=this.queryManager;this.isTornDown=!0,e.stopPollingQuery(this.queryId),this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),e.removeObservableQuery(this.queryId),e.stopQuery(this.queryId),this.observers.clear()},t}(Vt);function Gt(e){"production"===process.env.NODE_ENV||Oe.error("Unhandled error",e.message,e.stack)}function zt(e,t,n){var r=[];e.forEach((function(e){return e[t]&&r.push(e)})),r.forEach((function(e){return e[t](n)}))}function Kt(e){var t=e.options.fetchPolicy;"production"===process.env.NODE_ENV?Oe("cache-first"!==t&&"cache-only"!==t,5):Oe("cache-first"!==t&&"cache-only"!==t,"Queries that specify the cache-first and cache-only fetchPolicies cannot also be polling queries.")}var Yt=function(){function e(){this.store={}}return e.prototype.getStore=function(){return this.store},e.prototype.get=function(e){return this.store[e]},e.prototype.initMutation=function(e,t,n){this.store[e]={mutation:t,variables:n||{},loading:!0,error:null}},e.prototype.markMutationError=function(e,t){var n=this.store[e];n&&(n.loading=!1,n.error=t)},e.prototype.markMutationResult=function(e){var t=this.store[e];t&&(t.loading=!1,t.error=null)},e.prototype.reset=function(){this.store={}},e}(),Wt=function(){function e(){this.store={}}return e.prototype.getStore=function(){return this.store},e.prototype.get=function(e){return this.store[e]},e.prototype.initQuery=function(e){var t=this.store[e.queryId];"production"===process.env.NODE_ENV?Oe(!t||t.document===e.document||De(t.document,e.document),19):Oe(!t||t.document===e.document||De(t.document,e.document),"Internal Error: may not update existing query string in store");var n,r=!1,i=null;e.storePreviousVariables&&t&&t.networkStatus!==Qt.loading&&(De(t.variables,e.variables)||(r=!0,i=t.variables)),n=r?Qt.setVariables:e.isPoll?Qt.poll:e.isRefetch?Qt.refetch:Qt.loading;var o=[];t&&t.graphQLErrors&&(o=t.graphQLErrors),this.store[e.queryId]={document:e.document,variables:e.variables,previousVariables:i,networkError:null,graphQLErrors:o,networkStatus:n,metadata:e.metadata},"string"==typeof e.fetchMoreForQueryId&&this.store[e.fetchMoreForQueryId]&&(this.store[e.fetchMoreForQueryId].networkStatus=Qt.fetchMore)},e.prototype.markQueryResult=function(e,t,n){this.store&&this.store[e]&&(this.store[e].networkError=null,this.store[e].graphQLErrors=Lt(t.errors)?t.errors:[],this.store[e].previousVariables=null,this.store[e].networkStatus=Qt.ready,"string"==typeof n&&this.store[n]&&(this.store[n].networkStatus=Qt.ready))},e.prototype.markQueryError=function(e,t,n){this.store&&this.store[e]&&(this.store[e].networkError=t,this.store[e].networkStatus=Qt.error,"string"==typeof n&&this.markQueryResultClient(n,!0))},e.prototype.markQueryResultClient=function(e,t){var n=this.store&&this.store[e];n&&(n.networkError=null,n.previousVariables=null,t&&(n.networkStatus=Qt.ready))},e.prototype.stopQuery=function(e){delete this.store[e]},e.prototype.reset=function(e){var t=this;Object.keys(this.store).forEach((function(n){e.indexOf(n)<0?t.stopQuery(n):t.store[n].networkStatus=Qt.loading}))},e}();var Jt=function(){function e(e){var t=e.cache,n=e.client,r=e.resolvers,i=e.fragmentMatcher;this.cache=t,n&&(this.client=n),r&&this.addResolvers(r),i&&this.setFragmentMatcher(i)}return e.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=mt(t.resolvers,e)})):this.resolvers=mt(this.resolvers,e)},e.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},e.prototype.getResolvers=function(){return this.resolvers||{}},e.prototype.runResolvers=function(e){var t=e.document,n=e.remoteResult,a=e.context,s=e.variables,u=e.onlyRunForcedResolvers,c=void 0!==u&&u;return i(this,void 0,void 0,(function(){return o(this,(function(e){return t?[2,this.resolveDocument(t,n.data,a,s,this.fragmentMatcher,c).then((function(e){return r(r({},n),{data:e.result})}))]:[2,n]}))}))},e.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},e.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},e.prototype.clientQuery=function(e){if(Be(["client"],e)){if(this.resolvers)return e;"production"===process.env.NODE_ENV||Oe.warn("Found @client directives in a query but no ApolloClient resolvers were specified. This means ApolloClient local resolver handling has been disabled, and @client directives will be passed through to your link chain.")}return null},e.prototype.serverQuery=function(e){return this.resolvers?function(e){Ye(e);var t=ot([{test:function(e){return"client"===e.name.value},remove:!0}],e);return t&&(t=B(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return Qe(e)&&"__typename"===e.name.value})))return null}}})),t}(e):e},e.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.cache;return r(r({},e),{cache:t,getCacheKey:function(e){if(t.config)return t.config.dataIdFromObject(e);"production"===process.env.NODE_ENV?Oe(!1,6):Oe(!1,"To use context.getCacheKey, you need to use a cache that has a configurable dataIdFromObject, like apollo-cache-inmemory.")}})},e.prototype.addExportedVariables=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),i(this,void 0,void 0,(function(){return o(this,(function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(n),t).then((function(e){return r(r({},t),e.exportedVariables)}))]:[2,r({},t)]}))}))},e.prototype.shouldForceResolvers=function(e){var t=!1;return B(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 $}}}),t},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:st(e),variables:t,returnPartialData:!0,optimistic:!1}).result},e.prototype.resolveDocument=function(e,t,n,a,s,u){return void 0===n&&(n={}),void 0===a&&(a={}),void 0===s&&(s=function(){return!0}),void 0===u&&(u=!1),i(this,void 0,void 0,(function(){var i,c,l,f,p,h,d,v,y;return o(this,(function(o){var m;return i=Xe(e),c=He(e),l=Ze(c),f=i.operation,p=f?(m=f).charAt(0).toUpperCase()+m.slice(1):"Query",d=(h=this).cache,v=h.client,y={fragmentMap:l,context:r(r({},n),{cache:d,client:v}),variables:a,fragmentMatcher:s,defaultOperationType:p,exportedVariables:{},onlyRunForcedResolvers:u},[2,this.resolveSelectionSet(i.selectionSet,t,y).then((function(e){return{result:e,exportedVariables:y.exportedVariables}}))]}))}))},e.prototype.resolveSelectionSet=function(e,t,n){return i(this,void 0,void 0,(function(){var r,a,s,u,c,l=this;return o(this,(function(f){return r=n.fragmentMap,a=n.context,s=n.variables,u=[t],c=function(e){return i(l,void 0,void 0,(function(){var i,c;return o(this,(function(o){return $e(e,s)?Qe(e)?[2,this.resolveField(e,t,n).then((function(t){var n;void 0!==t&&u.push(((n={})[Ce(e)]=t,n))}))]:(qe(e)?i=e:(i=r[e.name.value],"production"===process.env.NODE_ENV?Oe(i,7):Oe(i,"No fragment named "+e.name.value)),i&&i.typeCondition&&(c=i.typeCondition.name.value,n.fragmentMatcher(t,c,a))?[2,this.resolveSelectionSet(i.selectionSet,t,n).then((function(e){u.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(e.selections.map(c)).then((function(){return gt(u)}))]}))}))},e.prototype.resolveField=function(e,t,n){return i(this,void 0,void 0,(function(){var r,i,a,s,u,c,l,f,p,h=this;return o(this,(function(o){return r=n.variables,i=e.name.value,a=Ce(e),s=i!==a,u=t[a]||t[i],c=Promise.resolve(u),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(l=t.__typename||n.defaultOperationType,(f=this.resolvers&&this.resolvers[l])&&(p=f[s?i:a])&&(c=Promise.resolve(p(t,je(e,r),n.context,{field:e,fragmentMap:n.fragmentMap})))),[2,c.then((function(t){return void 0===t&&(t=u),e.directives&&e.directives.forEach((function(e){"export"===e.name.value&&e.arguments&&e.arguments.forEach((function(e){"as"===e.name.value&&"StringValue"===e.value.kind&&(n.exportedVariables[e.value.value]=t)}))})),e.selectionSet?null==t?t:Array.isArray(t)?h.resolveSubSelectedArray(e,t,n):e.selectionSet?h.resolveSelectionSet(e.selectionSet,t,n):void 0:t}))]}))}))},e.prototype.resolveSubSelectedArray=function(e,t,n){var r=this;return Promise.all(t.map((function(t){return null===t?null:Array.isArray(t)?r.resolveSubSelectedArray(e,t,n):e.selectionSet?r.resolveSelectionSet(e.selectionSet,t,n):void 0})))},e}();function Ht(e){var t=new Set,n=null;return new Vt((function(r){return t.add(r),n=n||e.subscribe({next:function(e){t.forEach((function(t){return t.next&&t.next(e)}))},error:function(e){t.forEach((function(t){return t.error&&t.error(e)}))},complete:function(){t.forEach((function(e){return e.complete&&e.complete()}))}}),function(){t.delete(r)&&!t.size&&n&&(n.unsubscribe(),n=null)}}))}var Xt=Object.prototype.hasOwnProperty,Zt=function(){function e(e){var t=e.link,n=e.queryDeduplication,r=void 0!==n&&n,i=e.store,o=e.onBroadcast,a=void 0===o?function(){}:o,s=e.ssrMode,u=void 0!==s&&s,c=e.clientAwareness,l=void 0===c?{}:c,f=e.localState,p=e.assumeImmutableResults;this.mutationStore=new Yt,this.queryStore=new Wt,this.clientAwareness={},this.idCounter=1,this.queries=new Map,this.fetchQueryRejectFns=new Map,this.transformCache=new(ut?WeakMap:Map),this.inFlightLinkObservables=new Map,this.pollingInfoByQueryId=new Map,this.link=t,this.queryDeduplication=r,this.dataStore=i,this.onBroadcast=a,this.clientAwareness=l,this.localState=f||new Jt({cache:i.getCache()}),this.ssrMode=u,this.assumeImmutableResults=!!p}return e.prototype.stop=function(){var e=this;this.queries.forEach((function(t,n){e.stopQueryNoBroadcast(n)})),this.fetchQueryRejectFns.forEach((function(e){e("production"===process.env.NODE_ENV?new _e(8):new _e("QueryManager stopped while query was in flight"))}))},e.prototype.mutate=function(e){var t=e.mutation,n=e.variables,a=e.optimisticResponse,s=e.updateQueries,u=e.refetchQueries,c=void 0===u?[]:u,l=e.awaitRefetchQueries,f=void 0!==l&&l,p=e.update,h=e.errorPolicy,d=void 0===h?"none":h,v=e.fetchPolicy,y=e.context,m=void 0===y?{}:y;return i(this,void 0,void 0,(function(){var e,i,u,l=this;return o(this,(function(o){switch(o.label){case 0:return"production"===process.env.NODE_ENV?Oe(t,9):Oe(t,"mutation option is required. You must specify your GraphQL document in the mutation option."),"production"===process.env.NODE_ENV?Oe(!v||"no-cache"===v,10):Oe(!v||"no-cache"===v,"Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior."),e=this.generateQueryId(),t=this.transform(t).document,this.setQuery(e,(function(){return{document:t}})),n=this.getVariables(t,n),this.transform(t).hasClientExports?[4,this.localState.addExportedVariables(t,n,m)]:[3,2];case 1:n=o.sent(),o.label=2;case 2:return i=function(){var e={};return s&&l.queries.forEach((function(t,n){var r=t.observableQuery;if(r){var i=r.queryName;i&&Xt.call(s,i)&&(e[n]={updater:s[i],query:l.queryStore.get(n)})}})),e},this.mutationStore.initMutation(e,t,n),this.dataStore.markMutationInit({mutationId:e,document:t,variables:n,updateQueries:i(),update:p,optimisticResponse:a}),this.broadcastQueries(),u=this,[2,new Promise((function(o,s){var l,h;u.getObservableFromLink(t,r(r({},m),{optimisticResponse:a}),n,!1).subscribe({next:function(r){dt(r)&&"none"===d?h=new Bt({graphQLErrors:r.errors}):(u.mutationStore.markMutationResult(e),"no-cache"!==v&&u.dataStore.markMutationResult({mutationId:e,result:r,document:t,variables:n,updateQueries:i(),update:p}),l=r)},error:function(t){u.mutationStore.markMutationError(e,t),u.dataStore.markMutationComplete({mutationId:e,optimisticResponse:a}),u.broadcastQueries(),u.setQuery(e,(function(){return{document:null}})),s(new Bt({networkError:t}))},complete:function(){if(h&&u.mutationStore.markMutationError(e,h),u.dataStore.markMutationComplete({mutationId:e,optimisticResponse:a}),u.broadcastQueries(),h)s(h);else{"function"==typeof c&&(c=c(l));var t=[];Lt(c)&&c.forEach((function(e){if("string"==typeof e)u.queries.forEach((function(n){var r=n.observableQuery;r&&r.queryName===e&&t.push(r.refetch())}));else{var n={query:e.query,variables:e.variables,fetchPolicy:"network-only"};e.context&&(n.context=e.context),t.push(u.query(n))}})),Promise.all(f?t:[]).then((function(){u.setQuery(e,(function(){return{document:null}})),"ignore"===d&&l&&dt(l)&&delete l.errors,o(l)}))}}})}))]}}))}))},e.prototype.fetchQuery=function(e,t,n,a){return i(this,void 0,void 0,(function(){var i,s,u,c,l,f,p,h,d,v,y,m,g,b,E,w,_,O,k=this;return o(this,(function(o){switch(o.label){case 0:return i=t.metadata,s=void 0===i?null:i,u=t.fetchPolicy,c=void 0===u?"cache-first":u,l=t.context,f=void 0===l?{}:l,p=this.transform(t.query).document,h=this.getVariables(p,t.variables),this.transform(p).hasClientExports?[4,this.localState.addExportedVariables(p,h,f)]:[3,2];case 1:h=o.sent(),o.label=2;case 2:if(t=r(r({},t),{variables:h}),y=v="network-only"===c||"no-cache"===c,v||(m=this.dataStore.getCache().diff({query:p,variables:h,returnPartialData:!0,optimistic:!1}),g=m.complete,b=m.result,y=!g||"cache-and-network"===c,d=b),E=y&&"cache-only"!==c&&"standby"!==c,Be(["live"],p)&&(E=!0),w=this.idCounter++,_="no-cache"!==c?this.updateQueryWatch(e,p,t):void 0,this.setQuery(e,(function(){return{document:p,lastRequestId:w,invalidated:!0,cancel:_}})),this.invalidate(a),this.queryStore.initQuery({queryId:e,document:p,storePreviousVariables:E,variables:h,isPoll:n===$t.poll,isRefetch:n===$t.refetch,metadata:s,fetchMoreForQueryId:a}),this.broadcastQueries(),E){if(O=this.fetchRequest({requestId:w,queryId:e,document:p,options:t,fetchMoreForQueryId:a}).catch((function(t){throw t.hasOwnProperty("graphQLErrors")?t:(w>=k.getQuery(e).lastRequestId&&(k.queryStore.markQueryError(e,t,a),k.invalidate(e),k.invalidate(a),k.broadcastQueries()),new Bt({networkError:t}))})),"cache-and-network"!==c)return[2,O];O.catch((function(){}))}return this.queryStore.markQueryResultClient(e,!E),this.invalidate(e),this.invalidate(a),this.transform(p).hasForcedResolvers?[2,this.localState.runResolvers({document:p,remoteResult:{data:d},context:f,variables:h,onlyRunForcedResolvers:!0}).then((function(n){return k.markQueryResult(e,n,t,a),k.broadcastQueries(),n}))]:(this.broadcastQueries(),[2,{data:d}])}}))}))},e.prototype.markQueryResult=function(e,t,n,r){var i=n.fetchPolicy,o=n.variables,a=n.errorPolicy;"no-cache"===i?this.setQuery(e,(function(){return{newData:{result:t.data,complete:!0}}})):this.dataStore.markQueryResult(t,this.getQuery(e).document,o,r,"ignore"===a||"all"===a)},e.prototype.queryListenerForObserver=function(e,t,n){var r=this;function i(e,t){if(n[e])try{n[e](t)}catch(e){"production"===process.env.NODE_ENV||Oe.error(e)}else"error"===e&&("production"===process.env.NODE_ENV||Oe.error(t))}return function(n,o){if(r.invalidate(e,!1),n){var a=r.getQuery(e),s=a.observableQuery,u=a.document,c=s?s.options.fetchPolicy:t.fetchPolicy;if("standby"!==c){var l=Pt(n.networkStatus),f=s&&s.getLastResult(),p=!(!f||f.networkStatus===n.networkStatus),h=t.returnPartialData||!o&&n.previousVariables||p&&t.notifyOnNetworkStatusChange||"cache-only"===c||"cache-and-network"===c;if(!l||h){var d=Lt(n.graphQLErrors),v=s&&s.options.errorPolicy||t.errorPolicy||"none";if("none"===v&&d||n.networkError)return i("error",new Bt({graphQLErrors:n.graphQLErrors,networkError:n.networkError}));try{var y=void 0,m=void 0;if(o)"no-cache"!==c&&"network-only"!==c&&r.setQuery(e,(function(){return{newData:null}})),y=o.result,m=!o.complete;else{var g=s&&s.getLastError(),b="none"!==v&&(g&&g.graphQLErrors)!==n.graphQLErrors;if(f&&f.data&&!b)y=f.data,m=!1;else{var E=r.dataStore.getCache().diff({query:u,variables:n.previousVariables||n.variables,returnPartialData:!0,optimistic:!0});y=E.result,m=!E.complete}}var w=m&&!(t.returnPartialData||"cache-only"===c),_={data:w?f&&f.data:y,loading:l,networkStatus:n.networkStatus,stale:w};"all"===v&&d&&(_.errors=n.graphQLErrors),i("next",_)}catch(e){i("error",new Bt({networkError:e}))}}}}}},e.prototype.transform=function(e){var t,n=this.transformCache;if(!n.has(e)){var r=this.dataStore.getCache(),i=r.transformDocument(e),o=(t=r.transformForLink(i),ot([at],Ye(t))),a=this.localState.clientQuery(i),s=this.localState.serverQuery(o),u={document:i,hasClientExports:Ue(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:s,defaultVars:et(We(i))},c=function(e){e&&!n.has(e)&&n.set(e,u)};c(e),c(i),c(a),c(s)}return n.get(e)},e.prototype.getVariables=function(e,t){return r(r({},this.transform(e).defaultVars),t)},e.prototype.watchQuery=function(e,t){void 0===t&&(t=!0),"production"===process.env.NODE_ENV?Oe("standby"!==e.fetchPolicy,11):Oe("standby"!==e.fetchPolicy,'client.watchQuery cannot be called with fetchPolicy set to "standby"'),e.variables=this.getVariables(e.query,e.variables),void 0===e.notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var n=r({},e);return new Ut({queryManager:this,options:n,shouldSubscribe:t})},e.prototype.query=function(e){var t=this;return"production"===process.env.NODE_ENV?Oe(e.query,12):Oe(e.query,"query option is required. You must specify your GraphQL document in the query option."),"production"===process.env.NODE_ENV?Oe("Document"===e.query.kind,13):Oe("Document"===e.query.kind,'You must wrap the query string in a "gql" tag.'),"production"===process.env.NODE_ENV?Oe(!e.returnPartialData,14):Oe(!e.returnPartialData,"returnPartialData option only supported on watchQuery."),"production"===process.env.NODE_ENV?Oe(!e.pollInterval,15):Oe(!e.pollInterval,"pollInterval option only supported on watchQuery."),new Promise((function(n,r){var i=t.watchQuery(e,!1);t.fetchQueryRejectFns.set("query:"+i.queryId,r),i.result().then(n,r).then((function(){return t.fetchQueryRejectFns.delete("query:"+i.queryId)}))}))},e.prototype.generateQueryId=function(){return String(this.idCounter++)},e.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryInStoreNoBroadcast=function(e){this.stopPollingQuery(e),this.queryStore.stopQuery(e),this.invalidate(e)},e.prototype.addQueryListener=function(e,t){this.setQuery(e,(function(e){return e.listeners.add(t),{invalidated:!1}}))},e.prototype.updateQueryWatch=function(e,t,n){var r=this,i=this.getQuery(e).cancel;i&&i();return this.dataStore.getCache().watch({query:t,variables:n.variables,optimistic:!0,previousResult:function(){var t=null,n=r.getQuery(e).observableQuery;if(n){var i=n.getLastResult();i&&(t=i.data)}return t},callback:function(t){r.setQuery(e,(function(){return{invalidated:!0,newData:t}}))}})},e.prototype.addObservableQuery=function(e,t){this.setQuery(e,(function(){return{observableQuery:t}}))},e.prototype.removeObservableQuery=function(e){var t=this.getQuery(e).cancel;this.setQuery(e,(function(){return{observableQuery:null}})),t&&t()},e.prototype.clearStore=function(){this.fetchQueryRejectFns.forEach((function(e){e("production"===process.env.NODE_ENV?new _e(16):new _e("Store reset while query was in flight (not completed in link chain)"))}));var e=[];return this.queries.forEach((function(t,n){t.observableQuery&&e.push(n)})),this.queryStore.reset(e),this.mutationStore.reset(),this.dataStore.reset()},e.prototype.resetStore=function(){var e=this;return this.clearStore().then((function(){return e.reFetchObservableQueries()}))},e.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var n=[];return this.queries.forEach((function(r,i){var o=r.observableQuery;if(o){var a=o.options.fetchPolicy;o.resetLastResults(),"cache-only"===a||!e&&"standby"===a||n.push(o.refetch()),t.setQuery(i,(function(){return{newData:null}})),t.invalidate(i)}})),this.broadcastQueries(),Promise.all(n)},e.prototype.observeQuery=function(e,t,n){return this.addQueryListener(e,this.queryListenerForObserver(e,t,n)),this.fetchQuery(e,t)},e.prototype.startQuery=function(e,t,n){return"production"===process.env.NODE_ENV||Oe.warn("The QueryManager.startQuery method has been deprecated"),this.addQueryListener(e,n),this.fetchQuery(e,t).catch((function(){})),e},e.prototype.startGraphQLSubscription=function(e){var t=this,n=e.query,r=e.fetchPolicy,i=e.variables;n=this.transform(n).document,i=this.getVariables(n,i);var o=function(e){return t.getObservableFromLink(n,{},e,!1).map((function(i){if(r&&"no-cache"===r||(t.dataStore.markSubscriptionResult(i,n,e),t.broadcastQueries()),dt(i))throw new Bt({graphQLErrors:i.errors});return i}))};if(this.transform(n).hasClientExports){var a=this.localState.addExportedVariables(n,i).then(o);return new Vt((function(e){var t=null;return a.then((function(n){return t=n.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return o(i)},e.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},e.prototype.removeQuery=function(e){this.fetchQueryRejectFns.delete("query:"+e),this.fetchQueryRejectFns.delete("fetchRequest:"+e),this.getQuery(e).subscriptions.forEach((function(e){return e.unsubscribe()})),this.queries.delete(e)},e.prototype.getCurrentQueryResult=function(e,t){void 0===t&&(t=!0);var n=e.options,r=n.variables,i=n.query,o=n.fetchPolicy,a=n.returnPartialData,s=e.getLastResult(),u=this.getQuery(e.queryId).newData;if(u&&u.complete)return{data:u.result,partial:!1};if("no-cache"===o||"network-only"===o)return{data:void 0,partial:!1};var c=this.dataStore.getCache().diff({query:i,variables:r,previousResult:s?s.data:void 0,returnPartialData:!0,optimistic:t}),l=c.result,f=c.complete;return{data:f||a?l:void 0,partial:!f}},e.prototype.getQueryWithPreviousResult=function(e){var t;if("string"==typeof e){var n=this.getQuery(e).observableQuery;"production"===process.env.NODE_ENV?Oe(n,17):Oe(n,"ObservableQuery with this id doesn't exist: "+e),t=n}else t=e;var r=t.options,i=r.variables,o=r.query;return{previousResult:this.getCurrentQueryResult(t,!1).data,variables:i,document:o}},e.prototype.broadcastQueries=function(){var e=this;this.onBroadcast(),this.queries.forEach((function(t,n){t.invalidated&&t.listeners.forEach((function(r){r&&r(e.queryStore.get(n),t.newData)}))}))},e.prototype.getLocalState=function(){return this.localState},e.prototype.getObservableFromLink=function(e,t,n,i){var o,a=this;void 0===i&&(i=this.queryDeduplication);var s=this.transform(e).serverQuery;if(s){var u=this.inFlightLinkObservables,c=this.link,l={query:s,variables:n,operationName:Je(s)||void 0,context:this.prepareContext(r(r({},t),{forceFetch:!i}))};if(t=l.context,i){var f=u.get(s)||new Map;u.set(s,f);var p=JSON.stringify(n);if(!(o=f.get(p))){f.set(p,o=Ht(Ct(c,l)));var h=function(){f.delete(p),f.size||u.delete(s),d.unsubscribe()},d=o.subscribe({next:h,error:h,complete:h})}}else o=Ht(Ct(c,l))}else o=Vt.of({data:{}}),t=this.prepareContext(t);var v=this.transform(e).clientQuery;return v&&(o=function(e,t){return new Vt((function(n){var r=n.next,i=n.error,o=n.complete,a=0,s=!1,u={next:function(e){++a,new Promise((function(n){n(t(e))})).then((function(e){--a,r&&r.call(n,e),s&&u.complete()}),(function(e){--a,i&&i.call(n,e)}))},error:function(e){i&&i.call(n,e)},complete:function(){s=!0,a||o&&o.call(n)}},c=e.subscribe(u);return function(){return c.unsubscribe()}}))}(o,(function(e){return a.localState.runResolvers({document:v,remoteResult:e,context:t,variables:n})}))),o},e.prototype.fetchRequest=function(e){var t,n,r=this,i=e.requestId,o=e.queryId,a=e.document,s=e.options,u=e.fetchMoreForQueryId,c=s.variables,l=s.errorPolicy,f=void 0===l?"none":l,p=s.fetchPolicy;return new Promise((function(e,l){var h=r.getObservableFromLink(a,s.context,c),d="fetchRequest:"+o;r.fetchQueryRejectFns.set(d,l);var v=function(){r.fetchQueryRejectFns.delete(d),r.setQuery(o,(function(e){e.subscriptions.delete(y)}))},y=h.map((function(e){if(i>=r.getQuery(o).lastRequestId&&(r.markQueryResult(o,e,s,u),r.queryStore.markQueryResult(o,e,u),r.invalidate(o),r.invalidate(u),r.broadcastQueries()),"none"===f&&Lt(e.errors))return l(new Bt({graphQLErrors:e.errors}));if("all"===f&&(n=e.errors),u||"no-cache"===p)t=e.data;else{var h=r.dataStore.getCache().diff({variables:c,query:a,optimistic:!1,returnPartialData:!0}),d=h.result;(h.complete||s.returnPartialData)&&(t=d)}})).subscribe({error:function(e){v(),l(e)},complete:function(){v(),e({data:t,errors:n,loading:!1,networkStatus:Qt.ready,stale:!1})}});r.setQuery(o,(function(e){e.subscriptions.add(y)}))}))},e.prototype.getQuery=function(e){return this.queries.get(e)||{listeners:new Set,invalidated:!1,document:null,newData:null,lastRequestId:1,observableQuery:null,subscriptions:new Set}},e.prototype.setQuery=function(e,t){var n=this.getQuery(e),i=r(r({},n),t(n));this.queries.set(e,i)},e.prototype.invalidate=function(e,t){void 0===t&&(t=!0),e&&this.setQuery(e,(function(){return{invalidated:t}}))},e.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return r(r({},t),{clientAwareness:this.clientAwareness})},e.prototype.checkInFlight=function(e){var t=this.queryStore.get(e);return t&&t.networkStatus!==Qt.ready&&t.networkStatus!==Qt.error},e.prototype.startPollingQuery=function(e,t,n){var i=this,o=e.pollInterval;if("production"===process.env.NODE_ENV?Oe(o,18):Oe(o,"Attempted to start a polling query without a polling interval."),!this.ssrMode){var a=this.pollingInfoByQueryId.get(t);a||this.pollingInfoByQueryId.set(t,a={}),a.interval=o,a.options=r(r({},e),{fetchPolicy:"network-only"});var s=function(){var e=i.pollingInfoByQueryId.get(t);e&&(i.checkInFlight(t)?u():i.fetchQuery(t,e.options,$t.poll).then(u,u))},u=function(){var e=i.pollingInfoByQueryId.get(t);e&&(clearTimeout(e.timeout),e.timeout=setTimeout(s,e.interval))};n&&this.addQueryListener(t,n),u()}return t},e.prototype.stopPollingQuery=function(e){this.pollingInfoByQueryId.delete(e)},e}(),en=function(){function e(e){this.cache=e}return e.prototype.getCache=function(){return this.cache},e.prototype.markQueryResult=function(e,t,n,r,i){void 0===i&&(i=!1);var o=!dt(e);i&&dt(e)&&e.data&&(o=!0),!r&&o&&this.cache.write({result:e.data,dataId:"ROOT_QUERY",query:t,variables:n})},e.prototype.markSubscriptionResult=function(e,t,n){dt(e)||this.cache.write({result:e.data,dataId:"ROOT_SUBSCRIPTION",query:t,variables:n})},e.prototype.markMutationInit=function(e){var t,n=this;e.optimisticResponse&&(t="function"==typeof e.optimisticResponse?e.optimisticResponse(e.variables):e.optimisticResponse,this.cache.recordOptimisticTransaction((function(r){var i=n.cache;n.cache=r;try{n.markMutationResult({mutationId:e.mutationId,result:{data:t},document:e.document,variables:e.variables,updateQueries:e.updateQueries,update:e.update})}finally{n.cache=i}}),e.mutationId))},e.prototype.markMutationResult=function(e){var t=this;if(!dt(e.result)){var n=[{result:e.result.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}],r=e.updateQueries;r&&Object.keys(r).forEach((function(i){var o=r[i],a=o.query,s=o.updater,u=t.cache.diff({query:a.document,variables:a.variables,returnPartialData:!0,optimistic:!1}),c=u.result;if(u.complete){var l=ht((function(){return s(c,{mutationResult:e.result,queryName:Je(a.document)||void 0,queryVariables:a.variables})}));l&&n.push({result:l,dataId:"ROOT_QUERY",query:a.document,variables:a.variables})}})),this.cache.performTransaction((function(t){n.forEach((function(e){return t.write(e)}));var r=e.update;r&&ht((function(){return r(t,e.result)}))}))}},e.prototype.markMutationComplete=function(e){var t=e.mutationId;e.optimisticResponse&&this.cache.removeOptimistic(t)},e.prototype.markUpdateQueryResult=function(e,t,n){this.cache.write({result:n,dataId:"ROOT_QUERY",variables:t,query:e})},e.prototype.reset=function(){return this.cache.reset()},e}(),tn=!1,nn=function(){function e(e){var t=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.cache,r=e.ssrMode,i=void 0!==r&&r,o=e.ssrForceFetchDelay,a=void 0===o?0:o,s=e.connectToDevTools,u=e.queryDeduplication,c=void 0===u||u,l=e.defaultOptions,f=e.assumeImmutableResults,p=void 0!==f&&f,h=e.resolvers,d=e.typeDefs,v=e.fragmentMatcher,y=e.name,m=e.version,g=e.link;if(!g&&h&&(g=jt.empty()),!g||!n)throw"production"===process.env.NODE_ENV?new _e(1):new _e("In order to initialize Apollo Client, you must specify 'link' and 'cache' properties in the options object.\nThese options are part of the upgrade requirements when migrating from Apollo Client 1.x to Apollo Client 2.x.\nFor more information, please visit: https://www.apollographql.com/docs/tutorial/client.html#apollo-client-setup");this.link=g,this.cache=n,this.store=new en(n),this.disableNetworkFetches=i||a>0,this.queryDeduplication=c,this.defaultOptions=l||{},this.typeDefs=d,a&&setTimeout((function(){return t.disableNetworkFetches=!1}),a),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);var b="production"!==process.env.NODE_ENV&&"undefined"!=typeof window&&!window.__APOLLO_CLIENT__;(void 0===s?b:s&&"undefined"!=typeof window)&&(window.__APOLLO_CLIENT__=this),tn||"production"===process.env.NODE_ENV||(tn=!0,"undefined"!=typeof window&&window.document&&window.top===window.self&&void 0===window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("Chrome")>-1&&console.debug("Download the Apollo DevTools for a better development experience: https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm")),this.version="2.6.8",this.localState=new Jt({cache:n,client:this,resolvers:h,fragmentMatcher:v}),this.queryManager=new Zt({link:this.link,store:this.store,queryDeduplication:c,ssrMode:i,clientAwareness:{name:y,version:m},localState:this.localState,assumeImmutableResults:p,onBroadcast:function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.queryStore.getStore(),mutations:t.queryManager.mutationStore.getStore()},dataWithOptimisticResults:t.cache.extract(!0)})}})}return e.prototype.stop=function(){this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=r(r({},this.defaultOptions.watchQuery),e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=r(r({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=r(r({},this.defaultOptions.query),e)),"production"===process.env.NODE_ENV?Oe("cache-and-network"!==e.fetchPolicy,2):Oe("cache-and-network"!==e.fetchPolicy,"The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=r(r({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=r(r({},this.defaultOptions.mutate),e)),this.queryManager.mutate(e)},e.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},e.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return this.queryManager.broadcastQueries(),t},e.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return this.queryManager.broadcastQueries(),t},e.prototype.writeData=function(e){var t=this.cache.writeData(e);return this.queryManager.broadcastQueries(),t},e.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},e.prototype.__requestRaw=function(e){return Ct(this.link,e)},e.prototype.initQueryManager=function(){return"production"===process.env.NODE_ENV||Oe.warn("Calling the initQueryManager method is no longer necessary, and it will be removed from ApolloClient in version 3.0."),this.queryManager},e.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.resetStoreCallbacks.map((function(e){return e()})))})).then((function(){return e.reFetchObservableQueries()}))},e.prototype.clearStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.clearStoreCallbacks.map((function(e){return e()})))}))},e.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},e.prototype.extract=function(e){return this.cache.extract(e)},e.prototype.restore=function(e){return this.cache.restore(e)},e.prototype.addResolvers=function(e){this.localState.addResolvers(e)},e.prototype.setResolvers=function(e){this.localState.setResolvers(e)},e.prototype.getResolvers=function(){return this.localState.getResolvers()},e.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},e}();function rn(e){return{kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GeneratedClientQuery"},selectionSet:on(e)}]}}function on(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return null;if(Array.isArray(e))return on(e[0]);var t=[];return Object.keys(e).forEach((function(n){var r={kind:"Field",name:{kind:"Name",value:n},selectionSet:on(e[n])||void 0};t.push(r)})),{kind:"SelectionSet",selections:t}}var an={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:null,variableDefinitions:null,directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",alias:null,name:{kind:"Name",value:"__typename"},arguments:[],directives:[],selectionSet:null}]}}]},sn=function(){function e(){}return e.prototype.transformDocument=function(e){return e},e.prototype.transformForLink=function(e){return e},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.read({query:e.query,variables:e.variables,optimistic:t})},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.read({query:ze(e.fragment,e.fragmentName),variables:e.variables,rootId:e.id,optimistic:t})},e.prototype.writeQuery=function(e){this.write({dataId:"ROOT_QUERY",result:e.data,query:e.query,variables:e.variables})},e.prototype.writeFragment=function(e){this.write({dataId:e.id,result:e.data,variables:e.variables,query:ze(e.fragment,e.fragmentName)})},e.prototype.writeData=function(e){var t,n,r=e.id,i=e.data;if(void 0!==r){var o=null;try{o=this.read({rootId:r,optimistic:!1,query:an})}catch(e){}var a=o&&o.__typename||"__ClientData",s=Object.assign({__typename:a},i);this.writeFragment({id:r,fragment:(t=s,n=a,{kind:"Document",definitions:[{kind:"FragmentDefinition",typeCondition:{kind:"NamedType",name:{kind:"Name",value:n||"__FakeType"}},name:{kind:"Name",value:"GeneratedClientQuery"},selectionSet:on(t)}]}),data:s})}else this.writeQuery({query:rn(i),data:i})},e}(),un=null,cn={},ln=1,fn=Array,pn=fn["@wry/context:Slot"]||function(){var e=function(){function e(){this.id=["slot",ln++,Date.now(),Math.random().toString(36).slice(2)].join(":")}return e.prototype.hasValue=function(){for(var e=un;e;e=e.parent)if(this.id in e.slots){var t=e.slots[this.id];if(t===cn)break;return e!==un&&(un.slots[this.id]=t),!0}return un&&(un.slots[this.id]=cn),!1},e.prototype.getValue=function(){if(this.hasValue())return un.slots[this.id]},e.prototype.withValue=function(e,t,n,r){var i,o=((i={__proto__:null})[this.id]=e,i),a=un;un={parent:a,slots:o};try{return t.apply(r,n)}finally{un=a}},e.bind=function(e){var t=un;return function(){var n=un;try{return un=t,e.apply(this,arguments)}finally{un=n}}},e.noContext=function(e,t,n){if(!un)return e.apply(n,t);var r=un;try{return un=null,e.apply(n,t)}finally{un=r}},e}();try{Object.defineProperty(fn,"@wry/context:Slot",{value:fn["@wry/context:Slot"]=e,enumerable:!1,writable:!1,configurable:!1})}finally{return e}}();pn.bind,pn.noContext;function hn(){}var dn=function(){function e(e,t){void 0===e&&(e=1/0),void 0===t&&(t=hn),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return e.prototype.has=function(e){return this.map.has(e)},e.prototype.get=function(e){var t=this.getEntry(e);return t&&t.value},e.prototype.getEntry=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var n=t.older,r=t.newer;r&&(r.older=n),n&&(n.newer=r),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=r)}return t},e.prototype.set=function(e,t){var n=this.getEntry(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)},e.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},e.prototype.delete=function(e){var t=this.map.get(e);return!!t&&(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0)},e}(),vn=new pn,yn=[],mn=[];function gn(e,t){if(!e)throw new Error(t||"assertion failure")}function bn(e){switch(e.length){case 0:throw new Error("unknown value");case 1:return e[0];case 2:throw e[1]}}var En=function(){function e(t,n){this.fn=t,this.args=n,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],++e.count}return e.prototype.recompute=function(){if(gn(!this.recomputing,"already recomputing"),function(e){var t=vn.getValue();if(t)return e.parents.add(t),t.childValues.has(e)||t.childValues.set(e,[]),_n(e)?Nn(t,e):Sn(t,e),t}(this)||!In(this))return _n(this)?function(e){var t=xn(e);vn.withValue(e,wn,[e]),function(e){if("function"==typeof e.subscribe)try{An(e),e.unsubscribe=e.subscribe.apply(null,e.args)}catch(t){return e.setDirty(),!1}return!0}(e)&&function(e){if(e.dirty=!1,_n(e))return;kn(e)}(e);return t.forEach(In),bn(e.value)}(this):bn(this.value)},e.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,On(this),An(this))},e.prototype.dispose=function(){var e=this;xn(this).forEach(In),An(this),this.parents.forEach((function(t){t.setDirty(),Dn(t,e)}))},e.count=0,e}();function wn(e){e.recomputing=!0,e.value.length=0;try{e.value[0]=e.fn.apply(null,e.args)}catch(t){e.value[1]=t}e.recomputing=!1}function _n(e){return e.dirty||!(!e.dirtyChildren||!e.dirtyChildren.size)}function On(e){e.parents.forEach((function(t){return Nn(t,e)}))}function kn(e){e.parents.forEach((function(t){return Sn(t,e)}))}function Nn(e,t){if(gn(e.childValues.has(t)),gn(_n(t)),e.dirtyChildren){if(e.dirtyChildren.has(t))return}else e.dirtyChildren=mn.pop()||new Set;e.dirtyChildren.add(t),On(e)}function Sn(e,t){gn(e.childValues.has(t)),gn(!_n(t));var n,r,i,o=e.childValues.get(t);0===o.length?e.childValues.set(t,t.value.slice(0)):(n=o,r=t.value,(i=n.length)>0&&i===r.length&&n[i-1]===r[i-1]||e.setDirty()),Tn(e,t),_n(e)||kn(e)}function Tn(e,t){var n=e.dirtyChildren;n&&(n.delete(t),0===n.size&&(mn.length<100&&mn.push(n),e.dirtyChildren=null))}function In(e){return 0===e.parents.size&&"function"==typeof e.reportOrphan&&!0===e.reportOrphan()}function xn(e){var t=yn;return e.childValues.size>0&&(t=[],e.childValues.forEach((function(n,r){Dn(e,r),t.push(r)}))),gn(null===e.dirtyChildren),t}function Dn(e,t){t.parents.delete(e),e.childValues.delete(t),Tn(e,t)}function An(e){var t=e.unsubscribe;"function"==typeof t&&(e.unsubscribe=void 0,t())}var Rn=function(){function e(e){this.weakness=e}return e.prototype.lookup=function(){for(var e=[],t=0;t0;return d&&!s&&h.missing.forEach((function(e){if(!e.tolerable)throw"production"===process.env.NODE_ENV?new _e(8):new _e("Can't find field "+e.fieldName+" on object "+JSON.stringify(e.object,null,2)+".")})),o&&De(o,h.result)&&(h.result=o),{result:h.result,complete:!d}},e.prototype.executeStoreQuery=function(e){var t=e.query,n=e.rootValue,r=e.contextValue,i=e.variableValues,o=e.fragmentMatcher,a=void 0===o?Gn:o,s=Xe(t),u={query:t,fragmentMap:Ze(He(t)),contextValue:r,variableValues:i,fragmentMatcher:a};return this.executeSelectionSet({selectionSet:s.selectionSet,rootValue:n,execContext:u})},e.prototype.executeSelectionSet=function(e){var t=this,n=e.selectionSet,i=e.rootValue,o=e.execContext,a=o.fragmentMap,s=o.contextValue,u=o.variableValues,c={result:null},l=[],f=s.store.get(i.id),p=f&&f.__typename||"ROOT_QUERY"===i.id&&"Query"||void 0;function h(e){var t;return e.missing&&(c.missing=c.missing||[],(t=c.missing).push.apply(t,e.missing)),e.result}return n.selections.forEach((function(e){var n;if($e(e,u))if(Qe(e)){var c=h(t.executeField(f,p,e,o));void 0!==c&&l.push(((n={})[Ce(e)]=c,n))}else{var d=void 0;if(qe(e))d=e;else if(!(d=a[e.name.value]))throw"production"===process.env.NODE_ENV?new _e(9):new _e("No fragment named "+e.name.value);var v=d.typeCondition&&d.typeCondition.name.value,y=!v||o.fragmentMatcher(i,v,s);if(y){var m=t.executeSelectionSet({selectionSet:d.selectionSet,rootValue:i,execContext:o});"heuristic"===y&&m.missing&&(m=r(r({},m),{missing:m.missing.map((function(e){return r(r({},e),{tolerable:!0})}))})),l.push(h(m))}}})),c.result=gt(l),this.freezeResults&&"production"!==process.env.NODE_ENV&&Object.freeze(c.result),c},e.prototype.executeField=function(e,t,n,r){var i=r.variableValues,o=r.contextValue,a=function(e,t,n,r,i,o){o.resultKey;var a=o.directives,s=n;(r||a)&&(s=Fe(s,r,a));var u=void 0;if(e&&void 0===(u=e[s])&&i.cacheRedirects&&"string"==typeof t){var c=i.cacheRedirects[t];if(c){var l=c[n];l&&(u=l(e,r,{getCacheKey:function(e){var t=i.dataIdFromObject(e);return t&&Ve({id:t,typename:e.__typename})}}))}}if(void 0===u)return{result:u,missing:[{object:e,fieldName:s,tolerable:!1}]};f=u,null!=f&&"object"==typeof f&&"json"===f.type&&(u=u.json);var f;return{result:u}}(e,t,n.name.value,je(n,i),o,{resultKey:Ce(n),directives:Le(n,i)});return Array.isArray(a.result)?this.combineExecResults(a,this.executeSubSelectedArray({field:n,array:a.result,execContext:r})):n.selectionSet?null==a.result?a:this.combineExecResults(a,this.executeSelectionSet({selectionSet:n.selectionSet,rootValue:a.result,execContext:r})):(Un(n,a.result),this.freezeResults&&"production"!==process.env.NODE_ENV&&vt(a),a)},e.prototype.combineExecResults=function(){for(var e,t=[],n=0;n=0)return!0;n[e].push(t)}else n[e]=[t];return!1}var Hn={fragmentMatcher:new Pn,dataIdFromObject:function(e){if(e.__typename){if(void 0!==e.id)return e.__typename+":"+e.id;if(void 0!==e._id)return e.__typename+":"+e._id}return null},addTypename:!0,resultCaching:!0,freezeResults:!1};var Xn=Object.prototype.hasOwnProperty,Zn=function(e){function t(t,n,r){var i=e.call(this,Object.create(null))||this;return i.optimisticId=t,i.parent=n,i.transaction=r,i}return n(t,e),t.prototype.toObject=function(){return r(r({},this.parent.toObject()),this.data)},t.prototype.get=function(e){return Xn.call(this.data,e)?this.data[e]:this.parent.get(e)},t}(zn),er=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;n.watches=new Set,n.typenameDocumentCache=new Map,n.cacheKeyRoot=new Rn(ut),n.silenceBroadcast=!1,n.config=r(r({},Hn),t),n.config.customResolvers&&("production"===process.env.NODE_ENV||Oe.warn("customResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating customResolvers in the next major version."),n.config.cacheRedirects=n.config.customResolvers),n.config.cacheResolvers&&("production"===process.env.NODE_ENV||Oe.warn("cacheResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating cacheResolvers in the next major version."),n.config.cacheRedirects=n.config.cacheResolvers),n.addTypename=!!n.config.addTypename,n.data=n.config.resultCaching?new Ln:new zn,n.optimisticData=n.data,n.storeWriter=new Yn,n.storeReader=new Bn({cacheKeyRoot:n.cacheKeyRoot,freezeResults:t.freezeResults});var i=n,o=i.maybeBroadcastWatch;return n.maybeBroadcastWatch=Cn((function(e){return o.call(n,e)}),{makeCacheKey:function(e){if(!e.optimistic&&!e.previousResult)return i.data instanceof Ln?i.cacheKeyRoot.lookup(e.query,JSON.stringify(e.variables)):void 0}}),n}return n(t,e),t.prototype.restore=function(e){return e&&this.data.replace(e),this},t.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).toObject()},t.prototype.read=function(e){if("string"==typeof e.rootId&&void 0===this.data.get(e.rootId))return null;var t=this.config.fragmentMatcher,n=t&&t.match;return this.storeReader.readQueryFromStore({store:e.optimistic?this.optimisticData:this.data,query:this.transformDocument(e.query),variables:e.variables,rootId:e.rootId,fragmentMatcherFunction:n,previousResult:e.previousResult,config:this.config})||null},t.prototype.write=function(e){var t=this.config.fragmentMatcher,n=t&&t.match;this.storeWriter.writeResultToStore({dataId:e.dataId,result:e.result,variables:e.variables,document:this.transformDocument(e.query),store:this.data,dataIdFromObject:this.config.dataIdFromObject,fragmentMatcherFunction:n}),this.broadcastWatches()},t.prototype.diff=function(e){var t=this.config.fragmentMatcher,n=t&&t.match;return this.storeReader.diffQueryAgainstStore({store:e.optimistic?this.optimisticData:this.data,query:this.transformDocument(e.query),variables:e.variables,returnPartialData:e.returnPartialData,previousResult:e.previousResult,fragmentMatcherFunction:n,config:this.config})},t.prototype.watch=function(e){var t=this;return this.watches.add(e),function(){t.watches.delete(e)}},t.prototype.evict=function(e){throw"production"===process.env.NODE_ENV?new _e(1):new _e("eviction is not implemented on InMemory Cache")},t.prototype.reset=function(){return this.data.clear(),this.broadcastWatches(),Promise.resolve()},t.prototype.removeOptimistic=function(e){for(var t=[],n=0,r=this.optimisticData;r instanceof Zn;)r.optimisticId===e?++n:t.push(r),r=r.parent;if(n>0){for(this.optimisticData=r;t.length>0;){var i=t.pop();this.performTransaction(i.transaction,i.optimisticId)}this.broadcastWatches()}},t.prototype.performTransaction=function(e,t){var n=this.data,r=this.silenceBroadcast;this.silenceBroadcast=!0,"string"==typeof t&&(this.data=this.optimisticData=new Zn(t,this.optimisticData,e));try{e(this)}finally{this.silenceBroadcast=r,this.data=n}this.broadcastWatches()},t.prototype.recordOptimisticTransaction=function(e,t){return this.performTransaction(e,t)},t.prototype.transformDocument=function(e){if(this.addTypename){var t=this.typenameDocumentCache.get(e);return t||(t=B(Ye(e),{SelectionSet:{enter:function(e,t,n){if(!n||"OperationDefinition"!==n.kind){var i=e.selections;if(i&&!i.some((function(e){return Qe(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var o=n;if(!(Qe(o)&&o.directives&&o.directives.some((function(e){return"export"===e.name.value}))))return r(r({},e),{selections:a(i,[nt])})}}}}}),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},t.prototype.broadcastWatches=function(){var e=this;this.silenceBroadcast||this.watches.forEach((function(t){return e.maybeBroadcastWatch(t)}))},t.prototype.maybeBroadcastWatch=function(e){e.callback(this.diff({query:e.query,variables:e.variables,previousResult:e.previousResult&&e.previousResult(),optimistic:e.optimistic}))},t}(sn),tr={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},nr=function(e,t,n){var r=new Error(n);throw r.name="ServerError",r.response=e,r.statusCode=e.status,r.result=t,r},rr=function(e,t){var n;try{n=JSON.stringify(e)}catch(e){var r="production"===process.env.NODE_ENV?new _e(2):new _e("Network request failed. "+t+" is not serializable: "+e.message);throw r.parseError=e,r}return n},ir=function(e){void 0===e&&(e={});var t=e.uri,n=void 0===t?"/graphql":t,i=e.fetch,o=e.includeExtensions,a=e.useGETForQueries,s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i=300&&nr(e,t,"Response not successful: Received status code "+e.status),Array.isArray(t)||t.hasOwnProperty("data")||t.hasOwnProperty("errors")||nr(e,t,"Server response was missing for query '"+(Array.isArray(r)?r.map((function(e){return e.operationName})):r.operationName)+"'."),t}))})).then((function(e){return n.next(e),n.complete(),e})).catch((function(e){"AbortError"!==e.name&&(e.result&&e.result.errors&&e.result.data&&n.next(e.result),n.error(e))})),function(){p&&p.abort()}}))}))};var or,ar,sr=function(e){function t(t){return e.call(this,ir(t).request)||this}return n(t,e),t}(jt);(or=e.ConnectionMode||(e.ConnectionMode={}))[or.AUTO=0]="AUTO",or[or.PLAIN=1]="PLAIN",or[or.NODES=2]="NODES",or[or.EDGES=3]="EDGES",or[or.ITEMS=4]="ITEMS",(ar=e.ArgumentMode||(e.ArgumentMode={}))[ar.TYPE=0]="TYPE",ar[ar.LIST=1]="LIST";var ur,cr=function(){function t(){}return t.transformOutgoingData=function(e,t,n,r,i,o){var a=this,s=_r.getInstance(),u=e.getRelations(),c={};return void 0===i&&(i=new Map),void 0===o&&(o=!1),Object.keys(t).forEach((function(l){var f=t[l],p=e.getRelations().has(l);if(!(f instanceof Array?p&&a.isRecursion(i,f[0]):p&&a.isRecursion(i,f))&&a.shouldIncludeOutgoingField(o&&n,l,f,e,r)){var h=be.getRelatedModel(u.get(l));if(f instanceof Array){var d=s.getModel(se(l),!0);d?(a.addRecordForRecursionDetection(i,f[0]),c[l]=f.map((function(t){return a.transformOutgoingData(d||e,t,n,void 0,i,!0)}))):c[l]=f}else"object"==typeof f&&void 0!==f.$id?(h||(h=s.getModel(f.$self().entity)),a.addRecordForRecursionDetection(i,f),c[l]=a.transformOutgoingData(h,f,n,void 0,i,!0)):c[l]=f}})),c},t.transformIncomingData=function(t,n,r,i){var o=this;void 0===r&&(r=!1),void 0===i&&(i=!1);var a={},s=_r.getInstance();return i||(s.logger.group("Transforming incoming data"),s.logger.log("Raw data:",t)),Array.isArray(t)?a=t.map((function(e){return o.transformIncomingData(e,n,r,!0)})):Object.keys(t).forEach((function(u){if(void 0!==t[u]&&null!==t[u]&&u in t)if(he(t[u])){var c=s.getModel(u,!0)||n;if(t[u].nodes&&s.connectionMode===e.ConnectionMode.NODES)a[ae(u)]=o.transformIncomingData(t[u].nodes,c,r,!0);else if(t[u].edges&&s.connectionMode===e.ConnectionMode.EDGES)a[ae(u)]=o.transformIncomingData(t[u].edges,c,r,!0);else if(t.node&&s.connectionMode===e.ConnectionMode.EDGES)a=o.transformIncomingData(t.node,c,r,!0);else if(t[u].items&&s.connectionMode===e.ConnectionMode.ITEMS)a[ae(u)]=o.transformIncomingData(t[u].items,c,r,!0);else{var l=u;r&&!i&&(l=ce(l=t[u].nodes?c.pluralName:c.singularName)),a[l]=o.transformIncomingData(t[u],c,r,!0)}}else be.isFieldNumber(n.fields.get(u))?a[u]=parseFloat(t[u]):u.endsWith("Type")&&n.isTypeFieldOfPolymorphicRelation(u)?a[u]=ae(ce(t[u])):a[u]=t[u]})),i?a.$isPersisted=!0:(s.logger.log("Transformed data:",a),s.logger.groupEnd()),ye(a)},t.shouldIncludeOutgoingField=function(e,t,n,r,i){if(i&&i.includes(t))return!0;if(t.startsWith("$"))return!1;if("pivot"===t)return!1;if(null==n)return!1;if(!this.inputTypeContainsField(r,t))return!1;if(r.getRelations().has(t)){if(e)return!1;var o=r.getRelations().get(t),a=be.getRelatedModel(o);return!(!a||!r.shouldEagerSaveRelation(t,o,a))}return!0},t.inputTypeContainsField=function(e,t){var n=e.singularName+"Input",r=_r.getInstance().schema.getType(n,!1);if(null===r)throw new Error("Type "+r+" doesn't exist.");return void 0!==r.inputFields.find((function(e){return e.name===t}))},t.addRecordForRecursionDetection=function(e,t){var n=_r.getInstance();if(t)if(t.$self){var r=n.getModel(t.$self().entity),i=e.get(r.singularName)||[];i.push(t.$id),e.set(r.singularName,i)}else n.logger.warn("Seems like you're using non-model classes with plugin graphql. You shouldn't do that.");else n.logger.warn("Trying to add invalid record",t,"to recursion detection")},t.isRecursion=function(e,t){if(!t)return!1;if(!t.$self)return _r.getInstance().logger.warn("Seems like you're using non-model classes with plugin graphql. You shouldn't do that."),!1;var n=_r.getInstance().getModel(t.$self().entity);return(e.get(n.singularName)||[]).includes(t.$id)},t}(),lr=((ur=V)&&ur.default||ur).parse;function fr(e){return e.replace(/[\s,]+/g," ").trim()}var pr={},hr={};var dr=!0;var vr=!1;function yr(e){var t=fr(e);if(pr[t])return pr[t];var n=lr(e,{experimentalFragmentVariables:vr});if(!n||"Document"!==n.kind)throw new Error("Not a valid GraphQL document.");return n=function e(t,n){var r=Object.prototype.toString.call(t);if("[object Array]"===r)return t.map((function(t){return e(t,n)}));if("[object Object]"!==r)throw new Error("Unexpected input.");n&&t.loc&&delete t.loc,t.loc&&(delete t.loc.startToken,delete t.loc.endToken);var i,o,a,s=Object.keys(t);for(i in s)s.hasOwnProperty(i)&&(o=t[s[i]],"[object Object]"!==(a=Object.prototype.toString.call(o))&&"[object Array]"!==a||(t[s[i]]=e(o,!0)));return t}(n=function(e){for(var t,n={},r=[],i=0;i5:t.includes(a.singularName);if(e.shouldEagerLoadRelation(o,i,a)&&!u){var c=t.slice(0);c.push(a.singularName),r.push(n.buildField(a,be.isConnection(i),void 0,c,o,!1))}})),r.join("\n")},t.prepareArguments=function(t){return t=t?ye(t):{},Object.keys(t).forEach((function(n){var r=t[n];r&&he(r)&&(_r.getInstance().adapter.getArgumentMode()===e.ArgumentMode.LIST?(Object.keys(r).forEach((function(e){t[e]=r[e]})),delete t[n]):t[n]={__type:ue(n)})})),t},t}(),kr=function(){function e(){}return e.insertData=function(e,t){return i(this,void 0,void 0,(function(){var n,r=this;return o(this,(function(a){switch(a.label){case 0:return n={},[4,Promise.all(Object.keys(e).map((function(a){return i(r,void 0,void 0,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:return r=e[a],_r.getInstance().logger.log("Inserting records",r),[4,t("insertOrUpdate",{data:r})];case 1:return i=o.sent(),Object.keys(i).forEach((function(e){n[e]||(n[e]=[]),n[e]=n[e].concat(i[e])})),[2]}}))}))})))];case 1:return a.sent(),[2,n]}}))}))},e}(),Nr=function(){function e(){}return e.mutation=function(e,t,n,r){return i(this,void 0,void 0,(function(){var i,a,s,u,c,l,f,p,h;return o(this,(function(o){switch(o.label){case 0:return t?[4,(i=_r.getInstance()).loadSchema()]:[3,5];case 1:return a=o.sent(),s=Er.returnsConnection(a.getMutation(e)),u=Or.buildQuery("mutation",r,e,t,s),[4,i.apollo.request(r,u,t,!0)];case 2:return c=o.sent(),e===i.adapter.getNameForDestroy(r)?[3,4]:((c=c[Object.keys(c)[0]]).id=me(c.id),[4,kr.insertData((h={},h[r.pluralName]=c,h),n)]);case 3:return l=o.sent(),f=l[r.pluralName],(p=f[f.length-1])?[2,p]:(_r.getInstance().logger.log("Couldn't find the record of type '",r.pluralName,"' within",l,". Falling back to find()"),[2,r.baseModel.query().last()]);case 4:return[2,!0];case 5:return[2]}}))}))},e.getModelFromState=function(e){return _r.getInstance().getModel(e.$name)},e.prepareArgs=function(e,t){return e=e||{},t&&(e.id=t),e},e.addRecordToArgs=function(e,t,n){return e[t.singularName]=cr.transformOutgoingData(t,n,!1),e},e.transformArgs=function(e){var t=_r.getInstance();return Object.keys(e).forEach((function(n){var r=e[n];if(r instanceof t.components.Model){var i=t.getModel(se(r.$self().entity)),o=cr.transformOutgoingData(i,r,!1);t.logger.log("A",n,"model was found within the variables and will be transformed from",r,"to",o),e[n]=o}})),e},e}(),Sr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){var e=_r.getInstance(),n=e.components.Model.prototype;e.components.Actions.destroy=t.call.bind(t),n.$destroy=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,this.$dispatch("destroy",{id:me(this.$id)})]}))}))},n.$deleteAndDestroy=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.$delete()];case 1:return e.sent(),[2,this.$destroy()]}}))}))}},t.call=function(e,t){var n=e.state,r=e.dispatch,a=t.id,s=t.args;return i(this,void 0,void 0,(function(){var e,t,i;return o(this,(function(o){switch(o.label){case 0:return a?(e=this.getModelFromState(n),t=_r.getInstance().adapter.getNameForDestroy(e),(i=e.$mockHook("destroy",{id:a}))?[4,kr.insertData(i,r)]:[3,2]):[3,4];case 1:return o.sent(),[2,!0];case 2:return s=this.prepareArgs(s,a),[4,Nr.mutation(t,s,r,e)];case 3:return o.sent(),[2,!0];case 4:throw new Error("The destroy action requires the 'id' to be set")}}))}))},t}(Nr),Tr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){var e=_r.getInstance(),n=e.components.Model;e.components.Actions.fetch=t.call.bind(t),n.fetch=function(e,t){return void 0===t&&(t=!1),i(this,void 0,void 0,(function(){var n;return o(this,(function(r){return he(n=e)||(n={id:e}),[2,this.dispatch("fetch",{filter:n,bypassCache:t})]}))}))}},t.call=function(e,t){var n=e.state,r=e.dispatch;return i(this,void 0,void 0,(function(){var e,i,a,s,u,c,l,f,p;return o(this,(function(o){switch(o.label){case 0:return e=_r.getInstance(),i=this.getModelFromState(n),(a=i.$mockHook("fetch",{filter:t&&t.filter||{}}))?[2,kr.insertData(a,r)]:[4,e.loadSchema()];case 1:return o.sent(),s={},t&&t.filter&&(s=cr.transformOutgoingData(i,t.filter,!0,Object.keys(t.filter))),u=t&&t.bypassCache,c=!s.id,l=e.adapter.getNameForFetch(i,c),f=Or.buildQuery("query",i,l,s,c,c),[4,e.apollo.request(i,f,s,!1,u)];case 2:return p=o.sent(),[2,kr.insertData(p,r)]}}))}))},t}(Nr),Ir=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){var e=_r.getInstance(),n=e.components.Model,r=e.components.Model.prototype;e.components.Actions.mutate=t.call.bind(t),n.mutate=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.dispatch("mutate",e)]}))}))},r.$mutate=function(e){var t=e.name,n=e.args,r=e.multiple;return i(this,void 0,void 0,(function(){return o(this,(function(e){return(n=n||{}).id||(n.id=me(this.$id)),[2,this.$dispatch("mutate",{name:t,args:n,multiple:r})]}))}))}},t.call=function(e,t){var n=e.state,r=e.dispatch,a=t.args,s=t.name;return i(this,void 0,void 0,(function(){var e,t,i;return o(this,(function(o){switch(o.label){case 0:return s?(e=_r.getInstance(),t=this.getModelFromState(n),(i=t.$mockHook("mutate",{name:s,args:a||{}}))?[2,kr.insertData(i,r)]:[4,e.loadSchema()]):[3,2];case 1:return o.sent(),a=this.prepareArgs(a),this.transformArgs(a),[2,Nr.mutation(s,a,r,t)];case 2:throw new Error("The mutate action requires the mutation name ('mutation') to be set")}}))}))},t}(Nr),xr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){var e=_r.getInstance(),n=e.components.Model.prototype;e.components.Actions.persist=t.call.bind(t),n.$persist=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.$dispatch("persist",{id:this.$id,args:e})]}))}))}},t.call=function(e,t){var n=e.state,r=e.dispatch,a=t.id,s=t.args;return i(this,void 0,void 0,(function(){var e,t,i,u,c,l;return o(this,(function(o){switch(o.label){case 0:return a?(e=this.getModelFromState(n),t=_r.getInstance().adapter.getNameForPersist(e),i=e.getRecordWithId(a),(u=e.$mockHook("persist",{id:me(a),args:s||{}}))?[4,kr.insertData(u,r)]:[3,3]):[3,7];case 1:return c=o.sent(),[4,this.deleteObsoleteRecord(e,c,i)];case 2:return o.sent(),[2,c];case 3:return[4,_r.getInstance().loadSchema()];case 4:return o.sent(),s=this.prepareArgs(s),this.addRecordToArgs(s,e,i),[4,Nr.mutation(t,s,r,e)];case 5:return l=o.sent(),[4,this.deleteObsoleteRecord(e,l,i)];case 6:return o.sent(),[2,l];case 7:throw new Error("The persist action requires the 'id' to be set")}}))}))},t.deleteObsoleteRecord=function(e,t,n){return i(this,void 0,void 0,(function(){return o(this,(function(e){return t&&n&&t.id!==n.id?(_r.getInstance().logger.log("Dropping deprecated record",n),[2,n.$delete()]):[2,null]}))}))},t}(Nr),Dr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){var e=_r.getInstance(),n=e.components.Model.prototype;e.components.Actions.push=t.call.bind(t),n.$push=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.$dispatch("push",{data:this,args:e})]}))}))}},t.call=function(e,t){var n=e.state,r=e.dispatch,a=t.data,s=t.args;return i(this,void 0,void 0,(function(){var e,t,i;return o(this,(function(o){switch(o.label){case 0:return a?(e=this.getModelFromState(n),t=_r.getInstance().adapter.getNameForPush(e),(i=e.$mockHook("push",{data:a,args:s||{}}))?[2,kr.insertData(i,r)]:[4,_r.getInstance().loadSchema()]):[3,2];case 1:return o.sent(),s=this.prepareArgs(s,a.id),this.addRecordToArgs(s,e,a),[2,Nr.mutation(t,s,r,e)];case 2:throw new Error("The persist action requires the 'data' to be set")}}))}))},t}(Nr),Ar=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){var e=_r.getInstance(),n=e.components.Model,r=e.components.Model.prototype;e.components.Actions.query=t.call.bind(t),n.customQuery=function(e){var t=e.name,n=e.filter,r=e.multiple,a=e.bypassCache;return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,this.dispatch("query",{name:t,filter:n,multiple:r,bypassCache:a})]}))}))},r.$customQuery=function(e){var t=e.name,n=e.filter,r=e.multiple,a=e.bypassCache;return i(this,void 0,void 0,(function(){return o(this,(function(e){return(n=n||{}).id||(n.id=me(this.$id)),[2,this.$dispatch("query",{name:t,filter:n,multiple:r,bypassCache:a})]}))}))}},t.call=function(e,t){var n=e.state,r=e.dispatch,a=t.name,s=t.filter,u=t.bypassCache;return i(this,void 0,void 0,(function(){var e,t,i,c,l,f,p;return o(this,(function(o){switch(o.label){case 0:return a?(e=_r.getInstance(),t=this.getModelFromState(n),(i=t.$mockHook("query",{name:a,filter:s||{}}))?[2,kr.insertData(i,r)]:[4,e.loadSchema()]):[3,3];case 1:return c=o.sent(),s=s?cr.transformOutgoingData(t,s,!0):{},l=Er.returnsConnection(c.getQuery(a)),f=Or.buildQuery("query",t,a,s,l,!1),[4,e.apollo.request(t,f,s,!1,u)];case 2:return p=o.sent(),[2,kr.insertData(p,r)];case 3:throw new Error("The customQuery action requires the query name ('name') to be set")}}))}))},t}(Nr),Rr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){_r.getInstance().components.RootActions.simpleQuery=t.call.bind(t)},t.call=function(e,t){e.dispatch;var n=t.query,r=t.bypassCache,a=t.variables;return i(this,void 0,void 0,(function(){var e,t,i,s;return o(this,(function(o){switch(o.label){case 0:return e=_r.getInstance(),n?(t=fe(n),(i=e.globalMockHook("simpleQuery",{name:t.definitions[0].name.value,variables:a}))?[2,i]:(a=this.prepareArgs(a),[4,e.apollo.simpleQuery(pe(t),a,r)])):[3,2];case 1:return s=o.sent(),[2,(u=ye(s.data),JSON.parse(JSON.stringify(u)))];case 2:throw new Error("The simpleQuery action requires the 'query' to be set")}var u}))}))},t}(Nr),Mr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){_r.getInstance().components.RootActions.simpleMutation=t.call.bind(t)},t.call=function(e,t){e.dispatch;var n=t.query,r=t.variables;return i(this,void 0,void 0,(function(){var e,t,i;return o(this,(function(o){switch(o.label){case 0:return e=_r.getInstance(),n?(t=fe(n),(i=e.globalMockHook("simpleMutation",{name:t.definitions[0].name.value,variables:r}))?[2,i]:(r=this.prepareArgs(r),[4,e.apollo.simpleMutation(pe(t),r)])):[3,2];case 1:return[2,ye(o.sent().data)];case 2:throw new Error("The simpleMutation action requires the 'query' to be set")}}))}))},t}(Nr),Fr=function(){function e(t,n){_r.setup(t,n),e.setupActions()}return e.prototype.getContext=function(){return _r.getInstance()},e.setupActions=function(){Tr.setup(),xr.setup(),Dr.setup(),Sr.setup(),Ir.setup(),Ar.setup(),Rr.setup(),Mr.setup()},e}(),jr=function(){function e(){}return e.install=function(t,n){return e.instance=new Fr(t,n),e.instance},e}(),Cr=null;var Qr=function(){function e(e,t){this.action=e,this.options=t}return e.prototype.for=function(e){return this.modelClass=e,this},e.prototype.andReturn=function(e){return this.returnValue=e,this.installMock(),this},e.prototype.installMock=function(){"simpleQuery"===this.action||"simpleMutation"===this.action?Cr.addGlobalMock(this):Cr.getModel(this.modelClass.entity).$addMock(this)},e}();return e.DefaultAdapter=wr,e.Mock=Qr,e.Model=be,e.clearORMStore=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:if(!Cr)throw new Error("Please call setupTestUtils() before!");return[4,Cr.database.store.dispatch("entities/deleteAll")];case 1:return e.sent(),[2]}}))}))},e.default=jr,e.mock=function(e,t){if(!Cr)throw new Error("Please call setupTestUtils() before!");return new Qr(e,t)},e.setupTestUtils=function(e){if(!e.instance)throw new Error("Please call this function after setting up the store!");Cr=e.instance.getContext()},e}({}); + ***************************************************************************** */var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,n)};function n(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]2)return"[Array]";for(var n=Math.min(10,e.length),r=e.length-n,i=[],o=0;o1&&i.push("... ".concat(r," more items"));return"["+i.join(", ")+"]"}(e,n);return function(e,t){var n=Object.keys(e);if(0===n.length)return"{}";if(t.length>2)return"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var n=e.constructor.name;if("string"==typeof n&&""!==n)return n}return t}(e)+"]";return"{ "+n.map((function(n){return n+": "+l(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function f(e,t){if(!Boolean(e))throw new Error(t)}function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.prototype.toString;e.prototype.toJSON=t,e.prototype.inspect=t,s&&(e.prototype[s]=t)}function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){for(var n,r=/\r\n|[\n\r]/g,i=1,o=t+1;(n=r.exec(e.body))&&n.index120){for(var p=Math.floor(u/80),h=u%80,d=[],v=0;v0||f(0,"line in locationOffset is 1-indexed and must be positive"),this.locationOffset.column>0||f(0,"column in locationOffset is 1-indexed and must be positive")};function k(e){var t=e.split(/\r\n|[\n\r]/g),n=function(e){for(var t=null,n=1;n0&&S(t[0]);)t.shift();for(;t.length>0&&S(t[t.length-1]);)t.pop();return t.join("\n")}function N(e){for(var t=0;t",EOF:"",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function I(){return this.lastToken=this.token,this.token=this.lookahead()}function x(){var e=this.token;if(e.kind!==T.EOF)do{e=e.next||(e.next=R(this,e))}while(e.kind===T.COMMENT);return e}function D(e,t,n,r,i,o,a){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=a,this.prev=o,this.next=null}function A(e){return isNaN(e)?T.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function R(e,t){var n=e.source,r=n.body,i=r.length,o=function(e,t,n){var r=e.length,i=t;for(;i=i)return new D(T.EOF,i,i,a,s,t);var u=r.charCodeAt(o);switch(u){case 33:return new D(T.BANG,o,o+1,a,s,t);case 35:return function(e,t,n,r,i){var o,a=e.body,s=t;do{o=a.charCodeAt(++s)}while(!isNaN(o)&&(o>31||9===o));return new D(T.COMMENT,t,s,n,r,i,a.slice(t+1,s))}(n,o,a,s,t);case 36:return new D(T.DOLLAR,o,o+1,a,s,t);case 38:return new D(T.AMP,o,o+1,a,s,t);case 40:return new D(T.PAREN_L,o,o+1,a,s,t);case 41:return new D(T.PAREN_R,o,o+1,a,s,t);case 46:if(46===r.charCodeAt(o+1)&&46===r.charCodeAt(o+2))return new D(T.SPREAD,o,o+3,a,s,t);break;case 58:return new D(T.COLON,o,o+1,a,s,t);case 61:return new D(T.EQUALS,o,o+1,a,s,t);case 64:return new D(T.AT,o,o+1,a,s,t);case 91:return new D(T.BRACKET_L,o,o+1,a,s,t);case 93:return new D(T.BRACKET_R,o,o+1,a,s,t);case 123:return new D(T.BRACE_L,o,o+1,a,s,t);case 124:return new D(T.PIPE,o,o+1,a,s,t);case 125:return new D(T.BRACE_R,o,o+1,a,s,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return function(e,t,n,r,i){var o=e.body,a=o.length,s=t+1,u=0;for(;s!==a&&!isNaN(u=o.charCodeAt(s))&&(95===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122);)++s;return new D(T.NAME,t,s,n,r,i,o.slice(t,s))}(n,o,a,s,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return function(e,t,n,r,i,o){var a=e.body,s=n,u=t,c=!1;45===s&&(s=a.charCodeAt(++u));if(48===s){if((s=a.charCodeAt(++u))>=48&&s<=57)throw E(e,u,"Invalid number, unexpected digit after 0: ".concat(A(s),"."))}else u=M(e,u,s),s=a.charCodeAt(u);46===s&&(c=!0,s=a.charCodeAt(++u),u=M(e,u,s),s=a.charCodeAt(u));69!==s&&101!==s||(c=!0,43!==(s=a.charCodeAt(++u))&&45!==s||(s=a.charCodeAt(++u)),u=M(e,u,s),s=a.charCodeAt(u));if(46===s||69===s||101===s)throw E(e,u,"Invalid number, expected digit but got: ".concat(A(s),"."));return new D(c?T.FLOAT:T.INT,t,u,r,i,o,a.slice(t,u))}(n,o,u,a,s,t);case 34:return 34===r.charCodeAt(o+1)&&34===r.charCodeAt(o+2)?function(e,t,n,r,i,o){var a=e.body,s=t+3,u=s,c=0,l="";for(;s=48&&o<=57){do{o=r.charCodeAt(++i)}while(o>=48&&o<=57);return i}throw E(e,i,"Invalid number, expected digit but got: ".concat(A(o),"."))}function F(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}p(D,(function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}));var j=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function C(e,t){return new Q(e,t).parseDocument()}var Q=function(){function e(e,t){var n="string"==typeof e?new O(e):e;n instanceof O||f(0,"Must provide Source. Received: ".concat(c(n))),this._lexer=function(e,t){var n=new D(T.SOF,0,0,0,0,null);return{source:e,options:t,lastToken:n,token:n,line:1,lineStart:0,advance:I,lookahead:x}}(n),this._options=t||{}}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(T.NAME);return{kind:w.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:w.DOCUMENT,definitions:this.many(T.SOF,this.parseDefinition,T.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(T.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(T.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var e=this._lexer.token;if(this.peek(T.BRACE_L))return{kind:w.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(T.NAME)&&(t=this.parseName()),{kind:w.OPERATION_DEFINITION,operation:n,name:t,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseOperationType=function(){var e=this.expectToken(T.NAME);switch(e.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(e)},t.parseVariableDefinitions=function(){return this.optionalMany(T.PAREN_L,this.parseVariableDefinition,T.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:w.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(T.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(T.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(e)}},t.parseVariable=function(){var e=this._lexer.token;return this.expectToken(T.DOLLAR),{kind:w.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:w.SELECTION_SET,selections:this.many(T.BRACE_L,this.parseSelection,T.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(T.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,r=this.parseName();return this.expectOptionalToken(T.COLON)?(e=r,t=this.parseName()):t=r,{kind:w.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(T.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(T.PAREN_L,t,T.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(T.COLON),{kind:w.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:w.ARGUMENT,name:this.parseName(),value:(this.expectToken(T.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(T.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(T.NAME)?{kind:w.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:w.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseFragmentDefinition=function(){var e=this._lexer.token;return this.expectKeyword("fragment"),this._options.experimentalFragmentVariables?{kind:w.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}:{kind:w.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseFragmentName=function(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(e){var t=this._lexer.token;switch(t.kind){case T.BRACKET_L:return this.parseList(e);case T.BRACE_L:return this.parseObject(e);case T.INT:return this._lexer.advance(),{kind:w.INT,value:t.value,loc:this.loc(t)};case T.FLOAT:return this._lexer.advance(),{kind:w.FLOAT,value:t.value,loc:this.loc(t)};case T.STRING:case T.BLOCK_STRING:return this.parseStringLiteral();case T.NAME:return"true"===t.value||"false"===t.value?(this._lexer.advance(),{kind:w.BOOLEAN,value:"true"===t.value,loc:this.loc(t)}):"null"===t.value?(this._lexer.advance(),{kind:w.NULL,loc:this.loc(t)}):(this._lexer.advance(),{kind:w.ENUM,value:t.value,loc:this.loc(t)});case T.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:w.STRING,value:e.value,block:e.kind===T.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:w.LIST,values:this.any(T.BRACKET_L,(function(){return t.parseValueLiteral(e)}),T.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:w.OBJECT,fields:this.any(T.BRACE_L,(function(){return t.parseObjectField(e)}),T.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(T.COLON),{kind:w.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(T.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(T.AT),{kind:w.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(T.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(T.BRACKET_R),e={kind:w.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(T.BANG)?{kind:w.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:w.NAMED_TYPE,name:this.parseName(),loc:this.loc(e)}},t.parseTypeSystemDefinition=function(){var e=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(e.kind===T.NAME)switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(e)},t.peekDescription=function(){return this.peek(T.STRING)||this.peek(T.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var e=this._lexer.token;this.expectKeyword("schema");var t=this.parseDirectives(!0),n=this.many(T.BRACE_L,this.parseOperationTypeDefinition,T.BRACE_R);return{kind:w.SCHEMA_DEFINITION,directives:t,operationTypes:n,loc:this.loc(e)}},t.parseOperationTypeDefinition=function(){var e=this._lexer.token,t=this.parseOperationType();this.expectToken(T.COLON);var n=this.parseNamedType();return{kind:w.OPERATION_TYPE_DEFINITION,operation:t,type:n,loc:this.loc(e)}},t.parseScalarTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");var n=this.parseName(),r=this.parseDirectives(!0);return{kind:w.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");var n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:w.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o,loc:this.loc(e)}},t.parseImplementsInterfaces=function(){var e=[];if(this.expectOptionalKeyword("implements")){this.expectOptionalToken(T.AMP);do{e.push(this.parseNamedType())}while(this.expectOptionalToken(T.AMP)||this._options.allowLegacySDLImplementsInterfaces&&this.peek(T.NAME))}return e},t.parseFieldsDefinition=function(){return this._options.allowLegacySDLEmptyFields&&this.peek(T.BRACE_L)&&this._lexer.lookahead().kind===T.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(T.BRACE_L,this.parseFieldDefinition,T.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(T.COLON);var i=this.parseTypeReference(),o=this.parseDirectives(!0);return{kind:w.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:o,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(T.PAREN_L,this.parseInputValueDef,T.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(T.COLON);var r,i=this.parseTypeReference();this.expectOptionalToken(T.EQUALS)&&(r=this.parseValueLiteral(!0));var o=this.parseDirectives(!0);return{kind:w.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:o,loc:this.loc(e)}},t.parseInterfaceTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();return{kind:w.INTERFACE_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i,loc:this.loc(e)}},t.parseUnionTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseUnionMemberTypes();return{kind:w.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){var e=[];if(this.expectOptionalToken(T.EQUALS)){this.expectOptionalToken(T.PIPE);do{e.push(this.parseNamedType())}while(this.expectOptionalToken(T.PIPE))}return e},t.parseEnumTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseEnumValuesDefinition();return{kind:w.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(T.BRACE_L,this.parseEnumValueDefinition,T.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseDirectives(!0);return{kind:w.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseInputObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseInputFieldsDefinition();return{kind:w.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(T.BRACE_L,this.parseInputValueDef,T.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===T.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)},t.parseSchemaExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var t=this.parseDirectives(!0),n=this.optionalMany(T.BRACE_L,this.parseOperationTypeDefinition,T.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:w.SCHEMA_EXTENSION,directives:t,operationTypes:n,loc:this.loc(e)}},t.parseScalarTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var t=this.parseName(),n=this.parseDirectives(!0);if(0===n.length)throw this.unexpected();return{kind:w.SCALAR_TYPE_EXTENSION,name:t,directives:n,loc:this.loc(e)}},t.parseObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return{kind:w.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInterfaceTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:w.INTERFACE_TYPE_EXTENSION,name:t,directives:n,fields:r,loc:this.loc(e)}},t.parseUnionTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:w.UNION_TYPE_EXTENSION,name:t,directives:n,types:r,loc:this.loc(e)}},t.parseEnumTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:w.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r,loc:this.loc(e)}},t.parseInputObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:w.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r,loc:this.loc(e)}},t.parseDirectiveDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(T.AT);var n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var o=this.parseDirectiveLocations();return{kind:w.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:o,loc:this.loc(e)}},t.parseDirectiveLocations=function(){this.expectOptionalToken(T.PIPE);var e=[];do{e.push(this.parseDirectiveLocation())}while(this.expectOptionalToken(T.PIPE));return e},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==j[t.value])return t;throw this.unexpected(e)},t.loc=function(e){if(!this._options.noLocation)return new q(e,this._lexer.lastToken,this._lexer.source)},t.peek=function(e){return this._lexer.token.kind===e},t.expectToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw E(this._lexer.source,t.start,"Expected ".concat(e,", found ").concat(P(t)))},t.expectOptionalToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t},t.expectKeyword=function(e){var t=this._lexer.token;if(t.kind!==T.NAME||t.value!==e)throw E(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(P(t)));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===T.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=e||this._lexer.token;return E(this._lexer.source,t.start,"Unexpected ".concat(P(t)))},t.any=function(e,t,n){this.expectToken(e);for(var r=[];!this.expectOptionalToken(n);)r.push(t.call(this));return r},t.optionalMany=function(e,t,n){if(this.expectOptionalToken(e)){var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}return[]},t.many=function(e,t,n){this.expectToken(e);var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r},e}();function q(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}function P(e){var t=e.value;return t?"".concat(e.kind,' "').concat(t,'"'):e.kind}p(q,(function(){return{start:this.start,end:this.end}}));var V=Object.freeze({__proto__:null,parse:C,parseValue:function(e,t){var n=new Q(e,t);n.expectToken(T.SOF);var r=n.parseValueLiteral(!1);return n.expectToken(T.EOF),r},parseType:function(e,t){var n=new Q(e,t);n.expectToken(T.SOF);var r=n.parseTypeReference();return n.expectToken(T.EOF),r}}),L={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},$=Object.freeze({});function B(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:L,r=void 0,i=Array.isArray(e),o=[e],a=-1,s=[],u=void 0,l=void 0,f=void 0,p=[],h=[],d=e;do{var v=++a===o.length,y=v&&0!==s.length;if(v){if(l=0===h.length?void 0:p[p.length-1],u=f,f=h.pop(),y){if(i)u=u.slice();else{for(var m={},g=0,b=Object.keys(u);g1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=-1===e.indexOf("\n"),i=" "===e[0]||"\t"===e[0],o='"'===e[e.length-1],a=!r||o||n,s="";return!a||r&&i||(s+="\n"+t),s+=t?e.replace(/\n/g,"\n"+t):e,a&&(s+="\n"),'"""'+s.replace(/"""/g,'\\"""')+'"""'}(n,"description"===t?"":" "):JSON.stringify(n)},BooleanValue:function(e){return e.value?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){return e.value},ListValue:function(e){return"["+W(e.values,", ")+"]"},ObjectValue:function(e){return"{"+W(e.fields,", ")+"}"},ObjectField:function(e){return e.name+": "+e.value},Directive:function(e){return"@"+e.name+H("(",W(e.arguments,", "),")")},NamedType:function(e){return e.name},ListType:function(e){return"["+e.type+"]"},NonNullType:function(e){return e.type+"!"},SchemaDefinition:function(e){var t=e.directives,n=e.operationTypes;return W(["schema",W(t," "),J(n)]," ")},OperationTypeDefinition:function(e){return e.operation+": "+e.type},ScalarTypeDefinition:Y((function(e){return W(["scalar",e.name,W(e.directives," ")]," ")})),ObjectTypeDefinition:Y((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return W(["type",t,H("implements ",W(n," & ")),W(r," "),J(i)]," ")})),FieldDefinition:Y((function(e){var t=e.name,n=e.arguments,r=e.type,i=e.directives;return t+(ee(n)?H("(\n",X(W(n,"\n")),"\n)"):H("(",W(n,", "),")"))+": "+r+H(" ",W(i," "))})),InputValueDefinition:Y((function(e){var t=e.name,n=e.type,r=e.defaultValue,i=e.directives;return W([t+": "+n,H("= ",r),W(i," ")]," ")})),InterfaceTypeDefinition:Y((function(e){var t=e.name,n=e.directives,r=e.fields;return W(["interface",t,W(n," "),J(r)]," ")})),UnionTypeDefinition:Y((function(e){var t=e.name,n=e.directives,r=e.types;return W(["union",t,W(n," "),r&&0!==r.length?"= "+W(r," | "):""]," ")})),EnumTypeDefinition:Y((function(e){var t=e.name,n=e.directives,r=e.values;return W(["enum",t,W(n," "),J(r)]," ")})),EnumValueDefinition:Y((function(e){return W([e.name,W(e.directives," ")]," ")})),InputObjectTypeDefinition:Y((function(e){var t=e.name,n=e.directives,r=e.fields;return W(["input",t,W(n," "),J(r)]," ")})),DirectiveDefinition:Y((function(e){var t=e.name,n=e.arguments,r=e.repeatable,i=e.locations;return"directive @"+t+(ee(n)?H("(\n",X(W(n,"\n")),"\n)"):H("(",W(n,", "),")"))+(r?" repeatable":"")+" on "+W(i," | ")})),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return W(["extend schema",W(t," "),J(n)]," ")},ScalarTypeExtension:function(e){return W(["extend scalar",e.name,W(e.directives," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return W(["extend type",t,H("implements ",W(n," & ")),W(r," "),J(i)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return W(["extend interface",t,W(n," "),J(r)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,r=e.types;return W(["extend union",t,W(n," "),r&&0!==r.length?"= "+W(r," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,r=e.values;return W(["extend enum",t,W(n," "),J(r)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return W(["extend input",t,W(n," "),J(r)]," ")}};function Y(e){return function(t){return W([t.description,e(t)],"\n")}}function W(e,t){return e?e.filter((function(e){return e})).join(t||""):""}function J(e){return e&&0!==e.length?"{\n"+X(W(e,"\n"))+"\n}":""}function H(e,t,n){return t?e+t+(n||""):""}function X(e){return e&&" "+e.replace(/\n/g,"\n ")}function Z(e){return-1!==e.indexOf("\n")}function ee(e){return e&&e.some(Z)}var te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ne(e,t){return e(t={exports:{}},t.exports),t.exports}var re=ne((function(e,t){var n="[object Arguments]",r="[object Map]",i="[object Object]",o="[object Set]",a=/^\[object .+?Constructor\]$/,s=/^(?:0|[1-9]\d*)$/,u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u[n]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u[r]=u["[object Number]"]=u[i]=u["[object RegExp]"]=u[o]=u["[object String]"]=u["[object WeakMap]"]=!1;var c="object"==typeof te&&te&&te.Object===Object&&te,l="object"==typeof self&&self&&self.Object===Object&&self,f=c||l||Function("return this")(),p=t&&!t.nodeType&&t,h=p&&e&&!e.nodeType&&e,d=h&&h.exports===p,v=d&&c.process,y=function(){try{return v&&v.binding&&v.binding("util")}catch(e){}}(),m=y&&y.isTypedArray;function g(e,t){for(var n=-1,r=null==e?0:e.length;++ns))return!1;var c=o.get(e);if(c&&o.get(t))return c==t;var l=-1,f=!0,p=2&n?new oe:void 0;for(o.set(e,t),o.set(t,e);++l-1},re.prototype.set=function(e,t){var n=this.__data__,r=ue(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ie.prototype.clear=function(){this.size=0,this.__data__={hash:new ne,map:new(B||re),string:new ne}},ie.prototype.delete=function(e){var t=ye(this,e).delete(e);return this.size-=t?1:0,t},ie.prototype.get=function(e){return ye(this,e).get(e)},ie.prototype.has=function(e){return ye(this,e).has(e)},ie.prototype.set=function(e,t){var n=ye(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},oe.prototype.add=oe.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},oe.prototype.has=function(e){return this.__data__.has(e)},ae.prototype.clear=function(){this.__data__=new re,this.size=0},ae.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},ae.prototype.get=function(e){return this.__data__.get(e)},ae.prototype.has=function(e){return this.__data__.has(e)},ae.prototype.set=function(e,t){var n=this.__data__;if(n instanceof re){var r=n.__data__;if(!B||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ie(r)}return n.set(e,t),this.size=n.size,this};var ge=P?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991}function Ie(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function xe(e){return null!=e&&"object"==typeof e}var De=m?function(e){return function(t){return e(t)}}(m):function(e){return xe(e)&&Te(e.length)&&!!u[ce(e)]};function Ae(e){return null!=(t=e)&&Te(t.length)&&!Se(t)?se(e):he(e);var t}e.exports=function(e,t){return fe(e,t)}})),ie=ne((function(e,t){var n="[object Arguments]",r="[object Function]",i="[object GeneratorFunction]",o="[object Map]",a="[object Set]",s=/\w*$/,u=/^\[object .+?Constructor\]$/,c=/^(?:0|[1-9]\d*)$/,l={};l[n]=l["[object Array]"]=l["[object ArrayBuffer]"]=l["[object DataView]"]=l["[object Boolean]"]=l["[object Date]"]=l["[object Float32Array]"]=l["[object Float64Array]"]=l["[object Int8Array]"]=l["[object Int16Array]"]=l["[object Int32Array]"]=l[o]=l["[object Number]"]=l["[object Object]"]=l["[object RegExp]"]=l[a]=l["[object String]"]=l["[object Symbol]"]=l["[object Uint8Array]"]=l["[object Uint8ClampedArray]"]=l["[object Uint16Array]"]=l["[object Uint32Array]"]=!0,l["[object Error]"]=l[r]=l["[object WeakMap]"]=!1;var f="object"==typeof te&&te&&te.Object===Object&&te,p="object"==typeof self&&self&&self.Object===Object&&self,h=f||p||Function("return this")(),d=t&&!t.nodeType&&t,v=d&&e&&!e.nodeType&&e,y=v&&v.exports===d;function m(e,t){return e.set(t[0],t[1]),e}function g(e,t){return e.add(t),e}function b(e,t,n,r){var i=-1,o=e?e.length:0;for(r&&o&&(n=e[++i]);++i-1},oe.prototype.set=function(e,t){var n=this.__data__,r=le(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},ae.prototype.clear=function(){this.__data__={hash:new ie,map:new(G||oe),string:new ie}},ae.prototype.delete=function(e){return ve(this,e).delete(e)},ae.prototype.get=function(e){return ve(this,e).get(e)},ae.prototype.has=function(e){return ve(this,e).has(e)},ae.prototype.set=function(e,t){return ve(this,e).set(e,t),this},se.prototype.clear=function(){this.__data__=new oe},se.prototype.delete=function(e){return this.__data__.delete(e)},se.prototype.get=function(e){return this.__data__.get(e)},se.prototype.has=function(e){return this.__data__.has(e)},se.prototype.set=function(e,t){var n=this.__data__;if(n instanceof oe){var r=n.__data__;if(!G||r.length<199)return r.push([e,t]),this;n=this.__data__=new ae(r)}return n.set(e,t),this};var me=L?_(L,Object):function(){return[]},ge=function(e){return R.call(e)};function be(e,t){return!!(t=null==t?9007199254740991:t)&&("number"==typeof e||c.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991}(e.length)&&!Se(e)}var Ne=$||function(){return!1};function Se(e){var t=Te(e)?R.call(e):"";return t==r||t==i}function Te(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ie(e){return ke(e)?ue(e):function(e){if(!Ee(e))return B(e);var t=[];for(var n in Object(e))A.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return fe(e,!1,!0)}})),oe=ne((function(e,t){!function(t,n){e.exports=n()}(0,(function(){var e=[],t=[],n={},r={},i={};function o(e){return"string"==typeof e?new RegExp("^"+e+"$","i"):e}function a(e,t){return e===t?t:e===e.toUpperCase()?t.toUpperCase():e[0]===e[0].toUpperCase()?t.charAt(0).toUpperCase()+t.substr(1).toLowerCase():t.toLowerCase()}function s(e,t){return e.replace(/\$(\d{1,2})/g,(function(e,n){return t[n]||""}))}function u(e,t){return e.replace(t[0],(function(n,r){var i=s(t[1],arguments);return a(""===n?e[r-1]:n,i)}))}function c(e,t,r){if(!e.length||n.hasOwnProperty(e))return t;for(var i=r.length;i--;){var o=r[i];if(o[0].test(t))return u(t,o)}return t}function l(e,t,n){return function(r){var i=r.toLowerCase();return t.hasOwnProperty(i)?a(r,i):e.hasOwnProperty(i)?a(r,e[i]):c(i,r,n)}}function f(e,t,n,r){return function(r){var i=r.toLowerCase();return!!t.hasOwnProperty(i)||!e.hasOwnProperty(i)&&c(i,i,n)===i}}function p(e,t,n){return(n?t+" ":"")+(1===t?p.singular(e):p.plural(e))}return p.plural=l(i,r,e),p.isPlural=f(i,r,e),p.singular=l(r,i,t),p.isSingular=f(r,i,t),p.addPluralRule=function(t,n){e.push([o(t),n])},p.addSingularRule=function(e,n){t.push([o(e),n])},p.addUncountableRule=function(e){"string"!=typeof e?(p.addPluralRule(e,"$0"),p.addSingularRule(e,"$0")):n[e.toLowerCase()]=!0},p.addIrregularRule=function(e,t){t=t.toLowerCase(),e=e.toLowerCase(),i[e]=t,r[t]=e},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["whiskey","whiskies"]].forEach((function(e){return p.addIrregularRule(e[0],e[1])})),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|tlas|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[emjzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|octop|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/(m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach((function(e){return p.addPluralRule(e[0],e[1])})),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/(m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|tlas|gas|(?:her|at|gr)o|ris)(?:es)?$/i,"$1"],[/(analy|ba|diagno|parenthe|progno|synop|the|empha|cri)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|octop|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach((function(e){return p.addSingularRule(e[0],e[1])})),["adulthood","advice","agenda","aid","alcohol","ammo","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","flounder","fun","gallows","garbage","graffiti","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","manga","news","pike","plankton","pliers","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","species","staff","swine","tennis","traffic","transporation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(p.addUncountableRule),p}))})),ae=oe.plural,se=oe.singular;function ue(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ce(e){return e.charAt(0).toLowerCase()+e.slice(1)}function le(e){return z(fe(e))}function fe(e){return"string"==typeof e?C(e):e}function pe(e){return e.loc.source.body}function he(e){return null!==e&&!(e instanceof Array)&&"object"==typeof e}function de(e,t){if(!e)return{};for(var n=-1,r=t.length,i={};++n=0)return!0;var t=_r.getInstance(),n=!1;return this.getRelations().forEach((function(r){return!(r instanceof t.components.BelongsTo||r instanceof t.components.HasOne)||r.foreignKey!==e||(n=!0,!1)})),n},e.prototype.getRelations=function(){var t=new Map;return this.fields.forEach((function(n,r){e.isFieldAttribute(n)||t.set(r,n)})),t},e.prototype.isTypeFieldOfPolymorphicRelation=function(e){var t=this,n=_r.getInstance(),r=!1;return n.models.forEach((function(i){return!r&&(i.getRelations().forEach((function(i){if(i instanceof n.components.MorphMany||i instanceof n.components.MorphedByMany||i instanceof n.components.MorphOne||i instanceof n.components.MorphTo||i instanceof n.components.MorphToMany){var o=i.related;if(i.type===e&&o&&o.entity===t.baseModel.entity)return r=!0,!1}return!0})),!0)})),r},e.prototype.getRecordWithId=function(e){return this.baseModel.query().withAllRecursive().where("id",me(e)).first()},e.prototype.shouldEagerLoadRelation=function(e,t,n){var r=_r.getInstance();if(t instanceof r.components.HasOne||t instanceof r.components.BelongsTo||t instanceof r.components.MorphOne)return!0;var i=this.baseModel.eagerLoad||[];return Array.prototype.push.apply(i,this.baseModel.eagerSync||[]),void 0!==i.find((function(t){return t===n.singularName||t===n.pluralName||t===e}))},e.prototype.shouldEagerSaveRelation=function(e,t,n){if(t instanceof _r.getInstance().components.BelongsTo)return!0;var r=this.baseModel.eagerSave||[];return Array.prototype.push.apply(r,this.baseModel.eagerSync||[]),void 0!==r.find((function(t){return t===n.singularName||t===n.pluralName||t===e}))},e.prototype.$addMock=function(e){return!this.$findMock(e.action,e.options)&&(this.mocks[e.action]||(this.mocks[e.action]=[]),this.mocks[e.action].push(e),!0)},e.prototype.$findMock=function(e,t){return this.mocks[e]&&this.mocks[e].find((function(e){return!e.options||!t||ve(de(t,Object.keys(e.options)),e.options||{})}))||null},e.prototype.$mockHook=function(e,t){var n,r=null,i=this.$findMock(e,t);return i&&(r=i.returnValue instanceof Function?i.returnValue():i.returnValue||null),r?(r instanceof Array?r.forEach((function(e){return e.$isPersisted=!0})):r.$isPersisted=!0,(n={})[this.pluralName]=r,n):null},e}(),Ee=Object.setPrototypeOf,we=void 0===Ee?function(e,t){return e.__proto__=t,e}:Ee,_e=function(e){function t(n){void 0===n&&(n="Invariant Violation");var r=e.call(this,"number"==typeof n?"Invariant Violation: "+n+" (see https://github.com/apollographql/invariant-packages)":n)||this;return r.framesToPop=1,r.name="Invariant Violation",we(r,t.prototype),r}return n(t,e),t}(Error);function Oe(e,t){if(!e)throw new _e(t)}function ke(e){return function(){return console[e].apply(console,arguments)}}!function(e){e.warn=ke("warn"),e.error=ke("error")}(Oe||(Oe={}));var Ne={env:{}};if("object"==typeof process)Ne=process;else try{Function("stub","process = stub")(Ne)}catch(e){}var Se=Object.prototype,Te=Se.toString,Ie=Se.hasOwnProperty,xe=new Map;function De(e,t){try{return function e(t,n){if(t===n)return!0;var r=Te.call(t),i=Te.call(n);if(r!==i)return!1;switch(r){case"[object Array]":if(t.length!==n.length)return!1;case"[object Object]":if(Ae(t,n))return!0;var o=Object.keys(t),a=Object.keys(n),s=o.length;if(s!==a.length)return!1;for(var u=0;u0){var r=n.connection.filter?n.connection.filter:[];r.sort();var i=t,o={};return r.forEach((function(e){o[e]=i[e]})),n.connection.key+"("+JSON.stringify(o)+")"}return n.connection.key}var a=e;if(t){var s=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var n,r="boolean"==typeof t.cycles&&t.cycles,i=t.cmp&&(n=t.cmp,function(e){return function(t,r){var i={key:t,value:e[t]},o={key:r,value:e[r]};return n(i,o)}}),o=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var n,a;if(Array.isArray(t)){for(a="[",n=0;n-1}))}function Ue(e){return e&&Be(["client"],e)&&Be(["export"],e)}function Ge(e){var t=e.name.value;return"skip"===t||"include"===t}function ze(e,t){var n=t,i=[];return e.definitions.forEach((function(e){if("OperationDefinition"===e.kind)throw"production"===process.env.NODE_ENV?new _e(5):new _e("Found a "+e.operation+" operation"+(e.name?" named '"+e.name.value+"'":"")+". No operations are allowed when using a fragment as a query. Only fragments are allowed.");"FragmentDefinition"===e.kind&&i.push(e)})),void 0===n&&("production"===process.env.NODE_ENV?Oe(1===i.length,6):Oe(1===i.length,"Found "+i.length+" fragments. `fragmentName` must be provided when there is not exactly 1 fragment."),n=i[0].name.value),r(r({},e),{definitions:a([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:n}}]}}],e.definitions)})}function Ke(e){for(var t=[],n=1;n1){var r=[];t=wt(t,r);for(var i=1;i1,i=!1,o=arguments[1],a=o;return new n((function(n){return t.subscribe({next:function(t){var o=!i;if(i=!0,!o||r)try{a=e(a,t)}catch(e){return n.error(e)}else a=t},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(a),n.complete()}})}))}},{key:"concat",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r=0&&i.splice(e,1),a()}});i.push(o)},error:function(e){r.error(e)},complete:function(){a()}});function a(){o.closed&&0===i.length&&r.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),o.unsubscribe()}}))}},{key:c,value:function(){return this}}],[{key:"from",value:function(t){var n="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var r=f(t,c);if(r){var i=r.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return h(i)&&i.constructor===n?i:new n((function(e){return i.subscribe(e)}))}if(a("iterator")&&(r=f(t,u)))return new n((function(e){v((function(){if(!e.closed){var n=!0,i=!1,o=void 0;try{for(var a,s=r.call(t)[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(e.next(u),e.closed)return}}catch(e){i=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}e.complete()}}))}));if(Array.isArray(t))return new n((function(e){v((function(){if(!e.closed){for(var n=0;n0}var $t,Bt=function(e){function t(n){var r,i,o=n.graphQLErrors,a=n.networkError,s=n.errorMessage,u=n.extraInfo,c=e.call(this,s)||this;return c.graphQLErrors=o||[],c.networkError=a||null,c.message=s||(i="",Lt((r=c).graphQLErrors)&&r.graphQLErrors.forEach((function(e){var t=e?e.message:"Error message not found.";i+="GraphQL error: "+t+"\n"})),r.networkError&&(i+="Network error: "+r.networkError.message+"\n"),i=i.replace(/\n$/,"")),c.extraInfo=u,c.__proto__=t.prototype,c}return n(t,e),t}(Error);!function(e){e[e.normal=1]="normal",e[e.refetch=2]="refetch",e[e.poll=3]="poll"}($t||($t={}));var Ut=function(e){function t(t){var n=t.queryManager,r=t.options,i=t.shouldSubscribe,o=void 0===i||i,a=e.call(this,(function(e){return a.onSubscribe(e)}))||this;a.observers=new Set,a.subscriptions=new Set,a.isTornDown=!1,a.options=r,a.variables=r.variables||{},a.queryId=n.generateQueryId(),a.shouldSubscribe=o;var s=We(r.query);return a.queryName=s&&s.name&&s.name.value,a.queryManager=n,a}return n(t,e),t.prototype.result=function(){var e=this;return new Promise((function(t,n){var r={next:function(n){t(n),e.observers.delete(r),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout((function(){i.unsubscribe()}),0)},error:n},i=e.subscribe(r)}))},t.prototype.currentResult=function(){var e=this.getCurrentResult();return void 0===e.data&&(e.data={}),e},t.prototype.getCurrentResult=function(){if(this.isTornDown){var e=this.lastResult;return{data:!this.lastError&&e&&e.data||void 0,error:this.lastError,loading:!1,networkStatus:Qt.error}}var t,n,i,o=this.queryManager.getCurrentQueryResult(this),a=o.data,s=o.partial,u=this.queryManager.queryStore.get(this.queryId),c=this.options.fetchPolicy,l="network-only"===c||"no-cache"===c;if(u){var f=u.networkStatus;if(n=u,void 0===(i=this.options.errorPolicy)&&(i="none"),n&&(n.networkError||"none"===i&&Lt(n.graphQLErrors)))return{data:void 0,loading:!1,networkStatus:f,error:new Bt({graphQLErrors:u.graphQLErrors,networkError:u.networkError})};u.variables&&(this.options.variables=r(r({},this.options.variables),u.variables),this.variables=this.options.variables),t={data:a,loading:Pt(f),networkStatus:f},u.graphQLErrors&&"all"===this.options.errorPolicy&&(t.errors=u.graphQLErrors)}else{var p=l||s&&"cache-only"!==c;t={data:a,loading:p,networkStatus:p?Qt.loading:Qt.ready}}return s||this.updateLastResult(r(r({},t),{stale:!1})),r(r({},t),{partial:s})},t.prototype.isDifferentFromLastResult=function(e){var t=this.lastResultSnapshot;return!(t&&e&&t.networkStatus===e.networkStatus&&t.stale===e.stale&&De(t.data,e.data))},t.prototype.getLastResult=function(){return this.lastResult},t.prototype.getLastError=function(){return this.lastError},t.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},t.prototype.resetQueryStoreErrors=function(){var e=this.queryManager.queryStore.get(this.queryId);e&&(e.networkError=null,e.graphQLErrors=[])},t.prototype.refetch=function(e){var t=this.options.fetchPolicy;return"cache-only"===t?Promise.reject("production"===process.env.NODE_ENV?new _e(3):new _e("cache-only fetchPolicy option should not be used together with query refetch.")):("no-cache"!==t&&"cache-and-network"!==t&&(t="network-only"),De(this.variables,e)||(this.variables=r(r({},this.variables),e)),De(this.options.variables,this.variables)||(this.options.variables=r(r({},this.options.variables),this.variables)),this.queryManager.fetchQuery(this.queryId,r(r({},this.options),{fetchPolicy:t}),$t.refetch))},t.prototype.fetchMore=function(e){var t=this;"production"===process.env.NODE_ENV?Oe(e.updateQuery,4):Oe(e.updateQuery,"updateQuery option is required. This function defines how to update the query data with the new results.");var n=r(r({},e.query?e:r(r(r({},this.options),e),{variables:r(r({},this.variables),e.variables)})),{fetchPolicy:"network-only"}),i=this.queryManager.generateQueryId();return this.queryManager.fetchQuery(i,n,$t.normal,this.queryId).then((function(r){return t.updateQuery((function(t){return e.updateQuery(t,{fetchMoreResult:r.data,variables:n.variables})})),t.queryManager.stopQuery(i),r}),(function(e){throw t.queryManager.stopQuery(i),e}))},t.prototype.subscribeToMore=function(e){var t=this,n=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables}).subscribe({next:function(n){var r=e.updateQuery;r&&t.updateQuery((function(e,t){var i=t.variables;return r(e,{subscriptionData:n,variables:i})}))},error:function(t){e.onError?e.onError(t):"production"===process.env.NODE_ENV||Oe.error("Unhandled GraphQL subscription error",t)}});return this.subscriptions.add(n),function(){t.subscriptions.delete(n)&&n.unsubscribe()}},t.prototype.setOptions=function(e){var t=this.options.fetchPolicy;this.options=r(r({},this.options),e),e.pollInterval?this.startPolling(e.pollInterval):0===e.pollInterval&&this.stopPolling();var n=e.fetchPolicy;return this.setVariables(this.options.variables,t!==n&&("cache-only"===t||"standby"===t||"network-only"===n),e.fetchResults)},t.prototype.setVariables=function(e,t,n){return void 0===t&&(t=!1),void 0===n&&(n=!0),this.isTornDown=!1,e=e||this.variables,!t&&De(e,this.variables)?this.observers.size&&n?this.result():Promise.resolve():(this.variables=this.options.variables=e,this.observers.size?this.queryManager.fetchQuery(this.queryId,this.options):Promise.resolve())},t.prototype.updateQuery=function(e){var t=this.queryManager,n=t.getQueryWithPreviousResult(this.queryId),r=n.previousResult,i=n.variables,o=n.document,a=ht((function(){return e(r,{variables:i})}));a&&(t.dataStore.markUpdateQueryResult(o,i,a),t.broadcastQueries())},t.prototype.stopPolling=function(){this.queryManager.stopPollingQuery(this.queryId),this.options.pollInterval=void 0},t.prototype.startPolling=function(e){Kt(this),this.options.pollInterval=e,this.queryManager.startPollingQuery(this.options,this.queryId)},t.prototype.updateLastResult=function(e){var t=this.lastResult;return this.lastResult=e,this.lastResultSnapshot=this.queryManager.assumeImmutableResults?e:lt(e),t},t.prototype.onSubscribe=function(e){var t=this;try{var n=e._subscription._observer;n&&!n.error&&(n.error=Gt)}catch(e){}var r=!this.observers.size;return this.observers.add(e),e.next&&this.lastResult&&e.next(this.lastResult),e.error&&this.lastError&&e.error(this.lastError),r&&this.setUpQuery(),function(){t.observers.delete(e)&&!t.observers.size&&t.tearDownQuery()}},t.prototype.setUpQuery=function(){var e=this,t=this.queryManager,n=this.queryId;this.shouldSubscribe&&t.addObservableQuery(n,this),this.options.pollInterval&&(Kt(this),t.startPollingQuery(this.options,n));var i=function(t){e.updateLastResult(r(r({},e.lastResult),{errors:t.graphQLErrors,networkStatus:Qt.error,loading:!1})),zt(e.observers,"error",e.lastError=t)};t.observeQuery(n,this.options,{next:function(n){if(e.lastError||e.isDifferentFromLastResult(n)){var r=e.updateLastResult(n),i=e.options,o=i.query,a=i.variables,s=i.fetchPolicy;t.transform(o).hasClientExports?t.getLocalState().addExportedVariables(o,a).then((function(i){var a=e.variables;e.variables=e.options.variables=i,!n.loading&&r&&"cache-only"!==s&&t.transform(o).serverQuery&&!De(a,i)?e.refetch():zt(e.observers,"next",n)})):zt(e.observers,"next",n)}},error:i}).catch(i)},t.prototype.tearDownQuery=function(){var e=this.queryManager;this.isTornDown=!0,e.stopPollingQuery(this.queryId),this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),e.removeObservableQuery(this.queryId),e.stopQuery(this.queryId),this.observers.clear()},t}(Vt);function Gt(e){"production"===process.env.NODE_ENV||Oe.error("Unhandled error",e.message,e.stack)}function zt(e,t,n){var r=[];e.forEach((function(e){return e[t]&&r.push(e)})),r.forEach((function(e){return e[t](n)}))}function Kt(e){var t=e.options.fetchPolicy;"production"===process.env.NODE_ENV?Oe("cache-first"!==t&&"cache-only"!==t,5):Oe("cache-first"!==t&&"cache-only"!==t,"Queries that specify the cache-first and cache-only fetchPolicies cannot also be polling queries.")}var Yt=function(){function e(){this.store={}}return e.prototype.getStore=function(){return this.store},e.prototype.get=function(e){return this.store[e]},e.prototype.initMutation=function(e,t,n){this.store[e]={mutation:t,variables:n||{},loading:!0,error:null}},e.prototype.markMutationError=function(e,t){var n=this.store[e];n&&(n.loading=!1,n.error=t)},e.prototype.markMutationResult=function(e){var t=this.store[e];t&&(t.loading=!1,t.error=null)},e.prototype.reset=function(){this.store={}},e}(),Wt=function(){function e(){this.store={}}return e.prototype.getStore=function(){return this.store},e.prototype.get=function(e){return this.store[e]},e.prototype.initQuery=function(e){var t=this.store[e.queryId];"production"===process.env.NODE_ENV?Oe(!t||t.document===e.document||De(t.document,e.document),19):Oe(!t||t.document===e.document||De(t.document,e.document),"Internal Error: may not update existing query string in store");var n,r=!1,i=null;e.storePreviousVariables&&t&&t.networkStatus!==Qt.loading&&(De(t.variables,e.variables)||(r=!0,i=t.variables)),n=r?Qt.setVariables:e.isPoll?Qt.poll:e.isRefetch?Qt.refetch:Qt.loading;var o=[];t&&t.graphQLErrors&&(o=t.graphQLErrors),this.store[e.queryId]={document:e.document,variables:e.variables,previousVariables:i,networkError:null,graphQLErrors:o,networkStatus:n,metadata:e.metadata},"string"==typeof e.fetchMoreForQueryId&&this.store[e.fetchMoreForQueryId]&&(this.store[e.fetchMoreForQueryId].networkStatus=Qt.fetchMore)},e.prototype.markQueryResult=function(e,t,n){this.store&&this.store[e]&&(this.store[e].networkError=null,this.store[e].graphQLErrors=Lt(t.errors)?t.errors:[],this.store[e].previousVariables=null,this.store[e].networkStatus=Qt.ready,"string"==typeof n&&this.store[n]&&(this.store[n].networkStatus=Qt.ready))},e.prototype.markQueryError=function(e,t,n){this.store&&this.store[e]&&(this.store[e].networkError=t,this.store[e].networkStatus=Qt.error,"string"==typeof n&&this.markQueryResultClient(n,!0))},e.prototype.markQueryResultClient=function(e,t){var n=this.store&&this.store[e];n&&(n.networkError=null,n.previousVariables=null,t&&(n.networkStatus=Qt.ready))},e.prototype.stopQuery=function(e){delete this.store[e]},e.prototype.reset=function(e){var t=this;Object.keys(this.store).forEach((function(n){e.indexOf(n)<0?t.stopQuery(n):t.store[n].networkStatus=Qt.loading}))},e}();var Jt=function(){function e(e){var t=e.cache,n=e.client,r=e.resolvers,i=e.fragmentMatcher;this.cache=t,n&&(this.client=n),r&&this.addResolvers(r),i&&this.setFragmentMatcher(i)}return e.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=mt(t.resolvers,e)})):this.resolvers=mt(this.resolvers,e)},e.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},e.prototype.getResolvers=function(){return this.resolvers||{}},e.prototype.runResolvers=function(e){var t=e.document,n=e.remoteResult,a=e.context,s=e.variables,u=e.onlyRunForcedResolvers,c=void 0!==u&&u;return i(this,void 0,void 0,(function(){return o(this,(function(e){return t?[2,this.resolveDocument(t,n.data,a,s,this.fragmentMatcher,c).then((function(e){return r(r({},n),{data:e.result})}))]:[2,n]}))}))},e.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},e.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},e.prototype.clientQuery=function(e){if(Be(["client"],e)){if(this.resolvers)return e;"production"===process.env.NODE_ENV||Oe.warn("Found @client directives in a query but no ApolloClient resolvers were specified. This means ApolloClient local resolver handling has been disabled, and @client directives will be passed through to your link chain.")}return null},e.prototype.serverQuery=function(e){return this.resolvers?function(e){Ye(e);var t=ot([{test:function(e){return"client"===e.name.value},remove:!0}],e);return t&&(t=B(t,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return Qe(e)&&"__typename"===e.name.value})))return null}}})),t}(e):e},e.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.cache;return r(r({},e),{cache:t,getCacheKey:function(e){if(t.config)return t.config.dataIdFromObject(e);"production"===process.env.NODE_ENV?Oe(!1,6):Oe(!1,"To use context.getCacheKey, you need to use a cache that has a configurable dataIdFromObject, like apollo-cache-inmemory.")}})},e.prototype.addExportedVariables=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),i(this,void 0,void 0,(function(){return o(this,(function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(n),t).then((function(e){return r(r({},t),e.exportedVariables)}))]:[2,r({},t)]}))}))},e.prototype.shouldForceResolvers=function(e){var t=!1;return B(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 $}}}),t},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:st(e),variables:t,returnPartialData:!0,optimistic:!1}).result},e.prototype.resolveDocument=function(e,t,n,a,s,u){return void 0===n&&(n={}),void 0===a&&(a={}),void 0===s&&(s=function(){return!0}),void 0===u&&(u=!1),i(this,void 0,void 0,(function(){var i,c,l,f,p,h,d,v,y;return o(this,(function(o){var m;return i=Xe(e),c=He(e),l=Ze(c),f=i.operation,p=f?(m=f).charAt(0).toUpperCase()+m.slice(1):"Query",d=(h=this).cache,v=h.client,y={fragmentMap:l,context:r(r({},n),{cache:d,client:v}),variables:a,fragmentMatcher:s,defaultOperationType:p,exportedVariables:{},onlyRunForcedResolvers:u},[2,this.resolveSelectionSet(i.selectionSet,t,y).then((function(e){return{result:e,exportedVariables:y.exportedVariables}}))]}))}))},e.prototype.resolveSelectionSet=function(e,t,n){return i(this,void 0,void 0,(function(){var r,a,s,u,c,l=this;return o(this,(function(f){return r=n.fragmentMap,a=n.context,s=n.variables,u=[t],c=function(e){return i(l,void 0,void 0,(function(){var i,c;return o(this,(function(o){return $e(e,s)?Qe(e)?[2,this.resolveField(e,t,n).then((function(t){var n;void 0!==t&&u.push(((n={})[Ce(e)]=t,n))}))]:(qe(e)?i=e:(i=r[e.name.value],"production"===process.env.NODE_ENV?Oe(i,7):Oe(i,"No fragment named "+e.name.value)),i&&i.typeCondition&&(c=i.typeCondition.name.value,n.fragmentMatcher(t,c,a))?[2,this.resolveSelectionSet(i.selectionSet,t,n).then((function(e){u.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(e.selections.map(c)).then((function(){return gt(u)}))]}))}))},e.prototype.resolveField=function(e,t,n){return i(this,void 0,void 0,(function(){var r,i,a,s,u,c,l,f,p,h=this;return o(this,(function(o){return r=n.variables,i=e.name.value,a=Ce(e),s=i!==a,u=t[a]||t[i],c=Promise.resolve(u),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(l=t.__typename||n.defaultOperationType,(f=this.resolvers&&this.resolvers[l])&&(p=f[s?i:a])&&(c=Promise.resolve(p(t,je(e,r),n.context,{field:e,fragmentMap:n.fragmentMap})))),[2,c.then((function(t){return void 0===t&&(t=u),e.directives&&e.directives.forEach((function(e){"export"===e.name.value&&e.arguments&&e.arguments.forEach((function(e){"as"===e.name.value&&"StringValue"===e.value.kind&&(n.exportedVariables[e.value.value]=t)}))})),e.selectionSet?null==t?t:Array.isArray(t)?h.resolveSubSelectedArray(e,t,n):e.selectionSet?h.resolveSelectionSet(e.selectionSet,t,n):void 0:t}))]}))}))},e.prototype.resolveSubSelectedArray=function(e,t,n){var r=this;return Promise.all(t.map((function(t){return null===t?null:Array.isArray(t)?r.resolveSubSelectedArray(e,t,n):e.selectionSet?r.resolveSelectionSet(e.selectionSet,t,n):void 0})))},e}();function Ht(e){var t=new Set,n=null;return new Vt((function(r){return t.add(r),n=n||e.subscribe({next:function(e){t.forEach((function(t){return t.next&&t.next(e)}))},error:function(e){t.forEach((function(t){return t.error&&t.error(e)}))},complete:function(){t.forEach((function(e){return e.complete&&e.complete()}))}}),function(){t.delete(r)&&!t.size&&n&&(n.unsubscribe(),n=null)}}))}var Xt=Object.prototype.hasOwnProperty,Zt=function(){function e(e){var t=e.link,n=e.queryDeduplication,r=void 0!==n&&n,i=e.store,o=e.onBroadcast,a=void 0===o?function(){}:o,s=e.ssrMode,u=void 0!==s&&s,c=e.clientAwareness,l=void 0===c?{}:c,f=e.localState,p=e.assumeImmutableResults;this.mutationStore=new Yt,this.queryStore=new Wt,this.clientAwareness={},this.idCounter=1,this.queries=new Map,this.fetchQueryRejectFns=new Map,this.transformCache=new(ut?WeakMap:Map),this.inFlightLinkObservables=new Map,this.pollingInfoByQueryId=new Map,this.link=t,this.queryDeduplication=r,this.dataStore=i,this.onBroadcast=a,this.clientAwareness=l,this.localState=f||new Jt({cache:i.getCache()}),this.ssrMode=u,this.assumeImmutableResults=!!p}return e.prototype.stop=function(){var e=this;this.queries.forEach((function(t,n){e.stopQueryNoBroadcast(n)})),this.fetchQueryRejectFns.forEach((function(e){e("production"===process.env.NODE_ENV?new _e(8):new _e("QueryManager stopped while query was in flight"))}))},e.prototype.mutate=function(e){var t=e.mutation,n=e.variables,a=e.optimisticResponse,s=e.updateQueries,u=e.refetchQueries,c=void 0===u?[]:u,l=e.awaitRefetchQueries,f=void 0!==l&&l,p=e.update,h=e.errorPolicy,d=void 0===h?"none":h,v=e.fetchPolicy,y=e.context,m=void 0===y?{}:y;return i(this,void 0,void 0,(function(){var e,i,u,l=this;return o(this,(function(o){switch(o.label){case 0:return"production"===process.env.NODE_ENV?Oe(t,9):Oe(t,"mutation option is required. You must specify your GraphQL document in the mutation option."),"production"===process.env.NODE_ENV?Oe(!v||"no-cache"===v,10):Oe(!v||"no-cache"===v,"Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior."),e=this.generateQueryId(),t=this.transform(t).document,this.setQuery(e,(function(){return{document:t}})),n=this.getVariables(t,n),this.transform(t).hasClientExports?[4,this.localState.addExportedVariables(t,n,m)]:[3,2];case 1:n=o.sent(),o.label=2;case 2:return i=function(){var e={};return s&&l.queries.forEach((function(t,n){var r=t.observableQuery;if(r){var i=r.queryName;i&&Xt.call(s,i)&&(e[n]={updater:s[i],query:l.queryStore.get(n)})}})),e},this.mutationStore.initMutation(e,t,n),this.dataStore.markMutationInit({mutationId:e,document:t,variables:n,updateQueries:i(),update:p,optimisticResponse:a}),this.broadcastQueries(),u=this,[2,new Promise((function(o,s){var l,h;u.getObservableFromLink(t,r(r({},m),{optimisticResponse:a}),n,!1).subscribe({next:function(r){dt(r)&&"none"===d?h=new Bt({graphQLErrors:r.errors}):(u.mutationStore.markMutationResult(e),"no-cache"!==v&&u.dataStore.markMutationResult({mutationId:e,result:r,document:t,variables:n,updateQueries:i(),update:p}),l=r)},error:function(t){u.mutationStore.markMutationError(e,t),u.dataStore.markMutationComplete({mutationId:e,optimisticResponse:a}),u.broadcastQueries(),u.setQuery(e,(function(){return{document:null}})),s(new Bt({networkError:t}))},complete:function(){if(h&&u.mutationStore.markMutationError(e,h),u.dataStore.markMutationComplete({mutationId:e,optimisticResponse:a}),u.broadcastQueries(),h)s(h);else{"function"==typeof c&&(c=c(l));var t=[];Lt(c)&&c.forEach((function(e){if("string"==typeof e)u.queries.forEach((function(n){var r=n.observableQuery;r&&r.queryName===e&&t.push(r.refetch())}));else{var n={query:e.query,variables:e.variables,fetchPolicy:"network-only"};e.context&&(n.context=e.context),t.push(u.query(n))}})),Promise.all(f?t:[]).then((function(){u.setQuery(e,(function(){return{document:null}})),"ignore"===d&&l&&dt(l)&&delete l.errors,o(l)}))}}})}))]}}))}))},e.prototype.fetchQuery=function(e,t,n,a){return i(this,void 0,void 0,(function(){var i,s,u,c,l,f,p,h,d,v,y,m,g,b,E,w,_,O,k=this;return o(this,(function(o){switch(o.label){case 0:return i=t.metadata,s=void 0===i?null:i,u=t.fetchPolicy,c=void 0===u?"cache-first":u,l=t.context,f=void 0===l?{}:l,p=this.transform(t.query).document,h=this.getVariables(p,t.variables),this.transform(p).hasClientExports?[4,this.localState.addExportedVariables(p,h,f)]:[3,2];case 1:h=o.sent(),o.label=2;case 2:if(t=r(r({},t),{variables:h}),y=v="network-only"===c||"no-cache"===c,v||(m=this.dataStore.getCache().diff({query:p,variables:h,returnPartialData:!0,optimistic:!1}),g=m.complete,b=m.result,y=!g||"cache-and-network"===c,d=b),E=y&&"cache-only"!==c&&"standby"!==c,Be(["live"],p)&&(E=!0),w=this.idCounter++,_="no-cache"!==c?this.updateQueryWatch(e,p,t):void 0,this.setQuery(e,(function(){return{document:p,lastRequestId:w,invalidated:!0,cancel:_}})),this.invalidate(a),this.queryStore.initQuery({queryId:e,document:p,storePreviousVariables:E,variables:h,isPoll:n===$t.poll,isRefetch:n===$t.refetch,metadata:s,fetchMoreForQueryId:a}),this.broadcastQueries(),E){if(O=this.fetchRequest({requestId:w,queryId:e,document:p,options:t,fetchMoreForQueryId:a}).catch((function(t){throw t.hasOwnProperty("graphQLErrors")?t:(w>=k.getQuery(e).lastRequestId&&(k.queryStore.markQueryError(e,t,a),k.invalidate(e),k.invalidate(a),k.broadcastQueries()),new Bt({networkError:t}))})),"cache-and-network"!==c)return[2,O];O.catch((function(){}))}return this.queryStore.markQueryResultClient(e,!E),this.invalidate(e),this.invalidate(a),this.transform(p).hasForcedResolvers?[2,this.localState.runResolvers({document:p,remoteResult:{data:d},context:f,variables:h,onlyRunForcedResolvers:!0}).then((function(n){return k.markQueryResult(e,n,t,a),k.broadcastQueries(),n}))]:(this.broadcastQueries(),[2,{data:d}])}}))}))},e.prototype.markQueryResult=function(e,t,n,r){var i=n.fetchPolicy,o=n.variables,a=n.errorPolicy;"no-cache"===i?this.setQuery(e,(function(){return{newData:{result:t.data,complete:!0}}})):this.dataStore.markQueryResult(t,this.getQuery(e).document,o,r,"ignore"===a||"all"===a)},e.prototype.queryListenerForObserver=function(e,t,n){var r=this;function i(e,t){if(n[e])try{n[e](t)}catch(e){"production"===process.env.NODE_ENV||Oe.error(e)}else"error"===e&&("production"===process.env.NODE_ENV||Oe.error(t))}return function(n,o){if(r.invalidate(e,!1),n){var a=r.getQuery(e),s=a.observableQuery,u=a.document,c=s?s.options.fetchPolicy:t.fetchPolicy;if("standby"!==c){var l=Pt(n.networkStatus),f=s&&s.getLastResult(),p=!(!f||f.networkStatus===n.networkStatus),h=t.returnPartialData||!o&&n.previousVariables||p&&t.notifyOnNetworkStatusChange||"cache-only"===c||"cache-and-network"===c;if(!l||h){var d=Lt(n.graphQLErrors),v=s&&s.options.errorPolicy||t.errorPolicy||"none";if("none"===v&&d||n.networkError)return i("error",new Bt({graphQLErrors:n.graphQLErrors,networkError:n.networkError}));try{var y=void 0,m=void 0;if(o)"no-cache"!==c&&"network-only"!==c&&r.setQuery(e,(function(){return{newData:null}})),y=o.result,m=!o.complete;else{var g=s&&s.getLastError(),b="none"!==v&&(g&&g.graphQLErrors)!==n.graphQLErrors;if(f&&f.data&&!b)y=f.data,m=!1;else{var E=r.dataStore.getCache().diff({query:u,variables:n.previousVariables||n.variables,returnPartialData:!0,optimistic:!0});y=E.result,m=!E.complete}}var w=m&&!(t.returnPartialData||"cache-only"===c),_={data:w?f&&f.data:y,loading:l,networkStatus:n.networkStatus,stale:w};"all"===v&&d&&(_.errors=n.graphQLErrors),i("next",_)}catch(e){i("error",new Bt({networkError:e}))}}}}}},e.prototype.transform=function(e){var t,n=this.transformCache;if(!n.has(e)){var r=this.dataStore.getCache(),i=r.transformDocument(e),o=(t=r.transformForLink(i),ot([at],Ye(t))),a=this.localState.clientQuery(i),s=this.localState.serverQuery(o),u={document:i,hasClientExports:Ue(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:s,defaultVars:et(We(i))},c=function(e){e&&!n.has(e)&&n.set(e,u)};c(e),c(i),c(a),c(s)}return n.get(e)},e.prototype.getVariables=function(e,t){return r(r({},this.transform(e).defaultVars),t)},e.prototype.watchQuery=function(e,t){void 0===t&&(t=!0),"production"===process.env.NODE_ENV?Oe("standby"!==e.fetchPolicy,11):Oe("standby"!==e.fetchPolicy,'client.watchQuery cannot be called with fetchPolicy set to "standby"'),e.variables=this.getVariables(e.query,e.variables),void 0===e.notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var n=r({},e);return new Ut({queryManager:this,options:n,shouldSubscribe:t})},e.prototype.query=function(e){var t=this;return"production"===process.env.NODE_ENV?Oe(e.query,12):Oe(e.query,"query option is required. You must specify your GraphQL document in the query option."),"production"===process.env.NODE_ENV?Oe("Document"===e.query.kind,13):Oe("Document"===e.query.kind,'You must wrap the query string in a "gql" tag.'),"production"===process.env.NODE_ENV?Oe(!e.returnPartialData,14):Oe(!e.returnPartialData,"returnPartialData option only supported on watchQuery."),"production"===process.env.NODE_ENV?Oe(!e.pollInterval,15):Oe(!e.pollInterval,"pollInterval option only supported on watchQuery."),new Promise((function(n,r){var i=t.watchQuery(e,!1);t.fetchQueryRejectFns.set("query:"+i.queryId,r),i.result().then(n,r).then((function(){return t.fetchQueryRejectFns.delete("query:"+i.queryId)}))}))},e.prototype.generateQueryId=function(){return String(this.idCounter++)},e.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryInStoreNoBroadcast=function(e){this.stopPollingQuery(e),this.queryStore.stopQuery(e),this.invalidate(e)},e.prototype.addQueryListener=function(e,t){this.setQuery(e,(function(e){return e.listeners.add(t),{invalidated:!1}}))},e.prototype.updateQueryWatch=function(e,t,n){var r=this,i=this.getQuery(e).cancel;i&&i();return this.dataStore.getCache().watch({query:t,variables:n.variables,optimistic:!0,previousResult:function(){var t=null,n=r.getQuery(e).observableQuery;if(n){var i=n.getLastResult();i&&(t=i.data)}return t},callback:function(t){r.setQuery(e,(function(){return{invalidated:!0,newData:t}}))}})},e.prototype.addObservableQuery=function(e,t){this.setQuery(e,(function(){return{observableQuery:t}}))},e.prototype.removeObservableQuery=function(e){var t=this.getQuery(e).cancel;this.setQuery(e,(function(){return{observableQuery:null}})),t&&t()},e.prototype.clearStore=function(){this.fetchQueryRejectFns.forEach((function(e){e("production"===process.env.NODE_ENV?new _e(16):new _e("Store reset while query was in flight (not completed in link chain)"))}));var e=[];return this.queries.forEach((function(t,n){t.observableQuery&&e.push(n)})),this.queryStore.reset(e),this.mutationStore.reset(),this.dataStore.reset()},e.prototype.resetStore=function(){var e=this;return this.clearStore().then((function(){return e.reFetchObservableQueries()}))},e.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var n=[];return this.queries.forEach((function(r,i){var o=r.observableQuery;if(o){var a=o.options.fetchPolicy;o.resetLastResults(),"cache-only"===a||!e&&"standby"===a||n.push(o.refetch()),t.setQuery(i,(function(){return{newData:null}})),t.invalidate(i)}})),this.broadcastQueries(),Promise.all(n)},e.prototype.observeQuery=function(e,t,n){return this.addQueryListener(e,this.queryListenerForObserver(e,t,n)),this.fetchQuery(e,t)},e.prototype.startQuery=function(e,t,n){return"production"===process.env.NODE_ENV||Oe.warn("The QueryManager.startQuery method has been deprecated"),this.addQueryListener(e,n),this.fetchQuery(e,t).catch((function(){})),e},e.prototype.startGraphQLSubscription=function(e){var t=this,n=e.query,r=e.fetchPolicy,i=e.variables;n=this.transform(n).document,i=this.getVariables(n,i);var o=function(e){return t.getObservableFromLink(n,{},e,!1).map((function(i){if(r&&"no-cache"===r||(t.dataStore.markSubscriptionResult(i,n,e),t.broadcastQueries()),dt(i))throw new Bt({graphQLErrors:i.errors});return i}))};if(this.transform(n).hasClientExports){var a=this.localState.addExportedVariables(n,i).then(o);return new Vt((function(e){var t=null;return a.then((function(n){return t=n.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return o(i)},e.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},e.prototype.removeQuery=function(e){this.fetchQueryRejectFns.delete("query:"+e),this.fetchQueryRejectFns.delete("fetchRequest:"+e),this.getQuery(e).subscriptions.forEach((function(e){return e.unsubscribe()})),this.queries.delete(e)},e.prototype.getCurrentQueryResult=function(e,t){void 0===t&&(t=!0);var n=e.options,r=n.variables,i=n.query,o=n.fetchPolicy,a=n.returnPartialData,s=e.getLastResult(),u=this.getQuery(e.queryId).newData;if(u&&u.complete)return{data:u.result,partial:!1};if("no-cache"===o||"network-only"===o)return{data:void 0,partial:!1};var c=this.dataStore.getCache().diff({query:i,variables:r,previousResult:s?s.data:void 0,returnPartialData:!0,optimistic:t}),l=c.result,f=c.complete;return{data:f||a?l:void 0,partial:!f}},e.prototype.getQueryWithPreviousResult=function(e){var t;if("string"==typeof e){var n=this.getQuery(e).observableQuery;"production"===process.env.NODE_ENV?Oe(n,17):Oe(n,"ObservableQuery with this id doesn't exist: "+e),t=n}else t=e;var r=t.options,i=r.variables,o=r.query;return{previousResult:this.getCurrentQueryResult(t,!1).data,variables:i,document:o}},e.prototype.broadcastQueries=function(){var e=this;this.onBroadcast(),this.queries.forEach((function(t,n){t.invalidated&&t.listeners.forEach((function(r){r&&r(e.queryStore.get(n),t.newData)}))}))},e.prototype.getLocalState=function(){return this.localState},e.prototype.getObservableFromLink=function(e,t,n,i){var o,a=this;void 0===i&&(i=this.queryDeduplication);var s=this.transform(e).serverQuery;if(s){var u=this.inFlightLinkObservables,c=this.link,l={query:s,variables:n,operationName:Je(s)||void 0,context:this.prepareContext(r(r({},t),{forceFetch:!i}))};if(t=l.context,i){var f=u.get(s)||new Map;u.set(s,f);var p=JSON.stringify(n);if(!(o=f.get(p))){f.set(p,o=Ht(Ct(c,l)));var h=function(){f.delete(p),f.size||u.delete(s),d.unsubscribe()},d=o.subscribe({next:h,error:h,complete:h})}}else o=Ht(Ct(c,l))}else o=Vt.of({data:{}}),t=this.prepareContext(t);var v=this.transform(e).clientQuery;return v&&(o=function(e,t){return new Vt((function(n){var r=n.next,i=n.error,o=n.complete,a=0,s=!1,u={next:function(e){++a,new Promise((function(n){n(t(e))})).then((function(e){--a,r&&r.call(n,e),s&&u.complete()}),(function(e){--a,i&&i.call(n,e)}))},error:function(e){i&&i.call(n,e)},complete:function(){s=!0,a||o&&o.call(n)}},c=e.subscribe(u);return function(){return c.unsubscribe()}}))}(o,(function(e){return a.localState.runResolvers({document:v,remoteResult:e,context:t,variables:n})}))),o},e.prototype.fetchRequest=function(e){var t,n,r=this,i=e.requestId,o=e.queryId,a=e.document,s=e.options,u=e.fetchMoreForQueryId,c=s.variables,l=s.errorPolicy,f=void 0===l?"none":l,p=s.fetchPolicy;return new Promise((function(e,l){var h=r.getObservableFromLink(a,s.context,c),d="fetchRequest:"+o;r.fetchQueryRejectFns.set(d,l);var v=function(){r.fetchQueryRejectFns.delete(d),r.setQuery(o,(function(e){e.subscriptions.delete(y)}))},y=h.map((function(e){if(i>=r.getQuery(o).lastRequestId&&(r.markQueryResult(o,e,s,u),r.queryStore.markQueryResult(o,e,u),r.invalidate(o),r.invalidate(u),r.broadcastQueries()),"none"===f&&Lt(e.errors))return l(new Bt({graphQLErrors:e.errors}));if("all"===f&&(n=e.errors),u||"no-cache"===p)t=e.data;else{var h=r.dataStore.getCache().diff({variables:c,query:a,optimistic:!1,returnPartialData:!0}),d=h.result;(h.complete||s.returnPartialData)&&(t=d)}})).subscribe({error:function(e){v(),l(e)},complete:function(){v(),e({data:t,errors:n,loading:!1,networkStatus:Qt.ready,stale:!1})}});r.setQuery(o,(function(e){e.subscriptions.add(y)}))}))},e.prototype.getQuery=function(e){return this.queries.get(e)||{listeners:new Set,invalidated:!1,document:null,newData:null,lastRequestId:1,observableQuery:null,subscriptions:new Set}},e.prototype.setQuery=function(e,t){var n=this.getQuery(e),i=r(r({},n),t(n));this.queries.set(e,i)},e.prototype.invalidate=function(e,t){void 0===t&&(t=!0),e&&this.setQuery(e,(function(){return{invalidated:t}}))},e.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return r(r({},t),{clientAwareness:this.clientAwareness})},e.prototype.checkInFlight=function(e){var t=this.queryStore.get(e);return t&&t.networkStatus!==Qt.ready&&t.networkStatus!==Qt.error},e.prototype.startPollingQuery=function(e,t,n){var i=this,o=e.pollInterval;if("production"===process.env.NODE_ENV?Oe(o,18):Oe(o,"Attempted to start a polling query without a polling interval."),!this.ssrMode){var a=this.pollingInfoByQueryId.get(t);a||this.pollingInfoByQueryId.set(t,a={}),a.interval=o,a.options=r(r({},e),{fetchPolicy:"network-only"});var s=function(){var e=i.pollingInfoByQueryId.get(t);e&&(i.checkInFlight(t)?u():i.fetchQuery(t,e.options,$t.poll).then(u,u))},u=function(){var e=i.pollingInfoByQueryId.get(t);e&&(clearTimeout(e.timeout),e.timeout=setTimeout(s,e.interval))};n&&this.addQueryListener(t,n),u()}return t},e.prototype.stopPollingQuery=function(e){this.pollingInfoByQueryId.delete(e)},e}(),en=function(){function e(e){this.cache=e}return e.prototype.getCache=function(){return this.cache},e.prototype.markQueryResult=function(e,t,n,r,i){void 0===i&&(i=!1);var o=!dt(e);i&&dt(e)&&e.data&&(o=!0),!r&&o&&this.cache.write({result:e.data,dataId:"ROOT_QUERY",query:t,variables:n})},e.prototype.markSubscriptionResult=function(e,t,n){dt(e)||this.cache.write({result:e.data,dataId:"ROOT_SUBSCRIPTION",query:t,variables:n})},e.prototype.markMutationInit=function(e){var t,n=this;e.optimisticResponse&&(t="function"==typeof e.optimisticResponse?e.optimisticResponse(e.variables):e.optimisticResponse,this.cache.recordOptimisticTransaction((function(r){var i=n.cache;n.cache=r;try{n.markMutationResult({mutationId:e.mutationId,result:{data:t},document:e.document,variables:e.variables,updateQueries:e.updateQueries,update:e.update})}finally{n.cache=i}}),e.mutationId))},e.prototype.markMutationResult=function(e){var t=this;if(!dt(e.result)){var n=[{result:e.result.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}],r=e.updateQueries;r&&Object.keys(r).forEach((function(i){var o=r[i],a=o.query,s=o.updater,u=t.cache.diff({query:a.document,variables:a.variables,returnPartialData:!0,optimistic:!1}),c=u.result;if(u.complete){var l=ht((function(){return s(c,{mutationResult:e.result,queryName:Je(a.document)||void 0,queryVariables:a.variables})}));l&&n.push({result:l,dataId:"ROOT_QUERY",query:a.document,variables:a.variables})}})),this.cache.performTransaction((function(t){n.forEach((function(e){return t.write(e)}));var r=e.update;r&&ht((function(){return r(t,e.result)}))}))}},e.prototype.markMutationComplete=function(e){var t=e.mutationId;e.optimisticResponse&&this.cache.removeOptimistic(t)},e.prototype.markUpdateQueryResult=function(e,t,n){this.cache.write({result:n,dataId:"ROOT_QUERY",variables:t,query:e})},e.prototype.reset=function(){return this.cache.reset()},e}(),tn=!1,nn=function(){function e(e){var t=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.cache,r=e.ssrMode,i=void 0!==r&&r,o=e.ssrForceFetchDelay,a=void 0===o?0:o,s=e.connectToDevTools,u=e.queryDeduplication,c=void 0===u||u,l=e.defaultOptions,f=e.assumeImmutableResults,p=void 0!==f&&f,h=e.resolvers,d=e.typeDefs,v=e.fragmentMatcher,y=e.name,m=e.version,g=e.link;if(!g&&h&&(g=jt.empty()),!g||!n)throw"production"===process.env.NODE_ENV?new _e(1):new _e("In order to initialize Apollo Client, you must specify 'link' and 'cache' properties in the options object.\nThese options are part of the upgrade requirements when migrating from Apollo Client 1.x to Apollo Client 2.x.\nFor more information, please visit: https://www.apollographql.com/docs/tutorial/client.html#apollo-client-setup");this.link=g,this.cache=n,this.store=new en(n),this.disableNetworkFetches=i||a>0,this.queryDeduplication=c,this.defaultOptions=l||{},this.typeDefs=d,a&&setTimeout((function(){return t.disableNetworkFetches=!1}),a),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);var b="production"!==process.env.NODE_ENV&&"undefined"!=typeof window&&!window.__APOLLO_CLIENT__;(void 0===s?b:s&&"undefined"!=typeof window)&&(window.__APOLLO_CLIENT__=this),tn||"production"===process.env.NODE_ENV||(tn=!0,"undefined"!=typeof window&&window.document&&window.top===window.self&&void 0===window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("Chrome")>-1&&console.debug("Download the Apollo DevTools for a better development experience: https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm")),this.version="2.6.8",this.localState=new Jt({cache:n,client:this,resolvers:h,fragmentMatcher:v}),this.queryManager=new Zt({link:this.link,store:this.store,queryDeduplication:c,ssrMode:i,clientAwareness:{name:y,version:m},localState:this.localState,assumeImmutableResults:p,onBroadcast:function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.queryStore.getStore(),mutations:t.queryManager.mutationStore.getStore()},dataWithOptimisticResults:t.cache.extract(!0)})}})}return e.prototype.stop=function(){this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=r(r({},this.defaultOptions.watchQuery),e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=r(r({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=r(r({},this.defaultOptions.query),e)),"production"===process.env.NODE_ENV?Oe("cache-and-network"!==e.fetchPolicy,2):Oe("cache-and-network"!==e.fetchPolicy,"The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=r(r({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=r(r({},this.defaultOptions.mutate),e)),this.queryManager.mutate(e)},e.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},e.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return this.queryManager.broadcastQueries(),t},e.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return this.queryManager.broadcastQueries(),t},e.prototype.writeData=function(e){var t=this.cache.writeData(e);return this.queryManager.broadcastQueries(),t},e.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},e.prototype.__requestRaw=function(e){return Ct(this.link,e)},e.prototype.initQueryManager=function(){return"production"===process.env.NODE_ENV||Oe.warn("Calling the initQueryManager method is no longer necessary, and it will be removed from ApolloClient in version 3.0."),this.queryManager},e.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.resetStoreCallbacks.map((function(e){return e()})))})).then((function(){return e.reFetchObservableQueries()}))},e.prototype.clearStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.clearStoreCallbacks.map((function(e){return e()})))}))},e.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},e.prototype.extract=function(e){return this.cache.extract(e)},e.prototype.restore=function(e){return this.cache.restore(e)},e.prototype.addResolvers=function(e){this.localState.addResolvers(e)},e.prototype.setResolvers=function(e){this.localState.setResolvers(e)},e.prototype.getResolvers=function(){return this.localState.getResolvers()},e.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},e}();function rn(e){return{kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GeneratedClientQuery"},selectionSet:on(e)}]}}function on(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return null;if(Array.isArray(e))return on(e[0]);var t=[];return Object.keys(e).forEach((function(n){var r={kind:"Field",name:{kind:"Name",value:n},selectionSet:on(e[n])||void 0};t.push(r)})),{kind:"SelectionSet",selections:t}}var an={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:null,variableDefinitions:null,directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",alias:null,name:{kind:"Name",value:"__typename"},arguments:[],directives:[],selectionSet:null}]}}]},sn=function(){function e(){}return e.prototype.transformDocument=function(e){return e},e.prototype.transformForLink=function(e){return e},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.read({query:e.query,variables:e.variables,optimistic:t})},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.read({query:ze(e.fragment,e.fragmentName),variables:e.variables,rootId:e.id,optimistic:t})},e.prototype.writeQuery=function(e){this.write({dataId:"ROOT_QUERY",result:e.data,query:e.query,variables:e.variables})},e.prototype.writeFragment=function(e){this.write({dataId:e.id,result:e.data,variables:e.variables,query:ze(e.fragment,e.fragmentName)})},e.prototype.writeData=function(e){var t,n,r=e.id,i=e.data;if(void 0!==r){var o=null;try{o=this.read({rootId:r,optimistic:!1,query:an})}catch(e){}var a=o&&o.__typename||"__ClientData",s=Object.assign({__typename:a},i);this.writeFragment({id:r,fragment:(t=s,n=a,{kind:"Document",definitions:[{kind:"FragmentDefinition",typeCondition:{kind:"NamedType",name:{kind:"Name",value:n||"__FakeType"}},name:{kind:"Name",value:"GeneratedClientQuery"},selectionSet:on(t)}]}),data:s})}else this.writeQuery({query:rn(i),data:i})},e}(),un=null,cn={},ln=1,fn=Array,pn=fn["@wry/context:Slot"]||function(){var e=function(){function e(){this.id=["slot",ln++,Date.now(),Math.random().toString(36).slice(2)].join(":")}return e.prototype.hasValue=function(){for(var e=un;e;e=e.parent)if(this.id in e.slots){var t=e.slots[this.id];if(t===cn)break;return e!==un&&(un.slots[this.id]=t),!0}return un&&(un.slots[this.id]=cn),!1},e.prototype.getValue=function(){if(this.hasValue())return un.slots[this.id]},e.prototype.withValue=function(e,t,n,r){var i,o=((i={__proto__:null})[this.id]=e,i),a=un;un={parent:a,slots:o};try{return t.apply(r,n)}finally{un=a}},e.bind=function(e){var t=un;return function(){var n=un;try{return un=t,e.apply(this,arguments)}finally{un=n}}},e.noContext=function(e,t,n){if(!un)return e.apply(n,t);var r=un;try{return un=null,e.apply(n,t)}finally{un=r}},e}();try{Object.defineProperty(fn,"@wry/context:Slot",{value:fn["@wry/context:Slot"]=e,enumerable:!1,writable:!1,configurable:!1})}finally{return e}}();pn.bind,pn.noContext;function hn(){}var dn=function(){function e(e,t){void 0===e&&(e=1/0),void 0===t&&(t=hn),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return e.prototype.has=function(e){return this.map.has(e)},e.prototype.get=function(e){var t=this.getEntry(e);return t&&t.value},e.prototype.getEntry=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var n=t.older,r=t.newer;r&&(r.older=n),n&&(n.newer=r),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=r)}return t},e.prototype.set=function(e,t){var n=this.getEntry(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)},e.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},e.prototype.delete=function(e){var t=this.map.get(e);return!!t&&(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0)},e}(),vn=new pn,yn=[],mn=[];function gn(e,t){if(!e)throw new Error(t||"assertion failure")}function bn(e){switch(e.length){case 0:throw new Error("unknown value");case 1:return e[0];case 2:throw e[1]}}var En=function(){function e(t,n){this.fn=t,this.args=n,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],++e.count}return e.prototype.recompute=function(){if(gn(!this.recomputing,"already recomputing"),function(e){var t=vn.getValue();if(t)return e.parents.add(t),t.childValues.has(e)||t.childValues.set(e,[]),_n(e)?Nn(t,e):Sn(t,e),t}(this)||!In(this))return _n(this)?function(e){var t=xn(e);vn.withValue(e,wn,[e]),function(e){if("function"==typeof e.subscribe)try{An(e),e.unsubscribe=e.subscribe.apply(null,e.args)}catch(t){return e.setDirty(),!1}return!0}(e)&&function(e){if(e.dirty=!1,_n(e))return;kn(e)}(e);return t.forEach(In),bn(e.value)}(this):bn(this.value)},e.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,On(this),An(this))},e.prototype.dispose=function(){var e=this;xn(this).forEach(In),An(this),this.parents.forEach((function(t){t.setDirty(),Dn(t,e)}))},e.count=0,e}();function wn(e){e.recomputing=!0,e.value.length=0;try{e.value[0]=e.fn.apply(null,e.args)}catch(t){e.value[1]=t}e.recomputing=!1}function _n(e){return e.dirty||!(!e.dirtyChildren||!e.dirtyChildren.size)}function On(e){e.parents.forEach((function(t){return Nn(t,e)}))}function kn(e){e.parents.forEach((function(t){return Sn(t,e)}))}function Nn(e,t){if(gn(e.childValues.has(t)),gn(_n(t)),e.dirtyChildren){if(e.dirtyChildren.has(t))return}else e.dirtyChildren=mn.pop()||new Set;e.dirtyChildren.add(t),On(e)}function Sn(e,t){gn(e.childValues.has(t)),gn(!_n(t));var n,r,i,o=e.childValues.get(t);0===o.length?e.childValues.set(t,t.value.slice(0)):(n=o,r=t.value,(i=n.length)>0&&i===r.length&&n[i-1]===r[i-1]||e.setDirty()),Tn(e,t),_n(e)||kn(e)}function Tn(e,t){var n=e.dirtyChildren;n&&(n.delete(t),0===n.size&&(mn.length<100&&mn.push(n),e.dirtyChildren=null))}function In(e){return 0===e.parents.size&&"function"==typeof e.reportOrphan&&!0===e.reportOrphan()}function xn(e){var t=yn;return e.childValues.size>0&&(t=[],e.childValues.forEach((function(n,r){Dn(e,r),t.push(r)}))),gn(null===e.dirtyChildren),t}function Dn(e,t){t.parents.delete(e),e.childValues.delete(t),Tn(e,t)}function An(e){var t=e.unsubscribe;"function"==typeof t&&(e.unsubscribe=void 0,t())}var Rn=function(){function e(e){this.weakness=e}return e.prototype.lookup=function(){for(var e=[],t=0;t0;return d&&!s&&h.missing.forEach((function(e){if(!e.tolerable)throw"production"===process.env.NODE_ENV?new _e(8):new _e("Can't find field "+e.fieldName+" on object "+JSON.stringify(e.object,null,2)+".")})),o&&De(o,h.result)&&(h.result=o),{result:h.result,complete:!d}},e.prototype.executeStoreQuery=function(e){var t=e.query,n=e.rootValue,r=e.contextValue,i=e.variableValues,o=e.fragmentMatcher,a=void 0===o?Gn:o,s=Xe(t),u={query:t,fragmentMap:Ze(He(t)),contextValue:r,variableValues:i,fragmentMatcher:a};return this.executeSelectionSet({selectionSet:s.selectionSet,rootValue:n,execContext:u})},e.prototype.executeSelectionSet=function(e){var t=this,n=e.selectionSet,i=e.rootValue,o=e.execContext,a=o.fragmentMap,s=o.contextValue,u=o.variableValues,c={result:null},l=[],f=s.store.get(i.id),p=f&&f.__typename||"ROOT_QUERY"===i.id&&"Query"||void 0;function h(e){var t;return e.missing&&(c.missing=c.missing||[],(t=c.missing).push.apply(t,e.missing)),e.result}return n.selections.forEach((function(e){var n;if($e(e,u))if(Qe(e)){var c=h(t.executeField(f,p,e,o));void 0!==c&&l.push(((n={})[Ce(e)]=c,n))}else{var d=void 0;if(qe(e))d=e;else if(!(d=a[e.name.value]))throw"production"===process.env.NODE_ENV?new _e(9):new _e("No fragment named "+e.name.value);var v=d.typeCondition&&d.typeCondition.name.value,y=!v||o.fragmentMatcher(i,v,s);if(y){var m=t.executeSelectionSet({selectionSet:d.selectionSet,rootValue:i,execContext:o});"heuristic"===y&&m.missing&&(m=r(r({},m),{missing:m.missing.map((function(e){return r(r({},e),{tolerable:!0})}))})),l.push(h(m))}}})),c.result=gt(l),this.freezeResults&&"production"!==process.env.NODE_ENV&&Object.freeze(c.result),c},e.prototype.executeField=function(e,t,n,r){var i=r.variableValues,o=r.contextValue,a=function(e,t,n,r,i,o){o.resultKey;var a=o.directives,s=n;(r||a)&&(s=Fe(s,r,a));var u=void 0;if(e&&void 0===(u=e[s])&&i.cacheRedirects&&"string"==typeof t){var c=i.cacheRedirects[t];if(c){var l=c[n];l&&(u=l(e,r,{getCacheKey:function(e){var t=i.dataIdFromObject(e);return t&&Ve({id:t,typename:e.__typename})}}))}}if(void 0===u)return{result:u,missing:[{object:e,fieldName:s,tolerable:!1}]};f=u,null!=f&&"object"==typeof f&&"json"===f.type&&(u=u.json);var f;return{result:u}}(e,t,n.name.value,je(n,i),o,{resultKey:Ce(n),directives:Le(n,i)});return Array.isArray(a.result)?this.combineExecResults(a,this.executeSubSelectedArray({field:n,array:a.result,execContext:r})):n.selectionSet?null==a.result?a:this.combineExecResults(a,this.executeSelectionSet({selectionSet:n.selectionSet,rootValue:a.result,execContext:r})):(Un(n,a.result),this.freezeResults&&"production"!==process.env.NODE_ENV&&vt(a),a)},e.prototype.combineExecResults=function(){for(var e,t=[],n=0;n=0)return!0;n[e].push(t)}else n[e]=[t];return!1}var Hn={fragmentMatcher:new Pn,dataIdFromObject:function(e){if(e.__typename){if(void 0!==e.id)return e.__typename+":"+e.id;if(void 0!==e._id)return e.__typename+":"+e._id}return null},addTypename:!0,resultCaching:!0,freezeResults:!1};var Xn=Object.prototype.hasOwnProperty,Zn=function(e){function t(t,n,r){var i=e.call(this,Object.create(null))||this;return i.optimisticId=t,i.parent=n,i.transaction=r,i}return n(t,e),t.prototype.toObject=function(){return r(r({},this.parent.toObject()),this.data)},t.prototype.get=function(e){return Xn.call(this.data,e)?this.data[e]:this.parent.get(e)},t}(zn),er=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;n.watches=new Set,n.typenameDocumentCache=new Map,n.cacheKeyRoot=new Rn(ut),n.silenceBroadcast=!1,n.config=r(r({},Hn),t),n.config.customResolvers&&("production"===process.env.NODE_ENV||Oe.warn("customResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating customResolvers in the next major version."),n.config.cacheRedirects=n.config.customResolvers),n.config.cacheResolvers&&("production"===process.env.NODE_ENV||Oe.warn("cacheResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating cacheResolvers in the next major version."),n.config.cacheRedirects=n.config.cacheResolvers),n.addTypename=!!n.config.addTypename,n.data=n.config.resultCaching?new Ln:new zn,n.optimisticData=n.data,n.storeWriter=new Yn,n.storeReader=new Bn({cacheKeyRoot:n.cacheKeyRoot,freezeResults:t.freezeResults});var i=n,o=i.maybeBroadcastWatch;return n.maybeBroadcastWatch=Cn((function(e){return o.call(n,e)}),{makeCacheKey:function(e){if(!e.optimistic&&!e.previousResult)return i.data instanceof Ln?i.cacheKeyRoot.lookup(e.query,JSON.stringify(e.variables)):void 0}}),n}return n(t,e),t.prototype.restore=function(e){return e&&this.data.replace(e),this},t.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).toObject()},t.prototype.read=function(e){if("string"==typeof e.rootId&&void 0===this.data.get(e.rootId))return null;var t=this.config.fragmentMatcher,n=t&&t.match;return this.storeReader.readQueryFromStore({store:e.optimistic?this.optimisticData:this.data,query:this.transformDocument(e.query),variables:e.variables,rootId:e.rootId,fragmentMatcherFunction:n,previousResult:e.previousResult,config:this.config})||null},t.prototype.write=function(e){var t=this.config.fragmentMatcher,n=t&&t.match;this.storeWriter.writeResultToStore({dataId:e.dataId,result:e.result,variables:e.variables,document:this.transformDocument(e.query),store:this.data,dataIdFromObject:this.config.dataIdFromObject,fragmentMatcherFunction:n}),this.broadcastWatches()},t.prototype.diff=function(e){var t=this.config.fragmentMatcher,n=t&&t.match;return this.storeReader.diffQueryAgainstStore({store:e.optimistic?this.optimisticData:this.data,query:this.transformDocument(e.query),variables:e.variables,returnPartialData:e.returnPartialData,previousResult:e.previousResult,fragmentMatcherFunction:n,config:this.config})},t.prototype.watch=function(e){var t=this;return this.watches.add(e),function(){t.watches.delete(e)}},t.prototype.evict=function(e){throw"production"===process.env.NODE_ENV?new _e(1):new _e("eviction is not implemented on InMemory Cache")},t.prototype.reset=function(){return this.data.clear(),this.broadcastWatches(),Promise.resolve()},t.prototype.removeOptimistic=function(e){for(var t=[],n=0,r=this.optimisticData;r instanceof Zn;)r.optimisticId===e?++n:t.push(r),r=r.parent;if(n>0){for(this.optimisticData=r;t.length>0;){var i=t.pop();this.performTransaction(i.transaction,i.optimisticId)}this.broadcastWatches()}},t.prototype.performTransaction=function(e,t){var n=this.data,r=this.silenceBroadcast;this.silenceBroadcast=!0,"string"==typeof t&&(this.data=this.optimisticData=new Zn(t,this.optimisticData,e));try{e(this)}finally{this.silenceBroadcast=r,this.data=n}this.broadcastWatches()},t.prototype.recordOptimisticTransaction=function(e,t){return this.performTransaction(e,t)},t.prototype.transformDocument=function(e){if(this.addTypename){var t=this.typenameDocumentCache.get(e);return t||(t=B(Ye(e),{SelectionSet:{enter:function(e,t,n){if(!n||"OperationDefinition"!==n.kind){var i=e.selections;if(i&&!i.some((function(e){return Qe(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var o=n;if(!(Qe(o)&&o.directives&&o.directives.some((function(e){return"export"===e.name.value}))))return r(r({},e),{selections:a(i,[nt])})}}}}}),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},t.prototype.broadcastWatches=function(){var e=this;this.silenceBroadcast||this.watches.forEach((function(t){return e.maybeBroadcastWatch(t)}))},t.prototype.maybeBroadcastWatch=function(e){e.callback(this.diff({query:e.query,variables:e.variables,previousResult:e.previousResult&&e.previousResult(),optimistic:e.optimistic}))},t}(sn),tr={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},nr=function(e,t,n){var r=new Error(n);throw r.name="ServerError",r.response=e,r.statusCode=e.status,r.result=t,r},rr=function(e,t){var n;try{n=JSON.stringify(e)}catch(e){var r="production"===process.env.NODE_ENV?new _e(2):new _e("Network request failed. "+t+" is not serializable: "+e.message);throw r.parseError=e,r}return n},ir=function(e){void 0===e&&(e={});var t=e.uri,n=void 0===t?"/graphql":t,i=e.fetch,o=e.includeExtensions,a=e.useGETForQueries,s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i=300&&nr(e,t,"Response not successful: Received status code "+e.status),Array.isArray(t)||t.hasOwnProperty("data")||t.hasOwnProperty("errors")||nr(e,t,"Server response was missing for query '"+(Array.isArray(r)?r.map((function(e){return e.operationName})):r.operationName)+"'."),t}))})).then((function(e){return n.next(e),n.complete(),e})).catch((function(e){"AbortError"!==e.name&&(e.result&&e.result.errors&&e.result.data&&n.next(e.result),n.error(e))})),function(){p&&p.abort()}}))}))};var or,ar,sr=function(e){function t(t){return e.call(this,ir(t).request)||this}return n(t,e),t}(jt);(or=e.ConnectionMode||(e.ConnectionMode={}))[or.AUTO=0]="AUTO",or[or.PLAIN=1]="PLAIN",or[or.NODES=2]="NODES",or[or.EDGES=3]="EDGES",or[or.ITEMS=4]="ITEMS",(ar=e.ArgumentMode||(e.ArgumentMode={}))[ar.TYPE=0]="TYPE",ar[ar.LIST=1]="LIST";var ur,cr=function(){function t(){}return t.transformOutgoingData=function(e,t,n,r,i,o){var a=this,s=_r.getInstance(),u=e.getRelations(),c={};return void 0===i&&(i=new Map),void 0===o&&(o=!1),Object.keys(t).forEach((function(l){var f=t[l],p=e.getRelations().has(l);if(!(f instanceof Array?p&&a.isRecursion(i,f[0]):p&&a.isRecursion(i,f))&&a.shouldIncludeOutgoingField(o&&n,l,f,e,r)){var h=be.getRelatedModel(u.get(l));if(f instanceof Array){var d=s.getModel(se(l),!0);d?(a.addRecordForRecursionDetection(i,f[0]),c[l]=f.map((function(t){return a.transformOutgoingData(d||e,t,n,void 0,i,!0)}))):c[l]=f}else"object"==typeof f&&void 0!==f.$id?(h||(h=s.getModel(f.$self().entity)),a.addRecordForRecursionDetection(i,f),c[l]=a.transformOutgoingData(h,f,n,void 0,i,!0)):c[l]=f}})),c},t.transformIncomingData=function(t,n,r,i){var o=this;void 0===r&&(r=!1),void 0===i&&(i=!1);var a={},s=_r.getInstance();return i||(s.logger.group("Transforming incoming data"),s.logger.log("Raw data:",t)),Array.isArray(t)?a=t.map((function(e){return o.transformIncomingData(e,n,r,!0)})):Object.keys(t).forEach((function(u){if(void 0!==t[u]&&null!==t[u]&&u in t)if(he(t[u])){var c=s.getModel(u,!0)||n;if(t[u].nodes&&s.connectionMode===e.ConnectionMode.NODES)a[ae(u)]=o.transformIncomingData(t[u].nodes,c,r,!0);else if(t[u].edges&&s.connectionMode===e.ConnectionMode.EDGES)a[ae(u)]=o.transformIncomingData(t[u].edges,c,r,!0);else if(t.node&&s.connectionMode===e.ConnectionMode.EDGES)a=o.transformIncomingData(t.node,c,r,!0);else if(t[u].items&&s.connectionMode===e.ConnectionMode.ITEMS)a[ae(u)]=o.transformIncomingData(t[u].items,c,r,!0);else{var l=u;r&&!i&&(l=ce(l=t[u].nodes?c.pluralName:c.singularName)),a[l]=o.transformIncomingData(t[u],c,r,!0)}}else be.isFieldNumber(n.fields.get(u))?a[u]=parseFloat(t[u]):u.endsWith("Type")&&n.isTypeFieldOfPolymorphicRelation(u)?a[u]=ae(ce(t[u])):a[u]=t[u]})),i?a.$isPersisted=!0:(s.logger.log("Transformed data:",a),s.logger.groupEnd()),ye(a)},t.shouldIncludeOutgoingField=function(e,t,n,r,i){if(i&&i.includes(t))return!0;if(t.startsWith("$"))return!1;if("pivot"===t)return!1;if(null==n)return!1;if(!this.inputTypeContainsField(r,t))return!1;if(r.getRelations().has(t)){if(e)return!1;var o=r.getRelations().get(t),a=be.getRelatedModel(o);return!(!a||!r.shouldEagerSaveRelation(t,o,a))}return!0},t.inputTypeContainsField=function(e,t){var n=e.singularName+"Input",r=_r.getInstance().schema.getType(n,!1);if(null===r)throw new Error("Type "+r+" doesn't exist.");return void 0!==r.inputFields.find((function(e){return e.name===t}))},t.addRecordForRecursionDetection=function(e,t){var n=_r.getInstance();if(t)if(t.$self){var r=n.getModel(t.$self().entity),i=e.get(r.singularName)||[];i.push(t.$id),e.set(r.singularName,i)}else n.logger.warn("Seems like you're using non-model classes with plugin graphql. You shouldn't do that.");else n.logger.warn("Trying to add invalid record",t,"to recursion detection")},t.isRecursion=function(e,t){if(!t)return!1;if(!t.$self)return _r.getInstance().logger.warn("Seems like you're using non-model classes with plugin graphql. You shouldn't do that."),!1;var n=_r.getInstance().getModel(t.$self().entity);return(e.get(n.singularName)||[]).includes(t.$id)},t}(),lr=((ur=V)&&ur.default||ur).parse;function fr(e){return e.replace(/[\s,]+/g," ").trim()}var pr={},hr={};var dr=!0;var vr=!1;function yr(e){var t=fr(e);if(pr[t])return pr[t];var n=lr(e,{experimentalFragmentVariables:vr});if(!n||"Document"!==n.kind)throw new Error("Not a valid GraphQL document.");return n=function e(t,n){var r=Object.prototype.toString.call(t);if("[object Array]"===r)return t.map((function(t){return e(t,n)}));if("[object Object]"!==r)throw new Error("Unexpected input.");n&&t.loc&&delete t.loc,t.loc&&(delete t.loc.startToken,delete t.loc.endToken);var i,o,a,s=Object.keys(t);for(i in s)s.hasOwnProperty(i)&&(o=t[s[i]],"[object Object]"!==(a=Object.prototype.toString.call(o))&&"[object Array]"!==a||(t[s[i]]=e(o,!0)));return t}(n=function(e){for(var t,n={},r=[],i=0;i5:t.includes(a.singularName);if(e.shouldEagerLoadRelation(o,i,a)&&!u){var c=t.slice(0);c.push(a.singularName),r.push(n.buildField(a,be.isConnection(i),void 0,c,o,!1))}})),r.join("\n")},t.prepareArguments=function(t){return t=t?ye(t):{},Object.keys(t).forEach((function(n){var r=t[n];r&&he(r)&&(_r.getInstance().adapter.getArgumentMode()===e.ArgumentMode.LIST?(Object.keys(r).forEach((function(e){t[e]=r[e]})),delete t[n]):t[n]={__type:ue(n)})})),t},t}(),kr=function(){function e(){}return e.insertData=function(e,t){return i(this,void 0,void 0,(function(){var n,r=this;return o(this,(function(a){switch(a.label){case 0:return n={},[4,Promise.all(Object.keys(e).map((function(a){return i(r,void 0,void 0,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:return r=e[a],_r.getInstance().logger.log("Inserting records",r),[4,t("insertOrUpdate",{data:r})];case 1:return i=o.sent(),Object.keys(i).forEach((function(e){n[e]||(n[e]=[]),n[e]=n[e].concat(i[e])})),[2]}}))}))})))];case 1:return a.sent(),[2,n]}}))}))},e}(),Nr=function(){function e(){}return e.mutation=function(e,t,n,r){return i(this,void 0,void 0,(function(){var i,a,s,u,c,l,f,p,h;return o(this,(function(o){switch(o.label){case 0:return t?[4,(i=_r.getInstance()).loadSchema()]:[3,5];case 1:return a=o.sent(),s=Er.returnsConnection(a.getMutation(e)),u=Or.buildQuery("mutation",r,e,t,s),[4,i.apollo.request(r,u,t,!0)];case 2:return c=o.sent(),e===i.adapter.getNameForDestroy(r)?[3,4]:((c=c[Object.keys(c)[0]]).id=me(c.id),[4,kr.insertData((h={},h[r.pluralName]=c,h),n)]);case 3:return l=o.sent(),f=l[r.pluralName],(p=f[f.length-1])?[2,p]:(_r.getInstance().logger.log("Couldn't find the record of type '",r.pluralName,"' within",l,". Falling back to find()"),[2,r.baseModel.query().last()]);case 4:return[2,!0];case 5:return[2]}}))}))},e.getModelFromState=function(e){return _r.getInstance().getModel(e.$name)},e.prepareArgs=function(e,t){return e=e||{},t&&(e.id=t),e},e.addRecordToArgs=function(e,t,n){return e[t.singularName]=cr.transformOutgoingData(t,n,!1),e},e.transformArgs=function(e){var t=_r.getInstance();return Object.keys(e).forEach((function(n){var r=e[n];if(r instanceof t.components.Model){var i=t.getModel(se(r.$self().entity)),o=cr.transformOutgoingData(i,r,!1);t.logger.log("A",n,"model was found within the variables and will be transformed from",r,"to",o),e[n]=o}})),e},e}(),Sr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){var e=_r.getInstance(),n=e.components.Model.prototype;e.components.Actions.destroy=t.call.bind(t),n.$destroy=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,this.$dispatch("destroy",{id:me(this.$id)})]}))}))},n.$deleteAndDestroy=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.$delete()];case 1:return e.sent(),[2,this.$destroy()]}}))}))}},t.call=function(e,t){var n=e.state,r=e.dispatch,a=t.id,s=t.args;return i(this,void 0,void 0,(function(){var e,t,i;return o(this,(function(o){switch(o.label){case 0:return a?(e=this.getModelFromState(n),t=_r.getInstance().adapter.getNameForDestroy(e),(i=e.$mockHook("destroy",{id:a}))?[4,kr.insertData(i,r)]:[3,2]):[3,4];case 1:return o.sent(),[2,!0];case 2:return s=this.prepareArgs(s,a),[4,Nr.mutation(t,s,r,e)];case 3:return o.sent(),[2,!0];case 4:throw new Error("The destroy action requires the 'id' to be set")}}))}))},t}(Nr),Tr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){var e=_r.getInstance(),n=e.components.Model;e.components.Actions.fetch=t.call.bind(t),n.fetch=function(e,t){return void 0===t&&(t=!1),i(this,void 0,void 0,(function(){var n;return o(this,(function(r){return he(n=e)||(n={id:e}),[2,this.dispatch("fetch",{filter:n,bypassCache:t})]}))}))}},t.call=function(e,t){var n=e.state,r=e.dispatch;return i(this,void 0,void 0,(function(){var e,i,a,s,u,c,l,f,p;return o(this,(function(o){switch(o.label){case 0:return e=_r.getInstance(),i=this.getModelFromState(n),(a=i.$mockHook("fetch",{filter:t&&t.filter||{}}))?[2,kr.insertData(a,r)]:[4,e.loadSchema()];case 1:return o.sent(),s={},t&&t.filter&&(s=cr.transformOutgoingData(i,t.filter,!0,Object.keys(t.filter))),u=t&&t.bypassCache,c=!s.id,l=e.adapter.getNameForFetch(i,c),f=Or.buildQuery("query",i,l,s,c,c),[4,e.apollo.request(i,f,s,!1,u)];case 2:return p=o.sent(),[2,kr.insertData(p,r)]}}))}))},t}(Nr),Ir=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){var e=_r.getInstance(),n=e.components.Model,r=e.components.Model.prototype;e.components.Actions.mutate=t.call.bind(t),n.mutate=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.dispatch("mutate",e)]}))}))},r.$mutate=function(e){var t=e.name,n=e.args,r=e.multiple;return i(this,void 0,void 0,(function(){return o(this,(function(e){return(n=n||{}).id||(n.id=me(this.$id)),[2,this.$dispatch("mutate",{name:t,args:n,multiple:r})]}))}))}},t.call=function(e,t){var n=e.state,r=e.dispatch,a=t.args,s=t.name;return i(this,void 0,void 0,(function(){var e,t,i;return o(this,(function(o){switch(o.label){case 0:return s?(e=_r.getInstance(),t=this.getModelFromState(n),(i=t.$mockHook("mutate",{name:s,args:a||{}}))?[2,kr.insertData(i,r)]:[4,e.loadSchema()]):[3,2];case 1:return o.sent(),a=this.prepareArgs(a),this.transformArgs(a),[2,Nr.mutation(s,a,r,t)];case 2:throw new Error("The mutate action requires the mutation name ('mutation') to be set")}}))}))},t}(Nr),xr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){var e=_r.getInstance(),n=e.components.Model.prototype;e.components.Actions.persist=t.call.bind(t),n.$persist=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.$dispatch("persist",{id:this.$id,args:e})]}))}))}},t.call=function(e,t){var n=e.state,r=e.dispatch,a=t.id,s=t.args;return i(this,void 0,void 0,(function(){var e,t,i,u,c,l;return o(this,(function(o){switch(o.label){case 0:return a?(e=this.getModelFromState(n),t=_r.getInstance().adapter.getNameForPersist(e),i=e.getRecordWithId(a),(u=e.$mockHook("persist",{id:me(a),args:s||{}}))?[4,kr.insertData(u,r)]:[3,3]):[3,7];case 1:return c=o.sent(),[4,this.deleteObsoleteRecord(e,c,i)];case 2:return o.sent(),[2,c];case 3:return[4,_r.getInstance().loadSchema()];case 4:return o.sent(),s=this.prepareArgs(s),this.addRecordToArgs(s,e,i),[4,Nr.mutation(t,s,r,e)];case 5:return l=o.sent(),[4,this.deleteObsoleteRecord(e,l,i)];case 6:return o.sent(),[2,l];case 7:throw new Error("The persist action requires the 'id' to be set")}}))}))},t.deleteObsoleteRecord=function(e,t,n){return i(this,void 0,void 0,(function(){return o(this,(function(e){return t&&n&&t.id!==n.id?(_r.getInstance().logger.log("Dropping deprecated record",n),[2,n.$delete()]):[2,null]}))}))},t}(Nr),Dr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){var e=_r.getInstance(),n=e.components.Model.prototype;e.components.Actions.push=t.call.bind(t),n.$push=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.$dispatch("push",{data:this,args:e})]}))}))}},t.call=function(e,t){var n=e.state,r=e.dispatch,a=t.data,s=t.args;return i(this,void 0,void 0,(function(){var e,t,i;return o(this,(function(o){switch(o.label){case 0:return a?(e=this.getModelFromState(n),t=_r.getInstance().adapter.getNameForPush(e),(i=e.$mockHook("push",{data:a,args:s||{}}))?[2,kr.insertData(i,r)]:[4,_r.getInstance().loadSchema()]):[3,2];case 1:return o.sent(),s=this.prepareArgs(s,a.id),this.addRecordToArgs(s,e,a),[2,Nr.mutation(t,s,r,e)];case 2:throw new Error("The persist action requires the 'data' to be set")}}))}))},t}(Nr),Ar=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){var e=_r.getInstance(),n=e.components.Model,r=e.components.Model.prototype;e.components.Actions.query=t.call.bind(t),n.customQuery=function(e){var t=e.name,n=e.filter,r=e.multiple,a=e.bypassCache;return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,this.dispatch("query",{name:t,filter:n,multiple:r,bypassCache:a})]}))}))},r.$customQuery=function(e){var t=e.name,n=e.filter,r=e.multiple,a=e.bypassCache;return i(this,void 0,void 0,(function(){return o(this,(function(e){return(n=n||{}).id||(n.id=me(this.$id)),[2,this.$dispatch("query",{name:t,filter:n,multiple:r,bypassCache:a})]}))}))}},t.call=function(e,t){var n=e.state,r=e.dispatch,a=t.name,s=t.filter,u=t.bypassCache;return i(this,void 0,void 0,(function(){var e,t,i,c,l,f,p;return o(this,(function(o){switch(o.label){case 0:return a?(e=_r.getInstance(),t=this.getModelFromState(n),(i=t.$mockHook("query",{name:a,filter:s||{}}))?[2,kr.insertData(i,r)]:[4,e.loadSchema()]):[3,3];case 1:return c=o.sent(),s=s?cr.transformOutgoingData(t,s,!0):{},l=Er.returnsConnection(c.getQuery(a)),f=Or.buildQuery("query",t,a,s,l,!1),[4,e.apollo.request(t,f,s,!1,u)];case 2:return p=o.sent(),[2,kr.insertData(p,r)];case 3:throw new Error("The customQuery action requires the query name ('name') to be set")}}))}))},t}(Nr),Rr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){_r.getInstance().components.RootActions.simpleQuery=t.call.bind(t)},t.call=function(e,t){e.dispatch;var n=t.query,r=t.bypassCache,a=t.variables;return i(this,void 0,void 0,(function(){var e,t,i,s;return o(this,(function(o){switch(o.label){case 0:return e=_r.getInstance(),n?(t=fe(n),(i=e.globalMockHook("simpleQuery",{name:t.definitions[0].name.value,variables:a}))?[2,i]:(a=this.prepareArgs(a),[4,e.apollo.simpleQuery(pe(t),a,r)])):[3,2];case 1:return s=o.sent(),[2,(u=ye(s.data),JSON.parse(JSON.stringify(u)))];case 2:throw new Error("The simpleQuery action requires the 'query' to be set")}var u}))}))},t}(Nr),Mr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.setup=function(){_r.getInstance().components.RootActions.simpleMutation=t.call.bind(t)},t.call=function(e,t){e.dispatch;var n=t.query,r=t.variables;return i(this,void 0,void 0,(function(){var e,t,i;return o(this,(function(o){switch(o.label){case 0:return e=_r.getInstance(),n?(t=fe(n),(i=e.globalMockHook("simpleMutation",{name:t.definitions[0].name.value,variables:r}))?[2,i]:(r=this.prepareArgs(r),[4,e.apollo.simpleMutation(pe(t),r)])):[3,2];case 1:return[2,ye(o.sent().data)];case 2:throw new Error("The simpleMutation action requires the 'query' to be set")}}))}))},t}(Nr),Fr=function(){function e(t,n){_r.setup(t,n),e.setupActions()}return e.prototype.getContext=function(){return _r.getInstance()},e.setupActions=function(){Tr.setup(),xr.setup(),Dr.setup(),Sr.setup(),Ir.setup(),Ar.setup(),Rr.setup(),Mr.setup()},e}(),jr=function(){function e(){}return e.install=function(t,n){return e.instance=new Fr(t,n),e.instance},e}(),Cr=null;var Qr=function(){function e(e,t){this.action=e,this.options=t}return e.prototype.for=function(e){return this.modelClass=e,this},e.prototype.andReturn=function(e){return this.returnValue=e,this.installMock(),this},e.prototype.installMock=function(){"simpleQuery"===this.action||"simpleMutation"===this.action?Cr.addGlobalMock(this):Cr.getModel(this.modelClass.entity).$addMock(this)},e}();return e.DefaultAdapter=wr,e.Mock=Qr,e.Model=be,e.clearORMStore=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:if(!Cr)throw new Error("Please call setupTestUtils() before!");return[4,Cr.database.store.dispatch("entities/deleteAll")];case 1:return e.sent(),[2]}}))}))},e.default=jr,e.mock=function(e,t){if(!Cr)throw new Error("Please call setupTestUtils() before!");return new Qr(e,t)},e.setupTestUtils=function(e){if(!e.instance)throw new Error("Please call this function after setting up the store!");Cr=e.instance.getContext()},e}({}); diff --git a/src/common/context.ts b/src/common/context.ts index 1db0fbef..3039db78 100644 --- a/src/common/context.ts +++ b/src/common/context.ts @@ -150,31 +150,35 @@ export default class Context { public async loadSchema(): Promise { if (!this.schemaWillBeLoaded) { this.schemaWillBeLoaded = new Promise(async (resolve, reject) => { - this.logger.log("Fetching GraphQL Schema initially ..."); + try { + this.logger.log("Fetching GraphQL Schema initially ..."); - this.connectionMode = this.adapter.getConnectionMode(); + this.connectionMode = this.adapter.getConnectionMode(); - // We send a custom header along with the request. This is required for our test suite to mock the schema request. - const context = { - headers: { "X-GraphQL-Introspection-Query": "true" } - }; + // We send a custom header along with the request. This is required for our test suite to mock the schema request. + const context = { + headers: { "X-GraphQL-Introspection-Query": "true" } + }; - const result = await this.apollo.simpleQuery( - introspectionQuery, - {}, - true, - (context as unknown) as Data - ); + const result = await this.apollo.simpleQuery( + introspectionQuery, + {}, + true, + (context as unknown) as Data + ); - this.schema = new Schema(result.data.__schema); + this.schema = new Schema(result.data.__schema); - this.logger.log("GraphQL Schema successful fetched", result); + this.logger.log("GraphQL Schema successful fetched", result); - this.logger.log("Starting to process the schema ..."); - this.processSchema(); - this.logger.log("Schema procession done!"); + this.logger.log("Starting to process the schema ..."); + this.processSchema(); + this.logger.log("Schema procession done!"); - resolve(this.schema); + resolve(this.schema); + } catch (e) { + reject(e); + } }); }