UNPKG

@tdanks2000/anilist-wrapper

Version:

A comprehensive and easy-to-use TypeScript wrapper for the Anilist GraphQL API (v2). Simplifies fetching anime/manga data and managing user lists in Node.js applications.

28 lines (22 loc) 92.9 kB
// @bun var I6=Object.create;var{getPrototypeOf:A6,defineProperty:iZ,getOwnPropertyNames:D6}=Object;var N6=Object.prototype.hasOwnProperty;var E6=(Z,X,Y)=>{Y=Z!=null?I6(A6(Z)):{};let Q=X||!Z||!Z.__esModule?iZ(Y,"default",{value:Z,enumerable:!0}):Y;for(let B of D6(Z))if(!N6.call(Q,B))iZ(Q,B,{get:()=>Z[B],enumerable:!0});return Q};var O6=(Z,X)=>()=>(X||Z((X={exports:{}}).exports,X),X.exports);var Y6=O6((SY,OZ)=>{var L4,h4,f4,K4,x4,T4,S4,b4,y4,k4,g4,m4,v4,NZ,yZ,u4,c4,l4,p,p4,d4,n4,o4,s4,a4,t4,i4,r4,EZ,e4,Z6,X6;(function(Z){var X=typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:{};if(typeof define==="function"&&define.amd)define("tslib",["exports"],function(Q){Z(Y(X,Y(Q)))});else if(typeof OZ==="object"&&typeof SY==="object")Z(Y(X,Y(SY)));else Z(Y(X));function Y(Q,B){if(Q!==X)if(typeof Object.create==="function")Object.defineProperty(Q,"__esModule",{value:!0});else Q.__esModule=!0;return function(J,G){return Q[J]=B?B(J,G):G}}})(function(Z){var X=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(J,G){J.__proto__=G}||function(J,G){for(var z in G)if(Object.prototype.hasOwnProperty.call(G,z))J[z]=G[z]};L4=function(J,G){if(typeof G!=="function"&&G!==null)throw new TypeError("Class extends value "+String(G)+" is not a constructor or null");X(J,G);function z(){this.constructor=J}J.prototype=G===null?Object.create(G):(z.prototype=G.prototype,new z)},h4=Object.assign||function(J){for(var G,z=1,U=arguments.length;z<U;z++){G=arguments[z];for(var $ in G)if(Object.prototype.hasOwnProperty.call(G,$))J[$]=G[$]}return J},f4=function(J,G){var z={};for(var U in J)if(Object.prototype.hasOwnProperty.call(J,U)&&G.indexOf(U)<0)z[U]=J[U];if(J!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var $=0,U=Object.getOwnPropertySymbols(J);$<U.length;$++)if(G.indexOf(U[$])<0&&Object.prototype.propertyIsEnumerable.call(J,U[$]))z[U[$]]=J[U[$]]}return z},K4=function(J,G,z,U){var $=arguments.length,V=$<3?G:U===null?U=Object.getOwnPropertyDescriptor(G,z):U,P;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")V=Reflect.decorate(J,G,z,U);else for(var D=J.length-1;D>=0;D--)if(P=J[D])V=($<3?P(V):$>3?P(G,z,V):P(G,z))||V;return $>3&&V&&Object.defineProperty(G,z,V),V},x4=function(J,G){return function(z,U){G(z,U,J)}},T4=function(J,G,z,U,$,V){function P(K){if(K!==void 0&&typeof K!=="function")throw new TypeError("Function expected");return K}var D=U.kind,N=D==="getter"?"get":D==="setter"?"set":"value",I=!G&&J?U.static?J:J.prototype:null,O=G||(I?Object.getOwnPropertyDescriptor(I,U.name):{}),R,L=!1;for(var j=z.length-1;j>=0;j--){var H={};for(var M in U)H[M]=M==="access"?{}:U[M];for(var M in U.access)H.access[M]=U.access[M];H.addInitializer=function(K){if(L)throw new TypeError("Cannot add initializers after decoration has completed");V.push(P(K||null))};var h=z[j](D==="accessor"?{get:O.get,set:O.set}:O[N],H);if(D==="accessor"){if(h===void 0)continue;if(h===null||typeof h!=="object")throw new TypeError("Object expected");if(R=P(h.get))O.get=R;if(R=P(h.set))O.set=R;if(R=P(h.init))$.unshift(R)}else if(R=P(h))if(D==="field")$.unshift(R);else O[N]=R}if(I)Object.defineProperty(I,U.name,O);L=!0},S4=function(J,G,z){var U=arguments.length>2;for(var $=0;$<G.length;$++)z=U?G[$].call(J,z):G[$].call(J);return U?z:void 0},b4=function(J){return typeof J==="symbol"?J:"".concat(J)},y4=function(J,G,z){if(typeof G==="symbol")G=G.description?"[".concat(G.description,"]"):"";return Object.defineProperty(J,"name",{configurable:!0,value:z?"".concat(z," ",G):G})},k4=function(J,G){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(J,G)},g4=function(J,G,z,U){function $(V){return V instanceof z?V:new z(function(P){P(V)})}return new(z||(z=Promise))(function(V,P){function D(O){try{I(U.next(O))}catch(R){P(R)}}function N(O){try{I(U.throw(O))}catch(R){P(R)}}function I(O){O.done?V(O.value):$(O.value).then(D,N)}I((U=U.apply(J,G||[])).next())})},m4=function(J,G){var z={label:0,sent:function(){if(V[0]&1)throw V[1];return V[1]},trys:[],ops:[]},U,$,V,P=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return P.next=D(0),P.throw=D(1),P.return=D(2),typeof Symbol==="function"&&(P[Symbol.iterator]=function(){return this}),P;function D(I){return function(O){return N([I,O])}}function N(I){if(U)throw new TypeError("Generator is already executing.");while(P&&(P=0,I[0]&&(z=0)),z)try{if(U=1,$&&(V=I[0]&2?$.return:I[0]?$.throw||((V=$.return)&&V.call($),0):$.next)&&!(V=V.call($,I[1])).done)return V;if($=0,V)I=[I[0]&2,V.value];switch(I[0]){case 0:case 1:V=I;break;case 4:return z.label++,{value:I[1],done:!1};case 5:z.label++,$=I[1],I=[0];continue;case 7:I=z.ops.pop(),z.trys.pop();continue;default:if((V=z.trys,!(V=V.length>0&&V[V.length-1]))&&(I[0]===6||I[0]===2)){z=0;continue}if(I[0]===3&&(!V||I[1]>V[0]&&I[1]<V[3])){z.label=I[1];break}if(I[0]===6&&z.label<V[1]){z.label=V[1],V=I;break}if(V&&z.label<V[2]){z.label=V[2],z.ops.push(I);break}if(V[2])z.ops.pop();z.trys.pop();continue}I=G.call(J,z)}catch(O){I=[6,O],$=0}finally{U=V=0}if(I[0]&5)throw I[1];return{value:I[0]?I[1]:void 0,done:!0}}},v4=function(J,G){for(var z in J)if(z!=="default"&&!Object.prototype.hasOwnProperty.call(G,z))EZ(G,J,z)},EZ=Object.create?function(J,G,z,U){if(U===void 0)U=z;var $=Object.getOwnPropertyDescriptor(G,z);if(!$||("get"in $?!G.__esModule:$.writable||$.configurable))$={enumerable:!0,get:function(){return G[z]}};Object.defineProperty(J,U,$)}:function(J,G,z,U){if(U===void 0)U=z;J[U]=G[z]},NZ=function(J){var G=typeof Symbol==="function"&&Symbol.iterator,z=G&&J[G],U=0;if(z)return z.call(J);if(J&&typeof J.length==="number")return{next:function(){if(J&&U>=J.length)J=void 0;return{value:J&&J[U++],done:!J}}};throw new TypeError(G?"Object is not iterable.":"Symbol.iterator is not defined.")},yZ=function(J,G){var z=typeof Symbol==="function"&&J[Symbol.iterator];if(!z)return J;var U=z.call(J),$,V=[],P;try{while((G===void 0||G-- >0)&&!($=U.next()).done)V.push($.value)}catch(D){P={error:D}}finally{try{if($&&!$.done&&(z=U.return))z.call(U)}finally{if(P)throw P.error}}return V},u4=function(){for(var J=[],G=0;G<arguments.length;G++)J=J.concat(yZ(arguments[G]));return J},c4=function(){for(var J=0,G=0,z=arguments.length;G<z;G++)J+=arguments[G].length;for(var U=Array(J),$=0,G=0;G<z;G++)for(var V=arguments[G],P=0,D=V.length;P<D;P++,$++)U[$]=V[P];return U},l4=function(J,G,z){if(z||arguments.length===2){for(var U=0,$=G.length,V;U<$;U++)if(V||!(U in G)){if(!V)V=Array.prototype.slice.call(G,0,U);V[U]=G[U]}}return J.concat(V||Array.prototype.slice.call(G))},p=function(J){return this instanceof p?(this.v=J,this):new p(J)},p4=function(J,G,z){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var U=z.apply(J,G||[]),$,V=[];return $=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),D("next"),D("throw"),D("return",P),$[Symbol.asyncIterator]=function(){return this},$;function P(j){return function(H){return Promise.resolve(H).then(j,R)}}function D(j,H){if(U[j]){if($[j]=function(M){return new Promise(function(h,K){V.push([j,M,h,K])>1||N(j,M)})},H)$[j]=H($[j])}}function N(j,H){try{I(U[j](H))}catch(M){L(V[0][3],M)}}function I(j){j.value instanceof p?Promise.resolve(j.value.v).then(O,R):L(V[0][2],j)}function O(j){N("next",j)}function R(j){N("throw",j)}function L(j,H){if(j(H),V.shift(),V.length)N(V[0][0],V[0][1])}},d4=function(J){var G,z;return G={},U("next"),U("throw",function($){throw $}),U("return"),G[Symbol.iterator]=function(){return this},G;function U($,V){G[$]=J[$]?function(P){return(z=!z)?{value:p(J[$](P)),done:!1}:V?V(P):P}:V}},n4=function(J){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var G=J[Symbol.asyncIterator],z;return G?G.call(J):(J=typeof NZ==="function"?NZ(J):J[Symbol.iterator](),z={},U("next"),U("throw"),U("return"),z[Symbol.asyncIterator]=function(){return this},z);function U(V){z[V]=J[V]&&function(P){return new Promise(function(D,N){P=J[V](P),$(D,N,P.done,P.value)})}}function $(V,P,D,N){Promise.resolve(N).then(function(I){V({value:I,done:D})},P)}},o4=function(J,G){if(Object.defineProperty)Object.defineProperty(J,"raw",{value:G});else J.raw=G;return J};var Y=Object.create?function(J,G){Object.defineProperty(J,"default",{enumerable:!0,value:G})}:function(J,G){J.default=G},Q=function(J){return Q=Object.getOwnPropertyNames||function(G){var z=[];for(var U in G)if(Object.prototype.hasOwnProperty.call(G,U))z[z.length]=U;return z},Q(J)};s4=function(J){if(J&&J.__esModule)return J;var G={};if(J!=null){for(var z=Q(J),U=0;U<z.length;U++)if(z[U]!=="default")EZ(G,J,z[U])}return Y(G,J),G},a4=function(J){return J&&J.__esModule?J:{default:J}},t4=function(J,G,z,U){if(z==="a"&&!U)throw new TypeError("Private accessor was defined without a getter");if(typeof G==="function"?J!==G||!U:!G.has(J))throw new TypeError("Cannot read private member from an object whose class did not declare it");return z==="m"?U:z==="a"?U.call(J):U?U.value:G.get(J)},i4=function(J,G,z,U,$){if(U==="m")throw new TypeError("Private method is not writable");if(U==="a"&&!$)throw new TypeError("Private accessor was defined without a setter");if(typeof G==="function"?J!==G||!$:!G.has(J))throw new TypeError("Cannot write private member to an object whose class did not declare it");return U==="a"?$.call(J,z):$?$.value=z:G.set(J,z),z},r4=function(J,G){if(G===null||typeof G!=="object"&&typeof G!=="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof J==="function"?G===J:J.has(G)},e4=function(J,G,z){if(G!==null&&G!==void 0){if(typeof G!=="object"&&typeof G!=="function")throw new TypeError("Object expected.");var U,$;if(z){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");U=G[Symbol.asyncDispose]}if(U===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");if(U=G[Symbol.dispose],z)$=U}if(typeof U!=="function")throw new TypeError("Object not disposable.");if($)U=function(){try{$.call(this)}catch(V){return Promise.reject(V)}};J.stack.push({value:G,dispose:U,async:z})}else if(z)J.stack.push({async:!0});return G};var B=typeof SuppressedError==="function"?SuppressedError:function(J,G,z){var U=new Error(z);return U.name="SuppressedError",U.error=J,U.suppressed=G,U};Z6=function(J){function G(V){J.error=J.hasError?new B(V,J.error,"An error was suppressed during disposal."):V,J.hasError=!0}var z,U=0;function $(){while(z=J.stack.pop())try{if(!z.async&&U===1)return U=0,J.stack.push(z),Promise.resolve().then($);if(z.dispose){var V=z.dispose.call(z.value);if(z.async)return U|=2,Promise.resolve(V).then($,function(P){return G(P),$()})}else U|=1}catch(P){G(P)}if(U===1)return J.hasError?Promise.reject(J.error):Promise.resolve();if(J.hasError)throw J.error}return $()},X6=function(J,G){if(typeof J==="string"&&/^\.\.?\//.test(J))return J.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(z,U,$,V,P){return U?G?".jsx":".js":$&&(!V||!P)?z:$+V+"."+P.toLowerCase()+"js"});return J},Z("__extends",L4),Z("__assign",h4),Z("__rest",f4),Z("__decorate",K4),Z("__param",x4),Z("__esDecorate",T4),Z("__runInitializers",S4),Z("__propKey",b4),Z("__setFunctionName",y4),Z("__metadata",k4),Z("__awaiter",g4),Z("__generator",m4),Z("__exportStar",v4),Z("__createBinding",EZ),Z("__values",NZ),Z("__read",yZ),Z("__spread",u4),Z("__spreadArrays",c4),Z("__spreadArray",l4),Z("__await",p),Z("__asyncGenerator",p4),Z("__asyncDelegator",d4),Z("__asyncValues",n4),Z("__makeTemplateObject",o4),Z("__importStar",s4),Z("__importDefault",a4),Z("__classPrivateFieldGet",t4),Z("__classPrivateFieldSet",i4),Z("__classPrivateFieldIn",r4),Z("__addDisposableResource",e4),Z("__disposeResources",Z6),Z("__rewriteRelativeImportExtension",X6)})});class x extends Error{response;request;constructor(Z,X){let Y=`${x.extractMessage(Z)}: ${JSON.stringify({response:Z,request:X})}`;super(Y);if(Object.setPrototypeOf(this,x.prototype),this.response=Z,this.request=X,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,x)}static extractMessage(Z){return Z.errors?.[0]?.message??`GraphQL Error (Code: ${String(Z.status)})`}}var MZ=(Z)=>Z.toUpperCase(),YZ=(Z)=>{return typeof Z==="function"?Z():Z},wZ=(Z,X)=>Z.map((Y,Q)=>[Y,X[Q]]),S=(Z)=>{let X={};if(Z instanceof Headers)X=j6(Z);else if(Array.isArray(Z))Z.forEach(([Y,Q])=>{if(Y&&Q!==void 0)X[Y]=Q});else if(Z)X=Z;return X},j6=(Z)=>{let X={};return Z.forEach((Y,Q)=>{X[Q]=Y}),X},eZ=(Z)=>{try{let X=Z();if(H6(X))return X.catch((Y)=>{return rZ(Y)});return X}catch(X){return rZ(X)}},rZ=(Z)=>{if(Z instanceof Error)return Z;return new Error(String(Z))},H6=(Z)=>{return typeof Z==="object"&&Z!==null&&"then"in Z&&typeof Z.then==="function"&&"catch"in Z&&typeof Z.catch==="function"&&"finally"in Z&&typeof Z.finally==="function"},JZ=(Z)=>{throw new Error(`Unhandled case: ${String(Z)}`)},o=(Z)=>{return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)};var Z4=(Z,X)=>{return Z.documents?Z:{documents:Z,requestHeaders:X,signal:void 0}};var X4=(Z,X,Y)=>{return Z.query?Z:{query:Z,variables:X,requestHeaders:Y,signal:void 0}};function g(Z,X){if(!Boolean(Z))throw new Error(X)}function Y4(Z){return typeof Z=="object"&&Z!==null}function J4(Z,X){if(!Boolean(Z))throw new Error(X!=null?X:"Unexpected invariant triggered.")}var R6=/\r\n|[\n\r]/g;function m(Z,X){let Y=0,Q=1;for(let B of Z.body.matchAll(R6)){if(typeof B.index==="number"||J4(!1),B.index>=X)break;Y=B.index+B[0].length,Q+=1}return{line:Q,column:X+1-Y}}function qZ(Z){return BZ(Z.source,m(Z.source,Z.start))}function BZ(Z,X){let Y=Z.locationOffset.column-1,Q="".padStart(Y)+Z.body,B=X.line-1,J=Z.locationOffset.line-1,G=X.line+J,z=X.line===1?Y:0,U=X.column+z,$=`${Z.name}:${G}:${U} `,V=Q.split(/\r\n|[\n\r]/g),P=V[B];if(P.length>120){let D=Math.floor(U/80),N=U%80,I=[];for(let O=0;O<P.length;O+=80)I.push(P.slice(O,O+80));return $+B4([[`${G} |`,I[0]],...I.slice(1,D+1).map((O)=>["|",O]),["|","^".padStart(N)],["|",I[D+1]]])}return $+B4([[`${G-1} |`,V[B-1]],[`${G} |`,P],["|","^".padStart(U)],[`${G+1} |`,V[B+1]]])}function B4(Z){let X=Z.filter(([Q,B])=>B!==void 0),Y=Math.max(...X.map(([Q])=>Q.length));return X.map(([Q,B])=>Q.padStart(Y)+(B?" "+B:"")).join(` `)}function M6(Z){let X=Z[0];if(X==null||"kind"in X||"length"in X)return{nodes:X,source:Z[1],positions:Z[2],path:Z[3],originalError:Z[4],extensions:Z[5]};return X}class QZ extends Error{constructor(Z,...X){var Y,Q,B;let{nodes:J,source:G,positions:z,path:U,originalError:$,extensions:V}=M6(X);super(Z);this.name="GraphQLError",this.path=U!==null&&U!==void 0?U:void 0,this.originalError=$!==null&&$!==void 0?$:void 0,this.nodes=Q4(Array.isArray(J)?J:J?[J]:void 0);let P=Q4((Y=this.nodes)===null||Y===void 0?void 0:Y.map((N)=>N.loc).filter((N)=>N!=null));this.source=G!==null&&G!==void 0?G:P===null||P===void 0?void 0:(Q=P[0])===null||Q===void 0?void 0:Q.source,this.positions=z!==null&&z!==void 0?z:P===null||P===void 0?void 0:P.map((N)=>N.start),this.locations=z&&G?z.map((N)=>m(G,N)):P===null||P===void 0?void 0:P.map((N)=>m(N.source,N.start));let D=Y4($===null||$===void 0?void 0:$.extensions)?$===null||$===void 0?void 0:$.extensions:void 0;if(this.extensions=(B=V!==null&&V!==void 0?V:D)!==null&&B!==void 0?B: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&&$!==void 0&&$.stack)Object.defineProperty(this,"stack",{value:$.stack,writable:!0,configurable:!0});else if(Error.captureStackTrace)Error.captureStackTrace(this,QZ);else Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let Z=this.message;if(this.nodes){for(let X of this.nodes)if(X.loc)Z+=` `+qZ(X.loc)}else if(this.source&&this.locations)for(let X of this.locations)Z+=` `+BZ(this.source,X);return Z}toJSON(){let Z={message:this.message};if(this.locations!=null)Z.locations=this.locations;if(this.path!=null)Z.path=this.path;if(this.extensions!=null&&Object.keys(this.extensions).length>0)Z.extensions=this.extensions;return Z}}function Q4(Z){return Z===void 0||Z.length===0?void 0:Z}function w(Z,X,Y){return new QZ(`Syntax Error: ${Y}`,{source:Z,positions:[X]})}class GZ{constructor(Z,X,Y){this.start=Z.start,this.end=X.end,this.startToken=Z,this.endToken=X,this.source=Y}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class s{constructor(Z,X,Y,Q,B,J){this.kind=Z,this.start=X,this.end=Y,this.line=Q,this.column=B,this.value=J,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}}}var _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"]},w6=new Set(Object.keys(_Z));function LZ(Z){let X=Z===null||Z===void 0?void 0:Z.kind;return typeof X==="string"&&w6.has(X)}var T;(function(Z){Z.QUERY="query",Z.MUTATION="mutation",Z.SUBSCRIPTION="subscription"})(T||(T={}));var a;(function(Z){Z.QUERY="QUERY",Z.MUTATION="MUTATION",Z.SUBSCRIPTION="SUBSCRIPTION",Z.FIELD="FIELD",Z.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",Z.FRAGMENT_SPREAD="FRAGMENT_SPREAD",Z.INLINE_FRAGMENT="INLINE_FRAGMENT",Z.VARIABLE_DEFINITION="VARIABLE_DEFINITION",Z.SCHEMA="SCHEMA",Z.SCALAR="SCALAR",Z.OBJECT="OBJECT",Z.FIELD_DEFINITION="FIELD_DEFINITION",Z.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",Z.INTERFACE="INTERFACE",Z.UNION="UNION",Z.ENUM="ENUM",Z.ENUM_VALUE="ENUM_VALUE",Z.INPUT_OBJECT="INPUT_OBJECT",Z.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(a||(a={}));var A;(function(Z){Z.NAME="Name",Z.DOCUMENT="Document",Z.OPERATION_DEFINITION="OperationDefinition",Z.VARIABLE_DEFINITION="VariableDefinition",Z.SELECTION_SET="SelectionSet",Z.FIELD="Field",Z.ARGUMENT="Argument",Z.FRAGMENT_SPREAD="FragmentSpread",Z.INLINE_FRAGMENT="InlineFragment",Z.FRAGMENT_DEFINITION="FragmentDefinition",Z.VARIABLE="Variable",Z.INT="IntValue",Z.FLOAT="FloatValue",Z.STRING="StringValue",Z.BOOLEAN="BooleanValue",Z.NULL="NullValue",Z.ENUM="EnumValue",Z.LIST="ListValue",Z.OBJECT="ObjectValue",Z.OBJECT_FIELD="ObjectField",Z.DIRECTIVE="Directive",Z.NAMED_TYPE="NamedType",Z.LIST_TYPE="ListType",Z.NON_NULL_TYPE="NonNullType",Z.SCHEMA_DEFINITION="SchemaDefinition",Z.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",Z.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",Z.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",Z.FIELD_DEFINITION="FieldDefinition",Z.INPUT_VALUE_DEFINITION="InputValueDefinition",Z.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",Z.UNION_TYPE_DEFINITION="UnionTypeDefinition",Z.ENUM_TYPE_DEFINITION="EnumTypeDefinition",Z.ENUM_VALUE_DEFINITION="EnumValueDefinition",Z.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",Z.DIRECTIVE_DEFINITION="DirectiveDefinition",Z.SCHEMA_EXTENSION="SchemaExtension",Z.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",Z.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",Z.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",Z.UNION_TYPE_EXTENSION="UnionTypeExtension",Z.ENUM_TYPE_EXTENSION="EnumTypeExtension",Z.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(A||(A={}));function zZ(Z){return Z===9||Z===32}function v(Z){return Z>=48&&Z<=57}function G4(Z){return Z>=97&&Z<=122||Z>=65&&Z<=90}function hZ(Z){return G4(Z)||Z===95}function z4(Z){return G4(Z)||v(Z)||Z===95}function U4(Z){var X;let Y=Number.MAX_SAFE_INTEGER,Q=null,B=-1;for(let G=0;G<Z.length;++G){var J;let z=Z[G],U=q6(z);if(U===z.length)continue;if(Q=(J=Q)!==null&&J!==void 0?J:G,B=G,G!==0&&U<Y)Y=U}return Z.map((G,z)=>z===0?G:G.slice(Y)).slice((X=Q)!==null&&X!==void 0?X:0,B+1)}function q6(Z){let X=0;while(X<Z.length&&zZ(Z.charCodeAt(X)))++X;return X}function $4(Z,X){let Y=Z.replace(/"""/g,'\\"""'),Q=Y.split(/\r\n|[\n\r]/g),B=Q.length===1,J=Q.length>1&&Q.slice(1).every((N)=>N.length===0||zZ(N.charCodeAt(0))),G=Y.endsWith('\\"""'),z=Z.endsWith('"')&&!G,U=Z.endsWith("\\"),$=z||U,V=!(X!==null&&X!==void 0&&X.minimize)&&(!B||Z.length>70||$||J||G),P="",D=B&&zZ(Z.charCodeAt(0));if(V&&!D||J)P+=` `;if(P+=Y,V||$)P+=` `;return'"""'+P+'"""'}var F;(function(Z){Z.SOF="<SOF>",Z.EOF="<EOF>",Z.BANG="!",Z.DOLLAR="$",Z.AMP="&",Z.PAREN_L="(",Z.PAREN_R=")",Z.SPREAD="...",Z.COLON=":",Z.EQUALS="=",Z.AT="@",Z.BRACKET_L="[",Z.BRACKET_R="]",Z.BRACE_L="{",Z.PIPE="|",Z.BRACE_R="}",Z.NAME="Name",Z.INT="Int",Z.FLOAT="Float",Z.STRING="String",Z.BLOCK_STRING="BlockString",Z.COMMENT="Comment"})(F||(F={}));class UZ{constructor(Z){let X=new s(F.SOF,0,0,0,0);this.source=Z,this.lastToken=X,this.token=X,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let Z=this.token;if(Z.kind!==F.EOF)do if(Z.next)Z=Z.next;else{let X=_6(this,Z.end);Z.next=X,X.prev=Z,Z=X}while(Z.kind===F.COMMENT);return Z}}function F4(Z){return Z===F.BANG||Z===F.DOLLAR||Z===F.AMP||Z===F.PAREN_L||Z===F.PAREN_R||Z===F.SPREAD||Z===F.COLON||Z===F.EQUALS||Z===F.AT||Z===F.BRACKET_L||Z===F.BRACKET_R||Z===F.BRACE_L||Z===F.PIPE||Z===F.BRACE_R}function u(Z){return Z>=0&&Z<=55295||Z>=57344&&Z<=1114111}function $Z(Z,X){return P4(Z.charCodeAt(X))&&W4(Z.charCodeAt(X+1))}function P4(Z){return Z>=55296&&Z<=56319}function W4(Z){return Z>=56320&&Z<=57343}function y(Z,X){let Y=Z.source.body.codePointAt(X);if(Y===void 0)return F.EOF;else if(Y>=32&&Y<=126){let Q=String.fromCodePoint(Y);return Q==='"'?`'"'`:`"${Q}"`}return"U+"+Y.toString(16).toUpperCase().padStart(4,"0")}function q(Z,X,Y,Q,B){let J=Z.line,G=1+Y-Z.lineStart;return new s(X,Y,Q,J,G,B)}function _6(Z,X){let Y=Z.source.body,Q=Y.length,B=X;while(B<Q){let J=Y.charCodeAt(B);switch(J){case 65279:case 9:case 32:case 44:++B;continue;case 10:++B,++Z.line,Z.lineStart=B;continue;case 13:if(Y.charCodeAt(B+1)===10)B+=2;else++B;++Z.line,Z.lineStart=B;continue;case 35:return L6(Z,B);case 33:return q(Z,F.BANG,B,B+1);case 36:return q(Z,F.DOLLAR,B,B+1);case 38:return q(Z,F.AMP,B,B+1);case 40:return q(Z,F.PAREN_L,B,B+1);case 41:return q(Z,F.PAREN_R,B,B+1);case 46:if(Y.charCodeAt(B+1)===46&&Y.charCodeAt(B+2)===46)return q(Z,F.SPREAD,B,B+3);break;case 58:return q(Z,F.COLON,B,B+1);case 61:return q(Z,F.EQUALS,B,B+1);case 64:return q(Z,F.AT,B,B+1);case 91:return q(Z,F.BRACKET_L,B,B+1);case 93:return q(Z,F.BRACKET_R,B,B+1);case 123:return q(Z,F.BRACE_L,B,B+1);case 124:return q(Z,F.PIPE,B,B+1);case 125:return q(Z,F.BRACE_R,B,B+1);case 34:if(Y.charCodeAt(B+1)===34&&Y.charCodeAt(B+2)===34)return S6(Z,B);return f6(Z,B)}if(v(J)||J===45)return h6(Z,B,J);if(hZ(J))return b6(Z,B);throw w(Z.source,B,J===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:u(J)||$Z(Y,B)?`Unexpected character: ${y(Z,B)}.`:`Invalid character: ${y(Z,B)}.`)}return q(Z,F.EOF,Q,Q)}function L6(Z,X){let Y=Z.source.body,Q=Y.length,B=X+1;while(B<Q){let J=Y.charCodeAt(B);if(J===10||J===13)break;if(u(J))++B;else if($Z(Y,B))B+=2;else break}return q(Z,F.COMMENT,X,B,Y.slice(X+1,B))}function h6(Z,X,Y){let Q=Z.source.body,B=X,J=Y,G=!1;if(J===45)J=Q.charCodeAt(++B);if(J===48){if(J=Q.charCodeAt(++B),v(J))throw w(Z.source,B,`Invalid number, unexpected digit after 0: ${y(Z,B)}.`)}else B=fZ(Z,B,J),J=Q.charCodeAt(B);if(J===46)G=!0,J=Q.charCodeAt(++B),B=fZ(Z,B,J),J=Q.charCodeAt(B);if(J===69||J===101){if(G=!0,J=Q.charCodeAt(++B),J===43||J===45)J=Q.charCodeAt(++B);B=fZ(Z,B,J),J=Q.charCodeAt(B)}if(J===46||hZ(J))throw w(Z.source,B,`Invalid number, expected digit but got: ${y(Z,B)}.`);return q(Z,G?F.FLOAT:F.INT,X,B,Q.slice(X,B))}function fZ(Z,X,Y){if(!v(Y))throw w(Z.source,X,`Invalid number, expected digit but got: ${y(Z,X)}.`);let Q=Z.source.body,B=X+1;while(v(Q.charCodeAt(B)))++B;return B}function f6(Z,X){let Y=Z.source.body,Q=Y.length,B=X+1,J=B,G="";while(B<Q){let z=Y.charCodeAt(B);if(z===34)return G+=Y.slice(J,B),q(Z,F.STRING,X,B+1,G);if(z===92){G+=Y.slice(J,B);let U=Y.charCodeAt(B+1)===117?Y.charCodeAt(B+2)===123?K6(Z,B):x6(Z,B):T6(Z,B);G+=U.value,B+=U.size,J=B;continue}if(z===10||z===13)break;if(u(z))++B;else if($Z(Y,B))B+=2;else throw w(Z.source,B,`Invalid character within String: ${y(Z,B)}.`)}throw w(Z.source,B,"Unterminated string.")}function K6(Z,X){let Y=Z.source.body,Q=0,B=3;while(B<12){let J=Y.charCodeAt(X+B++);if(J===125){if(B<5||!u(Q))break;return{value:String.fromCodePoint(Q),size:B}}if(Q=Q<<4|t(J),Q<0)break}throw w(Z.source,X,`Invalid Unicode escape sequence: "${Y.slice(X,X+B)}".`)}function x6(Z,X){let Y=Z.source.body,Q=V4(Y,X+2);if(u(Q))return{value:String.fromCodePoint(Q),size:6};if(P4(Q)){if(Y.charCodeAt(X+6)===92&&Y.charCodeAt(X+7)===117){let B=V4(Y,X+8);if(W4(B))return{value:String.fromCodePoint(Q,B),size:12}}}throw w(Z.source,X,`Invalid Unicode escape sequence: "${Y.slice(X,X+6)}".`)}function V4(Z,X){return t(Z.charCodeAt(X))<<12|t(Z.charCodeAt(X+1))<<8|t(Z.charCodeAt(X+2))<<4|t(Z.charCodeAt(X+3))}function t(Z){return Z>=48&&Z<=57?Z-48:Z>=65&&Z<=70?Z-55:Z>=97&&Z<=102?Z-87:-1}function T6(Z,X){let Y=Z.source.body;switch(Y.charCodeAt(X+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:` `,size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw w(Z.source,X,`Invalid character escape sequence: "${Y.slice(X,X+2)}".`)}function S6(Z,X){let Y=Z.source.body,Q=Y.length,B=Z.lineStart,J=X+3,G=J,z="",U=[];while(J<Q){let $=Y.charCodeAt(J);if($===34&&Y.charCodeAt(J+1)===34&&Y.charCodeAt(J+2)===34){z+=Y.slice(G,J),U.push(z);let V=q(Z,F.BLOCK_STRING,X,J+3,U4(U).join(` `));return Z.line+=U.length-1,Z.lineStart=B,V}if($===92&&Y.charCodeAt(J+1)===34&&Y.charCodeAt(J+2)===34&&Y.charCodeAt(J+3)===34){z+=Y.slice(G,J),G=J+1,J+=4;continue}if($===10||$===13){if(z+=Y.slice(G,J),U.push(z),$===13&&Y.charCodeAt(J+1)===10)J+=2;else++J;z="",G=J,B=J;continue}if(u($))++J;else if($Z(Y,J))J+=2;else throw w(Z.source,J,`Invalid character within String: ${y(Z,J)}.`)}throw w(Z.source,J,"Unterminated string.")}function b6(Z,X){let Y=Z.source.body,Q=Y.length,B=X+1;while(B<Q){let J=Y.charCodeAt(B);if(z4(J))++B;else break}return q(Z,F.NAME,X,B,Y.slice(X,B))}function c(Z){return VZ(Z,[])}function VZ(Z,X){switch(typeof Z){case"string":return JSON.stringify(Z);case"function":return Z.name?`[function ${Z.name}]`:"[function]";case"object":return y6(Z,X);default:return String(Z)}}function y6(Z,X){if(Z===null)return"null";if(X.includes(Z))return"[Circular]";let Y=[...X,Z];if(k6(Z)){let Q=Z.toJSON();if(Q!==Z)return typeof Q==="string"?Q:VZ(Q,Y)}else if(Array.isArray(Z))return m6(Z,Y);return g6(Z,Y)}function k6(Z){return typeof Z.toJSON==="function"}function g6(Z,X){let Y=Object.entries(Z);if(Y.length===0)return"{}";if(X.length>2)return"["+v6(Z)+"]";return"{ "+Y.map(([B,J])=>B+": "+VZ(J,X)).join(", ")+" }"}function m6(Z,X){if(Z.length===0)return"[]";if(X.length>2)return"[Array]";let Y=Math.min(10,Z.length),Q=Z.length-Y,B=[];for(let J=0;J<Y;++J)B.push(VZ(Z[J],X));if(Q===1)B.push("... 1 more item");else if(Q>1)B.push(`... ${Q} more items`);return"["+B.join(", ")+"]"}function v6(Z){let X=Object.prototype.toString.call(Z).replace(/^\[object /,"").replace(/]$/,"");if(X==="Object"&&typeof Z.constructor==="function"){let Y=Z.constructor.name;if(typeof Y==="string"&&Y!=="")return Y}return X}var u6=globalThis.process&&!0,C4=u6?function Z(X,Y){return X instanceof Y}:function Z(X,Y){if(X instanceof Y)return!0;if(typeof X==="object"&&X!==null){var Q;let B=Y.prototype[Symbol.toStringTag],J=Symbol.toStringTag in X?X[Symbol.toStringTag]:(Q=X.constructor)===null||Q===void 0?void 0:Q.name;if(B===J){let G=c(X);throw new Error(`Cannot use ${B} "${G}" from another module or realm. Ensure that there is only one instance of "graphql" in the node_modules directory. If different versions of "graphql" are the dependencies of other relied on modules, use "resolutions" to ensure only one version is installed. https://yarnpkg.com/en/docs/selective-version-resolutions Duplicate "graphql" modules cannot be used at the same time since different versions may have different capabilities and behavior. The data from one version used in the function from another could produce confusing and spurious results.`)}}return!1};class i{constructor(Z,X="GraphQL request",Y={line:1,column:1}){typeof Z==="string"||g(!1,`Body must be a string. Received: ${c(Z)}.`),this.body=Z,this.name=X,this.locationOffset=Y,this.locationOffset.line>0||g(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||g(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function I4(Z){return C4(Z,i)}function l(Z,X){let Y=new A4(Z,X),Q=Y.parseDocument();return Object.defineProperty(Q,"tokenCount",{enumerable:!1,value:Y.tokenCount}),Q}class A4{constructor(Z,X={}){let Y=I4(Z)?Z:new i(Z);this._lexer=new UZ(Y),this._options=X,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let Z=this.expectToken(F.NAME);return this.node(Z,{kind:A.NAME,value:Z.value})}parseDocument(){return this.node(this._lexer.token,{kind:A.DOCUMENT,definitions:this.many(F.SOF,this.parseDefinition,F.EOF)})}parseDefinition(){if(this.peek(F.BRACE_L))return this.parseOperationDefinition();let Z=this.peekDescription(),X=Z?this._lexer.lookahead():this._lexer.token;if(X.kind===F.NAME){switch(X.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(Z)throw w(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(X.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(X)}parseOperationDefinition(){let Z=this._lexer.token;if(this.peek(F.BRACE_L))return this.node(Z,{kind:A.OPERATION_DEFINITION,operation:T.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let X=this.parseOperationType(),Y;if(this.peek(F.NAME))Y=this.parseName();return this.node(Z,{kind:A.OPERATION_DEFINITION,operation:X,name:Y,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let Z=this.expectToken(F.NAME);switch(Z.value){case"query":return T.QUERY;case"mutation":return T.MUTATION;case"subscription":return T.SUBSCRIPTION}throw this.unexpected(Z)}parseVariableDefinitions(){return this.optionalMany(F.PAREN_L,this.parseVariableDefinition,F.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:A.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(F.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(F.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let Z=this._lexer.token;return this.expectToken(F.DOLLAR),this.node(Z,{kind:A.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:A.SELECTION_SET,selections:this.many(F.BRACE_L,this.parseSelection,F.BRACE_R)})}parseSelection(){return this.peek(F.SPREAD)?this.parseFragment():this.parseField()}parseField(){let Z=this._lexer.token,X=this.parseName(),Y,Q;if(this.expectOptionalToken(F.COLON))Y=X,Q=this.parseName();else Q=X;return this.node(Z,{kind:A.FIELD,alias:Y,name:Q,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(F.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(Z){let X=Z?this.parseConstArgument:this.parseArgument;return this.optionalMany(F.PAREN_L,X,F.PAREN_R)}parseArgument(Z=!1){let X=this._lexer.token,Y=this.parseName();return this.expectToken(F.COLON),this.node(X,{kind:A.ARGUMENT,name:Y,value:this.parseValueLiteral(Z)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let Z=this._lexer.token;this.expectToken(F.SPREAD);let X=this.expectOptionalKeyword("on");if(!X&&this.peek(F.NAME))return this.node(Z,{kind:A.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)});return this.node(Z,{kind:A.INLINE_FRAGMENT,typeCondition:X?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let Z=this._lexer.token;if(this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0)return this.node(Z,{kind:A.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()});return this.node(Z,{kind:A.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(Z){let X=this._lexer.token;switch(X.kind){case F.BRACKET_L:return this.parseList(Z);case F.BRACE_L:return this.parseObject(Z);case F.INT:return this.advanceLexer(),this.node(X,{kind:A.INT,value:X.value});case F.FLOAT:return this.advanceLexer(),this.node(X,{kind:A.FLOAT,value:X.value});case F.STRING:case F.BLOCK_STRING:return this.parseStringLiteral();case F.NAME:switch(this.advanceLexer(),X.value){case"true":return this.node(X,{kind:A.BOOLEAN,value:!0});case"false":return this.node(X,{kind:A.BOOLEAN,value:!1});case"null":return this.node(X,{kind:A.NULL});default:return this.node(X,{kind:A.ENUM,value:X.value})}case F.DOLLAR:if(Z)if(this.expectToken(F.DOLLAR),this._lexer.token.kind===F.NAME){let Y=this._lexer.token.value;throw w(this._lexer.source,X.start,`Unexpected variable "$${Y}" in constant value.`)}else throw this.unexpected(X);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let Z=this._lexer.token;return this.advanceLexer(),this.node(Z,{kind:A.STRING,value:Z.value,block:Z.kind===F.BLOCK_STRING})}parseList(Z){let X=()=>this.parseValueLiteral(Z);return this.node(this._lexer.token,{kind:A.LIST,values:this.any(F.BRACKET_L,X,F.BRACKET_R)})}parseObject(Z){let X=()=>this.parseObjectField(Z);return this.node(this._lexer.token,{kind:A.OBJECT,fields:this.any(F.BRACE_L,X,F.BRACE_R)})}parseObjectField(Z){let X=this._lexer.token,Y=this.parseName();return this.expectToken(F.COLON),this.node(X,{kind:A.OBJECT_FIELD,name:Y,value:this.parseValueLiteral(Z)})}parseDirectives(Z){let X=[];while(this.peek(F.AT))X.push(this.parseDirective(Z));return X}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(Z){let X=this._lexer.token;return this.expectToken(F.AT),this.node(X,{kind:A.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(Z)})}parseTypeReference(){let Z=this._lexer.token,X;if(this.expectOptionalToken(F.BRACKET_L)){let Y=this.parseTypeReference();this.expectToken(F.BRACKET_R),X=this.node(Z,{kind:A.LIST_TYPE,type:Y})}else X=this.parseNamedType();if(this.expectOptionalToken(F.BANG))return this.node(Z,{kind:A.NON_NULL_TYPE,type:X});return X}parseNamedType(){return this.node(this._lexer.token,{kind:A.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(F.STRING)||this.peek(F.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let Z=this._lexer.token,X=this.parseDescription();this.expectKeyword("schema");let Y=this.parseConstDirectives(),Q=this.many(F.BRACE_L,this.parseOperationTypeDefinition,F.BRACE_R);return this.node(Z,{kind:A.SCHEMA_DEFINITION,description:X,directives:Y,operationTypes:Q})}parseOperationTypeDefinition(){let Z=this._lexer.token,X=this.parseOperationType();this.expectToken(F.COLON);let Y=this.parseNamedType();return this.node(Z,{kind:A.OPERATION_TYPE_DEFINITION,operation:X,type:Y})}parseScalarTypeDefinition(){let Z=this._lexer.token,X=this.parseDescription();this.expectKeyword("scalar");let Y=this.parseName(),Q=this.parseConstDirectives();return this.node(Z,{kind:A.SCALAR_TYPE_DEFINITION,description:X,name:Y,directives:Q})}parseObjectTypeDefinition(){let Z=this._lexer.token,X=this.parseDescription();this.expectKeyword("type");let Y=this.parseName(),Q=this.parseImplementsInterfaces(),B=this.parseConstDirectives(),J=this.parseFieldsDefinition();return this.node(Z,{kind:A.OBJECT_TYPE_DEFINITION,description:X,name:Y,interfaces:Q,directives:B,fields:J})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(F.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(F.BRACE_L,this.parseFieldDefinition,F.BRACE_R)}parseFieldDefinition(){let Z=this._lexer.token,X=this.parseDescription(),Y=this.parseName(),Q=this.parseArgumentDefs();this.expectToken(F.COLON);let B=this.parseTypeReference(),J=this.parseConstDirectives();return this.node(Z,{kind:A.FIELD_DEFINITION,description:X,name:Y,arguments:Q,type:B,directives:J})}parseArgumentDefs(){return this.optionalMany(F.PAREN_L,this.parseInputValueDef,F.PAREN_R)}parseInputValueDef(){let Z=this._lexer.token,X=this.parseDescription(),Y=this.parseName();this.expectToken(F.COLON);let Q=this.parseTypeReference(),B;if(this.expectOptionalToken(F.EQUALS))B=this.parseConstValueLiteral();let J=this.parseConstDirectives();return this.node(Z,{kind:A.INPUT_VALUE_DEFINITION,description:X,name:Y,type:Q,defaultValue:B,directives:J})}parseInterfaceTypeDefinition(){let Z=this._lexer.token,X=this.parseDescription();this.expectKeyword("interface");let Y=this.parseName(),Q=this.parseImplementsInterfaces(),B=this.parseConstDirectives(),J=this.parseFieldsDefinition();return this.node(Z,{kind:A.INTERFACE_TYPE_DEFINITION,description:X,name:Y,interfaces:Q,directives:B,fields:J})}parseUnionTypeDefinition(){let Z=this._lexer.token,X=this.parseDescription();this.expectKeyword("union");let Y=this.parseName(),Q=this.parseConstDirectives(),B=this.parseUnionMemberTypes();return this.node(Z,{kind:A.UNION_TYPE_DEFINITION,description:X,name:Y,directives:Q,types:B})}parseUnionMemberTypes(){return this.expectOptionalToken(F.EQUALS)?this.delimitedMany(F.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let Z=this._lexer.token,X=this.parseDescription();this.expectKeyword("enum");let Y=this.parseName(),Q=this.parseConstDirectives(),B=this.parseEnumValuesDefinition();return this.node(Z,{kind:A.ENUM_TYPE_DEFINITION,description:X,name:Y,directives:Q,values:B})}parseEnumValuesDefinition(){return this.optionalMany(F.BRACE_L,this.parseEnumValueDefinition,F.BRACE_R)}parseEnumValueDefinition(){let Z=this._lexer.token,X=this.parseDescription(),Y=this.parseEnumValueName(),Q=this.parseConstDirectives();return this.node(Z,{kind:A.ENUM_VALUE_DEFINITION,description:X,name:Y,directives:Q})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw w(this._lexer.source,this._lexer.token.start,`${FZ(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let Z=this._lexer.token,X=this.parseDescription();this.expectKeyword("input");let Y=this.parseName(),Q=this.parseConstDirectives(),B=this.parseInputFieldsDefinition();return this.node(Z,{kind:A.INPUT_OBJECT_TYPE_DEFINITION,description:X,name:Y,directives:Q,fields:B})}parseInputFieldsDefinition(){return this.optionalMany(F.BRACE_L,this.parseInputValueDef,F.BRACE_R)}parseTypeSystemExtension(){let Z=this._lexer.lookahead();if(Z.kind===F.NAME)switch(Z.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(Z)}parseSchemaExtension(){let Z=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let X=this.parseConstDirectives(),Y=this.optionalMany(F.BRACE_L,this.parseOperationTypeDefinition,F.BRACE_R);if(X.length===0&&Y.length===0)throw this.unexpected();return this.node(Z,{kind:A.SCHEMA_EXTENSION,directives:X,operationTypes:Y})}parseScalarTypeExtension(){let Z=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let X=this.parseName(),Y=this.parseConstDirectives();if(Y.length===0)throw this.unexpected();return this.node(Z,{kind:A.SCALAR_TYPE_EXTENSION,name:X,directives:Y})}parseObjectTypeExtension(){let Z=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let X=this.parseName(),Y=this.parseImplementsInterfaces(),Q=this.parseConstDirectives(),B=this.parseFieldsDefinition();if(Y.length===0&&Q.length===0&&B.length===0)throw this.unexpected();return this.node(Z,{kind:A.OBJECT_TYPE_EXTENSION,name:X,interfaces:Y,directives:Q,fields:B})}parseInterfaceTypeExtension(){let Z=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let X=this.parseName(),Y=this.parseImplementsInterfaces(),Q=this.parseConstDirectives(),B=this.parseFieldsDefinition();if(Y.length===0&&Q.length===0&&B.length===0)throw this.unexpected();return this.node(Z,{kind:A.INTERFACE_TYPE_EXTENSION,name:X,interfaces:Y,directives:Q,fields:B})}parseUnionTypeExtension(){let Z=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let X=this.parseName(),Y=this.parseConstDirectives(),Q=this.parseUnionMemberTypes();if(Y.length===0&&Q.length===0)throw this.unexpected();return this.node(Z,{kind:A.UNION_TYPE_EXTENSION,name:X,directives:Y,types:Q})}parseEnumTypeExtension(){let Z=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let X=this.parseName(),Y=this.parseConstDirectives(),Q=this.parseEnumValuesDefinition();if(Y.length===0&&Q.length===0)throw this.unexpected();return this.node(Z,{kind:A.ENUM_TYPE_EXTENSION,name:X,directives:Y,values:Q})}parseInputObjectTypeExtension(){let Z=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let X=this.parseName(),Y=this.parseConstDirectives(),Q=this.parseInputFieldsDefinition();if(Y.length===0&&Q.length===0)throw this.unexpected();return this.node(Z,{kind:A.INPUT_OBJECT_TYPE_EXTENSION,name:X,directives:Y,fields:Q})}parseDirectiveDefinition(){let Z=this._lexer.token,X=this.parseDescription();this.expectKeyword("directive"),this.expectToken(F.AT);let Y=this.parseName(),Q=this.parseArgumentDefs(),B=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let J=this.parseDirectiveLocations();return this.node(Z,{kind:A.DIRECTIVE_DEFINITION,description:X,name:Y,arguments:Q,repeatable:B,locations:J})}parseDirectiveLocations(){return this.delimitedMany(F.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let Z=this._lexer.token,X=this.parseName();if(Object.prototype.hasOwnProperty.call(a,X.value))return X;throw this.unexpected(Z)}node(Z,X){if(this._options.noLocation!==!0)X.loc=new GZ(Z,this._lexer.lastToken,this._lexer.source);return X}peek(Z){return this._lexer.token.kind===Z}expectToken(Z){let X=this._lexer.token;if(X.kind===Z)return this.advanceLexer(),X;throw w(this._lexer.source,X.start,`Expected ${D4(Z)}, found ${FZ(X)}.`)}expectOptionalToken(Z){if(this._lexer.token.kind===Z)return this.advanceLexer(),!0;return!1}expectKeyword(Z){let X=this._lexer.token;if(X.kind===F.NAME&&X.value===Z)this.advanceLexer();else throw w(this._lexer.source,X.start,`Expected "${Z}", found ${FZ(X)}.`)}expectOptionalKeyword(Z){let X=this._lexer.token;if(X.kind===F.NAME&&X.value===Z)return this.advanceLexer(),!0;return!1}unexpected(Z){let X=Z!==null&&Z!==void 0?Z:this._lexer.token;return w(this._lexer.source,X.start,`Unexpected ${FZ(X)}.`)}any(Z,X,Y){this.expectToken(Z);let Q=[];while(!this.expectOptionalToken(Y))Q.push(X.call(this));return Q}optionalMany(Z,X,Y){if(this.expectOptionalToken(Z)){let Q=[];do Q.push(X.call(this));while(!this.expectOptionalToken(Y));return Q}return[]}many(Z,X,Y){this.expectToken(Z);let Q=[];do Q.push(X.call(this));while(!this.expectOptionalToken(Y));return Q}delimitedMany(Z,X){this.expectOptionalToken(Z);let Y=[];do Y.push(X.call(this));while(this.expectOptionalToken(Z));return Y}advanceLexer(){let{maxTokens:Z}=this._options,X=this._lexer.advance();if(X.kind!==F.EOF){if(++this._tokenCounter,Z!==void 0&&this._tokenCounter>Z)throw w(this._lexer.source,X.start,`Document contains more that ${Z} tokens. Parsing aborted.`)}}}function FZ(Z){let X=Z.value;return D4(Z.kind)+(X!=null?` "${X}"`:"")}function D4(Z){return F4(Z)?`"${Z}"`:Z}function N4(Z){return`"${Z.replace(c6,l6)}"`}var c6=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function l6(Z){return p6[Z.charCodeAt(0)]}var p6=["\\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"];var E4=Object.freeze({});function KZ(Z,X,Y=_Z){let Q=new Map;for(let L of Object.values(A))Q.set(L,O4(X,L));let B=void 0,J=Array.isArray(Z),G=[Z],z=-1,U=[],$=Z,V=void 0,P=void 0,D=[],N=[];do{z++;let L=z===G.length,j=L&&U.length!==0;if(L){if(V=N.length===0?void 0:D[D.length-1],$=P,P=N.pop(),j)if(J){$=$.slice();let M=0;for(let[h,K]of U){let tZ=h-M;if(K===null)$.splice(tZ,1),M++;else $[tZ]=K}}else{$={...$};for(let[M,h]of U)$[M]=h}z=B.index,G=B.keys,U=B.edits,J=B.inArray,B=B.prev}else if(P){if(V=J?z:G[z],$=P[V],$===null||$===void 0)continue;D.push(V)}let H;if(!Array.isArray($)){var I,O;LZ($)||g(!1,`Invalid AST Node: ${c($)}.`);let M=L?(I=Q.get($.kind))===null||I===void 0?void 0:I.leave:(O=Q.get($.kind))===null||O===void 0?void 0:O.enter;if(H=M===null||M===void 0?void 0:M.call(X,$,V,P,D,N),H===E4)break;if(H===!1){if(!L){D.pop();continue}}else if(H!==void 0){if(U.push([V,H]),!L)if(LZ(H))$=H;else{D.pop();continue}}}if(H===void 0&&j)U.push([V,$]);if(L)D.pop();else{var R;if(B={inArray:J,index:z,keys:G,edits:U,prev:B},J=Array.isArray($),G=J?$:(R=Y[$.kind])!==null&&R!==void 0?R:[],z=-1,U=[],P)N.push(P);P=$}}while(B!==void 0);if(U.length!==0)return U[U.length-1][1];return Z}function O4(Z,X){let Y=Z[X];if(typeof Y==="object")return Y;else if(typeof Y==="function")return{enter:Y,leave:void 0};return{enter:Z.enter,leave:Z.leave}}function WZ(Z){return KZ(Z,n6)}var d6=80,n6={Name:{leave:(Z)=>Z.value},Variable:{leave:(Z)=>"$"+Z.name},Document:{leave:(Z)=>C(Z.definitions,` `)},OperationDefinition:{leave(Z){let X=E("(",C(Z.variableDefinitions,", "),")"),Y=C([Z.operation,C([Z.name,X]),C(Z.directives," ")]," ");return(Y==="query"?"":Y+" ")+Z.selectionSet}},VariableDefinition:{leave:({variable:Z,type:X,defaultValue:Y,directives:Q})=>Z+": "+X+E(" = ",Y)+E(" ",C(Q," "))},SelectionSet:{leave:({selections:Z})=>f(Z)},Field:{leave({alias:Z,name:X,arguments:Y,directives:Q,selectionSet:B}){let J=E("",Z,": ")+X,G=J+E("(",C(Y,", "),")");if(G.length>d6)G=J+E(`( `,PZ(C(Y,` `)),` )`);return C([G,C(Q," "),B]," ")}},Argument:{leave:({name:Z,value:X})=>Z+": "+X},FragmentSpread:{leave:({name:Z,directive