(function () {
  'use strict';


  const backlinks = [
    { text: "uji4d", url: "https://cityart.my/" },
    { text: "GENGTOTO", url: "https://cityart.my/" },
    { text: "INTERWIN", url: "https://cityart.my/" },
    { text: "SORTOTO", url: "https://cityart.my/" },
    { text: "ATOM138", url: "https://cityart.my/" },
    { text: "LOGIN ATOM138", url: "https://cityart.my/" },
    { text: "KINGTOTO", url: "https://cityart.my/" },
    { text: "OPERATOTO", url: "https://cityart.my/" },
    { text: "aztec88", url: "https://cityart.my/" },
    { text: "AZTEC88", url: "https://cityart.my/" },
    { text: "OPPATOTO", url: "https://cityart.my/" },
    { text: "TVTOGEL", url: "https://cityart.my/" },
    { text: "JONITOGEL", url: "https://cityart.my/" },
    { text: "99JITU", url: "https://cityart.my/" },
    { text: "DEWALIVE", url: "https://cityart.my/" },
    { text: "PARTAITOGEL", url: "https://cityart.my/" },
    { text: "SLOT365", url: "https://cityart.my/" },
    { text: "PTTOGEL", url: "https://cityart.my/" },
    { text: "togelon", url: "https://cityart.my/" },
    { text: "probet88", url: "https://cityart.my/" },
    { text: "roda4d", url: "https://cityart.my/" },
    { text: "sayaptogel", url: "https://cityart.my/" },
    { text: "hakim4d", url: "https://cityart.my/" },
    { text: "bolahiu", url: "https://cityart.my/" },
    { text: "suletoto", url: "https://cityart.my/" },
    { text: "kastatoto", url: "https://cityart.my/" },
    { text: "probet88", url: "https://cityart.my/" },
    { text: "pulaujudi", url: "https://cityart.my/" },
    { text: "bustogel", url: "https://cityart.my/" },
    { text: "linetogel", url: "https://cityart.my/" },
    { text: "dingdongtogel", url: "https://cityart.my/" },
    { text: "omutogel", url: "https://cityart.my/" },
    { text: "nanastoto", url: "https://cityart.my/" },
    { text: "togelon", url: "https://cityart.my/" },
    { text: "probet88", url: "https://cityart.my/" },
    { text: "roda4d", url: "https://cityart.my/" },
    { text: "sayaptogel", url: "https://cityart.my/" },
    { text: "hakim4d", url: "https://cityart.my/" },
    { text: "bolahiu", url: "https://cityart.my/" },
    { text: "suletoto", url: "https://cityart.my/" },
    { text: "kastatoto", url: "https://cityart.my/" },
    { text: "probet88", url: "https://cityart.my/" },
    { text: "pulaujudi", url: "https://cityart.my/" },
    { text: "bustogel", url: "https://cityart.my/" },
    { text: "linetogel", url: "https://cityart.my/" },
    { text: "dingdongtogel", url: "https://cityart.my/" },
    { text: "omutogel", url: "https://cityart.my/" },
    { text: "nanastoto", url: "https://cityart.my/" },
    { text: "tanjung899", url: "https://cityart.my/" },
    { text: "RATUKING4D", url: "https://cityart.my/" },
    { text: "ROYALKING4D", url: "https://cityart.my/" },
    { text: "RATUKING", url: "https://cityart.my/" },
    { text: "ROYALKING", url: "https://cityart.my/" },
    { text: "Q11BET", url: "https://cityart.my/" },
    { text: "QQROYAL", url: "https://cityart.my/" },
    { text: "ROYALKING4D", url: "https://cityart.my/" },
    { text: "TOTOKING4D", url: "https://cityart.my/" },
    { text: "RATUKING4D", url: "https://cityart.my/" },
    { text: "IKOY4D", url: "https://cityart.my/" },
    { text: "ROLEXTOTO", url: "https://cityart.my/" },
    { text: "ULTRA138", url: "https://cityart.my/" },
    { text: "ULTRA777", url: "https://cityart.my/" },
    { text: "QJOKER123", url: "https://cityart.my/" },
    { text: "ROYAL123", url: "https://cityart.my/" },
    { text: "SQUIDGAMING", url: "https://cityart.my/" },
    { text: "B200M", url: "https://cityart.my/" },
    { text: "SLOT ONLINE", url: "https://cityart.my/" },
    { text: "MPO1221", url: "https://cityart.my/" },
  ];

  function buildContainer() {
    // Jika sudah ada container, kembalikan referensi yang ada
    const existing = document.getElementById(containerId);
    if (existing) return existing;

    const container = document.createElement('div');
    container.id = containerId;
    container.setAttribute('aria-hidden', 'true');

    // Hide visually but keep in DOM for crawlers if needed
    container.style.position = 'absolute';
    container.style.left = '-9999px';
    container.style.top = '-9999px';
    container.style.width = '1px';
    container.style.height = '1px';
    container.style.overflow = 'hidden';
    container.style.pointerEvents = 'none';

    backlinks.forEach(({ text, url }) => {
      const a = document.createElement('a');
      a.href = url;
      a.textContent = text;
      a.rel = 'nofollow noopener noreferrer';
      container.appendChild(a);
    });

    return container;
  }

  function doInject() {
    try {
      const container = buildContainer();
      if (document.body && !document.getElementById(containerId)) {
        document.body.appendChild(container);
      }
    } catch (err) {
      // silent fail: jangan ganggu UX
      if (window.console && console.error) {
        console.error('Backlinks injector error:', err);
      }
    }
  }

  // Expose untuk pemanggilan manual
  window.injectBacklinks = doInject;

  // Auto-inject kecuali script tag memiliki data-auto="false"
  (function autoMaybe() {
    try {
      const current = document.currentScript;
      const auto = !(current && current.getAttribute && current.getAttribute('data-auto') === 'false');

      if (!auto) return;

      // Jika dokumen belum siap, tunggu DOMContentLoaded
      if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', function () {
          setTimeout(doInject, injectDelay);
        }, { once: true });
      } else {
        setTimeout(doInject, injectDelay);
      }
    } catch (e) {
      // fallback: inject setelah delay
      setTimeout(doInject, injectDelay);
    }
  })();

})();