@medplum/fhir-router 2.0.24 → 2.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +42 -14499
- package/dist/cjs/index.cjs.map +7 -1
- package/dist/esm/index.mjs +42 -14492
- package/dist/esm/index.mjs.map +7 -1
- package/package.json +2 -2
- package/dist/cjs/index.min.cjs +0 -2
- package/dist/cjs/index.min.cjs.map +0 -1
- package/dist/esm/index.min.mjs +0 -2
- package/dist/esm/index.min.mjs.map +0 -1
- package/tsconfig.build.json +0 -9
package/dist/esm/index.min.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{OperationOutcomeError as e,badRequest as t,normalizeOperationOutcome as n,parseSearchUrl as r,getReferenceString as i,resolveId as s,getStatus as o,isOk as a,allOk as c,Operator as u,parseSearchRequest as l,getSearchParameters as p,getResourceTypeSchema as d,isResourceType as f,getElementDefinition as h,buildTypeName as m,capitalize as y,getResourceTypes as v,isResourceTypeSchema as T,isLowerCase as E,globalSchema as g,toJsBoolean as N,evalFhirPathTyped as I,toTypedValue as b,LRUCache as _,forbidden as O,DEFAULT_SEARCH_COUNT as w,notFound as S,created as A,deepClone as D,matchesSearchRequest as x,evalFhirPath as k}from"@medplum/core";import R from"dataloader";import{applyPatch as F}from"rfc6902";class L{constructor(e,t,n){this.router=e,this.repo=t,this.bundle=n,this.ids={}}async processBatch(){const r=this.bundle.type;if(!r)throw new e(t("Missing bundle type"));if("batch"!==r&&"transaction"!==r)throw new e(t("Unrecognized bundle type"));const i=this.bundle.entry;if(!i)throw new e(t("Missing bundle entry"));const s=[];for(const e of i){const t=this.rewriteIdsInObject(e);e.resource?.id&&(t.resource.id=this.rewriteIdsInString(e.resource.id,!0));try{s.push(await this.processBatchEntry(t))}catch(e){s.push($(n(e)))}}return{resourceType:"Bundle",type:r+"-response",entry:s}}async processBatchEntry(e){this.validateEntry(e);const n=e.request;if(e.resource?.resourceType&&n.ifNoneExist){const i=`https://example.com/${e.resource.resourceType}`,s=new URL("?"+n.ifNoneExist,i),o=(await this.repo.search(r(s))).entry;if(o.length>1)return $(t("Multiple matches"));if(1===o.length){const t=o[0].resource;return e.fullUrl&&this.addReplacementId(e.fullUrl,t),$(c,t)}}let i=e.resource;"PATCH"===n.method&&(i=this.parsePatchBody(e));const s=new URL(n.url,"https://example.com/"),o=await this.router.handleRequest({method:n.method,pathname:s.pathname,params:Object.create(null),query:Object.fromEntries(s.searchParams),body:i},this.repo);return e.fullUrl&&2===o.length&&this.addReplacementId(e.fullUrl,o[1]),$(o[0],o[1])}validateEntry(n){if(!n.request)throw new e(t("Missing entry.request"));if(!n.request.method)throw new e(t("Missing entry.request.method"));if(!n.request.url)throw new e(t("Missing entry.request.url"))}parsePatchBody(n){const r=n.resource;if(!r)throw new e(t("Missing entry.resource"));if("Binary"!==r.resourceType)throw new e(t("Patch resource must be a Binary"));if(!r.data)throw new e(t("Missing entry.resource.data"));return JSON.parse(Buffer.from(r.data,"base64").toString("utf8"))}addReplacementId(e,t){e.startsWith("urn:uuid:")&&(this.ids[e]=t)}rewriteIds(e){return Array.isArray(e)?this.rewriteIdsInArray(e):"string"==typeof e?this.rewriteIdsInString(e):"object"==typeof e?this.rewriteIdsInObject(e):e}rewriteIdsInArray(e){return e.map((e=>this.rewriteIds(e)))}rewriteIdsInObject(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[e,this.rewriteIds(t)])))}rewriteIdsInString(e,t=!1){const n=e.match(/urn:uuid:\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/);if(n){const r=n[0],o=this.ids[r];if(o){let n=i(o);return t&&(n=s({reference:n})),n?e.replaceAll(r,n):e}}return e}}function $(e,t){return{response:{outcome:e,status:o(e).toString(),location:a(e)&&t?.id?i(t):void 0},resource:t}}function C(e,t){if(!Boolean(e))throw new Error(t)}function V(e){return"function"==typeof(null==e?void 0:e.then)}function U(e){return"object"==typeof e&&null!==e}function j(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const M=/\r\n|[\n\r]/g;function P(e,t){let n=0,r=1;for(const i of e.body.matchAll(M)){if("number"==typeof i.index||j(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function B(e,t){const n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,o=t.line+s,a=1===t.line?n:0,c=t.column+a,u=`${e.name}:${o}:${c}\n`,l=r.split(/\r\n|[\n\r]/g),p=l[i];if(p.length>120){const e=Math.floor(c/80),t=c%80,n=[];for(let e=0;e<p.length;e+=80)n.push(p.slice(e,e+80));return u+G([[`${o} |`,n[0]],...n.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",n[e+1]]])}return u+G([[o-1+" |",l[i-1]],[`${o} |`,p],["|","^".padStart(c)],[`${o+1} |`,l[i+1]]])}function G(e){const t=e.filter((([e,t])=>void 0!==t)),n=Math.max(...t.map((([e])=>e.length)));return t.map((([e,t])=>e.padStart(n)+(t?" "+t:""))).join("\n")}class J extends Error{constructor(e,...t){var n,r,i;const{nodes:s,source:o,positions:a,path:c,originalError:u,extensions:l}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=null!=c?c:void 0,this.originalError=null!=u?u:void 0,this.nodes=Y(Array.isArray(s)?s:s?[s]:void 0);const p=Y(null===(n=this.nodes)||void 0===n?void 0:n.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=o?o:null==p||null===(r=p[0])||void 0===r?void 0:r.source,this.positions=null!=a?a:null==p?void 0:p.map((e=>e.start)),this.locations=a&&o?a.map((e=>P(o,e))):null==p?void 0:p.map((e=>P(e.source,e.start)));const d=U(null==u?void 0:u.extensions)?null==u?void 0:u.extensions:void 0;this.extensions=null!==(i=null!=l?l:d)&&void 0!==i?i:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=u&&u.stack?Object.defineProperty(this,"stack",{value:u.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,J):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const n of this.nodes)n.loc&&(e+="\n\n"+B((t=n.loc).source,P(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+B(this.source,t);var t;return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function Y(e){return void 0===e||0===e.length?void 0:e}function Q(e,t,n){return new J(`Syntax Error: ${n}`,{source:e,positions:[t]})}class q{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class K{constructor(e,t,n,r,i,s){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=s,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const z={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:["description","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","interfaces","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","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},X=new Set(Object.keys(z));function H(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&X.has(t)}var W,Z,ee,te;function ne(e){return 9===e||32===e}function re(e){return e>=48&&e<=57}function ie(e){return e>=97&&e<=122||e>=65&&e<=90}function se(e){return ie(e)||95===e}function oe(e){return ie(e)||re(e)||95===e}function ae(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let t=0;t<e.length;++t){var s;const o=e[t],a=ce(o);a!==o.length&&(r=null!==(s=r)&&void 0!==s?s:t,i=t,0!==t&&a<n&&(n=a))}return e.map(((e,t)=>0===t?e:e.slice(n))).slice(null!==(t=r)&&void 0!==t?t:0,i+1)}function ce(e){let t=0;for(;t<e.length&&ne(e.charCodeAt(t));)++t;return t}!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(W||(W={})),function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(Z||(Z={})),function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"}(ee||(ee={})),function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"}(te||(te={}));class ue{constructor(e){const t=new K(te.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){this.lastToken=this.token;return this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==te.EOF)do{if(e.next)e=e.next;else{const t=ye(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===te.COMMENT);return e}}function le(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function pe(e,t){return de(e.charCodeAt(t))&&fe(e.charCodeAt(t+1))}function de(e){return e>=55296&&e<=56319}function fe(e){return e>=56320&&e<=57343}function he(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return te.EOF;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function me(e,t,n,r,i){const s=e.line,o=1+n-e.lineStart;return new K(t,n,r,s,o,i)}function ye(e,t){const n=e.source.body,r=n.length;let i=t;for(;i<r;){const t=n.charCodeAt(i);switch(t){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:10===n.charCodeAt(i+1)?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return ve(e,i);case 33:return me(e,te.BANG,i,i+1);case 36:return me(e,te.DOLLAR,i,i+1);case 38:return me(e,te.AMP,i,i+1);case 40:return me(e,te.PAREN_L,i,i+1);case 41:return me(e,te.PAREN_R,i,i+1);case 46:if(46===n.charCodeAt(i+1)&&46===n.charCodeAt(i+2))return me(e,te.SPREAD,i,i+3);break;case 58:return me(e,te.COLON,i,i+1);case 61:return me(e,te.EQUALS,i,i+1);case 64:return me(e,te.AT,i,i+1);case 91:return me(e,te.BRACKET_L,i,i+1);case 93:return me(e,te.BRACKET_R,i,i+1);case 123:return me(e,te.BRACE_L,i,i+1);case 124:return me(e,te.PIPE,i,i+1);case 125:return me(e,te.BRACE_R,i,i+1);case 34:return 34===n.charCodeAt(i+1)&&34===n.charCodeAt(i+2)?we(e,i):ge(e,i)}if(re(t)||45===t)return Te(e,i,t);if(se(t))return Se(e,i);throw Q(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":le(t)||pe(n,i)?`Unexpected character: ${he(e,i)}.`:`Invalid character: ${he(e,i)}.`)}return me(e,te.EOF,r,r)}function ve(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const e=n.charCodeAt(i);if(10===e||13===e)break;if(le(e))++i;else{if(!pe(n,i))break;i+=2}}return me(e,te.COMMENT,t,i,n.slice(t+1,i))}function Te(e,t,n){const r=e.source.body;let i=t,s=n,o=!1;if(45===s&&(s=r.charCodeAt(++i)),48===s){if(s=r.charCodeAt(++i),re(s))throw Q(e.source,i,`Invalid number, unexpected digit after 0: ${he(e,i)}.`)}else i=Ee(e,i,s),s=r.charCodeAt(i);if(46===s&&(o=!0,s=r.charCodeAt(++i),i=Ee(e,i,s),s=r.charCodeAt(i)),69!==s&&101!==s||(o=!0,s=r.charCodeAt(++i),43!==s&&45!==s||(s=r.charCodeAt(++i)),i=Ee(e,i,s),s=r.charCodeAt(i)),46===s||se(s))throw Q(e.source,i,`Invalid number, expected digit but got: ${he(e,i)}.`);return me(e,o?te.FLOAT:te.INT,t,i,r.slice(t,i))}function Ee(e,t,n){if(!re(n))throw Q(e.source,t,`Invalid number, expected digit but got: ${he(e,t)}.`);const r=e.source.body;let i=t+1;for(;re(r.charCodeAt(i));)++i;return i}function ge(e,t){const n=e.source.body,r=n.length;let i=t+1,s=i,o="";for(;i<r;){const r=n.charCodeAt(i);if(34===r)return o+=n.slice(s,i),me(e,te.STRING,t,i+1,o);if(92!==r){if(10===r||13===r)break;if(le(r))++i;else{if(!pe(n,i))throw Q(e.source,i,`Invalid character within String: ${he(e,i)}.`);i+=2}}else{o+=n.slice(s,i);const t=117===n.charCodeAt(i+1)?123===n.charCodeAt(i+2)?Ne(e,i):Ie(e,i):Oe(e,i);o+=t.value,i+=t.size,s=i}}throw Q(e.source,i,"Unterminated string.")}function Ne(e,t){const n=e.source.body;let r=0,i=3;for(;i<12;){const e=n.charCodeAt(t+i++);if(125===e){if(i<5||!le(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|_e(e),r<0)break}throw Q(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function Ie(e,t){const n=e.source.body,r=be(n,t+2);if(le(r))return{value:String.fromCodePoint(r),size:6};if(de(r)&&92===n.charCodeAt(t+6)&&117===n.charCodeAt(t+7)){const e=be(n,t+8);if(fe(e))return{value:String.fromCodePoint(r,e),size:12}}throw Q(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function be(e,t){return _e(e.charCodeAt(t))<<12|_e(e.charCodeAt(t+1))<<8|_e(e.charCodeAt(t+2))<<4|_e(e.charCodeAt(t+3))}function _e(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Oe(e,t){const n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw Q(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function we(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,s=t+3,o=s,a="";const c=[];for(;s<r;){const r=n.charCodeAt(s);if(34===r&&34===n.charCodeAt(s+1)&&34===n.charCodeAt(s+2)){a+=n.slice(o,s),c.push(a);const r=me(e,te.BLOCK_STRING,t,s+3,ae(c).join("\n"));return e.line+=c.length-1,e.lineStart=i,r}if(92!==r||34!==n.charCodeAt(s+1)||34!==n.charCodeAt(s+2)||34!==n.charCodeAt(s+3))if(10!==r&&13!==r)if(le(r))++s;else{if(!pe(n,s))throw Q(e.source,s,`Invalid character within String: ${he(e,s)}.`);s+=2}else a+=n.slice(o,s),c.push(a),13===r&&10===n.charCodeAt(s+1)?s+=2:++s,a="",o=s,i=s;else a+=n.slice(o,s),o=s+1,s+=4}throw Q(e.source,s,"Unterminated string.")}function Se(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){if(!oe(n.charCodeAt(i)))break;++i}return me(e,te.NAME,t,i,n.slice(t,i))}const Ae=10,De=2;function xe(e){return ke(e,[])}function ke(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return function(e,t){if(null===e)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(function(e){return"function"==typeof e.toJSON}(e)){const t=e.toJSON();if(t!==e)return"string"==typeof t?t:ke(t,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>De)return"[Array]";const n=Math.min(Ae,e.length),r=e.length-n,i=[];for(let r=0;r<n;++r)i.push(ke(e[r],t));1===r?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`);return"["+i.join(", ")+"]"}(e,n);return function(e,t){const n=Object.entries(e);if(0===n.length)return"{}";if(t.length>De)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";const r=n.map((([e,n])=>e+": "+ke(n,t)));return"{ "+r.join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const Re="production"===process.env.NODE_ENV?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if("object"==typeof e&&null!==e){var n;const r=t.prototype[Symbol.toStringTag];if(r===(Symbol.toStringTag in e?e[Symbol.toStringTag]:null===(n=e.constructor)||void 0===n?void 0:n.name)){const t=xe(e);throw new Error(`Cannot use ${r} "${t}" from another module or realm.\n\nEnsure that there is only one instance of "graphql" in the node_modules\ndirectory. If different versions of "graphql" are the dependencies of other\nrelied on modules, use "resolutions" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate "graphql" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`)}}return!1};class Fe{constructor(e,t="GraphQL request",n={line:1,column:1}){"string"==typeof e||C(!1,`Body must be a string. Received: ${xe(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||C(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||C(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}class Le{constructor(e,t={}){const n=function(e){return Re(e,Fe)}(e)?e:new Fe(e);this._lexer=new ue(n),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(te.NAME);return this.node(e,{kind:ee.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:ee.DOCUMENT,definitions:this.many(te.SOF,this.parseDefinition,te.EOF)})}parseDefinition(){if(this.peek(te.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===te.NAME){switch(t.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()}if(e)throw Q(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(te.BRACE_L))return this.node(e,{kind:ee.OPERATION_DEFINITION,operation:W.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(te.NAME)&&(n=this.parseName()),this.node(e,{kind:ee.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(te.NAME);switch(e.value){case"query":return W.QUERY;case"mutation":return W.MUTATION;case"subscription":return W.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(te.PAREN_L,this.parseVariableDefinition,te.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:ee.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(te.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(te.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(te.DOLLAR),this.node(e,{kind:ee.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:ee.SELECTION_SET,selections:this.many(te.BRACE_L,this.parseSelection,te.BRACE_R)})}parseSelection(){return this.peek(te.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,r;return this.expectOptionalToken(te.COLON)?(n=t,r=this.parseName()):r=t,this.node(e,{kind:ee.FIELD,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(te.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(te.PAREN_L,t,te.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(te.COLON),this.node(t,{kind:ee.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(te.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(te.NAME)?this.node(e,{kind:ee.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:ee.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),!0===this._options.allowLegacyFragmentVariables?this.node(e,{kind:ee.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:ee.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case te.BRACKET_L:return this.parseList(e);case te.BRACE_L:return this.parseObject(e);case te.INT:return this.advanceLexer(),this.node(t,{kind:ee.INT,value:t.value});case te.FLOAT:return this.advanceLexer(),this.node(t,{kind:ee.FLOAT,value:t.value});case te.STRING:case te.BLOCK_STRING:return this.parseStringLiteral();case te.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:ee.BOOLEAN,value:!0});case"false":return this.node(t,{kind:ee.BOOLEAN,value:!1});case"null":return this.node(t,{kind:ee.NULL});default:return this.node(t,{kind:ee.ENUM,value:t.value})}case te.DOLLAR:if(e){if(this.expectToken(te.DOLLAR),this._lexer.token.kind===te.NAME){const e=this._lexer.token.value;throw Q(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:ee.STRING,value:e.value,block:e.kind===te.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:ee.LIST,values:this.any(te.BRACKET_L,(()=>this.parseValueLiteral(e)),te.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:ee.OBJECT,fields:this.any(te.BRACE_L,(()=>this.parseObjectField(e)),te.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(te.COLON),this.node(t,{kind:ee.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(te.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(te.AT),this.node(t,{kind:ee.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(te.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(te.BRACKET_R),t=this.node(e,{kind:ee.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(te.BANG)?this.node(e,{kind:ee.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:ee.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(te.STRING)||this.peek(te.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.many(te.BRACE_L,this.parseOperationTypeDefinition,te.BRACE_R);return this.node(e,{kind:ee.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(te.COLON);const n=this.parseNamedType();return this.node(e,{kind:ee.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:ee.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:ee.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(te.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(te.BRACE_L,this.parseFieldDefinition,te.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(te.COLON);const i=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(e,{kind:ee.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:s})}parseArgumentDefs(){return this.optionalMany(te.PAREN_L,this.parseInputValueDef,te.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(te.COLON);const r=this.parseTypeReference();let i;this.expectOptionalToken(te.EQUALS)&&(i=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(e,{kind:ee.INPUT_VALUE_DEFINITION,description:t,name:n,type:r,defaultValue:i,directives:s})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:ee.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:ee.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(te.EQUALS)?this.delimitedMany(te.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:ee.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i})}parseEnumValuesDefinition(){return this.optionalMany(te.BRACE_L,this.parseEnumValueDefinition,te.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:ee.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw Q(this._lexer.source,this._lexer.token.start,`${$e(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:ee.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(te.BRACE_L,this.parseInputValueDef,te.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===te.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)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(te.BRACE_L,this.parseOperationTypeDefinition,te.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:ee.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(e,{kind:ee.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:ee.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:ee.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:ee.UNION_TYPE_EXTENSION,name:t,directives:n,types:r})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:ee.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:ee.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(te.AT);const n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(e,{kind:ee.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:s})}parseDirectiveLocations(){return this.delimitedMany(te.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(Z,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new q(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw Q(this._lexer.source,t.start,`Expected ${Ce(e)}, found ${$e(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==te.NAME||t.value!==e)throw Q(this._lexer.source,t.start,`Expected "${e}", found ${$e(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===te.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return Q(this._lexer.source,t.start,`Unexpected ${$e(t)}.`)}any(e,t,n){this.expectToken(e);const r=[];for(;!this.expectOptionalToken(n);)r.push(t.call(this));return r}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);const r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(void 0!==e&&t.kind!==te.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw Q(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function $e(e){const t=e.value;return Ce(e.kind)+(null!=t?` "${t}"`:"")}function Ce(e){return function(e){return e===te.BANG||e===te.DOLLAR||e===te.AMP||e===te.PAREN_L||e===te.PAREN_R||e===te.SPREAD||e===te.COLON||e===te.EQUALS||e===te.AT||e===te.BRACKET_L||e===te.BRACKET_R||e===te.BRACE_L||e===te.PIPE||e===te.BRACE_R}(e)?`"${e}"`:e}const Ve=5;function Ue(e,t){const[n,r]=t?[e,t]:[void 0,e];let i=" Did you mean ";n&&(i+=n+" ");const s=r.map((e=>`"${e}"`));switch(s.length){case 0:return"";case 1:return i+s[0]+"?";case 2:return i+s[0]+" or "+s[1]+"?"}const o=s.slice(0,Ve),a=o.pop();return i+o.join(", ")+", or "+a+"?"}function je(e){return e}function Me(e,t){const n=Object.create(null);for(const r of e)n[t(r)]=r;return n}function Pe(e,t,n){const r=Object.create(null);for(const i of e)r[t(i)]=n(i);return r}function Be(e,t){const n=Object.create(null);for(const r of Object.keys(e))n[r]=t(e[r],r);return n}function Ge(e,t){let n=0,r=0;for(;n<e.length&&r<t.length;){let i=e.charCodeAt(n),s=t.charCodeAt(r);if(Qe(i)&&Qe(s)){let o=0;do{++n,o=10*o+i-Je,i=e.charCodeAt(n)}while(Qe(i)&&o>0);let a=0;do{++r,a=10*a+s-Je,s=t.charCodeAt(r)}while(Qe(s)&&a>0);if(o<a)return-1;if(o>a)return 1}else{if(i<s)return-1;if(i>s)return 1;++n,++r}}return e.length-t.length}const Je=48,Ye=57;function Qe(e){return!isNaN(e)&&Je<=e&&e<=Ye}function qe(e,t){const n=Object.create(null),r=new Ke(e),i=Math.floor(.4*e.length)+1;for(const e of t){const t=r.measure(e,i);void 0!==t&&(n[e]=t)}return Object.keys(n).sort(((e,t)=>{const r=n[e]-n[t];return 0!==r?r:Ge(e,t)}))}class Ke{constructor(e){this._input=e,this._inputLowerCase=e.toLowerCase(),this._inputArray=ze(this._inputLowerCase),this._rows=[new Array(e.length+1).fill(0),new Array(e.length+1).fill(0),new Array(e.length+1).fill(0)]}measure(e,t){if(this._input===e)return 0;const n=e.toLowerCase();if(this._inputLowerCase===n)return 1;let r=ze(n),i=this._inputArray;if(r.length<i.length){const e=r;r=i,i=e}const s=r.length,o=i.length;if(s-o>t)return;const a=this._rows;for(let e=0;e<=o;e++)a[0][e]=e;for(let e=1;e<=s;e++){const n=a[(e-1)%3],s=a[e%3];let c=s[0]=e;for(let t=1;t<=o;t++){const o=r[e-1]===i[t-1]?0:1;let u=Math.min(n[t]+1,s[t-1]+1,n[t-1]+o);if(e>1&&t>1&&r[e-1]===i[t-2]&&r[e-2]===i[t-1]){const n=a[(e-2)%3][t-2];u=Math.min(u,n+1)}u<c&&(c=u),s[t]=u}if(c>t)return}const c=a[s%3][o];return c<=t?c:void 0}}function ze(e){const t=e.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r);return n}function Xe(e){if(null==e)return Object.create(null);if(null===Object.getPrototypeOf(e))return e;const t=Object.create(null);for(const[n,r]of Object.entries(e))t[n]=r;return t}const He=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function We(e){return Ze[e.charCodeAt(0)]}const Ze=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],et=Object.freeze({});function tt(e,t,n=z){const r=new Map;for(const e of Object.values(ee))r.set(e,nt(t,e));let i,s,o,a=Array.isArray(e),c=[e],u=-1,l=[],p=e;const d=[],f=[];do{u++;const e=u===c.length,v=e&&0!==l.length;if(e){if(s=0===f.length?void 0:d[d.length-1],p=o,o=f.pop(),v)if(a){p=p.slice();let e=0;for(const[t,n]of l){const r=t-e;null===n?(p.splice(r,1),e++):p[r]=n}}else{p=Object.defineProperties({},Object.getOwnPropertyDescriptors(p));for(const[e,t]of l)p[e]=t}u=i.index,c=i.keys,l=i.edits,a=i.inArray,i=i.prev}else if(o){if(s=a?u:c[u],p=o[s],null==p)continue;d.push(s)}let T;if(!Array.isArray(p)){var h,m;H(p)||C(!1,`Invalid AST Node: ${xe(p)}.`);const n=e?null===(h=r.get(p.kind))||void 0===h?void 0:h.leave:null===(m=r.get(p.kind))||void 0===m?void 0:m.enter;if(T=null==n?void 0:n.call(t,p,s,o,d,f),T===et)break;if(!1===T){if(!e){d.pop();continue}}else if(void 0!==T&&(l.push([s,T]),!e)){if(!H(T)){d.pop();continue}p=T}}var y;if(void 0===T&&v&&l.push([s,p]),e)d.pop();else i={inArray:a,index:u,keys:c,edits:l,prev:i},a=Array.isArray(p),c=a?p:null!==(y=n[p.kind])&&void 0!==y?y:[],u=-1,l=[],o&&f.push(o),o=p}while(void 0!==i);return 0!==l.length?l[l.length-1][1]:e}function nt(e,t){const n=e[t];return"object"==typeof n?n:"function"==typeof n?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function rt(e){return tt(e,it)}const it={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>st(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=at("(",st(e.variableDefinitions,", "),")"),n=st([e.operation,st([e.name,t]),st(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r})=>e+": "+t+at(" = ",n)+at(" ",st(r," "))},SelectionSet:{leave:({selections:e})=>ot(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const s=at("",e,": ")+t;let o=s+at("(",st(n,", "),")");return o.length>80&&(o=s+at("(\n",ct(st(n,"\n")),"\n)")),st([o,st(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+at(" ",st(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>st(["...",at("on ",e),st(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${e}${at("(",st(n,", "),")")} on ${t} ${at("",st(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e,t){const n=e.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=1===r.length,s=r.length>1&&r.slice(1).every((e=>0===e.length||ne(e.charCodeAt(0)))),o=n.endsWith('\\"""'),a=e.endsWith('"')&&!o,c=e.endsWith("\\"),u=a||c,l=!(null!=t&&t.minimize)&&(!i||e.length>70||u||s||o);let p="";const d=i&&ne(e.charCodeAt(0));return(l&&!d||s)&&(p+="\n"),p+=n,(l||u)&&(p+="\n"),'"""'+p+'"""'}(e):`"${e.replace(He,We)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+st(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+st(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+at("(",st(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>at("",e,"\n")+st(["schema",st(t," "),ot(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>at("",e,"\n")+st(["scalar",t,st(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>at("",e,"\n")+st(["type",t,at("implements ",st(n," & ")),st(r," "),ot(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>at("",e,"\n")+t+(ut(n)?at("(\n",ct(st(n,"\n")),"\n)"):at("(",st(n,", "),")"))+": "+r+at(" ",st(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>at("",e,"\n")+st([t+": "+n,at("= ",r),st(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>at("",e,"\n")+st(["interface",t,at("implements ",st(n," & ")),st(r," "),ot(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>at("",e,"\n")+st(["union",t,st(n," "),at("= ",st(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>at("",e,"\n")+st(["enum",t,st(n," "),ot(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>at("",e,"\n")+st([t,st(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>at("",e,"\n")+st(["input",t,st(n," "),ot(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:r,locations:i})=>at("",e,"\n")+"directive @"+t+(ut(n)?at("(\n",ct(st(n,"\n")),"\n)"):at("(",st(n,", "),")"))+(r?" repeatable":"")+" on "+st(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>st(["extend schema",st(e," "),ot(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>st(["extend scalar",e,st(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>st(["extend type",e,at("implements ",st(t," & ")),st(n," "),ot(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>st(["extend interface",e,at("implements ",st(t," & ")),st(n," "),ot(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>st(["extend union",e,st(t," "),at("= ",st(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>st(["extend enum",e,st(t," "),ot(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>st(["extend input",e,st(t," "),ot(n)]," ")}};function st(e,t=""){var n;return null!==(n=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==n?n:""}function ot(e){return at("{\n",ct(st(e,"\n")),"\n}")}function at(e,t,n=""){return null!=t&&""!==t?e+t+n:""}function ct(e){return at(" ",e.replace(/\n/g,"\n "))}function ut(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}function lt(e,t){switch(e.kind){case ee.NULL:return null;case ee.INT:return parseInt(e.value,10);case ee.FLOAT:return parseFloat(e.value);case ee.STRING:case ee.ENUM:case ee.BOOLEAN:return e.value;case ee.LIST:return e.values.map((e=>lt(e,t)));case ee.OBJECT:return Pe(e.fields,(e=>e.name.value),(e=>lt(e.value,t)));case ee.VARIABLE:return null==t?void 0:t[e.name.value]}}function pt(e){if(null!=e||C(!1,"Must provide name."),"string"==typeof e||C(!1,"Expected name to be a string."),0===e.length)throw new J("Expected name to be a non-empty string.");for(let t=1;t<e.length;++t)if(!oe(e.charCodeAt(t)))throw new J(`Names must only contain [_a-zA-Z0-9] but "${e}" does not.`);if(!se(e.charCodeAt(0)))throw new J(`Names must start with [_a-zA-Z] but "${e}" does not.`);return e}function dt(e){if("true"===e||"false"===e||"null"===e)throw new J(`Enum values cannot be named: ${e}`);return pt(e)}function ft(e){return ht(e)||mt(e)||yt(e)||vt(e)||Tt(e)||Et(e)||gt(e)||Nt(e)}function ht(e){return Re(e,$t)}function mt(e){return Re(e,Ct)}function yt(e){return Re(e,Jt)}function vt(e){return Re(e,Yt)}function Tt(e){return Re(e,qt)}function Et(e){return Re(e,zt)}function gt(e){return Re(e,St)}function Nt(e){return Re(e,At)}function It(e){return ht(e)||Tt(e)||Et(e)||Dt(e)&&It(e.ofType)}function bt(e){return ht(e)||mt(e)||yt(e)||vt(e)||Tt(e)||Dt(e)&&bt(e.ofType)}function _t(e){return ht(e)||Tt(e)}function Ot(e){return mt(e)||yt(e)||vt(e)}function wt(e){return yt(e)||vt(e)}class St{constructor(e){ft(e)||C(!1,`Expected ${xe(e)} to be a GraphQL type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class At{constructor(e){var t;ft(t=e)&&!Nt(t)||C(!1,`Expected ${xe(e)} to be a GraphQL nullable type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}}function Dt(e){return gt(e)||Nt(e)}function xt(e){if(e)return Nt(e)?e.ofType:e}function kt(e){return ht(e)||mt(e)||yt(e)||vt(e)||Tt(e)||Et(e)}function Rt(e){if(e){let t=e;for(;Dt(t);)t=t.ofType;return t}}function Ft(e){return"function"==typeof e?e():e}function Lt(e){return"function"==typeof e?e():e}class $t{constructor(e){var t,n,r,i;const s=null!==(t=e.parseValue)&&void 0!==t?t:je;this.name=pt(e.name),this.description=e.description,this.specifiedByURL=e.specifiedByURL,this.serialize=null!==(n=e.serialize)&&void 0!==n?n:je,this.parseValue=s,this.parseLiteral=null!==(r=e.parseLiteral)&&void 0!==r?r:(e,t)=>s(lt(e,t)),this.extensions=Xe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(i=e.extensionASTNodes)&&void 0!==i?i:[],null==e.specifiedByURL||"string"==typeof e.specifiedByURL||C(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${xe(e.specifiedByURL)}.`),null==e.serialize||"function"==typeof e.serialize||C(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),e.parseLiteral&&("function"==typeof e.parseValue&&"function"==typeof e.parseLiteral||C(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class Ct{constructor(e){var t;this.name=pt(e.name),this.description=e.description,this.isTypeOf=e.isTypeOf,this.extensions=Xe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=()=>Ut(e),this._interfaces=()=>Vt(e),null==e.isTypeOf||"function"==typeof e.isTypeOf||C(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${xe(e.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Pt(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Vt(e){var t;const n=Ft(null!==(t=e.interfaces)&&void 0!==t?t:[]);return Array.isArray(n)||C(!1,`${e.name} interfaces must be an Array or a function which returns an Array.`),n}function Ut(e){const t=Lt(e.fields);return Mt(t)||C(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),Be(t,((t,n)=>{var r;Mt(t)||C(!1,`${e.name}.${n} field config must be an object.`),null==t.resolve||"function"==typeof t.resolve||C(!1,`${e.name}.${n} field resolver must be a function if provided, but got: ${xe(t.resolve)}.`);const i=null!==(r=t.args)&&void 0!==r?r:{};return Mt(i)||C(!1,`${e.name}.${n} args must be an object with argument names as keys.`),{name:pt(n),description:t.description,type:t.type,args:jt(i),resolve:t.resolve,subscribe:t.subscribe,deprecationReason:t.deprecationReason,extensions:Xe(t.extensions),astNode:t.astNode}}))}function jt(e){return Object.entries(e).map((([e,t])=>({name:pt(e),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:Xe(t.extensions),astNode:t.astNode})))}function Mt(e){return U(e)&&!Array.isArray(e)}function Pt(e){return Be(e,(e=>({description:e.description,type:e.type,args:Bt(e.args),resolve:e.resolve,subscribe:e.subscribe,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function Bt(e){return Pe(e,(e=>e.name),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function Gt(e){return Nt(e.type)&&void 0===e.defaultValue}class Jt{constructor(e){var t;this.name=pt(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=Xe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=Ut.bind(void 0,e),this._interfaces=Vt.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||C(!1,`${this.name} must provide "resolveType" as a function, but got: ${xe(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Pt(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class Yt{constructor(e){var t;this.name=pt(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=Xe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._types=Qt.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||C(!1,`${this.name} must provide "resolveType" as a function, but got: ${xe(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return"function"==typeof this._types&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Qt(e){const t=Ft(e.types);return Array.isArray(t)||C(!1,`Must provide Array of types or a function which returns such an array for Union ${e.name}.`),t}class qt{constructor(e){var t,n,r;this.name=pt(e.name),this.description=e.description,this.extensions=Xe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._values=(n=this.name,Mt(r=e.values)||C(!1,`${n} values must be an object with value names as keys.`),Object.entries(r).map((([e,t])=>(Mt(t)||C(!1,`${n}.${e} must refer to an object with a "value" key representing an internal value but got: ${xe(t)}.`),{name:dt(e),description:t.description,value:void 0!==t.value?t.value:e,deprecationReason:t.deprecationReason,extensions:Xe(t.extensions),astNode:t.astNode})))),this._valueLookup=new Map(this._values.map((e=>[e.value,e]))),this._nameLookup=Me(this._values,(e=>e.name))}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return this._values}getValue(e){return this._nameLookup[e]}serialize(e){const t=this._valueLookup.get(e);if(void 0===t)throw new J(`Enum "${this.name}" cannot represent value: ${xe(e)}`);return t.name}parseValue(e){if("string"!=typeof e){const t=xe(e);throw new J(`Enum "${this.name}" cannot represent non-string value: ${t}.`+Kt(this,t))}const t=this.getValue(e);if(null==t)throw new J(`Value "${e}" does not exist in "${this.name}" enum.`+Kt(this,e));return t.value}parseLiteral(e,t){if(e.kind!==ee.ENUM){const t=rt(e);throw new J(`Enum "${this.name}" cannot represent non-enum value: ${t}.`+Kt(this,t),{nodes:e})}const n=this.getValue(e.value);if(null==n){const t=rt(e);throw new J(`Value "${t}" does not exist in "${this.name}" enum.`+Kt(this,t),{nodes:e})}return n.value}toConfig(){const e=Pe(this.getValues(),(e=>e.name),(e=>({description:e.description,value:e.value,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})));return{name:this.name,description:this.description,values:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Kt(e,t){return Ue("the enum value",qe(t,e.getValues().map((e=>e.name))))}class zt{constructor(e){var t;this.name=pt(e.name),this.description=e.description,this.extensions=Xe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=Xt.bind(void 0,e)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}toConfig(){const e=Be(this.getFields(),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})));return{name:this.name,description:this.description,fields:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Xt(e){const t=Lt(e.fields);return Mt(t)||C(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),Be(t,((t,n)=>(!("resolve"in t)||C(!1,`${e.name}.${n} field has a resolve property, but Input Types cannot define resolvers.`),{name:pt(n),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:Xe(t.extensions),astNode:t.astNode})))}function Ht(e){return Nt(e.type)&&void 0===e.defaultValue}function Wt(e,t){return e===t||(Nt(e)&&Nt(t)||!(!gt(e)||!gt(t)))&&Wt(e.ofType,t.ofType)}function Zt(e,t,n){return t===n||(Nt(n)?!!Nt(t)&&Zt(e,t.ofType,n.ofType):Nt(t)?Zt(e,t.ofType,n):gt(n)?!!gt(t)&&Zt(e,t.ofType,n.ofType):!gt(t)&&(wt(n)&&(yt(t)||mt(t))&&e.isSubType(n,t)))}function en(e,t,n){return t===n||(wt(t)?wt(n)?e.getPossibleTypes(t).some((t=>e.isSubType(n,t))):e.isSubType(t,n):!!wt(n)&&e.isSubType(n,t))}const tn=2147483647,nn=-2147483648,rn=new $t({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize(e){const t=ln(e);if("boolean"==typeof t)return t?1:0;let n=t;if("string"==typeof t&&""!==t&&(n=Number(t)),"number"!=typeof n||!Number.isInteger(n))throw new J(`Int cannot represent non-integer value: ${xe(t)}`);if(n>tn||n<nn)throw new J("Int cannot represent non 32-bit signed integer value: "+xe(t));return n},parseValue(e){if("number"!=typeof e||!Number.isInteger(e))throw new J(`Int cannot represent non-integer value: ${xe(e)}`);if(e>tn||e<nn)throw new J(`Int cannot represent non 32-bit signed integer value: ${e}`);return e},parseLiteral(e){if(e.kind!==ee.INT)throw new J(`Int cannot represent non-integer value: ${rt(e)}`,{nodes:e});const t=parseInt(e.value,10);if(t>tn||t<nn)throw new J(`Int cannot represent non 32-bit signed integer value: ${e.value}`,{nodes:e});return t}}),sn=new $t({name:"Float",description:"The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",serialize(e){const t=ln(e);if("boolean"==typeof t)return t?1:0;let n=t;if("string"==typeof t&&""!==t&&(n=Number(t)),"number"!=typeof n||!Number.isFinite(n))throw new J(`Float cannot represent non numeric value: ${xe(t)}`);return n},parseValue(e){if("number"!=typeof e||!Number.isFinite(e))throw new J(`Float cannot represent non numeric value: ${xe(e)}`);return e},parseLiteral(e){if(e.kind!==ee.FLOAT&&e.kind!==ee.INT)throw new J(`Float cannot represent non numeric value: ${rt(e)}`,e);return parseFloat(e.value)}}),on=new $t({name:"String",description:"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",serialize(e){const t=ln(e);if("string"==typeof t)return t;if("boolean"==typeof t)return t?"true":"false";if("number"==typeof t&&Number.isFinite(t))return t.toString();throw new J(`String cannot represent value: ${xe(e)}`)},parseValue(e){if("string"!=typeof e)throw new J(`String cannot represent a non string value: ${xe(e)}`);return e},parseLiteral(e){if(e.kind!==ee.STRING)throw new J(`String cannot represent a non string value: ${rt(e)}`,{nodes:e});return e.value}}),an=new $t({name:"Boolean",description:"The `Boolean` scalar type represents `true` or `false`.",serialize(e){const t=ln(e);if("boolean"==typeof t)return t;if(Number.isFinite(t))return 0!==t;throw new J(`Boolean cannot represent a non boolean value: ${xe(t)}`)},parseValue(e){if("boolean"!=typeof e)throw new J(`Boolean cannot represent a non boolean value: ${xe(e)}`);return e},parseLiteral(e){if(e.kind!==ee.BOOLEAN)throw new J(`Boolean cannot represent a non boolean value: ${rt(e)}`,{nodes:e});return e.value}}),cn=new $t({name:"ID",description:'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',serialize(e){const t=ln(e);if("string"==typeof t)return t;if(Number.isInteger(t))return String(t);throw new J(`ID cannot represent value: ${xe(e)}`)},parseValue(e){if("string"==typeof e)return e;if("number"==typeof e&&Number.isInteger(e))return e.toString();throw new J(`ID cannot represent value: ${xe(e)}`)},parseLiteral(e){if(e.kind!==ee.STRING&&e.kind!==ee.INT)throw new J("ID cannot represent a non-string and non-integer value: "+rt(e),{nodes:e});return e.value}}),un=Object.freeze([on,rn,sn,an,cn]);function ln(e){if(U(e)){if("function"==typeof e.valueOf){const t=e.valueOf();if(!U(t))return t}if("function"==typeof e.toJSON)return e.toJSON()}return e}function pn(e){return Re(e,dn)}class dn{constructor(e){var t,n;this.name=pt(e.name),this.description=e.description,this.locations=e.locations,this.isRepeatable=null!==(t=e.isRepeatable)&&void 0!==t&&t,this.extensions=Xe(e.extensions),this.astNode=e.astNode,Array.isArray(e.locations)||C(!1,`@${e.name} locations must be an Array.`);const r=null!==(n=e.args)&&void 0!==n?n:{};U(r)&&!Array.isArray(r)||C(!1,`@${e.name} args must be an object with argument names as keys.`),this.args=jt(r)}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:Bt(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}}toString(){return"@"+this.name}toJSON(){return this.toString()}}const fn=new dn({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[Z.FIELD,Z.FRAGMENT_SPREAD,Z.INLINE_FRAGMENT],args:{if:{type:new At(an),description:"Included when true."}}}),hn=new dn({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[Z.FIELD,Z.FRAGMENT_SPREAD,Z.INLINE_FRAGMENT],args:{if:{type:new At(an),description:"Skipped when true."}}}),mn=new dn({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[Z.FIELD_DEFINITION,Z.ARGUMENT_DEFINITION,Z.INPUT_FIELD_DEFINITION,Z.ENUM_VALUE],args:{reason:{type:on,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:"No longer supported"}}}),yn=new dn({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[Z.SCALAR],args:{url:{type:new At(on),description:"The URL that specifies the behavior of this scalar."}}}),vn=Object.freeze([fn,hn,mn,yn]);function Tn(e){return"object"==typeof e&&"function"==typeof(null==e?void 0:e[Symbol.iterator])}function En(e,t){if(Nt(t)){const n=En(e,t.ofType);return(null==n?void 0:n.kind)===ee.NULL?null:n}if(null===e)return{kind:ee.NULL};if(void 0===e)return null;if(gt(t)){const n=t.ofType;if(Tn(e)){const t=[];for(const r of e){const e=En(r,n);null!=e&&t.push(e)}return{kind:ee.LIST,values:t}}return En(e,n)}if(Et(t)){if(!U(e))return null;const n=[];for(const r of Object.values(t.getFields())){const t=En(e[r.name],r.type);t&&n.push({kind:ee.OBJECT_FIELD,name:{kind:ee.NAME,value:r.name},value:t})}return{kind:ee.OBJECT,fields:n}}if(_t(t)){const n=t.serialize(e);if(null==n)return null;if("boolean"==typeof n)return{kind:ee.BOOLEAN,value:n};if("number"==typeof n&&Number.isFinite(n)){const e=String(n);return gn.test(e)?{kind:ee.INT,value:e}:{kind:ee.FLOAT,value:e}}if("string"==typeof n)return Tt(t)?{kind:ee.ENUM,value:n}:t===cn&&gn.test(n)?{kind:ee.INT,value:n}:{kind:ee.STRING,value:n};throw new TypeError(`Cannot convert value to AST: ${xe(n)}.`)}j(!1,"Unexpected input type: "+xe(t))}const gn=/^-?(?:0|[1-9][0-9]*)$/,Nn=new Ct({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:()=>({description:{type:on,resolve:e=>e.description},types:{description:"A list of all types supported by this server.",type:new At(new St(new At(_n))),resolve:e=>Object.values(e.getTypeMap())},queryType:{description:"The type that query operations will be rooted at.",type:new At(_n),resolve:e=>e.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:_n,resolve:e=>e.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:_n,resolve:e=>e.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new At(new St(new At(In))),resolve:e=>e.getDirectives()}})}),In=new Ct({name:"__Directive",description:"A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.",fields:()=>({name:{type:new At(on),resolve:e=>e.name},description:{type:on,resolve:e=>e.description},isRepeatable:{type:new At(an),resolve:e=>e.isRepeatable},locations:{type:new At(new St(new At(bn))),resolve:e=>e.locations},args:{type:new At(new St(new At(wn))),args:{includeDeprecated:{type:an,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))}})}),bn=new qt({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:Z.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:Z.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:Z.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:Z.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:Z.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:Z.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:Z.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:Z.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:Z.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:Z.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:Z.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:Z.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:Z.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:Z.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:Z.UNION,description:"Location adjacent to a union definition."},ENUM:{value:Z.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:Z.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:Z.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:Z.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),_n=new Ct({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:()=>({kind:{type:new At(Dn),resolve:e=>ht(e)?An.SCALAR:mt(e)?An.OBJECT:yt(e)?An.INTERFACE:vt(e)?An.UNION:Tt(e)?An.ENUM:Et(e)?An.INPUT_OBJECT:gt(e)?An.LIST:Nt(e)?An.NON_NULL:void j(!1,`Unexpected type: "${xe(e)}".`)},name:{type:on,resolve:e=>"name"in e?e.name:void 0},description:{type:on,resolve:e=>"description"in e?e.description:void 0},specifiedByURL:{type:on,resolve:e=>"specifiedByURL"in e?e.specifiedByURL:void 0},fields:{type:new St(new At(On)),args:{includeDeprecated:{type:an,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(mt(e)||yt(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},interfaces:{type:new St(new At(_n)),resolve(e){if(mt(e)||yt(e))return e.getInterfaces()}},possibleTypes:{type:new St(new At(_n)),resolve(e,t,n,{schema:r}){if(wt(e))return r.getPossibleTypes(e)}},enumValues:{type:new St(new At(Sn)),args:{includeDeprecated:{type:an,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(Tt(e)){const n=e.getValues();return t?n:n.filter((e=>null==e.deprecationReason))}}},inputFields:{type:new St(new At(wn)),args:{includeDeprecated:{type:an,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(Et(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},ofType:{type:_n,resolve:e=>"ofType"in e?e.ofType:void 0}})}),On=new Ct({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:()=>({name:{type:new At(on),resolve:e=>e.name},description:{type:on,resolve:e=>e.description},args:{type:new At(new St(new At(wn))),args:{includeDeprecated:{type:an,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))},type:{type:new At(_n),resolve:e=>e.type},isDeprecated:{type:new At(an),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:on,resolve:e=>e.deprecationReason}})}),wn=new Ct({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:()=>({name:{type:new At(on),resolve:e=>e.name},description:{type:on,resolve:e=>e.description},type:{type:new At(_n),resolve:e=>e.type},defaultValue:{type:on,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(e){const{type:t,defaultValue:n}=e,r=En(n,t);return r?rt(r):null}},isDeprecated:{type:new At(an),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:on,resolve:e=>e.deprecationReason}})}),Sn=new Ct({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:()=>({name:{type:new At(on),resolve:e=>e.name},description:{type:on,resolve:e=>e.description},isDeprecated:{type:new At(an),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:on,resolve:e=>e.deprecationReason}})});var An;!function(e){e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.INPUT_OBJECT="INPUT_OBJECT",e.LIST="LIST",e.NON_NULL="NON_NULL"}(An||(An={}));const Dn=new qt({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:An.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:An.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:An.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:An.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:An.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:An.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:An.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:An.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),xn={name:"__schema",type:new At(Nn),description:"Access the current type schema of this server.",args:[],resolve:(e,t,n,{schema:r})=>r,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},kn={name:"__type",type:_n,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new At(on),defaultValue:void 0,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0}],resolve:(e,{name:t},n,{schema:r})=>r.getType(t),deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Rn={name:"__typename",type:new At(on),description:"The name of the current Object type at runtime.",args:[],resolve:(e,t,n,{parentType:r})=>r.name,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Fn=Object.freeze([Nn,In,bn,_n,On,wn,Sn,Dn]);function Ln(e){return Fn.some((({name:t})=>e.name===t))}function $n(e){if(!function(e){return Re(e,Cn)}(e))throw new Error(`Expected ${xe(e)} to be a GraphQL schema.`);return e}class Cn{constructor(e){var t,n;this.__validationErrors=!0===e.assumeValid?[]:void 0,U(e)||C(!1,"Must provide configuration object."),!e.types||Array.isArray(e.types)||C(!1,`"types" must be Array if provided but got: ${xe(e.types)}.`),!e.directives||Array.isArray(e.directives)||C(!1,`"directives" must be Array if provided but got: ${xe(e.directives)}.`),this.description=e.description,this.extensions=Xe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._queryType=e.query,this._mutationType=e.mutation,this._subscriptionType=e.subscription,this._directives=null!==(n=e.directives)&&void 0!==n?n:vn;const r=new Set(e.types);if(null!=e.types)for(const t of e.types)r.delete(t),Vn(t,r);null!=this._queryType&&Vn(this._queryType,r),null!=this._mutationType&&Vn(this._mutationType,r),null!=this._subscriptionType&&Vn(this._subscriptionType,r);for(const e of this._directives)if(pn(e))for(const t of e.args)Vn(t.type,r);Vn(Nn,r),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(const e of r){if(null==e)continue;const t=e.name;if(t||C(!1,"One of the provided types for building the Schema is missing a name."),void 0!==this._typeMap[t])throw new Error(`Schema must contain uniquely named types but contains multiple types named "${t}".`);if(this._typeMap[t]=e,yt(e)){for(const t of e.getInterfaces())if(yt(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.interfaces.push(e)}}else if(mt(e))for(const t of e.getInterfaces())if(yt(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.objects.push(e)}}}get[Symbol.toStringTag](){return"GraphQLSchema"}getQueryType(){return this._queryType}getMutationType(){return this._mutationType}getSubscriptionType(){return this._subscriptionType}getRootType(e){switch(e){case W.QUERY:return this.getQueryType();case W.MUTATION:return this.getMutationType();case W.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(e){return this.getTypeMap()[e]}getPossibleTypes(e){return vt(e)?e.getTypes():this.getImplementations(e).objects}getImplementations(e){const t=this._implementationsMap[e.name];return null!=t?t:{objects:[],interfaces:[]}}isSubType(e,t){let n=this._subTypeMap[e.name];if(void 0===n){if(n=Object.create(null),vt(e))for(const t of e.getTypes())n[t.name]=!0;else{const t=this.getImplementations(e);for(const e of t.objects)n[e.name]=!0;for(const e of t.interfaces)n[e.name]=!0}this._subTypeMap[e.name]=n}return void 0!==n[t.name]}getDirectives(){return this._directives}getDirective(e){return this.getDirectives().find((t=>t.name===e))}toConfig(){return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Object.values(this.getTypeMap()),directives:this.getDirectives(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,assumeValid:void 0!==this.__validationErrors}}}function Vn(e,t){const n=Rt(e);if(!t.has(n))if(t.add(n),vt(n))for(const e of n.getTypes())Vn(e,t);else if(mt(n)||yt(n)){for(const e of n.getInterfaces())Vn(e,t);for(const e of Object.values(n.getFields())){Vn(e.type,t);for(const n of e.args)Vn(n.type,t)}}else if(Et(n))for(const e of Object.values(n.getFields()))Vn(e.type,t);return t}function Un(e){if($n(e),e.__validationErrors)return e.__validationErrors;const t=new Mn(e);!function(e){const t=e.schema,n=t.getQueryType();if(n){if(!mt(n)){var r;e.reportError(`Query root type must be Object type, it cannot be ${xe(n)}.`,null!==(r=Pn(t,W.QUERY))&&void 0!==r?r:n.astNode)}}else e.reportError("Query root type must be provided.",t.astNode);const i=t.getMutationType();var s;i&&!mt(i)&&e.reportError(`Mutation root type must be Object type if provided, it cannot be ${xe(i)}.`,null!==(s=Pn(t,W.MUTATION))&&void 0!==s?s:i.astNode);const o=t.getSubscriptionType();var a;o&&!mt(o)&&e.reportError(`Subscription root type must be Object type if provided, it cannot be ${xe(o)}.`,null!==(a=Pn(t,W.SUBSCRIPTION))&&void 0!==a?a:o.astNode)}(t),function(e){for(const n of e.schema.getDirectives())if(pn(n)){Bn(e,n);for(const r of n.args){var t;if(Bn(e,r),It(r.type)||e.reportError(`The type of @${n.name}(${r.name}:) must be Input Type but got: ${xe(r.type)}.`,r.astNode),Gt(r)&&null!=r.deprecationReason)e.reportError(`Required argument @${n.name}(${r.name}:) cannot be deprecated.`,[Wn(r.astNode),null===(t=r.astNode)||void 0===t?void 0:t.type])}}else e.reportError(`Expected directive but got: ${xe(n)}.`,null==n?void 0:n.astNode)}(t),function(e){const t=function(e){const t=Object.create(null),n=[],r=Object.create(null);return i;function i(s){if(t[s.name])return;t[s.name]=!0,r[s.name]=n.length;const o=Object.values(s.getFields());for(const t of o)if(Nt(t.type)&&Et(t.type.ofType)){const s=t.type.ofType,o=r[s.name];if(n.push(t),void 0===o)i(s);else{const t=n.slice(o),r=t.map((e=>e.name)).join(".");e.reportError(`Cannot reference Input Object "${s.name}" within itself through a series of non-null fields: "${r}".`,t.map((e=>e.astNode)))}n.pop()}r[s.name]=void 0}}(e),n=e.schema.getTypeMap();for(const r of Object.values(n))kt(r)?(Ln(r)||Bn(e,r),mt(r)||yt(r)?(Gn(e,r),Jn(e,r)):vt(r)?qn(e,r):Tt(r)?Kn(e,r):Et(r)&&(zn(e,r),t(r))):e.reportError(`Expected GraphQL named type but got: ${xe(r)}.`,r.astNode)}(t);const n=t.getErrors();return e.__validationErrors=n,n}function jn(e){const t=Un(e);if(0!==t.length)throw new Error(t.map((e=>e.message)).join("\n\n"))}class Mn{constructor(e){this._errors=[],this.schema=e}reportError(e,t){const n=Array.isArray(t)?t.filter(Boolean):t;this._errors.push(new J(e,{nodes:n}))}getErrors(){return this._errors}}function Pn(e,t){var n;return null===(n=[e.astNode,...e.extensionASTNodes].flatMap((e=>{var t;return null!==(t=null==e?void 0:e.operationTypes)&&void 0!==t?t:[]})).find((e=>e.operation===t)))||void 0===n?void 0:n.type}function Bn(e,t){t.name.startsWith("__")&&e.reportError(`Name "${t.name}" must not begin with "__", which is reserved by GraphQL introspection.`,t.astNode)}function Gn(e,t){const n=Object.values(t.getFields());0===n.length&&e.reportError(`Type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(const o of n){var r;if(Bn(e,o),!bt(o.type))e.reportError(`The type of ${t.name}.${o.name} must be Output Type but got: ${xe(o.type)}.`,null===(r=o.astNode)||void 0===r?void 0:r.type);for(const n of o.args){const r=n.name;var i,s;if(Bn(e,n),!It(n.type))e.reportError(`The type of ${t.name}.${o.name}(${r}:) must be Input Type but got: ${xe(n.type)}.`,null===(i=n.astNode)||void 0===i?void 0:i.type);if(Gt(n)&&null!=n.deprecationReason)e.reportError(`Required argument ${t.name}.${o.name}(${r}:) cannot be deprecated.`,[Wn(n.astNode),null===(s=n.astNode)||void 0===s?void 0:s.type])}}}function Jn(e,t){const n=Object.create(null);for(const r of t.getInterfaces())yt(r)?t!==r?n[r.name]?e.reportError(`Type ${t.name} can only implement ${r.name} once.`,Xn(t,r)):(n[r.name]=!0,Qn(e,t,r),Yn(e,t,r)):e.reportError(`Type ${t.name} cannot implement itself because it would create a circular reference.`,Xn(t,r)):e.reportError(`Type ${xe(t)} must only implement Interface types, it cannot implement ${xe(r)}.`,Xn(t,r))}function Yn(e,t,n){const r=t.getFields();for(const c of Object.values(n.getFields())){const u=c.name,l=r[u];if(l){var i,s;if(!Zt(e.schema,l.type,c.type))e.reportError(`Interface field ${n.name}.${u} expects type ${xe(c.type)} but ${t.name}.${u} is type ${xe(l.type)}.`,[null===(i=c.astNode)||void 0===i?void 0:i.type,null===(s=l.astNode)||void 0===s?void 0:s.type]);for(const r of c.args){const i=r.name,s=l.args.find((e=>e.name===i));var o,a;if(s){if(!Wt(r.type,s.type))e.reportError(`Interface field argument ${n.name}.${u}(${i}:) expects type ${xe(r.type)} but ${t.name}.${u}(${i}:) is type ${xe(s.type)}.`,[null===(o=r.astNode)||void 0===o?void 0:o.type,null===(a=s.astNode)||void 0===a?void 0:a.type])}else e.reportError(`Interface field argument ${n.name}.${u}(${i}:) expected but ${t.name}.${u} does not provide it.`,[r.astNode,l.astNode])}for(const r of l.args){const i=r.name;!c.args.find((e=>e.name===i))&&Gt(r)&&e.reportError(`Object field ${t.name}.${u} includes required argument ${i} that is missing from the Interface field ${n.name}.${u}.`,[r.astNode,c.astNode])}}else e.reportError(`Interface field ${n.name}.${u} expected but ${t.name} does not provide it.`,[c.astNode,t.astNode,...t.extensionASTNodes])}}function Qn(e,t,n){const r=t.getInterfaces();for(const i of n.getInterfaces())r.includes(i)||e.reportError(i===t?`Type ${t.name} cannot implement ${n.name} because it would create a circular reference.`:`Type ${t.name} must implement ${i.name} because it is implemented by ${n.name}.`,[...Xn(n,i),...Xn(t,n)])}function qn(e,t){const n=t.getTypes();0===n.length&&e.reportError(`Union type ${t.name} must define one or more member types.`,[t.astNode,...t.extensionASTNodes]);const r=Object.create(null);for(const i of n)r[i.name]?e.reportError(`Union type ${t.name} can only include type ${i.name} once.`,Hn(t,i.name)):(r[i.name]=!0,mt(i)||e.reportError(`Union type ${t.name} can only include Object types, it cannot include ${xe(i)}.`,Hn(t,String(i))))}function Kn(e,t){const n=t.getValues();0===n.length&&e.reportError(`Enum type ${t.name} must define one or more values.`,[t.astNode,...t.extensionASTNodes]);for(const t of n)Bn(e,t)}function zn(e,t){const n=Object.values(t.getFields());0===n.length&&e.reportError(`Input Object type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(const s of n){var r,i;if(Bn(e,s),!It(s.type))e.reportError(`The type of ${t.name}.${s.name} must be Input Type but got: ${xe(s.type)}.`,null===(r=s.astNode)||void 0===r?void 0:r.type);if(Ht(s)&&null!=s.deprecationReason)e.reportError(`Required input field ${t.name}.${s.name} cannot be deprecated.`,[Wn(s.astNode),null===(i=s.astNode)||void 0===i?void 0:i.type])}}function Xn(e,t){const{astNode:n,extensionASTNodes:r}=e;return(null!=n?[n,...r]:r).flatMap((e=>{var t;return null!==(t=e.interfaces)&&void 0!==t?t:[]})).filter((e=>e.name.value===t.name))}function Hn(e,t){const{astNode:n,extensionASTNodes:r}=e;return(null!=n?[n,...r]:r).flatMap((e=>{var t;return null!==(t=e.types)&&void 0!==t?t:[]})).filter((e=>e.name.value===t))}function Wn(e){var t;return null==e||null===(t=e.directives)||void 0===t?void 0:t.find((e=>e.name.value===mn.name))}function Zn(e,t){switch(t.kind){case ee.LIST_TYPE:{const n=Zn(e,t.type);return n&&new St(n)}case ee.NON_NULL_TYPE:{const n=Zn(e,t.type);return n&&new At(n)}case ee.NAMED_TYPE:return e.getType(t.name.value)}}class er{constructor(e,t,n){this._schema=e,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=null!=n?n:tr,t&&(It(t)&&this._inputTypeStack.push(t),Ot(t)&&this._parentTypeStack.push(t),bt(t)&&this._typeStack.push(t))}get[Symbol.toStringTag](){return"TypeInfo"}getType(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]}getParentType(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]}getInputType(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]}getParentInputType(){if(this._inputTypeStack.length>1)return this._inputTypeStack[this._inputTypeStack.length-2]}getFieldDef(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]}getDefaultValue(){if(this._defaultValueStack.length>0)return this._defaultValueStack[this._defaultValueStack.length-1]}getDirective(){return this._directive}getArgument(){return this._argument}getEnumValue(){return this._enumValue}enter(e){const t=this._schema;switch(e.kind){case ee.SELECTION_SET:{const e=Rt(this.getType());this._parentTypeStack.push(Ot(e)?e:void 0);break}case ee.FIELD:{const n=this.getParentType();let r,i;n&&(r=this._getFieldDef(t,n,e),r&&(i=r.type)),this._fieldDefStack.push(r),this._typeStack.push(bt(i)?i:void 0);break}case ee.DIRECTIVE:this._directive=t.getDirective(e.name.value);break;case ee.OPERATION_DEFINITION:{const n=t.getRootType(e.operation);this._typeStack.push(mt(n)?n:void 0);break}case ee.INLINE_FRAGMENT:case ee.FRAGMENT_DEFINITION:{const n=e.typeCondition,r=n?Zn(t,n):Rt(this.getType());this._typeStack.push(bt(r)?r:void 0);break}case ee.VARIABLE_DEFINITION:{const n=Zn(t,e.type);this._inputTypeStack.push(It(n)?n:void 0);break}case ee.ARGUMENT:{var n;let t,r;const i=null!==(n=this.getDirective())&&void 0!==n?n:this.getFieldDef();i&&(t=i.args.find((t=>t.name===e.name.value)),t&&(r=t.type)),this._argument=t,this._defaultValueStack.push(t?t.defaultValue:void 0),this._inputTypeStack.push(It(r)?r:void 0);break}case ee.LIST:{const e=xt(this.getInputType()),t=gt(e)?e.ofType:e;this._defaultValueStack.push(void 0),this._inputTypeStack.push(It(t)?t:void 0);break}case ee.OBJECT_FIELD:{const t=Rt(this.getInputType());let n,r;Et(t)&&(r=t.getFields()[e.name.value],r&&(n=r.type)),this._defaultValueStack.push(r?r.defaultValue:void 0),this._inputTypeStack.push(It(n)?n:void 0);break}case ee.ENUM:{const t=Rt(this.getInputType());let n;Tt(t)&&(n=t.getValue(e.value)),this._enumValue=n;break}}}leave(e){switch(e.kind){case ee.SELECTION_SET:this._parentTypeStack.pop();break;case ee.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case ee.DIRECTIVE:this._directive=null;break;case ee.OPERATION_DEFINITION:case ee.INLINE_FRAGMENT:case ee.FRAGMENT_DEFINITION:this._typeStack.pop();break;case ee.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case ee.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case ee.LIST:case ee.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case ee.ENUM:this._enumValue=null}}}function tr(e,t,n){const r=n.name.value;return r===xn.name&&e.getQueryType()===t?xn:r===kn.name&&e.getQueryType()===t?kn:r===Rn.name&&Ot(t)?Rn:mt(t)||yt(t)?t.getFields()[r]:void 0}function nr(e,t){return{enter(...n){const r=n[0];e.enter(r);const i=nt(t,r.kind).enter;if(i){const s=i.apply(t,n);return void 0!==s&&(e.leave(r),H(s)&&e.enter(s)),s}},leave(...n){const r=n[0],i=nt(t,r.kind).leave;let s;return i&&(s=i.apply(t,n)),e.leave(r),s}}}function rr(e){return e.kind===ee.OPERATION_DEFINITION||e.kind===ee.FRAGMENT_DEFINITION}function ir(e){return e.kind===ee.SCALAR_TYPE_DEFINITION||e.kind===ee.OBJECT_TYPE_DEFINITION||e.kind===ee.INTERFACE_TYPE_DEFINITION||e.kind===ee.UNION_TYPE_DEFINITION||e.kind===ee.ENUM_TYPE_DEFINITION||e.kind===ee.INPUT_OBJECT_TYPE_DEFINITION}function sr(e){return e.kind===ee.SCALAR_TYPE_EXTENSION||e.kind===ee.OBJECT_TYPE_EXTENSION||e.kind===ee.INTERFACE_TYPE_EXTENSION||e.kind===ee.UNION_TYPE_EXTENSION||e.kind===ee.ENUM_TYPE_EXTENSION||e.kind===ee.INPUT_OBJECT_TYPE_EXTENSION}function or(e){const t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():vn;for(const e of r)t[e.name]=e.args.map((e=>e.name));const i=e.getDocument().definitions;for(const e of i)if(e.kind===ee.DIRECTIVE_DEFINITION){var s;const n=null!==(s=e.arguments)&&void 0!==s?s:[];t[e.name.value]=n.map((e=>e.name.value))}return{Directive(n){const r=n.name.value,i=t[r];if(n.arguments&&i)for(const t of n.arguments){const n=t.name.value;if(!i.includes(n)){const s=qe(n,i);e.reportError(new J(`Unknown argument "${n}" on directive "@${r}".`+Ue(s),{nodes:t}))}}return!1}}}const ar=[...un,...Fn].map((e=>e.name));function cr(e){switch(e.kind){case ee.OBJECT:return{...e,fields:(t=e.fields,t.map((e=>({...e,value:cr(e.value)}))).sort(((e,t)=>Ge(e.name.value,t.name.value))))};case ee.LIST:return{...e,values:e.values.map(cr)};case ee.INT:case ee.FLOAT:case ee.STRING:case ee.BOOLEAN:case ee.NULL:case ee.ENUM:case ee.VARIABLE:return e}var t}function ur(e){return Array.isArray(e)?e.map((([e,t])=>`subfields "${e}" conflict because `+ur(t))).join(" and "):e}function lr(e,t,n,r,i,s,o){const a=e.getFragment(o);if(!a)return;const[c,u]=vr(e,n,a);if(s!==c){dr(e,t,n,r,i,s,c);for(const a of u)r.has(a,o,i)||(r.add(a,o,i),lr(e,t,n,r,i,s,a))}}function pr(e,t,n,r,i,s,o){if(s===o)return;if(r.has(s,o,i))return;r.add(s,o,i);const a=e.getFragment(s),c=e.getFragment(o);if(!a||!c)return;const[u,l]=vr(e,n,a),[p,d]=vr(e,n,c);dr(e,t,n,r,i,u,p);for(const o of d)pr(e,t,n,r,i,s,o);for(const s of l)pr(e,t,n,r,i,s,o)}function dr(e,t,n,r,i,s,o){for(const[a,c]of Object.entries(s)){const s=o[a];if(s)for(const o of c)for(const c of s){const s=fr(e,n,r,i,a,o,c);s&&t.push(s)}}}function fr(e,t,n,r,i,s,o){const[a,c,u]=s,[l,p,d]=o,f=r||a!==l&&mt(a)&&mt(l);if(!f){const e=c.name.value,t=p.name.value;if(e!==t)return[[i,`"${e}" and "${t}" are different fields`],[c],[p]];if(hr(c)!==hr(p))return[[i,"they have differing arguments"],[c],[p]]}const h=null==u?void 0:u.type,m=null==d?void 0:d.type;if(h&&m&&mr(h,m))return[[i,`they return conflicting types "${xe(h)}" and "${xe(m)}"`],[c],[p]];const y=c.selectionSet,v=p.selectionSet;if(y&&v){const r=function(e,t,n,r,i,s,o,a){const c=[],[u,l]=yr(e,t,i,s),[p,d]=yr(e,t,o,a);dr(e,c,t,n,r,u,p);for(const i of d)lr(e,c,t,n,r,u,i);for(const i of l)lr(e,c,t,n,r,p,i);for(const i of l)for(const s of d)pr(e,c,t,n,r,i,s);return c}(e,t,n,f,Rt(h),y,Rt(m),v);return function(e,t,n,r){if(e.length>0)return[[t,e.map((([e])=>e))],[n,...e.map((([,e])=>e)).flat()],[r,...e.map((([,,e])=>e)).flat()]]}(r,i,c,p)}}function hr(e){var t;const n=null!==(t=e.arguments)&&void 0!==t?t:[];return rt(cr({kind:ee.OBJECT,fields:n.map((e=>({kind:ee.OBJECT_FIELD,name:e.name,value:e.value})))}))}function mr(e,t){return gt(e)?!gt(t)||mr(e.ofType,t.ofType):!!gt(t)||(Nt(e)?!Nt(t)||mr(e.ofType,t.ofType):!!Nt(t)||!(!_t(e)&&!_t(t))&&e!==t)}function yr(e,t,n,r){const i=t.get(r);if(i)return i;const s=Object.create(null),o=Object.create(null);Tr(e,n,r,s,o);const a=[s,Object.keys(o)];return t.set(r,a),a}function vr(e,t,n){const r=t.get(n.selectionSet);if(r)return r;const i=Zn(e.getSchema(),n.typeCondition);return yr(e,t,i,n.selectionSet)}function Tr(e,t,n,r,i){for(const s of n.selections)switch(s.kind){case ee.FIELD:{const e=s.name.value;let n;(mt(t)||yt(t))&&(n=t.getFields()[e]);const i=s.alias?s.alias.value:e;r[i]||(r[i]=[]),r[i].push([t,s,n]);break}case ee.FRAGMENT_SPREAD:i[s.name.value]=!0;break;case ee.INLINE_FRAGMENT:{const n=s.typeCondition,o=n?Zn(e.getSchema(),n):t;Tr(e,o,s.selectionSet,r,i);break}}}class Er{constructor(){this._data=new Map}has(e,t,n){var r;const[i,s]=e<t?[e,t]:[t,e],o=null===(r=this._data.get(i))||void 0===r?void 0:r.get(s);return void 0!==o&&(!!n||n===o)}add(e,t,n){const[r,i]=e<t?[e,t]:[t,e],s=this._data.get(r);void 0===s?this._data.set(r,new Map([[i,n]])):s.set(i,n)}}function gr(e){var t;const n=Object.create(null),r=e.getSchema(),i=null!==(t=null==r?void 0:r.getDirectives())&&void 0!==t?t:vn;for(const e of i)n[e.name]=Me(e.args.filter(Gt),(e=>e.name));const s=e.getDocument().definitions;for(const e of s)if(e.kind===ee.DIRECTIVE_DEFINITION){var o;const t=null!==(o=e.arguments)&&void 0!==o?o:[];n[e.name.value]=Me(t.filter(Nr),(e=>e.name.value))}return{Directive:{leave(t){const r=t.name.value,i=n[r];if(i){var s;const n=null!==(s=t.arguments)&&void 0!==s?s:[],o=new Set(n.map((e=>e.name.value)));for(const[n,s]of Object.entries(i))if(!o.has(n)){const i=ft(s.type)?xe(s.type):rt(s.type);e.reportError(new J(`Directive "@${r}" argument "${n}" of type "${i}" is required, but it was not provided.`,{nodes:t}))}}}}}}function Nr(e){return e.type.kind===ee.NON_NULL_TYPE&&null==e.defaultValue}function Ir(e){return e.map((e=>"number"==typeof e?"["+e.toString()+"]":"."+e)).join("")}function br(e,t,n){return{prev:e,key:t,typename:n}}function _r(e){const t=[];let n=e;for(;n;)t.push(n.key),n=n.prev;return t.reverse()}function Or(e,t,n=wr){return Sr(e,t,n,void 0)}function wr(e,t,n){let r="Invalid value "+xe(t);throw e.length>0&&(r+=` at "value${Ir(e)}"`),n.message=r+": "+n.message,n}function Sr(e,t,n,r){if(Nt(t))return null!=e?Sr(e,t.ofType,n,r):void n(_r(r),e,new J(`Expected non-nullable type "${xe(t)}" not to be null.`));if(null==e)return null;if(gt(t)){const i=t.ofType;return Tn(e)?Array.from(e,((e,t)=>{const s=br(r,t,void 0);return Sr(e,i,n,s)})):[Sr(e,i,n,r)]}if(Et(t)){if(!U(e))return void n(_r(r),e,new J(`Expected type "${t.name}" to be an object.`));const i={},s=t.getFields();for(const o of Object.values(s)){const s=e[o.name];if(void 0!==s)i[o.name]=Sr(s,o.type,n,br(r,o.name,t.name));else if(void 0!==o.defaultValue)i[o.name]=o.defaultValue;else if(Nt(o.type)){const t=xe(o.type);n(_r(r),e,new J(`Field "${o.name}" of required type "${t}" was not provided.`))}}for(const i of Object.keys(e))if(!s[i]){const s=qe(i,Object.keys(t.getFields()));n(_r(r),e,new J(`Field "${i}" is not defined by type "${t.name}".`+Ue(s)))}return i}if(_t(t)){let i;try{i=t.parseValue(e)}catch(i){return void n(_r(r),e,i instanceof J?i:new J(`Expected type "${t.name}". `+i.message,{originalError:i}))}return void 0===i&&n(_r(r),e,new J(`Expected type "${t.name}".`)),i}j(!1,"Unexpected input type: "+xe(t))}function Ar(e,t,n){if(e){if(e.kind===ee.VARIABLE){const r=e.name.value;if(null==n||void 0===n[r])return;const i=n[r];if(null===i&&Nt(t))return;return i}if(Nt(t)){if(e.kind===ee.NULL)return;return Ar(e,t.ofType,n)}if(e.kind===ee.NULL)return null;if(gt(t)){const r=t.ofType;if(e.kind===ee.LIST){const t=[];for(const i of e.values)if(Dr(i,n)){if(Nt(r))return;t.push(null)}else{const e=Ar(i,r,n);if(void 0===e)return;t.push(e)}return t}const i=Ar(e,r,n);if(void 0===i)return;return[i]}if(Et(t)){if(e.kind!==ee.OBJECT)return;const r=Object.create(null),i=Me(e.fields,(e=>e.name.value));for(const e of Object.values(t.getFields())){const t=i[e.name];if(!t||Dr(t.value,n)){if(void 0!==e.defaultValue)r[e.name]=e.defaultValue;else if(Nt(e.type))return;continue}const s=Ar(t.value,e.type,n);if(void 0===s)return;r[e.name]=s}return r}if(_t(t)){let r;try{r=t.parseLiteral(e,n)}catch(e){return}if(void 0===r)return;return r}j(!1,"Unexpected input type: "+xe(t))}}function Dr(e,t){return e.kind===ee.VARIABLE&&(null==t||void 0===t[e.name.value])}function xr(e,t,n,r){const i=[],s=null==r?void 0:r.maxErrors;try{const r=function(e,t,n,r){const i={};for(const s of t){const t=s.variable.name.value,o=Zn(e,s.type);if(!It(o)){const e=rt(s.type);r(new J(`Variable "$${t}" expected value of type "${e}" which cannot be used as an input type.`,{nodes:s.type}));continue}if(!Fr(n,t)){if(s.defaultValue)i[t]=Ar(s.defaultValue,o);else if(Nt(o)){const e=xe(o);r(new J(`Variable "$${t}" of required type "${e}" was not provided.`,{nodes:s}))}continue}const a=n[t];if(null===a&&Nt(o)){const e=xe(o);r(new J(`Variable "$${t}" of non-null type "${e}" must not be null.`,{nodes:s}))}else i[t]=Or(a,o,((e,n,i)=>{let o=`Variable "$${t}" got invalid value `+xe(n);e.length>0&&(o+=` at "${t}${Ir(e)}"`),r(new J(o+"; "+i.message,{nodes:s,originalError:i.originalError}))}))}return i}(e,t,n,(e=>{if(null!=s&&i.length>=s)throw new J("Too many errors processing variables, error limit reached. Execution aborted.");i.push(e)}));if(0===i.length)return{coerced:r}}catch(e){i.push(e)}return{errors:i}}function kr(e,t,n){var r;const i={},s=Me(null!==(r=t.arguments)&&void 0!==r?r:[],(e=>e.name.value));for(const r of e.args){const e=r.name,o=r.type,a=s[e];if(!a){if(void 0!==r.defaultValue)i[e]=r.defaultValue;else if(Nt(o))throw new J(`Argument "${e}" of required type "${xe(o)}" was not provided.`,{nodes:t});continue}const c=a.value;let u=c.kind===ee.NULL;if(c.kind===ee.VARIABLE){const t=c.name.value;if(null==n||!Fr(n,t)){if(void 0!==r.defaultValue)i[e]=r.defaultValue;else if(Nt(o))throw new J(`Argument "${e}" of required type "${xe(o)}" was provided the variable "$${t}" which was not provided a runtime value.`,{nodes:c});continue}u=null==n[t]}if(u&&Nt(o))throw new J(`Argument "${e}" of non-null type "${xe(o)}" must not be null.`,{nodes:c});const l=Ar(c,o,n);if(void 0===l)throw new J(`Argument "${e}" has invalid value ${rt(c)}.`,{nodes:c});i[e]=l}return i}function Rr(e,t,n){var r;const i=null===(r=t.directives)||void 0===r?void 0:r.find((t=>t.name.value===e.name));if(i)return kr(e,i,n)}function Fr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Lr(e,t,n,r,i){const s=new Map;return $r(e,t,n,r,i,s,new Set),s}function $r(e,t,n,r,i,s,o){for(const c of i.selections)switch(c.kind){case ee.FIELD:{if(!Cr(n,c))continue;const e=(a=c).alias?a.alias.value:a.name.value,t=s.get(e);void 0!==t?t.push(c):s.set(e,[c]);break}case ee.INLINE_FRAGMENT:if(!Cr(n,c)||!Vr(e,c,r))continue;$r(e,t,n,r,c.selectionSet,s,o);break;case ee.FRAGMENT_SPREAD:{const i=c.name.value;if(o.has(i)||!Cr(n,c))continue;o.add(i);const a=t[i];if(!a||!Vr(e,a,r))continue;$r(e,t,n,r,a.selectionSet,s,o);break}}var a}function Cr(e,t){const n=Rr(hn,t,e);if(!0===(null==n?void 0:n.if))return!1;const r=Rr(fn,t,e);return!1!==(null==r?void 0:r.if)}function Vr(e,t,n){const r=t.typeCondition;if(!r)return!0;const i=Zn(e,r);return i===n||!!wt(i)&&e.isSubType(i,n)}function Ur(e,t){const n=new Map;for(const r of e){const e=t(r),i=n.get(e);void 0===i?n.set(e,[r]):i.push(r)}return n}function jr(e,t){const n=e.getInputType();if(!n)return;const r=Rt(n);if(_t(r))try{if(void 0===r.parseLiteral(t,void 0)){const r=xe(n);e.reportError(new J(`Expected value of type "${r}", found ${rt(t)}.`,{nodes:t}))}}catch(r){const i=xe(n);r instanceof J?e.reportError(r):e.reportError(new J(`Expected value of type "${i}", found ${rt(t)}; `+r.message,{nodes:t,originalError:r}))}else{const r=xe(n);e.reportError(new J(`Expected value of type "${r}", found ${rt(t)}.`,{nodes:t}))}}function Mr(e,t,n,r,i){if(Nt(r)&&!Nt(t)){if(!(null!=n&&n.kind!==ee.NULL)&&!(void 0!==i))return!1;return Zt(e,t,r.ofType)}return Zt(e,t,r)}const Pr=Object.freeze([function(e){return{Document(t){for(const n of t.definitions)if(!rr(n)){const t=n.kind===ee.SCHEMA_DEFINITION||n.kind===ee.SCHEMA_EXTENSION?"schema":'"'+n.name.value+'"';e.reportError(new J(`The ${t} definition is not executable.`,{nodes:n}))}return!1}}},function(e){const t=Object.create(null);return{OperationDefinition(n){const r=n.name;return r&&(t[r.value]?e.reportError(new J(`There can be only one operation named "${r.value}".`,{nodes:[t[r.value],r]})):t[r.value]=r),!1},FragmentDefinition:()=>!1}},function(e){let t=0;return{Document(e){t=e.definitions.filter((e=>e.kind===ee.OPERATION_DEFINITION)).length},OperationDefinition(n){!n.name&&t>1&&e.reportError(new J("This anonymous operation must be the only defined operation.",{nodes:n}))}}},function(e){return{OperationDefinition(t){if("subscription"===t.operation){const n=e.getSchema(),r=n.getSubscriptionType();if(r){const i=t.name?t.name.value:null,s=Object.create(null),o=e.getDocument(),a=Object.create(null);for(const e of o.definitions)e.kind===ee.FRAGMENT_DEFINITION&&(a[e.name.value]=e);const c=Lr(n,a,s,r,t.selectionSet);if(c.size>1){const t=[...c.values()].slice(1).flat();e.reportError(new J(null!=i?`Subscription "${i}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",{nodes:t}))}for(const t of c.values()){t[0].name.value.startsWith("__")&&e.reportError(new J(null!=i?`Subscription "${i}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",{nodes:t}))}}}}}},function(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),r=Object.create(null);for(const t of e.getDocument().definitions)ir(t)&&(r[t.name.value]=!0);const i=[...Object.keys(n),...Object.keys(r)];return{NamedType(t,s,o,a,c){const u=t.name.value;if(!n[u]&&!r[u]){var l;const n=null!==(l=c[2])&&void 0!==l?l:o,r=null!=n&&("kind"in(p=n)&&(function(e){return e.kind===ee.SCHEMA_DEFINITION||ir(e)||e.kind===ee.DIRECTIVE_DEFINITION}(p)||function(e){return e.kind===ee.SCHEMA_EXTENSION||sr(e)}(p)));if(r&&ar.includes(u))return;const s=qe(u,r?ar.concat(i):i);e.reportError(new J(`Unknown type "${u}".`+Ue(s),{nodes:t}))}var p}}},function(e){return{InlineFragment(t){const n=t.typeCondition;if(n){const t=Zn(e.getSchema(),n);if(t&&!Ot(t)){const t=rt(n);e.reportError(new J(`Fragment cannot condition on non composite type "${t}".`,{nodes:n}))}}},FragmentDefinition(t){const n=Zn(e.getSchema(),t.typeCondition);if(n&&!Ot(n)){const n=rt(t.typeCondition);e.reportError(new J(`Fragment "${t.name.value}" cannot condition on non composite type "${n}".`,{nodes:t.typeCondition}))}}}},function(e){return{VariableDefinition(t){const n=Zn(e.getSchema(),t.type);if(void 0!==n&&!It(n)){const n=t.variable.name.value,r=rt(t.type);e.reportError(new J(`Variable "$${n}" cannot be non-input type "${r}".`,{nodes:t.type}))}}}},function(e){return{Field(t){const n=e.getType(),r=t.selectionSet;if(n)if(_t(Rt(n))){if(r){const i=t.name.value,s=xe(n);e.reportError(new J(`Field "${i}" must not have a selection since type "${s}" has no subfields.`,{nodes:r}))}}else if(!r){const r=t.name.value,i=xe(n);e.reportError(new J(`Field "${r}" of type "${i}" must have a selection of subfields. Did you mean "${r} { ... }"?`,{nodes:t}))}}}},function(e){return{Field(t){const n=e.getParentType();if(n){if(!e.getFieldDef()){const r=e.getSchema(),i=t.name.value;let s=Ue("to use an inline fragment on",function(e,t,n){if(!wt(t))return[];const r=new Set,i=Object.create(null);for(const o of e.getPossibleTypes(t))if(o.getFields()[n]){r.add(o),i[o.name]=1;for(const e of o.getInterfaces()){var s;e.getFields()[n]&&(r.add(e),i[e.name]=(null!==(s=i[e.name])&&void 0!==s?s:0)+1)}}return[...r].sort(((t,n)=>{const r=i[n.name]-i[t.name];return 0!==r?r:yt(t)&&e.isSubType(t,n)?-1:yt(n)&&e.isSubType(n,t)?1:Ge(t.name,n.name)})).map((e=>e.name))}(r,n,i));""===s&&(s=Ue(function(e,t){if(mt(e)||yt(e)){return qe(t,Object.keys(e.getFields()))}return[]}(n,i))),e.reportError(new J(`Cannot query field "${i}" on type "${n.name}".`+s,{nodes:t}))}}}}},function(e){const t=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(n){const r=n.name.value;return t[r]?e.reportError(new J(`There can be only one fragment named "${r}".`,{nodes:[t[r],n.name]})):t[r]=n.name,!1}}},function(e){return{FragmentSpread(t){const n=t.name.value;e.getFragment(n)||e.reportError(new J(`Unknown fragment "${n}".`,{nodes:t.name}))}}},function(e){const t=[],n=[];return{OperationDefinition:e=>(t.push(e),!1),FragmentDefinition:e=>(n.push(e),!1),Document:{leave(){const r=Object.create(null);for(const n of t)for(const t of e.getRecursivelyReferencedFragments(n))r[t.name.value]=!0;for(const t of n){const n=t.name.value;!0!==r[n]&&e.reportError(new J(`Fragment "${n}" is never used.`,{nodes:t}))}}}}},function(e){return{InlineFragment(t){const n=e.getType(),r=e.getParentType();if(Ot(n)&&Ot(r)&&!en(e.getSchema(),n,r)){const i=xe(r),s=xe(n);e.reportError(new J(`Fragment cannot be spread here as objects of type "${i}" can never be of type "${s}".`,{nodes:t}))}},FragmentSpread(t){const n=t.name.value,r=function(e,t){const n=e.getFragment(t);if(n){const t=Zn(e.getSchema(),n.typeCondition);if(Ot(t))return t}}(e,n),i=e.getParentType();if(r&&i&&!en(e.getSchema(),r,i)){const s=xe(i),o=xe(r);e.reportError(new J(`Fragment "${n}" cannot be spread here as objects of type "${s}" can never be of type "${o}".`,{nodes:t}))}}}},function(e){const t=Object.create(null),n=[],r=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition:e=>(i(e),!1)};function i(s){if(t[s.name.value])return;const o=s.name.value;t[o]=!0;const a=e.getFragmentSpreads(s.selectionSet);if(0!==a.length){r[o]=n.length;for(const t of a){const s=t.name.value,o=r[s];if(n.push(t),void 0===o){const t=e.getFragment(s);t&&i(t)}else{const t=n.slice(o),r=t.slice(0,-1).map((e=>'"'+e.name.value+'"')).join(", ");e.reportError(new J(`Cannot spread fragment "${s}" within itself`+(""!==r?` via ${r}.`:"."),{nodes:t}))}n.pop()}r[o]=void 0}}},function(e){return{OperationDefinition(t){var n;const r=Ur(null!==(n=t.variableDefinitions)&&void 0!==n?n:[],(e=>e.variable.name.value));for(const[t,n]of r)n.length>1&&e.reportError(new J(`There can be only one variable named "$${t}".`,{nodes:n.map((e=>e.variable.name))}))}}},function(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(n){const r=e.getRecursiveVariableUsages(n);for(const{node:i}of r){const r=i.name.value;!0!==t[r]&&e.reportError(new J(n.name?`Variable "$${r}" is not defined by operation "${n.name.value}".`:`Variable "$${r}" is not defined.`,{nodes:[i,n]}))}}},VariableDefinition(e){t[e.variable.name.value]=!0}}},function(e){let t=[];return{OperationDefinition:{enter(){t=[]},leave(n){const r=Object.create(null),i=e.getRecursiveVariableUsages(n);for(const{node:e}of i)r[e.name.value]=!0;for(const i of t){const t=i.variable.name.value;!0!==r[t]&&e.reportError(new J(n.name?`Variable "$${t}" is never used in operation "${n.name.value}".`:`Variable "$${t}" is never used.`,{nodes:i}))}}},VariableDefinition(e){t.push(e)}}},function(e){const t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():vn;for(const e of r)t[e.name]=e.locations;const i=e.getDocument().definitions;for(const e of i)e.kind===ee.DIRECTIVE_DEFINITION&&(t[e.name.value]=e.locations.map((e=>e.value)));return{Directive(n,r,i,s,o){const a=n.name.value,c=t[a];if(!c)return void e.reportError(new J(`Unknown directive "@${a}".`,{nodes:n}));const u=function(e){const t=e[e.length-1];switch("kind"in t||j(!1),t.kind){case ee.OPERATION_DEFINITION:return function(e){switch(e){case W.QUERY:return Z.QUERY;case W.MUTATION:return Z.MUTATION;case W.SUBSCRIPTION:return Z.SUBSCRIPTION}}(t.operation);case ee.FIELD:return Z.FIELD;case ee.FRAGMENT_SPREAD:return Z.FRAGMENT_SPREAD;case ee.INLINE_FRAGMENT:return Z.INLINE_FRAGMENT;case ee.FRAGMENT_DEFINITION:return Z.FRAGMENT_DEFINITION;case ee.VARIABLE_DEFINITION:return Z.VARIABLE_DEFINITION;case ee.SCHEMA_DEFINITION:case ee.SCHEMA_EXTENSION:return Z.SCHEMA;case ee.SCALAR_TYPE_DEFINITION:case ee.SCALAR_TYPE_EXTENSION:return Z.SCALAR;case ee.OBJECT_TYPE_DEFINITION:case ee.OBJECT_TYPE_EXTENSION:return Z.OBJECT;case ee.FIELD_DEFINITION:return Z.FIELD_DEFINITION;case ee.INTERFACE_TYPE_DEFINITION:case ee.INTERFACE_TYPE_EXTENSION:return Z.INTERFACE;case ee.UNION_TYPE_DEFINITION:case ee.UNION_TYPE_EXTENSION:return Z.UNION;case ee.ENUM_TYPE_DEFINITION:case ee.ENUM_TYPE_EXTENSION:return Z.ENUM;case ee.ENUM_VALUE_DEFINITION:return Z.ENUM_VALUE;case ee.INPUT_OBJECT_TYPE_DEFINITION:case ee.INPUT_OBJECT_TYPE_EXTENSION:return Z.INPUT_OBJECT;case ee.INPUT_VALUE_DEFINITION:{const t=e[e.length-3];return"kind"in t||j(!1),t.kind===ee.INPUT_OBJECT_TYPE_DEFINITION?Z.INPUT_FIELD_DEFINITION:Z.ARGUMENT_DEFINITION}default:j(!1,"Unexpected kind: "+xe(t.kind))}}(o);u&&!c.includes(u)&&e.reportError(new J(`Directive "@${a}" may not be used on ${u}.`,{nodes:n}))}}},function(e){const t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():vn;for(const e of r)t[e.name]=!e.isRepeatable;const i=e.getDocument().definitions;for(const e of i)e.kind===ee.DIRECTIVE_DEFINITION&&(t[e.name.value]=!e.repeatable);const s=Object.create(null),o=Object.create(null);return{enter(n){if(!("directives"in n)||!n.directives)return;let r;if(n.kind===ee.SCHEMA_DEFINITION||n.kind===ee.SCHEMA_EXTENSION)r=s;else if(ir(n)||sr(n)){const e=n.name.value;r=o[e],void 0===r&&(o[e]=r=Object.create(null))}else r=Object.create(null);for(const i of n.directives){const n=i.name.value;t[n]&&(r[n]?e.reportError(new J(`The directive "@${n}" can only be used once at this location.`,{nodes:[r[n],i]})):r[n]=i)}}}},function(e){return{...or(e),Argument(t){const n=e.getArgument(),r=e.getFieldDef(),i=e.getParentType();if(!n&&r&&i){const n=t.name.value,s=qe(n,r.args.map((e=>e.name)));e.reportError(new J(`Unknown argument "${n}" on field "${i.name}.${r.name}".`+Ue(s),{nodes:t}))}}}},function(e){return{Field:t,Directive:t};function t(t){var n;const r=Ur(null!==(n=t.arguments)&&void 0!==n?n:[],(e=>e.name.value));for(const[t,n]of r)n.length>1&&e.reportError(new J(`There can be only one argument named "${t}".`,{nodes:n.map((e=>e.name))}))}},function(e){return{ListValue(t){if(!gt(xt(e.getParentInputType())))return jr(e,t),!1},ObjectValue(t){const n=Rt(e.getInputType());if(!Et(n))return jr(e,t),!1;const r=Me(t.fields,(e=>e.name.value));for(const i of Object.values(n.getFields())){if(!r[i.name]&&Ht(i)){const r=xe(i.type);e.reportError(new J(`Field "${n.name}.${i.name}" of required type "${r}" was not provided.`,{nodes:t}))}}},ObjectField(t){const n=Rt(e.getParentInputType());if(!e.getInputType()&&Et(n)){const r=qe(t.name.value,Object.keys(n.getFields()));e.reportError(new J(`Field "${t.name.value}" is not defined by type "${n.name}".`+Ue(r),{nodes:t}))}},NullValue(t){const n=e.getInputType();Nt(n)&&e.reportError(new J(`Expected value of type "${xe(n)}", found ${rt(t)}.`,{nodes:t}))},EnumValue:t=>jr(e,t),IntValue:t=>jr(e,t),FloatValue:t=>jr(e,t),StringValue:t=>jr(e,t),BooleanValue:t=>jr(e,t)}},function(e){return{...gr(e),Field:{leave(t){var n;const r=e.getFieldDef();if(!r)return!1;const i=new Set(null===(n=t.arguments)||void 0===n?void 0:n.map((e=>e.name.value)));for(const n of r.args)if(!i.has(n.name)&&Gt(n)){const i=xe(n.type);e.reportError(new J(`Field "${r.name}" argument "${n.name}" of type "${i}" is required, but it was not provided.`,{nodes:t}))}}}}},function(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(n){const r=e.getRecursiveVariableUsages(n);for(const{node:n,type:i,defaultValue:s}of r){const r=n.name.value,o=t[r];if(o&&i){const t=e.getSchema(),a=Zn(t,o.type);if(a&&!Mr(t,a,o.defaultValue,i,s)){const t=xe(a),s=xe(i);e.reportError(new J(`Variable "$${r}" of type "${t}" used in position expecting type "${s}".`,{nodes:[o,n]}))}}}}},VariableDefinition(e){t[e.variable.name.value]=e}}},function(e){const t=new Er,n=new Map;return{SelectionSet(r){const i=function(e,t,n,r,i){const s=[],[o,a]=yr(e,t,r,i);if(function(e,t,n,r,i){for(const[s,o]of Object.entries(i))if(o.length>1)for(let i=0;i<o.length;i++)for(let a=i+1;a<o.length;a++){const c=fr(e,n,r,!1,s,o[i],o[a]);c&&t.push(c)}}(e,s,t,n,o),0!==a.length)for(let r=0;r<a.length;r++){lr(e,s,t,n,!1,o,a[r]);for(let i=r+1;i<a.length;i++)pr(e,s,t,n,!1,a[r],a[i])}return s}(e,n,t,e.getParentType(),r);for(const[[t,n],r,s]of i){const i=ur(n);e.reportError(new J(`Fields "${t}" conflict because ${i}. Use different aliases on the fields to fetch both if this was intentional.`,{nodes:r.concat(s)}))}}}},function(e){const t=[];let n=Object.create(null);return{ObjectValue:{enter(){t.push(n),n=Object.create(null)},leave(){const e=t.pop();e||j(!1),n=e}},ObjectField(t){const r=t.name.value;n[r]?e.reportError(new J(`There can be only one input field named "${r}".`,{nodes:[n[r],t.name]})):n[r]=t.name}}}]);class Br{constructor(e,t){this._ast=e,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=t}get[Symbol.toStringTag](){return"ASTValidationContext"}reportError(e){this._onError(e)}getDocument(){return this._ast}getFragment(e){let t;if(this._fragments)t=this._fragments;else{t=Object.create(null);for(const e of this.getDocument().definitions)e.kind===ee.FRAGMENT_DEFINITION&&(t[e.name.value]=e);this._fragments=t}return t[e]}getFragmentSpreads(e){let t=this._fragmentSpreads.get(e);if(!t){t=[];const n=[e];let r;for(;r=n.pop();)for(const e of r.selections)e.kind===ee.FRAGMENT_SPREAD?t.push(e):e.selectionSet&&n.push(e.selectionSet);this._fragmentSpreads.set(e,t)}return t}getRecursivelyReferencedFragments(e){let t=this._recursivelyReferencedFragments.get(e);if(!t){t=[];const n=Object.create(null),r=[e.selectionSet];let i;for(;i=r.pop();)for(const e of this.getFragmentSpreads(i)){const i=e.name.value;if(!0!==n[i]){n[i]=!0;const e=this.getFragment(i);e&&(t.push(e),r.push(e.selectionSet))}}this._recursivelyReferencedFragments.set(e,t)}return t}}class Gr extends Br{constructor(e,t,n,r){super(t,r),this._schema=e,this._typeInfo=n,this._variableUsages=new Map,this._recursiveVariableUsages=new Map}get[Symbol.toStringTag](){return"ValidationContext"}getSchema(){return this._schema}getVariableUsages(e){let t=this._variableUsages.get(e);if(!t){const n=[],r=new er(this._schema);tt(e,nr(r,{VariableDefinition:()=>!1,Variable(e){n.push({node:e,type:r.getInputType(),defaultValue:r.getDefaultValue()})}})),t=n,this._variableUsages.set(e,t)}return t}getRecursiveVariableUsages(e){let t=this._recursiveVariableUsages.get(e);if(!t){t=this.getVariableUsages(e);for(const n of this.getRecursivelyReferencedFragments(e))t=t.concat(this.getVariableUsages(n));this._recursiveVariableUsages.set(e,t)}return t}getType(){return this._typeInfo.getType()}getParentType(){return this._typeInfo.getParentType()}getInputType(){return this._typeInfo.getInputType()}getParentInputType(){return this._typeInfo.getParentInputType()}getFieldDef(){return this._typeInfo.getFieldDef()}getDirective(){return this._typeInfo.getDirective()}getArgument(){return this._typeInfo.getArgument()}getEnumValue(){return this._typeInfo.getEnumValue()}}function Jr(e,t,n=Pr,r,i=new er(e)){var s;const o=null!==(s=null==r?void 0:r.maxErrors)&&void 0!==s?s:100;t||C(!1,"Must provide document."),jn(e);const a=Object.freeze({}),c=[],u=new Gr(e,t,i,(e=>{if(c.length>=o)throw c.push(new J("Too many validation errors, error limit reached. Validation aborted.")),a;c.push(e)})),l=function(e){const t=new Array(e.length).fill(null),n=Object.create(null);for(const r of Object.values(ee)){let i=!1;const s=new Array(e.length).fill(void 0),o=new Array(e.length).fill(void 0);for(let t=0;t<e.length;++t){const{enter:n,leave:a}=nt(e[t],r);i||(i=null!=n||null!=a),s[t]=n,o[t]=a}if(!i)continue;const a={enter(...n){const r=n[0];for(let o=0;o<e.length;o++)if(null===t[o]){var i;const a=null===(i=s[o])||void 0===i?void 0:i.apply(e[o],n);if(!1===a)t[o]=r;else if(a===et)t[o]=et;else if(void 0!==a)return a}},leave(...n){const r=n[0];for(let s=0;s<e.length;s++)if(null===t[s]){var i;const r=null===(i=o[s])||void 0===i?void 0:i.apply(e[s],n);if(r===et)t[s]=et;else if(void 0!==r&&!1!==r)return r}else t[s]===r&&(t[s]=null)}};n[r]=a}return n}(n.map((e=>e(u))));try{tt(t,nr(i,l))}catch(e){if(e!==a)throw e}return c}class Yr extends Error{constructor(e){super("Unexpected error value: "+xe(e)),this.name="NonErrorThrown",this.thrownValue=e}}function Qr(e,t,n){var r;const i=(s=e)instanceof Error?s:new Yr(s);var s,o;return o=i,Array.isArray(o.path)?i:new J(i.message,{nodes:null!==(r=i.nodes)&&void 0!==r?r:t,source:i.source,positions:i.positions,path:n,originalError:i})}const qr=function(e){let t;return function(n,r,i){void 0===t&&(t=new WeakMap);let s=t.get(n);void 0===s&&(s=new WeakMap,t.set(n,s));let o=s.get(r);void 0===o&&(o=new WeakMap,s.set(r,o));let a=o.get(i);return void 0===a&&(a=e(n,r,i),o.set(i,a)),a}}(((e,t,n)=>function(e,t,n,r,i){const s=new Map,o=new Set;for(const a of i)a.selectionSet&&$r(e,t,n,r,a.selectionSet,s,o);return s}(e.schema,e.fragments,e.variableValues,t,n)));function Kr(e){arguments.length<2||C(!1,"graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.");const{schema:t,document:n,variableValues:r,rootValue:i}=e;!function(e,t,n){t||C(!1,"Must provide document."),jn(e),null==n||U(n)||C(!1,"Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.")}(t,n,r);const s=function(e){var t,n;const{schema:r,document:i,rootValue:s,contextValue:o,variableValues:a,operationName:c,fieldResolver:u,typeResolver:l,subscribeFieldResolver:p}=e;let d;const f=Object.create(null);for(const e of i.definitions)switch(e.kind){case ee.OPERATION_DEFINITION:if(null==c){if(void 0!==d)return[new J("Must provide operation name if query contains multiple operations.")];d=e}else(null===(t=e.name)||void 0===t?void 0:t.value)===c&&(d=e);break;case ee.FRAGMENT_DEFINITION:f[e.name.value]=e}if(!d)return null!=c?[new J(`Unknown operation named "${c}".`)]:[new J("Must provide an operation.")];const h=null!==(n=d.variableDefinitions)&&void 0!==n?n:[],m=xr(r,h,null!=a?a:{},{maxErrors:50});if(m.errors)return m.errors;return{schema:r,fragments:f,rootValue:s,contextValue:o,operation:d,variableValues:m.coerced,fieldResolver:null!=u?u:ii,typeResolver:null!=l?l:ri,subscribeFieldResolver:null!=p?p:ii,errors:[]}}(e);if(!("schema"in s))return{errors:s};try{const{operation:e}=s,t=function(e,t,n){const r=e.schema.getRootType(t.operation);if(null==r)throw new J(`Schema is not configured to execute ${t.operation} operation.`,{nodes:t});const i=Lr(e.schema,e.fragments,e.variableValues,r,t.selectionSet),s=void 0;switch(t.operation){case W.QUERY:return Xr(e,r,n,s,i);case W.MUTATION:return function(e,t,n,r,i){return function(e,t,n){let r=n;for(const n of e)r=V(r)?r.then((e=>t(e,n))):t(r,n);return r}(i.entries(),((i,[s,o])=>{const a=br(r,s,t.name),c=Hr(e,t,n,o,a);return void 0===c?i:V(c)?c.then((e=>(i[s]=e,i))):(i[s]=c,i)}),Object.create(null))}(e,r,n,s,i);case W.SUBSCRIPTION:return Xr(e,r,n,s,i)}}(s,e,i);return V(t)?t.then((e=>zr(e,s.errors)),(e=>(s.errors.push(e),zr(null,s.errors)))):zr(t,s.errors)}catch(e){return s.errors.push(e),zr(null,s.errors)}}function zr(e,t){return 0===t.length?{data:e}:{errors:t,data:e}}function Xr(e,t,n,r,i){const s=Object.create(null);let o=!1;for(const[a,c]of i.entries()){const i=Hr(e,t,n,c,br(r,a,t.name));void 0!==i&&(s[a]=i,V(i)&&(o=!0))}return o?(a=s,Promise.all(Object.values(a)).then((e=>{const t=Object.create(null);for(const[n,r]of Object.keys(a).entries())t[r]=e[n];return t}))):s;var a}function Hr(e,t,n,r,i){var s;const o=function(e,t,n){const r=n.name.value;if(r===xn.name&&e.getQueryType()===t)return xn;if(r===kn.name&&e.getQueryType()===t)return kn;if(r===Rn.name)return Rn;return t.getFields()[r]}(e.schema,t,r[0]);if(!o)return;const a=o.type,c=null!==(s=o.resolve)&&void 0!==s?s:e.fieldResolver,u=function(e,t,n,r,i){return{fieldName:t.name,fieldNodes:n,returnType:t.type,parentType:r,path:i,schema:e.schema,fragments:e.fragments,rootValue:e.rootValue,operation:e.operation,variableValues:e.variableValues}}(e,o,r,t,i);try{const t=kr(o,r[0],e.variableValues),s=c(n,t,e.contextValue,u);let l;return l=V(s)?s.then((t=>Zr(e,a,r,u,i,t))):Zr(e,a,r,u,i,s),V(l)?l.then(void 0,(t=>Wr(Qr(t,r,_r(i)),a,e))):l}catch(t){return Wr(Qr(t,r,_r(i)),a,e)}}function Wr(e,t,n){if(Nt(t))throw e;return n.errors.push(e),null}function Zr(e,t,n,r,i,s){if(s instanceof Error)throw s;if(Nt(t)){const o=Zr(e,t.ofType,n,r,i,s);if(null===o)throw new Error(`Cannot return null for non-nullable field ${r.parentType.name}.${r.fieldName}.`);return o}return null==s?null:gt(t)?function(e,t,n,r,i,s){if(!Tn(s))throw new J(`Expected Iterable, but did not find one for field "${r.parentType.name}.${r.fieldName}".`);const o=t.ofType;let a=!1;const c=Array.from(s,((t,s)=>{const c=br(i,s,void 0);try{let i;return i=V(t)?t.then((t=>Zr(e,o,n,r,c,t))):Zr(e,o,n,r,c,t),V(i)?(a=!0,i.then(void 0,(t=>Wr(Qr(t,n,_r(c)),o,e)))):i}catch(t){return Wr(Qr(t,n,_r(c)),o,e)}}));return a?Promise.all(c):c}(e,t,n,r,i,s):_t(t)?function(e,t){const n=e.serialize(t);if(null==n)throw new Error(`Expected \`${xe(e)}.serialize(${xe(t)})\` to return non-nullable value, returned: ${xe(n)}`);return n}(t,s):wt(t)?function(e,t,n,r,i,s){var o;const a=null!==(o=t.resolveType)&&void 0!==o?o:e.typeResolver,c=e.contextValue,u=a(s,c,r,t);if(V(u))return u.then((o=>ti(e,ei(o,e,t,n,r,s),n,r,i,s)));return ti(e,ei(u,e,t,n,r,s),n,r,i,s)}(e,t,n,r,i,s):mt(t)?ti(e,t,n,r,i,s):void j(!1,"Cannot complete value of unexpected output type: "+xe(t))}function ei(e,t,n,r,i,s){if(null==e)throw new J(`Abstract type "${n.name}" must resolve to an Object type at runtime for field "${i.parentType.name}.${i.fieldName}". Either the "${n.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`,r);if(mt(e))throw new J("Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.");if("string"!=typeof e)throw new J(`Abstract type "${n.name}" must resolve to an Object type at runtime for field "${i.parentType.name}.${i.fieldName}" with value ${xe(s)}, received "${xe(e)}".`);const o=t.schema.getType(e);if(null==o)throw new J(`Abstract type "${n.name}" was resolved to a type "${e}" that does not exist inside the schema.`,{nodes:r});if(!mt(o))throw new J(`Abstract type "${n.name}" was resolved to a non-object type "${e}".`,{nodes:r});if(!t.schema.isSubType(n,o))throw new J(`Runtime Object type "${o.name}" is not a possible type for "${n.name}".`,{nodes:r});return o}function ti(e,t,n,r,i,s){const o=qr(e,t,n);if(t.isTypeOf){const a=t.isTypeOf(s,e.contextValue,r);if(V(a))return a.then((r=>{if(!r)throw ni(t,s,n);return Xr(e,t,s,i,o)}));if(!a)throw ni(t,s,n)}return Xr(e,t,s,i,o)}function ni(e,t,n){return new J(`Expected value of type "${e.name}" but got: ${xe(t)}.`,{nodes:n})}const ri=function(e,t,n,r){if(U(e)&&"string"==typeof e.__typename)return e.__typename;const i=n.schema.getPossibleTypes(r),s=[];for(let r=0;r<i.length;r++){const o=i[r];if(o.isTypeOf){const i=o.isTypeOf(e,t,n);if(V(i))s[r]=i;else if(i)return o.name}}return s.length?Promise.all(s).then((e=>{for(let t=0;t<e.length;t++)if(e[t])return i[t].name})):void 0},ii=function(e,t,n,r){if(U(e)||"function"==typeof e){const i=e[r.fieldName];return"function"==typeof i?e[r.fieldName](t,n,r):i}};const si={base64Binary:on,boolean:an,canonical:on,code:on,date:on,dateTime:on,decimal:sn,id:cn,instant:on,integer:sn,markdown:on,number:sn,positiveInt:sn,string:on,time:on,unsignedInt:sn,uri:on,url:on,xhtml:on,"http://hl7.org/fhirpath/System.Boolean":an,"http://hl7.org/fhirpath/System.Date":on,"http://hl7.org/fhirpath/System.DateTime":on,"http://hl7.org/fhirpath/System.Decimal":sn,"http://hl7.org/fhirpath/System.Integer":sn,"http://hl7.org/fhirpath/System.String":on,"http://hl7.org/fhirpath/System.Time":on};function oi(e,t,n){let r;if(t){const e=n._reference;delete n._reference,r={code:e,operator:u.EQUALS,value:i(t)}}n=Object.fromEntries(Object.entries(n).map((([e,t])=>{return[(n=e,n.startsWith("_")?n:n.replaceAll("_","-")),t];var n})));const s=l(e,n);if(r){const e=s.filters||[];s.filters=[r,...e]}return s}function ai(e){return e.replaceAll("-","_")}async function ci(e,t,n,r){const i=r.fieldName,s=oi(i.substring(0,i.length-4),e,t),o=await n.repo.search(s);return o.entry?.map((e=>e.resource))}function ui(e){const t={_count:{type:rn,description:"Specify how many elements to return from a repeating list."},_offset:{type:rn,description:"Specify the offset to start at for a repeating element."},_sort:{type:on,description:"Specify the sort order by comma-separated list of sort rules in priority order."},_id:{type:on,description:"Select resources based on the logical id of the resource."},_lastUpdated:{type:on,description:"Select resources based on the last time they were changed."}},n=p(e);if(n)for(const[e,r]of Object.entries(n))t[ai(e)]={type:on,description:r.description};return t}const li={...si};function pi(e,t){let n=li[e];return n||(n=function(e,t){const n=d(e);return new zt({name:e+t,description:n.description,fields:()=>function(e,t){const n={};if(f(e)){const e={description:"The type of resource",type:on};n.resourceType=e}return function(e,t,n){const r=d(e),i=r.properties;for(const r of Object.keys(i)){const i=h(e,r);for(const e of i.type)di(t,r,i,e,n)}}(e,n,t),n}(e,t)})}(e,t),li[e]=n),n}function di(e,t,n,r,i){let s=r.code;"Element"!==s&&"BackboneElement"!==s||(s=m(n.path?.split(".")));const o={description:n.short,type:pi(s,i)};"*"===n.max&&(o.type=new St(pi(s,i)));e[t.replace("[x]",y(r.code))]=o}const fi={...si};function hi(e){let t=fi[e];return t||(t=mi(e),fi[e]=t),t}function mi(e){if("ResourceList"===e)return new Yt({name:"ResourceList",types:()=>v().map(hi).filter((e=>!!e)),resolveType:Ni});const t=d(e);return new Ct({name:e,description:t.description,fields:()=>function(e){const t={};return function(e,t){const n=d(e),r=n.properties;T(n)&&(t.resourceType={type:new At(on),description:"Resource Type"});"Reference"===e&&(t.resource={description:"Reference",type:hi("ResourceList"),resolve:gi});for(const n of Object.keys(r)){const r=h(e,n);for(const e of r.type)yi(t,n,r,e)}}(e,t),function(e,t){for(const n of v()){const r=hi(n),i=p(n),s={};let o=0;if(i)for(const[t,n]of Object.entries(i))n.target?.includes(e)&&(s[ai(t)]={value:t},o++);if(o>0){const i=new qt({name:e+"_"+n+"_reference",values:s}),o=ui(n);o._reference={type:new At(i),description:`Specify which property to use for reverse lookup for ${n}`},t[n+"List"]={type:new St(r),args:o,resolve:ci}}}}(e,t),t}(e)})}function yi(e,t,n,r){let i=r.code;"Element"!==i&&"BackboneElement"!==i||(i=m(n.path?.split(".")));const s={description:n.short,type:Ti(n,i),resolve:Ei};"*"===n.max&&(s.args=function(e){const t={_count:{type:rn,description:"Specify how many elements to return from a repeating list."},_offset:{type:rn,description:"Specify the offset to start at for a repeating element."}};if(!E(e.charAt(0))){t.fhirpath={type:on,description:"A FHIRPath statement selecting which of the subnodes is to be included"};const n=g.types[e];if(n.properties)for(const r of Object.keys(n.properties)){const n=h(e,r);for(const e of n.type)vi(t,r,n,e)}}return t}(i));e[t.replace("[x]",y(r.code))]=s}function vi(e,t,n,r){const i=r.code,s=t.replace("[x]",y(i));switch(i){case"canonical":case"code":case"id":case"oid":case"string":case"uri":case"url":case"uuid":case"http://hl7.org/fhirpath/System.String":e[s]={type:on,description:n.short}}}function Ti(e,t){let n=hi(t);return"*"===e.max&&(n=new St(n)),0===e.min||e.path?.endsWith("[x]")||(n=new At(n)),n}async function Ei(e,t,n,r){const i=e?.[r.fieldName];if(!t||!i)return i;const{_offset:s,_count:o,fhirpath:a,...c}=t;let u=i;for(const[e,t]of Object.entries(c))u=u.filter((n=>n[e]===t));return a&&(u=u.filter((e=>N(I(a,[b(e)]))))),s&&(u=u.slice(s)),o&&(u=u.slice(0,o)),u}async function gi(t,r,i){try{return await i.dataLoader.load(t)}catch(t){throw new e(n(t),t)}}function Ni(e){const t=e?.resourceType;if(t)return hi(t).name}const Ii=new _;let bi;async function _i(e,n,r){const{query:i,operationName:s,variables:o}=e.body;if(!i)return[t("Must provide query.")];let a;try{a=new Le(i,u).parseDocument()}catch(e){return[t("GraphQL syntax error.")]}var u;const l=function(){bi||(bi=function(){for(const e of v())fi[e]=mi(e);const e={},t={};for(const n of v()){const r=hi(n);e[n]={type:r,args:{id:{type:new At(cn),description:n+" ID"}},resolve:Di},e[n+"List"]={type:new St(r),args:ui(n),resolve:ci},e[n+"Connection"]={type:Si(n,r),args:ui(n),resolve:Ai},t[n+"Create"]={type:r,args:Oi(n),resolve:xi},t[n+"Update"]={type:r,args:wi(n),resolve:ki},t[n+"Delete"]={type:r,args:{id:{type:new At(cn),description:n+" ID"}},resolve:Ri}}return new Cn({query:new Ct({name:"QueryType",fields:e}),mutation:new Ct({name:"MutationType",fields:t})})}());return bi}(),p=Jr(l,a,[...Pr,Fi]);if(p.length>0)return[(d=p,{resourceType:"OperationOutcome",issue:d.map((e=>({severity:"error",code:"invalid",details:{text:e.message}})))})];var d;const f=function(e){return e.includes("query IntrospectionQuery")||e.includes("__schema")||e.includes("__type")}(i);if(f&&!r.options?.introspectionEnabled)return[O];const h=new R((e=>n.readReferences(e)));let m=f&&Ii.get(i);return m||(m=await Kr({schema:l,document:a,contextValue:{repo:n,dataLoader:h},operationName:s,variableValues:o})),[c,m]}function Oi(e){return{res:{type:new At(pi(e,"Create")),description:e+" Create"}}}function wi(e){return{id:{type:new At(cn),description:e+" ID"},res:{type:new At(pi(e,"Update")),description:e+" Update"}}}function Si(e,t){return new Ct({name:e+"Connection",fields:{count:{type:rn},offset:{type:rn},pageSize:{type:rn},first:{type:on},previous:{type:on},next:{type:on},last:{type:on},edges:{type:new St(new Ct({name:e+"ConnectionEdge",fields:{mode:{type:on},score:{type:sn},resource:{type:t}}}))}}})}async function Ai(e,t,n,r){const i=r.fieldName,s=oi(i.substring(0,i.length-10),e,t);(function(e,t){return e.fieldNodes.some((e=>e.selectionSet?.selections.some((e=>e.kind===ee.FIELD&&e.name.value===t))))})(r,"count")&&(s.total="accurate");const o=await n.repo.search(s);return{count:o.total,offset:s.offset||0,pageSize:s.count||w,edges:o.entry?.map((e=>({mode:e.search?.mode,score:e.search?.score,resource:e.resource})))}}async function Di(t,r,i,s){try{return await i.dataLoader.load({reference:`${s.fieldName}/${r.id}`})}catch(t){throw new e(n(t),t)}}async function xi(e,n,r,i){const s=i.fieldName,o=s.substring(0,s.length-6),a=n.res;if(a.resourceType!==o)return[t("Invalid resourceType")];return await r.repo.createResource(a)}async function ki(e,n,r,i){const s=i.fieldName,o=s.substring(0,s.length-6),a=n.res,c=n.id;if(a.resourceType!==o)return[t("Invalid resourceType")];if(c!==a.id)return[t("Incorrect ID")];return await r.repo.updateResource(a)}async function Ri(e,t,n,r){const i=r.fieldName,s=i.substring(0,i.length-6);await n.repo.deleteResource(s,t.id)}const Fi=e=>({Field(t,n,r,i){const s=function(e){return e.filter((e=>"selections"===e)).length}(i);if(s>12){const n=t.name.value;e.reportError(new J(`Field "${n}" exceeds max depth (depth=${s}, max=12)`,{nodes:t}))}}});class Li{constructor(){this.routes=[]}add(e,t,n){const r=t.split("/").filter((e=>!!e)).map((e=>e.startsWith(":")?{value:e.substring(1),param:!0}:{value:e}));this.routes.push({method:e,path:r,handler:n})}find(e,t){const n=t.split("/").filter((e=>!!e));let r,i=-1;for(const t of this.routes){const s=$i(t,e,n);s>i&&(r=t,i=s)}if(r)return{handler:r.handler,params:Ci(r,n)}}}function $i(e,t,n){if(t!==e.method||n.length!==e.path.length)return-1;let r=0;for(let t=0;t<n.length;t++)if(!e.path[t].param){if(n[t]!==e.path[t].value)return-1;r++}return r}function Ci(e,t){const n=Object.create(null);for(let r=0;r<t.length;r++)e.path[r].param&&(n[e.path[r].value]=t[r]);return n}async function Vi(e,n,r){const i=e.body;if("Bundle"!==i.resourceType)return[t("Not a bundle")];const s=await async function(e,t,n){return new L(e,t,n).processBatch()}(r,n,i);return[c,s]}async function Ui(e,t){const{resourceType:n}=e.params,r=e.query,i=await t.search(l(n,r));return[c,i]}async function ji(e,t){const{resourceType:n}=e.params,r=e.body,i=await t.search(l(n,r));return[c,i]}async function Mi(e,n){const{resourceType:r}=e.params,i=e.body;if(i.resourceType!==r)return[t("Incorrect resource type")];const s=await n.createResource(i);return[A,s]}async function Pi(e,t){const{resourceType:n,id:r}=e.params,i=await t.readResource(n,r);return[c,i]}async function Bi(e,t){const{resourceType:n,id:r}=e.params,i=await t.readHistory(n,r);return[c,i]}async function Gi(e,t){const{resourceType:n,id:r,vid:i}=e.params,s=await t.readVersion(n,r,i);return[c,s]}async function Ji(e,n){const{resourceType:r,id:i}=e.params,s=e.body;if(s.resourceType!==r)return[t("Incorrect resource type")];if(s.id!==i)return[t("Incorrect ID")];const o=await n.updateResource(s);return[c,o]}async function Yi(e,t){const{resourceType:n,id:r}=e.params;return await t.deleteResource(n,r),[c]}async function Qi(e,t){const{resourceType:n,id:r}=e.params,i=e.body,s=await t.patchResource(n,r,i);return[c,s]}class qi{constructor(e={}){this.router=new Li,this.options=e,this.router.add("POST","",Vi),this.router.add("GET",":resourceType",Ui),this.router.add("POST",":resourceType/_search",ji),this.router.add("POST",":resourceType",Mi),this.router.add("GET",":resourceType/:id",Pi),this.router.add("GET",":resourceType/:id/_history",Bi),this.router.add("GET",":resourceType/:id/_history/:vid",Gi),this.router.add("PUT",":resourceType/:id",Ji),this.router.add("DELETE",":resourceType/:id",Yi),this.router.add("PATCH",":resourceType/:id",Qi),this.router.add("POST","$graphql",_i)}async handleRequest(e,t){const r=this.router.find(e.method,e.pathname);if(!r)return[S];const{handler:i,params:s}=r;e.params=s;try{return await i(e,t,this)}catch(e){return[n(e)]}}}class Ki{async searchOne(e){const t=await this.search({...e,count:1});return t.entry?.[0]?.resource}async searchResources(e){const t=await this.search(e);return t.entry?.map((e=>e.resource))||[]}}class zi extends Ki{constructor(){super(),this.resources=new Map,this.history=new Map}async createResource(e){const t=D(e);t.id||(t.id=Hi()),t.meta||(t.meta={}),t.meta.versionId||(t.meta.versionId=Hi()),t.meta.lastUpdated||(t.meta.lastUpdated=(new Date).toISOString());const{resourceType:n,id:r}=t;let i=this.resources.get(n);i||(i=new Map,this.resources.set(n,i)),i.set(r,t);let s=this.history.get(n);s||(s=new Map,this.history.set(n,s));let o=s.get(r);return o||(o=[],s.set(r,o)),o.push(t),D(t)}updateResource(e){const t=D(e);return t.meta&&(t.meta.versionId&&delete t.meta.versionId,t.meta.lastUpdated&&delete t.meta.lastUpdated),this.createResource(t)}async patchResource(r,i,s){const o=await this.readResource(r,i);try{const n=F(o,s).filter(Boolean);if(n.length>0)throw new e(t(n.map((e=>e.message)).join("\n")))}catch(t){throw new e(n(t))}return this.updateResource(o)}async readResource(t,n){const r=this.resources.get(t)?.get(n);if(!r)throw new e(S);return D(r)}async readReference(n){const r=n.reference?.split("/");if(!r||2!==r.length)throw new e(t("Invalid reference"));return this.readResource(r[0],r[1])}async readReferences(e){return Promise.all(e.map((e=>this.readReference(e))))}async readHistory(e,t){return await this.readResource(e,t),{resourceType:"Bundle",type:"history",entry:(this.history.get(e)?.get(t)||[]).reverse().map((e=>({resource:D(e)})))}}async readVersion(t,n,r){await this.readResource(t,n);const i=this.history.get(t)?.get(n)?.find((e=>e.meta?.versionId===r));if(!i)throw new e(S);return D(i)}async search(e){const{resourceType:t}=e,n=this.resources.get(t)||new Map,r=[];for(const t of n.values())x(t,e)&&r.push(t);let i=r.map((e=>({resource:D(e)})));if(e.sortRules)for(const t of e.sortRules)i=i.sort(((e,n)=>Xi(e.resource,n.resource,t)));return void 0!==e.offset&&(i=i.slice(e.offset)),void 0!==e.count&&(i=i.slice(0,e.count)),{resourceType:"Bundle",type:"searchset",entry:i,total:r.length}}async deleteResource(t,n){if(!this.resources.get(t)?.get(n))throw new e(S);this.resources.get(t)?.delete(n)}}const Xi=(e,t,n)=>{const r=g.types[e.resourceType].searchParams?.[n.code],i=r?.expression;if(!i)return 0;const s=JSON.stringify(k(i,e)),o=JSON.stringify(k(i,t));return s.localeCompare(o)*(n.descending?-1:1)},Hi=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));export{Ki as BaseRepository,qi as FhirRouter,zi as MemoryRepository,Li as Router};
|
|
2
|
-
//# sourceMappingURL=index.min.mjs.map
|