UNPKG

@spiffcommerce/core

Version:

Core client API for interacting with the Spiff Commerce backend.

55 lines (49 loc) • 1.66 MB
"use strict";var KD=Object.create;var Kb=Object.defineProperty;var ZD=Object.getOwnPropertyDescriptor;var eP=Object.getOwnPropertyNames;var tP=Object.getPrototypeOf,rP=Object.prototype.hasOwnProperty;var nP=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of eP(e))!rP.call(r,i)&&i!==t&&Kb(r,i,{get:()=>e[i],enumerable:!(n=ZD(e,i))||n.enumerable});return r};var iP=(r,e,t)=>(t=r!=null?KD(tP(r)):{},nP(e||!r||!r.__esModule?Kb(t,"default",{value:r,enumerable:!0}):t,r));var ny=function(r,e){return ny=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},ny(r,e)};function va(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ny(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var me=function(){return me=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},me.apply(this,arguments)};function os(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function ns(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,e||[])).next())})}function is(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=o(0),s.throw=o(1),s.return=o(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(u){return function(c){return l([u,c])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(t=0)),t;)try{if(n=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1],a=u;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(u);break}a[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(c){u=[6,c],i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function na(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))}var Km="Invariant Violation",Zb=Object.setPrototypeOf,aP=Zb===void 0?function(r,e){return r.__proto__=e,r}:Zb,S2=(function(r){va(e,r);function e(t){t===void 0&&(t=Km);var n=r.call(this,typeof t=="number"?Km+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return n.framesToPop=1,n.name=Km,aP(n,e.prototype),n}return e})(Error);function vl(r,e){if(!r)throw new S2(e)}var E2=["debug","log","warn","error","silent"],sP=E2.indexOf("log");function jh(r){return function(){if(E2.indexOf(r)>=sP){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=jh("debug"),r.log=jh("log"),r.warn=jh("warn"),r.error=jh("error")})(vl||(vl={}));var bA="3.14.1";function Da(r){try{return r()}catch{}}const rg=Da(function(){return globalThis})||Da(function(){return window})||Da(function(){return self})||Da(function(){return global})||Da(function(){return Da.constructor("return this")()});var ew=new Map;function iy(r){var e=ew.get(r)||1;return ew.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function oP(r,e){var t=iy("stringifyForDisplay");return JSON.stringify(r,function(n,i){return i===void 0?t:i},e).split(JSON.stringify(t)).join("<undefined>")}function Gh(r){return function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(typeof e=="number"){var i=e;e=wA(i),e||(e=CA(i,t),t=[])}r.apply(void 0,[e].concat(t))}}var Mr=Object.assign(function(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];e||vl(e,wA(t,n)||CA(t,n))},{debug:Gh(vl.debug),log:Gh(vl.log),warn:Gh(vl.warn),error:Gh(vl.error)});function Wi(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return new S2(wA(r,e)||CA(r,e))}var tw=Symbol.for("ApolloErrorMessageHandler_"+bA);function k2(r){if(typeof r=="string")return r;try{return oP(r,2).slice(0,1e3)}catch{return"<non-serializable>"}}function wA(r,e){if(e===void 0&&(e=[]),!!r)return rg[tw]&&rg[tw](r,e.map(k2))}function CA(r,e){if(e===void 0&&(e=[]),!!r)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:bA,message:r,args:e.map(k2)})))}function _p(r,e){if(!!!r)throw new Error(e)}function lP(r){return typeof r=="object"&&r!==null}function uP(r,e){if(!!!r)throw new Error("Unexpected invariant triggered.")}const cP=/\r\n|[\n\r]/g;function ay(r,e){let t=0,n=1;for(const i of r.body.matchAll(cP)){if(typeof i.index=="number"||uP(!1),i.index>=e)break;t=i.index+i[0].length,n+=1}return{line:n,column:e+1-t}}function fP(r){return F2(r.source,ay(r.source,r.start))}function F2(r,e){const t=r.locationOffset.column-1,n="".padStart(t)+r.body,i=e.line-1,a=r.locationOffset.line-1,s=e.line+a,o=e.line===1?t:0,l=e.column+o,u=`${r.name}:${s}:${l} `,c=n.split(/\r\n|[\n\r]/g),h=c[i];if(h.length>120){const f=Math.floor(l/80),d=l%80,g=[];for(let v=0;v<h.length;v+=80)g.push(h.slice(v,v+80));return u+rw([[`${s} |`,g[0]],...g.slice(1,f+1).map(v=>["|",v]),["|","^".padStart(d)],["|",g[f+1]]])}return u+rw([[`${s-1} |`,c[i-1]],[`${s} |`,h],["|","^".padStart(l)],[`${s+1} |`,c[i+1]]])}function rw(r){const e=r.filter(([n,i])=>i!==void 0),t=Math.max(...e.map(([n])=>n.length));return e.map(([n,i])=>n.padStart(t)+(i?" "+i:"")).join(` `)}function dP(r){const e=r[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:r[1],positions:r[2],path:r[3],originalError:r[4],extensions:r[5]}:e}class xA extends Error{constructor(e,...t){var n,i,a;const{nodes:s,source:o,positions:l,path:u,originalError:c,extensions:h}=dP(t);super(e),this.name="GraphQLError",this.path=u??void 0,this.originalError=c??void 0,this.nodes=nw(Array.isArray(s)?s:s?[s]:void 0);const f=nw((n=this.nodes)===null||n===void 0?void 0:n.map(g=>g.loc).filter(g=>g!=null));this.source=o??(f==null||(i=f[0])===null||i===void 0?void 0:i.source),this.positions=l??f?.map(g=>g.start),this.locations=l&&o?l.map(g=>ay(o,g)):f?.map(g=>ay(g.source,g.start));const d=lP(c?.extensions)?c?.extensions:void 0;this.extensions=(a=h??d)!==null&&a!==void 0?a: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}}),c!=null&&c.stack?Object.defineProperty(this,"stack",{value:c.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,xA):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 t of this.nodes)t.loc&&(e+=` `+fP(t.loc));else if(this.source&&this.locations)for(const t of this.locations)e+=` `+F2(this.source,t);return e}toJSON(){const e={message:this.message};return this.locations!=null&&(e.locations=this.locations),this.path!=null&&(e.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function nw(r){return r===void 0||r.length===0?void 0:r}function ci(r,e,t){return new xA(`Syntax Error: ${t}`,{source:r,positions:[e]})}class hP{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}}}let T2=class{constructor(e,t,n,i,a,s){this.kind=e,this.start=t,this.end=n,this.line=i,this.column=a,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 I2={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","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:["description","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"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},pP=new Set(Object.keys(I2));function iw(r){const e=r?.kind;return typeof e=="string"&&pP.has(e)}var _u;(function(r){r.QUERY="query",r.MUTATION="mutation",r.SUBSCRIPTION="subscription"})(_u||(_u={}));var sy;(function(r){r.QUERY="QUERY",r.MUTATION="MUTATION",r.SUBSCRIPTION="SUBSCRIPTION",r.FIELD="FIELD",r.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",r.FRAGMENT_SPREAD="FRAGMENT_SPREAD",r.INLINE_FRAGMENT="INLINE_FRAGMENT",r.VARIABLE_DEFINITION="VARIABLE_DEFINITION",r.SCHEMA="SCHEMA",r.SCALAR="SCALAR",r.OBJECT="OBJECT",r.FIELD_DEFINITION="FIELD_DEFINITION",r.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",r.INTERFACE="INTERFACE",r.UNION="UNION",r.ENUM="ENUM",r.ENUM_VALUE="ENUM_VALUE",r.INPUT_OBJECT="INPUT_OBJECT",r.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(sy||(sy={}));var et;(function(r){r.NAME="Name",r.DOCUMENT="Document",r.OPERATION_DEFINITION="OperationDefinition",r.VARIABLE_DEFINITION="VariableDefinition",r.SELECTION_SET="SelectionSet",r.FIELD="Field",r.ARGUMENT="Argument",r.FRAGMENT_SPREAD="FragmentSpread",r.INLINE_FRAGMENT="InlineFragment",r.FRAGMENT_DEFINITION="FragmentDefinition",r.VARIABLE="Variable",r.INT="IntValue",r.FLOAT="FloatValue",r.STRING="StringValue",r.BOOLEAN="BooleanValue",r.NULL="NullValue",r.ENUM="EnumValue",r.LIST="ListValue",r.OBJECT="ObjectValue",r.OBJECT_FIELD="ObjectField",r.DIRECTIVE="Directive",r.NAMED_TYPE="NamedType",r.LIST_TYPE="ListType",r.NON_NULL_TYPE="NonNullType",r.SCHEMA_DEFINITION="SchemaDefinition",r.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",r.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",r.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",r.FIELD_DEFINITION="FieldDefinition",r.INPUT_VALUE_DEFINITION="InputValueDefinition",r.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",r.UNION_TYPE_DEFINITION="UnionTypeDefinition",r.ENUM_TYPE_DEFINITION="EnumTypeDefinition",r.ENUM_VALUE_DEFINITION="EnumValueDefinition",r.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",r.DIRECTIVE_DEFINITION="DirectiveDefinition",r.SCHEMA_EXTENSION="SchemaExtension",r.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",r.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",r.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",r.UNION_TYPE_EXTENSION="UnionTypeExtension",r.ENUM_TYPE_EXTENSION="EnumTypeExtension",r.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension",r.TYPE_COORDINATE="TypeCoordinate",r.MEMBER_COORDINATE="MemberCoordinate",r.ARGUMENT_COORDINATE="ArgumentCoordinate",r.DIRECTIVE_COORDINATE="DirectiveCoordinate",r.DIRECTIVE_ARGUMENT_COORDINATE="DirectiveArgumentCoordinate"})(et||(et={}));function oy(r){return r===9||r===32}function gd(r){return r>=48&&r<=57}function D2(r){return r>=97&&r<=122||r>=65&&r<=90}function P2(r){return D2(r)||r===95}function gP(r){return D2(r)||gd(r)||r===95}function mP(r){var e;let t=Number.MAX_SAFE_INTEGER,n=null,i=-1;for(let s=0;s<r.length;++s){var a;const o=r[s],l=vP(o);l!==o.length&&(n=(a=n)!==null&&a!==void 0?a:s,i=s,s!==0&&l<t&&(t=l))}return r.map((s,o)=>o===0?s:s.slice(t)).slice((e=n)!==null&&e!==void 0?e:0,i+1)}function vP(r){let e=0;for(;e<r.length&&oy(r.charCodeAt(e));)++e;return e}function yP(r,e){const t=r.replace(/"""/g,'\\"""'),n=t.split(/\r\n|[\n\r]/g),i=n.length===1,a=n.length>1&&n.slice(1).every(d=>d.length===0||oy(d.charCodeAt(0))),s=t.endsWith('\\"""'),o=r.endsWith('"')&&!s,l=r.endsWith("\\"),u=o||l,c=!i||r.length>70||u||a||s;let h="";const f=i&&oy(r.charCodeAt(0));return(c&&!f||a)&&(h+=` `),h+=t,(c||u)&&(h+=` `),'"""'+h+'"""'}var Pe;(function(r){r.SOF="<SOF>",r.EOF="<EOF>",r.BANG="!",r.DOLLAR="$",r.AMP="&",r.PAREN_L="(",r.PAREN_R=")",r.DOT=".",r.SPREAD="...",r.COLON=":",r.EQUALS="=",r.AT="@",r.BRACKET_L="[",r.BRACKET_R="]",r.BRACE_L="{",r.PIPE="|",r.BRACE_R="}",r.NAME="Name",r.INT="Int",r.FLOAT="Float",r.STRING="String",r.BLOCK_STRING="BlockString",r.COMMENT="Comment"})(Pe||(Pe={}));class AP{constructor(e){const t=new T2(Pe.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(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==Pe.EOF)do if(e.next)e=e.next;else{const t=wP(this,e.end);e.next=t,t.prev=e,e=t}while(e.kind===Pe.COMMENT);return e}}function bP(r){return r===Pe.BANG||r===Pe.DOLLAR||r===Pe.AMP||r===Pe.PAREN_L||r===Pe.PAREN_R||r===Pe.DOT||r===Pe.SPREAD||r===Pe.COLON||r===Pe.EQUALS||r===Pe.AT||r===Pe.BRACKET_L||r===Pe.BRACKET_R||r===Pe.BRACE_L||r===Pe.PIPE||r===Pe.BRACE_R}function pc(r){return r>=0&&r<=55295||r>=57344&&r<=1114111}function Fg(r,e){return R2(r.charCodeAt(e))&&O2(r.charCodeAt(e+1))}function R2(r){return r>=55296&&r<=56319}function O2(r){return r>=56320&&r<=57343}function Tl(r,e){const t=r.source.body.codePointAt(e);if(t===void 0)return Pe.EOF;if(t>=32&&t<=126){const n=String.fromCodePoint(t);return n==='"'?`'"'`:`"${n}"`}return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function ni(r,e,t,n,i){const a=r.line,s=1+t-r.lineStart;return new T2(e,t,n,a,s,i)}function wP(r,e){const t=r.source.body,n=t.length;let i=e;for(;i<n;){const a=t.charCodeAt(i);switch(a){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++r.line,r.lineStart=i;continue;case 13:t.charCodeAt(i+1)===10?i+=2:++i,++r.line,r.lineStart=i;continue;case 35:return CP(r,i);case 33:return ni(r,Pe.BANG,i,i+1);case 36:return ni(r,Pe.DOLLAR,i,i+1);case 38:return ni(r,Pe.AMP,i,i+1);case 40:return ni(r,Pe.PAREN_L,i,i+1);case 41:return ni(r,Pe.PAREN_R,i,i+1);case 46:if(t.charCodeAt(i+1)===46&&t.charCodeAt(i+2)===46)return ni(r,Pe.SPREAD,i,i+3);break;case 58:return ni(r,Pe.COLON,i,i+1);case 61:return ni(r,Pe.EQUALS,i,i+1);case 64:return ni(r,Pe.AT,i,i+1);case 91:return ni(r,Pe.BRACKET_L,i,i+1);case 93:return ni(r,Pe.BRACKET_R,i,i+1);case 123:return ni(r,Pe.BRACE_L,i,i+1);case 124:return ni(r,Pe.PIPE,i,i+1);case 125:return ni(r,Pe.BRACE_R,i,i+1);case 34:return t.charCodeAt(i+1)===34&&t.charCodeAt(i+2)===34?TP(r,i):SP(r,i)}if(gd(a)||a===45)return xP(r,i,a);if(P2(a))return IP(r,i);throw ci(r.source,i,a===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:pc(a)||Fg(t,i)?`Unexpected character: ${Tl(r,i)}.`:`Invalid character: ${Tl(r,i)}.`)}return ni(r,Pe.EOF,n,n)}function CP(r,e){const t=r.source.body,n=t.length;let i=e+1;for(;i<n;){const a=t.charCodeAt(i);if(a===10||a===13)break;if(pc(a))++i;else if(Fg(t,i))i+=2;else break}return ni(r,Pe.COMMENT,e,i,t.slice(e+1,i))}function xP(r,e,t){const n=r.source.body;let i=e,a=t,s=!1;if(a===45&&(a=n.charCodeAt(++i)),a===48){if(a=n.charCodeAt(++i),gd(a))throw ci(r.source,i,`Invalid number, unexpected digit after 0: ${Tl(r,i)}.`)}else i=Zm(r,i,a),a=n.charCodeAt(i);if(a===46&&(s=!0,a=n.charCodeAt(++i),i=Zm(r,i,a),a=n.charCodeAt(i)),(a===69||a===101)&&(s=!0,a=n.charCodeAt(++i),(a===43||a===45)&&(a=n.charCodeAt(++i)),i=Zm(r,i,a),a=n.charCodeAt(i)),a===46||P2(a))throw ci(r.source,i,`Invalid number, expected digit but got: ${Tl(r,i)}.`);return ni(r,s?Pe.FLOAT:Pe.INT,e,i,n.slice(e,i))}function Zm(r,e,t){if(!gd(t))throw ci(r.source,e,`Invalid number, expected digit but got: ${Tl(r,e)}.`);const n=r.source.body;let i=e+1;for(;gd(n.charCodeAt(i));)++i;return i}function SP(r,e){const t=r.source.body,n=t.length;let i=e+1,a=i,s="";for(;i<n;){const o=t.charCodeAt(i);if(o===34)return s+=t.slice(a,i),ni(r,Pe.STRING,e,i+1,s);if(o===92){s+=t.slice(a,i);const l=t.charCodeAt(i+1)===117?t.charCodeAt(i+2)===123?EP(r,i):kP(r,i):FP(r,i);s+=l.value,i+=l.size,a=i;continue}if(o===10||o===13)break;if(pc(o))++i;else if(Fg(t,i))i+=2;else throw ci(r.source,i,`Invalid character within String: ${Tl(r,i)}.`)}throw ci(r.source,i,"Unterminated string.")}function EP(r,e){const t=r.source.body;let n=0,i=3;for(;i<12;){const a=t.charCodeAt(e+i++);if(a===125){if(i<5||!pc(n))break;return{value:String.fromCodePoint(n),size:i}}if(n=n<<4|Vf(a),n<0)break}throw ci(r.source,e,`Invalid Unicode escape sequence: "${t.slice(e,e+i)}".`)}function kP(r,e){const t=r.source.body,n=aw(t,e+2);if(pc(n))return{value:String.fromCodePoint(n),size:6};if(R2(n)&&t.charCodeAt(e+6)===92&&t.charCodeAt(e+7)===117){const i=aw(t,e+8);if(O2(i))return{value:String.fromCodePoint(n,i),size:12}}throw ci(r.source,e,`Invalid Unicode escape sequence: "${t.slice(e,e+6)}".`)}function aw(r,e){return Vf(r.charCodeAt(e))<<12|Vf(r.charCodeAt(e+1))<<8|Vf(r.charCodeAt(e+2))<<4|Vf(r.charCodeAt(e+3))}function Vf(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function FP(r,e){const t=r.source.body;switch(t.charCodeAt(e+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:" ",size:2}}throw ci(r.source,e,`Invalid character escape sequence: "${t.slice(e,e+2)}".`)}function TP(r,e){const t=r.source.body,n=t.length;let i=r.lineStart,a=e+3,s=a,o="";const l=[];for(;a<n;){const u=t.charCodeAt(a);if(u===34&&t.charCodeAt(a+1)===34&&t.charCodeAt(a+2)===34){o+=t.slice(s,a),l.push(o);const c=ni(r,Pe.BLOCK_STRING,e,a+3,mP(l).join(` `));return r.line+=l.length-1,r.lineStart=i,c}if(u===92&&t.charCodeAt(a+1)===34&&t.charCodeAt(a+2)===34&&t.charCodeAt(a+3)===34){o+=t.slice(s,a),s=a+1,a+=4;continue}if(u===10||u===13){o+=t.slice(s,a),l.push(o),u===13&&t.charCodeAt(a+1)===10?a+=2:++a,o="",s=a,i=a;continue}if(pc(u))++a;else if(Fg(t,a))a+=2;else throw ci(r.source,a,`Invalid character within String: ${Tl(r,a)}.`)}throw ci(r.source,a,"Unterminated string.")}function IP(r,e){const t=r.source.body,n=t.length;let i=e+1;for(;i<n;){const a=t.charCodeAt(i);if(gP(a))++i;else break}return ni(r,Pe.NAME,e,i,t.slice(e,i))}const DP=10,B2=2;function SA(r){return Tg(r,[])}function Tg(r,e){switch(typeof r){case"string":return JSON.stringify(r);case"function":return r.name?`[function ${r.name}]`:"[function]";case"object":return PP(r,e);default:return String(r)}}function PP(r,e){if(r===null)return"null";if(e.includes(r))return"[Circular]";const t=[...e,r];if(RP(r)){const n=r.toJSON();if(n!==r)return typeof n=="string"?n:Tg(n,t)}else if(Array.isArray(r))return BP(r,t);return OP(r,t)}function RP(r){return typeof r.toJSON=="function"}function OP(r,e){const t=Object.entries(r);return t.length===0?"{}":e.length>B2?"["+MP(r)+"]":"{ "+t.map(([i,a])=>i+": "+Tg(a,e)).join(", ")+" }"}function BP(r,e){if(r.length===0)return"[]";if(e.length>B2)return"[Array]";const t=Math.min(DP,r.length),n=r.length-t,i=[];for(let a=0;a<t;++a)i.push(Tg(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push(`... ${n} more items`),"["+i.join(", ")+"]"}function MP(r){const e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){const t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}const _P=globalThis.process&&process.env.NODE_ENV==="production",NP=_P?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if(typeof e=="object"&&e!==null){var n;const i=t.prototype[Symbol.toStringTag],a=Symbol.toStringTag in e?e[Symbol.toStringTag]:(n=e.constructor)===null||n===void 0?void 0:n.name;if(i===a){const s=SA(e);throw new Error(`Cannot use ${i} "${s}" 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 M2{constructor(e,t="GraphQL request",n={line:1,column:1}){typeof e=="string"||_p(!1,`Body must be a string. Received: ${SA(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||_p(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||_p(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function LP(r){return NP(r,M2)}function UP(r,e){const t=new VP(r,e),n=t.parseDocument();return Object.defineProperty(n,"tokenCount",{enumerable:!1,value:t.tokenCount}),n}let VP=class{constructor(e,t={}){const{lexer:n,...i}=t;if(n)this._lexer=n;else{const a=LP(e)?e:new M2(e);this._lexer=new AP(a)}this._options=i,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const e=this.expectToken(Pe.NAME);return this.node(e,{kind:et.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:et.DOCUMENT,definitions:this.many(Pe.SOF,this.parseDefinition,Pe.EOF)})}parseDefinition(){if(this.peek(Pe.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(e&&t.kind===Pe.BRACE_L)throw ci(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(t.kind===Pe.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()}switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(e)throw ci(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if(t.value==="extend")return this.parseTypeSystemExtension()}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(Pe.BRACE_L))return this.node(e,{kind:et.OPERATION_DEFINITION,operation:_u.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseDescription(),n=this.parseOperationType();let i;return this.peek(Pe.NAME)&&(i=this.parseName()),this.node(e,{kind:et.OPERATION_DEFINITION,operation:n,description:t,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(Pe.NAME);switch(e.value){case"query":return _u.QUERY;case"mutation":return _u.MUTATION;case"subscription":return _u.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(Pe.PAREN_L,this.parseVariableDefinition,Pe.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:et.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(Pe.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Pe.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(Pe.DOLLAR),this.node(e,{kind:et.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:et.SELECTION_SET,selections:this.many(Pe.BRACE_L,this.parseSelection,Pe.BRACE_R)})}parseSelection(){return this.peek(Pe.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,i;return this.expectOptionalToken(Pe.COLON)?(n=t,i=this.parseName()):i=t,this.node(e,{kind:et.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Pe.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Pe.PAREN_L,t,Pe.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(Pe.COLON),this.node(t,{kind:et.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(Pe.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(Pe.NAME)?this.node(e,{kind:et.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:et.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token,t=this.parseDescription();return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:et.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:et.FRAGMENT_DEFINITION,description:t,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(e){const t=this._lexer.token;switch(t.kind){case Pe.BRACKET_L:return this.parseList(e);case Pe.BRACE_L:return this.parseObject(e);case Pe.INT:return this.advanceLexer(),this.node(t,{kind:et.INT,value:t.value});case Pe.FLOAT:return this.advanceLexer(),this.node(t,{kind:et.FLOAT,value:t.value});case Pe.STRING:case Pe.BLOCK_STRING:return this.parseStringLiteral();case Pe.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:et.BOOLEAN,value:!0});case"false":return this.node(t,{kind:et.BOOLEAN,value:!1});case"null":return this.node(t,{kind:et.NULL});default:return this.node(t,{kind:et.ENUM,value:t.value})}case Pe.DOLLAR:if(e)if(this.expectToken(Pe.DOLLAR),this._lexer.token.kind===Pe.NAME){const n=this._lexer.token.value;throw ci(this._lexer.source,t.start,`Unexpected variable "$${n}" in constant value.`)}else 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:et.STRING,value:e.value,block:e.kind===Pe.BLOCK_STRING})}parseList(e){const t=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:et.LIST,values:this.any(Pe.BRACKET_L,t,Pe.BRACKET_R)})}parseObject(e){const t=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:et.OBJECT,fields:this.any(Pe.BRACE_L,t,Pe.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(Pe.COLON),this.node(t,{kind:et.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(Pe.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(Pe.AT),this.node(t,{kind:et.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(Pe.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(Pe.BRACKET_R),t=this.node(e,{kind:et.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(Pe.BANG)?this.node(e,{kind:et.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:et.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(Pe.STRING)||this.peek(Pe.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(),i=this.many(Pe.BRACE_L,this.parseOperationTypeDefinition,Pe.BRACE_R);return this.node(e,{kind:et.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(Pe.COLON);const n=this.parseNamedType();return this.node(e,{kind:et.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:et.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:et.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:a,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(Pe.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(Pe.BRACE_L,this.parseFieldDefinition,Pe.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(Pe.COLON);const a=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(e,{kind:et.FIELD_DEFINITION,description:t,name:n,arguments:i,type:a,directives:s})}parseArgumentDefs(){return this.optionalMany(Pe.PAREN_L,this.parseInputValueDef,Pe.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(Pe.COLON);const i=this.parseTypeReference();let a;this.expectOptionalToken(Pe.EQUALS)&&(a=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(e,{kind:et.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:a,directives:s})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:et.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:a,fields:s})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseUnionMemberTypes();return this.node(e,{kind:et.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:a})}parseUnionMemberTypes(){return this.expectOptionalToken(Pe.EQUALS)?this.delimitedMany(Pe.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseEnumValuesDefinition();return this.node(e,{kind:et.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:a})}parseEnumValuesDefinition(){return this.optionalMany(Pe.BRACE_L,this.parseEnumValueDefinition,Pe.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:et.ENUM_VALUE_DEFINITION,description:t,name:n,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw ci(this._lexer.source,this._lexer.token.start,`${$h(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(),i=this.parseConstDirectives(),a=this.parseInputFieldsDefinition();return this.node(e,{kind:et.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:a})}parseInputFieldsDefinition(){return this.optionalMany(Pe.BRACE_L,this.parseInputValueDef,Pe.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===Pe.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(Pe.BRACE_L,this.parseOperationTypeDefinition,Pe.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:et.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(n.length===0)throw this.unexpected();return this.node(e,{kind:et.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(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:et.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:a})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:et.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:a})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:et.UNION_TYPE_EXTENSION,name:t,directives:n,types:i})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:et.ENUM_TYPE_EXTENSION,name:t,directives:n,values:i})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:et.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(Pe.AT);const n=this.parseName(),i=this.parseArgumentDefs(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(e,{kind:et.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:a,locations:s})}parseDirectiveLocations(){return this.delimitedMany(Pe.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(sy,t.value))return t;throw this.unexpected(e)}parseSchemaCoordinate(){const e=this._lexer.token,t=this.expectOptionalToken(Pe.AT),n=this.parseName();let i;!t&&this.expectOptionalToken(Pe.DOT)&&(i=this.parseName());let a;return(t||i)&&this.expectOptionalToken(Pe.PAREN_L)&&(a=this.parseName(),this.expectToken(Pe.COLON),this.expectToken(Pe.PAREN_R)),t?a?this.node(e,{kind:et.DIRECTIVE_ARGUMENT_COORDINATE,name:n,argumentName:a}):this.node(e,{kind:et.DIRECTIVE_COORDINATE,name:n}):i?a?this.node(e,{kind:et.ARGUMENT_COORDINATE,name:n,fieldName:i,argumentName:a}):this.node(e,{kind:et.MEMBER_COORDINATE,name:n,memberName:i}):this.node(e,{kind:et.TYPE_COORDINATE,name:n})}node(e,t){return this._options.noLocation!==!0&&(t.loc=new hP(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 ci(this._lexer.source,t.start,`Expected ${_2(e)}, found ${$h(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){const t=this._lexer.token;if(t.kind===Pe.NAME&&t.value===e)this.advanceLexer();else throw ci(this._lexer.source,t.start,`Expected "${e}", found ${$h(t)}.`)}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===Pe.NAME&&t.value===e?(this.advanceLexer(),!0):!1}unexpected(e){const t=e??this._lexer.token;return ci(this._lexer.source,t.start,`Unexpected ${$h(t)}.`)}any(e,t,n){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(n);)i.push(t.call(this));return i}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const i=[];do i.push(t.call(this));while(!this.expectOptionalToken(n));return i}return[]}many(e,t,n){this.expectToken(e);const i=[];do i.push(t.call(this));while(!this.expectOptionalToken(n));return i}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(t.kind!==Pe.EOF&&(++this._tokenCounter,e!==void 0&&this._tokenCounter>e))throw ci(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};function $h(r){const e=r.value;return _2(r.kind)+(e!=null?` "${e}"`:"")}function _2(r){return bP(r)?`"${r}"`:r}function zP(r){return`"${r.replace(HP,jP)}"`}const HP=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function jP(r){return GP[r.charCodeAt(0)]}const GP=["\\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"],EA=Object.freeze({});function Oa(r,e,t=I2){const n=new Map;for(const A of Object.values(et))n.set(A,$P(e,A));let i,a=Array.isArray(r),s=[r],o=-1,l=[],u=r,c,h;const f=[],d=[];do{o++;const A=o===s.length,C=A&&l.length!==0;if(A){if(c=d.length===0?void 0:f[f.length-1],u=h,h=d.pop(),C)if(a){u=u.slice();let T=0;for(const[S,R]of l){const B=S-T;R===null?(u.splice(B,1),T++):u[B]=R}}else{u={...u};for(const[T,S]of l)u[T]=S}o=i.index,s=i.keys,l=i.edits,a=i.inArray,i=i.prev}else if(h){if(c=a?o:s[o],u=h[c],u==null)continue;f.push(c)}let k;if(!Array.isArray(u)){var g,v;iw(u)||_p(!1,`Invalid AST Node: ${SA(u)}.`);const T=A?(g=n.get(u.kind))===null||g===void 0?void 0:g.leave:(v=n.get(u.kind))===null||v===void 0?void 0:v.enter;if(k=T?.call(e,u,c,h,f,d),k===EA)break;if(k===!1){if(!A){f.pop();continue}}else if(k!==void 0&&(l.push([c,k]),!A))if(iw(k))u=k;else{f.pop();continue}}if(k===void 0&&C&&l.push([c,u]),A)f.pop();else{var y;i={inArray:a,index:o,keys:s,edits:l,prev:i},a=Array.isArray(u),s=a?u:(y=t[u.kind])!==null&&y!==void 0?y:[],o=-1,l=[],h&&d.push(h),h=u}}while(i!==void 0);return l.length!==0?l[l.length-1][1]:r}function $P(r,e){const t=r[e];return typeof t=="object"?t:typeof t=="function"?{enter:t,leave:void 0}:{enter:r.enter,leave:r.leave}}function qP(r){return Oa(r,QP)}const WP=80,QP={Name:{leave:r=>r.value},Variable:{leave:r=>"$"+r.name},Document:{leave:r=>ut(r.definitions,` `)},OperationDefinition:{leave(r){const e=e0(r.variableDefinitions)?tr(`( `,ut(r.variableDefinitions,` `),` )`):tr("(",ut(r.variableDefinitions,", "),")"),t=tr("",r.description,` `)+ut([r.operation,ut([r.name,e]),ut(r.directives," ")]," ");return(t==="query"?"":t+" ")+r.selectionSet}},VariableDefinition:{leave:({variable:r,type:e,defaultValue:t,directives:n,description:i})=>tr("",i,` `)+r+": "+e+tr(" = ",t)+tr(" ",ut(n," "))},SelectionSet:{leave:({selections:r})=>ka(r)},Field:{leave({alias:r,name:e,arguments:t,directives:n,selectionSet:i}){const a=tr("",r,": ")+e;let s=a+tr("(",ut(t,", "),")");return s.length>WP&&(s=a+tr(`( `,Np(ut(t,` `)),` )`)),ut([s,ut(n," "),i]," ")}},Argument:{leave:({name:r,value:e})=>r+": "+e},FragmentSpread:{leave:({name:r,directives:e})=>"..."+r+tr(" ",ut(e," "))},InlineFragment:{leave:({typeCondition:r,directives:e,selectionSet:t})=>ut(["...",tr("on ",r),ut(e," "),t]," ")},FragmentDefinition:{leave:({name:r,typeCondition:e,variableDefinitions:t,directives:n,selectionSet:i,description:a})=>tr("",a,` `)+`fragment ${r}${tr("(",ut(t,", "),")")} on ${e} ${tr("",ut(n," ")," ")}`+i},IntValue:{leave:({value:r})=>r},FloatValue:{leave:({value:r})=>r},StringValue:{leave:({value:r,block:e})=>e?yP(r):zP(r)},BooleanValue:{leave:({value:r})=>r?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:r})=>r},ListValue:{leave:({values:r})=>"["+ut(r,", ")+"]"},ObjectValue:{leave:({fields:r})=>"{"+ut(r,", ")+"}"},ObjectField:{leave:({name:r,value:e})=>r+": "+e},Directive:{leave:({name:r,arguments:e})=>"@"+r+tr("(",ut(e,", "),")")},NamedType:{leave:({name:r})=>r},ListType:{leave:({type:r})=>"["+r+"]"},NonNullType:{leave:({type:r})=>r+"!"},SchemaDefinition:{leave:({description:r,directives:e,operationTypes:t})=>tr("",r,` `)+ut(["schema",ut(e," "),ka(t)]," ")},OperationTypeDefinition:{leave:({operation:r,type:e})=>r+": "+e},ScalarTypeDefinition:{leave:({description:r,name:e,directives:t})=>tr("",r,` `)+ut(["scalar",e,ut(t," ")]," ")},ObjectTypeDefinition:{leave:({description:r,name:e,interfaces:t,directives:n,fields:i})=>tr("",r,` `)+ut(["type",e,tr("implements ",ut(t," & ")),ut(n," "),ka(i)]," ")},FieldDefinition:{leave:({description:r,name:e,arguments:t,type:n,directives:i})=>tr("",r,` `)+e+(e0(t)?tr(`( `,Np(ut(t,` `)),` )`):tr("(",ut(t,", "),")"))+": "+n+tr(" ",ut(i," "))},InputValueDefinition:{leave:({description:r,name:e,type:t,defaultValue:n,directives:i})=>tr("",r,` `)+ut([e+": "+t,tr("= ",n),ut(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:r,name:e,interfaces:t,directives:n,fields:i})=>tr("",r,` `)+ut(["interface",e,tr("implements ",ut(t," & ")),ut(n," "),ka(i)]," ")},UnionTypeDefinition:{leave:({description:r,name:e,directives:t,types:n})=>tr("",r,` `)+ut(["union",e,ut(t," "),tr("= ",ut(n," | "))]," ")},EnumTypeDefinition:{leave:({description:r,name:e,directives:t,values:n})=>tr("",r,` `)+ut(["enum",e,ut(t," "),ka(n)]," ")},EnumValueDefinition:{leave:({description:r,name:e,directives:t})=>tr("",r,` `)+ut([e,ut(t," ")]," ")},InputObjectTypeDefinition:{leave:({description:r,name:e,directives:t,fields:n})=>tr("",r,` `)+ut(["input",e,ut(t," "),ka(n)]," ")},DirectiveDefinition:{leave:({description:r,name:e,arguments:t,repeatable:n,locations:i})=>tr("",r,` `)+"directive @"+e+(e0(t)?tr(`( `,Np(ut(t,` `)),` )`):tr("(",ut(t,", "),")"))+(n?" repeatable":"")+" on "+ut(i," | ")},SchemaExtension:{leave:({directives:r,operationTypes:e})=>ut(["extend schema",ut(r," "),ka(e)]," ")},ScalarTypeExtension:{leave:({name:r,directives:e})=>ut(["extend scalar",r,ut(e," ")]," ")},ObjectTypeExtension:{leave:({name:r,interfaces:e,directives:t,fields:n})=>ut(["extend type",r,tr("implements ",ut(e," & ")),ut(t," "),ka(n)]," ")},InterfaceTypeExtension:{leave:({name:r,interfaces:e,directives:t,fields:n})=>ut(["extend interface",r,tr("implements ",ut(e," & ")),ut(t," "),ka(n)]," ")},UnionTypeExtension:{leave:({name:r,directives:e,types:t})=>ut(["extend union",r,ut(e," "),tr("= ",ut(t," | "))]," ")},EnumTypeExtension:{leave:({name:r,directives:e,values:t})=>ut(["extend enum",r,ut(e," "),ka(t)]," ")},InputObjectTypeExtension:{leave:({name:r,directives:e,fields:t})=>ut(["extend input",r,ut(e," "),ka(t)]," ")},TypeCoordinate:{leave:({name:r})=>r},MemberCoordinate:{leave:({name:r,memberName:e})=>ut([r,tr(".",e)])},ArgumentCoordinate:{leave:({name:r,fieldName:e,argumentName:t})=>ut([r,tr(".",e),tr("(",t,":)")])},DirectiveCoordinate:{leave:({name:r})=>ut(["@",r])},DirectiveArgumentCoordinate:{leave:({name:r,argumentName:e})=>ut(["@",r,tr("(",e,":)")])}};function ut(r,e=""){var t;return(t=r?.filter(n=>n).join(e))!==null&&t!==void 0?t:""}function ka(r){return tr(`{ `,Np(ut(r,` `)),` }`)}function tr(r,e,t=""){return e!=null&&e!==""?r+e+t:""}function Np(r){return tr(" ",r.replace(/\n/g,` `))}function e0(r){var e;return(e=r?.some(t=>t.includes(` `)))!==null&&e!==void 0?e:!1}function sw(r){return r.kind===et.FIELD||r.kind===et.FRAGMENT_SPREAD||r.kind===et.INLINE_FRAGMENT}function Ud(r,e){var t=r.directives;return!t||!t.length?!0:JP(t).every(function(n){var i=n.directive,a=n.ifArgument,s=!1;return a.value.kind==="Variable"?(s=e&&e[a.value.name.value],Mr(s!==void 0,105,i.name.value)):s=a.value.value,i.name.value==="skip"?!s:s})}function md(r,e,t){var n=new Set(r),i=n.size;return Oa(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return EA}}),t?!n.size:n.size<i}function YP(r){return r&&md(["client","export"],r,!0)}function XP(r){var e=r.name.value;return e==="skip"||e==="include"}function JP(r){var e=[];return r&&r.length&&r.forEach(function(t){if(XP(t)){var n=t.arguments,i=t.name.value;Mr(n&&n.length===1,106,i);var a=n[0];Mr(a.name&&a.name.value==="if",107,i);var s=a.value;Mr(s&&(s.kind==="Variable"||s.kind==="BooleanValue"),108,i),e.push({directive:t,ifArgument:a})}}),e}function KP(r){var e,t,n=(e=r.directives)===null||e===void 0?void 0:e.find(function(a){var s=a.name;return s.value==="unmask"});if(!n)return"mask";var i=(t=n.arguments)===null||t===void 0?void 0:t.find(function(a){var s=a.name;return s.value==="mode"});return i&&"value"in i.value&&i.value.value==="migrate"?"migrate":"unmask"}const ZP=()=>Object.create(null),{forEach:eR,slice:ow}=Array.prototype,{hasOwnProperty:tR}=Object.prototype;class Vs{constructor(e=!0,t=ZP){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return eR.call(e,n=>t=t.getChildTrie(n)),tR.call(t,"data")?t.data:t.data=this.makeData(ow.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let n=0,i=e.length;t&&n<i;++n){const a=t.mapFor(e[n],!1);t=a&&a.get(e[n])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){const n=e[0],i=this.mapFor(n,!1),a=i&&i.get(n);a&&(t=a.removeArray(ow.call(e,1)),!a.data&&!a.weak&&!(a.strong&&a.strong.size)&&i.delete(n))}else t=this.data,delete this.