'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-1ee80297.js');
const light = require('./light-d8d0f261.js');
const index$1 = require('./index-4d4f2dcf.js');
require('./colors-a0e2d25f.js');
require('./kimlikApi-1cd43caf.js');
require('./data-transfer-field-0ce05c1a.js');
require('./BaseField-d019ade6.js');
require('./filter-d5040f65.js');
require('./cookie-c4d9848a.js');
require('./_commonjsHelpers-206db00d.js');

function wrapContent(theme, content) {
  return (index.h(index.Host, null, index.h("mentornity-console-app-context-injector", { theme: theme }, index.h("dvn-theme-provider", { colorBackground: true, fitHeight: true, theme: theme }, index.h("dvn-global-table", null), index.h("dvn-global-grid", null), index.h("dvn-global-text", null), index.h("notifier-wrapper", null, content)))));
}
let MentornityConsoleAppRoot = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.navigate = (config) => {
      this.path = config.path;
      history.pushState({}, '', this.path);
    };
  }
  onThemeChange(event) {
    if (event.detail === 'dvn-dark') {
      this.theme = light.dark;
    }
    else {
      this.theme = light.light;
    }
  }
  componentWillLoad() {
    const hour = new Date().getHours();
    const isSunGone = 6 > hour || hour > 18;
    this.theme = isSunGone ? light.dark : light.light;
    this.path = location.pathname;
  }
  render() {
    if (!index$1.isUserLoggedIn()) {
      return wrapContent(this.theme, index.h("dvn-app-anonymous", { navigate: this.navigate, path: this.path }));
    }
    return wrapContent(this.theme, index.h("dvn-app", { navigate: this.navigate, path: this.path }));
  }
};

exports.mentornity_console_app_root = MentornityConsoleAppRoot;
