import { isInIframe as u, debug as o } from "./initConfig.js";
import { version as r } from "../../version.js";
const d = (e) => !!document.head.querySelector(e), c = (e) => e.some(d), a = ["rio", "man", "vw", "scania", "traton"], l = (e) => a.includes(e), m = (e) => l(e) ? e : "rio", f = () => {
  if ((!window.CSS || !window.CSS.supports || !window.CSS.supports("gap: 1px")) && document.documentElement.classList.add("css-no-gap"), u && document.documentElement.classList.add("window-iframe"), document.title?.includes("UIKIT Demo"))
    return;
  o("Checking for UIKIT CSS in document head.");
  const e = c(['link[href*="rio-uikit.css"]', 'link[href*="rio-uikit-core.css"]']), t = d('style[data-vite-dev-id*="uikit.scss"]'), i = c([
    'link[href*="man-uikit.css"]',
    'link[href*="vw-uikit.css"]',
    'link[href*="scania-uikit.css"]',
    'link[href*="traton-uikit.css"]',
    'link[href*="rio-website.css"]'
  ]);
  if (e || t || i) {
    o("UIKIT CSS found in document head.");
    return;
  }
  o("No UIKIT CSS found => append link tag to document head.");
  const n = m(document.documentElement.dataset.brand), s = document.createElement("link");
  s.rel = "stylesheet", s.type = "text/css", s.href = `https://uikit.developers.rio.cloud/${r}/${n}-uikit.css`, document.head.appendChild(s);
}, S = () => {
  [...document.querySelectorAll('link[rel="stylesheet"]')].forEach((t) => {
    const { href: i } = t;
    if (i.includes("uikit.developers.rio.cloud")) {
      const [, n] = new URL(i).pathname.split("/");
      i.includes(r) || console.warn(
        `You are using different UIKIT JS and CSS versions.
Your current JS version is ${r} and your current CSS version is ${n}.
If this is not on purpose, please fix it. Otherwise, this may lead to UI bugs.`
      );
    } else i.includes("cdn.rio.cloud/libs/rio-uikit") && console.error(
      'You are still using an old "cdn.rio.cloud" css import. This will most likely cause major UI bugs! Please update to the CSS URLs as explained on https://uikit.developers.rio.cloud/#start/howto.'
    );
  });
};
export {
  S as checkCSSVersion,
  f as initCSS
};
//# sourceMappingURL=initCSS.js.map
