"use strict";

if (typeof window.core !== "function") {
  // Not initialized

  // Initialize of the class in global namespace
  window.core = class core {
    // Subdomain
    static subdomain = window.location.host.split(".")[0];

    // Page
    static page = window.location.pathname === "/"
      ? "tasks"
      : window.location.pathname.replace(/^.*\//, "");

    // Interface
    static interface = this.subdomain === "xn--80aksgi6f"
      ? "worker"
      : (this.subdomain === "xn--80aj0acchco"
        ? "operator"
        : (this.subdomain === "xn--80aairftm"
          ? "market"
          : (this.subdomain === "xn--80aalqawikqchmc"
            ? "administrator"
            : "worker")));
  };
}

// Вызов события: "инициализировано"
document.dispatchEvent(
  new CustomEvent("core.initialized", {
    detail: { core: window.core },
  }),
);
