prettier 3.0.0-alpha.1 → 3.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +910 -759
- package/README.md +3 -3
- package/bin/prettier.cjs +0 -0
- package/doc.d.ts +240 -0
- package/doc.js +351 -479
- package/doc.mjs +342 -474
- package/index.cjs +400 -230
- package/index.d.ts +919 -0
- package/index.mjs +18129 -32123
- package/internal/cli.mjs +4374 -10823
- package/internal/internal.mjs +6437 -0
- package/package.json +55 -13
- package/plugins/acorn.d.ts +6 -0
- package/plugins/acorn.js +13 -0
- package/plugins/acorn.mjs +13 -0
- package/plugins/angular.d.ts +8 -0
- package/plugins/angular.js +2 -2
- package/plugins/angular.mjs +2 -2
- package/plugins/babel.d.ts +17 -0
- package/plugins/babel.js +12 -12
- package/plugins/babel.mjs +12 -12
- package/plugins/estree.d.ts +0 -0
- package/plugins/estree.js +35 -0
- package/plugins/estree.mjs +35 -0
- package/plugins/flow.d.ts +5 -0
- package/plugins/flow.js +20 -20
- package/plugins/flow.mjs +20 -20
- package/plugins/glimmer.d.ts +5 -0
- package/plugins/glimmer.js +23 -18
- package/plugins/glimmer.mjs +23 -18
- package/plugins/graphql.d.ts +5 -0
- package/plugins/graphql.js +16 -7
- package/plugins/graphql.mjs +16 -7
- package/plugins/html.d.ts +8 -0
- package/plugins/html.js +19 -29
- package/plugins/html.mjs +19 -29
- package/plugins/markdown.d.ts +7 -0
- package/plugins/markdown.js +52 -32
- package/plugins/markdown.mjs +52 -32
- package/plugins/meriyah.d.ts +5 -0
- package/plugins/meriyah.js +5 -6
- package/plugins/meriyah.mjs +5 -6
- package/plugins/postcss.d.ts +7 -0
- package/plugins/postcss.js +45 -43
- package/plugins/postcss.mjs +45 -43
- package/plugins/typescript.d.ts +5 -0
- package/plugins/typescript.js +24 -239
- package/plugins/typescript.mjs +24 -239
- package/plugins/yaml.d.ts +5 -0
- package/plugins/yaml.js +146 -133
- package/plugins/yaml.mjs +146 -133
- package/standalone.d.ts +33 -0
- package/standalone.js +35 -105
- package/standalone.mjs +35 -105
- package/internal/third-party.mjs +0 -9071
- package/plugins/acorn-and-espree.js +0 -13
- package/plugins/acorn-and-espree.mjs +0 -13
package/plugins/graphql.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
(function(f){function e(){var i=f();return i.default||i}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.graphql=e()}})(function(){"use strict";var se=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var rt=Object.getOwnPropertyNames;var st=Object.prototype.hasOwnProperty;var oe=(e,t)=>{for(var n in t)se(e,n,{get:t[n],enumerable:!0})},ot=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rt(t))!st.call(e,i)&&i!==n&&se(e,i,{get:()=>t[i],enumerable:!(r=it(t,i))||r.enumerable});return e};var at=e=>ot(se({},"__esModule",{value:!0}),e);var ln={};oe(ln,{default:()=>ie,languages:()=>xe,options:()=>_e,parsers:()=>j,printers:()=>nt});var ie={};oe(ie,{languages:()=>xe,options:()=>_e,parsers:()=>j,printers:()=>nt});var ct=(e,t,n,r)=>{if(!(e&&t==null))return t.replaceAll?t.replaceAll(n,r):n.global?t.replace(n,r):t.split(n).join(r)},$=ct;var ae="indent";var ce="group";var ue="if-break";var F="line";var le="break-parent";var ye=()=>{},b=ye,pe=ye;function x(e){return b(e),{type:ae,contents:e}}function y(e,t={}){return b(e),pe(t.expandedStates,!0),{type:ce,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function O(e,t="",n={}){return b(e),t!==""&&b(t),{type:ue,breakContents:e,flatContents:t,groupId:n.groupId}}var yt={type:le};var It={type:F,hard:!0};var k={type:F},p={type:F,soft:!0},f=[It,yt];function E(e,t){b(e),pe(t);let n=[];for(let r=0;r<t.length;r++)r!==0&&n.push(e),n.push(t[r]);return n}function Ot(e,t,n){let r=!!(n!=null&&n.backwards);if(t===!1)return!1;let i=e.charAt(t);if(r){if(e.charAt(t-1)==="\r"&&i===`
|
|
2
|
+
`)return t-2;if(i===`
|
|
3
|
+
`||i==="\r"||i==="\u2028"||i==="\u2029")return t-1}else{if(i==="\r"&&e.charAt(t+1)===`
|
|
4
|
+
`)return t+2;if(i===`
|
|
5
|
+
`||i==="\r"||i==="\u2028"||i==="\u2029")return t+1}return t}var G=Ot;function J(e){return(t,n,r)=>{let i=!!(r!=null&&r.backwards);if(n===!1)return!1;let{length:s}=t,a=n;for(;a>=0&&a<s;){let u=t.charAt(a);if(e instanceof RegExp){if(!e.test(u))return a}else if(!e.includes(u))return a;i?a--:a++}return a===-1||a===s?a:!1}}var bn=J(/\s/),X=J(" "),Ie=J(",; "),Oe=J(/[^\n\r]/);function Dt(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let n=t+2;n<e.length;++n)if(e.charAt(n)==="*"&&e.charAt(n+1)==="/")return n+2}return t}var De=Dt;function At(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?Oe(e,t):t}var Ae=At;function gt(e,t,n={}){let r=X(e,n.backwards?t-1:t,n),i=G(e,r,n);return r!==i}var ge=gt;function kt(e,t){let n=null,r=t;for(;r!==n;)n=r,r=Ie(e,r),r=De(e,r),r=X(e,r);return r=Ae(e,r),r=G(e,r),r!==!1&&ge(e,r)}var ke=kt;function Ct(e){return Array.isArray(e)&&e.length>0}var fe=Ct;var he=class extends Error{name="UnexpectedNodeError";constructor(t,n,r="type"){super(`Unexpected ${n} node ${r}: ${JSON.stringify(t[r])}.`),this.node=t}},Ce=he;function Se(e){return/^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/.test(e)}function ve(e){return`# @format
|
|
4
6
|
|
|
5
|
-
`+
|
|
7
|
+
`+e}function q(e){return e.kind==="Comment"?e.start:e.loc.start}function Q(e){return e.kind==="Comment"?e.end:e.loc.end}var w=null;function V(e){if(w!==null&&typeof w.property){let t=w;return w=V.prototype=null,t}return w=V.prototype=e??Object.create(null),new V}var St=10;for(let e=0;e<=St;e++)V();function de(e){return V(e)}function vt(e,t="type"){de(e);function n(r){let i=r[t],s=e[i];if(!Array.isArray(s))throw Object.assign(new Error(`Missing visitor keys for '${i}'.`),{node:r});return s}return n}var be=vt;var W=class{constructor(t,n,r){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},B=class{constructor(t,n,r,i,s,a){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=a,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}}},H={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"]},Kn=new Set(Object.keys(H));var C;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(C||(C={}));var bt=be(H,"kind"),Le=bt;function Lt(e,t,n){let{node:r}=e;if(!r.description)return"";let i=[n("description")];return r.kind==="InputValueDefinition"&&!r.description.block?i.push(k):i.push(f),i}var A=Lt;function Rt(e,t,n){let{node:r}=e;switch(r.kind){case"Document":return[...E(f,g(e,t,n,"definitions")),f];case"OperationDefinition":{let i=t.originalText[q(r)]!=="{",s=!!r.name;return[i?r.operation:"",i&&s?[" ",n("name")]:"",i&&!s&&fe(r.variableDefinitions)?" ":"",Re(e,n),_(e,n,r),!i&&!s?"":" ",n("selectionSet")]}case"FragmentDefinition":return["fragment ",n("name"),Re(e,n)," on ",n("typeCondition"),_(e,n,r)," ",n("selectionSet")];case"SelectionSet":return["{",x([f,E(f,g(e,t,n,"selections"))]),f,"}"];case"Field":return y([r.alias?[n("alias"),": "]:"",n("name"),r.arguments.length>0?y(["(",x([p,E([O("",", "),p],g(e,t,n,"arguments"))]),p,")"]):"",_(e,n,r),r.selectionSet?" ":"",n("selectionSet")]);case"Name":return r.value;case"StringValue":if(r.block){let i=$(!1,r.value,'"""','\\"""').split(`
|
|
8
|
+
`);return i.length===1&&(i[0]=i[0].trim()),i.every(s=>s==="")&&(i.length=0),E(f,['"""',...i,'"""'])}return['"',$(!1,$(!1,r.value,/["\\]/g,"\\$&"),`
|
|
9
|
+
`,"\\n"),'"'];case"IntValue":case"FloatValue":case"EnumValue":return r.value;case"BooleanValue":return r.value?"true":"false";case"NullValue":return"null";case"Variable":return["$",n("name")];case"ListValue":return y(["[",x([p,E([O("",", "),p],e.map(n,"values"))]),p,"]"]);case"ObjectValue":{let i=t.bracketSpacing&&r.fields.length>0?" ":"";return y(["{",i,x([p,E([O("",", "),p],e.map(n,"fields"))]),p,O("",i),"}"])}case"ObjectField":case"Argument":return[n("name"),": ",n("value")];case"Directive":return["@",n("name"),r.arguments.length>0?y(["(",x([p,E([O("",", "),p],g(e,t,n,"arguments"))]),p,")"]):""];case"NamedType":return n("name");case"VariableDefinition":return[n("variable"),": ",n("type"),r.defaultValue?[" = ",n("defaultValue")]:"",_(e,n,r)];case"ObjectTypeExtension":case"ObjectTypeDefinition":case"InputObjectTypeExtension":case"InputObjectTypeDefinition":case"InterfaceTypeExtension":case"InterfaceTypeDefinition":{let{kind:i}=r,s=[];return i.endsWith("TypeDefinition")?s.push(A(e,t,n)):s.push("extend "),i.startsWith("ObjectType")?s.push("type"):i.startsWith("InputObjectType")?s.push("input"):s.push("interface"),s.push(" ",n("name")),!i.startsWith("InputObjectType")&&r.interfaces.length>0&&s.push(" implements ",...wt(e,t,n)),s.push(_(e,n,r)),r.fields.length>0&&s.push([" {",x([f,E(f,g(e,t,n,"fields"))]),f,"}"]),s}case"FieldDefinition":return[A(e,t,n),n("name"),r.arguments.length>0?y(["(",x([p,E([O("",", "),p],g(e,t,n,"arguments"))]),p,")"]):"",": ",n("type"),_(e,n,r)];case"DirectiveDefinition":return[A(e,t,n),"directive ","@",n("name"),r.arguments.length>0?y(["(",x([p,E([O("",", "),p],g(e,t,n,"arguments"))]),p,")"]):"",r.repeatable?" repeatable":""," on ",...E(" | ",e.map(n,"locations"))];case"EnumTypeExtension":case"EnumTypeDefinition":return[A(e,t,n),r.kind==="EnumTypeExtension"?"extend ":"","enum ",n("name"),_(e,n,r),r.values.length>0?[" {",x([f,E(f,g(e,t,n,"values"))]),f,"}"]:""];case"EnumValueDefinition":return[A(e,t,n),n("name"),_(e,n,r)];case"InputValueDefinition":return[A(e,t,n),n("name"),": ",n("type"),r.defaultValue?[" = ",n("defaultValue")]:"",_(e,n,r)];case"SchemaExtension":return["extend schema",_(e,n,r),...r.operationTypes.length>0?[" {",x([f,E(f,g(e,t,n,"operationTypes"))]),f,"}"]:[]];case"SchemaDefinition":return[A(e,t,n),"schema",_(e,n,r)," {",r.operationTypes.length>0?x([f,E(f,g(e,t,n,"operationTypes"))]):"",f,"}"];case"OperationTypeDefinition":return[r.operation,": ",n("type")];case"FragmentSpread":return["...",n("name"),_(e,n,r)];case"InlineFragment":return["...",r.typeCondition?[" on ",n("typeCondition")]:"",_(e,n,r)," ",n("selectionSet")];case"UnionTypeExtension":case"UnionTypeDefinition":return y([A(e,t,n),y([r.kind==="UnionTypeExtension"?"extend ":"","union ",n("name"),_(e,n,r),r.types.length>0?[" =",O(""," "),x([O([k," "]),E([k,"| "],e.map(n,"types"))])]:""])]);case"ScalarTypeExtension":case"ScalarTypeDefinition":return[A(e,t,n),r.kind==="ScalarTypeExtension"?"extend ":"","scalar ",n("name"),_(e,n,r)];case"NonNullType":return[n("type"),"!"];case"ListType":return["[",n("type"),"]"];default:throw new Ce(r,"Graphql","kind")}}function _(e,t,n){if(n.directives.length===0)return"";let r=E(k,e.map(t,"directives"));return n.kind==="FragmentDefinition"||n.kind==="OperationDefinition"?y([k,r]):[" ",y(x([p,r]))]}function g(e,t,n,r){return e.map(({isLast:i,node:s})=>{let a=n();return!i&&ke(t.originalText,Q(s))?[a,f]:a},r)}function Pt(e){return e.kind!=="Comment"}function Ft(e){let t=e.node;if(t.kind==="Comment")return"#"+t.value.trimEnd();throw new Error("Not a comment: "+JSON.stringify(t))}function wt(e,t,n){let{node:r}=e,i=[],{interfaces:s}=r,a=e.map(n,"interfaces");for(let u=0;u<s.length;u++){let l=s[u];i.push(a[u]);let T=s[u+1];if(T){let D=t.originalText.slice(l.loc.end,T.loc.start).includes("#");i.push(" &",D?k:" ")}}return i}function Re(e,t){let{node:n}=e;return fe(n.variableDefinitions)?y(["(",x([p,E([O("",", "),p],e.map(t,"variableDefinitions"))]),p,")"]):""}function Pe(e,t){e.kind==="StringValue"&&e.block&&!e.value.includes(`
|
|
10
|
+
`)&&(t.value=t.value.trim())}Pe.ignoredProperties=new Set(["loc","comments"]);function Vt(e){var n;let{node:t}=e;return(n=t==null?void 0:t.comments)==null?void 0:n.some(r=>r.value.trim()==="prettier-ignore")}var Bt={print:Rt,massageAstNode:Pe,hasPrettierIgnore:Vt,insertPragma:ve,printComment:Ft,canAttachComment:Pt,getVisitorKeys:Le},Fe=Bt;var j={};oe(j,{graphql:()=>cn});function we(e){return typeof e=="object"&&e!==null}function Ve(e,t){if(!!!e)throw new Error(t??"Unexpected invariant triggered.")}var Ut=/\r\n|[\n\r]/g;function U(e,t){let n=0,r=1;for(let i of e.body.matchAll(Ut)){if(typeof i.index=="number"||Ve(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function Ue(e){return me(e.source,U(e.source,e.start))}function me(e,t){let n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,a=t.line+s,u=t.line===1?n:0,l=t.column+u,T=`${e.name}:${a}:${l}
|
|
11
|
+
`,h=r.split(/\r\n|[\n\r]/g),D=h[i];if(D.length>120){let I=Math.floor(l/80),re=l%80,N=[];for(let v=0;v<D.length;v+=80)N.push(D.slice(v,v+80));return T+Be([[`${a} |`,N[0]],...N.slice(1,I+1).map(v=>["|",v]),["|","^".padStart(re)],["|",N[I+1]]])}return T+Be([[`${a-1} |`,h[i-1]],[`${a} |`,D],["|","^".padStart(l)],[`${a+1} |`,h[i+1]]])}function Be(e){let t=e.filter(([r,i])=>i!==void 0),n=Math.max(...t.map(([r])=>r.length));return t.map(([r,i])=>r.padStart(n)+(i?" "+i:"")).join(`
|
|
12
|
+
`)}function Mt(e){let t=e[0];return t==null||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}var L=class extends Error{constructor(t,...n){var r,i,s;let{nodes:a,source:u,positions:l,path:T,originalError:h,extensions:D}=Mt(n);super(t),this.name="GraphQLError",this.path=T??void 0,this.originalError=h??void 0,this.nodes=Me(Array.isArray(a)?a:a?[a]:void 0);let I=Me((r=this.nodes)===null||r===void 0?void 0:r.map(N=>N.loc).filter(N=>N!=null));this.source=u??(I==null||(i=I[0])===null||i===void 0?void 0:i.source),this.positions=l??(I==null?void 0:I.map(N=>N.start)),this.locations=l&&u?l.map(N=>U(u,N)):I==null?void 0:I.map(N=>U(N.source,N.start));let re=we(h==null?void 0:h.extensions)?h==null?void 0:h.extensions:void 0;this.extensions=(s=D??re)!==null&&s!==void 0?s: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}}),h!=null&&h.stack?Object.defineProperty(this,"stack",{value:h.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,L):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(let n of this.nodes)n.loc&&(t+=`
|
|
6
13
|
|
|
7
|
-
`+$(this.source,n);return t}toJSON(){let t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}}});function d(e,t,n){return new D(`Syntax Error: ${n}`,{source:e,positions:[t]})}var Y=m(()=>{u();ce()});var R,g,Ve,Vt,_,G=m(()=>{u();R=class{constructor(t,n,s){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=s}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},g=class{constructor(t,n,s,i,o,a){this.kind=t,this.start=n,this.end=s,this.line=i,this.column=o,this.value=a,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}}},Ve={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"]},Vt=new Set(Object.keys(Ve));(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(_||(_={}))});var b,ue=m(()=>{u();(function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(b||(b={}))});var c,pe=m(()=>{u();(function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(c||(c={}))});function le(e){return e===9||e===32}function S(e){return e>=48&&e<=57}function he(e){return e>=97&&e<=122||e>=65&&e<=90}function J(e){return he(e)||e===95}function de(e){return he(e)||S(e)||e===95}var X=m(()=>{u()});function fe(e){var t;let n=Number.MAX_SAFE_INTEGER,s=null,i=-1;for(let a=0;a<e.length;++a){var o;let p=e[a],l=Be(p);l!==p.length&&(s=(o=s)!==null&&o!==void 0?o:a,i=a,a!==0&&l<n&&(n=l))}return e.map((a,p)=>p===0?a:a.slice(n)).slice((t=s)!==null&&t!==void 0?t:0,i+1)}function Be(e){let t=0;for(;t<e.length&&le(e.charCodeAt(t));)++t;return t}var Ee=m(()=>{u();X()});var r,Q=m(()=>{u();(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"})(r||(r={}))});function Ne(e){return e===r.BANG||e===r.DOLLAR||e===r.AMP||e===r.PAREN_L||e===r.PAREN_R||e===r.SPREAD||e===r.COLON||e===r.EQUALS||e===r.AT||e===r.BRACKET_L||e===r.BRACKET_R||e===r.BRACE_L||e===r.PIPE||e===r.BRACE_R}function v(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function w(e,t){return Te(e.charCodeAt(t))&&xe(e.charCodeAt(t+1))}function Te(e){return e>=55296&&e<=56319}function xe(e){return e>=56320&&e<=57343}function O(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return r.EOF;if(n>=32&&n<=126){let s=String.fromCodePoint(n);return s==='"'?`'"'`:`"${s}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function f(e,t,n,s,i){let o=e.line,a=1+n-e.lineStart;return new g(t,n,s,o,a,i)}function je(e,t){let n=e.source.body,s=n.length,i=t;for(;i<s;){let o=n.charCodeAt(i);switch(o){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return $e(e,i);case 33:return f(e,r.BANG,i,i+1);case 36:return f(e,r.DOLLAR,i,i+1);case 38:return f(e,r.AMP,i,i+1);case 40:return f(e,r.PAREN_L,i,i+1);case 41:return f(e,r.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return f(e,r.SPREAD,i,i+3);break;case 58:return f(e,r.COLON,i,i+1);case 61:return f(e,r.EQUALS,i,i+1);case 64:return f(e,r.AT,i,i+1);case 91:return f(e,r.BRACKET_L,i,i+1);case 93:return f(e,r.BRACKET_R,i,i+1);case 123:return f(e,r.BRACE_L,i,i+1);case 124:return f(e,r.PIPE,i,i+1);case 125:return f(e,r.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?qe(e,i):Ge(e,i)}if(S(o)||o===45)return Ye(e,i,o);if(J(o))return ze(e,i);throw d(e.source,i,o===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:v(o)||w(n,i)?`Unexpected character: ${O(e,i)}.`:`Invalid character: ${O(e,i)}.`)}return f(e,r.EOF,s,s)}function $e(e,t){let n=e.source.body,s=n.length,i=t+1;for(;i<s;){let o=n.charCodeAt(i);if(o===10||o===13)break;if(v(o))++i;else if(w(n,i))i+=2;else break}return f(e,r.COMMENT,t,i,n.slice(t+1,i))}function Ye(e,t,n){let s=e.source.body,i=t,o=n,a=!1;if(o===45&&(o=s.charCodeAt(++i)),o===48){if(o=s.charCodeAt(++i),S(o))throw d(e.source,i,`Invalid number, unexpected digit after 0: ${O(e,i)}.`)}else i=q(e,i,o),o=s.charCodeAt(i);if(o===46&&(a=!0,o=s.charCodeAt(++i),i=q(e,i,o),o=s.charCodeAt(i)),(o===69||o===101)&&(a=!0,o=s.charCodeAt(++i),(o===43||o===45)&&(o=s.charCodeAt(++i)),i=q(e,i,o),o=s.charCodeAt(i)),o===46||J(o))throw d(e.source,i,`Invalid number, expected digit but got: ${O(e,i)}.`);return f(e,a?r.FLOAT:r.INT,t,i,s.slice(t,i))}function q(e,t,n){if(!S(n))throw d(e.source,t,`Invalid number, expected digit but got: ${O(e,t)}.`);let s=e.source.body,i=t+1;for(;S(s.charCodeAt(i));)++i;return i}function Ge(e,t){let n=e.source.body,s=n.length,i=t+1,o=i,a="";for(;i<s;){let p=n.charCodeAt(i);if(p===34)return a+=n.slice(o,i),f(e,r.STRING,t,i+1,a);if(p===92){a+=n.slice(o,i);let l=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?Je(e,i):Xe(e,i):Qe(e,i);a+=l.value,i+=l.size,o=i;continue}if(p===10||p===13)break;if(v(p))++i;else if(w(n,i))i+=2;else throw d(e.source,i,`Invalid character within String: ${O(e,i)}.`)}throw d(e.source,i,"Unterminated string.")}function Je(e,t){let n=e.source.body,s=0,i=3;for(;i<12;){let o=n.charCodeAt(t+i++);if(o===125){if(i<5||!v(s))break;return{value:String.fromCodePoint(s),size:i}}if(s=s<<4|C(o),s<0)break}throw d(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function Xe(e,t){let n=e.source.body,s=me(n,t+2);if(v(s))return{value:String.fromCodePoint(s),size:6};if(Te(s)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let i=me(n,t+8);if(xe(i))return{value:String.fromCodePoint(s,i),size:12}}throw d(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function me(e,t){return C(e.charCodeAt(t))<<12|C(e.charCodeAt(t+1))<<8|C(e.charCodeAt(t+2))<<4|C(e.charCodeAt(t+3))}function C(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Qe(e,t){let n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:`
|
|
8
|
-
|
|
9
|
-
`));return e.line+=l.length-1,e.lineStart=i,E}if(T===92&&n.charCodeAt(o+1)===34&&n.charCodeAt(o+2)===34&&n.charCodeAt(o+3)===34){p+=n.slice(a,o),a=o+1,o+=4;continue}if(T===10||T===13){p+=n.slice(a,o),l.push(p),T===13&&n.charCodeAt(o+1)===10?o+=2:++o,p="",a=o,i=o;continue}if(v(T))++o;else if(w(n,o))o+=2;else throw d(e.source,o,`Invalid character within String: ${O(e,o)}.`)}throw d(e.source,o,"Unterminated string.")}function ze(e,t){let n=e.source.body,s=n.length,i=t+1;for(;i<s;){let o=n.charCodeAt(i);if(de(o))++i;else break}return f(e,r.NAME,t,i,n.slice(t,i))}var F,Ie=m(()=>{u();Y();G();Ee();X();Q();F=class{constructor(t){let n=new g(r.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==r.EOF)do if(t.next)t=t.next;else{let n=je(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===r.COMMENT);return t}}});function P(e,t){if(!Boolean(e))throw new Error(t)}var _e=m(()=>{u()});function Oe(e){return M(e,[])}function M(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return He(e,t);default:return String(e)}}function He(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";let n=[...t,e];if(We(e)){let s=e.toJSON();if(s!==e)return typeof s=="string"?s:M(s,n)}else if(Array.isArray(e))return Ke(e,n);return Ze(e,n)}function We(e){return typeof e.toJSON=="function"}function Ze(e,t){let n=Object.entries(e);if(n.length===0)return"{}";if(t.length>2)return"["+et(e)+"]";let s=n.map(([i,o])=>i+": "+M(o,t));return"{ "+s.join(", ")+" }"}function Ke(e,t){if(e.length===0)return"[]";if(t.length>2)return"[Array]";let n=Math.min(10,e.length),s=e.length-n,i=[];for(let o=0;o<n;++o)i.push(M(e[o],t));return s===1?i.push("... 1 more item"):s>1&&i.push(`... ${s} more items`),"["+i.join(", ")+"]"}function et(e){let t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){let n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}var Ae=m(()=>{u()});var ye,De=m(()=>{u();ye=function(t,n){return t instanceof n}});function Se(e){return ye(e,L)}var L,ve=m(()=>{u();_e();Ae();De();L=class{constructor(t,n="GraphQL request",s={line:1,column:1}){typeof t=="string"||P(!1,`Body must be a string. Received: ${Oe(t)}.`),this.body=t,this.name=n,this.locationOffset=s,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"}}});var ge={};z(ge,{Parser:()=>A,parse:()=>tt,parseConstValue:()=>it,parseType:()=>st,parseValue:()=>nt});function tt(e,t){return new A(e,t).parseDocument()}function nt(e,t){let n=new A(e,t);n.expectToken(r.SOF);let s=n.parseValueLiteral(!1);return n.expectToken(r.EOF),s}function it(e,t){let n=new A(e,t);n.expectToken(r.SOF);let s=n.parseConstValueLiteral();return n.expectToken(r.EOF),s}function st(e,t){let n=new A(e,t);n.expectToken(r.SOF);let s=n.parseTypeReference();return n.expectToken(r.EOF),s}function U(e){let t=e.value;return ke(e.kind)+(t!=null?` "${t}"`:"")}function ke(e){return Ne(e)?`"${e}"`:e}var A,Ce=m(()=>{u();Y();G();ue();pe();Ie();ve();Q();A=class{constructor(t,n={}){let s=Se(t)?t:new L(t);this._lexer=new F(s),this._options=n,this._tokenCounter=0}parseName(){let t=this.expectToken(r.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(r.SOF,this.parseDefinition,r.EOF)})}parseDefinition(){if(this.peek(r.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===r.NAME){switch(n.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(t)throw d(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(r.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:_.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let n=this.parseOperationType(),s;return this.peek(r.NAME)&&(s=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:n,name:s,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(r.NAME);switch(t.value){case"query":return _.QUERY;case"mutation":return _.MUTATION;case"subscription":return _.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(r.PAREN_L,this.parseVariableDefinition,r.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(r.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(r.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(r.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this.many(r.BRACE_L,this.parseSelection,r.BRACE_R)})}parseSelection(){return this.peek(r.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),s,i;return this.expectOptionalToken(r.COLON)?(s=n,i=this.parseName()):i=n,this.node(t,{kind:c.FIELD,alias:s,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(r.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(r.PAREN_L,n,r.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,s=this.parseName();return this.expectToken(r.COLON),this.node(n,{kind:c.ARGUMENT,name:s,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let t=this._lexer.token;this.expectToken(r.SPREAD);let n=this.expectOptionalKeyword("on");return!n&&this.peek(r.NAME)?this.node(t,{kind:c.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.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(t){let n=this._lexer.token;switch(n.kind){case r.BRACKET_L:return this.parseList(t);case r.BRACE_L:return this.parseObject(t);case r.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case r.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case r.STRING:case r.BLOCK_STRING:return this.parseStringLiteral();case r.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case r.DOLLAR:if(t)if(this.expectToken(r.DOLLAR),this._lexer.token.kind===r.NAME){let s=this._lexer.token.value;throw d(this._lexer.source,n.start,`Unexpected variable "$${s}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===r.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(r.BRACKET_L,n,r.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(r.BRACE_L,n,r.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,s=this.parseName();return this.expectToken(r.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:s,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(r.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(r.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(r.BRACKET_L)){let s=this.parseTypeReference();this.expectToken(r.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:s})}else n=this.parseNamedType();return this.expectOptionalToken(r.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(r.STRING)||this.peek(r.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let s=this.parseConstDirectives(),i=this.many(r.BRACE_L,this.parseOperationTypeDefinition,r.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:s,operationTypes:i})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(r.COLON);let s=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:s})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let s=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:s,directives:i})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let s=this.parseName(),i=this.parseImplementsInterfaces(),o=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:s,interfaces:i,directives:o,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(r.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(r.BRACE_L,this.parseFieldDefinition,r.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),s=this.parseName(),i=this.parseArgumentDefs();this.expectToken(r.COLON);let o=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:s,arguments:i,type:o,directives:a})}parseArgumentDefs(){return this.optionalMany(r.PAREN_L,this.parseInputValueDef,r.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),s=this.parseName();this.expectToken(r.COLON);let i=this.parseTypeReference(),o;this.expectOptionalToken(r.EQUALS)&&(o=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:s,type:i,defaultValue:o,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let s=this.parseName(),i=this.parseImplementsInterfaces(),o=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:s,interfaces:i,directives:o,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let s=this.parseName(),i=this.parseConstDirectives(),o=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:s,directives:i,types:o})}parseUnionMemberTypes(){return this.expectOptionalToken(r.EQUALS)?this.delimitedMany(r.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let s=this.parseName(),i=this.parseConstDirectives(),o=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:s,directives:i,values:o})}parseEnumValuesDefinition(){return this.optionalMany(r.BRACE_L,this.parseEnumValueDefinition,r.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),s=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:s,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw d(this._lexer.source,this._lexer.token.start,`${U(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let s=this.parseName(),i=this.parseConstDirectives(),o=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:s,directives:i,fields:o})}parseInputFieldsDefinition(){return this.optionalMany(r.BRACE_L,this.parseInputValueDef,r.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===r.NAME)switch(t.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(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),s=this.optionalMany(r.BRACE_L,this.parseOperationTypeDefinition,r.BRACE_R);if(n.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:s})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),s=this.parseConstDirectives();if(s.length===0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:s})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),s=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();if(s.length===0&&i.length===0&&o.length===0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:s,directives:i,fields:o})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),s=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();if(s.length===0&&i.length===0&&o.length===0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:s,directives:i,fields:o})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),s=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(s.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:s,types:i})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),s=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(s.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:s,values:i})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),s=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(s.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:s,fields:i})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(r.AT);let s=this.parseName(),i=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let a=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:s,arguments:i,repeatable:o,locations:a})}parseDirectiveLocations(){return this.delimitedMany(r.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(b,n.value))return n;throw this.unexpected(t)}node(t,n){return this._options.noLocation!==!0&&(n.loc=new R(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw d(this._lexer.source,n.start,`Expected ${ke(t)}, found ${U(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===r.NAME&&n.value===t)this.advanceLexer();else throw d(this._lexer.source,n.start,`Expected "${t}", found ${U(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===r.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t!=null?t:this._lexer.token;return d(this._lexer.source,n.start,`Unexpected ${U(n)}.`)}any(t,n,s){this.expectToken(t);let i=[];for(;!this.expectOptionalToken(s);)i.push(n.call(this));return i}optionalMany(t,n,s){if(this.expectOptionalToken(t)){let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(s));return i}return[]}many(t,n,s){this.expectToken(t);let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(s));return i}delimitedMany(t,n){this.expectOptionalToken(t);let s=[];do s.push(n.call(this));while(this.expectOptionalToken(t));return s}advanceLexer(){let{maxTokens:t}=this._options,n=this._lexer.advance();if(t!==void 0&&n.kind!==r.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw d(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}});var lt={};z(lt,{default:()=>pt});u();u();function Pe(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var H=Pe;u();function W(e){return/^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/.test(e)}u();function Z(e){return e.kind==="Comment"?e.start:e.loc.start}function K(e){return e.kind==="Comment"?e.end:e.loc.end}function rt(e){let t=[],{startToken:n,endToken:s}=e.loc;for(let i=n;i!==s;i=i.next)i.kind==="Comment"&&t.push(i);return t}var ot={allowLegacyFragmentVariables:!0};function at(e){if((e==null?void 0:e.name)==="GraphQLError"){let{message:t,locations:[n]}=e;return H(t,{loc:{start:n},cause:e})}return e}async function ct(e){let{parse:t}=await Promise.resolve().then(()=>(Ce(),ge)),n;try{n=t(e,ot)}catch(s){throw at(s)}return n.comments=rt(n),n}var ut={parsers:{graphql:{parse:ct,astFormat:"graphql",hasPragma:W,locStart:Z,locEnd:K}}},pt=ut;return we(lt);});
|
|
14
|
+
`+Ue(n.loc));else if(this.source&&this.locations)for(let n of this.locations)t+=`
|
|
15
|
+
|
|
16
|
+
`+me(this.source,n);return t}toJSON(){let t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}};function Me(e){return e===void 0||e.length===0?void 0:e}function d(e,t,n){return new L(`Syntax Error: ${n}`,{source:e,positions:[t]})}var z;(function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(z||(z={}));var c;(function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(c||(c={}));function Ye(e){return e===9||e===32}function R(e){return e>=48&&e<=57}function je(e){return e>=97&&e<=122||e>=65&&e<=90}function Ee(e){return je(e)||e===95}function $e(e){return je(e)||R(e)||e===95}function Ge(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let a=0;a<e.length;++a){var s;let u=e[a],l=Yt(u);l!==u.length&&(r=(s=r)!==null&&s!==void 0?s:a,i=a,a!==0&&l<n&&(n=l))}return e.map((a,u)=>u===0?a:a.slice(n)).slice((t=r)!==null&&t!==void 0?t:0,i+1)}function Yt(e){let t=0;for(;t<e.length&&Ye(e.charCodeAt(t));)++t;return t}var o;(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"})(o||(o={}));var K=class{constructor(t){let n=new B(o.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==o.EOF)do if(t.next)t=t.next;else{let n=jt(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===o.COMMENT);return t}};function Xe(e){return e===o.BANG||e===o.DOLLAR||e===o.AMP||e===o.PAREN_L||e===o.PAREN_R||e===o.SPREAD||e===o.COLON||e===o.EQUALS||e===o.AT||e===o.BRACKET_L||e===o.BRACKET_R||e===o.BRACE_L||e===o.PIPE||e===o.BRACE_R}function P(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Z(e,t){return qe(e.charCodeAt(t))&&Qe(e.charCodeAt(t+1))}function qe(e){return e>=55296&&e<=56319}function Qe(e){return e>=56320&&e<=57343}function S(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return o.EOF;if(n>=32&&n<=126){let r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function m(e,t,n,r,i){let s=e.line,a=1+n-e.lineStart;return new B(t,n,r,s,a,i)}function jt(e,t){let n=e.source.body,r=n.length,i=t;for(;i<r;){let s=n.charCodeAt(i);switch(s){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return $t(e,i);case 33:return m(e,o.BANG,i,i+1);case 36:return m(e,o.DOLLAR,i,i+1);case 38:return m(e,o.AMP,i,i+1);case 40:return m(e,o.PAREN_L,i,i+1);case 41:return m(e,o.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return m(e,o.SPREAD,i,i+3);break;case 58:return m(e,o.COLON,i,i+1);case 61:return m(e,o.EQUALS,i,i+1);case 64:return m(e,o.AT,i,i+1);case 91:return m(e,o.BRACKET_L,i,i+1);case 93:return m(e,o.BRACKET_R,i,i+1);case 123:return m(e,o.BRACE_L,i,i+1);case 124:return m(e,o.PIPE,i,i+1);case 125:return m(e,o.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?Wt(e,i):Jt(e,i)}if(R(s)||s===45)return Gt(e,i,s);if(Ee(s))return Ht(e,i);throw d(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:P(s)||Z(n,i)?`Unexpected character: ${S(e,i)}.`:`Invalid character: ${S(e,i)}.`)}return m(e,o.EOF,r,r)}function $t(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(s===10||s===13)break;if(P(s))++i;else if(Z(n,i))i+=2;else break}return m(e,o.COMMENT,t,i,n.slice(t+1,i))}function Gt(e,t,n){let r=e.source.body,i=t,s=n,a=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),R(s))throw d(e.source,i,`Invalid number, unexpected digit after 0: ${S(e,i)}.`)}else i=Te(e,i,s),s=r.charCodeAt(i);if(s===46&&(a=!0,s=r.charCodeAt(++i),i=Te(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(a=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=Te(e,i,s),s=r.charCodeAt(i)),s===46||Ee(s))throw d(e.source,i,`Invalid number, expected digit but got: ${S(e,i)}.`);return m(e,a?o.FLOAT:o.INT,t,i,r.slice(t,i))}function Te(e,t,n){if(!R(n))throw d(e.source,t,`Invalid number, expected digit but got: ${S(e,t)}.`);let r=e.source.body,i=t+1;for(;R(r.charCodeAt(i));)++i;return i}function Jt(e,t){let n=e.source.body,r=n.length,i=t+1,s=i,a="";for(;i<r;){let u=n.charCodeAt(i);if(u===34)return a+=n.slice(s,i),m(e,o.STRING,t,i+1,a);if(u===92){a+=n.slice(s,i);let l=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?Xt(e,i):qt(e,i):Qt(e,i);a+=l.value,i+=l.size,s=i;continue}if(u===10||u===13)break;if(P(u))++i;else if(Z(n,i))i+=2;else throw d(e.source,i,`Invalid character within String: ${S(e,i)}.`)}throw d(e.source,i,"Unterminated string.")}function Xt(e,t){let n=e.source.body,r=0,i=3;for(;i<12;){let s=n.charCodeAt(t+i++);if(s===125){if(i<5||!P(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|M(s),r<0)break}throw d(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function qt(e,t){let n=e.source.body,r=Je(n,t+2);if(P(r))return{value:String.fromCodePoint(r),size:6};if(qe(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let i=Je(n,t+8);if(Qe(i))return{value:String.fromCodePoint(r,i),size:12}}throw d(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function Je(e,t){return M(e.charCodeAt(t))<<12|M(e.charCodeAt(t+1))<<8|M(e.charCodeAt(t+2))<<4|M(e.charCodeAt(t+3))}function M(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Qt(e,t){let n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:`
|
|
17
|
+
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw d(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function Wt(e,t){let n=e.source.body,r=n.length,i=e.lineStart,s=t+3,a=s,u="",l=[];for(;s<r;){let T=n.charCodeAt(s);if(T===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){u+=n.slice(a,s),l.push(u);let h=m(e,o.BLOCK_STRING,t,s+3,Ge(l).join(`
|
|
18
|
+
`));return e.line+=l.length-1,e.lineStart=i,h}if(T===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){u+=n.slice(a,s),a=s+1,s+=4;continue}if(T===10||T===13){u+=n.slice(a,s),l.push(u),T===13&&n.charCodeAt(s+1)===10?s+=2:++s,u="",a=s,i=s;continue}if(P(T))++s;else if(Z(n,s))s+=2;else throw d(e.source,s,`Invalid character within String: ${S(e,s)}.`)}throw d(e.source,s,"Unterminated string.")}function Ht(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if($e(s))++i;else break}return m(e,o.NAME,t,i,n.slice(t,i))}function ee(e,t){if(!!!e)throw new Error(t)}function We(e){return te(e,[])}function te(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return zt(e,t);default:return String(e)}}function zt(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";let n=[...t,e];if(Kt(e)){let r=e.toJSON();if(r!==e)return typeof r=="string"?r:te(r,n)}else if(Array.isArray(e))return en(e,n);return Zt(e,n)}function Kt(e){return typeof e.toJSON=="function"}function Zt(e,t){let n=Object.entries(e);return n.length===0?"{}":t.length>2?"["+tn(e)+"]":"{ "+n.map(([i,s])=>i+": "+te(s,t)).join(", ")+" }"}function en(e,t){if(e.length===0)return"[]";if(t.length>2)return"[Array]";let n=Math.min(10,e.length),r=e.length-n,i=[];for(let s=0;s<n;++s)i.push(te(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function tn(e){let t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){let n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}var He=function(t,n){return t instanceof n};var Y=class{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||ee(!1,`Body must be a string. Received: ${We(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||ee(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ee(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function ze(e){return He(e,Y)}function Ke(e,t){return new Ne(e,t).parseDocument()}var Ne=class{constructor(t,n={}){let r=ze(t)?t:new Y(t);this._lexer=new K(r),this._options=n,this._tokenCounter=0}parseName(){let t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===o.NAME){switch(n.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(t)throw d(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:C.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let n=this.parseOperationType(),r;return this.peek(o.NAME)&&(r=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(o.NAME);switch(t.value){case"query":return C.QUERY;case"mutation":return C.MUTATION;case"subscription":return C.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this.many(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),r,i;return this.expectOptionalToken(o.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:c.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let t=this._lexer.token;this.expectToken(o.SPREAD);let n=this.expectOptionalKeyword("on");return!n&&this.peek(o.NAME)?this.node(t,{kind:c.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.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(t){let n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){let r=this._lexer.token.value;throw d(this._lexer.source,n.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(o.BRACKET_L)){let r=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let r=this.parseConstDirectives(),i=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);let r=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(o.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(o.COLON);let s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(o.COLON);let i=this.parseTypeReference(),s;this.expectOptionalToken(o.EQUALS)&&(s=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw d(this._lexer.source,this._lexer.token.start,`${ne(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===o.NAME)switch(t.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(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),r=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.AT);let r=this.parseName(),i=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let a=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(z,n.value))return n;throw this.unexpected(t)}node(t,n){return this._options.noLocation!==!0&&(n.loc=new W(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw d(this._lexer.source,n.start,`Expected ${Ze(t)}, found ${ne(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw d(this._lexer.source,n.start,`Expected "${t}", found ${ne(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t??this._lexer.token;return d(this._lexer.source,n.start,`Unexpected ${ne(n)}.`)}any(t,n,r){this.expectToken(t);let i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}return[]}many(t,n,r){this.expectToken(t);let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);let r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){let{maxTokens:t}=this._options,n=this._lexer.advance();if(t!==void 0&&n.kind!==o.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw d(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}};function ne(e){let t=e.value;return Ze(e.kind)+(t!=null?` "${t}"`:"")}function Ze(e){return Xe(e)?`"${e}"`:e}function nn(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var et=nn;function rn(e){let t=[],{startToken:n,endToken:r}=e.loc;for(let i=n;i!==r;i=i.next)i.kind==="Comment"&&t.push(i);return t}var sn={allowLegacyFragmentVariables:!0};function on(e){if((e==null?void 0:e.name)==="GraphQLError"){let{message:t,locations:[n]}=e;return et(t,{loc:{start:n},cause:e})}return e}function an(e){let t;try{t=Ke(e,sn)}catch(n){throw on(n)}return t.comments=rn(t),t}var cn={parse:an,astFormat:"graphql",hasPragma:Se,locStart:q,locEnd:Q};var xe=[{linguistLanguageId:139,name:"GraphQL",type:"data",color:"#e10098",extensions:[".graphql",".gql",".graphqls"],tmScope:"source.graphql",aceMode:"text",parsers:["graphql"],vscodeLanguageIds:["graphql"]}];var tt={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}};var un={bracketSpacing:tt.bracketSpacing},_e=un;var nt={graphql:Fe};return at(ln);});
|
package/plugins/graphql.mjs
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var tt=Object.defineProperty;var Te=(e,t)=>{for(var n in t)tt(e,n,{get:t[n],enumerable:!0})};var Ee={};Te(Ee,{languages:()=>Ke,options:()=>et,parsers:()=>ne,printers:()=>rn});var nt=(e,t,n,r)=>{if(!(e&&t==null))return t.replaceAll?t.replaceAll(n,r):n.global?t.replace(n,r):t.split(n).join(r)},j=nt;var re="indent";var se="group";var oe="if-break";var F="line";var ae="break-parent";var Ne=()=>{},b=Ne,ce=Ne;function x(e){return b(e),{type:re,contents:e}}function y(e,t={}){return b(e),ce(t.expandedStates,!0),{type:se,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function O(e,t="",n={}){return b(e),t!==""&&b(t),{type:oe,breakContents:e,flatContents:t,groupId:n.groupId}}var mt={type:ae};var Et={type:F,hard:!0};var k={type:F},p={type:F,soft:!0},f=[Et,mt];function E(e,t){b(e),ce(t);let n=[];for(let r=0;r<t.length;r++)r!==0&&n.push(e),n.push(t[r]);return n}function Tt(e,t,n){let r=!!(n!=null&&n.backwards);if(t===!1)return!1;let i=e.charAt(t);if(r){if(e.charAt(t-1)==="\r"&&i===`
|
|
2
|
+
`)return t-2;if(i===`
|
|
3
|
+
`||i==="\r"||i==="\u2028"||i==="\u2029")return t-1}else{if(i==="\r"&&e.charAt(t+1)===`
|
|
4
|
+
`)return t+2;if(i===`
|
|
5
|
+
`||i==="\r"||i==="\u2028"||i==="\u2029")return t+1}return t}var $=Tt;function G(e){return(t,n,r)=>{let i=!!(r!=null&&r.backwards);if(n===!1)return!1;let{length:s}=t,a=n;for(;a>=0&&a<s;){let u=t.charAt(a);if(e instanceof RegExp){if(!e.test(u))return a}else if(!e.includes(u))return a;i?a--:a++}return a===-1||a===s?a:!1}}var An=G(/\s/),J=G(" "),xe=G(",; "),_e=G(/[^\n\r]/);function Nt(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let n=t+2;n<e.length;++n)if(e.charAt(n)==="*"&&e.charAt(n+1)==="/")return n+2}return t}var ye=Nt;function xt(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?_e(e,t):t}var Ie=xt;function _t(e,t,n={}){let r=J(e,n.backwards?t-1:t,n),i=$(e,r,n);return r!==i}var Oe=_t;function yt(e,t){let n=null,r=t;for(;r!==n;)n=r,r=xe(e,r),r=ye(e,r),r=J(e,r);return r=Ie(e,r),r=$(e,r),r!==!1&&Oe(e,r)}var De=yt;function It(e){return Array.isArray(e)&&e.length>0}var ue=It;var le=class extends Error{name="UnexpectedNodeError";constructor(t,n,r="type"){super(`Unexpected ${n} node ${r}: ${JSON.stringify(t[r])}.`),this.node=t}},Ae=le;function ge(e){return/^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/.test(e)}function ke(e){return`# @format
|
|
4
6
|
|
|
5
|
-
`+
|
|
7
|
+
`+e}function X(e){return e.kind==="Comment"?e.start:e.loc.start}function q(e){return e.kind==="Comment"?e.end:e.loc.end}var w=null;function V(e){if(w!==null&&typeof w.property){let t=w;return w=V.prototype=null,t}return w=V.prototype=e??Object.create(null),new V}var Ot=10;for(let e=0;e<=Ot;e++)V();function pe(e){return V(e)}function Dt(e,t="type"){pe(e);function n(r){let i=r[t],s=e[i];if(!Array.isArray(s))throw Object.assign(new Error(`Missing visitor keys for '${i}'.`),{node:r});return s}return n}var Ce=Dt;var Q=class{constructor(t,n,r){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},B=class{constructor(t,n,r,i,s,a){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=a,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}}},W={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"]},Xn=new Set(Object.keys(W));var C;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(C||(C={}));var At=Ce(W,"kind"),Se=At;function gt(e,t,n){let{node:r}=e;if(!r.description)return"";let i=[n("description")];return r.kind==="InputValueDefinition"&&!r.description.block?i.push(k):i.push(f),i}var A=gt;function kt(e,t,n){let{node:r}=e;switch(r.kind){case"Document":return[...E(f,g(e,t,n,"definitions")),f];case"OperationDefinition":{let i=t.originalText[X(r)]!=="{",s=!!r.name;return[i?r.operation:"",i&&s?[" ",n("name")]:"",i&&!s&&ue(r.variableDefinitions)?" ":"",ve(e,n),_(e,n,r),!i&&!s?"":" ",n("selectionSet")]}case"FragmentDefinition":return["fragment ",n("name"),ve(e,n)," on ",n("typeCondition"),_(e,n,r)," ",n("selectionSet")];case"SelectionSet":return["{",x([f,E(f,g(e,t,n,"selections"))]),f,"}"];case"Field":return y([r.alias?[n("alias"),": "]:"",n("name"),r.arguments.length>0?y(["(",x([p,E([O("",", "),p],g(e,t,n,"arguments"))]),p,")"]):"",_(e,n,r),r.selectionSet?" ":"",n("selectionSet")]);case"Name":return r.value;case"StringValue":if(r.block){let i=j(!1,r.value,'"""','\\"""').split(`
|
|
8
|
+
`);return i.length===1&&(i[0]=i[0].trim()),i.every(s=>s==="")&&(i.length=0),E(f,['"""',...i,'"""'])}return['"',j(!1,j(!1,r.value,/["\\]/g,"\\$&"),`
|
|
9
|
+
`,"\\n"),'"'];case"IntValue":case"FloatValue":case"EnumValue":return r.value;case"BooleanValue":return r.value?"true":"false";case"NullValue":return"null";case"Variable":return["$",n("name")];case"ListValue":return y(["[",x([p,E([O("",", "),p],e.map(n,"values"))]),p,"]"]);case"ObjectValue":{let i=t.bracketSpacing&&r.fields.length>0?" ":"";return y(["{",i,x([p,E([O("",", "),p],e.map(n,"fields"))]),p,O("",i),"}"])}case"ObjectField":case"Argument":return[n("name"),": ",n("value")];case"Directive":return["@",n("name"),r.arguments.length>0?y(["(",x([p,E([O("",", "),p],g(e,t,n,"arguments"))]),p,")"]):""];case"NamedType":return n("name");case"VariableDefinition":return[n("variable"),": ",n("type"),r.defaultValue?[" = ",n("defaultValue")]:"",_(e,n,r)];case"ObjectTypeExtension":case"ObjectTypeDefinition":case"InputObjectTypeExtension":case"InputObjectTypeDefinition":case"InterfaceTypeExtension":case"InterfaceTypeDefinition":{let{kind:i}=r,s=[];return i.endsWith("TypeDefinition")?s.push(A(e,t,n)):s.push("extend "),i.startsWith("ObjectType")?s.push("type"):i.startsWith("InputObjectType")?s.push("input"):s.push("interface"),s.push(" ",n("name")),!i.startsWith("InputObjectType")&&r.interfaces.length>0&&s.push(" implements ",...vt(e,t,n)),s.push(_(e,n,r)),r.fields.length>0&&s.push([" {",x([f,E(f,g(e,t,n,"fields"))]),f,"}"]),s}case"FieldDefinition":return[A(e,t,n),n("name"),r.arguments.length>0?y(["(",x([p,E([O("",", "),p],g(e,t,n,"arguments"))]),p,")"]):"",": ",n("type"),_(e,n,r)];case"DirectiveDefinition":return[A(e,t,n),"directive ","@",n("name"),r.arguments.length>0?y(["(",x([p,E([O("",", "),p],g(e,t,n,"arguments"))]),p,")"]):"",r.repeatable?" repeatable":""," on ",...E(" | ",e.map(n,"locations"))];case"EnumTypeExtension":case"EnumTypeDefinition":return[A(e,t,n),r.kind==="EnumTypeExtension"?"extend ":"","enum ",n("name"),_(e,n,r),r.values.length>0?[" {",x([f,E(f,g(e,t,n,"values"))]),f,"}"]:""];case"EnumValueDefinition":return[A(e,t,n),n("name"),_(e,n,r)];case"InputValueDefinition":return[A(e,t,n),n("name"),": ",n("type"),r.defaultValue?[" = ",n("defaultValue")]:"",_(e,n,r)];case"SchemaExtension":return["extend schema",_(e,n,r),...r.operationTypes.length>0?[" {",x([f,E(f,g(e,t,n,"operationTypes"))]),f,"}"]:[]];case"SchemaDefinition":return[A(e,t,n),"schema",_(e,n,r)," {",r.operationTypes.length>0?x([f,E(f,g(e,t,n,"operationTypes"))]):"",f,"}"];case"OperationTypeDefinition":return[r.operation,": ",n("type")];case"FragmentSpread":return["...",n("name"),_(e,n,r)];case"InlineFragment":return["...",r.typeCondition?[" on ",n("typeCondition")]:"",_(e,n,r)," ",n("selectionSet")];case"UnionTypeExtension":case"UnionTypeDefinition":return y([A(e,t,n),y([r.kind==="UnionTypeExtension"?"extend ":"","union ",n("name"),_(e,n,r),r.types.length>0?[" =",O(""," "),x([O([k," "]),E([k,"| "],e.map(n,"types"))])]:""])]);case"ScalarTypeExtension":case"ScalarTypeDefinition":return[A(e,t,n),r.kind==="ScalarTypeExtension"?"extend ":"","scalar ",n("name"),_(e,n,r)];case"NonNullType":return[n("type"),"!"];case"ListType":return["[",n("type"),"]"];default:throw new Ae(r,"Graphql","kind")}}function _(e,t,n){if(n.directives.length===0)return"";let r=E(k,e.map(t,"directives"));return n.kind==="FragmentDefinition"||n.kind==="OperationDefinition"?y([k,r]):[" ",y(x([p,r]))]}function g(e,t,n,r){return e.map(({isLast:i,node:s})=>{let a=n();return!i&&De(t.originalText,q(s))?[a,f]:a},r)}function Ct(e){return e.kind!=="Comment"}function St(e){let t=e.node;if(t.kind==="Comment")return"#"+t.value.trimEnd();throw new Error("Not a comment: "+JSON.stringify(t))}function vt(e,t,n){let{node:r}=e,i=[],{interfaces:s}=r,a=e.map(n,"interfaces");for(let u=0;u<s.length;u++){let l=s[u];i.push(a[u]);let T=s[u+1];if(T){let D=t.originalText.slice(l.loc.end,T.loc.start).includes("#");i.push(" &",D?k:" ")}}return i}function ve(e,t){let{node:n}=e;return ue(n.variableDefinitions)?y(["(",x([p,E([O("",", "),p],e.map(t,"variableDefinitions"))]),p,")"]):""}function be(e,t){e.kind==="StringValue"&&e.block&&!e.value.includes(`
|
|
10
|
+
`)&&(t.value=t.value.trim())}be.ignoredProperties=new Set(["loc","comments"]);function bt(e){var n;let{node:t}=e;return(n=t==null?void 0:t.comments)==null?void 0:n.some(r=>r.value.trim()==="prettier-ignore")}var Lt={print:kt,massageAstNode:be,hasPrettierIgnore:bt,insertPragma:ke,printComment:St,canAttachComment:Ct,getVisitorKeys:Se},Le=Lt;var ne={};Te(ne,{graphql:()=>tn});function Re(e){return typeof e=="object"&&e!==null}function Pe(e,t){if(!!!e)throw new Error(t??"Unexpected invariant triggered.")}var Rt=/\r\n|[\n\r]/g;function U(e,t){let n=0,r=1;for(let i of e.body.matchAll(Rt)){if(typeof i.index=="number"||Pe(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function we(e){return fe(e.source,U(e.source,e.start))}function fe(e,t){let n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,a=t.line+s,u=t.line===1?n:0,l=t.column+u,T=`${e.name}:${a}:${l}
|
|
11
|
+
`,h=r.split(/\r\n|[\n\r]/g),D=h[i];if(D.length>120){let I=Math.floor(l/80),ie=l%80,N=[];for(let v=0;v<D.length;v+=80)N.push(D.slice(v,v+80));return T+Fe([[`${a} |`,N[0]],...N.slice(1,I+1).map(v=>["|",v]),["|","^".padStart(ie)],["|",N[I+1]]])}return T+Fe([[`${a-1} |`,h[i-1]],[`${a} |`,D],["|","^".padStart(l)],[`${a+1} |`,h[i+1]]])}function Fe(e){let t=e.filter(([r,i])=>i!==void 0),n=Math.max(...t.map(([r])=>r.length));return t.map(([r,i])=>r.padStart(n)+(i?" "+i:"")).join(`
|
|
12
|
+
`)}function Pt(e){let t=e[0];return t==null||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}var L=class extends Error{constructor(t,...n){var r,i,s;let{nodes:a,source:u,positions:l,path:T,originalError:h,extensions:D}=Pt(n);super(t),this.name="GraphQLError",this.path=T??void 0,this.originalError=h??void 0,this.nodes=Ve(Array.isArray(a)?a:a?[a]:void 0);let I=Ve((r=this.nodes)===null||r===void 0?void 0:r.map(N=>N.loc).filter(N=>N!=null));this.source=u??(I==null||(i=I[0])===null||i===void 0?void 0:i.source),this.positions=l??(I==null?void 0:I.map(N=>N.start)),this.locations=l&&u?l.map(N=>U(u,N)):I==null?void 0:I.map(N=>U(N.source,N.start));let ie=Re(h==null?void 0:h.extensions)?h==null?void 0:h.extensions:void 0;this.extensions=(s=D??ie)!==null&&s!==void 0?s: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}}),h!=null&&h.stack?Object.defineProperty(this,"stack",{value:h.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,L):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(let n of this.nodes)n.loc&&(t+=`
|
|
6
13
|
|
|
7
|
-
`+j(this.source,n);return t}toJSON(){let t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}}});function d(e,t,n){return new D(`Syntax Error: ${n}`,{source:e,positions:[t]})}var $=m(()=>{u();oe()});var R,g,Fe,Rt,_,Y=m(()=>{u();R=class{constructor(t,n,s){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=s}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},g=class{constructor(t,n,s,i,o,a){this.kind=t,this.start=n,this.end=s,this.line=i,this.column=o,this.value=a,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}}},Fe={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"]},Rt=new Set(Object.keys(Fe));(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(_||(_={}))});var b,ae=m(()=>{u();(function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(b||(b={}))});var c,ce=m(()=>{u();(function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(c||(c={}))});function ue(e){return e===9||e===32}function S(e){return e>=48&&e<=57}function pe(e){return e>=97&&e<=122||e>=65&&e<=90}function G(e){return pe(e)||e===95}function le(e){return pe(e)||S(e)||e===95}var J=m(()=>{u()});function he(e){var t;let n=Number.MAX_SAFE_INTEGER,s=null,i=-1;for(let a=0;a<e.length;++a){var o;let p=e[a],l=we(p);l!==p.length&&(s=(o=s)!==null&&o!==void 0?o:a,i=a,a!==0&&l<n&&(n=l))}return e.map((a,p)=>p===0?a:a.slice(n)).slice((t=s)!==null&&t!==void 0?t:0,i+1)}function we(e){let t=0;for(;t<e.length&&ue(e.charCodeAt(t));)++t;return t}var de=m(()=>{u();J()});var r,X=m(()=>{u();(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"})(r||(r={}))});function Ee(e){return e===r.BANG||e===r.DOLLAR||e===r.AMP||e===r.PAREN_L||e===r.PAREN_R||e===r.SPREAD||e===r.COLON||e===r.EQUALS||e===r.AT||e===r.BRACKET_L||e===r.BRACKET_R||e===r.BRACE_L||e===r.PIPE||e===r.BRACE_R}function v(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function w(e,t){return me(e.charCodeAt(t))&&Ne(e.charCodeAt(t+1))}function me(e){return e>=55296&&e<=56319}function Ne(e){return e>=56320&&e<=57343}function O(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return r.EOF;if(n>=32&&n<=126){let s=String.fromCodePoint(n);return s==='"'?`'"'`:`"${s}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function f(e,t,n,s,i){let o=e.line,a=1+n-e.lineStart;return new g(t,n,s,o,a,i)}function Pe(e,t){let n=e.source.body,s=n.length,i=t;for(;i<s;){let o=n.charCodeAt(i);switch(o){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return Me(e,i);case 33:return f(e,r.BANG,i,i+1);case 36:return f(e,r.DOLLAR,i,i+1);case 38:return f(e,r.AMP,i,i+1);case 40:return f(e,r.PAREN_L,i,i+1);case 41:return f(e,r.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return f(e,r.SPREAD,i,i+3);break;case 58:return f(e,r.COLON,i,i+1);case 61:return f(e,r.EQUALS,i,i+1);case 64:return f(e,r.AT,i,i+1);case 91:return f(e,r.BRACKET_L,i,i+1);case 93:return f(e,r.BRACKET_R,i,i+1);case 123:return f(e,r.BRACE_L,i,i+1);case 124:return f(e,r.PIPE,i,i+1);case 125:return f(e,r.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?Ye(e,i):Ve(e,i)}if(S(o)||o===45)return Ue(e,i,o);if(G(o))return Ge(e,i);throw d(e.source,i,o===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:v(o)||w(n,i)?`Unexpected character: ${O(e,i)}.`:`Invalid character: ${O(e,i)}.`)}return f(e,r.EOF,s,s)}function Me(e,t){let n=e.source.body,s=n.length,i=t+1;for(;i<s;){let o=n.charCodeAt(i);if(o===10||o===13)break;if(v(o))++i;else if(w(n,i))i+=2;else break}return f(e,r.COMMENT,t,i,n.slice(t+1,i))}function Ue(e,t,n){let s=e.source.body,i=t,o=n,a=!1;if(o===45&&(o=s.charCodeAt(++i)),o===48){if(o=s.charCodeAt(++i),S(o))throw d(e.source,i,`Invalid number, unexpected digit after 0: ${O(e,i)}.`)}else i=Q(e,i,o),o=s.charCodeAt(i);if(o===46&&(a=!0,o=s.charCodeAt(++i),i=Q(e,i,o),o=s.charCodeAt(i)),(o===69||o===101)&&(a=!0,o=s.charCodeAt(++i),(o===43||o===45)&&(o=s.charCodeAt(++i)),i=Q(e,i,o),o=s.charCodeAt(i)),o===46||G(o))throw d(e.source,i,`Invalid number, expected digit but got: ${O(e,i)}.`);return f(e,a?r.FLOAT:r.INT,t,i,s.slice(t,i))}function Q(e,t,n){if(!S(n))throw d(e.source,t,`Invalid number, expected digit but got: ${O(e,t)}.`);let s=e.source.body,i=t+1;for(;S(s.charCodeAt(i));)++i;return i}function Ve(e,t){let n=e.source.body,s=n.length,i=t+1,o=i,a="";for(;i<s;){let p=n.charCodeAt(i);if(p===34)return a+=n.slice(o,i),f(e,r.STRING,t,i+1,a);if(p===92){a+=n.slice(o,i);let l=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?Be(e,i):je(e,i):$e(e,i);a+=l.value,i+=l.size,o=i;continue}if(p===10||p===13)break;if(v(p))++i;else if(w(n,i))i+=2;else throw d(e.source,i,`Invalid character within String: ${O(e,i)}.`)}throw d(e.source,i,"Unterminated string.")}function Be(e,t){let n=e.source.body,s=0,i=3;for(;i<12;){let o=n.charCodeAt(t+i++);if(o===125){if(i<5||!v(s))break;return{value:String.fromCodePoint(s),size:i}}if(s=s<<4|C(o),s<0)break}throw d(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function je(e,t){let n=e.source.body,s=fe(n,t+2);if(v(s))return{value:String.fromCodePoint(s),size:6};if(me(s)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let i=fe(n,t+8);if(Ne(i))return{value:String.fromCodePoint(s,i),size:12}}throw d(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function fe(e,t){return C(e.charCodeAt(t))<<12|C(e.charCodeAt(t+1))<<8|C(e.charCodeAt(t+2))<<4|C(e.charCodeAt(t+3))}function C(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function $e(e,t){let n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:`
|
|
8
|
-
|
|
9
|
-
`));return e.line+=l.length-1,e.lineStart=i,E}if(T===92&&n.charCodeAt(o+1)===34&&n.charCodeAt(o+2)===34&&n.charCodeAt(o+3)===34){p+=n.slice(a,o),a=o+1,o+=4;continue}if(T===10||T===13){p+=n.slice(a,o),l.push(p),T===13&&n.charCodeAt(o+1)===10?o+=2:++o,p="",a=o,i=o;continue}if(v(T))++o;else if(w(n,o))o+=2;else throw d(e.source,o,`Invalid character within String: ${O(e,o)}.`)}throw d(e.source,o,"Unterminated string.")}function Ge(e,t){let n=e.source.body,s=n.length,i=t+1;for(;i<s;){let o=n.charCodeAt(i);if(le(o))++i;else break}return f(e,r.NAME,t,i,n.slice(t,i))}var F,Te=m(()=>{u();$();Y();de();J();X();F=class{constructor(t){let n=new g(r.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==r.EOF)do if(t.next)t=t.next;else{let n=Pe(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===r.COMMENT);return t}}});function P(e,t){if(!Boolean(e))throw new Error(t)}var xe=m(()=>{u()});function Ie(e){return M(e,[])}function M(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return Je(e,t);default:return String(e)}}function Je(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";let n=[...t,e];if(Xe(e)){let s=e.toJSON();if(s!==e)return typeof s=="string"?s:M(s,n)}else if(Array.isArray(e))return qe(e,n);return Qe(e,n)}function Xe(e){return typeof e.toJSON=="function"}function Qe(e,t){let n=Object.entries(e);if(n.length===0)return"{}";if(t.length>2)return"["+ze(e)+"]";let s=n.map(([i,o])=>i+": "+M(o,t));return"{ "+s.join(", ")+" }"}function qe(e,t){if(e.length===0)return"[]";if(t.length>2)return"[Array]";let n=Math.min(10,e.length),s=e.length-n,i=[];for(let o=0;o<n;++o)i.push(M(e[o],t));return s===1?i.push("... 1 more item"):s>1&&i.push(`... ${s} more items`),"["+i.join(", ")+"]"}function ze(e){let t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){let n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}var _e=m(()=>{u()});var Oe,Ae=m(()=>{u();Oe=function(t,n){return t instanceof n}});function ye(e){return Oe(e,L)}var L,De=m(()=>{u();xe();_e();Ae();L=class{constructor(t,n="GraphQL request",s={line:1,column:1}){typeof t=="string"||P(!1,`Body must be a string. Received: ${Ie(t)}.`),this.body=t,this.name=n,this.locationOffset=s,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"}}});var ve={};Ce(ve,{Parser:()=>A,parse:()=>He,parseConstValue:()=>Ze,parseType:()=>Ke,parseValue:()=>We});function He(e,t){return new A(e,t).parseDocument()}function We(e,t){let n=new A(e,t);n.expectToken(r.SOF);let s=n.parseValueLiteral(!1);return n.expectToken(r.EOF),s}function Ze(e,t){let n=new A(e,t);n.expectToken(r.SOF);let s=n.parseConstValueLiteral();return n.expectToken(r.EOF),s}function Ke(e,t){let n=new A(e,t);n.expectToken(r.SOF);let s=n.parseTypeReference();return n.expectToken(r.EOF),s}function U(e){let t=e.value;return Se(e.kind)+(t!=null?` "${t}"`:"")}function Se(e){return Ee(e)?`"${e}"`:e}var A,ke=m(()=>{u();$();Y();ae();ce();Te();De();X();A=class{constructor(t,n={}){let s=ye(t)?t:new L(t);this._lexer=new F(s),this._options=n,this._tokenCounter=0}parseName(){let t=this.expectToken(r.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(r.SOF,this.parseDefinition,r.EOF)})}parseDefinition(){if(this.peek(r.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===r.NAME){switch(n.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(t)throw d(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(r.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:_.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let n=this.parseOperationType(),s;return this.peek(r.NAME)&&(s=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:n,name:s,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(r.NAME);switch(t.value){case"query":return _.QUERY;case"mutation":return _.MUTATION;case"subscription":return _.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(r.PAREN_L,this.parseVariableDefinition,r.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(r.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(r.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(r.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this.many(r.BRACE_L,this.parseSelection,r.BRACE_R)})}parseSelection(){return this.peek(r.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),s,i;return this.expectOptionalToken(r.COLON)?(s=n,i=this.parseName()):i=n,this.node(t,{kind:c.FIELD,alias:s,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(r.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(r.PAREN_L,n,r.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,s=this.parseName();return this.expectToken(r.COLON),this.node(n,{kind:c.ARGUMENT,name:s,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let t=this._lexer.token;this.expectToken(r.SPREAD);let n=this.expectOptionalKeyword("on");return!n&&this.peek(r.NAME)?this.node(t,{kind:c.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.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(t){let n=this._lexer.token;switch(n.kind){case r.BRACKET_L:return this.parseList(t);case r.BRACE_L:return this.parseObject(t);case r.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case r.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case r.STRING:case r.BLOCK_STRING:return this.parseStringLiteral();case r.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case r.DOLLAR:if(t)if(this.expectToken(r.DOLLAR),this._lexer.token.kind===r.NAME){let s=this._lexer.token.value;throw d(this._lexer.source,n.start,`Unexpected variable "$${s}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===r.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(r.BRACKET_L,n,r.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(r.BRACE_L,n,r.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,s=this.parseName();return this.expectToken(r.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:s,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(r.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(r.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(r.BRACKET_L)){let s=this.parseTypeReference();this.expectToken(r.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:s})}else n=this.parseNamedType();return this.expectOptionalToken(r.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(r.STRING)||this.peek(r.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let s=this.parseConstDirectives(),i=this.many(r.BRACE_L,this.parseOperationTypeDefinition,r.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:s,operationTypes:i})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(r.COLON);let s=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:s})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let s=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:s,directives:i})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let s=this.parseName(),i=this.parseImplementsInterfaces(),o=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:s,interfaces:i,directives:o,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(r.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(r.BRACE_L,this.parseFieldDefinition,r.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),s=this.parseName(),i=this.parseArgumentDefs();this.expectToken(r.COLON);let o=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:s,arguments:i,type:o,directives:a})}parseArgumentDefs(){return this.optionalMany(r.PAREN_L,this.parseInputValueDef,r.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),s=this.parseName();this.expectToken(r.COLON);let i=this.parseTypeReference(),o;this.expectOptionalToken(r.EQUALS)&&(o=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:s,type:i,defaultValue:o,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let s=this.parseName(),i=this.parseImplementsInterfaces(),o=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:s,interfaces:i,directives:o,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let s=this.parseName(),i=this.parseConstDirectives(),o=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:s,directives:i,types:o})}parseUnionMemberTypes(){return this.expectOptionalToken(r.EQUALS)?this.delimitedMany(r.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let s=this.parseName(),i=this.parseConstDirectives(),o=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:s,directives:i,values:o})}parseEnumValuesDefinition(){return this.optionalMany(r.BRACE_L,this.parseEnumValueDefinition,r.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),s=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:s,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw d(this._lexer.source,this._lexer.token.start,`${U(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let s=this.parseName(),i=this.parseConstDirectives(),o=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:s,directives:i,fields:o})}parseInputFieldsDefinition(){return this.optionalMany(r.BRACE_L,this.parseInputValueDef,r.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===r.NAME)switch(t.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(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),s=this.optionalMany(r.BRACE_L,this.parseOperationTypeDefinition,r.BRACE_R);if(n.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:s})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),s=this.parseConstDirectives();if(s.length===0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:s})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),s=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();if(s.length===0&&i.length===0&&o.length===0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:s,directives:i,fields:o})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),s=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();if(s.length===0&&i.length===0&&o.length===0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:s,directives:i,fields:o})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),s=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(s.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:s,types:i})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),s=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(s.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:s,values:i})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),s=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(s.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:s,fields:i})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(r.AT);let s=this.parseName(),i=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let a=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:s,arguments:i,repeatable:o,locations:a})}parseDirectiveLocations(){return this.delimitedMany(r.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(b,n.value))return n;throw this.unexpected(t)}node(t,n){return this._options.noLocation!==!0&&(n.loc=new R(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw d(this._lexer.source,n.start,`Expected ${Se(t)}, found ${U(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===r.NAME&&n.value===t)this.advanceLexer();else throw d(this._lexer.source,n.start,`Expected "${t}", found ${U(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===r.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t!=null?t:this._lexer.token;return d(this._lexer.source,n.start,`Unexpected ${U(n)}.`)}any(t,n,s){this.expectToken(t);let i=[];for(;!this.expectOptionalToken(s);)i.push(n.call(this));return i}optionalMany(t,n,s){if(this.expectOptionalToken(t)){let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(s));return i}return[]}many(t,n,s){this.expectToken(t);let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(s));return i}delimitedMany(t,n){this.expectOptionalToken(t);let s=[];do s.push(n.call(this));while(this.expectOptionalToken(t));return s}advanceLexer(){let{maxTokens:t}=this._options,n=this._lexer.advance();if(t!==void 0&&n.kind!==r.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw d(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}});u();u();function Le(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var q=Le;u();function z(e){return/^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/.test(e)}u();function H(e){return e.kind==="Comment"?e.start:e.loc.start}function W(e){return e.kind==="Comment"?e.end:e.loc.end}function et(e){let t=[],{startToken:n,endToken:s}=e.loc;for(let i=n;i!==s;i=i.next)i.kind==="Comment"&&t.push(i);return t}var tt={allowLegacyFragmentVariables:!0};function nt(e){if((e==null?void 0:e.name)==="GraphQLError"){let{message:t,locations:[n]}=e;return q(t,{loc:{start:n},cause:e})}return e}async function it(e){let{parse:t}=await Promise.resolve().then(()=>(ke(),ve)),n;try{n=t(e,tt)}catch(s){throw nt(s)}return n.comments=et(n),n}var st={parsers:{graphql:{parse:it,astFormat:"graphql",hasPragma:z,locStart:H,locEnd:W}}},On=st;export{On as default};
|
|
14
|
+
`+we(n.loc));else if(this.source&&this.locations)for(let n of this.locations)t+=`
|
|
15
|
+
|
|
16
|
+
`+fe(this.source,n);return t}toJSON(){let t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}};function Ve(e){return e===void 0||e.length===0?void 0:e}function d(e,t,n){return new L(`Syntax Error: ${n}`,{source:e,positions:[t]})}var H;(function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(H||(H={}));var c;(function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(c||(c={}));function Be(e){return e===9||e===32}function R(e){return e>=48&&e<=57}function Ue(e){return e>=97&&e<=122||e>=65&&e<=90}function he(e){return Ue(e)||e===95}function Me(e){return Ue(e)||R(e)||e===95}function Ye(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let a=0;a<e.length;++a){var s;let u=e[a],l=Ft(u);l!==u.length&&(r=(s=r)!==null&&s!==void 0?s:a,i=a,a!==0&&l<n&&(n=l))}return e.map((a,u)=>u===0?a:a.slice(n)).slice((t=r)!==null&&t!==void 0?t:0,i+1)}function Ft(e){let t=0;for(;t<e.length&&Be(e.charCodeAt(t));)++t;return t}var o;(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"})(o||(o={}));var z=class{constructor(t){let n=new B(o.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==o.EOF)do if(t.next)t=t.next;else{let n=wt(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===o.COMMENT);return t}};function $e(e){return e===o.BANG||e===o.DOLLAR||e===o.AMP||e===o.PAREN_L||e===o.PAREN_R||e===o.SPREAD||e===o.COLON||e===o.EQUALS||e===o.AT||e===o.BRACKET_L||e===o.BRACKET_R||e===o.BRACE_L||e===o.PIPE||e===o.BRACE_R}function P(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function K(e,t){return Ge(e.charCodeAt(t))&&Je(e.charCodeAt(t+1))}function Ge(e){return e>=55296&&e<=56319}function Je(e){return e>=56320&&e<=57343}function S(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return o.EOF;if(n>=32&&n<=126){let r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function m(e,t,n,r,i){let s=e.line,a=1+n-e.lineStart;return new B(t,n,r,s,a,i)}function wt(e,t){let n=e.source.body,r=n.length,i=t;for(;i<r;){let s=n.charCodeAt(i);switch(s){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return Vt(e,i);case 33:return m(e,o.BANG,i,i+1);case 36:return m(e,o.DOLLAR,i,i+1);case 38:return m(e,o.AMP,i,i+1);case 40:return m(e,o.PAREN_L,i,i+1);case 41:return m(e,o.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return m(e,o.SPREAD,i,i+3);break;case 58:return m(e,o.COLON,i,i+1);case 61:return m(e,o.EQUALS,i,i+1);case 64:return m(e,o.AT,i,i+1);case 91:return m(e,o.BRACKET_L,i,i+1);case 93:return m(e,o.BRACKET_R,i,i+1);case 123:return m(e,o.BRACE_L,i,i+1);case 124:return m(e,o.PIPE,i,i+1);case 125:return m(e,o.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?$t(e,i):Ut(e,i)}if(R(s)||s===45)return Bt(e,i,s);if(he(s))return Gt(e,i);throw d(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:P(s)||K(n,i)?`Unexpected character: ${S(e,i)}.`:`Invalid character: ${S(e,i)}.`)}return m(e,o.EOF,r,r)}function Vt(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(s===10||s===13)break;if(P(s))++i;else if(K(n,i))i+=2;else break}return m(e,o.COMMENT,t,i,n.slice(t+1,i))}function Bt(e,t,n){let r=e.source.body,i=t,s=n,a=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),R(s))throw d(e.source,i,`Invalid number, unexpected digit after 0: ${S(e,i)}.`)}else i=de(e,i,s),s=r.charCodeAt(i);if(s===46&&(a=!0,s=r.charCodeAt(++i),i=de(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(a=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=de(e,i,s),s=r.charCodeAt(i)),s===46||he(s))throw d(e.source,i,`Invalid number, expected digit but got: ${S(e,i)}.`);return m(e,a?o.FLOAT:o.INT,t,i,r.slice(t,i))}function de(e,t,n){if(!R(n))throw d(e.source,t,`Invalid number, expected digit but got: ${S(e,t)}.`);let r=e.source.body,i=t+1;for(;R(r.charCodeAt(i));)++i;return i}function Ut(e,t){let n=e.source.body,r=n.length,i=t+1,s=i,a="";for(;i<r;){let u=n.charCodeAt(i);if(u===34)return a+=n.slice(s,i),m(e,o.STRING,t,i+1,a);if(u===92){a+=n.slice(s,i);let l=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?Mt(e,i):Yt(e,i):jt(e,i);a+=l.value,i+=l.size,s=i;continue}if(u===10||u===13)break;if(P(u))++i;else if(K(n,i))i+=2;else throw d(e.source,i,`Invalid character within String: ${S(e,i)}.`)}throw d(e.source,i,"Unterminated string.")}function Mt(e,t){let n=e.source.body,r=0,i=3;for(;i<12;){let s=n.charCodeAt(t+i++);if(s===125){if(i<5||!P(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|M(s),r<0)break}throw d(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function Yt(e,t){let n=e.source.body,r=je(n,t+2);if(P(r))return{value:String.fromCodePoint(r),size:6};if(Ge(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let i=je(n,t+8);if(Je(i))return{value:String.fromCodePoint(r,i),size:12}}throw d(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function je(e,t){return M(e.charCodeAt(t))<<12|M(e.charCodeAt(t+1))<<8|M(e.charCodeAt(t+2))<<4|M(e.charCodeAt(t+3))}function M(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function jt(e,t){let n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:`
|
|
17
|
+
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw d(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function $t(e,t){let n=e.source.body,r=n.length,i=e.lineStart,s=t+3,a=s,u="",l=[];for(;s<r;){let T=n.charCodeAt(s);if(T===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){u+=n.slice(a,s),l.push(u);let h=m(e,o.BLOCK_STRING,t,s+3,Ye(l).join(`
|
|
18
|
+
`));return e.line+=l.length-1,e.lineStart=i,h}if(T===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){u+=n.slice(a,s),a=s+1,s+=4;continue}if(T===10||T===13){u+=n.slice(a,s),l.push(u),T===13&&n.charCodeAt(s+1)===10?s+=2:++s,u="",a=s,i=s;continue}if(P(T))++s;else if(K(n,s))s+=2;else throw d(e.source,s,`Invalid character within String: ${S(e,s)}.`)}throw d(e.source,s,"Unterminated string.")}function Gt(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(Me(s))++i;else break}return m(e,o.NAME,t,i,n.slice(t,i))}function Z(e,t){if(!!!e)throw new Error(t)}function Xe(e){return ee(e,[])}function ee(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return Jt(e,t);default:return String(e)}}function Jt(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";let n=[...t,e];if(Xt(e)){let r=e.toJSON();if(r!==e)return typeof r=="string"?r:ee(r,n)}else if(Array.isArray(e))return Qt(e,n);return qt(e,n)}function Xt(e){return typeof e.toJSON=="function"}function qt(e,t){let n=Object.entries(e);return n.length===0?"{}":t.length>2?"["+Wt(e)+"]":"{ "+n.map(([i,s])=>i+": "+ee(s,t)).join(", ")+" }"}function Qt(e,t){if(e.length===0)return"[]";if(t.length>2)return"[Array]";let n=Math.min(10,e.length),r=e.length-n,i=[];for(let s=0;s<n;++s)i.push(ee(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function Wt(e){let t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){let n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}var qe=function(t,n){return t instanceof n};var Y=class{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||Z(!1,`Body must be a string. Received: ${Xe(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||Z(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Z(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function Qe(e){return qe(e,Y)}function We(e,t){return new me(e,t).parseDocument()}var me=class{constructor(t,n={}){let r=Qe(t)?t:new Y(t);this._lexer=new z(r),this._options=n,this._tokenCounter=0}parseName(){let t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===o.NAME){switch(n.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(t)throw d(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:C.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let n=this.parseOperationType(),r;return this.peek(o.NAME)&&(r=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(o.NAME);switch(t.value){case"query":return C.QUERY;case"mutation":return C.MUTATION;case"subscription":return C.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this.many(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),r,i;return this.expectOptionalToken(o.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:c.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let t=this._lexer.token;this.expectToken(o.SPREAD);let n=this.expectOptionalKeyword("on");return!n&&this.peek(o.NAME)?this.node(t,{kind:c.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.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(t){let n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){let r=this._lexer.token.value;throw d(this._lexer.source,n.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(o.BRACKET_L)){let r=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let r=this.parseConstDirectives(),i=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);let r=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(o.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(o.COLON);let s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(o.COLON);let i=this.parseTypeReference(),s;this.expectOptionalToken(o.EQUALS)&&(s=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw d(this._lexer.source,this._lexer.token.start,`${te(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===o.NAME)switch(t.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(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),r=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.AT);let r=this.parseName(),i=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let a=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(H,n.value))return n;throw this.unexpected(t)}node(t,n){return this._options.noLocation!==!0&&(n.loc=new Q(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw d(this._lexer.source,n.start,`Expected ${He(t)}, found ${te(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw d(this._lexer.source,n.start,`Expected "${t}", found ${te(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t??this._lexer.token;return d(this._lexer.source,n.start,`Unexpected ${te(n)}.`)}any(t,n,r){this.expectToken(t);let i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}return[]}many(t,n,r){this.expectToken(t);let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);let r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){let{maxTokens:t}=this._options,n=this._lexer.advance();if(t!==void 0&&n.kind!==o.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw d(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}};function te(e){let t=e.value;return He(e.kind)+(t!=null?` "${t}"`:"")}function He(e){return $e(e)?`"${e}"`:e}function Ht(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var ze=Ht;function zt(e){let t=[],{startToken:n,endToken:r}=e.loc;for(let i=n;i!==r;i=i.next)i.kind==="Comment"&&t.push(i);return t}var Kt={allowLegacyFragmentVariables:!0};function Zt(e){if((e==null?void 0:e.name)==="GraphQLError"){let{message:t,locations:[n]}=e;return ze(t,{loc:{start:n},cause:e})}return e}function en(e){let t;try{t=We(e,Kt)}catch(n){throw Zt(n)}return t.comments=zt(t),t}var tn={parse:en,astFormat:"graphql",hasPragma:ge,locStart:X,locEnd:q};var Ke=[{linguistLanguageId:139,name:"GraphQL",type:"data",color:"#e10098",extensions:[".graphql",".gql",".graphqls"],tmScope:"source.graphql",aceMode:"text",parsers:["graphql"],vscodeLanguageIds:["graphql"]}];var Ze={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}};var nn={bracketSpacing:Ze.bracketSpacing},et=nn;var rn={graphql:Le};export{Ee as default,Ke as languages,et as options,ne as parsers,rn as printers};
|