@builtbystack/sq-shopify-theme-sdk 0.0.2 → 0.0.4

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.
@@ -1,14 +1,14 @@
1
- (function(k,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(k=typeof globalThis<"u"?globalThis:k||self,S(k.SQ={}))})(this,function(k){"use strict";var pn=Object.defineProperty;var dn=(k,S,P)=>S in k?pn(k,S,{enumerable:!0,configurable:!0,writable:!0,value:P}):k[S]=P;var Ye=(k,S,P)=>(dn(k,typeof S!="symbol"?S+"":S,P),P);function S(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const P=JSON,ze=e=>e.toUpperCase(),Qe=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},Je=(e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0},Xe=(e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0},We=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0};function J(e,t){if(!!!e)throw new Error(t)}function Ze(e){return typeof e=="object"&&e!==null}function Ke(e,t){if(!!!e)throw new Error(t??"Unexpected invariant triggered.")}const et=/\r\n|[\n\r]/g;function le(e,t){let n=0,r=1;for(const i of e.body.matchAll(et)){if(typeof i.index=="number"||Ke(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function tt(e){return be(e.source,le(e.source,e.start))}function be(e,t){const n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,c=t.line+s,u=t.line===1?n:0,p=t.column+u,d=`${e.name}:${c}:${p}
2
- `,y=r.split(/\r\n|[\n\r]/g),E=y[i];if(E.length>120){const T=Math.floor(p/80),A=p%80,m=[];for(let b=0;b<E.length;b+=80)m.push(E.slice(b,b+80));return d+xe([[`${c} |`,m[0]],...m.slice(1,T+1).map(b=>["|",b]),["|","^".padStart(A)],["|",m[T+1]]])}return d+xe([[`${c-1} |`,y[i-1]],[`${c} |`,E],["|","^".padStart(p)],[`${c+1} |`,y[i+1]]])}function xe(e){const 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(`
3
- `)}function nt(e){const 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}class he extends Error{constructor(t,...n){var r,i,s;const{nodes:c,source:u,positions:p,path:d,originalError:y,extensions:E}=nt(n);super(t),this.name="GraphQLError",this.path=d??void 0,this.originalError=y??void 0,this.nodes=Ie(Array.isArray(c)?c:c?[c]:void 0);const T=Ie((r=this.nodes)===null||r===void 0?void 0:r.map(m=>m.loc).filter(m=>m!=null));this.source=u??(T==null||(i=T[0])===null||i===void 0?void 0:i.source),this.positions=p??(T==null?void 0:T.map(m=>m.start)),this.locations=p&&u?p.map(m=>le(u,m)):T==null?void 0:T.map(m=>le(m.source,m.start));const A=Ze(y==null?void 0:y.extensions)?y==null?void 0:y.extensions:void 0;this.extensions=(s=E??A)!==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}}),y!=null&&y.stack?Object.defineProperty(this,"stack",{value:y.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,he):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(const n of this.nodes)n.loc&&(t+=`
1
+ (function(w,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(w=typeof globalThis<"u"?globalThis:w||self,S(w.SQ={}))})(this,function(w){"use strict";var pn=Object.defineProperty;var dn=(w,S,P)=>S in w?pn(w,S,{enumerable:!0,configurable:!0,writable:!0,value:P}):w[S]=P;var Ye=(w,S,P)=>(dn(w,typeof S!="symbol"?S+"":S,P),P);function S(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const P=JSON,ze=e=>e.toUpperCase(),Qe=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},Je=(e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0},Xe=(e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0},We=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0};function J(e,t){if(!!!e)throw new Error(t)}function Ze(e){return typeof e=="object"&&e!==null}function Ke(e,t){if(!!!e)throw new Error(t??"Unexpected invariant triggered.")}const et=/\r\n|[\n\r]/g;function le(e,t){let n=0,r=1;for(const i of e.body.matchAll(et)){if(typeof i.index=="number"||Ke(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function tt(e){return be(e.source,le(e.source,e.start))}function be(e,t){const n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,c=t.line+s,u=t.line===1?n:0,h=t.column+u,d=`${e.name}:${c}:${h}
2
+ `,y=r.split(/\r\n|[\n\r]/g),E=y[i];if(E.length>120){const T=Math.floor(h/80),A=h%80,m=[];for(let b=0;b<E.length;b+=80)m.push(E.slice(b,b+80));return d+xe([[`${c} |`,m[0]],...m.slice(1,T+1).map(b=>["|",b]),["|","^".padStart(A)],["|",m[T+1]]])}return d+xe([[`${c-1} |`,y[i-1]],[`${c} |`,E],["|","^".padStart(h)],[`${c+1} |`,y[i+1]]])}function xe(e){const 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(`
3
+ `)}function nt(e){const 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}class he extends Error{constructor(t,...n){var r,i,s;const{nodes:c,source:u,positions:h,path:d,originalError:y,extensions:E}=nt(n);super(t),this.name="GraphQLError",this.path=d??void 0,this.originalError=y??void 0,this.nodes=Ie(Array.isArray(c)?c:c?[c]:void 0);const T=Ie((r=this.nodes)===null||r===void 0?void 0:r.map(m=>m.loc).filter(m=>m!=null));this.source=u??(T==null||(i=T[0])===null||i===void 0?void 0:i.source),this.positions=h??(T==null?void 0:T.map(m=>m.start)),this.locations=h&&u?h.map(m=>le(u,m)):T==null?void 0:T.map(m=>le(m.source,m.start));const A=Ze(y==null?void 0:y.extensions)?y==null?void 0:y.extensions:void 0;this.extensions=(s=E??A)!==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}}),y!=null&&y.stack?Object.defineProperty(this,"stack",{value:y.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,he):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(const n of this.nodes)n.loc&&(t+=`
4
4
 
5
5
  `+tt(n.loc));else if(this.source&&this.locations)for(const n of this.locations)t+=`
6
6
 
7
- `+be(this.source,n);return t}toJSON(){const 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 Ie(e){return e===void 0||e.length===0?void 0:e}function I(e,t,n){return new he(`Syntax Error: ${n}`,{source:e,positions:[t]})}class it{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}}}class Oe{constructor(t,n,r,i,s,c){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=c,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const _e={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(_e));function De(e){const t=e==null?void 0:e.kind;return typeof t=="string"&&rt.has(t)}var U;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(U||(U={}));var pe;(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"})(pe||(pe={}));var f;(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"})(f||(f={}));function de(e){return e===9||e===32}function G(e){return e>=48&&e<=57}function Se(e){return e>=97&&e<=122||e>=65&&e<=90}function Ce(e){return Se(e)||e===95}function st(e){return Se(e)||G(e)||e===95}function ot(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let c=0;c<e.length;++c){var s;const u=e[c],p=at(u);p!==u.length&&(r=(s=r)!==null&&s!==void 0?s:c,i=c,c!==0&&p<n&&(n=p))}return e.map((c,u)=>u===0?c:c.slice(n)).slice((t=r)!==null&&t!==void 0?t:0,i+1)}function at(e){let t=0;for(;t<e.length&&de(e.charCodeAt(t));)++t;return t}function ct(e,t){const n=e.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=r.length===1,s=r.length>1&&r.slice(1).every(A=>A.length===0||de(A.charCodeAt(0))),c=n.endsWith('\\"""'),u=e.endsWith('"')&&!c,p=e.endsWith("\\"),d=u||p,y=!(t!=null&&t.minimize)&&(!i||e.length>70||d||s||c);let E="";const T=i&&de(e.charCodeAt(0));return(y&&!T||s)&&(E+=`
7
+ `+be(this.source,n);return t}toJSON(){const 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 Ie(e){return e===void 0||e.length===0?void 0:e}function I(e,t,n){return new he(`Syntax Error: ${n}`,{source:e,positions:[t]})}class it{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}}}class Oe{constructor(t,n,r,i,s,c){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=c,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const _e={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(_e));function De(e){const t=e==null?void 0:e.kind;return typeof t=="string"&&rt.has(t)}var U;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(U||(U={}));var pe;(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"})(pe||(pe={}));var f;(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"})(f||(f={}));function de(e){return e===9||e===32}function G(e){return e>=48&&e<=57}function Se(e){return e>=97&&e<=122||e>=65&&e<=90}function Ce(e){return Se(e)||e===95}function st(e){return Se(e)||G(e)||e===95}function ot(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let c=0;c<e.length;++c){var s;const u=e[c],h=at(u);h!==u.length&&(r=(s=r)!==null&&s!==void 0?s:c,i=c,c!==0&&h<n&&(n=h))}return e.map((c,u)=>u===0?c:c.slice(n)).slice((t=r)!==null&&t!==void 0?t:0,i+1)}function at(e){let t=0;for(;t<e.length&&de(e.charCodeAt(t));)++t;return t}function ct(e,t){const n=e.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=r.length===1,s=r.length>1&&r.slice(1).every(A=>A.length===0||de(A.charCodeAt(0))),c=n.endsWith('\\"""'),u=e.endsWith('"')&&!c,h=e.endsWith("\\"),d=u||h,y=!(t!=null&&t.minimize)&&(!i||e.length>70||d||s||c);let E="";const T=i&&de(e.charCodeAt(0));return(y&&!T||s)&&(E+=`
8
8
  `),E+=n,(y||d)&&(E+=`
9
- `),'"""'+E+'"""'}var a;(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"})(a||(a={}));class ut{constructor(t){const n=new Oe(a.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!==a.EOF)do if(t.next)t=t.next;else{const n=ht(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===a.COMMENT);return t}}function lt(e){return e===a.BANG||e===a.DOLLAR||e===a.AMP||e===a.PAREN_L||e===a.PAREN_R||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 V(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function X(e,t){return ke(e.charCodeAt(t))&&we(e.charCodeAt(t+1))}function ke(e){return e>=55296&&e<=56319}function we(e){return e>=56320&&e<=57343}function B(e,t){const n=e.source.body.codePointAt(t);if(n===void 0)return a.EOF;if(n>=32&&n<=126){const r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function x(e,t,n,r,i){const s=e.line,c=1+n-e.lineStart;return new Oe(t,n,r,s,c,i)}function ht(e,t){const n=e.source.body,r=n.length;let i=t;for(;i<r;){const 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 pt(e,i);case 33:return x(e,a.BANG,i,i+1);case 36:return x(e,a.DOLLAR,i,i+1);case 38:return x(e,a.AMP,i,i+1);case 40:return x(e,a.PAREN_L,i,i+1);case 41:return x(e,a.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return x(e,a.SPREAD,i,i+3);break;case 58:return x(e,a.COLON,i,i+1);case 61:return x(e,a.EQUALS,i,i+1);case 64:return x(e,a.AT,i,i+1);case 91:return x(e,a.BRACKET_L,i,i+1);case 93:return x(e,a.BRACKET_R,i,i+1);case 123:return x(e,a.BRACE_L,i,i+1);case 124:return x(e,a.PIPE,i,i+1);case 125:return x(e,a.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?Tt(e,i):ft(e,i)}if(G(s)||s===45)return dt(e,i,s);if(Ce(s))return vt(e,i);throw I(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:V(s)||X(n,i)?`Unexpected character: ${B(e,i)}.`:`Invalid character: ${B(e,i)}.`)}return x(e,a.EOF,r,r)}function pt(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const s=n.charCodeAt(i);if(s===10||s===13)break;if(V(s))++i;else if(X(n,i))i+=2;else break}return x(e,a.COMMENT,t,i,n.slice(t+1,i))}function dt(e,t,n){const r=e.source.body;let i=t,s=n,c=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),G(s))throw I(e.source,i,`Invalid number, unexpected digit after 0: ${B(e,i)}.`)}else i=fe(e,i,s),s=r.charCodeAt(i);if(s===46&&(c=!0,s=r.charCodeAt(++i),i=fe(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(c=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=fe(e,i,s),s=r.charCodeAt(i)),s===46||Ce(s))throw I(e.source,i,`Invalid number, expected digit but got: ${B(e,i)}.`);return x(e,c?a.FLOAT:a.INT,t,i,r.slice(t,i))}function fe(e,t,n){if(!G(n))throw I(e.source,t,`Invalid number, expected digit but got: ${B(e,t)}.`);const r=e.source.body;let i=t+1;for(;G(r.charCodeAt(i));)++i;return i}function ft(e,t){const n=e.source.body,r=n.length;let i=t+1,s=i,c="";for(;i<r;){const u=n.charCodeAt(i);if(u===34)return c+=n.slice(s,i),x(e,a.STRING,t,i+1,c);if(u===92){c+=n.slice(s,i);const p=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?yt(e,i):mt(e,i):Et(e,i);c+=p.value,i+=p.size,s=i;continue}if(u===10||u===13)break;if(V(u))++i;else if(X(n,i))i+=2;else throw I(e.source,i,`Invalid character within String: ${B(e,i)}.`)}throw I(e.source,i,"Unterminated string.")}function yt(e,t){const n=e.source.body;let r=0,i=3;for(;i<12;){const s=n.charCodeAt(t+i++);if(s===125){if(i<5||!V(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|H(s),r<0)break}throw I(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function mt(e,t){const n=e.source.body,r=Re(n,t+2);if(V(r))return{value:String.fromCodePoint(r),size:6};if(ke(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){const i=Re(n,t+8);if(we(i))return{value:String.fromCodePoint(r,i),size:12}}throw I(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function Re(e,t){return H(e.charCodeAt(t))<<12|H(e.charCodeAt(t+1))<<8|H(e.charCodeAt(t+2))<<4|H(e.charCodeAt(t+3))}function H(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Et(e,t){const 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:`
10
- `,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw I(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function Tt(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,s=t+3,c=s,u="";const p=[];for(;s<r;){const d=n.charCodeAt(s);if(d===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){u+=n.slice(c,s),p.push(u);const y=x(e,a.BLOCK_STRING,t,s+3,ot(p).join(`
11
- `));return e.line+=p.length-1,e.lineStart=i,y}if(d===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){u+=n.slice(c,s),c=s+1,s+=4;continue}if(d===10||d===13){u+=n.slice(c,s),p.push(u),d===13&&n.charCodeAt(s+1)===10?s+=2:++s,u="",c=s,i=s;continue}if(V(d))++s;else if(X(n,s))s+=2;else throw I(e.source,s,`Invalid character within String: ${B(e,s)}.`)}throw I(e.source,s,"Unterminated string.")}function vt(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const s=n.charCodeAt(i);if(st(s))++i;else break}return x(e,a.NAME,t,i,n.slice(t,i))}const gt=10,Le=2;function ye(e){return W(e,[])}function W(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return Nt(e,t);default:return String(e)}}function Nt(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(At(e)){const r=e.toJSON();if(r!==e)return typeof r=="string"?r:W(r,n)}else if(Array.isArray(e))return xt(e,n);return bt(e,n)}function At(e){return typeof e.toJSON=="function"}function bt(e,t){const n=Object.entries(e);return n.length===0?"{}":t.length>Le?"["+It(e)+"]":"{ "+n.map(([i,s])=>i+": "+W(s,t)).join(", ")+" }"}function xt(e,t){if(e.length===0)return"[]";if(t.length>Le)return"[Array]";const n=Math.min(gt,e.length),r=e.length-n,i=[];for(let s=0;s<n;++s)i.push(W(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function It(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){const n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}const Ot=globalThis.process&&globalThis.process.env.NODE_ENV==="production"?function(t,n){return t instanceof n}:function(t,n){if(t instanceof n)return!0;if(typeof t=="object"&&t!==null){var r;const i=n.prototype[Symbol.toStringTag],s=Symbol.toStringTag in t?t[Symbol.toStringTag]:(r=t.constructor)===null||r===void 0?void 0:r.name;if(i===s){const c=ye(t);throw new Error(`Cannot use ${i} "${c}" from another module or realm.
9
+ `),'"""'+E+'"""'}var a;(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"})(a||(a={}));class ut{constructor(t){const n=new Oe(a.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!==a.EOF)do if(t.next)t=t.next;else{const n=ht(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===a.COMMENT);return t}}function lt(e){return e===a.BANG||e===a.DOLLAR||e===a.AMP||e===a.PAREN_L||e===a.PAREN_R||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 V(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function X(e,t){return we(e.charCodeAt(t))&&ke(e.charCodeAt(t+1))}function we(e){return e>=55296&&e<=56319}function ke(e){return e>=56320&&e<=57343}function B(e,t){const n=e.source.body.codePointAt(t);if(n===void 0)return a.EOF;if(n>=32&&n<=126){const r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function x(e,t,n,r,i){const s=e.line,c=1+n-e.lineStart;return new Oe(t,n,r,s,c,i)}function ht(e,t){const n=e.source.body,r=n.length;let i=t;for(;i<r;){const 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 pt(e,i);case 33:return x(e,a.BANG,i,i+1);case 36:return x(e,a.DOLLAR,i,i+1);case 38:return x(e,a.AMP,i,i+1);case 40:return x(e,a.PAREN_L,i,i+1);case 41:return x(e,a.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return x(e,a.SPREAD,i,i+3);break;case 58:return x(e,a.COLON,i,i+1);case 61:return x(e,a.EQUALS,i,i+1);case 64:return x(e,a.AT,i,i+1);case 91:return x(e,a.BRACKET_L,i,i+1);case 93:return x(e,a.BRACKET_R,i,i+1);case 123:return x(e,a.BRACE_L,i,i+1);case 124:return x(e,a.PIPE,i,i+1);case 125:return x(e,a.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?Tt(e,i):ft(e,i)}if(G(s)||s===45)return dt(e,i,s);if(Ce(s))return vt(e,i);throw I(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:V(s)||X(n,i)?`Unexpected character: ${B(e,i)}.`:`Invalid character: ${B(e,i)}.`)}return x(e,a.EOF,r,r)}function pt(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const s=n.charCodeAt(i);if(s===10||s===13)break;if(V(s))++i;else if(X(n,i))i+=2;else break}return x(e,a.COMMENT,t,i,n.slice(t+1,i))}function dt(e,t,n){const r=e.source.body;let i=t,s=n,c=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),G(s))throw I(e.source,i,`Invalid number, unexpected digit after 0: ${B(e,i)}.`)}else i=fe(e,i,s),s=r.charCodeAt(i);if(s===46&&(c=!0,s=r.charCodeAt(++i),i=fe(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(c=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=fe(e,i,s),s=r.charCodeAt(i)),s===46||Ce(s))throw I(e.source,i,`Invalid number, expected digit but got: ${B(e,i)}.`);return x(e,c?a.FLOAT:a.INT,t,i,r.slice(t,i))}function fe(e,t,n){if(!G(n))throw I(e.source,t,`Invalid number, expected digit but got: ${B(e,t)}.`);const r=e.source.body;let i=t+1;for(;G(r.charCodeAt(i));)++i;return i}function ft(e,t){const n=e.source.body,r=n.length;let i=t+1,s=i,c="";for(;i<r;){const u=n.charCodeAt(i);if(u===34)return c+=n.slice(s,i),x(e,a.STRING,t,i+1,c);if(u===92){c+=n.slice(s,i);const h=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?yt(e,i):mt(e,i):Et(e,i);c+=h.value,i+=h.size,s=i;continue}if(u===10||u===13)break;if(V(u))++i;else if(X(n,i))i+=2;else throw I(e.source,i,`Invalid character within String: ${B(e,i)}.`)}throw I(e.source,i,"Unterminated string.")}function yt(e,t){const n=e.source.body;let r=0,i=3;for(;i<12;){const s=n.charCodeAt(t+i++);if(s===125){if(i<5||!V(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|H(s),r<0)break}throw I(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function mt(e,t){const n=e.source.body,r=Re(n,t+2);if(V(r))return{value:String.fromCodePoint(r),size:6};if(we(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){const i=Re(n,t+8);if(ke(i))return{value:String.fromCodePoint(r,i),size:12}}throw I(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function Re(e,t){return H(e.charCodeAt(t))<<12|H(e.charCodeAt(t+1))<<8|H(e.charCodeAt(t+2))<<4|H(e.charCodeAt(t+3))}function H(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Et(e,t){const 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:`
10
+ `,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw I(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function Tt(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,s=t+3,c=s,u="";const h=[];for(;s<r;){const d=n.charCodeAt(s);if(d===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){u+=n.slice(c,s),h.push(u);const y=x(e,a.BLOCK_STRING,t,s+3,ot(h).join(`
11
+ `));return e.line+=h.length-1,e.lineStart=i,y}if(d===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){u+=n.slice(c,s),c=s+1,s+=4;continue}if(d===10||d===13){u+=n.slice(c,s),h.push(u),d===13&&n.charCodeAt(s+1)===10?s+=2:++s,u="",c=s,i=s;continue}if(V(d))++s;else if(X(n,s))s+=2;else throw I(e.source,s,`Invalid character within String: ${B(e,s)}.`)}throw I(e.source,s,"Unterminated string.")}function vt(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const s=n.charCodeAt(i);if(st(s))++i;else break}return x(e,a.NAME,t,i,n.slice(t,i))}const gt=10,Le=2;function ye(e){return W(e,[])}function W(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return Nt(e,t);default:return String(e)}}function Nt(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(At(e)){const r=e.toJSON();if(r!==e)return typeof r=="string"?r:W(r,n)}else if(Array.isArray(e))return xt(e,n);return bt(e,n)}function At(e){return typeof e.toJSON=="function"}function bt(e,t){const n=Object.entries(e);return n.length===0?"{}":t.length>Le?"["+It(e)+"]":"{ "+n.map(([i,s])=>i+": "+W(s,t)).join(", ")+" }"}function xt(e,t){if(e.length===0)return"[]";if(t.length>Le)return"[Array]";const n=Math.min(gt,e.length),r=e.length-n,i=[];for(let s=0;s<n;++s)i.push(W(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function It(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){const n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}const Ot=globalThis.process&&globalThis.process.env.NODE_ENV==="production"?function(t,n){return t instanceof n}:function(t,n){if(t instanceof n)return!0;if(typeof t=="object"&&t!==null){var r;const i=n.prototype[Symbol.toStringTag],s=Symbol.toStringTag in t?t[Symbol.toStringTag]:(r=t.constructor)===null||r===void 0?void 0:r.name;if(i===s){const c=ye(t);throw new Error(`Cannot use ${i} "${c}" from another module or realm.
12
12
 
13
13
  Ensure that there is only one instance of "graphql" in the node_modules
14
14
  directory. If different versions of "graphql" are the dependencies of other
@@ -19,34 +19,34 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
19
19
  Duplicate "graphql" modules cannot be used at the same time since different
20
20
  versions may have different capabilities and behavior. The data from one
21
21
  version used in the function from another could produce confusing and
22
- spurious results.`)}}return!1};class Fe{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||J(!1,`Body must be a string. Received: ${ye(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||J(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||J(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function _t(e){return Ot(e,Fe)}function Pe(e,t){return new Dt(e,t).parseDocument()}class Dt{constructor(t,n={}){const r=_t(t)?t:new Fe(t);this._lexer=new ut(r),this._options=n,this._tokenCounter=0}parseName(){const t=this.expectToken(a.NAME);return this.node(t,{kind:f.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:f.DOCUMENT,definitions:this.many(a.SOF,this.parseDefinition,a.EOF)})}parseDefinition(){if(this.peek(a.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===a.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 I(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(){const t=this._lexer.token;if(this.peek(a.BRACE_L))return this.node(t,{kind:f.OPERATION_DEFINITION,operation:U.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseOperationType();let r;return this.peek(a.NAME)&&(r=this.parseName()),this.node(t,{kind:f.OPERATION_DEFINITION,operation:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(a.NAME);switch(t.value){case"query":return U.QUERY;case"mutation":return U.MUTATION;case"subscription":return U.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(a.PAREN_L,this.parseVariableDefinition,a.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:f.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(a.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(a.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(a.DOLLAR),this.node(t,{kind:f.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:f.SELECTION_SET,selections:this.many(a.BRACE_L,this.parseSelection,a.BRACE_R)})}parseSelection(){return this.peek(a.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,n=this.parseName();let r,i;return this.expectOptionalToken(a.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:f.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(a.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){const n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(a.PAREN_L,n,a.PAREN_R)}parseArgument(t=!1){const n=this._lexer.token,r=this.parseName();return this.expectToken(a.COLON),this.node(n,{kind:f.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(a.SPREAD);const n=this.expectOptionalKeyword("on");return!n&&this.peek(a.NAME)?this.node(t,{kind:f.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:f.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:f.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:f.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){const n=this._lexer.token;switch(n.kind){case a.BRACKET_L:return this.parseList(t);case a.BRACE_L:return this.parseObject(t);case a.INT:return this.advanceLexer(),this.node(n,{kind:f.INT,value:n.value});case a.FLOAT:return this.advanceLexer(),this.node(n,{kind:f.FLOAT,value:n.value});case a.STRING:case a.BLOCK_STRING:return this.parseStringLiteral();case a.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:f.BOOLEAN,value:!0});case"false":return this.node(n,{kind:f.BOOLEAN,value:!1});case"null":return this.node(n,{kind:f.NULL});default:return this.node(n,{kind:f.ENUM,value:n.value})}case a.DOLLAR:if(t)if(this.expectToken(a.DOLLAR),this._lexer.token.kind===a.NAME){const r=this._lexer.token.value;throw I(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(){const t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:f.STRING,value:t.value,block:t.kind===a.BLOCK_STRING})}parseList(t){const n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:f.LIST,values:this.any(a.BRACKET_L,n,a.BRACKET_R)})}parseObject(t){const n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:f.OBJECT,fields:this.any(a.BRACE_L,n,a.BRACE_R)})}parseObjectField(t){const n=this._lexer.token,r=this.parseName();return this.expectToken(a.COLON),this.node(n,{kind:f.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){const n=[];for(;this.peek(a.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const n=this._lexer.token;return this.expectToken(a.AT),this.node(n,{kind:f.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let n;if(this.expectOptionalToken(a.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(a.BRACKET_R),n=this.node(t,{kind:f.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(a.BANG)?this.node(t,{kind:f.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:f.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(a.STRING)||this.peek(a.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");const r=this.parseConstDirectives(),i=this.many(a.BRACE_L,this.parseOperationTypeDefinition,a.BRACE_R);return this.node(t,{kind:f.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,n=this.parseOperationType();this.expectToken(a.COLON);const r=this.parseNamedType();return this.node(t,{kind:f.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");const r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:f.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),c=this.parseFieldsDefinition();return this.node(t,{kind:f.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:c})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(a.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(a.BRACE_L,this.parseFieldDefinition,a.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(a.COLON);const s=this.parseTypeReference(),c=this.parseConstDirectives();return this.node(t,{kind:f.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:c})}parseArgumentDefs(){return this.optionalMany(a.PAREN_L,this.parseInputValueDef,a.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(a.COLON);const i=this.parseTypeReference();let s;this.expectOptionalToken(a.EQUALS)&&(s=this.parseConstValueLiteral());const c=this.parseConstDirectives();return this.node(t,{kind:f.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:c})}parseInterfaceTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),c=this.parseFieldsDefinition();return this.node(t,{kind:f.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:c})}parseUnionTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:f.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(a.EQUALS)?this.delimitedMany(a.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:f.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(a.BRACE_L,this.parseEnumValueDefinition,a.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:f.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 I(this._lexer.source,this._lexer.token.start,`${Z(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:f.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(a.BRACE_L,this.parseInputValueDef,a.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===a.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(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.optionalMany(a.BRACE_L,this.parseOperationTypeDefinition,a.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:f.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(t,{kind:f.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const 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:f.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const 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:f.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(a.AT);const r=this.parseName(),i=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const c=this.parseDirectiveLocations();return this.node(t,{kind:f.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:s,locations:c})}parseDirectiveLocations(){return this.delimitedMany(a.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(pe,n.value))return n;throw this.unexpected(t)}node(t,n){return this._options.noLocation!==!0&&(n.loc=new it(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){const n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw I(this._lexer.source,n.start,`Expected ${Be(t)}, found ${Z(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){const n=this._lexer.token;if(n.kind===a.NAME&&n.value===t)this.advanceLexer();else throw I(this._lexer.source,n.start,`Expected "${t}", found ${Z(n)}.`)}expectOptionalKeyword(t){const n=this._lexer.token;return n.kind===a.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){const n=t??this._lexer.token;return I(this._lexer.source,n.start,`Unexpected ${Z(n)}.`)}any(t,n,r){this.expectToken(t);const i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}return[]}many(t,n,r){this.expectToken(t);const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);const r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){const{maxTokens:t}=this._options,n=this._lexer.advance();if(t!==void 0&&n.kind!==a.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw I(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function Z(e){const t=e.value;return Be(e.kind)+(t!=null?` "${t}"`:"")}function Be(e){return lt(e)?`"${e}"`:e}function St(e){return`"${e.replace(Ct,kt)}"`}const Ct=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function kt(e){return wt[e.charCodeAt(0)]}const wt=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],Rt=Object.freeze({});function Lt(e,t,n=_e){const r=new Map;for(const C of Object.values(f))r.set(C,Ft(t,C));let i,s=Array.isArray(e),c=[e],u=-1,p=[],d=e,y,E;const T=[],A=[];do{u++;const C=u===c.length,oe=C&&p.length!==0;if(C){if(y=A.length===0?void 0:T[T.length-1],d=E,E=A.pop(),oe)if(s){d=d.slice();let R=0;for(const[$,ae]of p){const ce=$-R;ae===null?(d.splice(ce,1),R++):d[ce]=ae}}else{d=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));for(const[R,$]of p)d[R]=$}u=i.index,c=i.keys,p=i.edits,s=i.inArray,i=i.prev}else if(E){if(y=s?u:c[u],d=E[y],d==null)continue;T.push(y)}let L;if(!Array.isArray(d)){var m,b;De(d)||J(!1,`Invalid AST Node: ${ye(d)}.`);const R=C?(m=r.get(d.kind))===null||m===void 0?void 0:m.leave:(b=r.get(d.kind))===null||b===void 0?void 0:b.enter;if(L=R==null?void 0:R.call(t,d,y,E,T,A),L===Rt)break;if(L===!1){if(!C){T.pop();continue}}else if(L!==void 0&&(p.push([y,L]),!C))if(De(L))d=L;else{T.pop();continue}}if(L===void 0&&oe&&p.push([y,d]),C)T.pop();else{var D;i={inArray:s,index:u,keys:c,edits:p,prev:i},s=Array.isArray(d),c=s?d:(D=n[d.kind])!==null&&D!==void 0?D:[],u=-1,p=[],E&&A.push(E),E=d}}while(i!==void 0);return p.length!==0?p[p.length-1][1]:e}function Ft(e,t){const n=e[t];return typeof n=="object"?n:typeof n=="function"?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function Pt(e){return Lt(e,Mt)}const Bt=80,Mt={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>h(e.definitions,`
22
+ spurious results.`)}}return!1};class Fe{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||J(!1,`Body must be a string. Received: ${ye(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||J(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||J(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function _t(e){return Ot(e,Fe)}function Pe(e,t){return new Dt(e,t).parseDocument()}class Dt{constructor(t,n={}){const r=_t(t)?t:new Fe(t);this._lexer=new ut(r),this._options=n,this._tokenCounter=0}parseName(){const t=this.expectToken(a.NAME);return this.node(t,{kind:f.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:f.DOCUMENT,definitions:this.many(a.SOF,this.parseDefinition,a.EOF)})}parseDefinition(){if(this.peek(a.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===a.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 I(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(){const t=this._lexer.token;if(this.peek(a.BRACE_L))return this.node(t,{kind:f.OPERATION_DEFINITION,operation:U.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseOperationType();let r;return this.peek(a.NAME)&&(r=this.parseName()),this.node(t,{kind:f.OPERATION_DEFINITION,operation:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(a.NAME);switch(t.value){case"query":return U.QUERY;case"mutation":return U.MUTATION;case"subscription":return U.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(a.PAREN_L,this.parseVariableDefinition,a.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:f.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(a.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(a.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(a.DOLLAR),this.node(t,{kind:f.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:f.SELECTION_SET,selections:this.many(a.BRACE_L,this.parseSelection,a.BRACE_R)})}parseSelection(){return this.peek(a.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,n=this.parseName();let r,i;return this.expectOptionalToken(a.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:f.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(a.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){const n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(a.PAREN_L,n,a.PAREN_R)}parseArgument(t=!1){const n=this._lexer.token,r=this.parseName();return this.expectToken(a.COLON),this.node(n,{kind:f.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(a.SPREAD);const n=this.expectOptionalKeyword("on");return!n&&this.peek(a.NAME)?this.node(t,{kind:f.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:f.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:f.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:f.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){const n=this._lexer.token;switch(n.kind){case a.BRACKET_L:return this.parseList(t);case a.BRACE_L:return this.parseObject(t);case a.INT:return this.advanceLexer(),this.node(n,{kind:f.INT,value:n.value});case a.FLOAT:return this.advanceLexer(),this.node(n,{kind:f.FLOAT,value:n.value});case a.STRING:case a.BLOCK_STRING:return this.parseStringLiteral();case a.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:f.BOOLEAN,value:!0});case"false":return this.node(n,{kind:f.BOOLEAN,value:!1});case"null":return this.node(n,{kind:f.NULL});default:return this.node(n,{kind:f.ENUM,value:n.value})}case a.DOLLAR:if(t)if(this.expectToken(a.DOLLAR),this._lexer.token.kind===a.NAME){const r=this._lexer.token.value;throw I(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(){const t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:f.STRING,value:t.value,block:t.kind===a.BLOCK_STRING})}parseList(t){const n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:f.LIST,values:this.any(a.BRACKET_L,n,a.BRACKET_R)})}parseObject(t){const n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:f.OBJECT,fields:this.any(a.BRACE_L,n,a.BRACE_R)})}parseObjectField(t){const n=this._lexer.token,r=this.parseName();return this.expectToken(a.COLON),this.node(n,{kind:f.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){const n=[];for(;this.peek(a.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const n=this._lexer.token;return this.expectToken(a.AT),this.node(n,{kind:f.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let n;if(this.expectOptionalToken(a.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(a.BRACKET_R),n=this.node(t,{kind:f.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(a.BANG)?this.node(t,{kind:f.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:f.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(a.STRING)||this.peek(a.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");const r=this.parseConstDirectives(),i=this.many(a.BRACE_L,this.parseOperationTypeDefinition,a.BRACE_R);return this.node(t,{kind:f.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,n=this.parseOperationType();this.expectToken(a.COLON);const r=this.parseNamedType();return this.node(t,{kind:f.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");const r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:f.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),c=this.parseFieldsDefinition();return this.node(t,{kind:f.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:c})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(a.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(a.BRACE_L,this.parseFieldDefinition,a.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(a.COLON);const s=this.parseTypeReference(),c=this.parseConstDirectives();return this.node(t,{kind:f.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:c})}parseArgumentDefs(){return this.optionalMany(a.PAREN_L,this.parseInputValueDef,a.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(a.COLON);const i=this.parseTypeReference();let s;this.expectOptionalToken(a.EQUALS)&&(s=this.parseConstValueLiteral());const c=this.parseConstDirectives();return this.node(t,{kind:f.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:c})}parseInterfaceTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),c=this.parseFieldsDefinition();return this.node(t,{kind:f.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:c})}parseUnionTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:f.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(a.EQUALS)?this.delimitedMany(a.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:f.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(a.BRACE_L,this.parseEnumValueDefinition,a.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:f.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 I(this._lexer.source,this._lexer.token.start,`${Z(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:f.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(a.BRACE_L,this.parseInputValueDef,a.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===a.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(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.optionalMany(a.BRACE_L,this.parseOperationTypeDefinition,a.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:f.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(t,{kind:f.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const 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:f.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const 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:f.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(a.AT);const r=this.parseName(),i=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const c=this.parseDirectiveLocations();return this.node(t,{kind:f.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:s,locations:c})}parseDirectiveLocations(){return this.delimitedMany(a.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(pe,n.value))return n;throw this.unexpected(t)}node(t,n){return this._options.noLocation!==!0&&(n.loc=new it(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){const n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw I(this._lexer.source,n.start,`Expected ${Be(t)}, found ${Z(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){const n=this._lexer.token;if(n.kind===a.NAME&&n.value===t)this.advanceLexer();else throw I(this._lexer.source,n.start,`Expected "${t}", found ${Z(n)}.`)}expectOptionalKeyword(t){const n=this._lexer.token;return n.kind===a.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){const n=t??this._lexer.token;return I(this._lexer.source,n.start,`Unexpected ${Z(n)}.`)}any(t,n,r){this.expectToken(t);const i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}return[]}many(t,n,r){this.expectToken(t);const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);const r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){const{maxTokens:t}=this._options,n=this._lexer.advance();if(t!==void 0&&n.kind!==a.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw I(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function Z(e){const t=e.value;return Be(e.kind)+(t!=null?` "${t}"`:"")}function Be(e){return lt(e)?`"${e}"`:e}function St(e){return`"${e.replace(Ct,wt)}"`}const Ct=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function wt(e){return kt[e.charCodeAt(0)]}const kt=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],Rt=Object.freeze({});function Lt(e,t,n=_e){const r=new Map;for(const C of Object.values(f))r.set(C,Ft(t,C));let i,s=Array.isArray(e),c=[e],u=-1,h=[],d=e,y,E;const T=[],A=[];do{u++;const C=u===c.length,oe=C&&h.length!==0;if(C){if(y=A.length===0?void 0:T[T.length-1],d=E,E=A.pop(),oe)if(s){d=d.slice();let R=0;for(const[$,ae]of h){const ce=$-R;ae===null?(d.splice(ce,1),R++):d[ce]=ae}}else{d=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));for(const[R,$]of h)d[R]=$}u=i.index,c=i.keys,h=i.edits,s=i.inArray,i=i.prev}else if(E){if(y=s?u:c[u],d=E[y],d==null)continue;T.push(y)}let L;if(!Array.isArray(d)){var m,b;De(d)||J(!1,`Invalid AST Node: ${ye(d)}.`);const R=C?(m=r.get(d.kind))===null||m===void 0?void 0:m.leave:(b=r.get(d.kind))===null||b===void 0?void 0:b.enter;if(L=R==null?void 0:R.call(t,d,y,E,T,A),L===Rt)break;if(L===!1){if(!C){T.pop();continue}}else if(L!==void 0&&(h.push([y,L]),!C))if(De(L))d=L;else{T.pop();continue}}if(L===void 0&&oe&&h.push([y,d]),C)T.pop();else{var D;i={inArray:s,index:u,keys:c,edits:h,prev:i},s=Array.isArray(d),c=s?d:(D=n[d.kind])!==null&&D!==void 0?D:[],u=-1,h=[],E&&A.push(E),E=d}}while(i!==void 0);return h.length!==0?h[h.length-1][1]:e}function Ft(e,t){const n=e[t];return typeof n=="object"?n:typeof n=="function"?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function Pt(e){return Lt(e,Mt)}const Bt=80,Mt={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>p(e.definitions,`
23
23
 
24
- `)},OperationDefinition:{leave(e){const t=g("(",h(e.variableDefinitions,", "),")"),n=h([e.operation,h([e.name,t]),h(e.directives," ")]," ");return(n==="query"?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r})=>e+": "+t+g(" = ",n)+g(" ",h(r," "))},SelectionSet:{leave:({selections:e})=>w(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const s=g("",e,": ")+t;let c=s+g("(",h(n,", "),")");return c.length>Bt&&(c=s+g(`(
25
- `,K(h(n,`
24
+ `)},OperationDefinition:{leave(e){const t=g("(",p(e.variableDefinitions,", "),")"),n=p([e.operation,p([e.name,t]),p(e.directives," ")]," ");return(n==="query"?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r})=>e+": "+t+g(" = ",n)+g(" ",p(r," "))},SelectionSet:{leave:({selections:e})=>k(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const s=g("",e,": ")+t;let c=s+g("(",p(n,", "),")");return c.length>Bt&&(c=s+g(`(
25
+ `,K(p(n,`
26
26
  `)),`
27
- )`)),h([c,h(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+g(" ",h(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>h(["...",g("on ",e),h(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${e}${g("(",h(n,", "),")")} on ${t} ${g("",h(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?ct(e):St(e)},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+h(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+h(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+g("(",h(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>g("",e,`
28
- `)+h(["schema",h(t," "),w(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>g("",e,`
29
- `)+h(["scalar",t,h(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>g("",e,`
30
- `)+h(["type",t,g("implements ",h(n," & ")),h(r," "),w(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>g("",e,`
27
+ )`)),p([c,p(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+g(" ",p(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>p(["...",g("on ",e),p(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${e}${g("(",p(n,", "),")")} on ${t} ${g("",p(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?ct(e):St(e)},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+p(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+p(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+g("(",p(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>g("",e,`
28
+ `)+p(["schema",p(t," "),k(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>g("",e,`
29
+ `)+p(["scalar",t,p(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>g("",e,`
30
+ `)+p(["type",t,g("implements ",p(n," & ")),p(r," "),k(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>g("",e,`
31
31
  `)+t+(Me(n)?g(`(
32
- `,K(h(n,`
32
+ `,K(p(n,`
33
33
  `)),`
34
- )`):g("(",h(n,", "),")"))+": "+r+g(" ",h(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>g("",e,`
35
- `)+h([t+": "+n,g("= ",r),h(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>g("",e,`
36
- `)+h(["interface",t,g("implements ",h(n," & ")),h(r," "),w(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>g("",e,`
37
- `)+h(["union",t,h(n," "),g("= ",h(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>g("",e,`
38
- `)+h(["enum",t,h(n," "),w(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>g("",e,`
39
- `)+h([t,h(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>g("",e,`
40
- `)+h(["input",t,h(n," "),w(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:r,locations:i})=>g("",e,`
34
+ )`):g("(",p(n,", "),")"))+": "+r+g(" ",p(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>g("",e,`
35
+ `)+p([t+": "+n,g("= ",r),p(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>g("",e,`
36
+ `)+p(["interface",t,g("implements ",p(n," & ")),p(r," "),k(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>g("",e,`
37
+ `)+p(["union",t,p(n," "),g("= ",p(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>g("",e,`
38
+ `)+p(["enum",t,p(n," "),k(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>g("",e,`
39
+ `)+p([t,p(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>g("",e,`
40
+ `)+p(["input",t,p(n," "),k(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:r,locations:i})=>g("",e,`
41
41
  `)+"directive @"+t+(Me(n)?g(`(
42
- `,K(h(n,`
42
+ `,K(p(n,`
43
43
  `)),`
44
- )`):g("(",h(n,", "),")"))+(r?" repeatable":"")+" on "+h(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>h(["extend schema",h(e," "),w(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>h(["extend scalar",e,h(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>h(["extend type",e,g("implements ",h(t," & ")),h(n," "),w(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>h(["extend interface",e,g("implements ",h(t," & ")),h(n," "),w(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>h(["extend union",e,h(t," "),g("= ",h(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>h(["extend enum",e,h(t," "),w(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>h(["extend input",e,h(t," "),w(n)]," ")}};function h(e,t=""){var n;return(n=e==null?void 0:e.filter(r=>r).join(t))!==null&&n!==void 0?n:""}function w(e){return g(`{
45
- `,K(h(e,`
44
+ )`):g("(",p(n,", "),")"))+(r?" repeatable":"")+" on "+p(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>p(["extend schema",p(e," "),k(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>p(["extend scalar",e,p(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>p(["extend type",e,g("implements ",p(t," & ")),p(n," "),k(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>p(["extend interface",e,g("implements ",p(t," & ")),p(n," "),k(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>p(["extend union",e,p(t," "),g("= ",p(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>p(["extend enum",e,p(t," "),k(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>p(["extend input",e,p(t," "),k(n)]," ")}};function p(e,t=""){var n;return(n=e==null?void 0:e.filter(r=>r).join(t))!==null&&n!==void 0?n:""}function k(e){return g(`{
45
+ `,K(p(e,`
46
46
  `)),`
47
47
  }`)}function g(e,t,n=""){return t!=null&&t!==""?e+t+n:""}function K(e){return g(" ",e.replace(/\n/g,`
48
48
  `))}function Me(e){var t;return(t=e==null?void 0:e.some(n=>n.includes(`
49
- `)))!==null&&t!==void 0?t:!1}const Ue=e=>{var r,i;let t;const n=e.definitions.filter(s=>s.kind==="OperationDefinition");return n.length===1&&(t=(i=(r=n[0])==null?void 0:r.name)==null?void 0:i.value),t},me=e=>{if(typeof e=="string"){let n;try{const r=Pe(e);n=Ue(r)}catch{}return{query:e,operationName:n}}const t=Ue(e);return{query:Pt(e),operationName:t}};class Y extends Error{constructor(t,n){const r=`${Y.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(r),Object.setPrototypeOf(this,Y.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Y)}static extractMessage(t){var n,r;return((r=(n=t.errors)==null?void 0:n[0])==null?void 0:r.message)??`GraphQL Error (Code: ${t.status})`}}var Ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ee={exports:{}};(function(e,t){var n=typeof self<"u"?self:Ut,r=function(){function s(){this.fetch=!1,this.DOMException=n.DOMException}return s.prototype=n,new s}();(function(s){(function(c){var u={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function p(o){return o&&DataView.prototype.isPrototypeOf(o)}if(u.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],y=ArrayBuffer.isView||function(o){return o&&d.indexOf(Object.prototype.toString.call(o))>-1};function E(o){if(typeof o!="string"&&(o=String(o)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(o))throw new TypeError("Invalid character in header field name");return o.toLowerCase()}function T(o){return typeof o!="string"&&(o=String(o)),o}function A(o){var l={next:function(){var v=o.shift();return{done:v===void 0,value:v}}};return u.iterable&&(l[Symbol.iterator]=function(){return l}),l}function m(o){this.map={},o instanceof m?o.forEach(function(l,v){this.append(v,l)},this):Array.isArray(o)?o.forEach(function(l){this.append(l[0],l[1])},this):o&&Object.getOwnPropertyNames(o).forEach(function(l){this.append(l,o[l])},this)}m.prototype.append=function(o,l){o=E(o),l=T(l);var v=this.map[o];this.map[o]=v?v+", "+l:l},m.prototype.delete=function(o){delete this.map[E(o)]},m.prototype.get=function(o){return o=E(o),this.has(o)?this.map[o]:null},m.prototype.has=function(o){return this.map.hasOwnProperty(E(o))},m.prototype.set=function(o,l){this.map[E(o)]=T(l)},m.prototype.forEach=function(o,l){for(var v in this.map)this.map.hasOwnProperty(v)&&o.call(l,this.map[v],v,this)},m.prototype.keys=function(){var o=[];return this.forEach(function(l,v){o.push(v)}),A(o)},m.prototype.values=function(){var o=[];return this.forEach(function(l){o.push(l)}),A(o)},m.prototype.entries=function(){var o=[];return this.forEach(function(l,v){o.push([v,l])}),A(o)},u.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function b(o){if(o.bodyUsed)return Promise.reject(new TypeError("Already read"));o.bodyUsed=!0}function D(o){return new Promise(function(l,v){o.onload=function(){l(o.result)},o.onerror=function(){v(o.error)}})}function C(o){var l=new FileReader,v=D(l);return l.readAsArrayBuffer(o),v}function oe(o){var l=new FileReader,v=D(l);return l.readAsText(o),v}function L(o){for(var l=new Uint8Array(o),v=new Array(l.length),_=0;_<l.length;_++)v[_]=String.fromCharCode(l[_]);return v.join("")}function R(o){if(o.slice)return o.slice(0);var l=new Uint8Array(o.byteLength);return l.set(new Uint8Array(o)),l.buffer}function $(){return this.bodyUsed=!1,this._initBody=function(o){this._bodyInit=o,o?typeof o=="string"?this._bodyText=o:u.blob&&Blob.prototype.isPrototypeOf(o)?this._bodyBlob=o:u.formData&&FormData.prototype.isPrototypeOf(o)?this._bodyFormData=o:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)?this._bodyText=o.toString():u.arrayBuffer&&u.blob&&p(o)?(this._bodyArrayBuffer=R(o.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(o)||y(o))?this._bodyArrayBuffer=R(o):this._bodyText=o=Object.prototype.toString.call(o):this._bodyText="",this.headers.get("content-type")||(typeof o=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var o=b(this);if(o)return o;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?b(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(C)}),this.text=function(){var o=b(this);if(o)return o;if(this._bodyBlob)return oe(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(L(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(un)}),this.json=function(){return this.text().then(JSON.parse)},this}var ae=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function ce(o){var l=o.toUpperCase();return ae.indexOf(l)>-1?l:o}function M(o,l){l=l||{};var v=l.body;if(o instanceof M){if(o.bodyUsed)throw new TypeError("Already read");this.url=o.url,this.credentials=o.credentials,l.headers||(this.headers=new m(o.headers)),this.method=o.method,this.mode=o.mode,this.signal=o.signal,!v&&o._bodyInit!=null&&(v=o._bodyInit,o.bodyUsed=!0)}else this.url=String(o);if(this.credentials=l.credentials||this.credentials||"same-origin",(l.headers||!this.headers)&&(this.headers=new m(l.headers)),this.method=ce(l.method||this.method||"GET"),this.mode=l.mode||this.mode||null,this.signal=l.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function un(o){var l=new FormData;return o.trim().split("&").forEach(function(v){if(v){var _=v.split("="),O=_.shift().replace(/\+/g," "),N=_.join("=").replace(/\+/g," ");l.append(decodeURIComponent(O),decodeURIComponent(N))}}),l}function ln(o){var l=new m,v=o.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(_){var O=_.split(":"),N=O.shift().trim();if(N){var ue=O.join(":").trim();l.append(N,ue)}}),l}$.call(M.prototype);function F(o,l){l||(l={}),this.type="default",this.status=l.status===void 0?200:l.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in l?l.statusText:"OK",this.headers=new m(l.headers),this.url=l.url||"",this._initBody(o)}$.call(F.prototype),F.prototype.clone=function(){return new F(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},F.error=function(){var o=new F(null,{status:0,statusText:""});return o.type="error",o};var hn=[301,302,303,307,308];F.redirect=function(o,l){if(hn.indexOf(l)===-1)throw new RangeError("Invalid status code");return new F(null,{status:l,headers:{location:o}})},c.DOMException=s.DOMException;try{new c.DOMException}catch{c.DOMException=function(l,v){this.message=l,this.name=v;var _=Error(l);this.stack=_.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function Ne(o,l){return new Promise(function(v,_){var O=new M(o,l);if(O.signal&&O.signal.aborted)return _(new c.DOMException("Aborted","AbortError"));var N=new XMLHttpRequest;function ue(){N.abort()}N.onload=function(){var Q={status:N.status,statusText:N.statusText,headers:ln(N.getAllResponseHeaders()||"")};Q.url="responseURL"in N?N.responseURL:Q.headers.get("X-Request-URL");var Ae="response"in N?N.response:N.responseText;v(new F(Ae,Q))},N.onerror=function(){_(new TypeError("Network request failed"))},N.ontimeout=function(){_(new TypeError("Network request failed"))},N.onabort=function(){_(new c.DOMException("Aborted","AbortError"))},N.open(O.method,O.url,!0),O.credentials==="include"?N.withCredentials=!0:O.credentials==="omit"&&(N.withCredentials=!1),"responseType"in N&&u.blob&&(N.responseType="blob"),O.headers.forEach(function(Q,Ae){N.setRequestHeader(Ae,Q)}),O.signal&&(O.signal.addEventListener("abort",ue),N.onreadystatechange=function(){N.readyState===4&&O.signal.removeEventListener("abort",ue)}),N.send(typeof O._bodyInit>"u"?null:O._bodyInit)})}return Ne.polyfill=!0,s.fetch||(s.fetch=Ne,s.Headers=m,s.Request=M,s.Response=F),c.Headers=m,c.Request=M,c.Response=F,c.fetch=Ne,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t})(Ee,Ee.exports);var ee=Ee.exports;const te=Vt(ee),qt=S({__proto__:null,default:te},[ee]),q=e=>{let t={};return e&&(typeof Headers<"u"&&e instanceof Headers||qt&&ee.Headers&&e instanceof ee.Headers?t=Qe(e):Array.isArray(e)?e.forEach(([n,r])=>{n&&r!==void 0&&(t[n]=r)}):t=e),t},Ve=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),jt=e=>{if(!Array.isArray(e.query)){const r=e,i=[`query=${encodeURIComponent(Ve(r.query))}`];return e.variables&&i.push(`variables=${encodeURIComponent(r.jsonSerializer.stringify(r.variables))}`),r.operationName&&i.push(`operationName=${encodeURIComponent(r.operationName)}`),i.join("&")}if(typeof e.variables<"u"&&!Array.isArray(e.variables))throw new Error("Cannot create query with given variable type, array expected");const t=e,n=e.query.reduce((r,i,s)=>(r.push({query:Ve(i),variables:t.variables?t.jsonSerializer.stringify(t.variables[s]):void 0}),r),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`},$t=e=>async t=>{const{url:n,query:r,variables:i,operationName:s,fetch:c,fetchOptions:u,middleware:p}=t,d={...t.headers};let y="",E;e==="POST"?(E=Ht(r,i,s,u.jsonSerializer),typeof E=="string"&&(d["Content-Type"]="application/json")):y=jt({query:r,variables:i,operationName:s,jsonSerializer:u.jsonSerializer??P});const T={method:e,headers:d,body:E,...u};let A=n,m=T;if(p){const b=await Promise.resolve(p({...T,url:n,operationName:s,variables:i})),{url:D,...C}=b;A=D,m=C}return y&&(A=`${A}?${y}`),await c(A,m)};class Gt{constructor(t,n={}){this.url=t,this.requestConfig=n,this.rawRequest=async(...r)=>{const[i,s,c]=r,u=Xe(i,s,c),{headers:p,fetch:d=te,method:y="POST",requestMiddleware:E,responseMiddleware:T,...A}=this.requestConfig,{url:m}=this;u.signal!==void 0&&(A.signal=u.signal);const{operationName:b}=me(u.query);return Te({url:m,query:u.query,variables:u.variables,headers:{...q(ve(p)),...q(u.requestHeaders)},operationName:b,fetch:d,method:y,fetchOptions:A,middleware:E}).then(D=>(T&&T(D),D)).catch(D=>{throw T&&T(D),D})}}async request(t,...n){const[r,i]=n,s=Je(t,r,i),{headers:c,fetch:u=te,method:p="POST",requestMiddleware:d,responseMiddleware:y,...E}=this.requestConfig,{url:T}=this;s.signal!==void 0&&(E.signal=s.signal);const{query:A,operationName:m}=me(s.document);return Te({url:T,query:A,variables:s.variables,headers:{...q(ve(c)),...q(s.requestHeaders)},operationName:m,fetch:u,method:p,fetchOptions:E,middleware:d}).then(b=>(y&&y(b),b.data)).catch(b=>{throw y&&y(b),b})}batchRequests(t,n){const r=We(t,n),{headers:i,...s}=this.requestConfig;r.signal!==void 0&&(s.signal=r.signal);const c=r.documents.map(({document:p})=>me(p).query),u=r.documents.map(({variables:p})=>p);return Te({url:this.url,query:c,variables:u,headers:{...q(ve(i)),...q(r.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??te,method:this.requestConfig.method||"POST",fetchOptions:s,middleware:this.requestConfig.requestMiddleware}).then(p=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(p),p.data)).catch(p=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(p),p})}setHeaders(t){return this.requestConfig.headers=t,this}setHeader(t,n){const{headers:r}=this.requestConfig;return r?r[t]=n:this.requestConfig.headers={[t]:n},this}setEndpoint(t){return this.url=t,this}}const Te=async e=>{const{query:t,variables:n,fetchOptions:r}=e,i=$t(ze(e.method??"post")),s=Array.isArray(e.query),c=await i(e),u=await Yt(c,r.jsonSerializer??P),p=Array.isArray(u)?!u.some(({data:y})=>!y):!!u.data,d=Array.isArray(u)||!u.errors||Array.isArray(u.errors)&&!u.errors.length||r.errorPolicy==="all"||r.errorPolicy==="ignore";if(c.ok&&d&&p){const{errors:y,...E}=(Array.isArray(u),u),T=r.errorPolicy==="ignore"?E:u;return{...s?{data:T}:T,headers:c.headers,status:c.status}}else{const y=typeof u=="string"?{error:u}:u;throw new Y({...y,status:c.status,headers:c.headers},{query:t,variables:n})}},Ht=(e,t,n,r)=>{const i=r??P;if(!Array.isArray(e))return i.stringify({query:e,variables:t,operationName:n});if(typeof t<"u"&&!Array.isArray(t))throw new Error("Cannot create request body with given variable type, array expected");const s=e.reduce((c,u,p)=>(c.push({query:u,variables:t?t[p]:void 0}),c),[]);return i.stringify(s)},Yt=async(e,t)=>{let n;return e.headers.forEach((r,i)=>{i.toLowerCase()==="content-type"&&(n=r)}),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},ve=e=>typeof e=="function"?e():e;var ne=function(){return ne=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},ne.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var ie=new Map,ge=new Map,qe=!0,re=!1;function je(e){return e.replace(/[\s,]+/g," ").trim()}function zt(e){return je(e.source.body.substring(e.start,e.end))}function Qt(e){var t=new Set,n=[];return e.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var i=r.name.value,s=zt(r.loc),c=ge.get(i);c&&!c.has(s)?qe&&console.warn("Warning: fragment with name "+i+` already exists.
49
+ `)))!==null&&t!==void 0?t:!1}const Ue=e=>{var r,i;let t;const n=e.definitions.filter(s=>s.kind==="OperationDefinition");return n.length===1&&(t=(i=(r=n[0])==null?void 0:r.name)==null?void 0:i.value),t},me=e=>{if(typeof e=="string"){let n;try{const r=Pe(e);n=Ue(r)}catch{}return{query:e,operationName:n}}const t=Ue(e);return{query:Pt(e),operationName:t}};class Y extends Error{constructor(t,n){const r=`${Y.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(r),Object.setPrototypeOf(this,Y.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Y)}static extractMessage(t){var n,r;return((r=(n=t.errors)==null?void 0:n[0])==null?void 0:r.message)??`GraphQL Error (Code: ${t.status})`}}var Ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ee={exports:{}};(function(e,t){var n=typeof self<"u"?self:Ut,r=function(){function s(){this.fetch=!1,this.DOMException=n.DOMException}return s.prototype=n,new s}();(function(s){(function(c){var u={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function h(o){return o&&DataView.prototype.isPrototypeOf(o)}if(u.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],y=ArrayBuffer.isView||function(o){return o&&d.indexOf(Object.prototype.toString.call(o))>-1};function E(o){if(typeof o!="string"&&(o=String(o)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(o))throw new TypeError("Invalid character in header field name");return o.toLowerCase()}function T(o){return typeof o!="string"&&(o=String(o)),o}function A(o){var l={next:function(){var v=o.shift();return{done:v===void 0,value:v}}};return u.iterable&&(l[Symbol.iterator]=function(){return l}),l}function m(o){this.map={},o instanceof m?o.forEach(function(l,v){this.append(v,l)},this):Array.isArray(o)?o.forEach(function(l){this.append(l[0],l[1])},this):o&&Object.getOwnPropertyNames(o).forEach(function(l){this.append(l,o[l])},this)}m.prototype.append=function(o,l){o=E(o),l=T(l);var v=this.map[o];this.map[o]=v?v+", "+l:l},m.prototype.delete=function(o){delete this.map[E(o)]},m.prototype.get=function(o){return o=E(o),this.has(o)?this.map[o]:null},m.prototype.has=function(o){return this.map.hasOwnProperty(E(o))},m.prototype.set=function(o,l){this.map[E(o)]=T(l)},m.prototype.forEach=function(o,l){for(var v in this.map)this.map.hasOwnProperty(v)&&o.call(l,this.map[v],v,this)},m.prototype.keys=function(){var o=[];return this.forEach(function(l,v){o.push(v)}),A(o)},m.prototype.values=function(){var o=[];return this.forEach(function(l){o.push(l)}),A(o)},m.prototype.entries=function(){var o=[];return this.forEach(function(l,v){o.push([v,l])}),A(o)},u.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function b(o){if(o.bodyUsed)return Promise.reject(new TypeError("Already read"));o.bodyUsed=!0}function D(o){return new Promise(function(l,v){o.onload=function(){l(o.result)},o.onerror=function(){v(o.error)}})}function C(o){var l=new FileReader,v=D(l);return l.readAsArrayBuffer(o),v}function oe(o){var l=new FileReader,v=D(l);return l.readAsText(o),v}function L(o){for(var l=new Uint8Array(o),v=new Array(l.length),_=0;_<l.length;_++)v[_]=String.fromCharCode(l[_]);return v.join("")}function R(o){if(o.slice)return o.slice(0);var l=new Uint8Array(o.byteLength);return l.set(new Uint8Array(o)),l.buffer}function $(){return this.bodyUsed=!1,this._initBody=function(o){this._bodyInit=o,o?typeof o=="string"?this._bodyText=o:u.blob&&Blob.prototype.isPrototypeOf(o)?this._bodyBlob=o:u.formData&&FormData.prototype.isPrototypeOf(o)?this._bodyFormData=o:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)?this._bodyText=o.toString():u.arrayBuffer&&u.blob&&h(o)?(this._bodyArrayBuffer=R(o.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(o)||y(o))?this._bodyArrayBuffer=R(o):this._bodyText=o=Object.prototype.toString.call(o):this._bodyText="",this.headers.get("content-type")||(typeof o=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var o=b(this);if(o)return o;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?b(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(C)}),this.text=function(){var o=b(this);if(o)return o;if(this._bodyBlob)return oe(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(L(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(un)}),this.json=function(){return this.text().then(JSON.parse)},this}var ae=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function ce(o){var l=o.toUpperCase();return ae.indexOf(l)>-1?l:o}function M(o,l){l=l||{};var v=l.body;if(o instanceof M){if(o.bodyUsed)throw new TypeError("Already read");this.url=o.url,this.credentials=o.credentials,l.headers||(this.headers=new m(o.headers)),this.method=o.method,this.mode=o.mode,this.signal=o.signal,!v&&o._bodyInit!=null&&(v=o._bodyInit,o.bodyUsed=!0)}else this.url=String(o);if(this.credentials=l.credentials||this.credentials||"same-origin",(l.headers||!this.headers)&&(this.headers=new m(l.headers)),this.method=ce(l.method||this.method||"GET"),this.mode=l.mode||this.mode||null,this.signal=l.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(v)}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function un(o){var l=new FormData;return o.trim().split("&").forEach(function(v){if(v){var _=v.split("="),O=_.shift().replace(/\+/g," "),N=_.join("=").replace(/\+/g," ");l.append(decodeURIComponent(O),decodeURIComponent(N))}}),l}function ln(o){var l=new m,v=o.replace(/\r?\n[\t ]+/g," ");return v.split(/\r?\n/).forEach(function(_){var O=_.split(":"),N=O.shift().trim();if(N){var ue=O.join(":").trim();l.append(N,ue)}}),l}$.call(M.prototype);function F(o,l){l||(l={}),this.type="default",this.status=l.status===void 0?200:l.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in l?l.statusText:"OK",this.headers=new m(l.headers),this.url=l.url||"",this._initBody(o)}$.call(F.prototype),F.prototype.clone=function(){return new F(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},F.error=function(){var o=new F(null,{status:0,statusText:""});return o.type="error",o};var hn=[301,302,303,307,308];F.redirect=function(o,l){if(hn.indexOf(l)===-1)throw new RangeError("Invalid status code");return new F(null,{status:l,headers:{location:o}})},c.DOMException=s.DOMException;try{new c.DOMException}catch{c.DOMException=function(l,v){this.message=l,this.name=v;var _=Error(l);this.stack=_.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function Ne(o,l){return new Promise(function(v,_){var O=new M(o,l);if(O.signal&&O.signal.aborted)return _(new c.DOMException("Aborted","AbortError"));var N=new XMLHttpRequest;function ue(){N.abort()}N.onload=function(){var Q={status:N.status,statusText:N.statusText,headers:ln(N.getAllResponseHeaders()||"")};Q.url="responseURL"in N?N.responseURL:Q.headers.get("X-Request-URL");var Ae="response"in N?N.response:N.responseText;v(new F(Ae,Q))},N.onerror=function(){_(new TypeError("Network request failed"))},N.ontimeout=function(){_(new TypeError("Network request failed"))},N.onabort=function(){_(new c.DOMException("Aborted","AbortError"))},N.open(O.method,O.url,!0),O.credentials==="include"?N.withCredentials=!0:O.credentials==="omit"&&(N.withCredentials=!1),"responseType"in N&&u.blob&&(N.responseType="blob"),O.headers.forEach(function(Q,Ae){N.setRequestHeader(Ae,Q)}),O.signal&&(O.signal.addEventListener("abort",ue),N.onreadystatechange=function(){N.readyState===4&&O.signal.removeEventListener("abort",ue)}),N.send(typeof O._bodyInit>"u"?null:O._bodyInit)})}return Ne.polyfill=!0,s.fetch||(s.fetch=Ne,s.Headers=m,s.Request=M,s.Response=F),c.Headers=m,c.Request=M,c.Response=F,c.fetch=Ne,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t})(Ee,Ee.exports);var ee=Ee.exports;const te=Vt(ee),qt=S({__proto__:null,default:te},[ee]),q=e=>{let t={};return e&&(typeof Headers<"u"&&e instanceof Headers||qt&&ee.Headers&&e instanceof ee.Headers?t=Qe(e):Array.isArray(e)?e.forEach(([n,r])=>{n&&r!==void 0&&(t[n]=r)}):t=e),t},Ve=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),jt=e=>{if(!Array.isArray(e.query)){const r=e,i=[`query=${encodeURIComponent(Ve(r.query))}`];return e.variables&&i.push(`variables=${encodeURIComponent(r.jsonSerializer.stringify(r.variables))}`),r.operationName&&i.push(`operationName=${encodeURIComponent(r.operationName)}`),i.join("&")}if(typeof e.variables<"u"&&!Array.isArray(e.variables))throw new Error("Cannot create query with given variable type, array expected");const t=e,n=e.query.reduce((r,i,s)=>(r.push({query:Ve(i),variables:t.variables?t.jsonSerializer.stringify(t.variables[s]):void 0}),r),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`},$t=e=>async t=>{const{url:n,query:r,variables:i,operationName:s,fetch:c,fetchOptions:u,middleware:h}=t,d={...t.headers};let y="",E;e==="POST"?(E=Ht(r,i,s,u.jsonSerializer),typeof E=="string"&&(d["Content-Type"]="application/json")):y=jt({query:r,variables:i,operationName:s,jsonSerializer:u.jsonSerializer??P});const T={method:e,headers:d,body:E,...u};let A=n,m=T;if(h){const b=await Promise.resolve(h({...T,url:n,operationName:s,variables:i})),{url:D,...C}=b;A=D,m=C}return y&&(A=`${A}?${y}`),await c(A,m)};class Gt{constructor(t,n={}){this.url=t,this.requestConfig=n,this.rawRequest=async(...r)=>{const[i,s,c]=r,u=Xe(i,s,c),{headers:h,fetch:d=te,method:y="POST",requestMiddleware:E,responseMiddleware:T,...A}=this.requestConfig,{url:m}=this;u.signal!==void 0&&(A.signal=u.signal);const{operationName:b}=me(u.query);return Te({url:m,query:u.query,variables:u.variables,headers:{...q(ve(h)),...q(u.requestHeaders)},operationName:b,fetch:d,method:y,fetchOptions:A,middleware:E}).then(D=>(T&&T(D),D)).catch(D=>{throw T&&T(D),D})}}async request(t,...n){const[r,i]=n,s=Je(t,r,i),{headers:c,fetch:u=te,method:h="POST",requestMiddleware:d,responseMiddleware:y,...E}=this.requestConfig,{url:T}=this;s.signal!==void 0&&(E.signal=s.signal);const{query:A,operationName:m}=me(s.document);return Te({url:T,query:A,variables:s.variables,headers:{...q(ve(c)),...q(s.requestHeaders)},operationName:m,fetch:u,method:h,fetchOptions:E,middleware:d}).then(b=>(y&&y(b),b.data)).catch(b=>{throw y&&y(b),b})}batchRequests(t,n){const r=We(t,n),{headers:i,...s}=this.requestConfig;r.signal!==void 0&&(s.signal=r.signal);const c=r.documents.map(({document:h})=>me(h).query),u=r.documents.map(({variables:h})=>h);return Te({url:this.url,query:c,variables:u,headers:{...q(ve(i)),...q(r.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??te,method:this.requestConfig.method||"POST",fetchOptions:s,middleware:this.requestConfig.requestMiddleware}).then(h=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(h),h.data)).catch(h=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(h),h})}setHeaders(t){return this.requestConfig.headers=t,this}setHeader(t,n){const{headers:r}=this.requestConfig;return r?r[t]=n:this.requestConfig.headers={[t]:n},this}setEndpoint(t){return this.url=t,this}}const Te=async e=>{const{query:t,variables:n,fetchOptions:r}=e,i=$t(ze(e.method??"post")),s=Array.isArray(e.query),c=await i(e),u=await Yt(c,r.jsonSerializer??P),h=Array.isArray(u)?!u.some(({data:y})=>!y):!!u.data,d=Array.isArray(u)||!u.errors||Array.isArray(u.errors)&&!u.errors.length||r.errorPolicy==="all"||r.errorPolicy==="ignore";if(c.ok&&d&&h){const{errors:y,...E}=(Array.isArray(u),u),T=r.errorPolicy==="ignore"?E:u;return{...s?{data:T}:T,headers:c.headers,status:c.status}}else{const y=typeof u=="string"?{error:u}:u;throw new Y({...y,status:c.status,headers:c.headers},{query:t,variables:n})}},Ht=(e,t,n,r)=>{const i=r??P;if(!Array.isArray(e))return i.stringify({query:e,variables:t,operationName:n});if(typeof t<"u"&&!Array.isArray(t))throw new Error("Cannot create request body with given variable type, array expected");const s=e.reduce((c,u,h)=>(c.push({query:u,variables:t?t[h]:void 0}),c),[]);return i.stringify(s)},Yt=async(e,t)=>{let n;return e.headers.forEach((r,i)=>{i.toLowerCase()==="content-type"&&(n=r)}),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},ve=e=>typeof e=="function"?e():e;var ne=function(){return ne=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},ne.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var ie=new Map,ge=new Map,qe=!0,re=!1;function je(e){return e.replace(/[\s,]+/g," ").trim()}function zt(e){return je(e.source.body.substring(e.start,e.end))}function Qt(e){var t=new Set,n=[];return e.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var i=r.name.value,s=zt(r.loc),c=ge.get(i);c&&!c.has(s)?qe&&console.warn("Warning: fragment with name "+i+` already exists.
50
50
  graphql-tag enforces all fragment names across your application to be unique; read more about
51
51
  this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):c||ge.set(i,c=new Set),c.add(s),t.has(s)||(t.add(s),n.push(r))}else n.push(r)}),ne(ne({},e),{definitions:n})}function Jt(e){var t=new Set(e.definitions);t.forEach(function(r){r.loc&&delete r.loc,Object.keys(r).forEach(function(i){var s=r[i];s&&typeof s=="object"&&t.add(s)})});var n=e.loc;return n&&(delete n.startToken,delete n.endToken),e}function Xt(e){var t=je(e);if(!ie.has(t)){var n=Pe(e,{experimentalFragmentVariables:re,allowLegacyFragmentVariables:re});if(!n||n.kind!=="Document")throw new Error("Not a valid GraphQL document.");ie.set(t,Jt(Qt(n)))}return ie.get(t)}function j(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];typeof e=="string"&&(e=[e]);var r=e[0];return t.forEach(function(i,s){i&&i.kind==="Document"?r+=i.loc.source.body:r+=i,r+=e[s+1]}),Xt(r)}function Wt(){ie.clear(),ge.clear()}function Zt(){qe=!1}function Kt(){re=!0}function en(){re=!1}var z={gql:j,resetCaches:Wt,disableFragmentWarnings:Zt,enableExperimentalFragmentVariables:Kt,disableExperimentalFragmentVariables:en};(function(e){e.gql=z.gql,e.resetCaches=z.resetCaches,e.disableFragmentWarnings=z.disableFragmentWarnings,e.enableExperimentalFragmentVariables=z.enableExperimentalFragmentVariables,e.disableExperimentalFragmentVariables=z.disableExperimentalFragmentVariables})(j||(j={})),j.default=j;const se=j;var $e;(function(e){e.CreatedAt="CREATED_AT"})($e||($e={}));var Ge;(function(e){e.CreatedAt="CREATED_AT"})(Ge||(Ge={}));var He;(function(e){e.Invalid="INVALID",e.Public="PUBLIC",e.TenantUser="TENANT_USER"})(He||(He={}));const tn=se`
52
52
  query GetLocationAvailabilities($sku: String!, $first: Int, $after: String, $isReverse: Boolean! = false) {
@@ -97,4 +97,4 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):c
97
97
  pointsPending
98
98
  }
99
99
  }
100
- `,on=(e,t,n,r)=>e();function an(e,t=on){return{GetLocationAvailabilities(n,r){return t(i=>e.request(tn,n,{...r,...i}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,r){return t(i=>e.request(nn,n,{...r,...i}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,r){return t(i=>e.request(rn,n,{...r,...i}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,r){return t(i=>e.request(sn,n,{...r,...i}),"GetPoints","query",n)}}}class cn{constructor(t){Ye(this,"api");this.api=an(new Gt(`${t}/apps/sq-api`,{headers:{"X-SQ-CLIENT":"ShopifyAppProxy"}}))}async getLocationAvailabilities(t,n,r,i){const s=await this.api.GetLocationAvailabilities({sku:t,first:n,after:r,isReverse:i});return{nodes:s.locationAvailabilities.nodes.map(c=>({location:{name:c.location.name},inventoryQuantity:c.inventoryQuantity}))??[],pageInfo:s.locationAvailabilities.pageInfo??null}}async getLocationAvailability(t,n){const r=await this.api.GetLocationAvailability({sku:t,locationID:n});return{location:{name:r.locationAvailability.location.name},inventoryQuantity:r.locationAvailability.inventoryQuantity}}async getPurchasingCustomerMetafield(t,n){return(await this.api.GetPurchasingCustomerMetafield({namespace:t,key:n})).purchasingCustomerMetafield??null}async getPoints(){const t=await this.api.GetPoints();return t.purchasingCustomer?{pointsApproved:t.purchasingCustomer.pointsApproved,pointsPending:t.purchasingCustomer.pointsPending}:null}}k.SDK=cn,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
100
+ `,on=(e,t,n,r)=>e();function an(e,t=on){return{GetLocationAvailabilities(n,r){return t(i=>e.request(tn,n,{...r,...i}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,r){return t(i=>e.request(nn,n,{...r,...i}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,r){return t(i=>e.request(rn,n,{...r,...i}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,r){return t(i=>e.request(sn,n,{...r,...i}),"GetPoints","query",n)}}}class cn{constructor(t){Ye(this,"api");this.api=an(new Gt(`${t}/apps/sq-api`,{headers:{"X-SQ-CLIENT":"ShopifyAppProxy"}}))}async getLocationAvailabilities(t,n,r,i){const s=await this.api.GetLocationAvailabilities({sku:t,first:n,after:r,isReverse:i});return{nodes:s.locationAvailabilities.nodes.map(c=>({location:{name:c.location.name},inventoryQuantity:c.inventoryQuantity}))??[],pageInfo:s.locationAvailabilities.pageInfo??null}}async getLocationAvailability(t,n){const r=await this.api.GetLocationAvailability({sku:t,locationID:n});return{location:{name:r.locationAvailability.location.name},inventoryQuantity:r.locationAvailability.inventoryQuantity}}async getPurchasingCustomerMetafield(t,n){return(await this.api.GetPurchasingCustomerMetafield({namespace:t,key:n})).purchasingCustomerMetafield??null}async getPoints(){const t=await this.api.GetPoints();return t.purchasingCustomer?{pointsApproved:t.purchasingCustomer.pointsApproved,pointsPending:t.purchasingCustomer.pointsPending}:null}async getLocations(t,n,r){const i=await this.api.GetLocations({first:t,after:n,isReverse:r});return{nodes:i.locations.nodes.map(s=>({id:s.id,name:s.name}))??[],pageInfo:i.locations.pageInfo??null}}async getPurchasingCustomerDiscounts(t,n,r){var s,c,u;const i=await this.api.GetPurchasingCustomerDiscounts({first:t,after:n,isReverse:r});return{id:((s=i.purchasingCustomer)==null?void 0:s.id)??"",nodes:((c=i.purchasingCustomer)==null?void 0:c.discounts.nodes.map(h=>({id:h.id,title:h.title,description:h.description,code:h.code,createdAt:new Date(h.createdAt),updatedAt:new Date(h.updatedAt)})))??[],pageInfo:((u=i.purchasingCustomer)==null?void 0:u.discounts.pageInfo)??null}}}w.SDK=cn,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builtbystack/sq-shopify-theme-sdk",
3
3
  "private": false,
4
- "version": "0.0.2",
4
+ "version": "0.0.4",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
@@ -11,13 +11,17 @@
11
11
  "dev": "vite",
12
12
  "build": "tsc && vite build",
13
13
  "preview": "vite preview",
14
- "codegen": "graphql-codegen --config codegen.ts"
14
+ "codegen": "graphql-codegen --config codegen.ts",
15
+ "deploy": "npm run build && npm pack && npm publish"
15
16
  },
16
- "types": "dist/sq-shopify-appproxy-sdk.d.ts",
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "types": "dist/sq-shopify-theme-sdk.d.ts",
17
21
  "exports": {
18
22
  ".": {
19
- "import": "./dist/sq-shopify-appproxy-sdk.js",
20
- "require": "./dist/sq-shopify-appproxy-sdk.umd.js"
23
+ "import": "./dist/sq-shopify-theme-sdk.js",
24
+ "require": "./dist/sq-shopify-theme-sdk.umd.js"
21
25
  }
22
26
  },
23
27
  "dependencies": {