UNPKG

@launchdarkly/observability

Version:

Browser observability for your web app. Capture frontend metrics, errors, logs and traces.

49 lines (43 loc) 352 kB
(function(rt,Te){typeof exports=="object"&&typeof module<"u"?Te(exports):typeof define=="function"&&define.amd?define(["exports"],Te):(rt=typeof globalThis<"u"?globalThis:rt||self,Te(rt.Observability={}))})(this,function(rt){"use strict";var Te=Object.defineProperty,Oc=(t,e,n)=>e in t?Te(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,mt=(t,e,n)=>Oc(t,typeof e!="symbol"?e+"":e,n),Sc=(t,e,n)=>new Promise((r,i)=>{var o=c=>{try{u(n.next(c))}catch(s){i(s)}},a=c=>{try{u(n.throw(c))}catch(s){i(s)}},u=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,a);u((n=n.apply(t,e)).next())});const mo=Object.create(null),Tt=(t,e,...n)=>{const r=`[@launchdarkly plugins]: (${t}): `;console[e].apply(console,[r,...n]),wc(r,...n)},bt=(t,e,n,...r)=>{mo[`${t}-${e}`]||(mo[`${t}-${e}`]=!0,Tt(t,n,...r))},wc=(t,...e)=>Sc(void 0,null,function*(){try{const{LDObserve:n}=yield Promise.resolve().then(()=>Hp);n.recordLog(`${t}${e}`,"warn")}catch{}});class Ac{constructor(e,n){mt(this,"debug"),mt(this,"name"),this.debug=e,this.name=n}log(...e){if(this.debug){let n=`[${Date.now()}]`;this.name&&(n+=` - ${this.name}`),console.log.apply(console,[n,...e])}}warn(...e){let n=`[${Date.now()}]`;this.name&&(n+=` - ${this.name}`),console.warn.apply(console,[n,...e])}}let _o=class{constructor(){mt(this,"_sdk"),mt(this,"_isLoaded",!1),mt(this,"_callBuffer",[]),mt(this,"_capacity",1e5),mt(this,"_droppedEvents",0),mt(this,"_exceededCapacity",!1),mt(this,"_logger",new Ac)}_bufferCall(e,n){if(this._isLoaded)try{return this._sdk[e](...n)}catch(r){Tt(`Error executing buffered call to ${e}:`,"error",r)}else{this._enqueue({method:e,args:n});return}}_enqueue(e){this._callBuffer.length<this._capacity?(this._callBuffer.push(e),this._exceededCapacity=!1):(this._exceededCapacity||(this._exceededCapacity=!0,Tt("Exceeded event queue capacity. Increase capacity to avoid dropping events.","warn")),this._droppedEvents+=1)}load(e){this._sdk=e,this._isLoaded=!0;for(const{method:n,args:r}of this._callBuffer)try{this._sdk[n](...r)}catch(i){Tt(`Error executing buffered call to ${n}:`,"error",i)}this._callBuffer=[]}};var Lc=Object.defineProperty,Rc=Object.defineProperties,Cc=Object.getOwnPropertyDescriptors,rn=Object.getOwnPropertySymbols,go=Object.prototype.hasOwnProperty,Eo=Object.prototype.propertyIsEnumerable,rr=(t,e,n)=>e in t?Lc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,N=(t,e)=>{for(var n in e||(e={}))go.call(e,n)&&rr(t,n,e[n]);if(rn)for(var n of rn(e))Eo.call(e,n)&&rr(t,n,e[n]);return t},on=(t,e)=>Rc(t,Cc(e)),be=(t,e)=>{var n={};for(var r in t)go.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&rn)for(var r of rn(t))e.indexOf(r)<0&&Eo.call(t,r)&&(n[r]=t[r]);return n},Oe=(t,e,n)=>rr(t,typeof e!="symbol"?e+"":e,n),Zt=(t,e,n)=>new Promise((r,i)=>{var o=c=>{try{u(n.next(c))}catch(s){i(s)}},a=c=>{try{u(n.throw(c))}catch(s){i(s)}},u=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,a);u((n=n.apply(t,e)).next())});function an(t,e){throw new Error(e)}function Nc(t){return typeof t=="object"&&t!==null}function xc(t,e){throw new Error("Unexpected invariant triggered.")}const Pc=/\r\n|[\n\r]/g;function ir(t,e){let n=0,r=1;for(const i of t.body.matchAll(Pc)){if(typeof i.index=="number"||xc(),i.index>=e)break;n=i.index+i[0].length,r+=1}return{line:r,column:e+1-n}}function Ic(t){return To(t.source,ir(t.source,t.start))}function To(t,e){const n=t.locationOffset.column-1,r="".padStart(n)+t.body,i=e.line-1,o=t.locationOffset.line-1,a=e.line+o,u=e.line===1?n:0,c=e.column+u,s=`${t.name}:${a}:${c} `,l=r.split(/\r\n|[\n\r]/g),p=l[i];if(p.length>120){const f=Math.floor(c/80),y=c%80,v=[];for(let m=0;m<p.length;m+=80)v.push(p.slice(m,m+80));return s+bo([[`${a} |`,v[0]],...v.slice(1,f+1).map(m=>["|",m]),["|","^".padStart(y)],["|",v[f+1]]])}return s+bo([[`${a-1} |`,l[i-1]],[`${a} |`,p],["|","^".padStart(c)],[`${a+1} |`,l[i+1]]])}function bo(t){const e=t.filter(([r,i])=>i!==void 0),n=Math.max(...e.map(([r])=>r.length));return e.map(([r,i])=>r.padStart(n)+(i?" "+i:"")).join(` `)}function Mc(t){const e=t[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}let kc=class bc extends Error{constructor(e,...n){var r,i,o;const{nodes:a,source:u,positions:c,path:s,originalError:l,extensions:p}=Mc(n);super(e),this.name="GraphQLError",this.path=s??void 0,this.originalError=l??void 0,this.nodes=Oo(Array.isArray(a)?a:a?[a]:void 0);const f=Oo((r=this.nodes)===null||r===void 0?void 0:r.map(v=>v.loc).filter(v=>v!=null));this.source=u??(f==null||(i=f[0])===null||i===void 0?void 0:i.source),this.positions=c??f?.map(v=>v.start),this.locations=c&&u?c.map(v=>ir(u,v)):f?.map(v=>ir(v.source,v.start));const y=Nc(l?.extensions)?l?.extensions:void 0;this.extensions=(o=p??y)!==null&&o!==void 0?o: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}}),l!=null&&l.stack?Object.defineProperty(this,"stack",{value:l.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,bc):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const n of this.nodes)n.loc&&(e+=` `+Ic(n.loc));else if(this.source&&this.locations)for(const n of this.locations)e+=` `+To(this.source,n);return e}toJSON(){const e={message:this.message};return this.locations!=null&&(e.locations=this.locations),this.path!=null&&(e.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}};function Oo(t){return t===void 0||t.length===0?void 0:t}function G(t,e,n){return new kc(`Syntax Error: ${n}`,{source:t,positions:[e]})}let Dc=class{constructor(e,n,r){this.start=e.start,this.end=n.end,this.startToken=e,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},So=class{constructor(e,n,r,i,o,a){this.kind=e,this.start=n,this.end=r,this.line=i,this.column=o,this.value=a,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}};const wo={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"]},Uc=new Set(Object.keys(wo));function Ao(t){const e=t?.kind;return typeof e=="string"&&Uc.has(e)}var te;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(te||(te={}));var or;(function(t){t.QUERY="QUERY",t.MUTATION="MUTATION",t.SUBSCRIPTION="SUBSCRIPTION",t.FIELD="FIELD",t.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",t.FRAGMENT_SPREAD="FRAGMENT_SPREAD",t.INLINE_FRAGMENT="INLINE_FRAGMENT",t.VARIABLE_DEFINITION="VARIABLE_DEFINITION",t.SCHEMA="SCHEMA",t.SCALAR="SCALAR",t.OBJECT="OBJECT",t.FIELD_DEFINITION="FIELD_DEFINITION",t.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",t.INTERFACE="INTERFACE",t.UNION="UNION",t.ENUM="ENUM",t.ENUM_VALUE="ENUM_VALUE",t.INPUT_OBJECT="INPUT_OBJECT",t.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(or||(or={}));var O;(function(t){t.NAME="Name",t.DOCUMENT="Document",t.OPERATION_DEFINITION="OperationDefinition",t.VARIABLE_DEFINITION="VariableDefinition",t.SELECTION_SET="SelectionSet",t.FIELD="Field",t.ARGUMENT="Argument",t.FRAGMENT_SPREAD="FragmentSpread",t.INLINE_FRAGMENT="InlineFragment",t.FRAGMENT_DEFINITION="FragmentDefinition",t.VARIABLE="Variable",t.INT="IntValue",t.FLOAT="FloatValue",t.STRING="StringValue",t.BOOLEAN="BooleanValue",t.NULL="NullValue",t.ENUM="EnumValue",t.LIST="ListValue",t.OBJECT="ObjectValue",t.OBJECT_FIELD="ObjectField",t.DIRECTIVE="Directive",t.NAMED_TYPE="NamedType",t.LIST_TYPE="ListType",t.NON_NULL_TYPE="NonNullType",t.SCHEMA_DEFINITION="SchemaDefinition",t.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",t.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",t.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",t.FIELD_DEFINITION="FieldDefinition",t.INPUT_VALUE_DEFINITION="InputValueDefinition",t.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",t.UNION_TYPE_DEFINITION="UnionTypeDefinition",t.ENUM_TYPE_DEFINITION="EnumTypeDefinition",t.ENUM_VALUE_DEFINITION="EnumValueDefinition",t.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",t.DIRECTIVE_DEFINITION="DirectiveDefinition",t.SCHEMA_EXTENSION="SchemaExtension",t.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",t.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",t.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",t.UNION_TYPE_EXTENSION="UnionTypeExtension",t.ENUM_TYPE_EXTENSION="EnumTypeExtension",t.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(O||(O={}));function ar(t){return t===9||t===32}function Se(t){return t>=48&&t<=57}function Lo(t){return t>=97&&t<=122||t>=65&&t<=90}function Ro(t){return Lo(t)||t===95}function jc(t){return Lo(t)||Se(t)||t===95}function Bc(t){var e;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let a=0;a<t.length;++a){var o;const u=t[a],c=$c(u);c!==u.length&&(r=(o=r)!==null&&o!==void 0?o:a,i=a,a!==0&&c<n&&(n=c))}return t.map((a,u)=>u===0?a:a.slice(n)).slice((e=r)!==null&&e!==void 0?e:0,i+1)}function $c(t){let e=0;for(;e<t.length&&ar(t.charCodeAt(e));)++e;return e}function Fc(t,e){const n=t.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=r.length===1,o=r.length>1&&r.slice(1).every(y=>y.length===0||ar(y.charCodeAt(0))),a=n.endsWith('\\"""'),u=t.endsWith('"')&&!a,c=t.endsWith("\\"),s=u||c,l=!i||t.length>70||s||o||a;let p="";const f=i&&ar(t.charCodeAt(0));return(l&&!f||o)&&(p+=` `),p+=n,(l||s)&&(p+=` `),'"""'+p+'"""'}var d;(function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"})(d||(d={}));let Vc=class{constructor(e){const n=new So(d.SOF,0,0,0,0);this.source=e,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 e=this.token;if(e.kind!==d.EOF)do if(e.next)e=e.next;else{const n=Gc(this,e.end);e.next=n,n.prev=e,e=n}while(e.kind===d.COMMENT);return e}};function Hc(t){return t===d.BANG||t===d.DOLLAR||t===d.AMP||t===d.PAREN_L||t===d.PAREN_R||t===d.SPREAD||t===d.COLON||t===d.EQUALS||t===d.AT||t===d.BRACKET_L||t===d.BRACKET_R||t===d.BRACE_L||t===d.PIPE||t===d.BRACE_R}function ee(t){return t>=0&&t<=55295||t>=57344&&t<=1114111}function sn(t,e){return Co(t.charCodeAt(e))&&No(t.charCodeAt(e+1))}function Co(t){return t>=55296&&t<=56319}function No(t){return t>=56320&&t<=57343}function Pt(t,e){const n=t.source.body.codePointAt(e);if(n===void 0)return d.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(t,e,n,r,i){const o=t.line,a=1+n-t.lineStart;return new So(e,n,r,o,a,i)}function Gc(t,e){const n=t.source.body,r=n.length;let i=e;for(;i<r;){const o=n.charCodeAt(i);switch(o){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++t.line,t.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++t.line,t.lineStart=i;continue;case 35:return qc(t,i);case 33:return B(t,d.BANG,i,i+1);case 36:return B(t,d.DOLLAR,i,i+1);case 38:return B(t,d.AMP,i,i+1);case 40:return B(t,d.PAREN_L,i,i+1);case 41:return B(t,d.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return B(t,d.SPREAD,i,i+3);break;case 58:return B(t,d.COLON,i,i+1);case 61:return B(t,d.EQUALS,i,i+1);case 64:return B(t,d.AT,i,i+1);case 91:return B(t,d.BRACKET_L,i,i+1);case 93:return B(t,d.BRACKET_R,i,i+1);case 123:return B(t,d.BRACE_L,i,i+1);case 124:return B(t,d.PIPE,i,i+1);case 125:return B(t,d.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?Jc(t,i):Xc(t,i)}if(Se(o)||o===45)return zc(t,i,o);if(Ro(o))return Qc(t,i);throw G(t.source,i,o===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:ee(o)||sn(n,i)?`Unexpected character: ${Pt(t,i)}.`:`Invalid character: ${Pt(t,i)}.`)}return B(t,d.EOF,r,r)}function qc(t,e){const n=t.source.body,r=n.length;let i=e+1;for(;i<r;){const o=n.charCodeAt(i);if(o===10||o===13)break;if(ee(o))++i;else if(sn(n,i))i+=2;else break}return B(t,d.COMMENT,e,i,n.slice(e+1,i))}function zc(t,e,n){const r=t.source.body;let i=e,o=n,a=!1;if(o===45&&(o=r.charCodeAt(++i)),o===48){if(o=r.charCodeAt(++i),Se(o))throw G(t.source,i,`Invalid number, unexpected digit after 0: ${Pt(t,i)}.`)}else i=sr(t,i,o),o=r.charCodeAt(i);if(o===46&&(a=!0,o=r.charCodeAt(++i),i=sr(t,i,o),o=r.charCodeAt(i)),(o===69||o===101)&&(a=!0,o=r.charCodeAt(++i),(o===43||o===45)&&(o=r.charCodeAt(++i)),i=sr(t,i,o),o=r.charCodeAt(i)),o===46||Ro(o))throw G(t.source,i,`Invalid number, expected digit but got: ${Pt(t,i)}.`);return B(t,a?d.FLOAT:d.INT,e,i,r.slice(e,i))}function sr(t,e,n){if(!Se(n))throw G(t.source,e,`Invalid number, expected digit but got: ${Pt(t,e)}.`);const r=t.source.body;let i=e+1;for(;Se(r.charCodeAt(i));)++i;return i}function Xc(t,e){const n=t.source.body,r=n.length;let i=e+1,o=i,a="";for(;i<r;){const u=n.charCodeAt(i);if(u===34)return a+=n.slice(o,i),B(t,d.STRING,e,i+1,a);if(u===92){a+=n.slice(o,i);const c=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?Kc(t,i):Wc(t,i):Yc(t,i);a+=c.value,i+=c.size,o=i;continue}if(u===10||u===13)break;if(ee(u))++i;else if(sn(n,i))i+=2;else throw G(t.source,i,`Invalid character within String: ${Pt(t,i)}.`)}throw G(t.source,i,"Unterminated string.")}function Kc(t,e){const n=t.source.body;let r=0,i=3;for(;i<12;){const o=n.charCodeAt(e+i++);if(o===125){if(i<5||!ee(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|we(o),r<0)break}throw G(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+i)}".`)}function Wc(t,e){const n=t.source.body,r=xo(n,e+2);if(ee(r))return{value:String.fromCodePoint(r),size:6};if(Co(r)&&n.charCodeAt(e+6)===92&&n.charCodeAt(e+7)===117){const i=xo(n,e+8);if(No(i))return{value:String.fromCodePoint(r,i),size:12}}throw G(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+6)}".`)}function xo(t,e){return we(t.charCodeAt(e))<<12|we(t.charCodeAt(e+1))<<8|we(t.charCodeAt(e+2))<<4|we(t.charCodeAt(e+3))}function we(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function Yc(t,e){const n=t.source.body;switch(n.charCodeAt(e+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:` `,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw G(t.source,e,`Invalid character escape sequence: "${n.slice(e,e+2)}".`)}function Jc(t,e){const n=t.source.body,r=n.length;let i=t.lineStart,o=e+3,a=o,u="";const c=[];for(;o<r;){const s=n.charCodeAt(o);if(s===34&&n.charCodeAt(o+1)===34&&n.charCodeAt(o+2)===34){u+=n.slice(a,o),c.push(u);const l=B(t,d.BLOCK_STRING,e,o+3,Bc(c).join(` `));return t.line+=c.length-1,t.lineStart=i,l}if(s===92&&n.charCodeAt(o+1)===34&&n.charCodeAt(o+2)===34&&n.charCodeAt(o+3)===34){u+=n.slice(a,o),a=o+1,o+=4;continue}if(s===10||s===13){u+=n.slice(a,o),c.push(u),s===13&&n.charCodeAt(o+1)===10?o+=2:++o,u="",a=o,i=o;continue}if(ee(s))++o;else if(sn(n,o))o+=2;else throw G(t.source,o,`Invalid character within String: ${Pt(t,o)}.`)}throw G(t.source,o,"Unterminated string.")}function Qc(t,e){const n=t.source.body,r=n.length;let i=e+1;for(;i<r;){const o=n.charCodeAt(i);if(jc(o))++i;else break}return B(t,d.NAME,e,i,n.slice(e,i))}const Zc=10,Po=2;function ur(t){return un(t,[])}function un(t,e){switch(typeof t){case"string":return JSON.stringify(t);case"function":return t.name?`[function ${t.name}]`:"[function]";case"object":return tl(t,e);default:return String(t)}}function tl(t,e){if(t===null)return"null";if(e.includes(t))return"[Circular]";const n=[...e,t];if(el(t)){const r=t.toJSON();if(r!==t)return typeof r=="string"?r:un(r,n)}else if(Array.isArray(t))return rl(t,n);return nl(t,n)}function el(t){return typeof t.toJSON=="function"}function nl(t,e){const n=Object.entries(t);return n.length===0?"{}":e.length>Po?"["+il(t)+"]":"{ "+n.map(([r,i])=>r+": "+un(i,e)).join(", ")+" }"}function rl(t,e){if(t.length===0)return"[]";if(e.length>Po)return"[Array]";const n=Math.min(Zc,t.length),r=t.length-n,i=[];for(let o=0;o<n;++o)i.push(un(t[o],e));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function il(t){const e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){const n=t.constructor.name;if(typeof n=="string"&&n!=="")return n}return e}const ol=globalThis.process&&process.env.NODE_ENV==="production",al=ol?function(t,e){return t instanceof e}:function(t,e){if(t instanceof e)return!0;if(typeof t=="object"&&t!==null){var n;const r=e.prototype[Symbol.toStringTag],i=Symbol.toStringTag in t?t[Symbol.toStringTag]:(n=t.constructor)===null||n===void 0?void 0:n.name;if(r===i){const o=ur(t);throw new Error(`Cannot use ${r} "${o}" from another module or realm. Ensure that there is only one instance of "graphql" in the node_modules directory. If different versions of "graphql" are the dependencies of other relied on modules, use "resolutions" to ensure only one version is installed. https://yarnpkg.com/en/docs/selective-version-resolutions Duplicate "graphql" modules cannot be used at the same time since different versions may have different capabilities and behavior. The data from one version used in the function from another could produce confusing and spurious results.`)}}return!1};let Io=class{constructor(e,n="GraphQL request",r={line:1,column:1}){typeof e=="string"||an(!1,`Body must be a string. Received: ${ur(e)}.`),this.body=e,this.name=n,this.locationOffset=r,this.locationOffset.line>0||an(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||an(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function sl(t){return al(t,Io)}function Mo(t,e){const n=new ul(t,e),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}let ul=class{constructor(e,n={}){const r=sl(e)?e:new Io(e);this._lexer=new Vc(r),this._options=n,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const e=this.expectToken(d.NAME);return this.node(e,{kind:O.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:O.DOCUMENT,definitions:this.many(d.SOF,this.parseDefinition,d.EOF)})}parseDefinition(){if(this.peek(d.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),n=e?this._lexer.lookahead():this._lexer.token;if(n.kind===d.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(e)throw G(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 e=this._lexer.token;if(this.peek(d.BRACE_L))return this.node(e,{kind:O.OPERATION_DEFINITION,operation:te.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseOperationType();let r;return this.peek(d.NAME)&&(r=this.parseName()),this.node(e,{kind:O.OPERATION_DEFINITION,operation:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(d.NAME);switch(e.value){case"query":return te.QUERY;case"mutation":return te.MUTATION;case"subscription":return te.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(d.PAREN_L,this.parseVariableDefinition,d.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:O.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(d.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(d.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(d.DOLLAR),this.node(e,{kind:O.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:O.SELECTION_SET,selections:this.many(d.BRACE_L,this.parseSelection,d.BRACE_R)})}parseSelection(){return this.peek(d.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,n=this.parseName();let r,i;return this.expectOptionalToken(d.COLON)?(r=n,i=this.parseName()):i=n,this.node(e,{kind:O.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(d.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const n=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(d.PAREN_L,n,d.PAREN_R)}parseArgument(e=!1){const n=this._lexer.token,r=this.parseName();return this.expectToken(d.COLON),this.node(n,{kind:O.ARGUMENT,name:r,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(d.SPREAD);const n=this.expectOptionalKeyword("on");return!n&&this.peek(d.NAME)?this.node(e,{kind:O.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:O.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:O.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:O.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(e){const n=this._lexer.token;switch(n.kind){case d.BRACKET_L:return this.parseList(e);case d.BRACE_L:return this.parseObject(e);case d.INT:return this.advanceLexer(),this.node(n,{kind:O.INT,value:n.value});case d.FLOAT:return this.advanceLexer(),this.node(n,{kind:O.FLOAT,value:n.value});case d.STRING:case d.BLOCK_STRING:return this.parseStringLiteral();case d.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:O.BOOLEAN,value:!0});case"false":return this.node(n,{kind:O.BOOLEAN,value:!1});case"null":return this.node(n,{kind:O.NULL});default:return this.node(n,{kind:O.ENUM,value:n.value})}case d.DOLLAR:if(e)if(this.expectToken(d.DOLLAR),this._lexer.token.kind===d.NAME){const r=this._lexer.token.value;throw G(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 e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:O.STRING,value:e.value,block:e.kind===d.BLOCK_STRING})}parseList(e){const n=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:O.LIST,values:this.any(d.BRACKET_L,n,d.BRACKET_R)})}parseObject(e){const n=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:O.OBJECT,fields:this.any(d.BRACE_L,n,d.BRACE_R)})}parseObjectField(e){const n=this._lexer.token,r=this.parseName();return this.expectToken(d.COLON),this.node(n,{kind:O.OBJECT_FIELD,name:r,value:this.parseValueLiteral(e)})}parseDirectives(e){const n=[];for(;this.peek(d.AT);)n.push(this.parseDirective(e));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const n=this._lexer.token;return this.expectToken(d.AT),this.node(n,{kind:O.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let n;if(this.expectOptionalToken(d.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(d.BRACKET_R),n=this.node(e,{kind:O.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(d.BANG)?this.node(e,{kind:O.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:O.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(d.STRING)||this.peek(d.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");const r=this.parseConstDirectives(),i=this.many(d.BRACE_L,this.parseOperationTypeDefinition,d.BRACE_R);return this.node(e,{kind:O.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,n=this.parseOperationType();this.expectToken(d.COLON);const r=this.parseNamedType();return this.node(e,{kind:O.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");const r=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:O.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");const r=this.parseName(),i=this.parseImplementsInterfaces(),o=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(e,{kind:O.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:o,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(d.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(d.BRACE_L,this.parseFieldDefinition,d.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(d.COLON);const o=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(e,{kind:O.FIELD_DEFINITION,description:n,name:r,arguments:i,type:o,directives:a})}parseArgumentDefs(){return this.optionalMany(d.PAREN_L,this.parseInputValueDef,d.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(d.COLON);const i=this.parseTypeReference();let o;this.expectOptionalToken(d.EQUALS)&&(o=this.parseConstValueLiteral());const a=this.parseConstDirectives();return this.node(e,{kind:O.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:o,directives:a})}parseInterfaceTypeDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),i=this.parseImplementsInterfaces(),o=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(e,{kind:O.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:o,fields:a})}parseUnionTypeDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");const r=this.parseName(),i=this.parseConstDirectives(),o=this.parseUnionMemberTypes();return this.node(e,{kind:O.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:o})}parseUnionMemberTypes(){return this.expectOptionalToken(d.EQUALS)?this.delimitedMany(d.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");const r=this.parseName(),i=this.parseConstDirectives(),o=this.parseEnumValuesDefinition();return this.node(e,{kind:O.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:o})}parseEnumValuesDefinition(){return this.optionalMany(d.BRACE_L,this.parseEnumValueDefinition,d.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:O.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 G(this._lexer.source,this._lexer.token.start,`${cn(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");const r=this.parseName(),i=this.parseConstDirectives(),o=this.parseInputFieldsDefinition();return this.node(e,{kind:O.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:o})}parseInputFieldsDefinition(){return this.optionalMany(d.BRACE_L,this.parseInputValueDef,d.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===d.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.optionalMany(d.BRACE_L,this.parseOperationTypeDefinition,d.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:O.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){const e=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(e,{kind:O.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&o.length===0)throw this.unexpected();return this.node(e,{kind:O.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:o})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&o.length===0)throw this.unexpected();return this.node(e,{kind:O.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:o})}parseUnionTypeExtension(){const e=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(e,{kind:O.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){const e=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(e,{kind:O.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){const e=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(e,{kind:O.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(d.AT);const r=this.parseName(),i=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const a=this.parseDirectiveLocations();return this.node(e,{kind:O.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:o,locations:a})}parseDirectiveLocations(){return this.delimitedMany(d.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(or,n.value))return n;throw this.unexpected(e)}node(e,n){return this._options.noLocation!==!0&&(n.loc=new Dc(e,this._lexer.lastToken,this._lexer.source)),n}peek(e){return this._lexer.token.kind===e}expectToken(e){const n=this._lexer.token;if(n.kind===e)return this.advanceLexer(),n;throw G(this._lexer.source,n.start,`Expected ${ko(e)}, found ${cn(n)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){const n=this._lexer.token;if(n.kind===d.NAME&&n.value===e)this.advanceLexer();else throw G(this._lexer.source,n.start,`Expected "${e}", found ${cn(n)}.`)}expectOptionalKeyword(e){const n=this._lexer.token;return n.kind===d.NAME&&n.value===e?(this.advanceLexer(),!0):!1}unexpected(e){const n=e??this._lexer.token;return G(this._lexer.source,n.start,`Unexpected ${cn(n)}.`)}any(e,n,r){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(e,n,r){if(this.expectOptionalToken(e)){const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}return[]}many(e,n,r){this.expectToken(e);const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(e,n){this.expectOptionalToken(e);const r=[];do r.push(n.call(this));while(this.expectOptionalToken(e));return r}advanceLexer(){const{maxTokens:e}=this._options,n=this._lexer.advance();if(n.kind!==d.EOF&&(++this._tokenCounter,e!==void 0&&this._tokenCounter>e))throw G(this._lexer.source,n.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};function cn(t){const e=t.value;return ko(t.kind)+(e!=null?` "${e}"`:"")}function ko(t){return Hc(t)?`"${t}"`:t}function cl(t){return`"${t.replace(ll,pl)}"`}const ll=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function pl(t){return fl[t.charCodeAt(0)]}const fl=["\\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"],hl=Object.freeze({});function dl(t,e,n=wo){const r=new Map;for(const E of Object.values(O))r.set(E,vl(e,E));let i,o=Array.isArray(t),a=[t],u=-1,c=[],s=t,l,p;const f=[],y=[];do{u++;const E=u===a.length,S=E&&c.length!==0;if(E){if(l=y.length===0?void 0:f[f.length-1],s=p,p=y.pop(),S)if(o){s=s.slice();let U=0;for(const[z,F]of c){const j=z-U;F===null?(s.splice(j,1),U++):s[j]=F}}else{s=N({},s);for(const[U,z]of c)s[U]=z}u=i.index,a=i.keys,c=i.edits,o=i.inArray,i=i.prev}else if(p){if(l=o?u:a[u],s=p[l],s==null)continue;f.push(l)}let I;if(!Array.isArray(s)){var v,m;Ao(s)||an(!1,`Invalid AST Node: ${ur(s)}.`);const U=E?(v=r.get(s.kind))===null||v===void 0?void 0:v.leave:(m=r.get(s.kind))===null||m===void 0?void 0:m.enter;if(I=U?.call(e,s,l,p,f,y),I===hl)break;if(I===!1){if(!E){f.pop();continue}}else if(I!==void 0&&(c.push([l,I]),!E))if(Ao(I))s=I;else{f.pop();continue}}if(I===void 0&&S&&c.push([l,s]),E)f.pop();else{var _;i={inArray:o,index:u,keys:a,edits:c,prev:i},o=Array.isArray(s),a=o?s:(_=n[s.kind])!==null&&_!==void 0?_:[],u=-1,c=[],p&&y.push(p),p=s}}while(i!==void 0);return c.length!==0?c[c.length-1][1]:t}function vl(t,e){const n=t[e];return typeof n=="object"?n:typeof n=="function"?{enter:n,leave:void 0}:{enter:t.enter,leave:t.leave}}function yl(t){return dl(t,_l)}const ml=80,_l={Name:{leave:t=>t.value},Variable:{leave:t=>"$"+t.name},Document:{leave:t=>b(t.definitions,` `)},OperationDefinition:{leave(t){const e=R("(",b(t.variableDefinitions,", "),")"),n=b([t.operation,b([t.name,e]),b(t.directives," ")]," ");return(n==="query"?"":n+" ")+t.selectionSet}},VariableDefinition:{leave:({variable:t,type:e,defaultValue:n,directives:r})=>t+": "+e+R(" = ",n)+R(" ",b(r," "))},SelectionSet:{leave:({selections:t})=>ut(t)},Field:{leave({alias:t,name:e,arguments:n,directives:r,selectionSet:i}){const o=R("",t,": ")+e;let a=o+R("(",b(n,", "),")");return a.length>ml&&(a=o+R(`( `,ln(b(n,` `)),` )`)),b([a,b(r," "),i]," ")}},Argument:{leave:({name:t,value:e})=>t+": "+e},FragmentSpread:{leave:({name:t,directives:e})=>"..."+t+R(" ",b(e," "))},InlineFragment:{leave:({typeCondition:t,directives:e,selectionSet:n})=>b(["...",R("on ",t),b(e," "),n]," ")},FragmentDefinition:{leave:({name:t,typeCondition:e,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${t}${R("(",b(n,", "),")")} on ${e} ${R("",b(r," ")," ")}`+i},IntValue:{leave:({value:t})=>t},FloatValue:{leave:({value:t})=>t},StringValue:{leave:({value:t,block:e})=>e?Fc(t):cl(t)},BooleanValue:{leave:({value:t})=>t?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:t})=>t},ListValue:{leave:({values:t})=>"["+b(t,", ")+"]"},ObjectValue:{leave:({fields:t})=>"{"+b(t,", ")+"}"},ObjectField:{leave:({name:t,value:e})=>t+": "+e},Directive:{leave:({name:t,arguments:e})=>"@"+t+R("(",b(e,", "),")")},NamedType:{leave:({name:t})=>t},ListType:{leave:({type:t})=>"["+t+"]"},NonNullType:{leave:({type:t})=>t+"!"},SchemaDefinition:{leave:({description:t,directives:e,operationTypes:n})=>R("",t,` `)+b(["schema",b(e," "),ut(n)]," ")},OperationTypeDefinition:{leave:({operation:t,type:e})=>t+": "+e},ScalarTypeDefinition:{leave:({description:t,name:e,directives:n})=>R("",t,` `)+b(["scalar",e,b(n," ")]," ")},ObjectTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:r,fields:i})=>R("",t,` `)+b(["type",e,R("implements ",b(n," & ")),b(r," "),ut(i)]," ")},FieldDefinition:{leave:({description:t,name:e,arguments:n,type:r,directives:i})=>R("",t,` `)+e+(Do(n)?R(`( `,ln(b(n,` `)),` )`):R("(",b(n,", "),")"))+": "+r+R(" ",b(i," "))},InputValueDefinition:{leave:({description:t,name:e,type:n,defaultValue:r,directives:i})=>R("",t,` `)+b([e+": "+n,R("= ",r),b(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:r,fields:i})=>R("",t,` `)+b(["interface",e,R("implements ",b(n," & ")),b(r," "),ut(i)]," ")},UnionTypeDefinition:{leave:({description:t,name:e,directives:n,types:r})=>R("",t,` `)+b(["union",e,b(n," "),R("= ",b(r," | "))]," ")},EnumTypeDefinition:{leave:({description:t,name:e,directives:n,values:r})=>R("",t,` `)+b(["enum",e,b(n," "),ut(r)]," ")},EnumValueDefinition:{leave:({description:t,name:e,directives:n})=>R("",t,` `)+b([e,b(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:t,name:e,directives:n,fields:r})=>R("",t,` `)+b(["input",e,b(n," "),ut(r)]," ")},DirectiveDefinition:{leave:({description:t,name:e,arguments:n,repeatable:r,locations:i})=>R("",t,` `)+"directive @"+e+(Do(n)?R(`( `,ln(b(n,` `)),` )`):R("(",b(n,", "),")"))+(r?" repeatable":"")+" on "+b(i," | ")},SchemaExtension:{leave:({directives:t,operationTypes:e})=>b(["extend schema",b(t," "),ut(e)]," ")},ScalarTypeExtension:{leave:({name:t,directives:e})=>b(["extend scalar",t,b(e," ")]," ")},ObjectTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:r})=>b(["extend type",t,R("implements ",b(e," & ")),b(n," "),ut(r)]," ")},InterfaceTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:r})=>b(["extend interface",t,R("implements ",b(e," & ")),b(n," "),ut(r)]," ")},UnionTypeExtension:{leave:({name:t,directives:e,types:n})=>b(["extend union",t,b(e," "),R("= ",b(n," | "))]," ")},EnumTypeExtension:{leave:({name:t,directives:e,values:n})=>b(["extend enum",t,b(e," "),ut(n)]," ")},InputObjectTypeExtension:{leave:({name:t,directives:e,fields:n})=>b(["extend input",t,b(e," "),ut(n)]," ")}};function b(t,e=""){var n;return(n=t?.filter(r=>r).join(e))!==null&&n!==void 0?n:""}function ut(t){return R(`{ `,ln(b(t,` `)),` }`)}function R(t,e,n=""){return e!=null&&e!==""?t+e+n:""}function ln(t){return R(" ",t.replace(/\n/g,` `))}function Do(t){var e;return(e=t?.some(n=>n.includes(` `)))!==null&&e!==void 0?e:!1}const cr=JSON,gl=t=>t.toUpperCase(),El=t=>{const e={};return t.forEach((n,r)=>{e[r]=n}),e},Tl=(t,e,n)=>t.document?t:{document:t,variables:e,requestHeaders:n,signal:void 0},bl=(t,e,n)=>t.query?t:{query:t,variables:e,requestHeaders:n,signal:void 0},Ol=(t,e)=>t.documents?t:{documents:t,requestHeaders:e,signal:void 0},Uo=t=>{var e,n;let r;const i=t.definitions.filter(o=>o.kind==="OperationDefinition");return i.length===1&&(r=(n=(e=i[0])==null?void 0:e.name)==null?void 0:n.value),r},lr=t=>{if(typeof t=="string"){let n;try{const r=Mo(t);n=Uo(r)}catch{}return{query:t,operationName:n}}const e=Uo(t);return{query:yl(t),operationName:e}};let jo=class nr extends Error{constructor(e,n){const r=`${nr.extractMessage(e)}: ${JSON.stringify({response:e,request:n})}`;super(r),Object.setPrototypeOf(this,nr.prototype),this.response=e,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,nr)}static extractMessage(e){var n,r,i;return(i=(r=(n=e.errors)==null?void 0:n[0])==null?void 0:r.message)!=null?i:`GraphQL Error (Code: ${e.status})`}};var pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var fr={exports:{}};(function(t,e){var n=typeof self<"u"?self:pr,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(a){var u={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function c(h){return h&&DataView.prototype.isPrototypeOf(h)}if(u.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(h){return h&&s.indexOf(Object.prototype.toString.call(h))>-1};function p(h){if(typeof h!="string"&&(h=String(h)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(h))throw new TypeError("Invalid character in header field name");return h.toLowerCase()}function f(h){return typeof h!="string"&&(h=String(h)),h}function y(h){var g={next:function(){var L=h.shift();return{done:L===void 0,value:L}}};return u.iterable&&(g[Symbol.iterator]=function(){return g}),g}function v(h){this.map={},h instanceof v?h.forEach(function(g,L){this.append(L,g)},this):Array.isArray(h)?h.forEach(function(g){this.append(g[0],g[1])},this):h&&Object.getOwnPropertyNames(h).forEach(function(g){this.append(g,h[g])},this)}v.prototype.append=function(h,g){h=p(h),g=f(g);var L=this.map[h];this.map[h]=L?L+", "+g:g},v.prototype.delete=function(h){delete this.map[p(h)]},v.prototype.get=function(h){return h=p(h),this.has(h)?this.map[h]:null},v.prototype.has=function(h){return this.map.hasOwnProperty(p(h))},v.prototype.set=function(h,g){this.map[p(h)]=f(g)},v.prototype.forEach=function(h,g){for(var L in this.map)this.map.hasOwnProperty(L)&&h.call(g,this.map[L],L,this)},v.prototype.keys=function(){var h=[];return this.forEach(function(g,L){h.push(L)}),y(h)},v.prototype.values=function(){var h=[];return this.forEach(function(g){h.push(g)}),y(h)},v.prototype.entries=function(){var h=[];return this.forEach(function(g,L){h.push([L,g])}),y(h)},u.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function m(h){if(h.bodyUsed)return Promise.reject(new TypeError("Already read"));h.bodyUsed=!0}function _(h){return new Promise(function(g,L){h.onload=function(){g(h.result)},h.onerror=function(){L(h.error)}})}function E(h){var g=new FileReader,L=_(g);return g.readAsArrayBuffer(h),L}function S(h){var g=new FileReader,L=_(g);return g.readAsText(h),L}function I(h){for(var g=new Uint8Array(h),L=new Array(g.length),H=0;H<g.length;H++)L[H]=String.fromCharCode(g[H]);return L.join("")}function U(h){if(h.slice)return h.slice(0);var g=new Uint8Array(h.byteLength);return g.set(new Uint8Array(h)),g.buffer}function z(){return this.bodyUsed=!1,this._initBody=function(h){this._bodyInit=h,h?typeof h=="string"?this._bodyText=h:u.blob&&Blob.prototype.isPrototypeOf(h)?this._bodyBlob=h:u.formData&&FormData.prototype.isPrototypeOf(h)?this._bodyFormData=h:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(h)?this._bodyText=h.toString():u.arrayBuffer&&u.blob&&c(h)?(this._bodyArrayBuffer=U(h.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(h)||l(h))?this._bodyArrayBuffer=U(h):this._bodyText=h=Object.prototype.toString.call(h):this._bodyText="",this.headers.get("content-type")||(typeof h=="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(h)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var h=m(this);if(h)return h;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?m(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(E)}),this.text=function(){var h=m(this);if(h)return h;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(I(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(st)}),this.json=function(){return this.text().then(JSON.parse)},this}var F=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function j(h){var g=h.toUpperCase();return F.indexOf(g)>-1?g:h}function V(h,g){g=g||{};var L=g.body;if(h instanceof V){if(h.bodyUsed)throw new TypeError("Already read");this.url=h.url,this.credentials=h.credentials,g.headers||(this.headers=new v(h.headers)),this.method=h.method,this.mode=h.mode,this.signal=h.signal,!L&&h._bodyInit!=null&&(L=h._bodyInit,h.bodyUsed=!0)}else this.url=String(h);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new v(g.headers)),this.method=j(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")