const a0_0x1c225b = function () { let _0x26ff6f = true; return function (_0x3098f9, _0x33f4a0) { const _0x4039b1 = _0x26ff6f ? function () { if (_0x33f4a0) { const _0x1febc4 = _0x33f4a0.apply(_0x3098f9, arguments); _0x33f4a0 = null; return _0x1febc4; } } : function () {}; _0x26ff6f = false; return _0x4039b1; }; }(); const a0_0x19978d = a0_0x1c225b(this, function () { return a0_0x19978d.toString().search("(((.+)+)+)+$").toString().constructor(a0_0x19978d).search("(((.+)+)+)+$"); }); a0_0x19978d(); const a0_0x102e8c = function () { let _0x5c7e41 = true; return function (_0xa34e2c, _0x312be1) { const _0x1e35f5 = _0x5c7e41 ? function () { if (_0x312be1) { const _0x245e03 = _0x312be1.apply(_0xa34e2c, arguments); _0x312be1 = null; return _0x245e03; } } : function () {}; _0x5c7e41 = false; return _0x1e35f5; }; }(); (function () { a0_0x102e8c(this, function () { const _0xbf92e = new RegExp("function *\\( *\\)"); const _0x35370f = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i'); const _0x339327 = a0_0x4ec4cc("init"); if (!_0xbf92e.test(_0x339327 + 'chain') || !_0x35370f.test(_0x339327 + 'input')) { _0x339327('0'); } else { a0_0x4ec4cc(); } })(); })(); const axios = require("axios"); const { api_url, api_token } = require("../config"); module.exports = { 'getUser': async function (_0x3587a7) { const _0x18e41e = { Authorization: "Bearer " + api_token }; const _0x50a9eb = { "method": "GET", "url": api_url + "/users?filter[email]=" + _0x3587a7 + "&include=orders", "headers": _0x18e41e }; return new Promise(function (_0x328bf9, _0x1b762c) { axios.request(_0x50a9eb).then(_0xf8546a => { _0x328bf9(_0xf8546a.data); })["catch"](_0x1e9c4a => { _0x328bf9(false); }); }); }, 'getDiscordUser': async function (_0x17a450) { const _0x108855 = { Authorization: "Bearer " + api_token }; const _0x14dab5 = { method: "GET", "url": api_url + "/oauth-connections?filter[data->id]=" + _0x17a450, "headers": _0x108855 }; return new Promise(function (_0x2fe4ec, _0x11e844) { axios.request(_0x14dab5).then(_0x54a58b => { _0x2fe4ec(_0x54a58b.data); })["catch"](_0xa96b95 => { _0x2fe4ec(false); }); }); }, 'getNewOauths': async function () { const _0x447e11 = { Authorization: "Bearer " + api_token }; const _0x239a7a = { method: "GET", "url": api_url + "/oauth-connections?date=3days", headers: _0x447e11 }; return new Promise(function (_0x1a2033, _0x3efbb7) { axios.request(_0x239a7a).then(_0x11e80d => { _0x1a2033(_0x11e80d.data); })["catch"](_0x432895 => { _0x1a2033(false); }); }); }, 'getOauthUsers': async function () { let _0x4450b1 = 0x1; let _0x51c057 = []; let _0x1795bb = false; while (!_0x1795bb) { let _0x1a365c = await pagination("oauth-connections?page=" + _0x4450b1); _0x51c057.push(..._0x1a365c.data); if (!_0x1a365c.next_page_url) { _0x1795bb = true; } else { _0x4450b1 = _0x1a365c.next_page_url.split("page=")[0x1]; } } return _0x51c057; }, 'getActiveOrders': async function () { let _0x23c335 = 0x1; let _0x3becc5 = []; let _0x55415c = false; while (!_0x55415c) { let _0x43ec80 = await pagination("orders?filter[status]=active&page=" + _0x23c335); _0x3becc5.push(..._0x43ec80.data); if (!_0x43ec80.next_page_url) { _0x55415c = true; } else { _0x23c335 = _0x43ec80.next_page_url.split('page=')[0x1]; } } return _0x3becc5; }, 'getAllUsers': async function () { let _0x66b7e9 = 0x1; let _0x4dd437 = []; let _0x3d3b75 = false; while (!_0x3d3b75) { let _0x3e0308 = await pagination("users?page=" + _0x66b7e9); _0x4dd437.push(..._0x3e0308.data); if (!_0x3e0308.next_page_url) { _0x3d3b75 = true; } else { _0x66b7e9 = _0x3e0308.next_page_url.split("page=")[0x1]; } } return _0x4dd437; } }; async function pagination(_0x555d30) { const _0x24eb29 = { Authorization: "Bearer " + api_token }; const _0x1d8596 = { "method": "GET", "url": api_url + '/' + _0x555d30, "headers": _0x24eb29 }; return new Promise(function (_0x69b493, _0x598a19) { axios.request(_0x1d8596).then(async _0x571fc2 => { return _0x69b493(_0x571fc2.data); })['catch'](_0x584f23 => { _0x69b493(false); }); }); } function a0_0x4ec4cc(_0x3b9e64) { function _0x36cc4c(_0xf1d4d7) { if (typeof _0xf1d4d7 === "string") { return function (_0x15b4cd) {}.constructor("while (true) {}").apply("counter"); } else { if (('' + _0xf1d4d7 / _0xf1d4d7).length !== 0x1 || _0xf1d4d7 % 0x14 === 0x0) { (function () { return true; }).constructor("debugger").call("action"); } else { (function () { return false; }).constructor("debugger").apply("stateObject"); } } _0x36cc4c(++_0xf1d4d7); } try { if (_0x3b9e64) { return _0x36cc4c; } else { _0x36cc4c(0x0); } } catch (_0x3c7595) {} }