import { r as registerInstance, c as createEvent, h, H as Host } from './index-ecdfb761.js';
import { a as generateActionEmitData } from './action-util-20b0b25d.js';
import { I as InvalidationAction, N as NotificationAction } from './actions-b9a0f808.js';
import { t as takvimAvailableTimePickerI18nDefault } from './i18n-2d5bee10.js';
import './i18n-27a6b633.js';
import './i18n-f1ddd0c3.js';

const DvnAppViewTakvimAvailableTimePickerView = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.invalidation = createEvent(this, "invalidation", 7);
    this.notification = createEvent(this, "notification", 7);
    this.action = createEvent(this, "action", 7);
  }
  async componentWillLoad() {
    this.strings = await this.apiSozluk.getContent(this.view.i18nEntryId, takvimAvailableTimePickerI18nDefault);
  }
  render() {
    const { createdMeeting, membership, user, userSettings, params: { viewedUserMembership }, strings, view, } = this;
    return (h(Host, { class: "d-block" }, 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 InvalidationAction) {
            this.invalidation.emit(eventToEmit);
          }
          if (eventToEmit instanceof NotificationAction) {
            this.notification.emit(eventToEmit);
          }
        });
      }, strings: strings, weekStartDay: userSettings.weekStartDay }), h("dvn-dialog", { title: strings.meetingIsScheduled, shown: !!createdMeeting, onDismiss: () => this.createdMeeting = undefined }, h("div", { slot: "actions" }, h("dvn-button", { view: "flat", onClick: () => this.createdMeeting = undefined }, strings.stayOnPage), h("dvn-button", { tint: "primary", view: "flat", onClick: () => this.action.emit(generateActionEmitData({}, this.createdMeeting, this.view.successNavigationAction)) }, strings.goToMeetingPage)))));
  }
};

export { DvnAppViewTakvimAvailableTimePickerView as dvn_app_view_takvim_available_time_picker_view };
