!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).prettierPlugins=e.prettierPlugins||{},e.prettierPlugins.graphql=t())}(this,(function(){"use strict";var e=function(e,t){const n=new SyntaxError(e+" ("+t.start.line+":"+t.start.column+")");return n.loc=t,n};var t=function(...e){let t;for(const[n,i]of e.entries())try{return{result:i()}}catch(e){0===n&&(t=e)}return{error:t}};var n={hasPragma:function(e){return/^\s*#[^\S\n]*@(format|prettier)\s*(\n|$)/.test(e)},insertPragma:function(e){return"# @format\n\n"+e}};var i={locStart:function(e){return"number"==typeof e.start?e.start:e.loc&&e.loc.start},locEnd:function(e){return"number"==typeof e.end?e.end:e.loc&&e.loc.end}};function r(e){var t={exports:{}};return e(t,t.exports),t.exports}var o=function(e){return"object"==a(e)&&null!==e};function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var s=Object.defineProperty({default:o},"__esModule",{value:!0}),c=r((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.SYMBOL_TO_STRING_TAG=t.SYMBOL_ASYNC_ITERATOR=t.SYMBOL_ITERATOR=void 0;var n="function"==typeof Symbol&&null!=Symbol.iterator?Symbol.iterator:"@@iterator";t.SYMBOL_ITERATOR=n;var i="function"==typeof Symbol&&null!=Symbol.asyncIterator?Symbol.asyncIterator:"@@asyncIterator";t.SYMBOL_ASYNC_ITERATOR=i;var r="function"==typeof Symbol&&null!=Symbol.toStringTag?Symbol.toStringTag:"@@toStringTag";t.SYMBOL_TO_STRING_TAG=r})),u=function(e,t){var n,i=/\r\n|[\n\r]/g,r=1,o=t+1;for(;(n=i.exec(e.body))&&n.index120){for(var d=Math.floor(c/80),h=c%80,E=[],v=0;v",EOF:"",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});t.TokenKind=n})),R=function(e){return w(e,[])},g=(D=O)&&D.__esModule?D:{default:D};function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function w(e,t){switch(C(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,t){if(-1!==t.indexOf(e))return"[Circular]";var n=[].concat(t,[e]),i=function(e){var t=e[String(g.default)];if("function"==typeof t)return t;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==i){var r=i.call(e);if(r!==e)return"string"==typeof r?r:w(r,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";for(var n=Math.min(10,e.length),i=e.length-n,r=[],o=0;o1&&r.push("... ".concat(i," more items"));return"["+r.join(", ")+"]"}(e,n);return function(e,t){var n=Object.keys(e);if(0===n.length)return"{}";if(t.length>2)return"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var n=e.constructor.name;if("string"==typeof n&&""!==n)return n}return t}(e)+"]";return"{ "+n.map((function(n){return n+": "+w(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}var F=Object.defineProperty({default:R},"__esModule",{value:!0}),P=function(e,t){if(!Boolean(e))throw new Error(t)};var M=Object.defineProperty({default:P},"__esModule",{value:!0}),B=r((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=function(e,t){return e instanceof t}})),j=r((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isSource=function(e){return(0,r.default)(e,s)},t.Source=void 0;var n=o(F),i=o(M),r=o(B);function o(e){return e&&e.__esModule?e:{default:e}}function a(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"GraphQL request",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{line:1,column:1};"string"==typeof e||(0,i.default)(0,"Body must be a string. Received: ".concat((0,n.default)(e),".")),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||(0,i.default)(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||(0,i.default)(0,"column in locationOffset is 1-indexed and must be positive.")}var t,r,o;return t=e,(r=[{key:c.SYMBOL_TO_STRING_TAG,get:function(){return"Source"}}])&&a(t.prototype,r),o&&a(t,o),e}();t.Source=s})),U=r((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DirectiveLocation=void 0;var n=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});t.DirectiveLocation=n})),V=function(e){var t=e.split(/\r\n|[\n\r]/g),n=Q(e);if(0!==n)for(var i=1;ir&&J(t[o-1]);)--o;return t.slice(r,o).join("\n")},G=Q,Y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=-1===e.indexOf("\n"),r=" "===e[0]||"\t"===e[0],o='"'===e[e.length-1],a="\\"===e[e.length-1],s=!i||o||a||n,c="";!s||i&&r||(c+="\n"+t);c+=t?e.replace(/\n/g,"\n"+t):e,s&&(c+="\n");return'"""'+c.replace(/"""/g,'\\"""')+'"""'};function J(e){for(var t=0;t31||9===o));return new b.Token(L.TokenKind.COMMENT,t,s,n,i,r,a.slice(t+1,s))}function s(e,t,n,r,o,a){var s=e.body,u=n,l=t,p=!1;if(45===u&&(u=s.charCodeAt(++l)),48===u){if((u=s.charCodeAt(++l))>=48&&u<=57)throw(0,N.syntaxError)(e,l,"Invalid number, unexpected digit after 0: ".concat(i(u),"."))}else l=c(e,l,u),u=s.charCodeAt(l);if(46===u&&(p=!0,u=s.charCodeAt(++l),l=c(e,l,u),u=s.charCodeAt(l)),69!==u&&101!==u||(p=!0,43!==(u=s.charCodeAt(++l))&&45!==u||(u=s.charCodeAt(++l)),l=c(e,l,u),u=s.charCodeAt(l)),46===u||function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122}(u))throw(0,N.syntaxError)(e,l,"Invalid number, expected digit but got: ".concat(i(u),"."));return new b.Token(p?L.TokenKind.FLOAT:L.TokenKind.INT,t,l,r,o,a,s.slice(t,l))}function c(e,t,n){var r=e.body,o=t,a=n;if(a>=48&&a<=57){do{a=r.charCodeAt(++o)}while(a>=48&&a<=57);return o}throw(0,N.syntaxError)(e,o,"Invalid number, expected digit but got: ".concat(i(a),"."))}function u(e,t,n,r,o){for(var a,s,c,u,l=e.body,d=t+1,h=d,f=0,T="";d=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function d(e,t,n,i,r){for(var o=e.body,a=o.length,s=t+1,c=0;s!==a&&!isNaN(c=o.charCodeAt(s))&&(95===c||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new b.Token(L.TokenKind.NAME,t,s,n,i,r,o.slice(t,s))}t.Lexer=n})),H=r((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.parse=function(e,t){return new n(e,t).parseDocument()},t.parseValue=function(e,t){var i=new n(e,t);i.expectToken(L.TokenKind.SOF);var r=i.parseValueLiteral(!1);return i.expectToken(L.TokenKind.EOF),r},t.parseType=function(e,t){var i=new n(e,t);i.expectToken(L.TokenKind.SOF);var r=i.parseTypeReference();return i.expectToken(L.TokenKind.EOF),r},t.Parser=void 0;var n=function(){function e(e,t){var n=(0,j.isSource)(e)?e:new j.Source(e);this._lexer=new q.Lexer(n),this._options=t}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(L.TokenKind.NAME);return{kind:y.Kind.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:y.Kind.DOCUMENT,definitions:this.many(L.TokenKind.SOF,this.parseDefinition,L.TokenKind.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(L.TokenKind.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(L.TokenKind.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var e=this._lexer.token;if(this.peek(L.TokenKind.BRACE_L))return{kind:y.Kind.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(L.TokenKind.NAME)&&(t=this.parseName()),{kind:y.Kind.OPERATION_DEFINITION,operation:n,name:t,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseOperationType=function(){var e=this.expectToken(L.TokenKind.NAME);switch(e.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(e)},t.parseVariableDefinitions=function(){return this.optionalMany(L.TokenKind.PAREN_L,this.parseVariableDefinition,L.TokenKind.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:y.Kind.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(L.TokenKind.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(L.TokenKind.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(e)}},t.parseVariable=function(){var e=this._lexer.token;return this.expectToken(L.TokenKind.DOLLAR),{kind:y.Kind.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:y.Kind.SELECTION_SET,selections:this.many(L.TokenKind.BRACE_L,this.parseSelection,L.TokenKind.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(L.TokenKind.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,i=this.parseName();return this.expectOptionalToken(L.TokenKind.COLON)?(e=i,t=this.parseName()):t=i,{kind:y.Kind.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(L.TokenKind.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(L.TokenKind.PAREN_L,t,L.TokenKind.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(L.TokenKind.COLON),{kind:y.Kind.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:y.Kind.ARGUMENT,name:this.parseName(),value:(this.expectToken(L.TokenKind.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(L.TokenKind.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(L.TokenKind.NAME)?{kind:y.Kind.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:y.Kind.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseFragmentDefinition=function(){var e,t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.experimentalFragmentVariables)?{kind:y.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}:{kind:y.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}},t.parseFragmentName=function(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(e){var t=this._lexer.token;switch(t.kind){case L.TokenKind.BRACKET_L:return this.parseList(e);case L.TokenKind.BRACE_L:return this.parseObject(e);case L.TokenKind.INT:return this._lexer.advance(),{kind:y.Kind.INT,value:t.value,loc:this.loc(t)};case L.TokenKind.FLOAT:return this._lexer.advance(),{kind:y.Kind.FLOAT,value:t.value,loc:this.loc(t)};case L.TokenKind.STRING:case L.TokenKind.BLOCK_STRING:return this.parseStringLiteral();case L.TokenKind.NAME:switch(this._lexer.advance(),t.value){case"true":return{kind:y.Kind.BOOLEAN,value:!0,loc:this.loc(t)};case"false":return{kind:y.Kind.BOOLEAN,value:!1,loc:this.loc(t)};case"null":return{kind:y.Kind.NULL,loc:this.loc(t)};default:return{kind:y.Kind.ENUM,value:t.value,loc:this.loc(t)}}case L.TokenKind.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:y.Kind.STRING,value:e.value,block:e.kind===L.TokenKind.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:y.Kind.LIST,values:this.any(L.TokenKind.BRACKET_L,(function(){return t.parseValueLiteral(e)}),L.TokenKind.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:y.Kind.OBJECT,fields:this.any(L.TokenKind.BRACE_L,(function(){return t.parseObjectField(e)}),L.TokenKind.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(L.TokenKind.COLON),{kind:y.Kind.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(L.TokenKind.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(L.TokenKind.AT),{kind:y.Kind.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(L.TokenKind.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(L.TokenKind.BRACKET_R),e={kind:y.Kind.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(L.TokenKind.BANG)?{kind:y.Kind.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:y.Kind.NAMED_TYPE,name:this.parseName(),loc:this.loc(e)}},t.parseTypeSystemDefinition=function(){var e=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(e.kind===L.TokenKind.NAME)switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(e)},t.peekDescription=function(){return this.peek(L.TokenKind.STRING)||this.peek(L.TokenKind.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");var n=this.parseDirectives(!0),i=this.many(L.TokenKind.BRACE_L,this.parseOperationTypeDefinition,L.TokenKind.BRACE_R);return{kind:y.Kind.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i,loc:this.loc(e)}},t.parseOperationTypeDefinition=function(){var e=this._lexer.token,t=this.parseOperationType();this.expectToken(L.TokenKind.COLON);var n=this.parseNamedType();return{kind:y.Kind.OPERATION_TYPE_DEFINITION,operation:t,type:n,loc:this.loc(e)}},t.parseScalarTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");var n=this.parseName(),i=this.parseDirectives(!0);return{kind:y.Kind.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:i,loc:this.loc(e)}},t.parseObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");var n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:y.Kind.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:o,loc:this.loc(e)}},t.parseImplementsInterfaces=function(){var e;if(!this.expectOptionalKeyword("implements"))return[];if(!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLImplementsInterfaces)){var t=[];this.expectOptionalToken(L.TokenKind.AMP);do{t.push(this.parseNamedType())}while(this.expectOptionalToken(L.TokenKind.AMP)||this.peek(L.TokenKind.NAME));return t}return this.delimitedMany(L.TokenKind.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var e;return!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLEmptyFields)&&this.peek(L.TokenKind.BRACE_L)&&this._lexer.lookahead().kind===L.TokenKind.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(L.TokenKind.BRACE_L,this.parseFieldDefinition,L.TokenKind.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(L.TokenKind.COLON);var r=this.parseTypeReference(),o=this.parseDirectives(!0);return{kind:y.Kind.FIELD_DEFINITION,description:t,name:n,arguments:i,type:r,directives:o,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(L.TokenKind.PAREN_L,this.parseInputValueDef,L.TokenKind.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(L.TokenKind.COLON);var i,r=this.parseTypeReference();this.expectOptionalToken(L.TokenKind.EQUALS)&&(i=this.parseValueLiteral(!0));var o=this.parseDirectives(!0);return{kind:y.Kind.INPUT_VALUE_DEFINITION,description:t,name:n,type:r,defaultValue:i,directives:o,loc:this.loc(e)}},t.parseInterfaceTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");var n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:y.Kind.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:o,loc:this.loc(e)}},t.parseUnionTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");var n=this.parseName(),i=this.parseDirectives(!0),r=this.parseUnionMemberTypes();return{kind:y.Kind.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:r,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(L.TokenKind.EQUALS)?this.delimitedMany(L.TokenKind.PIPE,this.parseNamedType):[]},t.parseEnumTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");var n=this.parseName(),i=this.parseDirectives(!0),r=this.parseEnumValuesDefinition();return{kind:y.Kind.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:r,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(L.TokenKind.BRACE_L,this.parseEnumValueDefinition,L.TokenKind.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseDirectives(!0);return{kind:y.Kind.ENUM_VALUE_DEFINITION,description:t,name:n,directives:i,loc:this.loc(e)}},t.parseInputObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");var n=this.parseName(),i=this.parseDirectives(!0),r=this.parseInputFieldsDefinition();return{kind:y.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:r,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(L.TokenKind.BRACE_L,this.parseInputValueDef,L.TokenKind.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===L.TokenKind.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)},t.parseSchemaExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var t=this.parseDirectives(!0),n=this.optionalMany(L.TokenKind.BRACE_L,this.parseOperationTypeDefinition,L.TokenKind.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:y.Kind.SCHEMA_EXTENSION,directives:t,operationTypes:n,loc:this.loc(e)}},t.parseScalarTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var t=this.parseName(),n=this.parseDirectives(!0);if(0===n.length)throw this.unexpected();return{kind:y.Kind.SCALAR_TYPE_EXTENSION,name:t,directives:n,loc:this.loc(e)}},t.parseObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return{kind:y.Kind.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:r,loc:this.loc(e)}},t.parseInterfaceTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return{kind:y.Kind.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:r,loc:this.loc(e)}},t.parseUnionTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var t=this.parseName(),n=this.parseDirectives(!0),i=this.parseUnionMemberTypes();if(0===n.length&&0===i.length)throw this.unexpected();return{kind:y.Kind.UNION_TYPE_EXTENSION,name:t,directives:n,types:i,loc:this.loc(e)}},t.parseEnumTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var t=this.parseName(),n=this.parseDirectives(!0),i=this.parseEnumValuesDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return{kind:y.Kind.ENUM_TYPE_EXTENSION,name:t,directives:n,values:i,loc:this.loc(e)}},t.parseInputObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var t=this.parseName(),n=this.parseDirectives(!0),i=this.parseInputFieldsDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return{kind:y.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i,loc:this.loc(e)}},t.parseDirectiveDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(L.TokenKind.AT);var n=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var o=this.parseDirectiveLocations();return{kind:y.Kind.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:r,locations:o,loc:this.loc(e)}},t.parseDirectiveLocations=function(){return this.delimitedMany(L.TokenKind.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==U.DirectiveLocation[t.value])return t;throw this.unexpected(e)},t.loc=function(e){var t;if(!0!==(null===(t=this._options)||void 0===t?void 0:t.noLocation))return new b.Location(e,this._lexer.lastToken,this._lexer.source)},t.peek=function(e){return this._lexer.token.kind===e},t.expectToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw(0,N.syntaxError)(this._lexer.source,t.start,"Expected ".concat(r(e),", found ").concat(i(t),"."))},t.expectOptionalToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t},t.expectKeyword=function(e){var t=this._lexer.token;if(t.kind!==L.TokenKind.NAME||t.value!==e)throw(0,N.syntaxError)(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(i(t),"."));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===L.TokenKind.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=null!=e?e:this._lexer.token;return(0,N.syntaxError)(this._lexer.source,t.start,"Unexpected ".concat(i(t),"."))},t.any=function(e,t,n){this.expectToken(e);for(var i=[];!this.expectOptionalToken(n);)i.push(t.call(this));return i},t.optionalMany=function(e,t,n){if(this.expectOptionalToken(e)){var i=[];do{i.push(t.call(this))}while(!this.expectOptionalToken(n));return i}return[]},t.many=function(e,t,n){this.expectToken(e);var i=[];do{i.push(t.call(this))}while(!this.expectOptionalToken(n));return i},t.delimitedMany=function(e,t){this.expectOptionalToken(e);var n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n},e}();function i(e){var t=e.value;return r(e.kind)+(null!=t?' "'.concat(t,'"'):"")}function r(e){return(0,q.isPunctuatorTokenKind)(e)?'"'.concat(e,'"'):e}t.Parser=n}));const{hasPragma:z}=n,{locStart:$,locEnd:W}=i;function Z(e){if(e&&"object"==typeof e){delete e.startToken,delete e.endToken,delete e.prev,delete e.next;for(const t in e)Z(e[t])}return e}const ee={allowLegacySDLImplementsInterfaces:!1,experimentalFragmentVariables:!0};return{parsers:{graphql:{parse:function(n){const{parse:i}=H,{result:r,error:o}=t((()=>i(n,Object.assign({},ee))),(()=>i(n,Object.assign(Object.assign({},ee),{},{allowLegacySDLImplementsInterfaces:!0}))));if(!r)throw function(t){const{GraphQLError:n}=v;if(t instanceof n){const{message:n,locations:[i]}=t;return e(n,{start:i})}return t}(o);return r.comments=function(e){const t=[],{startToken:n}=e.loc;let{next:i}=n;for(;""!==i.kind;)"Comment"===i.kind&&(Object.assign(i,{column:i.column-1}),t.push(i)),i=i.next;return t}(r),Z(r),r},astFormat:"graphql",hasPragma:z,locStart:$,locEnd:W}}}}));