/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@eyewa/graphql-request@1.0.1/dist/src/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var s in e=arguments[r])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},__awaiter=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(s,i){function o(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?s(t.value):new r((function(e){e(t.value)})).then(o,a)}u((n=n.apply(t,e||[])).next())}))},__generator=this&&this.__generator||function(t,e){var r,n,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(s=n[2&i[0]?"return":i[0]?"throw":"next"])&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[0,s.value]),i[0]){case 0:case 1:s=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(6===i[0]&&o.label<s[1]){o.label=s[1],s=i;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(i);break}s[2]&&o.ops.pop(),o.trys.pop();continue}i=e.call(t,o)}catch(t){i=[6,t],n=0}finally{r=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},__rest=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&(r[n[s]]=t[n[s]])}return r};Object.defineProperty(exports,"__esModule",{value:!0});var types_1=require("./types"),types_2=require("./types");exports.ClientError=types_2.ClientError,require("cross-fetch/polyfill");var GraphQLClient=function(){function t(t,e){this.url=t,this.options=e||{}}return t.prototype.rawRequest=function(t,e){return __awaiter(this,void 0,void 0,(function(){var r,n,s,i,o,a,u,c,h;return __generator(this,(function(l){switch(l.label){case 0:return r=this.options,n=r.headers,s=__rest(r,["headers"]),i=JSON.stringify({query:t,variables:e||void 0}),[4,fetch(this.url,__assign({method:"POST",headers:Object.assign({"Content-Type":"application/json"},n),body:i},s))];case 1:return[4,getResult(o=l.sent())];case 2:if(a=l.sent(),o.ok&&!a.errors&&a.data)return u=o.headers,c=o.status,[2,__assign({},a,{headers:u,status:c})];throw h="string"==typeof a?{error:a}:a,new types_1.ClientError(__assign({},h,{status:o.status,headers:o.headers}),{query:t,variables:e})}}))}))},t.prototype.request=function(t,e){return __awaiter(this,void 0,void 0,(function(){var r,n,s,i,o,a,u;return __generator(this,(function(c){switch(c.label){case 0:return r=this.options,n=r.headers,s=__rest(r,["headers"]),i=JSON.stringify({query:t,variables:e||void 0}),[4,fetch(this.url,__assign({method:"POST",headers:Object.assign({"Content-Type":"application/json"},n),body:i},s))];case 1:return[4,getResult(o=c.sent())];case 2:if(a=c.sent(),o.ok&&!a.errors&&a.data)return[2,a.data];throw u="string"==typeof a?{error:a}:a,new types_1.ClientError(__assign({},u,{status:o.status}),{query:t,variables:e})}}))}))},t.prototype.query=function(t,e){return __awaiter(this,void 0,void 0,(function(){var r,n,s,i,o,a,u;return __generator(this,(function(c){switch(c.label){case 0:return r=this.options,n=r.headers,s=__rest(r,["headers"]),i="query="+encodeURIComponent(t),e&&(i+="&variables="+encodeURIComponent(JSON.stringify(e||void 0))),[4,fetch(this.url+"?"+i,__assign({method:"GET",headers:Object.assign({"Content-Type":"application/json"},n)},s))];case 1:return[4,getResult(o=c.sent())];case 2:if(a=c.sent(),o.ok&&!a.errors&&a.data)return[2,a.data];throw u="string"==typeof a?{error:a}:a,new types_1.ClientError(__assign({},u,{status:o.status}),{query:t,variables:e})}}))}))},t.prototype.setHeaders=function(t){return this.options.headers=t,this},t.prototype.setHeader=function(t,e){var r,n=this.options.headers;return n?n[t]=e:this.options.headers=((r={})[t]=e,r),this},t}();function rawRequest(t,e,r){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){return[2,new GraphQLClient(t).rawRequest(e,r)]}))}))}function request(t,e,r){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){return[2,new GraphQLClient(t).request(e,r)]}))}))}function getResult(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(r){return(e=t.headers.get("Content-Type"))&&e.startsWith("application/json")?[2,t.json()]:[2,t.text()]}))}))}exports.GraphQLClient=GraphQLClient,exports.rawRequest=rawRequest,exports.request=request,exports.default=request;
//# sourceMappingURL=/sm/145b69b773edb826eccf78989d067a505be9ee44ecb01b224c9e37782884ee2b.map