@spritz-finance/api-client 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/spritz-api-client.cjs +1 -1
- package/dist/spritz-api-client.d.ts +264 -1838
- package/dist/spritz-api-client.mjs +1 -1
- package/package.json +1 -1
|
@@ -39,7 +39,7 @@ spurious results.`))}}return!1};function Ap(e,n){for(var t=0;t<n.length;t++){var
|
|
|
39
39
|
`))}function Lp(e){return e.indexOf(`
|
|
40
40
|
`)!==-1}function lc(e){return e!=null&&e.some(Lp)}function Nr(e,n){switch(e.kind){case C.NULL:return null;case C.INT:return parseInt(e.value,10);case C.FLOAT:return parseFloat(e.value);case C.STRING:case C.ENUM:case C.BOOLEAN:return e.value;case C.LIST:return e.values.map(function(t){return Nr(t,n)});case C.OBJECT:return Ir(e.fields,function(t){return t.name.value},function(t){return Nr(t.value,n)});case C.VARIABLE:return n?.[e.name.value]}Nt(0,"Unexpected value node: "+J(e))}function Zp(e,n){for(var t=0;t<n.length;t++){var u=n[t];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,u.key,u)}}function jn(e,n,t){return n&&Zp(e.prototype,n),e}function dc(e){return Ot(e)||Ze(e)||$e(e)||rn(e)||an(e)||An(e)||zt(e)||Ln(e)}function Vp(e){if(!dc(e))throw new Error("Expected ".concat(J(e)," to be a GraphQL type."));return e}function Ot(e){return Je(e,wn)}function Ze(e){return Je(e,on)}function $e(e){return Je(e,hc)}function rn(e){return Je(e,gc)}function an(e){return Je(e,wi)}function An(e){return Je(e,Ec)}function zt(e){return Je(e,se)}function Ln(e){return Je(e,j)}function Zn(e){return Ot(e)||an(e)||An(e)||Or(e)&&Zn(e.ofType)}function Bi(e){return Ot(e)||Ze(e)||$e(e)||rn(e)||an(e)||Or(e)&&Bi(e.ofType)}function qp(e){return Ot(e)||an(e)}function Tr(e){return Ze(e)||$e(e)||rn(e)}function Mp(e){return $e(e)||rn(e)}function se(e){if(this instanceof se)this.ofType=Vp(e);else return new se(e)}se.prototype.toString=function(){return"["+String(this.ofType)+"]"},se.prototype.toJSON=function(){return this.toString()},Object.defineProperty(se.prototype,Ce,{get:function(){return"GraphQLList"}}),Oe(se);function j(e){if(this instanceof j)this.ofType=Jp(e);else return new j(e)}j.prototype.toString=function(){return String(this.ofType)+"!"},j.prototype.toJSON=function(){return this.toString()},Object.defineProperty(j.prototype,Ce,{get:function(){return"GraphQLNonNull"}}),Oe(j);function Or(e){return zt(e)||Ln(e)}function Gp(e){return dc(e)&&!Ln(e)}function Jp(e){if(!Gp(e))throw new Error("Expected ".concat(J(e)," to be a GraphQL nullable type."));return e}function Hp(e){if(e)return Ln(e)?e.ofType:e}function Ut(e){if(e){for(var n=e;Or(n);)n=n.ofType;return n}}function Ai(e){return typeof e=="function"?e():e}function Vn(e){return e&&e.length>0?e:void 0}var wn=function(){function e(t){var u,i,r,a=(u=t.parseValue)!==null&&u!==void 0?u:sc;this.name=t.name,this.description=t.description,this.specifiedByUrl=t.specifiedByUrl,this.serialize=(i=t.serialize)!==null&&i!==void 0?i:sc,this.parseValue=a,this.parseLiteral=(r=t.parseLiteral)!==null&&r!==void 0?r:function(o,s){return a(Nr(o,s))},this.extensions=t.extensions&&we(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=Vn(t.extensionASTNodes),typeof t.name=="string"||q(0,"Must provide name."),t.specifiedByUrl==null||typeof t.specifiedByUrl=="string"||q(0,"".concat(this.name,' must provide "specifiedByUrl" as a string, ')+"but got: ".concat(J(t.specifiedByUrl),".")),t.serialize==null||typeof t.serialize=="function"||q(0,"".concat(this.name,' must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.')),t.parseLiteral&&(typeof t.parseValue=="function"&&typeof t.parseLiteral=="function"||q(0,"".concat(this.name,' must provide both "parseValue" and "parseLiteral" functions.')))}var n=e.prototype;return n.toConfig=function(){var u;return{name:this.name,description:this.description,specifiedByUrl:this.specifiedByUrl,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:(u=this.extensionASTNodes)!==null&&u!==void 0?u:[]}},n.toString=function(){return this.name},n.toJSON=function(){return this.toString()},jn(e,[{key:Ce,get:function(){return"GraphQLScalarType"}}]),e}();Oe(wn);var on=function(){function e(t){this.name=t.name,this.description=t.description,this.isTypeOf=t.isTypeOf,this.extensions=t.extensions&&we(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=Vn(t.extensionASTNodes),this._fields=mc.bind(void 0,t),this._interfaces=fc.bind(void 0,t),typeof t.name=="string"||q(0,"Must provide name."),t.isTypeOf==null||typeof t.isTypeOf=="function"||q(0,"".concat(this.name,' must provide "isTypeOf" as a function, ')+"but got: ".concat(J(t.isTypeOf),"."))}var n=e.prototype;return n.getFields=function(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields},n.getInterfaces=function(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces},n.toConfig=function(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:vc(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes||[]}},n.toString=function(){return this.name},n.toJSON=function(){return this.toString()},jn(e,[{key:Ce,get:function(){return"GraphQLObjectType"}}]),e}();Oe(on);function fc(e){var n,t=(n=Ai(e.interfaces))!==null&&n!==void 0?n:[];return Array.isArray(t)||q(0,"".concat(e.name," interfaces must be an Array or a function which returns an Array.")),t}function mc(e){var n=Ai(e.fields);return qn(n)||q(0,"".concat(e.name," fields must be an object with field names as keys or a function which returns such an object.")),ki(n,function(t,u){var i;qn(t)||q(0,"".concat(e.name,".").concat(u," field config must be an object.")),!("isDeprecated"in t)||q(0,"".concat(e.name,".").concat(u,' should provide "deprecationReason" instead of "isDeprecated".')),t.resolve==null||typeof t.resolve=="function"||q(0,"".concat(e.name,".").concat(u," field resolver must be a function if ")+"provided, but got: ".concat(J(t.resolve),"."));var r=(i=t.args)!==null&&i!==void 0?i:{};qn(r)||q(0,"".concat(e.name,".").concat(u," args must be an object with argument names as keys."));var a=Tt(r).map(function(o){var s=o[0],c=o[1];return{name:s,description:c.description,type:c.type,defaultValue:c.defaultValue,deprecationReason:c.deprecationReason,extensions:c.extensions&&we(c.extensions),astNode:c.astNode}});return{name:u,description:t.description,type:t.type,args:a,resolve:t.resolve,subscribe:t.subscribe,isDeprecated:t.deprecationReason!=null,deprecationReason:t.deprecationReason,extensions:t.extensions&&we(t.extensions),astNode:t.astNode}})}function qn(e){return Sn(e)&&!Array.isArray(e)}function vc(e){return ki(e,function(n){return{description:n.description,type:n.type,args:pc(n.args),resolve:n.resolve,subscribe:n.subscribe,deprecationReason:n.deprecationReason,extensions:n.extensions,astNode:n.astNode}})}function pc(e){return Ir(e,function(n){return n.name},function(n){return{description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:n.extensions,astNode:n.astNode}})}var hc=function(){function e(t){this.name=t.name,this.description=t.description,this.resolveType=t.resolveType,this.extensions=t.extensions&&we(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=Vn(t.extensionASTNodes),this._fields=mc.bind(void 0,t),this._interfaces=fc.bind(void 0,t),typeof t.name=="string"||q(0,"Must provide name."),t.resolveType==null||typeof t.resolveType=="function"||q(0,"".concat(this.name,' must provide "resolveType" as a function, ')+"but got: ".concat(J(t.resolveType),"."))}var n=e.prototype;return n.getFields=function(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields},n.getInterfaces=function(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces},n.toConfig=function(){var u;return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:vc(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:(u=this.extensionASTNodes)!==null&&u!==void 0?u:[]}},n.toString=function(){return this.name},n.toJSON=function(){return this.toString()},jn(e,[{key:Ce,get:function(){return"GraphQLInterfaceType"}}]),e}();Oe(hc);var gc=function(){function e(t){this.name=t.name,this.description=t.description,this.resolveType=t.resolveType,this.extensions=t.extensions&&we(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=Vn(t.extensionASTNodes),this._types=Kp.bind(void 0,t),typeof t.name=="string"||q(0,"Must provide name."),t.resolveType==null||typeof t.resolveType=="function"||q(0,"".concat(this.name,' must provide "resolveType" as a function, ')+"but got: ".concat(J(t.resolveType),"."))}var n=e.prototype;return n.getTypes=function(){return typeof this._types=="function"&&(this._types=this._types()),this._types},n.toConfig=function(){var u;return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:(u=this.extensionASTNodes)!==null&&u!==void 0?u:[]}},n.toString=function(){return this.name},n.toJSON=function(){return this.toString()},jn(e,[{key:Ce,get:function(){return"GraphQLUnionType"}}]),e}();Oe(gc);function Kp(e){var n=Ai(e.types);return Array.isArray(n)||q(0,"Must provide Array of types or a function which returns such an array for Union ".concat(e.name,".")),n}var wi=function(){function e(t){this.name=t.name,this.description=t.description,this.extensions=t.extensions&&we(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=Vn(t.extensionASTNodes),this._values=Qp(this.name,t.values),this._valueLookup=new Map(this._values.map(function(u){return[u.value,u]})),this._nameLookup=oc(this._values,function(u){return u.name}),typeof t.name=="string"||q(0,"Must provide name.")}var n=e.prototype;return n.getValues=function(){return this._values},n.getValue=function(u){return this._nameLookup[u]},n.serialize=function(u){var i=this._valueLookup.get(u);if(i===void 0)throw new ee('Enum "'.concat(this.name,'" cannot represent value: ').concat(J(u)));return i.name},n.parseValue=function(u){if(typeof u!="string"){var i=J(u);throw new ee('Enum "'.concat(this.name,'" cannot represent non-string value: ').concat(i,".")+_i(this,i))}var r=this.getValue(u);if(r==null)throw new ee('Value "'.concat(u,'" does not exist in "').concat(this.name,'" enum.')+_i(this,u));return r.value},n.parseLiteral=function(u,i){if(u.kind!==C.ENUM){var r=He(u);throw new ee('Enum "'.concat(this.name,'" cannot represent non-enum value: ').concat(r,".")+_i(this,r),u)}var a=this.getValue(u.value);if(a==null){var o=He(u);throw new ee('Value "'.concat(o,'" does not exist in "').concat(this.name,'" enum.')+_i(this,o),u)}return a.value},n.toConfig=function(){var u,i=Ir(this.getValues(),function(r){return r.name},function(r){return{description:r.description,value:r.value,deprecationReason:r.deprecationReason,extensions:r.extensions,astNode:r.astNode}});return{name:this.name,description:this.description,values:i,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:(u=this.extensionASTNodes)!==null&&u!==void 0?u:[]}},n.toString=function(){return this.name},n.toJSON=function(){return this.toString()},jn(e,[{key:Ce,get:function(){return"GraphQLEnumType"}}]),e}();Oe(wi);function _i(e,n){var t=e.getValues().map(function(i){return i.name}),u=Up(n,t);return Tp("the enum value",u)}function Qp(e,n){return qn(n)||q(0,"".concat(e," values must be an object with value names as keys.")),Tt(n).map(function(t){var u=t[0],i=t[1];return qn(i)||q(0,"".concat(e,".").concat(u,' must refer to an object with a "value" key ')+"representing an internal value but got: ".concat(J(i),".")),!("isDeprecated"in i)||q(0,"".concat(e,".").concat(u,' should provide "deprecationReason" instead of "isDeprecated".')),{name:u,description:i.description,value:i.value!==void 0?i.value:u,isDeprecated:i.deprecationReason!=null,deprecationReason:i.deprecationReason,extensions:i.extensions&&we(i.extensions),astNode:i.astNode}})}var Ec=function(){function e(t){this.name=t.name,this.description=t.description,this.extensions=t.extensions&&we(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=Vn(t.extensionASTNodes),this._fields=Wp.bind(void 0,t),typeof t.name=="string"||q(0,"Must provide name.")}var n=e.prototype;return n.getFields=function(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields},n.toConfig=function(){var u,i=ki(this.getFields(),function(r){return{description:r.description,type:r.type,defaultValue:r.defaultValue,deprecationReason:r.deprecationReason,extensions:r.extensions,astNode:r.astNode}});return{name:this.name,description:this.description,fields:i,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:(u=this.extensionASTNodes)!==null&&u!==void 0?u:[]}},n.toString=function(){return this.name},n.toJSON=function(){return this.toString()},jn(e,[{key:Ce,get:function(){return"GraphQLInputObjectType"}}]),e}();Oe(Ec);function Wp(e){var n=Ai(e.fields);return qn(n)||q(0,"".concat(e.name," fields must be an object with field names as keys or a function which returns such an object.")),ki(n,function(t,u){return!("resolve"in t)||q(0,"".concat(e.name,".").concat(u," field has a resolve property, but Input Types cannot define resolvers.")),{name:u,description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:t.extensions&&we(t.extensions),astNode:t.astNode}})}var Yp=Array.from||function(e,n,t){if(e==null)throw new TypeError("Array.from requires an array-like object - not null or undefined");var u=e[Ws];if(typeof u=="function"){for(var i=u.call(e),r=[],a,o=0;!(a=i.next()).done;++o)if(r.push(n.call(t,a.value,o)),o>9999999)throw new TypeError("Near-infinite iteration.");return r}var s=e.length;if(typeof s=="number"&&s>=0&&s%1===0){for(var c=[],l=0;l<s;++l)Object.prototype.hasOwnProperty.call(e,l)&&c.push(n.call(t,e[l],l));return c}return[]},Xp=Yp,eh=Number.isFinite||function(e){return typeof e=="number"&&isFinite(e)},Pt=eh;function Ci(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ci=function(t){return typeof t}:Ci=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ci(e)}function nh(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(l){return l};if(e==null||Ci(e)!=="object")return null;if(Array.isArray(e))return e.map(n);var t=e[Ws];if(typeof t=="function"){for(var u=t.call(e),i=[],r,a=0;!(r=u.next()).done;++a)i.push(n(r.value,a));return i}var o=e.length;if(typeof o=="number"&&o>=0&&o%1===0){for(var s=[],c=0;c<o;++c){if(!Object.prototype.hasOwnProperty.call(e,c))return null;s.push(n(e[String(c)],c))}return s}return null}var th=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e},$i=th,zr=2147483647,Ur=-2147483648;function ih(e){var n=Rt(e);if(typeof n=="boolean")return n?1:0;var t=n;if(typeof n=="string"&&n!==""&&(t=Number(n)),!$i(t))throw new ee("Int cannot represent non-integer value: ".concat(J(n)));if(t>zr||t<Ur)throw new ee("Int cannot represent non 32-bit signed integer value: "+J(n));return t}function uh(e){if(!$i(e))throw new ee("Int cannot represent non-integer value: ".concat(J(e)));if(e>zr||e<Ur)throw new ee("Int cannot represent non 32-bit signed integer value: ".concat(e));return e}var rh=new wn({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize:ih,parseValue:uh,parseLiteral:function(n){if(n.kind!==C.INT)throw new ee("Int cannot represent non-integer value: ".concat(He(n)),n);var t=parseInt(n.value,10);if(t>zr||t<Ur)throw new ee("Int cannot represent non 32-bit signed integer value: ".concat(n.value),n);return t}});function ah(e){var n=Rt(e);if(typeof n=="boolean")return n?1:0;var t=n;if(typeof n=="string"&&n!==""&&(t=Number(n)),!Pt(t))throw new ee("Float cannot represent non numeric value: ".concat(J(n)));return t}function oh(e){if(!Pt(e))throw new ee("Float cannot represent non numeric value: ".concat(J(e)));return e}var sh=new wn({name:"Float",description:"The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",serialize:ah,parseValue:oh,parseLiteral:function(n){if(n.kind!==C.FLOAT&&n.kind!==C.INT)throw new ee("Float cannot represent non numeric value: ".concat(He(n)),n);return parseFloat(n.value)}});function Rt(e){if(Sn(e)){if(typeof e.valueOf=="function"){var n=e.valueOf();if(!Sn(n))return n}if(typeof e.toJSON=="function")return e.toJSON()}return e}function ch(e){var n=Rt(e);if(typeof n=="string")return n;if(typeof n=="boolean")return n?"true":"false";if(Pt(n))return n.toString();throw new ee("String cannot represent value: ".concat(J(e)))}function lh(e){if(typeof e!="string")throw new ee("String cannot represent a non string value: ".concat(J(e)));return e}var te=new wn({name:"String",description:"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",serialize:ch,parseValue:lh,parseLiteral:function(n){if(n.kind!==C.STRING)throw new ee("String cannot represent a non string value: ".concat(He(n)),n);return n.value}});function dh(e){var n=Rt(e);if(typeof n=="boolean")return n;if(Pt(n))return n!==0;throw new ee("Boolean cannot represent a non boolean value: ".concat(J(n)))}function fh(e){if(typeof e!="boolean")throw new ee("Boolean cannot represent a non boolean value: ".concat(J(e)));return e}var xe=new wn({name:"Boolean",description:"The `Boolean` scalar type represents `true` or `false`.",serialize:dh,parseValue:fh,parseLiteral:function(n){if(n.kind!==C.BOOLEAN)throw new ee("Boolean cannot represent a non boolean value: ".concat(He(n)),n);return n.value}});function mh(e){var n=Rt(e);if(typeof n=="string")return n;if($i(n))return String(n);throw new ee("ID cannot represent value: ".concat(J(e)))}function vh(e){if(typeof e=="string")return e;if($i(e))return e.toString();throw new ee("ID cannot represent value: ".concat(J(e)))}var yc=new wn({name:"ID",description:'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',serialize:mh,parseValue:vh,parseLiteral:function(n){if(n.kind!==C.STRING&&n.kind!==C.INT)throw new ee("ID cannot represent a non-string and non-integer value: "+He(n),n);return n.value}}),bc=Object.freeze([te,rh,sh,xe,yc]);function jt(e,n){if(Ln(n)){var t=jt(e,n.ofType);return t?.kind===C.NULL?null:t}if(e===null)return{kind:C.NULL};if(e===void 0)return null;if(zt(n)){var u=n.ofType,i=nh(e);if(i!=null){for(var r=[],a=0;a<i.length;a++){var o=i[a],s=jt(o,u);s!=null&&r.push(s)}return{kind:C.LIST,values:r}}return jt(e,u)}if(An(n)){if(!Sn(e))return null;for(var c=[],l=0,f=Bn(n.getFields());l<f.length;l++){var m=f[l],d=jt(e[m.name],m.type);d&&c.push({kind:C.OBJECT_FIELD,name:{kind:C.NAME,value:m.name},value:d})}return{kind:C.OBJECT,fields:c}}if(qp(n)){var v=n.serialize(e);if(v==null)return null;if(typeof v=="boolean")return{kind:C.BOOLEAN,value:v};if(typeof v=="number"&&Pt(v)){var h=String(v);return kc.test(h)?{kind:C.INT,value:h}:{kind:C.FLOAT,value:h}}if(typeof v=="string")return an(n)?{kind:C.ENUM,value:v}:n===yc&&kc.test(v)?{kind:C.INT,value:v}:{kind:C.STRING,value:v};throw new TypeError("Cannot convert value to AST: ".concat(J(v),"."))}Nt(0,"Unexpected input type: "+J(n))}var kc=/^-?(?:0|[1-9][0-9]*)$/,Pr=new on({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:function(){return{description:{type:te,resolve:function(t){return t.description}},types:{description:"A list of all types supported by this server.",type:new j(new se(new j(Pe))),resolve:function(t){return Bn(t.getTypeMap())}},queryType:{description:"The type that query operations will be rooted at.",type:new j(Pe),resolve:function(t){return t.getQueryType()}},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:Pe,resolve:function(t){return t.getMutationType()}},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:Pe,resolve:function(t){return t.getSubscriptionType()}},directives:{description:"A list of all directives supported by this server.",type:new j(new se(new j(Dc))),resolve:function(t){return t.getDirectives()}}}}}),Dc=new on({name:"__Directive",description:`A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.
|
|
41
41
|
|
|
42
|
-
In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.`,fields:function(){return{name:{type:new j(te),resolve:function(t){return t.name}},description:{type:te,resolve:function(t){return t.description}},isRepeatable:{type:new j(xe),resolve:function(t){return t.isRepeatable}},locations:{type:new j(new se(new j(Sc))),resolve:function(t){return t.locations}},args:{type:new j(new se(new j(xi))),args:{includeDeprecated:{type:xe,defaultValue:!1}},resolve:function(t,u){var i=u.includeDeprecated;return i?t.args:t.args.filter(function(r){return r.deprecationReason==null})}}}}}),Sc=new wi({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:K.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:K.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:K.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:K.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:K.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:K.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:K.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:K.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:K.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:K.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:K.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:K.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:K.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:K.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:K.UNION,description:"Location adjacent to a union definition."},ENUM:{value:K.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:K.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:K.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:K.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),Pe=new on({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByUrl`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:function(){return{kind:{type:new j(wc),resolve:function(t){if(Ot(t))return de.SCALAR;if(Ze(t))return de.OBJECT;if($e(t))return de.INTERFACE;if(rn(t))return de.UNION;if(an(t))return de.ENUM;if(An(t))return de.INPUT_OBJECT;if(zt(t))return de.LIST;if(Ln(t))return de.NON_NULL;Nt(0,'Unexpected type: "'.concat(J(t),'".'))}},name:{type:te,resolve:function(t){return t.name!==void 0?t.name:void 0}},description:{type:te,resolve:function(t){return t.description!==void 0?t.description:void 0}},specifiedByUrl:{type:te,resolve:function(t){return t.specifiedByUrl!==void 0?t.specifiedByUrl:void 0}},fields:{type:new se(new j(Bc)),args:{includeDeprecated:{type:xe,defaultValue:!1}},resolve:function(t,u){var i=u.includeDeprecated;if(Ze(t)||$e(t)){var r=Bn(t.getFields());return i?r:r.filter(function(a){return a.deprecationReason==null})}}},interfaces:{type:new se(new j(Pe)),resolve:function(t){if(Ze(t)||$e(t))return t.getInterfaces()}},possibleTypes:{type:new se(new j(Pe)),resolve:function(t,u,i,r){var a=r.schema;if(Mp(t))return a.getPossibleTypes(t)}},enumValues:{type:new se(new j(Ac)),args:{includeDeprecated:{type:xe,defaultValue:!1}},resolve:function(t,u){var i=u.includeDeprecated;if(an(t)){var r=t.getValues();return i?r:r.filter(function(a){return a.deprecationReason==null})}}},inputFields:{type:new se(new j(xi)),args:{includeDeprecated:{type:xe,defaultValue:!1}},resolve:function(t,u){var i=u.includeDeprecated;if(An(t)){var r=Bn(t.getFields());return i?r:r.filter(function(a){return a.deprecationReason==null})}}},ofType:{type:Pe,resolve:function(t){return t.ofType!==void 0?t.ofType:void 0}}}}}),Bc=new on({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:function(){return{name:{type:new j(te),resolve:function(t){return t.name}},description:{type:te,resolve:function(t){return t.description}},args:{type:new j(new se(new j(xi))),args:{includeDeprecated:{type:xe,defaultValue:!1}},resolve:function(t,u){var i=u.includeDeprecated;return i?t.args:t.args.filter(function(r){return r.deprecationReason==null})}},type:{type:new j(Pe),resolve:function(t){return t.type}},isDeprecated:{type:new j(xe),resolve:function(t){return t.deprecationReason!=null}},deprecationReason:{type:te,resolve:function(t){return t.deprecationReason}}}}}),xi=new on({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:function(){return{name:{type:new j(te),resolve:function(t){return t.name}},description:{type:te,resolve:function(t){return t.description}},type:{type:new j(Pe),resolve:function(t){return t.type}},defaultValue:{type:te,description:"A GraphQL-formatted string representing the default value for this input value.",resolve:function(t){var u=t.type,i=t.defaultValue,r=jt(i,u);return r?He(r):null}},isDeprecated:{type:new j(xe),resolve:function(t){return t.deprecationReason!=null}},deprecationReason:{type:te,resolve:function(t){return t.deprecationReason}}}}}),Ac=new on({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:function(){return{name:{type:new j(te),resolve:function(t){return t.name}},description:{type:te,resolve:function(t){return t.description}},isDeprecated:{type:new j(xe),resolve:function(t){return t.deprecationReason!=null}},deprecationReason:{type:te,resolve:function(t){return t.deprecationReason}}}}}),de=Object.freeze({SCALAR:"SCALAR",OBJECT:"OBJECT",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",INPUT_OBJECT:"INPUT_OBJECT",LIST:"LIST",NON_NULL:"NON_NULL"}),wc=new wi({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:de.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:de.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:de.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:de.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:de.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:de.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:de.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:de.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),_c={name:"__schema",type:new j(Pr),description:"Access the current type schema of this server.",args:[],resolve:function(n,t,u,i){var r=i.schema;return r},isDeprecated:!1,deprecationReason:void 0,extensions:void 0,astNode:void 0},Cc={name:"__type",type:Pe,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new j(te),defaultValue:void 0,deprecationReason:void 0,extensions:void 0,astNode:void 0}],resolve:function(n,t,u,i){var r=t.name,a=i.schema;return a.getType(r)},isDeprecated:!1,deprecationReason:void 0,extensions:void 0,astNode:void 0},$c={name:"__typename",type:new j(te),description:"The name of the current Object type at runtime.",args:[],resolve:function(n,t,u,i){var r=i.parentType;return r.name},isDeprecated:!1,deprecationReason:void 0,extensions:void 0,astNode:void 0},xc=Object.freeze([Pr,Dc,Sc,Pe,Bc,xi,Ac,wc]);function ph(e,n){for(var t=0;t<n.length;t++){var u=n[t];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,u.key,u)}}function hh(e,n,t){return n&&ph(e.prototype,n),e}function gh(e){return Je(e,Mn)}var Mn=function(){function e(t){var u,i;this.name=t.name,this.description=t.description,this.locations=t.locations,this.isRepeatable=(u=t.isRepeatable)!==null&&u!==void 0?u:!1,this.extensions=t.extensions&&we(t.extensions),this.astNode=t.astNode,t.name||q(0,"Directive must be named."),Array.isArray(t.locations)||q(0,"@".concat(t.name," locations must be an Array."));var r=(i=t.args)!==null&&i!==void 0?i:{};Sn(r)&&!Array.isArray(r)||q(0,"@".concat(t.name," args must be an object with argument names as keys.")),this.args=Tt(r).map(function(a){var o=a[0],s=a[1];return{name:o,description:s.description,type:s.type,defaultValue:s.defaultValue,deprecationReason:s.deprecationReason,extensions:s.extensions&&we(s.extensions),astNode:s.astNode}})}var n=e.prototype;return n.toConfig=function(){return{name:this.name,description:this.description,locations:this.locations,args:pc(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}},n.toString=function(){return"@"+this.name},n.toJSON=function(){return this.toString()},hh(e,[{key:Ce,get:function(){return"GraphQLDirective"}}]),e}();Oe(Mn);var Eh=new Mn({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[K.FIELD,K.FRAGMENT_SPREAD,K.INLINE_FRAGMENT],args:{if:{type:new j(xe),description:"Included when true."}}}),yh=new Mn({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[K.FIELD,K.FRAGMENT_SPREAD,K.INLINE_FRAGMENT],args:{if:{type:new j(xe),description:"Skipped when true."}}}),bh="No longer supported",kh=new Mn({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[K.FIELD_DEFINITION,K.ARGUMENT_DEFINITION,K.INPUT_FIELD_DEFINITION,K.ENUM_VALUE],args:{reason:{type:te,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:bh}}}),Dh=new Mn({name:"specifiedBy",description:"Exposes a URL that specifies the behaviour of this scalar.",locations:[K.SCALAR],args:{url:{type:new j(te),description:"The URL that specifies the behaviour of this scalar."}}}),Sh=Object.freeze([Eh,yh,kh,Dh]);function Bh(e,n){for(var t=0;t<n.length;t++){var u=n[t];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,u.key,u)}}function Ah(e,n,t){return n&&Bh(e.prototype,n),e}(function(){function e(t){var u;this.__validationErrors=t.assumeValid===!0?[]:void 0,Sn(t)||q(0,"Must provide configuration object."),!t.types||Array.isArray(t.types)||q(0,'"types" must be Array if provided but got: '.concat(J(t.types),".")),!t.directives||Array.isArray(t.directives)||q(0,'"directives" must be Array if provided but got: '+"".concat(J(t.directives),".")),this.description=t.description,this.extensions=t.extensions&&we(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=t.extensionASTNodes,this._queryType=t.query,this._mutationType=t.mutation,this._subscriptionType=t.subscription,this._directives=(u=t.directives)!==null&&u!==void 0?u:Sh;var i=new Set(t.types);if(t.types!=null)for(var r=0,a=t.types;r<a.length;r++){var o=a[r];i.delete(o),Re(o,i)}this._queryType!=null&&Re(this._queryType,i),this._mutationType!=null&&Re(this._mutationType,i),this._subscriptionType!=null&&Re(this._subscriptionType,i);for(var s=0,c=this._directives;s<c.length;s++){var l=c[s];if(gh(l))for(var f=0,m=l.args;f<m.length;f++){var d=m[f];Re(d.type,i)}}Re(Pr,i),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(var v=0,h=Xp(i);v<h.length;v++){var E=h[v];if(E!=null){var b=E.name;if(b||q(0,"One of the provided types for building the Schema is missing a name."),this._typeMap[b]!==void 0)throw new Error('Schema must contain uniquely named types but contains multiple types named "'.concat(b,'".'));if(this._typeMap[b]=E,$e(E))for(var y=0,k=E.getInterfaces();y<k.length;y++){var _=k[y];if($e(_)){var B=this._implementationsMap[_.name];B===void 0&&(B=this._implementationsMap[_.name]={objects:[],interfaces:[]}),B.interfaces.push(E)}}else if(Ze(E))for(var G=0,V=E.getInterfaces();G<V.length;G++){var F=V[G];if($e(F)){var g=this._implementationsMap[F.name];g===void 0&&(g=this._implementationsMap[F.name]={objects:[],interfaces:[]}),g.objects.push(E)}}}}}var n=e.prototype;return n.getQueryType=function(){return this._queryType},n.getMutationType=function(){return this._mutationType},n.getSubscriptionType=function(){return this._subscriptionType},n.getTypeMap=function(){return this._typeMap},n.getType=function(u){return this.getTypeMap()[u]},n.getPossibleTypes=function(u){return rn(u)?u.getTypes():this.getImplementations(u).objects},n.getImplementations=function(u){var i=this._implementationsMap[u.name];return i??{objects:[],interfaces:[]}},n.isPossibleType=function(u,i){return this.isSubType(u,i)},n.isSubType=function(u,i){var r=this._subTypeMap[u.name];if(r===void 0){if(r=Object.create(null),rn(u))for(var a=0,o=u.getTypes();a<o.length;a++){var s=o[a];r[s.name]=!0}else{for(var c=this.getImplementations(u),l=0,f=c.objects;l<f.length;l++){var m=f[l];r[m.name]=!0}for(var d=0,v=c.interfaces;d<v.length;d++){var h=v[d];r[h.name]=!0}}this._subTypeMap[u.name]=r}return r[i.name]!==void 0},n.getDirectives=function(){return this._directives},n.getDirective=function(u){return ac(this.getDirectives(),function(i){return i.name===u})},n.toConfig=function(){var u;return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Bn(this.getTypeMap()),directives:this.getDirectives().slice(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:(u=this.extensionASTNodes)!==null&&u!==void 0?u:[],assumeValid:this.__validationErrors!==void 0}},Ah(e,[{key:Ce,get:function(){return"GraphQLSchema"}}]),e})();function Re(e,n){var t=Ut(e);if(!n.has(t)){if(n.add(t),rn(t))for(var u=0,i=t.getTypes();u<i.length;u++){var r=i[u];Re(r,n)}else if(Ze(t)||$e(t)){for(var a=0,o=t.getInterfaces();a<o.length;a++){var s=o[a];Re(s,n)}for(var c=0,l=Bn(t.getFields());c<l.length;c++){var f=l[c];Re(f.type,n);for(var m=0,d=f.args;m<d.length;m++){var v=d[m];Re(v.type,n)}}}else if(An(t))for(var h=0,E=Bn(t.getFields());h<E.length;h++){var b=E[h];Re(b.type,n)}}return n}function Ii(e,n){var t;if(n.kind===C.LIST_TYPE)return t=Ii(e,n.type),t&&new se(t);if(n.kind===C.NON_NULL_TYPE)return t=Ii(e,n.type),t&&new j(t);if(n.kind===C.NAMED_TYPE)return e.getType(n.name.value);Nt(0,"Unexpected type node: "+J(n))}var wh=function(){function e(t,u,i){this._schema=t,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=u??_h,i&&(Zn(i)&&this._inputTypeStack.push(i),Tr(i)&&this._parentTypeStack.push(i),Bi(i)&&this._typeStack.push(i))}var n=e.prototype;return n.getType=function(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]},n.getParentType=function(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]},n.getInputType=function(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]},n.getParentInputType=function(){if(this._inputTypeStack.length>1)return this._inputTypeStack[this._inputTypeStack.length-2]},n.getFieldDef=function(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]},n.getDefaultValue=function(){if(this._defaultValueStack.length>0)return this._defaultValueStack[this._defaultValueStack.length-1]},n.getDirective=function(){return this._directive},n.getArgument=function(){return this._argument},n.getEnumValue=function(){return this._enumValue},n.enter=function(u){var i=this._schema;switch(u.kind){case C.SELECTION_SET:{var r=Ut(this.getType());this._parentTypeStack.push(Tr(r)?r:void 0);break}case C.FIELD:{var a=this.getParentType(),o,s;a&&(o=this._getFieldDef(i,a,u),o&&(s=o.type)),this._fieldDefStack.push(o),this._typeStack.push(Bi(s)?s:void 0);break}case C.DIRECTIVE:this._directive=i.getDirective(u.name.value);break;case C.OPERATION_DEFINITION:{var c;switch(u.operation){case"query":c=i.getQueryType();break;case"mutation":c=i.getMutationType();break;case"subscription":c=i.getSubscriptionType();break}this._typeStack.push(Ze(c)?c:void 0);break}case C.INLINE_FRAGMENT:case C.FRAGMENT_DEFINITION:{var l=u.typeCondition,f=l?Ii(i,l):Ut(this.getType());this._typeStack.push(Bi(f)?f:void 0);break}case C.VARIABLE_DEFINITION:{var m=Ii(i,u.type);this._inputTypeStack.push(Zn(m)?m:void 0);break}case C.ARGUMENT:{var d,v,h,E=(d=this.getDirective())!==null&&d!==void 0?d:this.getFieldDef();E&&(v=ac(E.args,function(F){return F.name===u.name.value}),v&&(h=v.type)),this._argument=v,this._defaultValueStack.push(v?v.defaultValue:void 0),this._inputTypeStack.push(Zn(h)?h:void 0);break}case C.LIST:{var b=Hp(this.getInputType()),y=zt(b)?b.ofType:b;this._defaultValueStack.push(void 0),this._inputTypeStack.push(Zn(y)?y:void 0);break}case C.OBJECT_FIELD:{var k=Ut(this.getInputType()),_,B;An(k)&&(B=k.getFields()[u.name.value],B&&(_=B.type)),this._defaultValueStack.push(B?B.defaultValue:void 0),this._inputTypeStack.push(Zn(_)?_:void 0);break}case C.ENUM:{var G=Ut(this.getInputType()),V;an(G)&&(V=G.getValue(u.value)),this._enumValue=V;break}}},n.leave=function(u){switch(u.kind){case C.SELECTION_SET:this._parentTypeStack.pop();break;case C.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case C.DIRECTIVE:this._directive=null;break;case C.OPERATION_DEFINITION:case C.INLINE_FRAGMENT:case C.FRAGMENT_DEFINITION:this._typeStack.pop();break;case C.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case C.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case C.LIST:case C.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case C.ENUM:this._enumValue=null;break}},e}();function _h(e,n,t){var u=t.name.value;if(u===_c.name&&e.getQueryType()===n)return _c;if(u===Cc.name&&e.getQueryType()===n)return Cc;if(u===$c.name&&Tr(n))return $c;if(Ze(n)||$e(n))return n.getFields()[u]}function Ch(e,n){return{enter:function(u){e.enter(u);var i=xr(n,u.kind,!1);if(i){var r=i.apply(n,arguments);return r!==void 0&&(e.leave(u),$r(r)&&e.enter(r)),r}},leave:function(u){var i=xr(n,u.kind,!0),r;return i&&(r=i.apply(n,arguments)),e.leave(u),r}}}[].concat(bc,xc).map(function(e){return e.name});var sn;function Gn(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}sn={},Gn(sn,C.SCALAR_TYPE_DEFINITION,C.SCALAR_TYPE_EXTENSION),Gn(sn,C.OBJECT_TYPE_DEFINITION,C.OBJECT_TYPE_EXTENSION),Gn(sn,C.INTERFACE_TYPE_DEFINITION,C.INTERFACE_TYPE_EXTENSION),Gn(sn,C.UNION_TYPE_DEFINITION,C.UNION_TYPE_EXTENSION),Gn(sn,C.ENUM_TYPE_DEFINITION,C.ENUM_TYPE_EXTENSION),Gn(sn,C.INPUT_OBJECT_TYPE_DEFINITION,C.INPUT_OBJECT_TYPE_EXTENSION);function Ic(e,n){e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n}var Fc=function(){function e(t,u){this._ast=t,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=u}var n=e.prototype;return n.reportError=function(u){this._onError(u)},n.getDocument=function(){return this._ast},n.getFragment=function(u){var i=this._fragments;return i||(this._fragments=i=this.getDocument().definitions.reduce(function(r,a){return a.kind===C.FRAGMENT_DEFINITION&&(r[a.name.value]=a),r},Object.create(null))),i[u]},n.getFragmentSpreads=function(u){var i=this._fragmentSpreads.get(u);if(!i){i=[];for(var r=[u];r.length!==0;)for(var a=r.pop(),o=0,s=a.selections;o<s.length;o++){var c=s[o];c.kind===C.FRAGMENT_SPREAD?i.push(c):c.selectionSet&&r.push(c.selectionSet)}this._fragmentSpreads.set(u,i)}return i},n.getRecursivelyReferencedFragments=function(u){var i=this._recursivelyReferencedFragments.get(u);if(!i){i=[];for(var r=Object.create(null),a=[u.selectionSet];a.length!==0;)for(var o=a.pop(),s=0,c=this.getFragmentSpreads(o);s<c.length;s++){var l=c[s],f=l.name.value;if(r[f]!==!0){r[f]=!0;var m=this.getFragment(f);m&&(i.push(m),a.push(m.selectionSet))}}this._recursivelyReferencedFragments.set(u,i)}return i},e}();(function(e){Ic(n,e);function n(u,i,r){var a;return a=e.call(this,u,r)||this,a._schema=i,a}var t=n.prototype;return t.getSchema=function(){return this._schema},n})(Fc),function(e){Ic(n,e);function n(u,i,r,a){var o;return o=e.call(this,i,a)||this,o._schema=u,o._typeInfo=r,o._variableUsages=new Map,o._recursiveVariableUsages=new Map,o}var t=n.prototype;return t.getSchema=function(){return this._schema},t.getVariableUsages=function(i){var r=this._variableUsages.get(i);if(!r){var a=[],o=new wh(this._schema);rc(i,Ch(o,{VariableDefinition:function(){return!1},Variable:function(c){a.push({node:c,type:o.getInputType(),defaultValue:o.getDefaultValue()})}})),r=a,this._variableUsages.set(i,r)}return r},t.getRecursiveVariableUsages=function(i){var r=this._recursiveVariableUsages.get(i);if(!r){r=this.getVariableUsages(i);for(var a=0,o=this.getRecursivelyReferencedFragments(i);a<o.length;a++){var s=o[a];r=r.concat(this.getVariableUsages(s))}this._recursiveVariableUsages.set(i,r)}return r},t.getType=function(){return this._typeInfo.getType()},t.getParentType=function(){return this._typeInfo.getParentType()},t.getInputType=function(){return this._typeInfo.getInputType()},t.getParentInputType=function(){return this._typeInfo.getParentInputType()},t.getFieldDef=function(){return this._typeInfo.getFieldDef()},t.getDirective=function(){return this._typeInfo.getDirective()},t.getArgument=function(){return this._typeInfo.getArgument()},t.getEnumValue=function(){return this._typeInfo.getEnumValue()},n}(Fc),oc(bc.concat(xc),function(e){return e.name});const Nc=e=>e instanceof Error?e:typeof e=="string"?new Error(e):new Error(String(e)),$h=()=>typeof globalThis.window<"u"&&typeof globalThis.window.document<"u"&&typeof globalThis.navigator<"u",Rr={staging:{baseEndpoint:"https://api-staging.spritz.finance",graphEndpoint:"https://api-staging.spritz.finance/router/graph",restEndpoint:"https://sandbox.spritz.finance"},production:{baseEndpoint:"https://api.spritz.finance",graphEndpoint:"https://api.spritz.finance/router/graph",restEndpoint:"https://platform.spritz.finance"}},xh=(e,n)=>{if(typeof n!="number"||!Number.isInteger(n))throw new Error(`${e} must be an integer`);if(n<0)throw new Error(`${e} must be a positive integer`);return n};function Ih(e){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function jr(e,n){if(!e||typeof e!="object"||!(n in e))return;const t=e[n];if(typeof t=="string"&&t.length>0)return t}class Tc extends Error{timestamp;headers;constructor(n,t){super(n),this.name="SpritzApiError",this.message=n,this.headers=t??{},this.timestamp=new Date().toISOString()}}class Se extends Error{status;error;headers;timestamp;constructor(n,t,u,i){super(Se.makeMessage(t,u)),this.status=n,this.error=t,this.headers=i,this.timestamp=new Date().toISOString()}static makeMessage(n,t){const u=jr(n,"detail");if(u)return u;const i=jr(n,"title");return i||jr(n,"message")||(n!==void 0?Ih(n):t||"Unknown error occurred")}static generate(n,t,u,i){return n?n===400?new zc(n,t,u,i):n===401?new Uc(n,t,u,i):n===403?new Pc(n,t,u,i):n===404?new Rc(n,t,u,i):n===409?new jc(n,t,u,i):n===422?new Lc(n,t,u,i):n===429?new Zc(n,t,u,i):n>=500?new Vc(n,t,u,i):new Se(n,t,u,i):new Fi({cause:Nc(t)})}}class Fh extends Se{status=void 0;constructor({message:n}={}){super(void 0,void 0,n||"Request was aborted.",void 0)}}class Fi extends Se{status=void 0;constructor({message:n,cause:t}){super(void 0,void 0,n||"Connection error.",void 0),t&&(this.cause=t)}}class Oc extends Fi{constructor(){super({message:"Request timed out."})}}class zc extends Se{name="BadRequestError";status=400}class Uc extends Se{name="AuthenticationError";status=401}class Pc extends Se{name="PermissionDeniedError";status=403}class Rc extends Se{name="NotFoundError";status=404}class jc extends Se{name="ConflictError";status=409}class Lc extends Se{name="UnprocessableEntityError";status=422}class Zc extends Se{name="RateLimitError";status=429}class Vc extends Se{name="InternalServerError"}const Nh=e=>{try{return JSON.parse(e)}catch{return}},qc=10,Mc=100;function Th(e){if(!e||!e.definitions)throw new Error("Invalid GraphQL query: missing definitions");const n=e.definitions.filter(r=>r.kind==="OperationDefinition");if(n.length>1)throw new Error("Invalid GraphQL query: multiple operations not allowed");if(n.length===0)throw new Error("Invalid GraphQL query: no operation definition found");const t=n[0],u=Oh(t);if(u>qc)throw new Error(`GraphQL query too deep: ${u} levels (max: ${qc})`);const i=zh(t);if(i>Mc)throw new Error(`GraphQL query too complex: ${i} fields (max: ${Mc})`);if(t.operation!=="query"&&t.operation!=="mutation")throw new Error(`Invalid GraphQL operation type: ${t.operation}`)}function Oh(e){function n(t){let u=0;for(const i of t.selections)if(i.kind==="Field"&&i.selectionSet){const r=1+n(i.selectionSet);u=Math.max(u,r)}else if(i.kind==="InlineFragment"&&i.selectionSet){const r=n(i.selectionSet);u=Math.max(u,r)}else i.kind==="FragmentSpread"&&(u=Math.max(u,1));return u}return n(e.selectionSet)}function zh(e){function n(t){let u=0;for(const i of t.selections)u+=1,i.kind==="Field"&&i.selectionSet||i.kind==="InlineFragment"&&i.selectionSet?u+=n(i.selectionSet):i.kind==="FragmentSpread"&&(u+=5);return u}return n(e.selectionSet)}function Uh(e){if(!e)return;const n=Object.create(null);for(const[t,u]of Object.entries(e)){if(!Ph(t))throw new Error(`Invalid GraphQL variable name: ${t}`);if(t==="__proto__"||t==="constructor"||t==="prototype")throw new Error(`Invalid property name: ${t}`);n[t]=Lr(u)}return n}function Ph(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function Gc(e){return Array.from(e).filter(n=>{const t=n.charCodeAt(0);return t>31&&t!==127}).join("")}function Lr(e){if(e==null)return e;if(typeof e=="string")return Gc(e);if(typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(Lr);if(typeof e=="object"){const n=Object.create(null);for(const[t,u]of Object.entries(e)){if(t.includes("__proto__")||t.includes("constructor"))throw new Error(`Invalid property name: ${t}`);n[t]=Lr(u)}return n}return Gc(String(e))}const Rh="sha256=";function Jc(e){return Array.from(new Uint8Array(e)).map(n=>n.toString(16).padStart(2,"0")).join("")}async function jh(e){const n=new TextEncoder().encode(e),t=await crypto.subtle.digest("SHA-256",n);return Jc(t)}async function Lh(e,n){const t=new TextEncoder,u=await crypto.subtle.importKey("raw",t.encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),i=await crypto.subtle.sign("HMAC",u,t.encode(n));return Jc(i)}function Zh(e){const n=e.searchParams;return[...n].length===0?"":[...n.keys()].sort().map(t=>{const u=n.get(t)??"";return`${encodeURIComponent(t)}=${encodeURIComponent(u)}`}).join("&")}function Vh(e){const n=Zh(e);return n===""?e.pathname:`${e.pathname}?${n}`}async function qh(e,n,t){const u=t.body?await jh(t.body):"",i=`${n}.${t.method.toUpperCase()}.${t.path}.${u}`,r=await Lh(e,i);return`${Rh}${r}`}async function Mh(e,n,t,u,i){const r=new URL(u),a=Vh(r),o=Date.now(),s=await qh(n,o,{method:t,path:a,body:i});return{"X-Integrator-Key":e,"X-Signature":s,"X-Timestamp":String(o)}}async function Zr(e){const{response:n}=e;return n.headers.get("content-type")?.includes("application/json")?{response:await n.json(),headers:e.headers}:{response:await n.text(),headers:e.headers}}class Gh{baseGraphURL;baseRestURL;baseRestApiURL;timeout;apiKey;integrationKey;integratorSecret;constructor({environment:n,timeout:t=3e5,apiKey:u,integrationKey:i,integratorSecret:r}){this.apiKey=u,this.integrationKey=i,this.integratorSecret=r,this.baseGraphURL=Rr[n].graphEndpoint,this.baseRestURL=Rr[n].baseEndpoint,this.baseRestApiURL=Rr[n].restEndpoint,this.timeout=xh("timeout",t)}async query({query:n,variables:t}){Th(n);const u=Uh(t);return this.sendQuery({query:n,variables:u}).then(i=>Zr(i)).then(({response:i,headers:r})=>{if(i.data)return i.data;if(i.errors){const a=i.errors[0]??{message:"Unknown error"};throw new Tc(a.message,r)}else throw new Error("Unknown error")})}async request({method:n,path:t,body:u=void 0}){return this.sendRequest({method:n,path:t,body:u}).then(i=>Zr(i)).then(({response:i})=>i)}async restApi({method:n,path:t,body:u=void 0,query:i}){return this.sendRestApiRequest({method:n,path:t,body:u,query:i}).then(r=>Zr(r)).then(({response:r})=>r)}async sendQuery({query:n,variables:t}){const{url:u,req:i,timeout:r}=this.buildGraphRequest({query:n,variables:t});return this.sendHTTPRequest({url:u,req:i,timeout:r})}async sendRequest({method:n,path:t,body:u}){const{url:i,req:r,timeout:a}=this.buildRestRequest(n,t,u);return this.sendHTTPRequest({url:i,req:r,timeout:a})}async sendRestApiRequest({method:n,path:t,body:u,query:i}){const{url:r,req:a,timeout:o}=this.buildRestRequest(n,t,u,this.baseRestApiURL,i);if(this.integrationKey&&this.integratorSecret){const s=await Mh(this.integrationKey,this.integratorSecret,n,r,a.body??null),{"X-INTEGRATION-KEY":c,...l}=a.headers;a.headers={...l,...s}}return this.sendHTTPRequest({url:r,req:a,timeout:o})}async sendHTTPRequest({url:n,req:t,timeout:u}){const i=new AbortController,r=await this.fetchWithTimeout(n,t,u,i).catch(Nc);if(r instanceof Error)throw r.name==="AbortError"?new Oc:new Fi({cause:r});const a=this.getResponseHeaders(r.headers);if(!r.ok){const o=await r.text().catch(()=>"Unknown error"),s=Nh(o);throw this.makeStatusError(r.status,s,s?void 0:o,a)}return{response:r,controller:i,headers:a}}getResponseHeaders(n){const t=n.get("x-amzn-trace-id"),u=n.get("x-amzn-requestid");return{traceId:t,requestId:u}}async fetchWithTimeout(n,t,u,i){const{signal:r,...a}=t||{},o=AbortSignal.timeout(u),s=r?AbortSignal.any([r,o,i.signal]):AbortSignal.any([o,i.signal]);return fetch(n,{...a,signal:s})}buildGraphRequest({query:n,variables:t}){const u={query:He(n),variables:t,operationName:n?.definitions?.[0]?.name?.value},i=u?JSON.stringify(u,null,2):null,r=this.calculateContentLength(i),a=this.timeout,o={...r&&{"Content-Length":r},...this.defaultHeaders()},s=Object.fromEntries(Object.entries(o).filter(([l,f])=>f!==null)),c={method:"POST",...i?{body:i}:{},headers:s};return{url:this.baseGraphURL,req:c,timeout:a}}buildRestRequest(n,t,u,i,r){const a=u?JSON.stringify(u):null,o=this.calculateContentLength(a),s=this.timeout,c={...o&&{"Content-Length":o},...this.defaultHeaders()},l=Object.fromEntries(Object.entries(c).filter(([h,E])=>E!==null)),f={method:n,...a?{body:a}:{},headers:l},m=i??this.baseRestURL,d=t.startsWith("/")?t:"/"+t,v=new URL(d,m);if(r)for(const[h,E]of Object.entries(r))E!==void 0&&v.searchParams.set(h,String(E));return{url:v.toString(),req:f,timeout:s}}defaultHeaders(){return{Accept:"application/json","Content-Type":"application/json",...this.authHeaders()}}calculateContentLength(n){if(typeof n=="string"){if(typeof Buffer<"u")return Buffer.byteLength(n,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(n).length.toString()}return null}authHeaders(){return{Authorization:"Bearer "+this.apiKey,...this.integrationKey?{"X-INTEGRATION-KEY":this.integrationKey}:{}}}makeStatusError(n,t,u,i){return Se.generate(n,t,u,i)}}class Jh{client;constructor(n){this.client=n}async list(n){return this.client.restApi({method:"get",path:"/v1/integrator/ach-debit/returns",query:n})}async get(n){return this.client.restApi({method:"get",path:`/v1/integrator/ach-debit/returns/${encodeURIComponent(n)}`})}}class Hh{client;constructor(n){this.client=n}async list(){return this.client.restApi({method:"get",path:"/v1/bank-accounts/"})}async get(n){return this.client.restApi({method:"get",path:`/v1/bank-accounts/${encodeURIComponent(n)}`})}async create(n){return this.client.restApi({method:"post",path:"/v1/bank-accounts/",body:n})}async delete(n){return this.client.restApi({method:"delete",path:`/v1/bank-accounts/${encodeURIComponent(n)}`})}async createLinkToken(){return this.client.restApi({method:"post",path:"/v1/bank-accounts/link-token"})}async completeLinking(n){return this.client.restApi({method:"post",path:"/v1/bank-accounts/link-complete",body:n})}}var Lt={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"BillFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Bill"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"originator"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"payable"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verifying"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billAccountDetails"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amountDue"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"openedAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastPaymentAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastPaymentDate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"nextPaymentDueDate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"nextPaymentMinimumAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastStatementBalance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"remainingStatementBalance"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"dataSync"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"lastSync"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"syncStatus"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"institution"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"logo"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"paymentAddresses"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:588}};Lt.loc.source={body:`fragment BillFragment on Bill {
|
|
42
|
+
In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.`,fields:function(){return{name:{type:new j(te),resolve:function(t){return t.name}},description:{type:te,resolve:function(t){return t.description}},isRepeatable:{type:new j(xe),resolve:function(t){return t.isRepeatable}},locations:{type:new j(new se(new j(Sc))),resolve:function(t){return t.locations}},args:{type:new j(new se(new j(xi))),args:{includeDeprecated:{type:xe,defaultValue:!1}},resolve:function(t,u){var i=u.includeDeprecated;return i?t.args:t.args.filter(function(r){return r.deprecationReason==null})}}}}}),Sc=new wi({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:K.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:K.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:K.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:K.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:K.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:K.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:K.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:K.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:K.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:K.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:K.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:K.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:K.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:K.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:K.UNION,description:"Location adjacent to a union definition."},ENUM:{value:K.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:K.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:K.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:K.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),Pe=new on({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByUrl`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:function(){return{kind:{type:new j(wc),resolve:function(t){if(Ot(t))return de.SCALAR;if(Ze(t))return de.OBJECT;if($e(t))return de.INTERFACE;if(rn(t))return de.UNION;if(an(t))return de.ENUM;if(An(t))return de.INPUT_OBJECT;if(zt(t))return de.LIST;if(Ln(t))return de.NON_NULL;Nt(0,'Unexpected type: "'.concat(J(t),'".'))}},name:{type:te,resolve:function(t){return t.name!==void 0?t.name:void 0}},description:{type:te,resolve:function(t){return t.description!==void 0?t.description:void 0}},specifiedByUrl:{type:te,resolve:function(t){return t.specifiedByUrl!==void 0?t.specifiedByUrl:void 0}},fields:{type:new se(new j(Bc)),args:{includeDeprecated:{type:xe,defaultValue:!1}},resolve:function(t,u){var i=u.includeDeprecated;if(Ze(t)||$e(t)){var r=Bn(t.getFields());return i?r:r.filter(function(a){return a.deprecationReason==null})}}},interfaces:{type:new se(new j(Pe)),resolve:function(t){if(Ze(t)||$e(t))return t.getInterfaces()}},possibleTypes:{type:new se(new j(Pe)),resolve:function(t,u,i,r){var a=r.schema;if(Mp(t))return a.getPossibleTypes(t)}},enumValues:{type:new se(new j(Ac)),args:{includeDeprecated:{type:xe,defaultValue:!1}},resolve:function(t,u){var i=u.includeDeprecated;if(an(t)){var r=t.getValues();return i?r:r.filter(function(a){return a.deprecationReason==null})}}},inputFields:{type:new se(new j(xi)),args:{includeDeprecated:{type:xe,defaultValue:!1}},resolve:function(t,u){var i=u.includeDeprecated;if(An(t)){var r=Bn(t.getFields());return i?r:r.filter(function(a){return a.deprecationReason==null})}}},ofType:{type:Pe,resolve:function(t){return t.ofType!==void 0?t.ofType:void 0}}}}}),Bc=new on({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:function(){return{name:{type:new j(te),resolve:function(t){return t.name}},description:{type:te,resolve:function(t){return t.description}},args:{type:new j(new se(new j(xi))),args:{includeDeprecated:{type:xe,defaultValue:!1}},resolve:function(t,u){var i=u.includeDeprecated;return i?t.args:t.args.filter(function(r){return r.deprecationReason==null})}},type:{type:new j(Pe),resolve:function(t){return t.type}},isDeprecated:{type:new j(xe),resolve:function(t){return t.deprecationReason!=null}},deprecationReason:{type:te,resolve:function(t){return t.deprecationReason}}}}}),xi=new on({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:function(){return{name:{type:new j(te),resolve:function(t){return t.name}},description:{type:te,resolve:function(t){return t.description}},type:{type:new j(Pe),resolve:function(t){return t.type}},defaultValue:{type:te,description:"A GraphQL-formatted string representing the default value for this input value.",resolve:function(t){var u=t.type,i=t.defaultValue,r=jt(i,u);return r?He(r):null}},isDeprecated:{type:new j(xe),resolve:function(t){return t.deprecationReason!=null}},deprecationReason:{type:te,resolve:function(t){return t.deprecationReason}}}}}),Ac=new on({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:function(){return{name:{type:new j(te),resolve:function(t){return t.name}},description:{type:te,resolve:function(t){return t.description}},isDeprecated:{type:new j(xe),resolve:function(t){return t.deprecationReason!=null}},deprecationReason:{type:te,resolve:function(t){return t.deprecationReason}}}}}),de=Object.freeze({SCALAR:"SCALAR",OBJECT:"OBJECT",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",INPUT_OBJECT:"INPUT_OBJECT",LIST:"LIST",NON_NULL:"NON_NULL"}),wc=new wi({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:de.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:de.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:de.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:de.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:de.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:de.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:de.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:de.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),_c={name:"__schema",type:new j(Pr),description:"Access the current type schema of this server.",args:[],resolve:function(n,t,u,i){var r=i.schema;return r},isDeprecated:!1,deprecationReason:void 0,extensions:void 0,astNode:void 0},Cc={name:"__type",type:Pe,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new j(te),defaultValue:void 0,deprecationReason:void 0,extensions:void 0,astNode:void 0}],resolve:function(n,t,u,i){var r=t.name,a=i.schema;return a.getType(r)},isDeprecated:!1,deprecationReason:void 0,extensions:void 0,astNode:void 0},$c={name:"__typename",type:new j(te),description:"The name of the current Object type at runtime.",args:[],resolve:function(n,t,u,i){var r=i.parentType;return r.name},isDeprecated:!1,deprecationReason:void 0,extensions:void 0,astNode:void 0},xc=Object.freeze([Pr,Dc,Sc,Pe,Bc,xi,Ac,wc]);function ph(e,n){for(var t=0;t<n.length;t++){var u=n[t];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,u.key,u)}}function hh(e,n,t){return n&&ph(e.prototype,n),e}function gh(e){return Je(e,Mn)}var Mn=function(){function e(t){var u,i;this.name=t.name,this.description=t.description,this.locations=t.locations,this.isRepeatable=(u=t.isRepeatable)!==null&&u!==void 0?u:!1,this.extensions=t.extensions&&we(t.extensions),this.astNode=t.astNode,t.name||q(0,"Directive must be named."),Array.isArray(t.locations)||q(0,"@".concat(t.name," locations must be an Array."));var r=(i=t.args)!==null&&i!==void 0?i:{};Sn(r)&&!Array.isArray(r)||q(0,"@".concat(t.name," args must be an object with argument names as keys.")),this.args=Tt(r).map(function(a){var o=a[0],s=a[1];return{name:o,description:s.description,type:s.type,defaultValue:s.defaultValue,deprecationReason:s.deprecationReason,extensions:s.extensions&&we(s.extensions),astNode:s.astNode}})}var n=e.prototype;return n.toConfig=function(){return{name:this.name,description:this.description,locations:this.locations,args:pc(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}},n.toString=function(){return"@"+this.name},n.toJSON=function(){return this.toString()},hh(e,[{key:Ce,get:function(){return"GraphQLDirective"}}]),e}();Oe(Mn);var Eh=new Mn({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[K.FIELD,K.FRAGMENT_SPREAD,K.INLINE_FRAGMENT],args:{if:{type:new j(xe),description:"Included when true."}}}),yh=new Mn({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[K.FIELD,K.FRAGMENT_SPREAD,K.INLINE_FRAGMENT],args:{if:{type:new j(xe),description:"Skipped when true."}}}),bh="No longer supported",kh=new Mn({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[K.FIELD_DEFINITION,K.ARGUMENT_DEFINITION,K.INPUT_FIELD_DEFINITION,K.ENUM_VALUE],args:{reason:{type:te,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:bh}}}),Dh=new Mn({name:"specifiedBy",description:"Exposes a URL that specifies the behaviour of this scalar.",locations:[K.SCALAR],args:{url:{type:new j(te),description:"The URL that specifies the behaviour of this scalar."}}}),Sh=Object.freeze([Eh,yh,kh,Dh]);function Bh(e,n){for(var t=0;t<n.length;t++){var u=n[t];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,u.key,u)}}function Ah(e,n,t){return n&&Bh(e.prototype,n),e}(function(){function e(t){var u;this.__validationErrors=t.assumeValid===!0?[]:void 0,Sn(t)||q(0,"Must provide configuration object."),!t.types||Array.isArray(t.types)||q(0,'"types" must be Array if provided but got: '.concat(J(t.types),".")),!t.directives||Array.isArray(t.directives)||q(0,'"directives" must be Array if provided but got: '+"".concat(J(t.directives),".")),this.description=t.description,this.extensions=t.extensions&&we(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=t.extensionASTNodes,this._queryType=t.query,this._mutationType=t.mutation,this._subscriptionType=t.subscription,this._directives=(u=t.directives)!==null&&u!==void 0?u:Sh;var i=new Set(t.types);if(t.types!=null)for(var r=0,a=t.types;r<a.length;r++){var o=a[r];i.delete(o),Re(o,i)}this._queryType!=null&&Re(this._queryType,i),this._mutationType!=null&&Re(this._mutationType,i),this._subscriptionType!=null&&Re(this._subscriptionType,i);for(var s=0,c=this._directives;s<c.length;s++){var l=c[s];if(gh(l))for(var f=0,m=l.args;f<m.length;f++){var d=m[f];Re(d.type,i)}}Re(Pr,i),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(var v=0,h=Xp(i);v<h.length;v++){var E=h[v];if(E!=null){var b=E.name;if(b||q(0,"One of the provided types for building the Schema is missing a name."),this._typeMap[b]!==void 0)throw new Error('Schema must contain uniquely named types but contains multiple types named "'.concat(b,'".'));if(this._typeMap[b]=E,$e(E))for(var y=0,k=E.getInterfaces();y<k.length;y++){var _=k[y];if($e(_)){var B=this._implementationsMap[_.name];B===void 0&&(B=this._implementationsMap[_.name]={objects:[],interfaces:[]}),B.interfaces.push(E)}}else if(Ze(E))for(var G=0,V=E.getInterfaces();G<V.length;G++){var F=V[G];if($e(F)){var g=this._implementationsMap[F.name];g===void 0&&(g=this._implementationsMap[F.name]={objects:[],interfaces:[]}),g.objects.push(E)}}}}}var n=e.prototype;return n.getQueryType=function(){return this._queryType},n.getMutationType=function(){return this._mutationType},n.getSubscriptionType=function(){return this._subscriptionType},n.getTypeMap=function(){return this._typeMap},n.getType=function(u){return this.getTypeMap()[u]},n.getPossibleTypes=function(u){return rn(u)?u.getTypes():this.getImplementations(u).objects},n.getImplementations=function(u){var i=this._implementationsMap[u.name];return i??{objects:[],interfaces:[]}},n.isPossibleType=function(u,i){return this.isSubType(u,i)},n.isSubType=function(u,i){var r=this._subTypeMap[u.name];if(r===void 0){if(r=Object.create(null),rn(u))for(var a=0,o=u.getTypes();a<o.length;a++){var s=o[a];r[s.name]=!0}else{for(var c=this.getImplementations(u),l=0,f=c.objects;l<f.length;l++){var m=f[l];r[m.name]=!0}for(var d=0,v=c.interfaces;d<v.length;d++){var h=v[d];r[h.name]=!0}}this._subTypeMap[u.name]=r}return r[i.name]!==void 0},n.getDirectives=function(){return this._directives},n.getDirective=function(u){return ac(this.getDirectives(),function(i){return i.name===u})},n.toConfig=function(){var u;return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Bn(this.getTypeMap()),directives:this.getDirectives().slice(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:(u=this.extensionASTNodes)!==null&&u!==void 0?u:[],assumeValid:this.__validationErrors!==void 0}},Ah(e,[{key:Ce,get:function(){return"GraphQLSchema"}}]),e})();function Re(e,n){var t=Ut(e);if(!n.has(t)){if(n.add(t),rn(t))for(var u=0,i=t.getTypes();u<i.length;u++){var r=i[u];Re(r,n)}else if(Ze(t)||$e(t)){for(var a=0,o=t.getInterfaces();a<o.length;a++){var s=o[a];Re(s,n)}for(var c=0,l=Bn(t.getFields());c<l.length;c++){var f=l[c];Re(f.type,n);for(var m=0,d=f.args;m<d.length;m++){var v=d[m];Re(v.type,n)}}}else if(An(t))for(var h=0,E=Bn(t.getFields());h<E.length;h++){var b=E[h];Re(b.type,n)}}return n}function Ii(e,n){var t;if(n.kind===C.LIST_TYPE)return t=Ii(e,n.type),t&&new se(t);if(n.kind===C.NON_NULL_TYPE)return t=Ii(e,n.type),t&&new j(t);if(n.kind===C.NAMED_TYPE)return e.getType(n.name.value);Nt(0,"Unexpected type node: "+J(n))}var wh=function(){function e(t,u,i){this._schema=t,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=u??_h,i&&(Zn(i)&&this._inputTypeStack.push(i),Tr(i)&&this._parentTypeStack.push(i),Bi(i)&&this._typeStack.push(i))}var n=e.prototype;return n.getType=function(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]},n.getParentType=function(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]},n.getInputType=function(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]},n.getParentInputType=function(){if(this._inputTypeStack.length>1)return this._inputTypeStack[this._inputTypeStack.length-2]},n.getFieldDef=function(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]},n.getDefaultValue=function(){if(this._defaultValueStack.length>0)return this._defaultValueStack[this._defaultValueStack.length-1]},n.getDirective=function(){return this._directive},n.getArgument=function(){return this._argument},n.getEnumValue=function(){return this._enumValue},n.enter=function(u){var i=this._schema;switch(u.kind){case C.SELECTION_SET:{var r=Ut(this.getType());this._parentTypeStack.push(Tr(r)?r:void 0);break}case C.FIELD:{var a=this.getParentType(),o,s;a&&(o=this._getFieldDef(i,a,u),o&&(s=o.type)),this._fieldDefStack.push(o),this._typeStack.push(Bi(s)?s:void 0);break}case C.DIRECTIVE:this._directive=i.getDirective(u.name.value);break;case C.OPERATION_DEFINITION:{var c;switch(u.operation){case"query":c=i.getQueryType();break;case"mutation":c=i.getMutationType();break;case"subscription":c=i.getSubscriptionType();break}this._typeStack.push(Ze(c)?c:void 0);break}case C.INLINE_FRAGMENT:case C.FRAGMENT_DEFINITION:{var l=u.typeCondition,f=l?Ii(i,l):Ut(this.getType());this._typeStack.push(Bi(f)?f:void 0);break}case C.VARIABLE_DEFINITION:{var m=Ii(i,u.type);this._inputTypeStack.push(Zn(m)?m:void 0);break}case C.ARGUMENT:{var d,v,h,E=(d=this.getDirective())!==null&&d!==void 0?d:this.getFieldDef();E&&(v=ac(E.args,function(F){return F.name===u.name.value}),v&&(h=v.type)),this._argument=v,this._defaultValueStack.push(v?v.defaultValue:void 0),this._inputTypeStack.push(Zn(h)?h:void 0);break}case C.LIST:{var b=Hp(this.getInputType()),y=zt(b)?b.ofType:b;this._defaultValueStack.push(void 0),this._inputTypeStack.push(Zn(y)?y:void 0);break}case C.OBJECT_FIELD:{var k=Ut(this.getInputType()),_,B;An(k)&&(B=k.getFields()[u.name.value],B&&(_=B.type)),this._defaultValueStack.push(B?B.defaultValue:void 0),this._inputTypeStack.push(Zn(_)?_:void 0);break}case C.ENUM:{var G=Ut(this.getInputType()),V;an(G)&&(V=G.getValue(u.value)),this._enumValue=V;break}}},n.leave=function(u){switch(u.kind){case C.SELECTION_SET:this._parentTypeStack.pop();break;case C.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case C.DIRECTIVE:this._directive=null;break;case C.OPERATION_DEFINITION:case C.INLINE_FRAGMENT:case C.FRAGMENT_DEFINITION:this._typeStack.pop();break;case C.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case C.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case C.LIST:case C.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case C.ENUM:this._enumValue=null;break}},e}();function _h(e,n,t){var u=t.name.value;if(u===_c.name&&e.getQueryType()===n)return _c;if(u===Cc.name&&e.getQueryType()===n)return Cc;if(u===$c.name&&Tr(n))return $c;if(Ze(n)||$e(n))return n.getFields()[u]}function Ch(e,n){return{enter:function(u){e.enter(u);var i=xr(n,u.kind,!1);if(i){var r=i.apply(n,arguments);return r!==void 0&&(e.leave(u),$r(r)&&e.enter(r)),r}},leave:function(u){var i=xr(n,u.kind,!0),r;return i&&(r=i.apply(n,arguments)),e.leave(u),r}}}[].concat(bc,xc).map(function(e){return e.name});var sn;function Gn(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}sn={},Gn(sn,C.SCALAR_TYPE_DEFINITION,C.SCALAR_TYPE_EXTENSION),Gn(sn,C.OBJECT_TYPE_DEFINITION,C.OBJECT_TYPE_EXTENSION),Gn(sn,C.INTERFACE_TYPE_DEFINITION,C.INTERFACE_TYPE_EXTENSION),Gn(sn,C.UNION_TYPE_DEFINITION,C.UNION_TYPE_EXTENSION),Gn(sn,C.ENUM_TYPE_DEFINITION,C.ENUM_TYPE_EXTENSION),Gn(sn,C.INPUT_OBJECT_TYPE_DEFINITION,C.INPUT_OBJECT_TYPE_EXTENSION);function Ic(e,n){e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n}var Fc=function(){function e(t,u){this._ast=t,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=u}var n=e.prototype;return n.reportError=function(u){this._onError(u)},n.getDocument=function(){return this._ast},n.getFragment=function(u){var i=this._fragments;return i||(this._fragments=i=this.getDocument().definitions.reduce(function(r,a){return a.kind===C.FRAGMENT_DEFINITION&&(r[a.name.value]=a),r},Object.create(null))),i[u]},n.getFragmentSpreads=function(u){var i=this._fragmentSpreads.get(u);if(!i){i=[];for(var r=[u];r.length!==0;)for(var a=r.pop(),o=0,s=a.selections;o<s.length;o++){var c=s[o];c.kind===C.FRAGMENT_SPREAD?i.push(c):c.selectionSet&&r.push(c.selectionSet)}this._fragmentSpreads.set(u,i)}return i},n.getRecursivelyReferencedFragments=function(u){var i=this._recursivelyReferencedFragments.get(u);if(!i){i=[];for(var r=Object.create(null),a=[u.selectionSet];a.length!==0;)for(var o=a.pop(),s=0,c=this.getFragmentSpreads(o);s<c.length;s++){var l=c[s],f=l.name.value;if(r[f]!==!0){r[f]=!0;var m=this.getFragment(f);m&&(i.push(m),a.push(m.selectionSet))}}this._recursivelyReferencedFragments.set(u,i)}return i},e}();(function(e){Ic(n,e);function n(u,i,r){var a;return a=e.call(this,u,r)||this,a._schema=i,a}var t=n.prototype;return t.getSchema=function(){return this._schema},n})(Fc),function(e){Ic(n,e);function n(u,i,r,a){var o;return o=e.call(this,i,a)||this,o._schema=u,o._typeInfo=r,o._variableUsages=new Map,o._recursiveVariableUsages=new Map,o}var t=n.prototype;return t.getSchema=function(){return this._schema},t.getVariableUsages=function(i){var r=this._variableUsages.get(i);if(!r){var a=[],o=new wh(this._schema);rc(i,Ch(o,{VariableDefinition:function(){return!1},Variable:function(c){a.push({node:c,type:o.getInputType(),defaultValue:o.getDefaultValue()})}})),r=a,this._variableUsages.set(i,r)}return r},t.getRecursiveVariableUsages=function(i){var r=this._recursiveVariableUsages.get(i);if(!r){r=this.getVariableUsages(i);for(var a=0,o=this.getRecursivelyReferencedFragments(i);a<o.length;a++){var s=o[a];r=r.concat(this.getVariableUsages(s))}this._recursiveVariableUsages.set(i,r)}return r},t.getType=function(){return this._typeInfo.getType()},t.getParentType=function(){return this._typeInfo.getParentType()},t.getInputType=function(){return this._typeInfo.getInputType()},t.getParentInputType=function(){return this._typeInfo.getParentInputType()},t.getFieldDef=function(){return this._typeInfo.getFieldDef()},t.getDirective=function(){return this._typeInfo.getDirective()},t.getArgument=function(){return this._typeInfo.getArgument()},t.getEnumValue=function(){return this._typeInfo.getEnumValue()},n}(Fc),oc(bc.concat(xc),function(e){return e.name});const Nc=e=>e instanceof Error?e:typeof e=="string"?new Error(e):new Error(String(e)),$h=()=>typeof globalThis.window<"u"&&typeof globalThis.window.document<"u"&&typeof globalThis.navigator<"u",Rr={staging:{baseEndpoint:"https://api-staging.spritz.finance",graphEndpoint:"https://api-staging.spritz.finance/router/graph",restEndpoint:"https://sandbox.spritz.finance"},production:{baseEndpoint:"https://api.spritz.finance",graphEndpoint:"https://api.spritz.finance/router/graph",restEndpoint:"https://platform.spritz.finance"}},xh=(e,n)=>{if(typeof n!="number"||!Number.isInteger(n))throw new Error(`${e} must be an integer`);if(n<0)throw new Error(`${e} must be a positive integer`);return n};function Ih(e){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function jr(e,n){if(!e||typeof e!="object"||!(n in e))return;const t=e[n];if(typeof t=="string"&&t.length>0)return t}class Tc extends Error{timestamp;headers;constructor(n,t){super(n),this.name="SpritzApiError",this.message=n,this.headers=t??{},this.timestamp=new Date().toISOString()}}class Se extends Error{status;error;headers;timestamp;constructor(n,t,u,i){super(Se.makeMessage(t,u)),this.status=n,this.error=t,this.headers=i,this.timestamp=new Date().toISOString()}static makeMessage(n,t){const u=jr(n,"detail");if(u)return u;const i=jr(n,"title");return i||jr(n,"message")||(n!==void 0?Ih(n):t||"Unknown error occurred")}static generate(n,t,u,i){return n?n===400?new zc(n,t,u,i):n===401?new Uc(n,t,u,i):n===403?new Pc(n,t,u,i):n===404?new Rc(n,t,u,i):n===409?new jc(n,t,u,i):n===422?new Lc(n,t,u,i):n===429?new Zc(n,t,u,i):n>=500?new Vc(n,t,u,i):new Se(n,t,u,i):new Fi({cause:Nc(t)})}}class Fh extends Se{status=void 0;constructor({message:n}={}){super(void 0,void 0,n||"Request was aborted.",void 0)}}class Fi extends Se{status=void 0;constructor({message:n,cause:t}){super(void 0,void 0,n||"Connection error.",void 0),t&&(this.cause=t)}}class Oc extends Fi{constructor(){super({message:"Request timed out."})}}class zc extends Se{name="BadRequestError";status=400}class Uc extends Se{name="AuthenticationError";status=401}class Pc extends Se{name="PermissionDeniedError";status=403}class Rc extends Se{name="NotFoundError";status=404}class jc extends Se{name="ConflictError";status=409}class Lc extends Se{name="UnprocessableEntityError";status=422}class Zc extends Se{name="RateLimitError";status=429}class Vc extends Se{name="InternalServerError"}const Nh=e=>{try{return JSON.parse(e)}catch{return}},qc=10,Mc=100;function Th(e){if(!e||!e.definitions)throw new Error("Invalid GraphQL query: missing definitions");const n=e.definitions.filter(r=>r.kind==="OperationDefinition");if(n.length>1)throw new Error("Invalid GraphQL query: multiple operations not allowed");if(n.length===0)throw new Error("Invalid GraphQL query: no operation definition found");const t=n[0],u=Oh(t);if(u>qc)throw new Error(`GraphQL query too deep: ${u} levels (max: ${qc})`);const i=zh(t);if(i>Mc)throw new Error(`GraphQL query too complex: ${i} fields (max: ${Mc})`);if(t.operation!=="query"&&t.operation!=="mutation")throw new Error(`Invalid GraphQL operation type: ${t.operation}`)}function Oh(e){function n(t){let u=0;for(const i of t.selections)if(i.kind==="Field"&&i.selectionSet){const r=1+n(i.selectionSet);u=Math.max(u,r)}else if(i.kind==="InlineFragment"&&i.selectionSet){const r=n(i.selectionSet);u=Math.max(u,r)}else i.kind==="FragmentSpread"&&(u=Math.max(u,1));return u}return n(e.selectionSet)}function zh(e){function n(t){let u=0;for(const i of t.selections)u+=1,i.kind==="Field"&&i.selectionSet||i.kind==="InlineFragment"&&i.selectionSet?u+=n(i.selectionSet):i.kind==="FragmentSpread"&&(u+=5);return u}return n(e.selectionSet)}function Uh(e){if(!e)return;const n=Object.create(null);for(const[t,u]of Object.entries(e)){if(!Ph(t))throw new Error(`Invalid GraphQL variable name: ${t}`);if(t==="__proto__"||t==="constructor"||t==="prototype")throw new Error(`Invalid property name: ${t}`);n[t]=Lr(u)}return n}function Ph(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function Gc(e){return Array.from(e).filter(n=>{const t=n.charCodeAt(0);return t>31&&t!==127}).join("")}function Lr(e){if(e==null)return e;if(typeof e=="string")return Gc(e);if(typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(Lr);if(typeof e=="object"){const n=Object.create(null);for(const[t,u]of Object.entries(e)){if(t.includes("__proto__")||t.includes("constructor"))throw new Error(`Invalid property name: ${t}`);n[t]=Lr(u)}return n}return Gc(String(e))}const Rh="sha256=";function Jc(e){return Array.from(new Uint8Array(e)).map(n=>n.toString(16).padStart(2,"0")).join("")}async function jh(e){const n=new TextEncoder().encode(e),t=await crypto.subtle.digest("SHA-256",n);return Jc(t)}async function Lh(e,n){const t=new TextEncoder,u=await crypto.subtle.importKey("raw",t.encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),i=await crypto.subtle.sign("HMAC",u,t.encode(n));return Jc(i)}function Zh(e){const n=e.searchParams;return[...n].length===0?"":[...n.keys()].sort().map(t=>{const u=n.get(t)??"";return`${encodeURIComponent(t)}=${encodeURIComponent(u)}`}).join("&")}function Vh(e){const n=Zh(e);return n===""?e.pathname:`${e.pathname}?${n}`}async function qh(e,n,t){const u=t.body?await jh(t.body):"",i=`${n}.${t.method.toUpperCase()}.${t.path}.${u}`,r=await Lh(e,i);return`${Rh}${r}`}async function Mh(e,n,t,u,i){const r=new URL(u),a=Vh(r),o=Date.now(),s=await qh(n,o,{method:t,path:a,body:i});return{"X-Integrator-Key":e,"X-Signature":s,"X-Timestamp":String(o)}}async function Zr(e){const{response:n}=e;return n.headers.get("content-type")?.includes("application/json")?{response:await n.json(),headers:e.headers}:{response:await n.text(),headers:e.headers}}class Gh{baseGraphURL;baseRestURL;baseRestApiURL;timeout;apiKey;integrationKey;integratorSecret;constructor({environment:n,timeout:t=3e5,apiKey:u,integrationKey:i,integratorSecret:r}){this.apiKey=u,this.integrationKey=i,this.integratorSecret=r,this.baseGraphURL=Rr[n].graphEndpoint,this.baseRestURL=Rr[n].baseEndpoint,this.baseRestApiURL=Rr[n].restEndpoint,this.timeout=xh("timeout",t)}async query({query:n,variables:t}){Th(n);const u=Uh(t);return this.sendQuery({query:n,variables:u}).then(i=>Zr(i)).then(({response:i,headers:r})=>{if(i.data)return i.data;if(i.errors){const a=i.errors[0]??{message:"Unknown error"};throw new Tc(a.message,r)}else throw new Error("Unknown error")})}async request({method:n,path:t,body:u=void 0}){return this.sendRequest({method:n,path:t,body:u}).then(i=>Zr(i)).then(({response:i})=>i)}async restApi({method:n,path:t,body:u=void 0,query:i}){return this.sendRestApiRequest({method:n,path:t,body:u,query:i}).then(r=>Zr(r)).then(({response:r})=>r)}async sendQuery({query:n,variables:t}){const{url:u,req:i,timeout:r}=this.buildGraphRequest({query:n,variables:t});return this.sendHTTPRequest({url:u,req:i,timeout:r})}async sendRequest({method:n,path:t,body:u}){const{url:i,req:r,timeout:a}=this.buildRestRequest(n,t,u);return this.sendHTTPRequest({url:i,req:r,timeout:a})}async sendRestApiRequest({method:n,path:t,body:u,query:i}){const{url:r,req:a,timeout:o}=this.buildRestRequest(n,t,u,this.baseRestApiURL,i);if(this.integrationKey&&this.integratorSecret){const s=await Mh(this.integrationKey,this.integratorSecret,n,r,a.body??null),{"X-INTEGRATION-KEY":c,...l}=a.headers;a.headers={...l,...s}}return this.sendHTTPRequest({url:r,req:a,timeout:o})}async sendHTTPRequest({url:n,req:t,timeout:u}){const i=new AbortController,r=await this.fetchWithTimeout(n,t,u,i).catch(Nc);if(r instanceof Error)throw r.name==="AbortError"?new Oc:new Fi({cause:r});const a=this.getResponseHeaders(r.headers);if(!r.ok){const o=await r.text().catch(()=>"Unknown error"),s=Nh(o);throw this.makeStatusError(r.status,s,s?void 0:o,a)}return{response:r,controller:i,headers:a}}getResponseHeaders(n){const t=n.get("x-amzn-trace-id"),u=n.get("x-amzn-requestid");return{traceId:t,requestId:u}}async fetchWithTimeout(n,t,u,i){const{signal:r,...a}=t||{},o=AbortSignal.timeout(u),s=r?AbortSignal.any([r,o,i.signal]):AbortSignal.any([o,i.signal]);return fetch(n,{...a,signal:s})}buildGraphRequest({query:n,variables:t}){const u={query:He(n),variables:t,operationName:n?.definitions?.[0]?.name?.value},i=u?JSON.stringify(u,null,2):null,r=this.calculateContentLength(i),a=this.timeout,o={...r&&{"Content-Length":r},...this.defaultHeaders()},s=Object.fromEntries(Object.entries(o).filter(([l,f])=>f!==null)),c={method:"POST",...i?{body:i}:{},headers:s};return{url:this.baseGraphURL,req:c,timeout:a}}buildRestRequest(n,t,u,i,r){const a=u?JSON.stringify(u):null,o=this.calculateContentLength(a),s=this.timeout,c={...o&&{"Content-Length":o},...this.defaultHeaders()},l=Object.fromEntries(Object.entries(c).filter(([h,E])=>E!==null)),f={method:n,...a?{body:a}:{},headers:l},m=i??this.baseRestURL,d=t.startsWith("/")?t:"/"+t,v=new URL(d,m);if(r)for(const[h,E]of Object.entries(r))E!==void 0&&v.searchParams.set(h,String(E));return{url:v.toString(),req:f,timeout:s}}defaultHeaders(){return{Accept:"application/json","Content-Type":"application/json",...this.authHeaders()}}calculateContentLength(n){if(typeof n=="string"){if(typeof Buffer<"u")return Buffer.byteLength(n,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(n).length.toString()}return null}authHeaders(){return{Authorization:"Bearer "+this.apiKey,...this.integrationKey?{"X-INTEGRATION-KEY":this.integrationKey}:{}}}makeStatusError(n,t,u,i){return Se.generate(n,t,u,i)}}class Jh{client;constructor(n){this.client=n}async list(n){return this.client.restApi({method:"get",path:"/v1/integrator/ach-debit/returns",query:n})}async get(n){return this.client.restApi({method:"get",path:`/v1/integrator/ach-debit/returns/${encodeURIComponent(n)}`})}}class Hh{client;constructor(n){this.client=n}async list(){return this.client.restApi({method:"get",path:"/v1/bank-accounts/"})}async get(n){return this.client.restApi({method:"get",path:`/v1/bank-accounts/${encodeURIComponent(n)}`})}async create(n){return this.client.restApi({method:"post",path:"/v1/bank-accounts/",body:n})}async delete(n){return this.client.restApi({method:"delete",path:`/v1/bank-accounts/${encodeURIComponent(n)}`})}async createLinkToken(n){return this.client.restApi({method:"post",path:"/v1/bank-accounts/link-token",body:n})}async completeLinking(n){return this.client.restApi({method:"post",path:"/v1/bank-accounts/link-complete",body:n})}}var Lt={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"BillFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Bill"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"originator"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"payable"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verifying"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billAccountDetails"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amountDue"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"openedAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastPaymentAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastPaymentDate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"nextPaymentDueDate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"nextPaymentMinimumAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastStatementBalance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"remainingStatementBalance"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"dataSync"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"lastSync"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"syncStatus"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"institution"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"logo"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"paymentAddresses"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:588}};Lt.loc.source={body:`fragment BillFragment on Bill {
|
|
43
43
|
id
|
|
44
44
|
name
|
|
45
45
|
userId
|