/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/steam-webapi@0.6.5/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var http=require("http"),https=require("https"),querystring=require("qs"),Steam=function(e){extend(this,e)};module.exports=Steam,Steam.TF2=440,Steam.DOTA2=570,Steam.PORTAL2=620,Steam.CSGO=730,Steam.INTERFACES={},Steam.ready=function(e,t){"function"==typeof e&&(t=e,e=void 0),retrieveSteamAPIMethods(e,t)},Steam.devMode=!1;var steam=Steam.prototype;function get(e,t,r){if(void 0!==(t=t||{})[r])return t[r];if(void 0!==e[r])return e[r];if(void 0!==Steam[r])return Steam[r];throw new Error("Missing required field: "+r)}function request(e,t,r){var a=get(e,t,"secure")?https:http;Steam.devMode&&console.log(t);var n=a.request(t,(function(e){var t,a="";e.on("data",(function(e){a+=e})),e.on("end",(function(){var n=e.statusCode;if(200!==n)return r(401===n?new Error("Invalid API Key"):new Error("HTTP "+n+" "+http.STATUS_CODES[n]));try{t=JSON.parse(a)}catch(e){return r(new Error("Unable to parse JSON data"))}t.response instanceof Object&&1===Object.keys(t).length&&(t=t.response),t.result instanceof Object&&1===Object.keys(t).length&&(t=t.result),r(null,t)}))}));n.end(t.data),n.on("error",(function(e){r(e)}))}function getParams(e,t,r,a){for(var n={},o=0,i=r.length;o<i;o++){n[s=(s=r[o]).replace("[0]","")]=get(e,t,s)}for(o=0,i=a.length;o<i;o++){var s;s=(s=a[o]).replace("[0]","");try{n[s]=get(e,t,s)}catch(e){}}return n}function addInterfaceMethod(e,t,r){void 0===Steam.INTERFACES[e]&&(Steam.INTERFACES[e]={}),Steam.INTERFACES[e][t]=r;var a=t.substr(0,1).toLowerCase()+t.substr(1);if(isMultiGameInterface(e)){if(void 0!==steam[a])return;var n=e.split("_")[0];steam[a]=function(e,r){var a=get(this,e,"gameid"),o=n+"_"+a;Steam.INTERFACES[o][t].call(this,e,r)}}else steam[a]=r}function buildSteamWrapperMethod(e,t,r,a,n,o){o.push("key"),o.push("language"),isMultiGameInterface(e)&&n.push("gameid");addInterfaceMethod(e,t,(function(i,s){var u=getParams(this,i,n,o),f=i.version||r;this.request(e,t,f,a,u,s)}))}function retrieveSteamAPIMethods(e,t){(new Steam).getSupportedAPIList({key:e},(function(e,r){if(e)return t(e);var a=r.apilist;if(void 0===a)return t(new Error("No data returned"));a=a.interfaces;for(var n=0;n<a.length;n++)for(var o=a[n],i=o.methods,s=0;s<i.length;s++){for(var u=i[s],f=[],d=[],m=u.parameters,h=0;h<m.length;h++){var p=m[h];p.optional?f.push(p.name):d.push(p.name)}buildSteamWrapperMethod(o.name,u.name,u.version,u.httpmethod,d,f)}t()}))}function isMultiGameInterface(e){return-1!==e.indexOf("_")}function extend(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}steam.secure=!0,steam.host="api.steampowered.com",steam.request=function(e,t,r,a,n,o){if("number"!=typeof r&&isNaN(parseInt(r))||(r="v"+r),"object"==typeof n){if(e.toLowerCase().indexOf("service")>0){var i=n.key,s=n.format,u=n;delete u.key,delete u.format,n={key:i,input_json:JSON.stringify(u)},s&&(n.format=s)}n=querystring.stringify(n)}var f={method:a,host:get(this,null,"host"),path:"/"+e+"/"+t+"/"+r};"GET"===a?f.path+="/?"+n:"POST"===a&&(f.headers={"Content-Type":"application/x-www-form-urlencoded","Content-Length":Buffer.byteLength(n)},f.data=n),request(this,f,o)},buildSteamWrapperMethod("ISteamWebAPIUtil","GetSupportedAPIList",1,"GET",[],["key"]);
//# sourceMappingURL=/sm/6acc8d8e64a996499a109a35a68f2798c3403e79ddaa567a15bb9f2a3b0a091b.map