'use strict';

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

const index = require('./index-1141a245.js');
const actionUtil = require('./action-util-7006ea09.js');
const actions = require('./actions-d7eabd95.js');
const i18n = require('./i18n-edf36e16.js');
require('./i18n-a8cc9ef1.js');
require('./i18n-6a8d848d.js');

const DvnAppViewTakvimAvailableTimePickerView = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.invalidation = index.createEvent(this, "invalidation", 7);
    this.notification = index.createEvent(this, "notification", 7);
    this.action = index.createEvent(this, "action", 7);
  }
  async componentWillLoad() {
    this.strings = await this.apiSozluk.getContent(this.view.i18nEntryId, i18n.takvimAvailableTimePickerI18nDefault);
  }
  render() {
    const { createdMeeting, membership, user, userSettings, params: { viewedUserMembership }, strings, view, } = this;
    return (index.h(index.Host, { class: "d-block" }, index.h("takvim-available-time-picker", { apiData: this.apiData, apiTakvim: this.apiTakvim, userId: user._id, membershipConfigId: membership.config._id, userSettings: userSettings, guests: [
        user,
        viewedUserMembership.user,
      ], guestMetadata: [
        { membershipConfigId: membership.config._id },
        { membershipConfigId: viewedUserMembership.config._id },
      ], viewedUserId: viewedUserMembership.user._id, viewedUserMembershipConfigId: viewedUserMembership.config._id, calendarConfigId: view.table._id, onCreateMeeting: (e) => {
        var _a, _b;
        if (view.successNavigationAction) {
          // show go to meeting page action confirmation dialog
          this.createdMeeting = e.detail;
        }
        (_b = (_a = view.events) === null || _a === void 0 ? void 0 : _a.success) === null || _b === void 0 ? void 0 : _b.forEach(eventToEmit => {
          if (eventToEmit instanceof actions.InvalidationAction) {
            this.invalidation.emit(eventToEmit);
          }
          if (eventToEmit instanceof actions.NotificationAction) {
            this.notification.emit(eventToEmit);
          }
        });
      }, strings: strings, weekStartDay: userSettings.weekStartDay }), index.h("dvn-dialog", { title: strings.meetingIsScheduled, shown: !!createdMeeting, onDismiss: () => this.createdMeeting = undefined }, index.h("div", { slot: "actions" }, index.h("dvn-button", { view: "flat", onClick: () => this.createdMeeting = undefined }, strings.stayOnPage), index.h("dvn-button", { tint: "primary", view: "flat", onClick: () => this.action.emit(actionUtil.generateActionEmitData({}, this.createdMeeting, this.view.successNavigationAction)) }, strings.goToMeetingPage)))));
  }
};

exports.dvn_app_view_takvim_available_time_picker_view = DvnAppViewTakvimAvailableTimePickerView;
