import { r as registerInstance, h, H as Host } from './index-ecdfb761.js';
import { d as dark } from './dark-51789ed8.js';
import { l as light } from './light-e0bd183b.js';
import { i as isUserLoggedIn } from './index-7d83a942.js';
import { w as watchDeviceAppearance } from './theme-a6597800.js';
import './colors-4dc9e03b.js';
import './kimlik-api-66e341bd.js';
import './apiBase-648a161d.js';
import './data-transfer-field-2f305919.js';
import './BaseField-0b01dc2c.js';
import './filter-cbaa3d7d.js';
import './cookie-9f22e0fb.js';
import './_commonjsHelpers-27f122dd.js';

function wrapContent(theme, content) {
  return (h(Host, null, h("mentornity-console-app-context-injector", { theme: theme }, h("dvn-theme-provider", { colorBackground: true, fitHeight: true, theme: theme }, h("dvn-global-table", null), h("dvn-global-grid", null), h("dvn-global-text", null), h("notifier-wrapper", null, content)))));
}
const MentornityConsoleAppRoot = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.theme = light;
    this.navigate = (config) => {
      this.path = config.path;
      history.pushState({}, '', this.path);
    };
  }
  onThemeChange(event) {
    if (event.detail === 'dvn-dark') {
      this.theme = dark;
    }
    else {
      this.theme = light;
    }
  }
  componentWillLoad() {
    // get the current appearance from device and start watching the appearance change events
    if (watchDeviceAppearance(appearance => this.theme = appearance === 'dark' ? dark : light) === 'dark') {
      this.theme = dark;
    }
    this.path = location.pathname;
  }
  render() {
    if (!isUserLoggedIn()) {
      return wrapContent(this.theme, h("dvn-app-anonymous", { navigate: this.navigate, path: this.path }));
    }
    return wrapContent(this.theme, h("dvn-app", { navigate: this.navigate, path: this.path }));
  }
};

export { MentornityConsoleAppRoot as mentornity_console_app_root };
