'use strict';

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

const index = require('./index-1141a245.js');
const session = require('./session-b6f20e12.js');
const takvimMeetingListViewConfig = require('./takvim-meeting-list-view-config-ef7bea1f.js');
const mentorintyBridgeApi = require('./mentorinty-bridge-api-0534712d.js');
require('./membership-ed8d3277.js');
require('./data-model-9afb7f54.js');
require('./table-config-8b14c7d3.js');
require('./FieldModelGenerator-1900d81a.js');
require('./reference-field-1239b0c3.js');
require('./BaseField-381327a9.js');
require('./index-2eea69a0.js');
require('./FieldGenerator-279a646b.js');
require('./date-a24d7714.js');
require('./index-0783d14f.js');
require('./index-e8e4d80b.js');
require('./index-9d3d3d15.js');
require('./index-9fd84b93.js');
require('./index-61f9621a.js');
require('./string-de672b69.js');
require('./User-e889279b.js');
require('./UserSettings-fc04eb54.js');
require('./cookie-135bf612.js');
require('./kimlik-api-d3c479a3.js');
require('./apiBase-e4ebaf8b.js');
require('./data-transfer-field-e8417d5f.js');
require('./filter-d5040f65.js');
require('./_commonjsHelpers-206db00d.js');
require('./index-33e96540.js');
require('./instance-36d7564f.js');
require('./index-a2e99c85.js');
require('./i18n-49870fc9.js');
require('./i18n-5585a319.js');
require('./calendar-e4b7baeb.js');
require('./index-b776fc14.js');
require('./moment-7a3433f2.js');
require('./view-config-7972654b.js');
require('./index-e751cab0.js');
require('./attachment-b0acc4c1.js');
require('./CalendarConfig-ee7bb722.js');

const mentornityMyMeetingsWrapperCss = "mentornity-my-meetings-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;overflow:hidden}";

const MentornityMyMeetingsWrapper = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
  }
  componentWillLoad() {
    // fetch the context async to unblock the component render
    session.generateMentornitySessionContext(this.contextParams, { fetchConfig: true })
      .then((mentornitySessionContext) => {
      this.mentornitySessionContext = mentornitySessionContext;
      this.view = takvimMeetingListViewConfig.TakvimMeetingListViewConfig.decode({
        _id: 'my-meetings-page-meeting-list-view',
        i18nEntryId: 'my-meetings-page-meeting-list-view',
        table: mentorintyBridgeApi.generateCalendarConfig(this.mentornitySessionContext.organisationConfig),
      });
    })
      .catch(error => {
      console.log(error);
      this.error = error;
    });
  }
  onAction(event) {
    const action = event.detail;
    switch (action.name) {
      case 'open-meeting-detail-from-meeting-list':
        window.dispatchEvent(new CustomEvent('dvn.mentornity-my-meetings-wrapper.open-meeting-detail', {
          detail: {
            meetingId: action.params.meetingId,
          }
        }));
        break;
    }
  }
  render() {
    const { error, mentornitySessionContext, view } = this;
    if (!!error) {
      return (index.h("dvn-card", { leanedSides: true, tint: "danger" }, "Failed to get data."));
    }
    if (!mentornitySessionContext) {
      return (index.h("div", { class: "d-flex flex-grow-1 justify-content-center pt-3" }, index.h("dvn-progress", { indefinite: true })));
    }
    const { apiSozluk, mentornityBridgeApi, user, userSettings } = mentornitySessionContext;
    return (index.h("dvn-app-view-takvim-meeting-list-view-table", { apiSozluk: apiSozluk, apiTakvim: mentornityBridgeApi, userSettings: userSettings, view: view, params: {
        guest1Id: user._id
      }, scrollToFitHeight: true }));
  }
};
MentornityMyMeetingsWrapper.style = mentornityMyMeetingsWrapperCss;

exports.mentornity_my_meetings_wrapper = MentornityMyMeetingsWrapper;
