"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.clientIdAsync = clientIdAsync; exports.setClientIdAsync = setClientIdAsync; function _uuid() { const data = require("uuid"); _uuid = function () { return data; }; return data; } function _internal() { const data = require("./internal"); _internal = function () { return data; }; return data; } function _newIdentifier(type = 'c') { const bytes = (0, _uuid().v4)(null, Buffer.alloc(16)); const base64 = bytes.toString('base64'); const slug = base64 // Replace + with - (see RFC 4648, sec. 5) .replace(/\+/g, '-') // Replace / with _ (see RFC 4648, sec. 5) .replace(/\//g, '_') // Drop '==' padding .substring(0, 22); return type + '_' + slug; } async function clientIdAsync() { let clientId = await _internal().UserSettings.getAsync('accessToken', null); if (clientId === null) { clientId = _newIdentifier(); await setClientIdAsync(clientId); } return clientId; } async function setClientIdAsync(token) { await _internal().UserSettings.setAsync('accessToken', token); return token; } //# sourceMappingURL=Session.js.map