@builtbystack/sq-shopify-theme-sdk 0.0.5 → 0.0.6

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(w,C){typeof exports=="object"&&typeof module<"u"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(w=typeof globalThis<"u"?globalThis:w||self,C(w.SQ={}))})(this,function(w){"use strict";var hn=Object.defineProperty;var pn=(w,C,P)=>C in w?hn(w,C,{enumerable:!0,configurable:!0,writable:!0,value:P}):w[C]=P;var $e=(w,C,P)=>(pn(w,typeof C!="symbol"?C+"":C,P),P);function C(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,Ge=e=>e.toUpperCase(),He=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},Ye=(e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0},ze=(e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0},Qe=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0};function X(e,t){if(!!!e)throw new Error(t)}function Je(e){return typeof e=="object"&&e!==null}function Xe(e,t){if(!!!e)throw new Error(t??"Unexpected invariant triggered.")}const We=/\r\n|[\n\r]/g;function le(e,t){let n=0,r=1;for(const i of e.body.matchAll(We)){if(typeof i.index=="number"||Xe(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function Ze(e){return xe(e.source,le(e.source,e.start))}function xe(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 x=0;x<E.length;x+=80)m.push(E.slice(x,x+80));return d+be([[`${c} |`,m[0]],...m.slice(1,T+1).map(x=>["|",x]),["|","^".padStart(A)],["|",m[T+1]]])}return d+be([[`${c-1} |`,y[i-1]],[`${c} |`,E],["|","^".padStart(h)],[`${c+1} |`,y[i+1]]])}function be(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 Ke(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}=Ke(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=Je(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(R,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(R=typeof globalThis<"u"?globalThis:R||self,_(R.SQ={}))})(this,function(R){"use strict";var dn=Object.defineProperty;var fn=(R,_,F)=>_ in R?dn(R,_,{enumerable:!0,configurable:!0,writable:!0,value:F}):R[_]=F;var $e=(R,_,F)=>(fn(R,typeof _!="symbol"?_+"":_,F),F);function _(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 F=JSON,Ge=e=>e.toUpperCase(),He=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},Ye=(e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0},ze=(e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0},Qe=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0};function X(e,t){if(!!!e)throw new Error(t)}function Je(e){return typeof e=="object"&&e!==null}function Xe(e,t){if(!!!e)throw new Error(t??"Unexpected invariant triggered.")}const We=/\r\n|[\n\r]/g;function le(e,t){let n=0,r=1;for(const i of e.body.matchAll(We)){if(typeof i.index=="number"||Xe(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function Ze(e){return Ce(e.source,le(e.source,e.start))}function Ce(e,t){const n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,a=t.line+s,u=t.line===1?n:0,p=t.column+u,d=`${e.name}:${a}:${p}
2
+ `,m=r.split(/\r\n|[\n\r]/g),E=m[i];if(E.length>120){const g=Math.floor(p/80),N=p%80,y=[];for(let C=0;C<E.length;C+=80)y.push(E.slice(C,C+80));return d+xe([[`${a} |`,y[0]],...y.slice(1,g+1).map(C=>["|",C]),["|","^".padStart(N)],["|",y[g+1]]])}return d+xe([[`${a-1} |`,m[i-1]],[`${a} |`,E],["|","^".padStart(p)],[`${a+1} |`,m[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 Ke(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:a,source:u,positions:p,path:d,originalError:m,extensions:E}=Ke(n);super(t),this.name="GraphQLError",this.path=d??void 0,this.originalError=m??void 0,this.nodes=be(Array.isArray(a)?a:a?[a]:void 0);const g=be((r=this.nodes)===null||r===void 0?void 0:r.map(y=>y.loc).filter(y=>y!=null));this.source=u??(g==null||(i=g[0])===null||i===void 0?void 0:i.source),this.positions=p??(g==null?void 0:g.map(y=>y.start)),this.locations=p&&u?p.map(y=>le(u,y)):g==null?void 0:g.map(y=>le(y.source,y.start));const N=Je(m==null?void 0:m.extensions)?m==null?void 0:m.extensions:void 0;this.extensions=(s=E??N)!==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}}),m!=null&&m.stack?Object.defineProperty(this,"stack",{value:m.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
  `+Ze(n.loc));else if(this.source&&this.locations)for(const n of this.locations)t+=`
6
6
 
7
- `+xe(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 et{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"]},tt=new Set(Object.keys(_e));function De(e){const t=e==null?void 0:e.kind;return typeof t=="string"&&tt.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 H(e){return e>=48&&e<=57}function Ce(e){return e>=97&&e<=122||e>=65&&e<=90}function Se(e){return Ce(e)||e===95}function nt(e){return Ce(e)||H(e)||e===95}function it(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=rt(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 rt(e){let t=0;for(;t<e.length&&de(e.charCodeAt(t));)++t;return t}function st(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
- `),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 ot{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=ct(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===a.COMMENT);return t}}function at(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 q(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function W(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 b(e,t,n,r,i){const s=e.line,c=1+n-e.lineStart;return new Oe(t,n,r,s,c,i)}function ct(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 ut(e,i);case 33:return b(e,a.BANG,i,i+1);case 36:return b(e,a.DOLLAR,i,i+1);case 38:return b(e,a.AMP,i,i+1);case 40:return b(e,a.PAREN_L,i,i+1);case 41:return b(e,a.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return b(e,a.SPREAD,i,i+3);break;case 58:return b(e,a.COLON,i,i+1);case 61:return b(e,a.EQUALS,i,i+1);case 64:return b(e,a.AT,i,i+1);case 91:return b(e,a.BRACKET_L,i,i+1);case 93:return b(e,a.BRACKET_R,i,i+1);case 123:return b(e,a.BRACE_L,i,i+1);case 124:return b(e,a.PIPE,i,i+1);case 125:return b(e,a.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?yt(e,i):ht(e,i)}if(H(s)||s===45)return lt(e,i,s);if(Se(s))return mt(e,i);throw I(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:q(s)||W(n,i)?`Unexpected character: ${B(e,i)}.`:`Invalid character: ${B(e,i)}.`)}return b(e,a.EOF,r,r)}function ut(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(q(s))++i;else if(W(n,i))i+=2;else break}return b(e,a.COMMENT,t,i,n.slice(t+1,i))}function lt(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),H(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||Se(s))throw I(e.source,i,`Invalid number, expected digit but got: ${B(e,i)}.`);return b(e,c?a.FLOAT:a.INT,t,i,r.slice(t,i))}function fe(e,t,n){if(!H(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(;H(r.charCodeAt(i));)++i;return i}function ht(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),b(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?pt(e,i):dt(e,i):ft(e,i);c+=h.value,i+=h.size,s=i;continue}if(u===10||u===13)break;if(q(u))++i;else if(W(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 pt(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||!q(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|Y(s),r<0)break}throw I(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function dt(e,t){const n=e.source.body,r=Re(n,t+2);if(q(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 Y(e.charCodeAt(t))<<12|Y(e.charCodeAt(t+1))<<8|Y(e.charCodeAt(t+2))<<4|Y(e.charCodeAt(t+3))}function Y(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function ft(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 yt(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=b(e,a.BLOCK_STRING,t,s+3,it(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(q(d))++s;else if(W(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 mt(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const s=n.charCodeAt(i);if(nt(s))++i;else break}return b(e,a.NAME,t,i,n.slice(t,i))}const Et=10,Le=2;function ye(e){return Z(e,[])}function Z(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return Tt(e,t);default:return String(e)}}function Tt(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(gt(e)){const r=e.toJSON();if(r!==e)return typeof r=="string"?r:Z(r,n)}else if(Array.isArray(e))return Nt(e,n);return vt(e,n)}function gt(e){return typeof e.toJSON=="function"}function vt(e,t){const n=Object.entries(e);return n.length===0?"{}":t.length>Le?"["+At(e)+"]":"{ "+n.map(([i,s])=>i+": "+Z(s,t)).join(", ")+" }"}function Nt(e,t){if(e.length===0)return"[]";if(t.length>Le)return"[Array]";const n=Math.min(Et,e.length),r=e.length-n,i=[];for(let s=0;s<n;++s)i.push(Z(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function At(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 xt=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.
7
+ `+Ce(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 be(e){return e===void 0||e.length===0?void 0:e}function b(e,t,n){return new he(`Syntax Error: ${n}`,{source:e,positions:[t]})}class et{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 Ie{constructor(t,n,r,i,s,a){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=a,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const Oe={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"]},tt=new Set(Object.keys(Oe));function De(e){const t=e==null?void 0:e.kind;return typeof t=="string"&&tt.has(t)}var q;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(q||(q={}));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 H(e){return e>=48&&e<=57}function _e(e){return e>=97&&e<=122||e>=65&&e<=90}function ke(e){return _e(e)||e===95}function nt(e){return _e(e)||H(e)||e===95}function it(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let a=0;a<e.length;++a){var s;const u=e[a],p=rt(u);p!==u.length&&(r=(s=r)!==null&&s!==void 0?s:a,i=a,a!==0&&p<n&&(n=p))}return e.map((a,u)=>u===0?a:a.slice(n)).slice((t=r)!==null&&t!==void 0?t:0,i+1)}function rt(e){let t=0;for(;t<e.length&&de(e.charCodeAt(t));)++t;return t}function st(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(N=>N.length===0||de(N.charCodeAt(0))),a=n.endsWith('\\"""'),u=e.endsWith('"')&&!a,p=e.endsWith("\\"),d=u||p,m=!(t!=null&&t.minimize)&&(!i||e.length>70||d||s||a);let E="";const g=i&&de(e.charCodeAt(0));return(m&&!g||s)&&(E+=`
8
+ `),E+=n,(m||d)&&(E+=`
9
+ `),'"""'+E+'"""'}var c;(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"})(c||(c={}));class ot{constructor(t){const n=new Ie(c.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!==c.EOF)do if(t.next)t=t.next;else{const n=ct(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===c.COMMENT);return t}}function at(e){return e===c.BANG||e===c.DOLLAR||e===c.AMP||e===c.PAREN_L||e===c.PAREN_R||e===c.SPREAD||e===c.COLON||e===c.EQUALS||e===c.AT||e===c.BRACKET_L||e===c.BRACKET_R||e===c.BRACE_L||e===c.PIPE||e===c.BRACE_R}function V(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function W(e,t){return Re(e.charCodeAt(t))&&Se(e.charCodeAt(t+1))}function Re(e){return e>=55296&&e<=56319}function Se(e){return e>=56320&&e<=57343}function U(e,t){const n=e.source.body.codePointAt(t);if(n===void 0)return c.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,a=1+n-e.lineStart;return new Ie(t,n,r,s,a,i)}function ct(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 ut(e,i);case 33:return x(e,c.BANG,i,i+1);case 36:return x(e,c.DOLLAR,i,i+1);case 38:return x(e,c.AMP,i,i+1);case 40:return x(e,c.PAREN_L,i,i+1);case 41:return x(e,c.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return x(e,c.SPREAD,i,i+3);break;case 58:return x(e,c.COLON,i,i+1);case 61:return x(e,c.EQUALS,i,i+1);case 64:return x(e,c.AT,i,i+1);case 91:return x(e,c.BRACKET_L,i,i+1);case 93:return x(e,c.BRACKET_R,i,i+1);case 123:return x(e,c.BRACE_L,i,i+1);case 124:return x(e,c.PIPE,i,i+1);case 125:return x(e,c.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?mt(e,i):ht(e,i)}if(H(s)||s===45)return lt(e,i,s);if(ke(s))return yt(e,i);throw b(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:V(s)||W(n,i)?`Unexpected character: ${U(e,i)}.`:`Invalid character: ${U(e,i)}.`)}return x(e,c.EOF,r,r)}function ut(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(W(n,i))i+=2;else break}return x(e,c.COMMENT,t,i,n.slice(t+1,i))}function lt(e,t,n){const r=e.source.body;let i=t,s=n,a=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),H(s))throw b(e.source,i,`Invalid number, unexpected digit after 0: ${U(e,i)}.`)}else i=fe(e,i,s),s=r.charCodeAt(i);if(s===46&&(a=!0,s=r.charCodeAt(++i),i=fe(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(a=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=fe(e,i,s),s=r.charCodeAt(i)),s===46||ke(s))throw b(e.source,i,`Invalid number, expected digit but got: ${U(e,i)}.`);return x(e,a?c.FLOAT:c.INT,t,i,r.slice(t,i))}function fe(e,t,n){if(!H(n))throw b(e.source,t,`Invalid number, expected digit but got: ${U(e,t)}.`);const r=e.source.body;let i=t+1;for(;H(r.charCodeAt(i));)++i;return i}function ht(e,t){const n=e.source.body,r=n.length;let i=t+1,s=i,a="";for(;i<r;){const u=n.charCodeAt(i);if(u===34)return a+=n.slice(s,i),x(e,c.STRING,t,i+1,a);if(u===92){a+=n.slice(s,i);const p=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?pt(e,i):dt(e,i):ft(e,i);a+=p.value,i+=p.size,s=i;continue}if(u===10||u===13)break;if(V(u))++i;else if(W(n,i))i+=2;else throw b(e.source,i,`Invalid character within String: ${U(e,i)}.`)}throw b(e.source,i,"Unterminated string.")}function pt(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|Y(s),r<0)break}throw b(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function dt(e,t){const n=e.source.body,r=we(n,t+2);if(V(r))return{value:String.fromCodePoint(r),size:6};if(Re(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){const i=we(n,t+8);if(Se(i))return{value:String.fromCodePoint(r,i),size:12}}throw b(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function we(e,t){return Y(e.charCodeAt(t))<<12|Y(e.charCodeAt(t+1))<<8|Y(e.charCodeAt(t+2))<<4|Y(e.charCodeAt(t+3))}function Y(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function ft(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 b(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function mt(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,s=t+3,a=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(a,s),p.push(u);const m=x(e,c.BLOCK_STRING,t,s+3,it(p).join(`
11
+ `));return e.line+=p.length-1,e.lineStart=i,m}if(d===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){u+=n.slice(a,s),a=s+1,s+=4;continue}if(d===10||d===13){u+=n.slice(a,s),p.push(u),d===13&&n.charCodeAt(s+1)===10?s+=2:++s,u="",a=s,i=s;continue}if(V(d))++s;else if(W(n,s))s+=2;else throw b(e.source,s,`Invalid character within String: ${U(e,s)}.`)}throw b(e.source,s,"Unterminated string.")}function yt(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const s=n.charCodeAt(i);if(nt(s))++i;else break}return x(e,c.NAME,t,i,n.slice(t,i))}const Et=10,Pe=2;function me(e){return Z(e,[])}function Z(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return gt(e,t);default:return String(e)}}function gt(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(Tt(e)){const r=e.toJSON();if(r!==e)return typeof r=="string"?r:Z(r,n)}else if(Array.isArray(e))return At(e,n);return vt(e,n)}function Tt(e){return typeof e.toJSON=="function"}function vt(e,t){const n=Object.entries(e);return n.length===0?"{}":t.length>Pe?"["+Nt(e)+"]":"{ "+n.map(([i,s])=>i+": "+Z(s,t)).join(", ")+" }"}function At(e,t){if(e.length===0)return"[]";if(t.length>Pe)return"[Array]";const n=Math.min(Et,e.length),r=e.length-n,i=[];for(let s=0;s<n;++s)i.push(Z(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function Nt(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 Ct=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 a=me(t);throw new Error(`Cannot use ${i} "${a}" 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,36 +19,36 @@ 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"||X(!1,`Body must be a string. Received: ${ye(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||X(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||X(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function bt(e){return xt(e,Fe)}function Pe(e,t){return new It(e,t).parseDocument()}class It{constructor(t,n={}){const r=bt(t)?t:new Fe(t);this._lexer=new ot(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,`${K(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 et(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 ${K(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 ${K(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 ${K(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 K(e){const t=e.value;return Be(e.kind)+(t!=null?` "${t}"`:"")}function Be(e){return at(e)?`"${e}"`:e}function Ot(e){return`"${e.replace(_t,Dt)}"`}const _t=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Dt(e){return Ct[e.charCodeAt(0)]}const Ct=["\\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"],St=Object.freeze({});function wt(e,t,n=_e){const r=new Map;for(const S of Object.values(f))r.set(S,kt(t,S));let i,s=Array.isArray(e),c=[e],u=-1,h=[],d=e,y,E;const T=[],A=[];do{u++;const S=u===c.length,oe=S&&h.length!==0;if(S){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[G,ae]of h){const ce=G-R;ae===null?(d.splice(ce,1),R++):d[ce]=ae}}else{d=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));for(const[R,G]of h)d[R]=G}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,x;De(d)||X(!1,`Invalid AST Node: ${ye(d)}.`);const R=S?(m=r.get(d.kind))===null||m===void 0?void 0:m.leave:(x=r.get(d.kind))===null||x===void 0?void 0:x.enter;if(L=R==null?void 0:R.call(t,d,y,E,T,A),L===St)break;if(L===!1){if(!S){T.pop();continue}}else if(L!==void 0&&(h.push([y,L]),!S))if(De(L))d=L;else{T.pop();continue}}if(L===void 0&&oe&&h.push([y,d]),S)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 kt(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 Rt(e){return wt(e,Ft)}const Lt=80,Ft={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>p(e.definitions,`
22
+ spurious results.`)}}return!1};class Le{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||X(!1,`Body must be a string. Received: ${me(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||X(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||X(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function xt(e){return Ct(e,Le)}function Fe(e,t){return new bt(e,t).parseDocument()}class bt{constructor(t,n={}){const r=xt(t)?t:new Le(t);this._lexer=new ot(r),this._options=n,this._tokenCounter=0}parseName(){const t=this.expectToken(c.NAME);return this.node(t,{kind:f.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:f.DOCUMENT,definitions:this.many(c.SOF,this.parseDefinition,c.EOF)})}parseDefinition(){if(this.peek(c.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===c.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 b(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(c.BRACE_L))return this.node(t,{kind:f.OPERATION_DEFINITION,operation:q.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseOperationType();let r;return this.peek(c.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(c.NAME);switch(t.value){case"query":return q.QUERY;case"mutation":return q.MUTATION;case"subscription":return q.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(c.PAREN_L,this.parseVariableDefinition,c.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:f.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(c.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(c.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(c.DOLLAR),this.node(t,{kind:f.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:f.SELECTION_SET,selections:this.many(c.BRACE_L,this.parseSelection,c.BRACE_R)})}parseSelection(){return this.peek(c.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,n=this.parseName();let r,i;return this.expectOptionalToken(c.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(c.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){const n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(c.PAREN_L,n,c.PAREN_R)}parseArgument(t=!1){const n=this._lexer.token,r=this.parseName();return this.expectToken(c.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(c.SPREAD);const n=this.expectOptionalKeyword("on");return!n&&this.peek(c.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 c.BRACKET_L:return this.parseList(t);case c.BRACE_L:return this.parseObject(t);case c.INT:return this.advanceLexer(),this.node(n,{kind:f.INT,value:n.value});case c.FLOAT:return this.advanceLexer(),this.node(n,{kind:f.FLOAT,value:n.value});case c.STRING:case c.BLOCK_STRING:return this.parseStringLiteral();case c.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 c.DOLLAR:if(t)if(this.expectToken(c.DOLLAR),this._lexer.token.kind===c.NAME){const r=this._lexer.token.value;throw b(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===c.BLOCK_STRING})}parseList(t){const n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:f.LIST,values:this.any(c.BRACKET_L,n,c.BRACKET_R)})}parseObject(t){const n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:f.OBJECT,fields:this.any(c.BRACE_L,n,c.BRACE_R)})}parseObjectField(t){const n=this._lexer.token,r=this.parseName();return this.expectToken(c.COLON),this.node(n,{kind:f.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){const n=[];for(;this.peek(c.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const n=this._lexer.token;return this.expectToken(c.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(c.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(c.BRACKET_R),n=this.node(t,{kind:f.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(c.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(c.STRING)||this.peek(c.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(c.BRACE_L,this.parseOperationTypeDefinition,c.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(c.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(),a=this.parseFieldsDefinition();return this.node(t,{kind:f.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(c.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(c.BRACE_L,this.parseFieldDefinition,c.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(c.COLON);const s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:f.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(c.PAREN_L,this.parseInputValueDef,c.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(c.COLON);const i=this.parseTypeReference();let s;this.expectOptionalToken(c.EQUALS)&&(s=this.parseConstValueLiteral());const a=this.parseConstDirectives();return this.node(t,{kind:f.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:f.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}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(c.EQUALS)?this.delimitedMany(c.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(c.BRACE_L,this.parseEnumValueDefinition,c.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 b(this._lexer.source,this._lexer.token.start,`${K(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(c.BRACE_L,this.parseInputValueDef,c.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===c.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(c.BRACE_L,this.parseOperationTypeDefinition,c.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(c.AT);const r=this.parseName(),i=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const a=this.parseDirectiveLocations();return this.node(t,{kind:f.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(c.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 et(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 b(this._lexer.source,n.start,`Expected ${Be(t)}, found ${K(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){const n=this._lexer.token;if(n.kind===c.NAME&&n.value===t)this.advanceLexer();else throw b(this._lexer.source,n.start,`Expected "${t}", found ${K(n)}.`)}expectOptionalKeyword(t){const n=this._lexer.token;return n.kind===c.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){const n=t??this._lexer.token;return b(this._lexer.source,n.start,`Unexpected ${K(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!==c.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw b(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function K(e){const t=e.value;return Be(e.kind)+(t!=null?` "${t}"`:"")}function Be(e){return at(e)?`"${e}"`:e}function It(e){return`"${e.replace(Ot,Dt)}"`}const Ot=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Dt(e){return _t[e.charCodeAt(0)]}const _t=["\\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"],kt=Object.freeze({});function Rt(e,t,n=Oe){const r=new Map;for(const k of Object.values(f))r.set(k,St(t,k));let i,s=Array.isArray(e),a=[e],u=-1,p=[],d=e,m,E;const g=[],N=[];do{u++;const k=u===a.length,oe=k&&p.length!==0;if(k){if(m=N.length===0?void 0:g[g.length-1],d=E,E=N.pop(),oe)if(s){d=d.slice();let w=0;for(const[G,ae]of p){const ce=G-w;ae===null?(d.splice(ce,1),w++):d[ce]=ae}}else{d=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));for(const[w,G]of p)d[w]=G}u=i.index,a=i.keys,p=i.edits,s=i.inArray,i=i.prev}else if(E){if(m=s?u:a[u],d=E[m],d==null)continue;g.push(m)}let P;if(!Array.isArray(d)){var y,C;De(d)||X(!1,`Invalid AST Node: ${me(d)}.`);const w=k?(y=r.get(d.kind))===null||y===void 0?void 0:y.leave:(C=r.get(d.kind))===null||C===void 0?void 0:C.enter;if(P=w==null?void 0:w.call(t,d,m,E,g,N),P===kt)break;if(P===!1){if(!k){g.pop();continue}}else if(P!==void 0&&(p.push([m,P]),!k))if(De(P))d=P;else{g.pop();continue}}if(P===void 0&&oe&&p.push([m,d]),k)g.pop();else{var D;i={inArray:s,index:u,keys:a,edits:p,prev:i},s=Array.isArray(d),a=s?d:(D=n[d.kind])!==null&&D!==void 0?D:[],u=-1,p=[],E&&N.push(E),E=d}}while(i!==void 0);return p.length!==0?p[p.length-1][1]:e}function St(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 wt(e){return Rt(e,Lt)}const Pt=80,Lt={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>h(e.definitions,`
23
23
 
24
- `)},OperationDefinition:{leave(e){const t=v("(",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+v(" = ",n)+v(" ",p(r," "))},SelectionSet:{leave:({selections:e})=>k(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const s=v("",e,": ")+t;let c=s+v("(",p(n,", "),")");return c.length>Lt&&(c=s+v(`(
25
- `,ee(p(n,`
24
+ `)},OperationDefinition:{leave(e){const t=v("(",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+v(" = ",n)+v(" ",h(r," "))},SelectionSet:{leave:({selections:e})=>S(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const s=v("",e,": ")+t;let a=s+v("(",h(n,", "),")");return a.length>Pt&&(a=s+v(`(
25
+ `,ee(h(n,`
26
26
  `)),`
27
- )`)),p([c,p(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+v(" ",p(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>p(["...",v("on ",e),p(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${e}${v("(",p(n,", "),")")} on ${t} ${v("",p(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?st(e):Ot(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+v("(",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})=>v("",e,`
28
- `)+p(["schema",p(t," "),k(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>v("",e,`
29
- `)+p(["scalar",t,p(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>v("",e,`
30
- `)+p(["type",t,v("implements ",p(n," & ")),p(r," "),k(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>v("",e,`
31
- `)+t+(Me(n)?v(`(
32
- `,ee(p(n,`
27
+ )`)),h([a,h(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+v(" ",h(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>h(["...",v("on ",e),h(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${e}${v("(",h(n,", "),")")} on ${t} ${v("",h(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?st(e):It(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+v("(",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})=>v("",e,`
28
+ `)+h(["schema",h(t," "),S(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>v("",e,`
29
+ `)+h(["scalar",t,h(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>v("",e,`
30
+ `)+h(["type",t,v("implements ",h(n," & ")),h(r," "),S(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>v("",e,`
31
+ `)+t+(Ue(n)?v(`(
32
+ `,ee(h(n,`
33
33
  `)),`
34
- )`):v("(",p(n,", "),")"))+": "+r+v(" ",p(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>v("",e,`
35
- `)+p([t+": "+n,v("= ",r),p(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>v("",e,`
36
- `)+p(["interface",t,v("implements ",p(n," & ")),p(r," "),k(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>v("",e,`
37
- `)+p(["union",t,p(n," "),v("= ",p(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>v("",e,`
38
- `)+p(["enum",t,p(n," "),k(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>v("",e,`
39
- `)+p([t,p(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>v("",e,`
40
- `)+p(["input",t,p(n," "),k(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:r,locations:i})=>v("",e,`
41
- `)+"directive @"+t+(Me(n)?v(`(
42
- `,ee(p(n,`
34
+ )`):v("(",h(n,", "),")"))+": "+r+v(" ",h(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>v("",e,`
35
+ `)+h([t+": "+n,v("= ",r),h(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>v("",e,`
36
+ `)+h(["interface",t,v("implements ",h(n," & ")),h(r," "),S(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>v("",e,`
37
+ `)+h(["union",t,h(n," "),v("= ",h(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>v("",e,`
38
+ `)+h(["enum",t,h(n," "),S(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>v("",e,`
39
+ `)+h([t,h(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>v("",e,`
40
+ `)+h(["input",t,h(n," "),S(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:r,locations:i})=>v("",e,`
41
+ `)+"directive @"+t+(Ue(n)?v(`(
42
+ `,ee(h(n,`
43
43
  `)),`
44
- )`):v("(",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,v("implements ",p(t," & ")),p(n," "),k(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>p(["extend interface",e,v("implements ",p(t," & ")),p(n," "),k(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>p(["extend union",e,p(t," "),v("= ",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 v(`{
45
- `,ee(p(e,`
44
+ )`):v("(",h(n,", "),")"))+(r?" repeatable":"")+" on "+h(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>h(["extend schema",h(e," "),S(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,v("implements ",h(t," & ")),h(n," "),S(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>h(["extend interface",e,v("implements ",h(t," & ")),h(n," "),S(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>h(["extend union",e,h(t," "),v("= ",h(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>h(["extend enum",e,h(t," "),S(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>h(["extend input",e,h(t," "),S(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 S(e){return v(`{
45
+ `,ee(h(e,`
46
46
  `)),`
47
47
  }`)}function v(e,t,n=""){return t!=null&&t!==""?e+t+n:""}function ee(e){return v(" ",e.replace(/\n/g,`
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:Rt(e),operationName:t}};class z extends Error{constructor(t,n){const r=`${z.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(r),Object.setPrototypeOf(this,z.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,z)}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 Pt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bt(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:Pt,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 g=o.shift();return{done:g===void 0,value:g}}};return u.iterable&&(l[Symbol.iterator]=function(){return l}),l}function m(o){this.map={},o instanceof m?o.forEach(function(l,g){this.append(g,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 g=this.map[o];this.map[o]=g?g+", "+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 g in this.map)this.map.hasOwnProperty(g)&&o.call(l,this.map[g],g,this)},m.prototype.keys=function(){var o=[];return this.forEach(function(l,g){o.push(g)}),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,g){o.push([g,l])}),A(o)},u.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function x(o){if(o.bodyUsed)return Promise.reject(new TypeError("Already read"));o.bodyUsed=!0}function D(o){return new Promise(function(l,g){o.onload=function(){l(o.result)},o.onerror=function(){g(o.error)}})}function S(o){var l=new FileReader,g=D(l);return l.readAsArrayBuffer(o),g}function oe(o){var l=new FileReader,g=D(l);return l.readAsText(o),g}function L(o){for(var l=new Uint8Array(o),g=new Array(l.length),_=0;_<l.length;_++)g[_]=String.fromCharCode(l[_]);return g.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 G(){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=x(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?x(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(S)}),this.text=function(){var o=x(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(cn)}),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 g=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,!g&&o._bodyInit!=null&&(g=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")&&g)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(g)}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function cn(o){var l=new FormData;return o.trim().split("&").forEach(function(g){if(g){var _=g.split("="),O=_.shift().replace(/\+/g," "),N=_.join("=").replace(/\+/g," ");l.append(decodeURIComponent(O),decodeURIComponent(N))}}),l}function un(o){var l=new m,g=o.replace(/\r?\n[\t ]+/g," ");return g.split(/\r?\n/).forEach(function(_){var O=_.split(":"),N=O.shift().trim();if(N){var ue=O.join(":").trim();l.append(N,ue)}}),l}G.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)}G.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 ln=[301,302,303,307,308];F.redirect=function(o,l){if(ln.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,g){this.message=l,this.name=g;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(g,_){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 J={status:N.status,statusText:N.statusText,headers:un(N.getAllResponseHeaders()||"")};J.url="responseURL"in N?N.responseURL:J.headers.get("X-Request-URL");var Ae="response"in N?N.response:N.responseText;g(new F(Ae,J))},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(J,Ae){N.setRequestHeader(Ae,J)}),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 te=Ee.exports;const ne=Bt(te),Mt=C({__proto__:null,default:ne},[te]),V=e=>{let t={};return e&&(typeof Headers<"u"&&e instanceof Headers||Mt&&te.Headers&&e instanceof te.Headers?t=He(e):Array.isArray(e)?e.forEach(([n,r])=>{n&&r!==void 0&&(t[n]=r)}):t=e),t},qe=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),Ut=e=>{if(!Array.isArray(e.query)){const r=e,i=[`query=${encodeURIComponent(qe(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:qe(i),variables:t.variables?t.jsonSerializer.stringify(t.variables[s]):void 0}),r),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`},qt=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=jt(r,i,s,u.jsonSerializer),typeof E=="string"&&(d["Content-Type"]="application/json")):y=Ut({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 x=await Promise.resolve(h({...T,url:n,operationName:s,variables:i})),{url:D,...S}=x;A=D,m=S}return y&&(A=`${A}?${y}`),await c(A,m)};class Vt{constructor(t,n={}){this.url=t,this.requestConfig=n,this.rawRequest=async(...r)=>{const[i,s,c]=r,u=ze(i,s,c),{headers:h,fetch:d=ne,method:y="POST",requestMiddleware:E,responseMiddleware:T,...A}=this.requestConfig,{url:m}=this;u.signal!==void 0&&(A.signal=u.signal);const{operationName:x}=me(u.query);return Te({url:m,query:u.query,variables:u.variables,headers:{...V(ge(h)),...V(u.requestHeaders)},operationName:x,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=Ye(t,r,i),{headers:c,fetch:u=ne,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:{...V(ge(c)),...V(s.requestHeaders)},operationName:m,fetch:u,method:h,fetchOptions:E,middleware:d}).then(x=>(y&&y(x),x.data)).catch(x=>{throw y&&y(x),x})}batchRequests(t,n){const r=Qe(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:{...V(ge(i)),...V(r.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??ne,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=qt(Ge(e.method??"post")),s=Array.isArray(e.query),c=await i(e),u=await $t(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 z({...y,status:c.status,headers:c.headers},{query:t,variables:n})}},jt=(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)},$t=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()},ge=e=>typeof e=="function"?e():e;var ie=function(){return ie=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},ie.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var re=new Map,ve=new Map,Ve=!0,se=!1;function je(e){return e.replace(/[\s,]+/g," ").trim()}function Gt(e){return je(e.source.body.substring(e.start,e.end))}function Ht(e){var t=new Set,n=[];return e.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var i=r.name.value,s=Gt(r.loc),c=ve.get(i);c&&!c.has(s)?Ve&&console.warn("Warning: fragment with name "+i+` already exists.
48
+ `))}function Ue(e){var t;return(t=e==null?void 0:e.some(n=>n.includes(`
49
+ `)))!==null&&t!==void 0?t:!1}const Me=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},ye=e=>{if(typeof e=="string"){let n;try{const r=Fe(e);n=Me(r)}catch{}return{query:e,operationName:n}}const t=Me(e);return{query:wt(e),operationName:t}};class z extends Error{constructor(t,n){const r=`${z.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(r),Object.setPrototypeOf(this,z.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,z)}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 Ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bt(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:Ft,r=function(){function s(){this.fetch=!1,this.DOMException=n.DOMException}return s.prototype=n,new s}();(function(s){(function(a){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]"],m=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 g(o){return typeof o!="string"&&(o=String(o)),o}function N(o){var l={next:function(){var T=o.shift();return{done:T===void 0,value:T}}};return u.iterable&&(l[Symbol.iterator]=function(){return l}),l}function y(o){this.map={},o instanceof y?o.forEach(function(l,T){this.append(T,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)}y.prototype.append=function(o,l){o=E(o),l=g(l);var T=this.map[o];this.map[o]=T?T+", "+l:l},y.prototype.delete=function(o){delete this.map[E(o)]},y.prototype.get=function(o){return o=E(o),this.has(o)?this.map[o]:null},y.prototype.has=function(o){return this.map.hasOwnProperty(E(o))},y.prototype.set=function(o,l){this.map[E(o)]=g(l)},y.prototype.forEach=function(o,l){for(var T in this.map)this.map.hasOwnProperty(T)&&o.call(l,this.map[T],T,this)},y.prototype.keys=function(){var o=[];return this.forEach(function(l,T){o.push(T)}),N(o)},y.prototype.values=function(){var o=[];return this.forEach(function(l){o.push(l)}),N(o)},y.prototype.entries=function(){var o=[];return this.forEach(function(l,T){o.push([T,l])}),N(o)},u.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function C(o){if(o.bodyUsed)return Promise.reject(new TypeError("Already read"));o.bodyUsed=!0}function D(o){return new Promise(function(l,T){o.onload=function(){l(o.result)},o.onerror=function(){T(o.error)}})}function k(o){var l=new FileReader,T=D(l);return l.readAsArrayBuffer(o),T}function oe(o){var l=new FileReader,T=D(l);return l.readAsText(o),T}function P(o){for(var l=new Uint8Array(o),T=new Array(l.length),O=0;O<l.length;O++)T[O]=String.fromCharCode(l[O]);return T.join("")}function w(o){if(o.slice)return o.slice(0);var l=new Uint8Array(o.byteLength);return l.set(new Uint8Array(o)),l.buffer}function G(){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=w(o.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(o)||m(o))?this._bodyArrayBuffer=w(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=C(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?C(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(k)}),this.text=function(){var o=C(this);if(o)return o;if(this._bodyBlob)return oe(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(P(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(ln)}),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 T=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 y(o.headers)),this.method=o.method,this.mode=o.mode,this.signal=o.signal,!T&&o._bodyInit!=null&&(T=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 y(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")&&T)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(T)}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function ln(o){var l=new FormData;return o.trim().split("&").forEach(function(T){if(T){var O=T.split("="),I=O.shift().replace(/\+/g," "),A=O.join("=").replace(/\+/g," ");l.append(decodeURIComponent(I),decodeURIComponent(A))}}),l}function hn(o){var l=new y,T=o.replace(/\r?\n[\t ]+/g," ");return T.split(/\r?\n/).forEach(function(O){var I=O.split(":"),A=I.shift().trim();if(A){var ue=I.join(":").trim();l.append(A,ue)}}),l}G.call(M.prototype);function L(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 y(l.headers),this.url=l.url||"",this._initBody(o)}G.call(L.prototype),L.prototype.clone=function(){return new L(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},L.error=function(){var o=new L(null,{status:0,statusText:""});return o.type="error",o};var pn=[301,302,303,307,308];L.redirect=function(o,l){if(pn.indexOf(l)===-1)throw new RangeError("Invalid status code");return new L(null,{status:l,headers:{location:o}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(l,T){this.message=l,this.name=T;var O=Error(l);this.stack=O.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function Ae(o,l){return new Promise(function(T,O){var I=new M(o,l);if(I.signal&&I.signal.aborted)return O(new a.DOMException("Aborted","AbortError"));var A=new XMLHttpRequest;function ue(){A.abort()}A.onload=function(){var J={status:A.status,statusText:A.statusText,headers:hn(A.getAllResponseHeaders()||"")};J.url="responseURL"in A?A.responseURL:J.headers.get("X-Request-URL");var Ne="response"in A?A.response:A.responseText;T(new L(Ne,J))},A.onerror=function(){O(new TypeError("Network request failed"))},A.ontimeout=function(){O(new TypeError("Network request failed"))},A.onabort=function(){O(new a.DOMException("Aborted","AbortError"))},A.open(I.method,I.url,!0),I.credentials==="include"?A.withCredentials=!0:I.credentials==="omit"&&(A.withCredentials=!1),"responseType"in A&&u.blob&&(A.responseType="blob"),I.headers.forEach(function(J,Ne){A.setRequestHeader(Ne,J)}),I.signal&&(I.signal.addEventListener("abort",ue),A.onreadystatechange=function(){A.readyState===4&&I.signal.removeEventListener("abort",ue)}),A.send(typeof I._bodyInit>"u"?null:I._bodyInit)})}return Ae.polyfill=!0,s.fetch||(s.fetch=Ae,s.Headers=y,s.Request=M,s.Response=L),a.Headers=y,a.Request=M,a.Response=L,a.fetch=Ae,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(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 te=Ee.exports;const ne=Bt(te),Ut=_({__proto__:null,default:ne},[te]),j=e=>{let t={};return e&&(typeof Headers<"u"&&e instanceof Headers||Ut&&te.Headers&&e instanceof te.Headers?t=He(e):Array.isArray(e)?e.forEach(([n,r])=>{n&&r!==void 0&&(t[n]=r)}):t=e),t},qe=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),Mt=e=>{if(!Array.isArray(e.query)){const r=e,i=[`query=${encodeURIComponent(qe(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:qe(i),variables:t.variables?t.jsonSerializer.stringify(t.variables[s]):void 0}),r),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`},qt=e=>async t=>{const{url:n,query:r,variables:i,operationName:s,fetch:a,fetchOptions:u,middleware:p}=t,d={...t.headers};let m="",E;e==="POST"?(E=jt(r,i,s,u.jsonSerializer),typeof E=="string"&&(d["Content-Type"]="application/json")):m=Mt({query:r,variables:i,operationName:s,jsonSerializer:u.jsonSerializer??F});const g={method:e,headers:d,body:E,...u};let N=n,y=g;if(p){const C=await Promise.resolve(p({...g,url:n,operationName:s,variables:i})),{url:D,...k}=C;N=D,y=k}return m&&(N=`${N}?${m}`),await a(N,y)};class Vt{constructor(t,n={}){this.url=t,this.requestConfig=n,this.rawRequest=async(...r)=>{const[i,s,a]=r,u=ze(i,s,a),{headers:p,fetch:d=ne,method:m="POST",requestMiddleware:E,responseMiddleware:g,...N}=this.requestConfig,{url:y}=this;u.signal!==void 0&&(N.signal=u.signal);const{operationName:C}=ye(u.query);return ge({url:y,query:u.query,variables:u.variables,headers:{...j(Te(p)),...j(u.requestHeaders)},operationName:C,fetch:d,method:m,fetchOptions:N,middleware:E}).then(D=>(g&&g(D),D)).catch(D=>{throw g&&g(D),D})}}async request(t,...n){const[r,i]=n,s=Ye(t,r,i),{headers:a,fetch:u=ne,method:p="POST",requestMiddleware:d,responseMiddleware:m,...E}=this.requestConfig,{url:g}=this;s.signal!==void 0&&(E.signal=s.signal);const{query:N,operationName:y}=ye(s.document);return ge({url:g,query:N,variables:s.variables,headers:{...j(Te(a)),...j(s.requestHeaders)},operationName:y,fetch:u,method:p,fetchOptions:E,middleware:d}).then(C=>(m&&m(C),C.data)).catch(C=>{throw m&&m(C),C})}batchRequests(t,n){const r=Qe(t,n),{headers:i,...s}=this.requestConfig;r.signal!==void 0&&(s.signal=r.signal);const a=r.documents.map(({document:p})=>ye(p).query),u=r.documents.map(({variables:p})=>p);return ge({url:this.url,query:a,variables:u,headers:{...j(Te(i)),...j(r.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??ne,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 ge=async e=>{const{query:t,variables:n,fetchOptions:r}=e,i=qt(Ge(e.method??"post")),s=Array.isArray(e.query),a=await i(e),u=await $t(a,r.jsonSerializer??F),p=Array.isArray(u)?!u.some(({data:m})=>!m):!!u.data,d=Array.isArray(u)||!u.errors||Array.isArray(u.errors)&&!u.errors.length||r.errorPolicy==="all"||r.errorPolicy==="ignore";if(a.ok&&d&&p){const{errors:m,...E}=(Array.isArray(u),u),g=r.errorPolicy==="ignore"?E:u;return{...s?{data:g}:g,headers:a.headers,status:a.status}}else{const m=typeof u=="string"?{error:u}:u;throw new z({...m,status:a.status,headers:a.headers},{query:t,variables:n})}},jt=(e,t,n,r)=>{const i=r??F;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((a,u,p)=>(a.push({query:u,variables:t?t[p]:void 0}),a),[]);return i.stringify(s)},$t=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()},Te=e=>typeof e=="function"?e():e;var ie=function(){return ie=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},ie.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var re=new Map,ve=new Map,Ve=!0,se=!1;function je(e){return e.replace(/[\s,]+/g," ").trim()}function Gt(e){return je(e.source.body.substring(e.start,e.end))}function Ht(e){var t=new Set,n=[];return e.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var i=r.name.value,s=Gt(r.loc),a=ve.get(i);a&&!a.has(s)?Ve&&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
- this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):c||ve.set(i,c=new Set),c.add(s),t.has(s)||(t.add(s),n.push(r))}else n.push(r)}),ie(ie({},e),{definitions:n})}function Yt(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 zt(e){var t=je(e);if(!re.has(t)){var n=Pe(e,{experimentalFragmentVariables:se,allowLegacyFragmentVariables:se});if(!n||n.kind!=="Document")throw new Error("Not a valid GraphQL document.");re.set(t,Yt(Ht(n)))}return re.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]}),zt(r)}function Qt(){re.clear(),ve.clear()}function Jt(){Ve=!1}function Xt(){se=!0}function Wt(){se=!1}var Q={gql:j,resetCaches:Qt,disableFragmentWarnings:Jt,enableExperimentalFragmentVariables:Xt,disableExperimentalFragmentVariables:Wt};(function(e){e.gql=Q.gql,e.resetCaches=Q.resetCaches,e.disableFragmentWarnings=Q.disableFragmentWarnings,e.enableExperimentalFragmentVariables=Q.enableExperimentalFragmentVariables,e.disableExperimentalFragmentVariables=Q.disableExperimentalFragmentVariables})(j||(j={})),j.default=j;const $=j,Zt=$`
51
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a||ve.set(i,a=new Set),a.add(s),t.has(s)||(t.add(s),n.push(r))}else n.push(r)}),ie(ie({},e),{definitions:n})}function Yt(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 zt(e){var t=je(e);if(!re.has(t)){var n=Fe(e,{experimentalFragmentVariables:se,allowLegacyFragmentVariables:se});if(!n||n.kind!=="Document")throw new Error("Not a valid GraphQL document.");re.set(t,Yt(Ht(n)))}return re.get(t)}function $(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]}),zt(r)}function Qt(){re.clear(),ve.clear()}function Jt(){Ve=!1}function Xt(){se=!0}function Wt(){se=!1}var Q={gql:$,resetCaches:Qt,disableFragmentWarnings:Jt,enableExperimentalFragmentVariables:Xt,disableExperimentalFragmentVariables:Wt};(function(e){e.gql=Q.gql,e.resetCaches=Q.resetCaches,e.disableFragmentWarnings=Q.disableFragmentWarnings,e.enableExperimentalFragmentVariables=Q.enableExperimentalFragmentVariables,e.disableExperimentalFragmentVariables=Q.disableExperimentalFragmentVariables})($||($={})),$.default=$;const B=$,Zt=B`
52
52
  query GetLocationAvailabilities($sku: String!, $first: Int, $after: String, $isReverse: Boolean! = false) {
53
53
  locationAvailabilities(
54
54
  sku: $sku
@@ -71,7 +71,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):c
71
71
  }
72
72
  }
73
73
  }
74
- `,Kt=$`
74
+ `,Kt=B`
75
75
  query GetLocationAvailability($sku: String!, $locationID: ID!) {
76
76
  locationAvailability(sku: $sku, locationID: $locationID) {
77
77
  location {
@@ -81,7 +81,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):c
81
81
  inventoryQuantity
82
82
  }
83
83
  }
84
- `,en=$`
84
+ `,en=B`
85
85
  query GetPurchasingCustomerMetafield($namespace: String!, $key: String!) {
86
86
  purchasingCustomerMetafield(namespace: $namespace, key: $key) {
87
87
  id
@@ -90,14 +90,14 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):c
90
90
  value
91
91
  }
92
92
  }
93
- `,tn=$`
93
+ `,tn=B`
94
94
  query GetPoints {
95
95
  purchasingCustomer {
96
96
  pointsApproved
97
97
  pointsPending
98
98
  }
99
99
  }
100
- `,nn=$`
100
+ `,nn=B`
101
101
  query GetLocations($first: Int, $after: String, $isReverse: Boolean! = false) {
102
102
  locations(first: $first, after: $after, isReverse: $isReverse) {
103
103
  nodes {
@@ -112,7 +112,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):c
112
112
  }
113
113
  }
114
114
  }
115
- `,rn=$`
115
+ `,rn=B`
116
116
  query GetPurchasingCustomerDiscounts($first: Int, $after: String, $isReverse: Boolean! = false) {
117
117
  purchasingCustomer {
118
118
  id
@@ -134,4 +134,66 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):c
134
134
  }
135
135
  }
136
136
  }
137
- `,sn=(e,t,n,r)=>e();function on(e,t=sn){return{GetLocationAvailabilities(n,r){return t(i=>e.request(Zt,n,{...r,...i}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,r){return t(i=>e.request(Kt,n,{...r,...i}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,r){return t(i=>e.request(en,n,{...r,...i}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,r){return t(i=>e.request(tn,n,{...r,...i}),"GetPoints","query",n)},GetLocations(n,r){return t(i=>e.request(nn,n,{...r,...i}),"GetLocations","query",n)},GetPurchasingCustomerDiscounts(n,r){return t(i=>e.request(rn,n,{...r,...i}),"GetPurchasingCustomerDiscounts","query",n)}}}class an{constructor(t){$e(this,"api");this.api=on(new Vt(`${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=an,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
137
+ `,sn=B`
138
+ query GetPurchasingCustomerPointChangeActivities($first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: PointChangeActivitySortKey! = CREATED_AT) {
139
+ purchasingCustomer {
140
+ id
141
+ pointChangeActivities(
142
+ first: $first
143
+ after: $after
144
+ isReverse: $isReverse
145
+ sortKeys: $sortKeys
146
+ ) {
147
+ nodes {
148
+ id
149
+ title
150
+ pointChange {
151
+ id
152
+ delta
153
+ availableAt
154
+ expiresDate
155
+ availableUntil
156
+ pointChangeCreatedAt
157
+ createdAt
158
+ }
159
+ }
160
+ pageInfo {
161
+ startCursor
162
+ endCursor
163
+ hasNextPage
164
+ hasPreviousPage
165
+ }
166
+ }
167
+ }
168
+ }
169
+ `,on=B`
170
+ query GetPurchasingCustomerRank {
171
+ purchasingCustomer {
172
+ currentCustomerRank {
173
+ id
174
+ name
175
+ threshold
176
+ higherRank {
177
+ id
178
+ name
179
+ threshold
180
+ }
181
+ lowerRank {
182
+ id
183
+ name
184
+ threshold
185
+ }
186
+ earnedPointToRankUp
187
+ purchasePriceToRankUp
188
+ calculationCondition {
189
+ customerRankCalculationPeriod {
190
+ start
191
+ end
192
+ }
193
+ earnedPoint
194
+ purchasePrice
195
+ }
196
+ }
197
+ }
198
+ }
199
+ `,an=(e,t,n,r)=>e();function cn(e,t=an){return{GetLocationAvailabilities(n,r){return t(i=>e.request(Zt,n,{...r,...i}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,r){return t(i=>e.request(Kt,n,{...r,...i}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,r){return t(i=>e.request(en,n,{...r,...i}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,r){return t(i=>e.request(tn,n,{...r,...i}),"GetPoints","query",n)},GetLocations(n,r){return t(i=>e.request(nn,n,{...r,...i}),"GetLocations","query",n)},GetPurchasingCustomerDiscounts(n,r){return t(i=>e.request(rn,n,{...r,...i}),"GetPurchasingCustomerDiscounts","query",n)},GetPurchasingCustomerPointChangeActivities(n,r){return t(i=>e.request(sn,n,{...r,...i}),"GetPurchasingCustomerPointChangeActivities","query",n)},GetPurchasingCustomerRank(n,r){return t(i=>e.request(on,n,{...r,...i}),"GetPurchasingCustomerRank","query",n)}}}class un{constructor(t){$e(this,"api");this.api=cn(new Vt(`${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(a=>({location:{name:a.location.name},inventoryQuantity:a.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){const i=await this.api.GetPurchasingCustomerDiscounts({first:t,after:n,isReverse:r});return i.purchasingCustomer?{id:i.purchasingCustomer.id,nodes:i.purchasingCustomer.discounts.nodes.map(s=>({id:s.id,title:s.title,description:s.description,code:s.code,createdAt:new Date(s.createdAt),updatedAt:new Date(s.updatedAt)}))??[],pageInfo:i.purchasingCustomer.discounts.pageInfo??null}:null}async getPointChangeActivities(t,n,r,i){const s=await this.api.GetPurchasingCustomerPointChangeActivities({first:t,after:n,isReverse:r,sortKeys:i});return s.purchasingCustomer?{nodes:s.purchasingCustomer.pointChangeActivities.nodes.map(a=>({id:a.id,title:a.title,pointChange:{id:a.pointChange.id,delta:a.pointChange.delta,availableAt:a.pointChange.availableAt?new Date(a.pointChange.availableAt):void 0,availableUntil:a.pointChange.availableUntil?new Date(a.pointChange.availableUntil):void 0,expiresDate:a.pointChange.expiresDate?new Date(a.pointChange.expiresDate):void 0,pointChangeCreatedAt:new Date(a.pointChange.pointChangeCreatedAt),createdAt:new Date(a.pointChange.createdAt)}})),pageInfo:s.purchasingCustomer.pointChangeActivities.pageInfo}:null}async getPurchasingCustomerCurrentRank(){var n;const t=await this.api.GetPurchasingCustomerRank();return(n=t.purchasingCustomer)!=null&&n.currentCustomerRank?{id:t.purchasingCustomer.currentCustomerRank.id,name:t.purchasingCustomer.currentCustomerRank.name,calculationCondition:{customerRankCalculationPeriod:t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod?{start:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.start),end:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.end)}:void 0,earnedPoint:t.purchasingCustomer.currentCustomerRank.calculationCondition.earnedPoint,purchasePrice:t.purchasingCustomer.currentCustomerRank.calculationCondition.purchasePrice},earnedPointToRankUp:t.purchasingCustomer.currentCustomerRank.earnedPointToRankUp,higherRank:t.purchasingCustomer.currentCustomerRank.higherRank?{id:t.purchasingCustomer.currentCustomerRank.higherRank.id,name:t.purchasingCustomer.currentCustomerRank.higherRank.name,threshold:t.purchasingCustomer.currentCustomerRank.higherRank.threshold}:void 0,lowerRank:t.purchasingCustomer.currentCustomerRank.lowerRank?{id:t.purchasingCustomer.currentCustomerRank.lowerRank.id,name:t.purchasingCustomer.currentCustomerRank.lowerRank.name,threshold:t.purchasingCustomer.currentCustomerRank.lowerRank.threshold}:void 0,purchasePriceToRankUp:t.purchasingCustomer.currentCustomerRank.purchasePriceToRankUp,threshold:t.purchasingCustomer.currentCustomerRank.threshold}:null}}R.SDK=un,Object.defineProperty(R,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.5",
4
+ "version": "0.0.6",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
@@ -9,10 +9,11 @@
9
9
  "type": "module",
10
10
  "scripts": {
11
11
  "dev": "vite",
12
+ "doc": "typedoc --readme README.doc.md --disableSources --excludePrivate --plugin typedoc-plugin-markdown --entryPoints ./src/index.ts && concat-md --decrease-title-levels --dir-name-as-title docs > README.md",
12
13
  "build": "tsc && vite build",
13
14
  "preview": "vite preview",
14
15
  "codegen": "graphql-codegen --config codegen.ts",
15
- "deploy": "npm run build && npm pack && npm publish"
16
+ "deploy": "npm run build && npm run doc && npm pack && npm publish"
16
17
  },
17
18
  "publishConfig": {
18
19
  "access": "public"
@@ -33,6 +34,9 @@
33
34
  "@graphql-codegen/typescript-graphql-request": "^6",
34
35
  "@graphql-codegen/typescript-operations": "^4",
35
36
  "@types/node": "^20",
37
+ "concat-md": "^0.5.1",
38
+ "typedoc": "^0.26.2",
39
+ "typedoc-plugin-markdown": "^4.1.0",
36
40
  "typescript": "^5",
37
41
  "vite": "^5",
38
42
  "vite-plugin-dts": "^3.8.3"