@shopify/cli
Version:
A CLI tool to build for the Shopify platform
29 lines (22 loc) • 45.1 kB
JavaScript
import{b as Oe,g as Q}from"./chunk-VPRTJUIN.js";function v(e){return w(e),{type:Ce,contents:e}}function O(e,t={}){return w(e),ie(t.expandedStates,!0),{type:Se,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function A(e,t="",i={}){return w(e),t!==""&&w(t),{type:be,breakContents:e,flatContents:t,groupId:i.groupId}}function E(e,t){w(e),ie(t);let i=[];for(let r=0;r<t.length;r++)r!==0&&i.push(e),i.push(t[r]);return i}function U(e){return(t,i,r)=>{let n=!!r?.backwards;if(i===!1)return!1;let{length:s}=t,o=i;for(;o>=0&&o<s;){let c=t.charAt(o);if(e instanceof RegExp){if(!e.test(c))return o}else if(!e.includes(c))return o;n?o--:o++}return o===-1||o===s?o:!1}}function Me(e,t,i){let r=!!i?.backwards;if(t===!1)return!1;let n=e.charAt(t);if(r){if(e.charAt(t-1)==="\r"&&n===`
`)return t-2;if(X(n))return t-1}else{if(n==="\r"&&e.charAt(t+1)===`
`)return t+2;if(X(n))return t+1}return t}function Ue(e,t,i={}){let r=ne(e,i.backwards?t-1:t,i),n=re(e,r,i);return r!==n}function Be(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let i=t+2;i<e.length;++i)if(e.charAt(i)==="*"&&e.charAt(i+1)==="/")return i+2}return t}function Ke(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?Pe(e,t):t}function Ge(e,t){let i=null,r=t;for(;r!==i;)i=r,r=we(e,r),r=je(e,r),r=ne(e,r);return r=$e(e,r),r=re(e,r),r!==!1&&Ve(e,r)}function qe(e){return Array.isArray(e)&&e.length>0}function F(e){if(R!==null&&typeof R.property){let t=R;return R=F.prototype=null,t}return R=F.prototype=e??Object.create(null),new F}function ze(e){return F(e)}function He(e,t="type"){ze(e);function i(r){let n=r[t],s=e[n];if(!Array.isArray(s))throw Object.assign(new Error(`Missing visitor keys for '${n}'.`),{node:r});return s}return i}function ct(e,t,i){let{node:r}=e;if(!r.description)return"";let n=[i("description")];return r.kind==="InputValueDefinition"&&!r.description.block?n.push(S):n.push(h),n}function ut(e,t,i){let{node:r}=e;switch(r.kind){case"Document":return[...E(h,D(e,t,i,"definitions")),h];case"OperationDefinition":{let n=t.originalText[ce(r)]!=="{",s=!!r.name;return[y(e,t,i),n?r.operation:"",n&&s?[" ",i("name")]:"",n&&!s&&se(r.variableDefinitions)?" ":"",z(e,i),T(e,i,r),!n&&!s?"":" ",i("selectionSet")]}case"FragmentDefinition":return[y(e,t,i),"fragment ",i("name"),z(e,i)," on ",i("typeCondition"),T(e,i,r)," ",i("selectionSet")];case"SelectionSet":return["{",v([h,E(h,D(e,t,i,"selections"))]),h,"}"];case"Field":return O([r.alias?[i("alias"),": "]:"",i("name"),r.arguments.length>0?O(["(",v([p,E([A("",", "),p],D(e,t,i,"arguments"))]),p,")"]):"",T(e,i,r),r.selectionSet?" ":"",i("selectionSet")]);case"Name":return r.value;case"StringValue":if(r.block){let n=K(0,r.value,'"""','\\"""').split(`
`);return n.length===1&&(n[0]=n[0].trim()),n.every(s=>s==="")&&(n.length=0),E(h,['"""',...n,'"""'])}return['"',K(0,K(0,r.value,/["\\]/gu,"\\$&"),`
`,"\\n"),'"'];case"IntValue":case"FloatValue":case"EnumValue":return r.value;case"BooleanValue":return r.value?"true":"false";case"NullValue":return"null";case"Variable":return["$",i("name")];case"ListValue":return O(["[",v([p,E([A("",", "),p],e.map(i,"values"))]),p,"]"]);case"ObjectValue":{let n=t.bracketSpacing&&r.fields.length>0?" ":"";return O(["{",n,v([p,E([A("",", "),p],e.map(i,"fields"))]),p,A("",n),"}"])}case"ObjectField":case"Argument":return[i("name"),": ",i("value")];case"Directive":return["@",i("name"),r.arguments.length>0?O(["(",v([p,E([A("",", "),p],D(e,t,i,"arguments"))]),p,")"]):""];case"NamedType":return i("name");case"VariableDefinition":return[y(e,t,i),i("variable"),": ",i("type"),r.defaultValue?[" = ",i("defaultValue")]:"",T(e,i,r)];case"ObjectTypeExtension":case"ObjectTypeDefinition":case"InputObjectTypeExtension":case"InputObjectTypeDefinition":case"InterfaceTypeExtension":case"InterfaceTypeDefinition":{let{kind:n}=r,s=[];return n.endsWith("TypeDefinition")?s.push(y(e,t,i)):s.push("extend "),n.startsWith("ObjectType")?s.push("type"):n.startsWith("InputObjectType")?s.push("input"):s.push("interface"),s.push(" ",i("name")),!n.startsWith("InputObjectType")&&r.interfaces.length>0&&s.push(" implements ",...dt(e,t,i)),s.push(T(e,i,r)),r.fields.length>0&&s.push([" {",v([h,E(h,D(e,t,i,"fields"))]),h,"}"]),s}case"FieldDefinition":return[y(e,t,i),i("name"),r.arguments.length>0?O(["(",v([p,E([A("",", "),p],D(e,t,i,"arguments"))]),p,")"]):"",": ",i("type"),T(e,i,r)];case"DirectiveDefinition":return[y(e,t,i),"directive ","@",i("name"),r.arguments.length>0?O(["(",v([p,E([A("",", "),p],D(e,t,i,"arguments"))]),p,")"]):"",r.repeatable?" repeatable":""," on ",...E(" | ",e.map(i,"locations"))];case"EnumTypeExtension":case"EnumTypeDefinition":return[y(e,t,i),r.kind==="EnumTypeExtension"?"extend ":"","enum ",i("name"),T(e,i,r),r.values.length>0?[" {",v([h,E(h,D(e,t,i,"values"))]),h,"}"]:""];case"EnumValueDefinition":return[y(e,t,i),i("name"),T(e,i,r)];case"InputValueDefinition":return[y(e,t,i),i("name"),": ",i("type"),r.defaultValue?[" = ",i("defaultValue")]:"",T(e,i,r)];case"SchemaExtension":return["extend schema",T(e,i,r),...r.operationTypes.length>0?[" {",v([h,E(h,D(e,t,i,"operationTypes"))]),h,"}"]:[]];case"SchemaDefinition":return[y(e,t,i),"schema",T(e,i,r)," {",r.operationTypes.length>0?v([h,E(h,D(e,t,i,"operationTypes"))]):"",h,"}"];case"OperationTypeDefinition":return[r.operation,": ",i("type")];case"FragmentSpread":return["...",i("name"),T(e,i,r)];case"InlineFragment":return["...",r.typeCondition?[" on ",i("typeCondition")]:"",T(e,i,r)," ",i("selectionSet")];case"UnionTypeExtension":case"UnionTypeDefinition":return O([y(e,t,i),O([r.kind==="UnionTypeExtension"?"extend ":"","union ",i("name"),T(e,i,r),r.types.length>0?[" =",A(""," "),v([A([S,"| "]),E([S,"| "],e.map(i,"types"))])]:""])]);case"ScalarTypeExtension":case"ScalarTypeDefinition":return[y(e,t,i),r.kind==="ScalarTypeExtension"?"extend ":"","scalar ",i("name"),T(e,i,r)];case"NonNullType":return[i("type"),"!"];case"ListType":return["[",i("type"),"]"];default:throw new Qe(r,"Graphql","kind")}}function T(e,t,i){if(i.directives.length===0)return"";let r=E(S,e.map(t,"directives"));return i.kind==="FragmentDefinition"||i.kind==="OperationDefinition"?O([S,r]):[" ",O(v([p,r]))]}function D(e,t,i,r){return e.map(({isLast:n,node:s})=>{let o=i();return!n&&Ye(t.originalText,ue(s))?[o,h]:o},r)}function pt(e){return e.kind!=="Comment"}function ht({node:e}){if(e.kind==="Comment")return"#"+e.value.trimEnd();throw new Error("Not a comment: "+JSON.stringify(e))}function dt(e,t,i){let{node:r}=e,n=[],{interfaces:s}=r,o=e.map(i,"interfaces");for(let c=0;c<s.length;c++){let u=s[c];n.push(o[c]);let N=s[c+1];if(N){let I=t.originalText.slice(u.loc.end,N.loc.start).includes("#");n.push(" &",I?S:" ")}}return n}function z(e,t){let{node:i}=e;return se(i.variableDefinitions)?O(["(",v([p,E([A("",", "),p],e.map(t,"variableDefinitions"))]),p,")"]):""}function pe(e,t){e.kind==="StringValue"&&e.block&&!e.value.includes(`
`)&&(t.value=e.value.trim())}function ft(e){let{node:t}=e;return t?.comments?.some(i=>i.value.trim()==="prettier-ignore")}function yt(e){return typeof e=="object"&&e!==null}function Ot(e,t){if(!e)throw new Error(t??"Unexpected invariant triggered.")}function Y(e,t){let i=0,r=1;for(let n of e.body.matchAll(Dt)){if(typeof n.index=="number"||Ot(!1),n.index>=t)break;i=n.index+n[0].length,r+=1}return{line:r,column:t+1-i}}function At(e){return de(e.source,Y(e.source,e.start))}function de(e,t){let i=e.locationOffset.column-1,r="".padStart(i)+e.body,n=t.line-1,s=e.locationOffset.line-1,o=t.line+s,c=t.line===1?i:0,u=t.column+c,N=`${e.name}:${o}:${u}
`,I=r.split(/\r\n|[\n\r]/g),g=I[n];if(g.length>120){let x=Math.floor(u/80),j=u%80,m=[];for(let k=0;k<g.length;k+=80)m.push(g.slice(k,k+80));return N+H([[`${o} |`,m[0]],...m.slice(1,x+1).map(k=>["|",k]),["|","^".padStart(j)],["|",m[x+1]]])}return N+H([[`${o-1} |`,I[n-1]],[`${o} |`,g],["|","^".padStart(u)],[`${o+1} |`,I[n+1]]])}function H(e){let t=e.filter(([r,n])=>n!==void 0),i=Math.max(...t.map(([r])=>r.length));return t.map(([r,n])=>r.padStart(i)+(n?" "+n:"")).join(`
`)}function xt(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}function W(e){return e===void 0||e.length===0?void 0:e}function f(e,t,i){return new _t(`Syntax Error: ${i}`,{source:e,positions:[t]})}function gt(e){return e===9||e===32}function P(e){return e>=48&&e<=57}function Ee(e){return e>=97&&e<=122||e>=65&&e<=90}function me(e){return Ee(e)||e===95}function kt(e){return Ee(e)||P(e)||e===95}function Ct(e){var t;let i=Number.MAX_SAFE_INTEGER,r=null,n=-1;for(let o=0;o<e.length;++o){var s;let c=e[o],u=St(c);u!==c.length&&(r=(s=r)!==null&&s!==void 0?s:o,n=o,o!==0&&u<i&&(i=u))}return e.map((o,c)=>c===0?o:o.slice(i)).slice((t=r)!==null&&t!==void 0?t:0,n+1)}function St(e){let t=0;for(;t<e.length&>(e.charCodeAt(t));)++t;return t}function Rt(e){return e===a.BANG||e===a.DOLLAR||e===a.AMP||e===a.PAREN_L||e===a.PAREN_R||e===a.DOT||e===a.SPREAD||e===a.COLON||e===a.EQUALS||e===a.AT||e===a.BRACKET_L||e===a.BRACKET_R||e===a.BRACE_L||e===a.PIPE||e===a.BRACE_R}function b(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function V(e,t){return Te(e.charCodeAt(t))&&Ne(e.charCodeAt(t+1))}function Te(e){return e>=55296&&e<=56319}function Ne(e){return e>=56320&&e<=57343}function _(e,t){let i=e.source.body.codePointAt(t);if(i===void 0)return a.EOF;if(i>=32&&i<=126){let r=String.fromCodePoint(i);return r==='"'?`'"'`:`"${r}"`}return"U+"+i.toString(16).toUpperCase().padStart(4,"0")}function d(e,t,i,r,n){let s=e.line,o=1+i-e.lineStart;return new ae(t,i,r,s,o,n)}function Lt(e,t){let i=e.source.body,r=i.length,n=t;for(;n<r;){let s=i.charCodeAt(n);switch(s){case 65279:case 9:case 32:case 44:++n;continue;case 10:++n,++e.line,e.lineStart=n;continue;case 13:i.charCodeAt(n+1)===10?n+=2:++n,++e.line,e.lineStart=n;continue;case 35:return Ft(e,n);case 33:return d(e,a.BANG,n,n+1);case 36:return d(e,a.DOLLAR,n,n+1);case 38:return d(e,a.AMP,n,n+1);case 40:return d(e,a.PAREN_L,n,n+1);case 41:return d(e,a.PAREN_R,n,n+1);case 46:if(i.charCodeAt(n+1)===46&&i.charCodeAt(n+2)===46)return d(e,a.SPREAD,n,n+3);break;case 58:return d(e,a.COLON,n,n+1);case 61:return d(e,a.EQUALS,n,n+1);case 64:return d(e,a.AT,n,n+1);case 91:return d(e,a.BRACKET_L,n,n+1);case 93:return d(e,a.BRACKET_R,n,n+1);case 123:return d(e,a.BRACE_L,n,n+1);case 124:return d(e,a.PIPE,n,n+1);case 125:return d(e,a.BRACE_R,n,n+1);case 34:return i.charCodeAt(n+1)===34&&i.charCodeAt(n+2)===34?Bt(e,n):Pt(e,n)}if(P(s)||s===45)return wt(e,n,s);if(me(s))return jt(e,n);throw f(e.source,n,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:b(s)||V(i,n)?`Unexpected character: ${_(e,n)}.`:`Invalid character: ${_(e,n)}.`)}return d(e,a.EOF,r,r)}function Ft(e,t){let i=e.source.body,r=i.length,n=t+1;for(;n<r;){let s=i.charCodeAt(n);if(s===10||s===13)break;if(b(s))++n;else if(V(i,n))n+=2;else break}return d(e,a.COMMENT,t,n,i.slice(t+1,n))}function wt(e,t,i){let r=e.source.body,n=t,s=i,o=!1;if(s===45&&(s=r.charCodeAt(++n)),s===48){if(s=r.charCodeAt(++n),P(s))throw f(e.source,n,`Invalid number, unexpected digit after 0: ${_(e,n)}.`)}else n=$(e,n,s),s=r.charCodeAt(n);if(s===46&&(o=!0,s=r.charCodeAt(++n),n=$(e,n,s),s=r.charCodeAt(n)),(s===69||s===101)&&(o=!0,s=r.charCodeAt(++n),(s===43||s===45)&&(s=r.charCodeAt(++n)),n=$(e,n,s),s=r.charCodeAt(n)),s===46||me(s))throw f(e.source,n,`Invalid number, expected digit but got: ${_(e,n)}.`);return d(e,o?a.FLOAT:a.INT,t,n,r.slice(t,n))}function $(e,t,i){if(!P(i))throw f(e.source,t,`Invalid number, expected digit but got: ${_(e,t)}.`);let r=e.source.body,n=t+1;for(;P(r.charCodeAt(n));)++n;return n}function Pt(e,t){let i=e.source.body,r=i.length,n=t+1,s=n,o="";for(;n<r;){let c=i.charCodeAt(n);if(c===34)return o+=i.slice(s,n),d(e,a.STRING,t,n+1,o);if(c===92){o+=i.slice(s,n);let u=i.charCodeAt(n+1)===117?i.charCodeAt(n+2)===123?Mt(e,n):Ut(e,n):Vt(e,n);o+=u.value,n+=u.size,s=n;continue}if(c===10||c===13)break;if(b(c))++n;else if(V(i,n))n+=2;else throw f(e.source,n,`Invalid character within String: ${_(e,n)}.`)}throw f(e.source,n,"Unterminated string.")}function Mt(e,t){let i=e.source.body,r=0,n=3;for(;n<12;){let s=i.charCodeAt(t+n++);if(s===125){if(n<5||!b(r))break;return{value:String.fromCodePoint(r),size:n}}if(r=r<<4|L(s),r<0)break}throw f(e.source,t,`Invalid Unicode escape sequence: "${i.slice(t,t+n)}".`)}function Ut(e,t){let i=e.source.body,r=Z(i,t+2);if(b(r))return{value:String.fromCodePoint(r),size:6};if(Te(r)&&i.charCodeAt(t+6)===92&&i.charCodeAt(t+7)===117){let n=Z(i,t+8);if(Ne(n))return{value:String.fromCodePoint(r,n),size:12}}throw f(e.source,t,`Invalid Unicode escape sequence: "${i.slice(t,t+6)}".`)}function Z(e,t){return L(e.charCodeAt(t))<<12|L(e.charCodeAt(t+1))<<8|L(e.charCodeAt(t+2))<<4|L(e.charCodeAt(t+3))}function L(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Vt(e,t){let i=e.source.body;switch(i.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:`
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw f(e.source,t,`Invalid character escape sequence: "${i.slice(t,t+2)}".`)}function Bt(e,t){let i=e.source.body,r=i.length,n=e.lineStart,s=t+3,o=s,c="",u=[];for(;s<r;){let N=i.charCodeAt(s);if(N===34&&i.charCodeAt(s+1)===34&&i.charCodeAt(s+2)===34){c+=i.slice(o,s),u.push(c);let I=d(e,a.BLOCK_STRING,t,s+3,Ct(u).join(`
`));return e.line+=u.length-1,e.lineStart=n,I}if(N===92&&i.charCodeAt(s+1)===34&&i.charCodeAt(s+2)===34&&i.charCodeAt(s+3)===34){c+=i.slice(o,s),o=s+1,s+=4;continue}if(N===10||N===13){c+=i.slice(o,s),u.push(c),N===13&&i.charCodeAt(s+1)===10?s+=2:++s,c="",o=s,n=s;continue}if(b(N))++s;else if(V(i,s))s+=2;else throw f(e.source,s,`Invalid character within String: ${_(e,s)}.`)}throw f(e.source,s,"Unterminated string.")}function jt(e,t){let i=e.source.body,r=i.length,n=t+1;for(;n<r;){let s=i.charCodeAt(n);if(kt(s))++n;else break}return d(e,a.NAME,t,n,i.slice(t,n))}function G(e,t){if(!e)throw new Error(t)}function Ie(e){return B(e,[])}function B(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return Kt(e,t);default:return String(e)}}function Kt(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";let i=[...t,e];if($t(e)){let r=e.toJSON();if(r!==e)return typeof r=="string"?r:B(r,i)}else if(Array.isArray(e))return Yt(e,i);return Gt(e,i)}function $t(e){return typeof e.toJSON=="function"}function Gt(e,t){let i=Object.entries(e);return i.length===0?"{}":t.length>2?"["+qt(e)+"]":"{ "+i.map(([r,n])=>r+": "+B(n,t)).join(", ")+" }"}function Yt(e,t){if(e.length===0)return"[]";if(t.length>2)return"[Array]";let i=Math.min(10,e.length),r=e.length-i,n=[];for(let s=0;s<i;++s)n.push(B(e[s],t));return r===1?n.push("... 1 more item"):r>1&&n.push(`... ${r} more items`),"["+n.join(", ")+"]"}function qt(e){let t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){let i=e.constructor.name;if(typeof i=="string"&&i!=="")return i}return t}function Xt(e){return Qt(e,ve)}function zt(e,t){let i=new Ht(e,t),r=i.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:i.tokenCount}),r}function M(e){let t=e.value;return ye(e.kind)+(t!=null?` "${t}"`:"")}function ye(e){return Rt(e)?`"${e}"`:e}function Wt(e,t){let i=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(i,t)}function ei(e){let t=[],{startToken:i,endToken:r}=e.loc;for(let n=i;n!==r;n=n.next)n.kind==="Comment"&&t.push({...n,loc:{start:n.start,end:n.end}});return t}function ii(e){if(e?.name==="GraphQLError"){let{message:t,locations:[i]}=e;return Zt(t,{loc:{start:i},cause:e})}return e}function ni(e){let t;try{t=zt(e,ti)}catch(i){throw ii(i)}return t.comments=ei(t),t}var De,ee,Ae,xe,_e,ge,K,ke,te,Ce,Se,be,J,Re,w,ie,Le,S,p,Fe,h,oi,ne,we,Pe,X,re,Ve,je,$e,Ye,se,Je,Qe,R,Xe,We,Ze,ae,oe,li,C,le,et,tt,it,ce,ue,nt,rt,st,at,ot,lt,y,Et,mt,Tt,Nt,It,vt,he,Dt,_t,q,l,a,bt,Jt,Qt,ve,Ht,Zt,ti,ri,si,ai=Oe(()=>{Q();De=Object.defineProperty,ee=(e,t)=>{for(var i in t)De(e,i,{get:t[i],enumerable:!0})},Ae={};ee(Ae,{languages:()=>Tt,options:()=>vt,parsers:()=>he,printers:()=>si});xe=(e,t)=>(i,r,...n)=>i|1&&r==null?void 0:(t.call(r)??r[e]).apply(r,n),_e=String.prototype.replaceAll??function(e,t){return e.global?this.replace(e,t):this.split(e).join(t)},ge=xe("replaceAll",function(){if(typeof this=="string")return _e}),K=ge,ke=()=>{},te=ke,Ce="indent",Se="group",be="if-break",J="line",Re="break-parent",w=te,ie=te;Le={type:Re};S={type:J},p={type:J,soft:!0},Fe={type:J,hard:!0},h=[Fe,Le];oi=U(/\s/u),ne=U(" "),we=U(",; "),Pe=U(/[^\n\r]/u),X=e=>e===`
`||e==="\r"||e==="\u2028"||e==="\u2029";re=Me;Ve=Ue;je=Be;$e=Ke;Ye=Ge;se=qe,Je=class extends Error{name="UnexpectedNodeError";constructor(e,t,i="type"){super(`Unexpected ${t} node ${i}: ${JSON.stringify(e[i])}.`),this.node=e}},Qe=Je,R=null;Xe=10;for(let e=0;e<=Xe;e++)F();We=He,Ze=class{constructor(e,t,i){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=i}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},ae=class{constructor(e,t,i,r,n,s){this.kind=e,this.start=t,this.end=i,this.line=r,this.column=n,this.value=s,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}},oe={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},li=new Set(Object.keys(oe));(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(C||(C={}));le={...oe};for(let e of["ArgumentCoordinate","DirectiveArgumentCoordinate","DirectiveCoordinate","MemberCoordinate","TypeCoordinate"])delete le[e];et=le,tt=We(et,"kind"),it=tt,ce=e=>e.loc.start,ue=e=>e.loc.end,nt="format",rt=/^\s*#[^\S\n]*@(?:noformat|noprettier)\s*(?:\n|$)/u,st=/^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/u,at=e=>st.test(e),ot=e=>rt.test(e),lt=e=>`# @${nt}
${e}`;y=ct;pe.ignoredProperties=new Set(["loc","comments"]);Et={print:ut,massageAstNode:pe,hasPrettierIgnore:ft,insertPragma:lt,printComment:ht,canAttachComment:pt,getVisitorKeys:it},mt=Et,Tt=[{name:"GraphQL",type:"data",aceMode:"graphqlschema",extensions:[".graphql",".gql",".graphqls"],tmScope:"source.graphql",parsers:["graphql"],vscodeLanguageIds:["graphql"],linguistLanguageId:139}],Nt={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},objectWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap object literals.",choices:[{value:"preserve",description:"Keep as multi-line, if there is a newline between the opening brace and first property."},{value:"collapse",description:"Fit to a single line when possible."}]},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."}},It={bracketSpacing:Nt.bracketSpacing},vt=It,he={};ee(he,{graphql:()=>ri});Dt=/\r\n|[\n\r]/g;_t=class fe extends Error{constructor(t,...i){var r,n,s;let{nodes:o,source:c,positions:u,path:N,originalError:I,extensions:g}=xt(i);super(t),this.name="GraphQLError",this.path=N??void 0,this.originalError=I??void 0,this.nodes=W(Array.isArray(o)?o:o?[o]:void 0);let x=W((r=this.nodes)===null||r===void 0?void 0:r.map(m=>m.loc).filter(m=>m!=null));this.source=c??(x==null||(n=x[0])===null||n===void 0?void 0:n.source),this.positions=u??x?.map(m=>m.start),this.locations=u&&c?u.map(m=>Y(c,m)):x?.map(m=>Y(m.source,m.start));let j=yt(I?.extensions)?I?.extensions:void 0;this.extensions=(s=g??j)!==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}}),I!=null&&I.stack?Object.defineProperty(this,"stack",{value:I.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,fe):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 i of this.nodes)i.loc&&(t+=`
`+At(i.loc));else if(this.source&&this.locations)for(let i of this.locations)t+=`
`+de(this.source,i);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(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"})(q||(q={}));(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",e.TYPE_COORDINATE="TypeCoordinate",e.MEMBER_COORDINATE="MemberCoordinate",e.ARGUMENT_COORDINATE="ArgumentCoordinate",e.DIRECTIVE_COORDINATE="DirectiveCoordinate",e.DIRECTIVE_ARGUMENT_COORDINATE="DirectiveArgumentCoordinate"})(l||(l={}));(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.DOT=".",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"})(a||(a={}));bt=class{constructor(e){let t=new ae(a.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==a.EOF)do if(e.next)e=e.next;else{let t=Lt(this,e.end);e.next=t,t.prev=e,e=t}while(e.kind===a.COMMENT);return e}};Jt=globalThis.process&&!0,Qt=Jt?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if(typeof e=="object"&&e!==null){var i;let r=t.prototype[Symbol.toStringTag],n=Symbol.toStringTag in e?e[Symbol.toStringTag]:(i=e.constructor)===null||i===void 0?void 0:i.name;if(r===n){let s=Ie(e);throw new Error(`Cannot use ${r} "${s}" from another module or realm.
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.
https://yarnpkg.com/en/docs/selective-version-resolutions
Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.`)}}return!1},ve=class{constructor(e,t="GraphQL request",i={line:1,column:1}){typeof e=="string"||G(!1,`Body must be a string. Received: ${Ie(e)}.`),this.body=e,this.name=t,this.locationOffset=i,this.locationOffset.line>0||G(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||G(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};Ht=class{constructor(e,t={}){let{lexer:i,...r}=t;if(i)this._lexer=i;else{let n=Xt(e)?e:new ve(e);this._lexer=new bt(n)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let e=this.expectToken(a.NAME);return this.node(e,{kind:l.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:l.DOCUMENT,definitions:this.many(a.SOF,this.parseDefinition,a.EOF)})}parseDefinition(){if(this.peek(a.BRACE_L))return this.parseOperationDefinition();let e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(e&&t.kind===a.BRACE_L)throw f(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(t.kind===a.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(e)throw f(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if(t.value==="extend")return this.parseTypeSystemExtension()}throw this.unexpected(t)}parseOperationDefinition(){let e=this._lexer.token;if(this.peek(a.BRACE_L))return this.node(e,{kind:l.OPERATION_DEFINITION,operation:C.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let t=this.parseDescription(),i=this.parseOperationType(),r;return this.peek(a.NAME)&&(r=this.parseName()),this.node(e,{kind:l.OPERATION_DEFINITION,operation:i,description:t,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let e=this.expectToken(a.NAME);switch(e.value){case"query":return C.QUERY;case"mutation":return C.MUTATION;case"subscription":return C.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(a.PAREN_L,this.parseVariableDefinition,a.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:l.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(a.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(a.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let e=this._lexer.token;return this.expectToken(a.DOLLAR),this.node(e,{kind:l.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:l.SELECTION_SET,selections:this.many(a.BRACE_L,this.parseSelection,a.BRACE_R)})}parseSelection(){return this.peek(a.SPREAD)?this.parseFragment():this.parseField()}parseField(){let e=this._lexer.token,t=this.parseName(),i,r;return this.expectOptionalToken(a.COLON)?(i=t,r=this.parseName()):r=t,this.node(e,{kind:l.FIELD,alias:i,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(a.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){let t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(a.PAREN_L,t,a.PAREN_R)}parseArgument(e=!1){let t=this._lexer.token,i=this.parseName();return this.expectToken(a.COLON),this.node(t,{kind:l.ARGUMENT,name:i,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let e=this._lexer.token;this.expectToken(a.SPREAD);let t=this.expectOptionalKeyword("on");return!t&&this.peek(a.NAME)?this.node(e,{kind:l.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:l.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let e=this._lexer.token,t=this.parseDescription();return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:l.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:l.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(e){let t=this._lexer.token;switch(t.kind){case a.BRACKET_L:return this.parseList(e);case a.BRACE_L:return this.parseObject(e);case a.INT:return this.advanceLexer(),this.node(t,{kind:l.INT,value:t.value});case a.FLOAT:return this.advanceLexer(),this.node(t,{kind:l.FLOAT,value:t.value});case a.STRING:case a.BLOCK_STRING:return this.parseStringLiteral();case a.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:l.BOOLEAN,value:!0});case"false":return this.node(t,{kind:l.BOOLEAN,value:!1});case"null":return this.node(t,{kind:l.NULL});default:return this.node(t,{kind:l.ENUM,value:t.value})}case a.DOLLAR:if(e)if(this.expectToken(a.DOLLAR),this._lexer.token.kind===a.NAME){let i=this._lexer.token.value;throw f(this._lexer.source,t.start,`Unexpected variable "$${i}" in constant value.`)}else throw this.unexpected(t);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:l.STRING,value:e.value,block:e.kind===a.BLOCK_STRING})}parseList(e){let t=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:l.LIST,values:this.any(a.BRACKET_L,t,a.BRACKET_R)})}parseObject(e){let t=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:l.OBJECT,fields:this.any(a.BRACE_L,t,a.BRACE_R)})}parseObjectField(e){let t=this._lexer.token,i=this.parseName();return this.expectToken(a.COLON),this.node(t,{kind:l.OBJECT_FIELD,name:i,value:this.parseValueLiteral(e)})}parseDirectives(e){let t=[];for(;this.peek(a.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){let t=this._lexer.token;return this.expectToken(a.AT),this.node(t,{kind:l.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){let e=this._lexer.token,t;if(this.expectOptionalToken(a.BRACKET_L)){let i=this.parseTypeReference();this.expectToken(a.BRACKET_R),t=this.node(e,{kind:l.LIST_TYPE,type:i})}else t=this.parseNamedType();return this.expectOptionalToken(a.BANG)?this.node(e,{kind:l.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:l.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(a.STRING)||this.peek(a.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");let i=this.parseConstDirectives(),r=this.many(a.BRACE_L,this.parseOperationTypeDefinition,a.BRACE_R);return this.node(e,{kind:l.SCHEMA_DEFINITION,description:t,directives:i,operationTypes:r})}parseOperationTypeDefinition(){let e=this._lexer.token,t=this.parseOperationType();this.expectToken(a.COLON);let i=this.parseNamedType();return this.node(e,{kind:l.OPERATION_TYPE_DEFINITION,operation:t,type:i})}parseScalarTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");let i=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:l.SCALAR_TYPE_DEFINITION,description:t,name:i,directives:r})}parseObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");let i=this.parseName(),r=this.parseImplementsInterfaces(),n=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:l.OBJECT_TYPE_DEFINITION,description:t,name:i,interfaces:r,directives:n,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(a.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(a.BRACE_L,this.parseFieldDefinition,a.BRACE_R)}parseFieldDefinition(){let e=this._lexer.token,t=this.parseDescription(),i=this.parseName(),r=this.parseArgumentDefs();this.expectToken(a.COLON);let n=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(e,{kind:l.FIELD_DEFINITION,description:t,name:i,arguments:r,type:n,directives:s})}parseArgumentDefs(){return this.optionalMany(a.PAREN_L,this.parseInputValueDef,a.PAREN_R)}parseInputValueDef(){let e=this._lexer.token,t=this.parseDescription(),i=this.parseName();this.expectToken(a.COLON);let r=this.parseTypeReference(),n;this.expectOptionalToken(a.EQUALS)&&(n=this.parseConstValueLiteral());let s=this.parseConstDirectives();return this.node(e,{kind:l.INPUT_VALUE_DEFINITION,description:t,name:i,type:r,defaultValue:n,directives:s})}parseInterfaceTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");let i=this.parseName(),r=this.parseImplementsInterfaces(),n=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:l.INTERFACE_TYPE_DEFINITION,description:t,name:i,interfaces:r,directives:n,fields:s})}parseUnionTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");let i=this.parseName(),r=this.parseConstDirectives(),n=this.parseUnionMemberTypes();return this.node(e,{kind:l.UNION_TYPE_DEFINITION,description:t,name:i,directives:r,types:n})}parseUnionMemberTypes(){return this.expectOptionalToken(a.EQUALS)?this.delimitedMany(a.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");let i=this.parseName(),r=this.parseConstDirectives(),n=this.parseEnumValuesDefinition();return this.node(e,{kind:l.ENUM_TYPE_DEFINITION,description:t,name:i,directives:r,values:n})}parseEnumValuesDefinition(){return this.optionalMany(a.BRACE_L,this.parseEnumValueDefinition,a.BRACE_R)}parseEnumValueDefinition(){let e=this._lexer.token,t=this.parseDescription(),i=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:l.ENUM_VALUE_DEFINITION,description:t,name:i,directives:r})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw f(this._lexer.source,this._lexer.token.start,`${M(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");let i=this.parseName(),r=this.parseConstDirectives(),n=this.parseInputFieldsDefinition();return this.node(e,{kind:l.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:i,directives:r,fields:n})}parseInputFieldsDefinition(){return this.optionalMany(a.BRACE_L,this.parseInputValueDef,a.BRACE_R)}parseTypeSystemExtension(){let e=this._lexer.lookahead();if(e.kind===a.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let t=this.parseConstDirectives(),i=this.optionalMany(a.BRACE_L,this.parseOperationTypeDefinition,a.BRACE_R);if(t.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:l.SCHEMA_EXTENSION,directives:t,operationTypes:i})}parseScalarTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let t=this.parseName(),i=this.parseConstDirectives();if(i.length===0)throw this.unexpected();return this.node(e,{kind:l.SCALAR_TYPE_EXTENSION,name:t,directives:i})}parseObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let t=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),n=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:l.OBJECT_TYPE_EXTENSION,name:t,interfaces:i,directives:r,fields:n})}parseInterfaceTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let t=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),n=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:l.INTERFACE_TYPE_EXTENSION,name:t,interfaces:i,directives:r,fields:n})}parseUnionTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let t=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:l.UNION_TYPE_EXTENSION,name:t,directives:i,types:r})}parseEnumTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let t=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:l.ENUM_TYPE_EXTENSION,name:t,directives:i,values:r})}parseInputObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let t=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:l.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:i,fields:r})}parseDirectiveDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(a.AT);let i=this.parseName(),r=this.parseArgumentDefs(),n=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let s=this.parseDirectiveLocations();return this.node(e,{kind:l.DIRECTIVE_DEFINITION,description:t,name:i,arguments:r,repeatable:n,locations:s})}parseDirectiveLocations(){return this.delimitedMany(a.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(q,t.value))return t;throw this.unexpected(e)}parseSchemaCoordinate(){let e=this._lexer.token,t=this.expectOptionalToken(a.AT),i=this.parseName(),r;!t&&this.expectOptionalToken(a.DOT)&&(r=this.parseName());let n;return(t||r)&&this.expectOptionalToken(a.PAREN_L)&&(n=this.parseName(),this.expectToken(a.COLON),this.expectToken(a.PAREN_R)),t?n?this.node(e,{kind:l.DIRECTIVE_ARGUMENT_COORDINATE,name:i,argumentName:n}):this.node(e,{kind:l.DIRECTIVE_COORDINATE,name:i}):r?n?this.node(e,{kind:l.ARGUMENT_COORDINATE,name:i,fieldName:r,argumentName:n}):this.node(e,{kind:l.MEMBER_COORDINATE,name:i,memberName:r}):this.node(e,{kind:l.TYPE_COORDINATE,name:i})}node(e,t){return this._options.noLocation!==!0&&(t.loc=new Ze(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){let t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw f(this._lexer.source,t.start,`Expected ${ye(e)}, found ${M(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){let t=this._lexer.token;if(t.kind===a.NAME&&t.value===e)this.advanceLexer();else throw f(this._lexer.source,t.start,`Expected "${e}", found ${M(t)}.`)}expectOptionalKeyword(e){let t=this._lexer.token;return t.kind===a.NAME&&t.value===e?(this.advanceLexer(),!0):!1}unexpected(e){let t=e??this._lexer.token;return f(this._lexer.source,t.start,`Unexpected ${M(t)}.`)}any(e,t,i){this.expectToken(e);let r=[];for(;!this.expectOptionalToken(i);)r.push(t.call(this));return r}optionalMany(e,t,i){if(this.expectOptionalToken(e)){let r=[];do r.push(t.call(this));while(!this.expectOptionalToken(i));return r}return[]}many(e,t,i){this.expectToken(e);let r=[];do r.push(t.call(this));while(!this.expectOptionalToken(i));return r}delimitedMany(e,t){this.expectOptionalToken(e);let i=[];do i.push(t.call(this));while(this.expectOptionalToken(e));return i}advanceLexer(){let{maxTokens:e}=this._options,t=this._lexer.advance();if(t.kind!==a.EOF&&(++this._tokenCounter,e!==void 0&&this._tokenCounter>e))throw f(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};Zt=Wt;ti={allowLegacyFragmentVariables:!0};ri={parse:ni,astFormat:"graphql",hasPragma:at,hasIgnorePragma:ot,locStart:ce,locEnd:ue},si={graphql:mt}});ai();export{Ae as default,Tt as languages,vt as options,he as parsers,si as printers};