"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CacheManager = void 0;

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var fullbackGlobal = {};

var CacheManager =
/*#__PURE__*/
function () {
  function CacheManager() {
    _classCallCheck(this, CacheManager);
  }

  _createClass(CacheManager, null, [{
    key: "global",
    get: function get() {
      if (typeof globalThis !== 'undefined') {
        return globalThis;
      }

      if (typeof self !== 'undefined') {
        return self;
      }

      if (typeof window !== 'undefined') {
        return window;
      }

      if (typeof global !== 'undefined') {
        return global;
      }

      return fullbackGlobal;
    }
  }, {
    key: "globalCache",
    get: function get() {
      if (typeof CacheManager.global._atIconScriptCaches !== 'undefined') {
        return CacheManager.global._atIconScriptCaches;
      }

      CacheManager.global._atIconScriptCaches = new Set();
      return CacheManager.global._atIconScriptCaches;
    }
  }]);

  return CacheManager;
}();

exports.CacheManager = CacheManager;

_defineProperty(CacheManager, "has", function (val) {
  return CacheManager.globalCache.has(val);
});

_defineProperty(CacheManager, "add", function (val) {
  return CacheManager.globalCache.add(val);
});