@nylas/react 1.4.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/{add-circle-icon_2.entry-75a3df95.cjs → add-circle-icon_2.entry-8a1c55bc.cjs} +1 -1
  2. package/dist/{add-circle-icon_2.entry-55361a03.js → add-circle-icon_2.entry-b4bbcfee.js} +1 -1
  3. package/dist/{archive-icon.entry-3c4e4b28.js → archive-icon.entry-a2492cf3.js} +1 -1
  4. package/dist/{archive-icon.entry-8aa151fd.cjs → archive-icon.entry-e48d2356.cjs} +1 -1
  5. package/dist/{arrow-icon.entry-5bb183c1.js → arrow-icon.entry-9414299f.js} +1 -1
  6. package/dist/{arrow-icon.entry-2cef5ca1.cjs → arrow-icon.entry-b1ecb2aa.cjs} +1 -1
  7. package/dist/{bold-icon.entry-e0010c60.js → bold-icon.entry-b72aed9f.js} +1 -1
  8. package/dist/{bold-icon.entry-c919c71d.cjs → bold-icon.entry-c781e9c1.cjs} +1 -1
  9. package/dist/{button-component_2.entry-1dd1b8d6.js → button-component_2.entry-36e49459.js} +1 -1
  10. package/dist/{button-component_2.entry-078ee06a.cjs → button-component_2.entry-73f76545.cjs} +1 -1
  11. package/dist/{calendar-agenda-fill-icon_36.entry-9b694a33.cjs → calendar-agenda-fill-icon_36.entry-e9b92e0e.cjs} +2 -2
  12. package/dist/{calendar-agenda-fill-icon_36.entry-772a70d7.js → calendar-agenda-fill-icon_36.entry-efa7ad26.js} +4 -4
  13. package/dist/{calendar-cancel-icon.entry-b791b6b1.cjs → calendar-cancel-icon.entry-01c388eb.cjs} +1 -1
  14. package/dist/{calendar-cancel-icon.entry-7d1a7cea.js → calendar-cancel-icon.entry-0f739a8a.js} +1 -1
  15. package/dist/{calendar-check-icon_2.entry-2380a4e6.cjs → calendar-check-icon_2.entry-5febbadf.cjs} +1 -1
  16. package/dist/{calendar-check-icon_2.entry-2b5711fd.js → calendar-check-icon_2.entry-dfb0036d.js} +1 -1
  17. package/dist/{calendar-icon.entry-f88c8b09.cjs → calendar-icon.entry-9743e0b7.cjs} +1 -1
  18. package/dist/{calendar-icon.entry-9b23c994.js → calendar-icon.entry-f197396d.js} +1 -1
  19. package/dist/{checkbox-component.entry-af77c4fa.cjs → checkbox-component.entry-1aa5782f.cjs} +1 -1
  20. package/dist/{checkbox-component.entry-94fd68e7.js → checkbox-component.entry-72a6aa72.js} +1 -1
  21. package/dist/checkmark-icon_15.entry-35dd97b7.cjs +5 -0
  22. package/dist/{checkmark-icon_15.entry-3ddf90df.js → checkmark-icon_15.entry-5c09cff5.js} +4 -4
  23. package/dist/{chevron-icon_3.entry-af195326.js → chevron-icon_3.entry-4a72f211.js} +1 -1
  24. package/dist/{chevron-icon_3.entry-a492d340.cjs → chevron-icon_3.entry-e0608b7c.cjs} +1 -1
  25. package/dist/{clock-icon_4.entry-7dc4324b.js → clock-icon_4.entry-0afe79c2.js} +1 -1
  26. package/dist/{clock-icon_4.entry-530cd13b.cjs → clock-icon_4.entry-202ce025.cjs} +1 -1
  27. package/dist/constants-f51538ef-cd2a67c4.cjs +1 -0
  28. package/dist/{constants-3d8016e3-3c080f00.js → constants-f51538ef-e0a5f026.js} +27 -32
  29. package/dist/{customParseFormat-129be926-30b2af24.cjs → customParseFormat-d1de5ed0-65a0bba3.cjs} +1 -1
  30. package/dist/{customParseFormat-129be926-36eabae2.js → customParseFormat-d1de5ed0-c0ef002d.js} +1 -1
  31. package/dist/{delete-icon.entry-3328484a.js → delete-icon.entry-580bfcc9.js} +1 -1
  32. package/dist/{delete-icon.entry-9369bf78.cjs → delete-icon.entry-762ac892.cjs} +1 -1
  33. package/dist/{document-refresh-icon.entry-f45be1c4.cjs → document-refresh-icon.entry-4e0f0c61.cjs} +1 -1
  34. package/dist/{document-refresh-icon.entry-902ead30.js → document-refresh-icon.entry-e500b4e3.js} +1 -1
  35. package/dist/{feedbackSync-d943ffc7-d1e98ba0.js → feedbackSync-172f942c-42124493.js} +1 -1
  36. package/dist/{feedbackSync-d943ffc7-13f01c1f.cjs → feedbackSync-172f942c-62f72bd2.cjs} +1 -1
  37. package/dist/{folder-icon.entry-48cfa8d0.cjs → folder-icon.entry-2694e253.cjs} +1 -1
  38. package/dist/{folder-icon.entry-c4ffba45.js → folder-icon.entry-54c3cc66.js} +1 -1
  39. package/dist/{forward-icon.entry-dd036273.js → forward-icon.entry-5e540f05.js} +1 -1
  40. package/dist/{forward-icon.entry-146f3318.cjs → forward-icon.entry-f07102d8.cjs} +1 -1
  41. package/dist/{globe-icon_2.entry-049fbca2.cjs → globe-icon_2.entry-14a4c168.cjs} +1 -1
  42. package/dist/{globe-icon_2.entry-d6a95f6e.js → globe-icon_2.entry-aaceb196.js} +3 -3
  43. package/dist/{google-logo-icon_6.entry-e26385cc.js → google-logo-icon_6.entry-00d40db2.js} +211 -195
  44. package/dist/{google-logo-icon_6.entry-4d9e06be.cjs → google-logo-icon_6.entry-fa76ffe3.cjs} +2 -2
  45. package/dist/{google-meet-icon_5.entry-94112d7e.cjs → google-meet-icon_5.entry-6c20e149.cjs} +1 -1
  46. package/dist/{google-meet-icon_5.entry-c0129f58.js → google-meet-icon_5.entry-f1f05903.js} +1 -1
  47. package/dist/{inbox-icon.entry-94683ba9.cjs → inbox-icon.entry-9a4628f2.cjs} +1 -1
  48. package/dist/{inbox-icon.entry-74d7a10d.js → inbox-icon.entry-aa78ba8c.js} +1 -1
  49. package/dist/index-1e75512f.cjs +57 -0
  50. package/dist/{index-6e735f92.js → index-e8380973.js} +57 -48
  51. package/dist/{index.es-4615d47c-b7c254fe.cjs → index.es-fc8588de-034ead51.cjs} +1 -1
  52. package/dist/{index.es-4615d47c-9156501b.js → index.es-fc8588de-c943eef6.js} +1 -1
  53. package/dist/{info-icon_2.entry-ef5dbccc.js → info-icon_2.entry-b3b313ab.js} +1 -1
  54. package/dist/{info-icon_2.entry-8bcd39dc.cjs → info-icon_2.entry-bbcefb9a.cjs} +1 -1
  55. package/dist/{input-component.entry-922063d5.js → input-component.entry-401b9ba5.js} +1 -1
  56. package/dist/{input-component.entry-cc1fb2fa.cjs → input-component.entry-ec8e8e7c.cjs} +1 -1
  57. package/dist/{input-dropdown_2.entry-f3750e99.cjs → input-dropdown_2.entry-8cb11601.cjs} +1 -1
  58. package/dist/{input-dropdown_2.entry-4041c294.js → input-dropdown_2.entry-c37f392c.js} +2 -2
  59. package/dist/{italic-icon.entry-6706da64.js → italic-icon.entry-0e85d0d9.js} +1 -1
  60. package/dist/{italic-icon.entry-63b6943f.cjs → italic-icon.entry-6675558a.cjs} +1 -1
  61. package/dist/{multi-select-dropdown_2.entry-e10a9439.js → multi-select-dropdown_2.entry-3eecf18a.js} +1 -1
  62. package/dist/{multi-select-dropdown_2.entry-1096321d.cjs → multi-select-dropdown_2.entry-e37c501d.cjs} +1 -1
  63. package/dist/{nylas-booked-event-card_12.entry-7eceb6b6.js → nylas-booked-event-card_12.entry-e7464ae7.js} +3 -3
  64. package/dist/{nylas-booked-event-card_12.entry-38f37135.cjs → nylas-booked-event-card_12.entry-fddc9ab8.cjs} +1 -1
  65. package/dist/{nylas-event-calendar_3.entry-cc428f95.js → nylas-event-calendar_3.entry-9abd46c2.js} +4 -4
  66. package/dist/{nylas-event-calendar_3.entry-7dad0f2f.cjs → nylas-event-calendar_3.entry-e6669bbf.cjs} +1 -1
  67. package/dist/{nylas-form-card.entry-dd3f240a.js → nylas-form-card.entry-a3186807.js} +2 -2
  68. package/dist/{nylas-form-card.entry-984be5f9.cjs → nylas-form-card.entry-cbb00fba.cjs} +1 -1
  69. package/dist/{nylas-scheduler-editor.entry-8fb56081.cjs → nylas-scheduler-editor.entry-5c92901a.cjs} +2 -2
  70. package/dist/{nylas-scheduler-editor.entry-623da747.js → nylas-scheduler-editor.entry-7b188a38.js} +56 -47
  71. package/dist/{nylas-scheduling.entry-472ef577.cjs → nylas-scheduling.entry-970240f6.cjs} +1 -1
  72. package/dist/{nylas-scheduling.entry-6608aa36.js → nylas-scheduling.entry-e9929b03.js} +7 -7
  73. package/dist/{person-icon.entry-168ba481.cjs → person-icon.entry-8998fdb8.cjs} +1 -1
  74. package/dist/{person-icon.entry-9f0233cd.js → person-icon.entry-d2856f08.js} +1 -1
  75. package/dist/{play-icon.entry-4115845d.cjs → play-icon.entry-99eb969b.cjs} +1 -1
  76. package/dist/{play-icon.entry-5fbfabb5.js → play-icon.entry-f949a80f.js} +1 -1
  77. package/dist/{radio-button-group.entry-da3f23ac.js → radio-button-group.entry-bc3b12fd.js} +1 -1
  78. package/dist/{radio-button-group.entry-3ae5f246.cjs → radio-button-group.entry-d66edd04.cjs} +1 -1
  79. package/dist/react.cjs +1 -1
  80. package/dist/react.js +1 -1
  81. package/dist/{refresh-icon.entry-13742bb5.cjs → refresh-icon.entry-99d1982d.cjs} +1 -1
  82. package/dist/{refresh-icon.entry-e1db3ca5.js → refresh-icon.entry-d6df8b1c.js} +1 -1
  83. package/dist/{register-component-083eb961-763c87e9.js → register-component-62d792d4-448b6a43.js} +1 -1
  84. package/dist/{register-component-083eb961-c5c48a1b.cjs → register-component-62d792d4-c6e7d129.cjs} +1 -1
  85. package/dist/{reply-all-icon.entry-ded706c7.js → reply-all-icon.entry-7ebf01a0.js} +1 -1
  86. package/dist/{reply-all-icon.entry-9446c2d0.cjs → reply-all-icon.entry-d7c44139.cjs} +1 -1
  87. package/dist/{reply-icon.entry-0d362c63.cjs → reply-icon.entry-058c00e8.cjs} +1 -1
  88. package/dist/{reply-icon.entry-7c5c0fd9.js → reply-icon.entry-d1622d85.js} +1 -1
  89. package/dist/{sent-icon.entry-92434496.cjs → sent-icon.entry-6c604512.cjs} +1 -1
  90. package/dist/{sent-icon.entry-bc9d1b35.js → sent-icon.entry-fe12bc2f.js} +1 -1
  91. package/dist/{spam-icon.entry-e0313c63.cjs → spam-icon.entry-45e5292e.cjs} +1 -1
  92. package/dist/{spam-icon.entry-11370b68.js → spam-icon.entry-b97c7709.js} +1 -1
  93. package/dist/{star-icon.entry-87823b56.cjs → star-icon.entry-4db13fdb.cjs} +1 -1
  94. package/dist/{star-icon.entry-3a81207c.js → star-icon.entry-98b80645.js} +1 -1
  95. package/dist/{stop-icon.entry-472a11dc.js → stop-icon.entry-0290fd30.js} +1 -1
  96. package/dist/{stop-icon.entry-ddf9242a.cjs → stop-icon.entry-9d7b53fd.cjs} +1 -1
  97. package/dist/{textarea-component.entry-2c6c0c7e.cjs → textarea-component.entry-9b474ab5.cjs} +1 -1
  98. package/dist/{textarea-component.entry-f9797150.js → textarea-component.entry-a62c257b.js} +1 -1
  99. package/dist/{toggle-switch.entry-fbef6918.cjs → toggle-switch.entry-5dbfcd48.cjs} +1 -1
  100. package/dist/{toggle-switch.entry-a7cbc256.js → toggle-switch.entry-e423b793.js} +1 -1
  101. package/dist/{translate-icon.entry-0ab604fe.js → translate-icon.entry-60c55a2e.js} +1 -1
  102. package/dist/{translate-icon.entry-2fe4868f.cjs → translate-icon.entry-f82fa6fc.cjs} +1 -1
  103. package/dist/{trash-fill-icon.entry-1904e8d6.cjs → trash-fill-icon.entry-095caae3.cjs} +1 -1
  104. package/dist/{trash-fill-icon.entry-4bdfb061.js → trash-fill-icon.entry-825055fd.js} +1 -1
  105. package/dist/{underline-icon.entry-6a2ca451.cjs → underline-icon.entry-0807a43d.cjs} +1 -1
  106. package/dist/{underline-icon.entry-29366789.js → underline-icon.entry-40028bc6.js} +1 -1
  107. package/dist/{warning-icon.entry-1649ffe7.js → warning-icon.entry-24e37759.js} +1 -1
  108. package/dist/{warning-icon.entry-3f848ed6.cjs → warning-icon.entry-fce7c14f.cjs} +1 -1
  109. package/package.json +2 -2
  110. package/dist/checkmark-icon_15.entry-de65b967.cjs +0 -5
  111. package/dist/constants-3d8016e3-fd6c3848.cjs +0 -1
  112. package/dist/index-3b0366ac.cjs +0 -57
@@ -1,9 +1,9 @@
1
- var _e = Object.defineProperty;
2
- var be = (r, t, n) => t in r ? _e(r, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[t] = n;
3
- var P = (r, t, n) => (be(r, typeof t != "symbol" ? t + "" : t, n), n);
4
- import { d as dayjs, u as utc, t as timezone, p as process, c as commonjsGlobal, r as registerInstance, a as createEvent, b as debug, N as NylasIdentityRequestWrapper, i as instance, h, H as Host, g as getElement, e as createStore, B as Buffer, F as Fragment, f as dataResponse, j as getCalendarRange } from "./index-6e735f92.js";
5
- import { N as NylasBaseProvider, X as Xr } from "./index.es-4615d47c-9156501b.js";
6
- import { L as LANGUAGE_CODE, a as LANGUAGE_MAP, C as CONFIGURATION_EVENT_TYPE, E as EXPERIMENTAL_FEATURES } from "./constants-3d8016e3-3c080f00.js";
1
+ var le = Object.defineProperty;
2
+ var ce = (r, t, n) => t in r ? le(r, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[t] = n;
3
+ var P = (r, t, n) => (ce(r, typeof t != "symbol" ? t + "" : t, n), n);
4
+ import { d as dayjs, u as utc, t as timezone, p as process, c as commonjsGlobal, r as registerInstance, a as createEvent, b as debug, N as NylasIdentityRequestWrapper, i as instance, h, H as Host, g as getElement, e as createStore, B as Buffer, F as Fragment, f as dataResponse, j as getCalendarRange } from "./index-e8380973.js";
5
+ import { N as NylasBaseProvider, X as Xr } from "./index.es-fc8588de-c943eef6.js";
6
+ import { L as LANGUAGE_CODE, a as LANGUAGE_MAP, C as CONFIGURATION_EVENT_TYPE } from "./constants-f51538ef-e0a5f026.js";
7
7
  import "react";
8
8
  import "react/jsx-runtime";
9
9
  import "react-dom";
@@ -211,9 +211,9 @@ class NylasSchedulerConfigAPIConnector {
211
211
  })) : (this.nylasSchedulerConfigStore.state.selectedGroupEvent = a.data, await this.getGroupEvents(n), this.nylasSchedulerConfigStore.state.isLoading = !1, dataResponse(a.data));
212
212
  }
213
213
  async updateGroupEvent(t, n, s) {
214
- var g, m, y, w, b, x, R, A, k, U, N, O, I, T;
214
+ var g, m, y, w, _, x, R, A, k, U, N, O, I, T;
215
215
  this.nylasSchedulerConfigStore.state.isLoading = !0;
216
- const a = this.nylasSchedulerConfigStore.state.selectedGroupEvent, l = (g = a == null ? void 0 : a.event) == null ? void 0 : g.master_event_id, d = (m = a == null ? void 0 : a.event) == null ? void 0 : m.id, c = (w = (y = a == null ? void 0 : a.event) == null ? void 0 : y.when) == null ? void 0 : w.start_time, u = (x = (b = a == null ? void 0 : a.group_event_info) == null ? void 0 : b.rrule) == null ? void 0 : x[0], f = u ? u.split(";").filter((S) => !S.startsWith("UNTIL")).join(";") : "", p = c ? dayjs(c * 1e3).subtract(1, "minute").format("YYYYMMDDTHHmmss[Z]") : "";
216
+ const a = this.nylasSchedulerConfigStore.state.selectedGroupEvent, l = (g = a == null ? void 0 : a.event) == null ? void 0 : g.master_event_id, d = (m = a == null ? void 0 : a.event) == null ? void 0 : m.id, c = (w = (y = a == null ? void 0 : a.event) == null ? void 0 : y.when) == null ? void 0 : w.start_time, u = (x = (_ = a == null ? void 0 : a.group_event_info) == null ? void 0 : _.rrule) == null ? void 0 : x[0], f = u ? u.split(";").filter((S) => !S.startsWith("UNTIL")).join(";") : "", p = c ? dayjs(c * 1e3).subtract(1, "minute").format("YYYYMMDDTHHmmss[Z]") : "";
217
217
  if (n === "this")
218
218
  return this.updateGroupEventById({
219
219
  ...t,
@@ -236,31 +236,31 @@ class NylasSchedulerConfigAPIConnector {
236
236
  }, s), [v, S];
237
237
  } else if (n === "all") {
238
238
  const S = t == null ? void 0 : t.when, v = (I = a == null ? void 0 : a.event) == null ? void 0 : I.when, L = (T = this.nylasSchedulerConfigStore.state.masterGroupEvents) == null ? void 0 : T[l];
239
- let _ = L == null ? void 0 : L.when;
240
- return (S == null ? void 0 : S.start_time) !== (v == null ? void 0 : v.start_time) && (_ = {
241
- ..._,
242
- start_time: (S == null ? void 0 : S.start_time) || (_ == null ? void 0 : _.start_time)
243
- }), (S == null ? void 0 : S.end_time) !== (v == null ? void 0 : v.end_time) && (_ = {
244
- ..._,
245
- end_time: (S == null ? void 0 : S.end_time) || (_ == null ? void 0 : _.end_time)
246
- }), (S == null ? void 0 : S.start_timezone) !== (v == null ? void 0 : v.start_timezone) && (_ = {
247
- ..._,
248
- start_timezone: (S == null ? void 0 : S.start_timezone) || (_ == null ? void 0 : _.start_timezone)
249
- }), (S == null ? void 0 : S.end_timezone) !== (v == null ? void 0 : v.end_timezone) && (_ = {
250
- ..._,
251
- end_timezone: (S == null ? void 0 : S.end_timezone) || (_ == null ? void 0 : _.end_timezone)
239
+ let b = L == null ? void 0 : L.when;
240
+ return (S == null ? void 0 : S.start_time) !== (v == null ? void 0 : v.start_time) && (b = {
241
+ ...b,
242
+ start_time: (S == null ? void 0 : S.start_time) || (b == null ? void 0 : b.start_time)
243
+ }), (S == null ? void 0 : S.end_time) !== (v == null ? void 0 : v.end_time) && (b = {
244
+ ...b,
245
+ end_time: (S == null ? void 0 : S.end_time) || (b == null ? void 0 : b.end_time)
246
+ }), (S == null ? void 0 : S.start_timezone) !== (v == null ? void 0 : v.start_timezone) && (b = {
247
+ ...b,
248
+ start_timezone: (S == null ? void 0 : S.start_timezone) || (b == null ? void 0 : b.start_timezone)
249
+ }), (S == null ? void 0 : S.end_timezone) !== (v == null ? void 0 : v.end_timezone) && (b = {
250
+ ...b,
251
+ end_timezone: (S == null ? void 0 : S.end_timezone) || (b == null ? void 0 : b.end_timezone)
252
252
  }), this.updateGroupEventById({
253
253
  ...t,
254
- when: _,
254
+ when: b,
255
255
  id: l
256
256
  }, s);
257
257
  }
258
258
  throw this.nylasSchedulerConfigStore.state.isLoading = !1, new Error("Invalid option");
259
259
  }
260
260
  async deleteGroupEvent(t, n, s) {
261
- var m, y, w, b, x, R, A, k, U, N, O, I;
261
+ var m, y, w, _, x, R, A, k, U, N, O, I;
262
262
  this.nylasSchedulerConfigStore.state.isLoading = !0;
263
- const a = this.nylasSchedulerConfigStore.state.selectedGroupEvent, l = (m = a == null ? void 0 : a.event) == null ? void 0 : m.master_event_id, d = (y = a == null ? void 0 : a.event) == null ? void 0 : y.id, c = (b = (w = a == null ? void 0 : a.event) == null ? void 0 : w.when) == null ? void 0 : b.start_time, u = (R = (x = a == null ? void 0 : a.group_event_info) == null ? void 0 : x.rrule) == null ? void 0 : R[0], f = u ? u.split(";").filter((T) => !T.startsWith("UNTIL")).join(";") : "", p = c ? dayjs(c * 1e3).format("YYYYMMDDTHHmmss[Z]") : "", g = {
263
+ const a = this.nylasSchedulerConfigStore.state.selectedGroupEvent, l = (m = a == null ? void 0 : a.event) == null ? void 0 : m.master_event_id, d = (y = a == null ? void 0 : a.event) == null ? void 0 : y.id, c = (_ = (w = a == null ? void 0 : a.event) == null ? void 0 : w.when) == null ? void 0 : _.start_time, u = (R = (x = a == null ? void 0 : a.group_event_info) == null ? void 0 : x.rrule) == null ? void 0 : R[0], f = u ? u.split(";").filter((T) => !T.startsWith("UNTIL")).join(";") : "", p = c ? dayjs(c * 1e3).format("YYYYMMDDTHHmmss[Z]") : "", g = {
264
264
  location: (A = a == null ? void 0 : a.event) == null ? void 0 : A.location,
265
265
  conferencing: (k = a == null ? void 0 : a.event) == null ? void 0 : k.conferencing,
266
266
  title: (U = a == null ? void 0 : a.event) == null ? void 0 : U.title,
@@ -690,11 +690,11 @@ var sha256 = { exports: {} };
690
690
  r[16] = this.block, r[t >> 2] |= EXTRA[t & 3], this.block = r[16], t >= 56 && (this.hashed || this.hash(), r[0] = this.block, r[16] = r[1] = r[2] = r[3] = r[4] = r[5] = r[6] = r[7] = r[8] = r[9] = r[10] = r[11] = r[12] = r[13] = r[14] = r[15] = 0), r[14] = this.hBytes << 3 | this.bytes >>> 29, r[15] = this.bytes << 3, this.hash();
691
691
  }
692
692
  }, Sha256.prototype.hash = function() {
693
- var r = this.h0, t = this.h1, n = this.h2, s = this.h3, a = this.h4, l = this.h5, d = this.h6, c = this.h7, u = this.blocks, f, p, g, m, y, w, b, x, R, A, k;
693
+ var r = this.h0, t = this.h1, n = this.h2, s = this.h3, a = this.h4, l = this.h5, d = this.h6, c = this.h7, u = this.blocks, f, p, g, m, y, w, _, x, R, A, k;
694
694
  for (f = 16; f < 64; ++f)
695
695
  y = u[f - 15], p = (y >>> 7 | y << 25) ^ (y >>> 18 | y << 14) ^ y >>> 3, y = u[f - 2], g = (y >>> 17 | y << 15) ^ (y >>> 19 | y << 13) ^ y >>> 10, u[f] = u[f - 16] + p + u[f - 7] + g << 0;
696
696
  for (k = t & n, f = 0; f < 64; f += 4)
697
- this.first ? (this.is224 ? (x = 300032, y = u[0] - 1413257819, c = y - 150054599 << 0, s = y + 24177077 << 0) : (x = 704751109, y = u[0] - 210244248, c = y - 1521486534 << 0, s = y + 143694565 << 0), this.first = !1) : (p = (r >>> 2 | r << 30) ^ (r >>> 13 | r << 19) ^ (r >>> 22 | r << 10), g = (a >>> 6 | a << 26) ^ (a >>> 11 | a << 21) ^ (a >>> 25 | a << 7), x = r & t, m = x ^ r & n ^ k, b = a & l ^ ~a & d, y = c + g + b + K[f] + u[f], w = p + m, c = s + y << 0, s = y + w << 0), p = (s >>> 2 | s << 30) ^ (s >>> 13 | s << 19) ^ (s >>> 22 | s << 10), g = (c >>> 6 | c << 26) ^ (c >>> 11 | c << 21) ^ (c >>> 25 | c << 7), R = s & r, m = R ^ s & t ^ x, b = c & a ^ ~c & l, y = d + g + b + K[f + 1] + u[f + 1], w = p + m, d = n + y << 0, n = y + w << 0, p = (n >>> 2 | n << 30) ^ (n >>> 13 | n << 19) ^ (n >>> 22 | n << 10), g = (d >>> 6 | d << 26) ^ (d >>> 11 | d << 21) ^ (d >>> 25 | d << 7), A = n & s, m = A ^ n & r ^ R, b = d & c ^ ~d & a, y = l + g + b + K[f + 2] + u[f + 2], w = p + m, l = t + y << 0, t = y + w << 0, p = (t >>> 2 | t << 30) ^ (t >>> 13 | t << 19) ^ (t >>> 22 | t << 10), g = (l >>> 6 | l << 26) ^ (l >>> 11 | l << 21) ^ (l >>> 25 | l << 7), k = t & n, m = k ^ t & s ^ A, b = l & d ^ ~l & c, y = a + g + b + K[f + 3] + u[f + 3], w = p + m, a = r + y << 0, r = y + w << 0;
697
+ this.first ? (this.is224 ? (x = 300032, y = u[0] - 1413257819, c = y - 150054599 << 0, s = y + 24177077 << 0) : (x = 704751109, y = u[0] - 210244248, c = y - 1521486534 << 0, s = y + 143694565 << 0), this.first = !1) : (p = (r >>> 2 | r << 30) ^ (r >>> 13 | r << 19) ^ (r >>> 22 | r << 10), g = (a >>> 6 | a << 26) ^ (a >>> 11 | a << 21) ^ (a >>> 25 | a << 7), x = r & t, m = x ^ r & n ^ k, _ = a & l ^ ~a & d, y = c + g + _ + K[f] + u[f], w = p + m, c = s + y << 0, s = y + w << 0), p = (s >>> 2 | s << 30) ^ (s >>> 13 | s << 19) ^ (s >>> 22 | s << 10), g = (c >>> 6 | c << 26) ^ (c >>> 11 | c << 21) ^ (c >>> 25 | c << 7), R = s & r, m = R ^ s & t ^ x, _ = c & a ^ ~c & l, y = d + g + _ + K[f + 1] + u[f + 1], w = p + m, d = n + y << 0, n = y + w << 0, p = (n >>> 2 | n << 30) ^ (n >>> 13 | n << 19) ^ (n >>> 22 | n << 10), g = (d >>> 6 | d << 26) ^ (d >>> 11 | d << 21) ^ (d >>> 25 | d << 7), A = n & s, m = A ^ n & r ^ R, _ = d & c ^ ~d & a, y = l + g + _ + K[f + 2] + u[f + 2], w = p + m, l = t + y << 0, t = y + w << 0, p = (t >>> 2 | t << 30) ^ (t >>> 13 | t << 19) ^ (t >>> 22 | t << 10), g = (l >>> 6 | l << 26) ^ (l >>> 11 | l << 21) ^ (l >>> 25 | l << 7), k = t & n, m = k ^ t & s ^ A, _ = l & d ^ ~l & c, y = a + g + _ + K[f + 3] + u[f + 3], w = p + m, a = r + y << 0, r = y + w << 0;
698
698
  this.h0 = this.h0 + r << 0, this.h1 = this.h1 + t << 0, this.h2 = this.h2 + n << 0, this.h3 = this.h3 + s << 0, this.h4 = this.h4 + a << 0, this.h5 = this.h5 + l << 0, this.h6 = this.h6 + d << 0, this.h7 = this.h7 + c << 0;
699
699
  }, Sha256.prototype.hex = function() {
700
700
  this.finalize();
@@ -891,13 +891,13 @@ function fetchEventSource(r, t) {
891
891
  const y = Object.assign({}, s);
892
892
  y.accept || (y.accept = EventStreamContentType);
893
893
  let w;
894
- function b() {
894
+ function _() {
895
895
  w.abort(), document.hidden || N();
896
896
  }
897
- u || document.addEventListener("visibilitychange", b);
897
+ u || document.addEventListener("visibilitychange", _);
898
898
  let x = DefaultRetryInterval, R = 0;
899
899
  function A() {
900
- document.removeEventListener("visibilitychange", b), window.clearTimeout(R), w.abort();
900
+ document.removeEventListener("visibilitychange", _), window.clearTimeout(R), w.abort();
901
901
  }
902
902
  n == null || n.addEventListener("abort", () => {
903
903
  A(), g();
@@ -1528,8 +1528,8 @@ const LoginRequired = ({ authenticationUrl: r }) => h(
1528
1528
  h("small", { class: "disclaimer-text", part: "nse__login-required-disclaimer-text" }, "* You will be redirected to authenticate your account.")
1529
1529
  )
1530
1530
  );
1531
- function ExpressFlow({ currentUser: r, calendars: t, selectedEventType: n, experimentalFeatures: s }) {
1532
- const a = (t == null ? void 0 : t.find((d) => d.is_primary)) || (t == null ? void 0 : t[0]), l = (s == null ? void 0 : s[EXPERIMENTAL_FEATURES.group_events]) || !1;
1531
+ function ExpressFlow({ currentUser: r, calendars: t, selectedEventType: n }) {
1532
+ const s = (t == null ? void 0 : t.find((a) => a.is_primary)) || (t == null ? void 0 : t[0]);
1533
1533
  switch (n) {
1534
1534
  case CONFIGURATION_EVENT_TYPE.one_on_one:
1535
1535
  case CONFIGURATION_EVENT_TYPE.max_availability:
@@ -1548,8 +1548,7 @@ function ExpressFlow({ currentUser: r, calendars: t, selectedEventType: n, exper
1548
1548
  h("nylas-event-location", { userProvider: r.provider })
1549
1549
  )
1550
1550
  ),
1551
- h("nylas-booking-calendar-picker", { exportparts: "nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content", expressFlow: !0, calendars: t, currentUser: r, defaultBookingCalendar: a == null ? void 0 : a.id }),
1552
- !l && h("nylas-scheduling-method", { showSubTitle: !0, exportparts: "nsm, nsm__header, nsm__input-label, nsm__dropdown, nsm__dropdown-button, nsm__dropdown-content" }),
1551
+ h("nylas-booking-calendar-picker", { exportparts: "nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content", expressFlow: !0, calendars: t, currentUser: r, defaultBookingCalendar: s == null ? void 0 : s.id }),
1553
1552
  h("nylas-custom-event-slug", { name: "custom-event-slug", exportparts: "nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield" })
1554
1553
  );
1555
1554
  case CONFIGURATION_EVENT_TYPE.collective:
@@ -1567,8 +1566,7 @@ function ExpressFlow({ currentUser: r, calendars: t, selectedEventType: n, exper
1567
1566
  h("nylas-event-location", { userProvider: r.provider })
1568
1567
  )
1569
1568
  ),
1570
- h("nylas-booking-calendar-picker", { exportparts: "nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content", expressFlow: !0, calendars: t, currentUser: r, defaultBookingCalendar: a == null ? void 0 : a.id }),
1571
- !l && h("nylas-scheduling-method", { showSubTitle: !0, exportparts: "nsm, nsm__header, nsm__input-label, nsm__dropdown, nsm__dropdown-button, nsm__dropdown-content" }),
1569
+ h("nylas-booking-calendar-picker", { exportparts: "nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content", expressFlow: !0, calendars: t, currentUser: r, defaultBookingCalendar: s == null ? void 0 : s.id }),
1572
1570
  h("nylas-custom-event-slug", { name: "custom-event-slug", exportparts: "nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield" }),
1573
1571
  h("nylas-additional-participants", { name: "participants", eventParticipants: [{ name: (r == null ? void 0 : r.name) || (r == null ? void 0 : r.email), email: (r == null ? void 0 : r.email) || "", is_organizer: !0 }], exportparts: "nadtnlpart, nadtnlpart__title, nadtnlpart__subtitle, nadtnlpart__content, nadtnlpart__input_group, nadtnlpart__input_wrapper, nadtnlpart__input, nadtnlpart__remove-participant" })
1574
1572
  );
@@ -1589,19 +1587,25 @@ function ExpressFlow({ currentUser: r, calendars: t, selectedEventType: n, exper
1589
1587
  h("nylas-event-capacity", null)
1590
1588
  )
1591
1589
  ),
1592
- h("nylas-booking-calendar-picker", { exportparts: "nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content", expressFlow: !0, calendars: t, currentUser: r, defaultBookingCalendar: a == null ? void 0 : a.id }),
1590
+ h("nylas-booking-calendar-picker", { exportparts: "nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content", expressFlow: !0, calendars: t, currentUser: r, defaultBookingCalendar: s == null ? void 0 : s.id }),
1593
1591
  h("nylas-additional-participants", { name: "participants", eventParticipants: [{ name: (r == null ? void 0 : r.name) || (r == null ? void 0 : r.email), email: (r == null ? void 0 : r.email) || "", is_organizer: !0 }], exportparts: "nadtnlpart, nadtnlpart__title, nadtnlpart__subtitle, nadtnlpart__content, nadtnlpart__input_group, nadtnlpart__input_wrapper, nadtnlpart__input, nadtnlpart__remove-participant" }),
1594
1592
  h("nylas-page-name", { requirePageName: !0, pageName: "Group events page" }),
1595
1593
  h("nylas-custom-event-slug", { name: "custom-event-slug", exportparts: "nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield" })
1596
1594
  );
1597
1595
  }
1598
1596
  }
1599
- const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 0px 6px -2px rgba(0, 0, 0, 0.05), 0px 5px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff}@media screen and (max-width: 768px){:host{width:-moz-available;width:-webkit-fill-available;width:fill-available;min-width:325px}}div.scheduler-editor-content{height:610px}div.scheduler-editor-content.scheduler-editor-content--group_feature_enabled{height:900px}@media screen and (max-width: 768px){div.scheduler-editor-content.scheduler-editor-content--group_feature_enabled{height:auto}}@media screen and (max-width: 768px){div.scheduler-editor-content{height:auto}}div.scheduler-editor-content--group{height:900px}@media screen and (max-width: 768px){div.scheduler-editor-content--group{height:auto}}div.scheduler-editor-header{display:grid;grid-template-columns:1fr auto auto;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900);min-width:924px}@media screen and (max-width: 768px){div.scheduler-editor-header{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;margin:0;font-size:18px;line-height:24px;font-weight:600}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary);background-color:transparent}div.scheduler-editor-header button:disabled{cursor:not-allowed}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button){border:none;padding:4px;margin-right:8px}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button):hover{outline:none;color:var(--nylas-primary)}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-content){min-width:132px}@media screen and (max-width: 768px){div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-content){width:-webkit-fill-available;width:fill-available;width:-moz-available}}nylas-select-event-type{height:inherit;width:calc(924px + 2rem)}@media screen and (max-width: 768px){nylas-select-event-type{width:auto}}nylas-editor-tabs,nylas-editor-tabs-group{width:auto;height:inherit}nylas-editor-tabs .row,nylas-editor-tabs-group .row{display:flex;gap:1rem}nylas-editor-tabs .composable,nylas-editor-tabs-group .composable{height:inherit;overflow:auto}nylas-editor-tabs nylas-event-info div[slot=inputs],nylas-editor-tabs nylas-event-limits div[slot=inputs],nylas-editor-tabs-group nylas-event-info div[slot=inputs],nylas-editor-tabs-group nylas-event-limits div[slot=inputs]{display:flex;flex-direction:column;gap:1rem}.card{display:flex;flex-direction:column;padding:2rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;max-width:fit-content;align-self:center}.login-required{height:inherit;overflow-y:auto;display:flex;flex-direction:column;justify-content:center;padding:2rem 1rem;background-color:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.login-required{height:auto}}.login-required p{margin:0 0 1rem}.login-required .microsoft-button,.login-required .google-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;margin-bottom:1rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;justify-content:center;gap:0.5rem;align-items:center}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;border:0;background-color:var(--nylas-base-0);height:48px;margin-bottom:1rem;font-size:0.95rem;justify-content:center;gap:0.25rem;align-items:center}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button svg{transform:rotate(180deg)}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .disclaimer-text{font-size:0.75rem;color:var(--nylas-base-600);align-self:center}.list-configurations{padding:2rem;height:inherit;background:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.list-configurations{height:auto;padding:2rem 1rem}}.list-configurations nylas-list-configurations{height:inherit;display:flex;flex-direction:column}', NylasSchedulerEditorStyle0 = nylasSchedulerEditorCss, NylasSchedulerEditor = class {
1597
+ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 0px 6px -2px rgba(0, 0, 0, 0.05), 0px 5px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff}@media screen and (max-width: 768px){:host{width:-moz-available;width:-webkit-fill-available;width:fill-available;min-width:325px}}div.scheduler-editor-content{height:900px}@media screen and (max-width: 768px){div.scheduler-editor-content{height:auto}}div.scheduler-editor-content--group{height:900px}@media screen and (max-width: 768px){div.scheduler-editor-content--group{height:auto}}div.scheduler-editor-header{display:grid;grid-template-columns:1fr auto auto;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900);min-width:924px}@media screen and (max-width: 768px){div.scheduler-editor-header{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;margin:0;font-size:18px;line-height:24px;font-weight:600}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary);background-color:transparent}div.scheduler-editor-header button:disabled{cursor:not-allowed}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button){border:none;padding:4px;margin-right:8px}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button):hover{outline:none;color:var(--nylas-primary)}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-content){min-width:132px}@media screen and (max-width: 768px){div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-content){width:-webkit-fill-available;width:fill-available;width:-moz-available}}nylas-select-event-type{height:inherit;width:calc(924px + 2rem)}@media screen and (max-width: 768px){nylas-select-event-type{width:auto}}nylas-editor-tabs,nylas-editor-tabs-group{width:auto;height:inherit}nylas-editor-tabs .row,nylas-editor-tabs-group .row{display:flex;gap:1rem}nylas-editor-tabs .composable,nylas-editor-tabs-group .composable{height:inherit;overflow:auto}nylas-editor-tabs nylas-event-info div[slot=inputs],nylas-editor-tabs nylas-event-limits div[slot=inputs],nylas-editor-tabs-group nylas-event-info div[slot=inputs],nylas-editor-tabs-group nylas-event-limits div[slot=inputs]{display:flex;flex-direction:column;gap:1rem}.card{display:flex;flex-direction:column;padding:2rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;max-width:fit-content;align-self:center}.login-required{height:inherit;overflow-y:auto;display:flex;flex-direction:column;justify-content:center;padding:2rem 1rem;background-color:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.login-required{height:auto}}.login-required p{margin:0 0 1rem}.login-required .microsoft-button,.login-required .google-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;margin-bottom:1rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;justify-content:center;gap:0.5rem;align-items:center}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;border:0;background-color:var(--nylas-base-0);height:48px;margin-bottom:1rem;font-size:0.95rem;justify-content:center;gap:0.25rem;align-items:center}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button svg{transform:rotate(180deg)}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .disclaimer-text{font-size:0.75rem;color:var(--nylas-base-600);align-self:center}.list-configurations{padding:2rem;height:inherit;background:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.list-configurations{height:auto;padding:2rem 1rem}}.list-configurations nylas-list-configurations{height:inherit;display:flex;flex-direction:column}', NylasSchedulerEditorStyle0 = nylasSchedulerEditorCss, NylasSchedulerEditor = class {
1600
1598
  constructor(r) {
1601
1599
  registerInstance(this, r), this.init = createEvent(this, "init", 7), this.loggedIn = createEvent(this, "loggedIn", 7), this.loggedOut = createEvent(this, "loggedOut", 7), this.schedulerConfigCloseClicked = createEvent(this, "schedulerConfigCloseClicked", 7), this.handleSchedulerConfigCloseClicked = (t) => {
1602
1600
  const n = this.schedulerConfigCloseClicked.emit(this.host);
1603
1601
  "schedulerConfigCloseClicked" in this.eventOverrides && this.eventOverrides.schedulerConfigCloseClicked(n, this.nylasSchedulerConfigConnector), n.defaultPrevented || (localStorage.removeItem("grant"), localStorage.removeItem("user"), window.location.reload());
1604
- }, this.authenticationUrl = async (t) => this.nylasApiRequest ? await this.nylasApiRequest.authenticationUrl({ provider: t }) || "" : (console.error("[nylas-scheduler-editor] Nylas API Request is not initialized."), ""), this.configurationId = void 0, this.nylasApiRequest = void 0, this.nylasSessionsConfig = void 0, this.defaultAuthArgs = void 0, this.eventOverrides = {}, this.schedulerPreviewLink = "", this.defaultSchedulerConfigState = void 0, this.mode = "app", this.additionalParticipants = void 0, this.hideEditorTabs = [], this.conferenceProviders = void 0, this.requiresSlug = !1, this.enableUserFeedback = !0, this.defaultLanguage = void 0, this.localization = void 0, this.nylasBranding = !0, this.experimentalFeatures = void 0, this.automaticComponentRegistration = !0, this.selectedLanguage = this.defaultLanguage || LANGUAGE_CODE.en, this.langVersion = 0;
1602
+ }, this.authenticationUrl = async (t) => this.nylasApiRequest ? await this.nylasApiRequest.authenticationUrl({ provider: t }) || "" : (console.error("[nylas-scheduler-editor] Nylas API Request is not initialized."), ""), this.configurationId = void 0, this.nylasApiRequest = void 0, this.nylasSessionsConfig = void 0, this.defaultAuthArgs = void 0, this.eventOverrides = {}, this.schedulerPreviewLink = "", this.defaultSchedulerConfigState = void 0, this.mode = "app", this.additionalParticipants = void 0, this.hideEditorTabs = [], this.conferenceProviders = void 0, this.requiresSlug = !1, this.enableUserFeedback = !0, this.defaultLanguage = void 0, this.localization = void 0, this.nylasBranding = !0, this.experimentalFeatures = void 0, this.enableEventTypes = {
1603
+ one_on_one: !0,
1604
+ collective: !0,
1605
+ max_fairness: !0,
1606
+ max_availability: !0,
1607
+ group: !0
1608
+ }, this.automaticComponentRegistration = !0, this.selectedLanguage = this.defaultLanguage || LANGUAGE_CODE.en, this.langVersion = 0;
1605
1609
  }
1606
1610
  connectedCallback() {
1607
1611
  debug("[nylas-scheduler-editor] connectedCallback");
@@ -1627,7 +1631,8 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
1627
1631
  requiresSlug: this.requiresSlug,
1628
1632
  selectedLanguage: this.defaultLanguage || LANGUAGE_CODE.en,
1629
1633
  nylasBranding: this.nylasBranding,
1630
- experimentalFeatures: this.experimentalFeatures
1634
+ experimentalFeatures: this.experimentalFeatures,
1635
+ enableEventTypes: this.enableEventTypes
1631
1636
  })
1632
1637
  }, !this.nylasApiRequest && this.nylasSessionsConfig) {
1633
1638
  const g = new NylasSessions(this.nylasSessionsConfig);
@@ -1635,8 +1640,8 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
1635
1640
  var y, w;
1636
1641
  const m = await ((w = (y = this.nylasSchedulerConfigConnector) == null ? void 0 : y.schedulerConfig) == null ? void 0 : w.currentUser());
1637
1642
  if (m) {
1638
- const b = this.loggedIn.emit(this.host);
1639
- "loggedIn" in this.eventOverrides && await this.eventOverrides.loggedIn(b, this.nylasSchedulerConfigConnector), b.defaultPrevented || await this.loggedInHandler(m);
1643
+ const _ = this.loggedIn.emit(this.host);
1644
+ "loggedIn" in this.eventOverrides && await this.eventOverrides.loggedIn(_, this.nylasSchedulerConfigConnector), _.defaultPrevented || await this.loggedInHandler(m);
1640
1645
  }
1641
1646
  }), g.onLoginFail(async () => {
1642
1647
  var y, w;
@@ -1693,6 +1698,10 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
1693
1698
  var t, n;
1694
1699
  (n = (t = this.stores) == null ? void 0 : t.schedulerConfig) == null || n.set("experimentalFeatures", r);
1695
1700
  }
1701
+ updateEnableEventTypes(r) {
1702
+ var t, n;
1703
+ (n = (t = this.stores) == null ? void 0 : t.schedulerConfig) == null || n.set("enableEventTypes", r);
1704
+ }
1696
1705
  async store() {
1697
1706
  var r;
1698
1707
  return (r = this.stores) == null ? void 0 : r.schedulerConfig;
@@ -1721,18 +1730,17 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
1721
1730
  }
1722
1731
  }
1723
1732
  render() {
1724
- var a, l, d, c, u, f, p, g, m, y, w, b, x, R, A, k, U, N, O, I, T, S, v, L, _, X, $, j, z, Y, M, V, J, W, Z, Q, ee, te, ne, se, re, oe, ie, ae, le, ce, de, he, ue, fe, ge, pe, ye, me, we, Se;
1733
+ var a, l, d, c, u, f, p, g, m, y, w, _, x, R, A, k, U, N, O, I, T, S, v, L, b, $, X, j, z, Y, M, V, J, W, Z, Q, ee, te, ne, se, re, oe, ie, ae;
1725
1734
  const r = this.host.querySelector('[slot="custom-page-style-inputs"]'), t = (d = (l = (a = this.stores) == null ? void 0 : a.schedulerConfig) == null ? void 0 : l.state.selectedConfiguration) == null ? void 0 : d.id, n = Object.keys(LANGUAGE_MAP).map((q) => ({
1726
1735
  label: LANGUAGE_MAP[q],
1727
1736
  value: q
1728
1737
  })), s = ((u = (c = this.stores) == null ? void 0 : c.schedulerConfig) == null ? void 0 : u.state.selectedEventType) === CONFIGURATION_EVENT_TYPE.group || ((g = (p = (f = this.stores) == null ? void 0 : f.schedulerConfig) == null ? void 0 : p.state.selectedConfiguration) == null ? void 0 : g.type) === CONFIGURATION_EVENT_TYPE.group;
1729
- return h(Host, { key: "c859b600874208d4ae1349f5838a834a69cbffa3" }, h("div", { key: "fb40121186bc57dbf4bba2560d77945b9e259f5b", class: "scheduler-editor-header", part: "nse__header" }, h("h1", { key: "91edbc1ae7967f6bf5c5a239393a6a5fa0f02f94", class: "scheduler-editor-title", part: "nse__title" }, h("calendar-icon", { key: "1e6798aacd0e004e6fc6ee486bbc681afbab7487", width: "18", height: "18" }), instance.t("schedulerEditorTitle")), h("div", { key: "b488780445f86b83035b474b52cb210f3805e229", class: {
1738
+ return h(Host, { key: "33481780f28849b0db13759a7c2868446db68e52" }, h("div", { key: "c1d8968a3833afc945b8f12cae92ae903fac55df", class: "scheduler-editor-header", part: "nse__header" }, h("h1", { key: "9225e1fe985975a052579ad19b2a39cf58e10636", class: "scheduler-editor-title", part: "nse__title" }, h("calendar-icon", { key: "6643a8d8ec40bd49ad6874558a46ff7b4881e999", width: "18", height: "18" }), instance.t("schedulerEditorTitle")), h("div", { key: "5f39a141b7621cd12a4286f50a4f7ff88ee22960", class: {
1730
1739
  language: !0
1731
- }, part: "nse__language" }, h("select-dropdown", { key: "baeaaaa703182988a6c99f58c9ca55a008ffa490", name: "language", searchPlaceholder: instance.t("search"), options: n, withChevron: !1, defaultSelectedOption: n.find((q) => q.value == this.selectedLanguage), exportparts: "sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label" }, h("span", { key: "31bea579d0d640218d3b8b4ac9240e1c2f467dbb", slot: "select-icon" }, h("translate-icon", { key: "c250969318fa8b8626019ef05d88beb187155cad", width: "20", height: "20" })))), h("button", { key: "aef03775ee2aaa4a8d6d15e9a1c833c5bcdf19c5", class: "scheduler-editor-close", title: "logout", onClick: (q) => this.handleSchedulerConfigCloseClicked(q), part: "nse__close-button" }, h("close-icon", { key: "43e2a903bc332d6c238c0250968abb62d7e14e51", width: "18", height: "18" }))), h("div", { key: "cfc1ce795dd551fe60ace249e9d5a8ab428b239e", class: {
1740
+ }, part: "nse__language" }, h("select-dropdown", { key: "f39d2f85796930affa228b770d20ff2322bcf664", name: "language", searchPlaceholder: instance.t("search"), options: n, withChevron: !1, defaultSelectedOption: n.find((q) => q.value == this.selectedLanguage), exportparts: "sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label" }, h("span", { key: "1d6480fdbcc79b7752bda9693e1afa4280a9fc88", slot: "select-icon" }, h("translate-icon", { key: "13819cc3e68b82b92d8a0b905155628cb357b6f2", width: "20", height: "20" })))), h("button", { key: "e59c5d9ee944a731eb4aaf9314315f4eaab8aeed", class: "scheduler-editor-close", title: "logout", onClick: (q) => this.handleSchedulerConfigCloseClicked(q), part: "nse__close-button" }, h("close-icon", { key: "e02c1e6fee18ba347eb5155eb638b5a45dc4ff98", width: "18", height: "18" }))), h("div", { key: "f3694ba504ab3814d18647454c6c817e35997922", class: {
1732
1741
  "scheduler-editor-content": !0,
1733
- "scheduler-editor-content--group_feature_enabled": !!((w = (y = (m = this.stores) == null ? void 0 : m.schedulerConfig) == null ? void 0 : y.state.experimentalFeatures) != null && w[EXPERIMENTAL_FEATURES.group_events]),
1734
1742
  "scheduler-editor-content--group": s
1735
- }, part: "nse__content" }, ((x = (b = this.stores) == null ? void 0 : b.schedulerConfig) == null ? void 0 : x.state.currentUser) && this.stores.schedulerConfig.state.action === null && h("div", { class: "list-configurations", part: "nse__list-configurations" }, h("nylas-list-configurations", { exportparts: "nlc__create-new-cta, actions__dropdown, actions__dropdown-button, actions__dropdown-content, actions-Copy, actions-Preview, actions-Delete" })), ((A = (R = this.stores) == null ? void 0 : R.schedulerConfig) == null ? void 0 : A.state.currentUser) && this.stores.schedulerConfig.state.action === "create-select" && ((N = (U = (k = this.stores) == null ? void 0 : k.schedulerConfig) == null ? void 0 : U.state.experimentalFeatures) == null ? void 0 : N[EXPERIMENTAL_FEATURES.group_events]) && h("nylas-select-event-type", null), ((I = (O = this.stores) == null ? void 0 : O.schedulerConfig) == null ? void 0 : I.state.currentUser) && this.stores.schedulerConfig.state.action === "create" && s && h("nylas-editor-tabs-group", { mode: "composable" }, h(ExpressFlow, { experimentalFeatures: (v = (S = (T = this.stores) == null ? void 0 : T.schedulerConfig) == null ? void 0 : S.state) == null ? void 0 : v.experimentalFeatures, selectedEventType: ((X = (_ = (L = this.stores) == null ? void 0 : L.schedulerConfig) == null ? void 0 : _.state) == null ? void 0 : X.selectedEventType) || CONFIGURATION_EVENT_TYPE.one_on_one, currentUser: (j = ($ = this.stores) == null ? void 0 : $.schedulerConfig) == null ? void 0 : j.state.currentUser, calendars: (M = (Y = (z = this.stores) == null ? void 0 : z.schedulerConfig) == null ? void 0 : Y.state) == null ? void 0 : M.calendars, selectedConfiguration: (W = (J = (V = this.stores) == null ? void 0 : V.schedulerConfig) == null ? void 0 : J.state) == null ? void 0 : W.selectedConfiguration })), ((Q = (Z = this.stores) == null ? void 0 : Z.schedulerConfig) == null ? void 0 : Q.state.currentUser) && this.stores.schedulerConfig.state.action === "create" && !s && h("nylas-editor-tabs", { mode: "composable" }, h(ExpressFlow, { experimentalFeatures: (ne = (te = (ee = this.stores) == null ? void 0 : ee.schedulerConfig) == null ? void 0 : te.state) == null ? void 0 : ne.experimentalFeatures, selectedEventType: ((oe = (re = (se = this.stores) == null ? void 0 : se.schedulerConfig) == null ? void 0 : re.state) == null ? void 0 : oe.selectedEventType) || CONFIGURATION_EVENT_TYPE.one_on_one, currentUser: (ae = (ie = this.stores) == null ? void 0 : ie.schedulerConfig) == null ? void 0 : ae.state.currentUser, calendars: (de = (ce = (le = this.stores) == null ? void 0 : le.schedulerConfig) == null ? void 0 : ce.state) == null ? void 0 : de.calendars, selectedConfiguration: (fe = (ue = (he = this.stores) == null ? void 0 : he.schedulerConfig) == null ? void 0 : ue.state) == null ? void 0 : fe.selectedConfiguration })), ((pe = (ge = this.stores) == null ? void 0 : ge.schedulerConfig) == null ? void 0 : pe.state.currentUser) && this.stores.schedulerConfig.state.action === "edit" && s && h("nylas-editor-tabs-group", { key: t, mode: this.mode }, this.mode === "composable" && h("slot", null), this.mode === "app" && r && h("div", { style: { display: "none" }, slot: "custom-page-style-inputs", key: t }, h("slot", { name: "custom-page-style-inputs" }))), ((me = (ye = this.stores) == null ? void 0 : ye.schedulerConfig) == null ? void 0 : me.state.currentUser) && this.stores.schedulerConfig.state.action === "edit" && !s && h("nylas-editor-tabs", { key: t, mode: this.mode }, this.mode === "composable" && h("slot", null), this.mode === "app" && r && h("div", { style: { display: "none" }, slot: "custom-page-style-inputs", key: t }, h("slot", { name: "custom-page-style-inputs" }))), !((Se = (we = this.stores) == null ? void 0 : we.schedulerConfig) != null && Se.state.currentUser) && h("slot", { name: "login-required" }, h(LoginRequired, { authenticationUrl: this.authenticationUrl }))));
1743
+ }, part: "nse__content" }, ((y = (m = this.stores) == null ? void 0 : m.schedulerConfig) == null ? void 0 : y.state.currentUser) && this.stores.schedulerConfig.state.action === null && h("div", { class: "list-configurations", part: "nse__list-configurations" }, h("nylas-list-configurations", { exportparts: "nlc__create-new-cta, actions__dropdown, actions__dropdown-button, actions__dropdown-content, actions-Copy, actions-Preview, actions-Delete" })), ((_ = (w = this.stores) == null ? void 0 : w.schedulerConfig) == null ? void 0 : _.state.currentUser) && this.stores.schedulerConfig.state.action === "create-select" && h("nylas-select-event-type", null), ((R = (x = this.stores) == null ? void 0 : x.schedulerConfig) == null ? void 0 : R.state.currentUser) && this.stores.schedulerConfig.state.action === "create" && s && h("nylas-editor-tabs-group", { mode: "composable" }, h(ExpressFlow, { selectedEventType: ((U = (k = (A = this.stores) == null ? void 0 : A.schedulerConfig) == null ? void 0 : k.state) == null ? void 0 : U.selectedEventType) || CONFIGURATION_EVENT_TYPE.one_on_one, currentUser: (O = (N = this.stores) == null ? void 0 : N.schedulerConfig) == null ? void 0 : O.state.currentUser, calendars: (S = (T = (I = this.stores) == null ? void 0 : I.schedulerConfig) == null ? void 0 : T.state) == null ? void 0 : S.calendars, selectedConfiguration: (b = (L = (v = this.stores) == null ? void 0 : v.schedulerConfig) == null ? void 0 : L.state) == null ? void 0 : b.selectedConfiguration })), ((X = ($ = this.stores) == null ? void 0 : $.schedulerConfig) == null ? void 0 : X.state.currentUser) && this.stores.schedulerConfig.state.action === "create" && !s && h("nylas-editor-tabs", { mode: "composable" }, h(ExpressFlow, { selectedEventType: ((Y = (z = (j = this.stores) == null ? void 0 : j.schedulerConfig) == null ? void 0 : z.state) == null ? void 0 : Y.selectedEventType) || CONFIGURATION_EVENT_TYPE.one_on_one, currentUser: (V = (M = this.stores) == null ? void 0 : M.schedulerConfig) == null ? void 0 : V.state.currentUser, calendars: (Z = (W = (J = this.stores) == null ? void 0 : J.schedulerConfig) == null ? void 0 : W.state) == null ? void 0 : Z.calendars, selectedConfiguration: (te = (ee = (Q = this.stores) == null ? void 0 : Q.schedulerConfig) == null ? void 0 : ee.state) == null ? void 0 : te.selectedConfiguration })), ((se = (ne = this.stores) == null ? void 0 : ne.schedulerConfig) == null ? void 0 : se.state.currentUser) && this.stores.schedulerConfig.state.action === "edit" && s && h("nylas-editor-tabs-group", { key: t, mode: this.mode }, this.mode === "composable" && h("slot", null), this.mode === "app" && r && h("div", { style: { display: "none" }, slot: "custom-page-style-inputs", key: t }, h("slot", { name: "custom-page-style-inputs" }))), ((oe = (re = this.stores) == null ? void 0 : re.schedulerConfig) == null ? void 0 : oe.state.currentUser) && this.stores.schedulerConfig.state.action === "edit" && !s && h("nylas-editor-tabs", { key: t, mode: this.mode }, this.mode === "composable" && h("slot", null), this.mode === "app" && r && h("div", { style: { display: "none" }, slot: "custom-page-style-inputs", key: t }, h("slot", { name: "custom-page-style-inputs" }))), !((ae = (ie = this.stores) == null ? void 0 : ie.schedulerConfig) != null && ae.state.currentUser) && h("slot", { name: "login-required" }, h(LoginRequired, { authenticationUrl: this.authenticationUrl }))));
1736
1744
  }
1737
1745
  get host() {
1738
1746
  return getElement(this);
@@ -1742,7 +1750,8 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
1742
1750
  configurationId: ["configurationIdChanged"],
1743
1751
  localization: ["updateLocalization"],
1744
1752
  nylasBranding: ["updateNylasBranding"],
1745
- experimentalFeatures: ["updateExperimentalFeatures"]
1753
+ experimentalFeatures: ["updateExperimentalFeatures"],
1754
+ enableEventTypes: ["updateEnableEventTypes"]
1746
1755
  };
1747
1756
  }
1748
1757
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-3b0366ac.cjs"),R=require("./index.es-4615d47c-b7c254fe.cjs"),X=require("./constants-3d8016e3-fd6c3848.cjs"),M=require("./feedbackSync-d943ffc7-13f01c1f.cjs");require("react");require("react/jsx-runtime");require("react-dom");var H;(function(n){n.Error="error",n.Warning="warning",n.Info="info",n.Success="success"})(H||(H={}));var L;(function(n){n.Component="component",n.Api="api",n.Auth="auth"})(L||(L={}));var q;(function(n){n.endtime_not_in_future="endtime_not_in_future",n.no_booking_info="no_booking_info",n.no_timeslot_selected="no_timeslot_selected",n.no_timezone_selected="no_timezone_selected",n.no_booking_id="no_booking_id",n.no_salt="no_salt",n.invalid_start_time="invalid_start_time",n.invalid_end_time="invalid_end_time",n.invalid_timezone="invalid_timezone",n.no_config_id="no_config_id"})(q||(q={}));class Z{constructor(){this.component=e=>{const t=L.Component,o=`${e} Error`;return{endtime_not_in_future:(s='"endtime" can not be in the future')=>({title:o,message:s,category:t}),no_booking_info:(s="No booking info provided")=>({title:o,message:s,category:t}),no_timeslot_selected:(s="No timeslot selected")=>({title:o,message:s,category:t}),no_timezone_selected:(s="No timezone selected")=>({title:o,message:s,category:t}),no_booking_id:(s="No booking id provided")=>({title:o,message:s,category:t}),no_salt:(s="No salt provided")=>({title:o,message:s,category:t}),invalid_start_time:(s="Invalid start time")=>({title:o,message:s,category:t}),invalid_end_time:(s="Invalid end time")=>({title:o,message:s,category:t}),invalid_timezone:(s="Invalid timezone")=>({title:o,message:s,category:t}),no_config_id:(s="No configuration id provided")=>({title:o,message:s,category:t})}},this.api=e=>{const t=L.Api,o=`${e} Error`;return{invalid_session:s=>({title:o,message:s,category:t}),general_error:s=>({title:o,message:s,category:t}),internal_error:s=>({title:o,message:s,category:t}),invalid_request_error:s=>({title:o,message:s,category:t}),timeslot_not_available:s=>({title:o,message:s,category:t}),provider_error:s=>({title:o,message:s,category:t}),not_found_error:s=>({title:o,message:s,category:t})}}}}class K{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:o,configId:s,slug:a,clientId:r}){this.errors=new Z,this.schedulerStore=t,this.schedulerAPIURL=e,this.sessionId=o,this.configId=s,this.slug=a,this.clientId=r}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,o,s={}){try{const a=new URL(this.schedulerAPIURL),r="1.4.5";return a.pathname=e,await(await fetch(decodeURIComponent(a.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,"X-Source":"nylas-scheduling","X-Nylas-Web-Elements-Version":r,...s},body:o})).json()}catch(a){return{error:{message:a.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){var o,s,a,r;let t=(e==null?void 0:e.message)||(e==null?void 0:e.title)||"Something went wrong";return(e==null?void 0:e.type)==="provider_error"&&(t=((s=(o=e==null?void 0:e.provider_error)==null?void 0:o.error)==null?void 0:s.message)||((r=(a=e==null?void 0:e.provider_error)==null?void 0:a.error)==null?void 0:r.title)||"Something went wrong"),t}setConfigId(e){this.configId=e}selectDate(e){this.schedulerStore.set("selectedDate",e),this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}selectLanguage(e){this.schedulerStore.set("selectedLanguage",e),i.instance.changeLanguage(e)}async toggleAdditionalData(e){e||await this.refetchAvailability(),this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3,o=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t,s=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;return await this.getAvailability(o,s)}async resetStoreStateAndFetchAvailability(){const e=new Date,t=await this.refetchAvailability(),o=this.schedulerStore.get("availability").find(a=>new Date(a.start_time)>new Date);let s=e;return o&&(s=o.start_time),this.schedulerStore.set("selectedDate",s),this.schedulerStore.set("eventInfo",null),this.schedulerStore.set("showBookingForm",!1),this.schedulerStore.set("selectedTimeslot",null),t}async setReschedule(e){this.schedulerStore.set("isLoading",!0);const t=this.schedulerStore.state.eventInfo;return t&&this.schedulerStore.set("reschedulingEventInfo",t),this.schedulerStore.set("rescheduleBookingId",e),await this.getUISettings(),await this.resetStoreStateAndFetchAvailability().finally(()=>{this.schedulerStore.set("isLoading",!1)})}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async setReject(e){this.schedulerStore.set("rejectBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("cancelBookingId",""),this.schedulerStore.set("rejectBookingId",""),this.schedulerStore.set("cancelledEventInfo",null),e}async goBack(){this.schedulerStore.set("cancelBookingId","")}async resetConfirm(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("organizerConfirmationBookingId",""),this.schedulerStore.set("confirmedEventInfo",void 0),e}async bookTimeslot(e){var T,I,D;this.schedulerStore.set("isLoading",!0);const{selectedTimeslot:t,selectedTimezone:o,bookingInfo:s,selectedLanguage:a}=this.schedulerStore.state;if(!e&&!s)return{error:this.errors.component(i.instance.t("createBookingErrorTitle")).no_booking_info()};const r=(e==null?void 0:e.timeslot)||t;if(!r)return{error:this.errors.component(i.instance.t("createBookingErrorTitle")).no_timeslot_selected()};const l=e&&(e!=null&&e.timezone)?e==null?void 0:e.timezone:o,c=a||"en-US";if(!l)return{error:this.errors.component(i.instance.t("createBookingErrorTitle")).no_timezone_selected()};const u=[...this.schedulerStore.get("availabilityOrderEmails")];let d="";const g=(r==null?void 0:r.emails)||[],h={};Object.entries((s==null?void 0:s.additionalFields)||{}).forEach(([_,x])=>{h[_]=x.value});const m=e?e==null?void 0:e.primaryParticipant:s==null?void 0:s.primaryParticipant,p=e?(e==null?void 0:e.guests)||[]:(s==null?void 0:s.guests)||[],w=e?e==null?void 0:e.additionalFields:h,f=this.getHeaders(),k=`/v3/scheduling/bookings${!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:""}`;if(u.length===0){const _=await this.makeAPIRequest(decodeURIComponent(k),"POST",JSON.stringify({additional_fields:w,additional_guests:p,guest:{...m},start_time:r.start_time.getTime()/1e3,end_time:r.end_time.getTime()/1e3,timezone:l,event_id:(r==null?void 0:r.event_id)||void 0,master_id:(r==null?void 0:r.master_id)||void 0,calendar_id:(r==null?void 0:r.calendar_id)||void 0,email_language:this.getTwoLetterLanguageCode(c)}),f);return this.schedulerStore.set("isLoading",!1),"data"in _?(this.schedulerStore.set("eventInfo",_.data),_):{error:_.error}}for(;u.length>0;){if(d=u.shift(),!g.includes(d))continue;const _=await this.makeAPIRequest(decodeURIComponent(k),"POST",JSON.stringify({participants:d?[{email:d}]:void 0,additional_fields:w,additional_guests:p,guest:{...m},start_time:r.start_time.getTime()/1e3,end_time:r.end_time.getTime()/1e3,timezone:l,email_language:this.getTwoLetterLanguageCode(c)}),f);if("data"in _)return this.schedulerStore.set("isLoading",!1),this.schedulerStore.set("eventInfo",_==null?void 0:_.data),_;if((I=(T=_.error)==null?void 0:T.message)!=null&&I.startsWith("The selected timeslot is unavailable"))continue;{this.schedulerStore.set("isLoading",!1);const x=(D=_.error)==null?void 0:D.type;let B=_.error;if(x&&x in this.errors.api(i.instance.t("createBookingErrorTitle"))){const z=this.getErrorMessage(B);B=this.errors.api(i.instance.t("createBookingErrorTitle"))[x](z)}return{error:B}}}return this.schedulerStore.set("isLoading",!1),{error:this.errors.api(i.instance.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")}}async getUISettings(){var r;this.schedulerStore.set("isLoading",!0);const e=this.schedulerStore.get("rescheduleBookingId"),t=this.getHeaders();let o=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";e&&o?o+=`&booking_id=${e}`:e&&(o+=`?booking_id=${e}`);const s=`/v3/scheduling/ui-settings${o}`,a=await this.makeAPIRequest(s,"GET",void 0,t);if("error"in a){this.schedulerStore.set("isLoading",!1);const l=(r=a.error)==null?void 0:r.type;let c=a.error;return l&&l in this.errors.api(i.instance.t("getUISettingErrorTitle"))&&(c=this.errors.api(i.instance.t("getUISettingErrorTitle"))[l]((c==null?void 0:c.message)||(c==null?void 0:c.title)||"Something went wrong")),{error:c}}return"data"in a&&this.schedulerStore.set("configSettings",a.data),this.schedulerStore.set("isLoading",!1),a}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){var a;const t=(a=this.schedulerStore.get("configSettings"))==null?void 0:a.scheduler,o=t==null?void 0:t.min_booking_notice;if(!o)return e;const s=new Date().getTime();return e<(s+o*60*1e3)/1e3?Math.floor((s+o*60*1e3)/1e3):e}getEndTimeForAvailableDaysInFuture(e){var r,l;const t=new Date,o=(l=(r=this.schedulerStore.get("configSettings"))==null?void 0:r.scheduler)==null?void 0:l.available_days_in_future,s=Math.floor(i.addDaysToCurrentDate(t,o).getTime()/1e3);return Math.min(s,e)}async getAvailability(e=0,t=0){var h,m,p,w;this.schedulerStore.set("isLoading",!0);const o=new URLSearchParams,s=new Date,a=s.getTime();if(t&&t<a/1e3)return this.schedulerStore.set("isLoading",!1),{error:this.errors.component(i.instance.t("getAvailabilityErrorTitle")).endtime_not_in_future()};if(!e){const f=new Date(s.getFullYear(),s.getMonth(),1);e=Math.floor(f.getTime()/1e3)}if(!t){const f=new Date(s.getFullYear(),s.getMonth()+1,0);t=Math.floor(f.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const r=this.getStartTimeWithMinBookingNotice(e);e=r,t=r>t?r+1:t,o.append("start_time",encodeURIComponent(e.toString())),o.append("end_time",encodeURIComponent(t.toString())),this.configId&&!this.sessionId?o.append("configuration_id",encodeURIComponent(this.configId)):this.slug&&this.clientId&&!this.sessionId&&(o.append("slug",encodeURIComponent(this.slug)),o.append("client_id",encodeURIComponent(this.clientId)));const l=this.schedulerStore.get("rescheduleBookingId");l&&o.append("booking_id",encodeURIComponent(l));const c=o.toString(),u=`/v3/scheduling/availability${c?`?${c}`:""}`,d=this.getHeaders(),g=await this.makeAPIRequest(decodeURIComponent(u),"GET",void 0,d);if("error"in g){this.schedulerStore.set("availability",[]),this.schedulerStore.set("isLoading",!1);const f=(h=g.error)==null?void 0:h.type;let v=g.error;if(f&&f in this.errors.api(i.instance.t("getAvailabilityErrorTitle"))){const k=this.getErrorMessage(v);v=this.errors.api(i.instance.t("getAvailabilityErrorTitle"))[f](k)}return{error:v}}if("data"in g){const k=(((p=(m=g.data)==null?void 0:m.time_slots)==null?void 0:p.map(I=>({...I,start_time:new Date(I.start_time*1e3),end_time:new Date(I.end_time*1e3)})))||[]).filter(I=>I.start_time.getTime()>a).sort((I,D)=>I.start_time.getTime()-D.start_time.getTime());this.schedulerStore.set("availability",k);const T=((w=g.data)==null?void 0:w.order)||[];this.schedulerStore.set("availabilityOrderEmails",T)}return this.schedulerStore.set("isLoading",!1),g}async cancelBooking(e,t){var l;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(i.instance.t("cancelBookingErrorTitle")).no_booking_id()};const o=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",s=`/v3/scheduling/bookings/${e}${o}`,a=this.getHeaders(),r=await this.makeAPIRequest(decodeURIComponent(s),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),a);if("error"in r){this.schedulerStore.set("isLoading",!1);const c=(l=r.error)==null?void 0:l.type;let u=r.error;if(c&&c in this.errors.api(i.instance.t("cancelBookingErrorTitle"))){const d=this.getErrorMessage(u);u=this.errors.api(i.instance.t("cancelBookingErrorTitle"))[c](d)}return{error:u}}return this.schedulerStore.set("cancelledEventInfo",{booking_id:e}),this.schedulerStore.set("rescheduleBookingId",""),this.schedulerStore.set("isLoading",!1),r}async rescheduleBooking(e,t){var F;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(i.instance.t("rescheduleBookingErrorTitle")).no_booking_id()};const o=this.errors.api(i.instance.t("rescheduleBookingErrorTitle")),s=this.errors.component(i.instance.t("rescheduleBookingErrorTitle")),{bookingInfo:a,selectedTimeslot:r,selectedTimezone:l,selectedLanguage:c}=this.schedulerStore.state,{startTime:u,endTime:d,timezone:g}=t,h=u||(r==null?void 0:r.start_time);if(!h)return{error:s.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const m=d||(r==null?void 0:r.end_time);if(!m)return{error:s.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const p=this.schedulerStore.get("availabilityOrderEmails");let w="";if(p.length>0){const y=(r==null?void 0:r.emails)||[];for(let C=0;C<p.length;C++)if(y.includes(p[C])){w=p[C];break}}const f=g||l;if(!f)return{error:s.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')};const v=(r==null?void 0:r.event_id)||void 0,k=(r==null?void 0:r.master_id)||void 0,T=(r==null?void 0:r.calendar_id)||void 0,I={};Object.entries((a==null?void 0:a.additionalFields)||{}).forEach(([y,C])=>{I[y]=C.value});const D=t?t==null?void 0:t.primaryParticipant:a==null?void 0:a.primaryParticipant,_=t?(t==null?void 0:t.guests)||[]:(a==null?void 0:a.guests)||[],x=t?t==null?void 0:t.additionalFields:I,B=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",z=`/v3/scheduling/bookings/${e}${B}`,b=this.getHeaders(),S=await this.makeAPIRequest(decodeURIComponent(z),"PATCH",JSON.stringify({start_time:h.getTime()/1e3,end_time:m.getTime()/1e3,timezone:f,additional_fields:x,guest:{...D},additional_guests:_,participants:w?[{email:w}]:void 0,email_language:this.getTwoLetterLanguageCode(c),event_id:v,master_id:k,calendar_id:T}),b);if("error"in S){this.schedulerStore.set("isLoading",!1);const y=(F=S.error)==null?void 0:F.type;let C=S.error;if(y&&y in o){const U=this.getErrorMessage(C);C=o[y](U)}return{error:C}}const A=this.schedulerStore.get("reschedulingEventInfo");if("data"in S)this.schedulerStore.set("eventInfo",S==null?void 0:S.data);else if(A)this.schedulerStore.set("eventInfo",A);else{const y={booking_id:e};this.schedulerStore.set("eventInfo",y)}return this.schedulerStore.set("isLoading",!1),S}async updateBooking(e){var g;this.schedulerStore.set("isLoading",!0);const{bookingId:t,status:o,reason:s}=e,a=this.schedulerStore.get("organizerConfirmationSalt"),r=o==="confirmed"?i.instance.t("confirmBookingErrorTitle"):i.instance.t("rejectBookingErrorTitle");if(!t)return{error:this.errors.component(r).no_booking_id()};if(!a)return{error:this.errors.component(r).no_salt()};const l=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",c=`/v3/scheduling/bookings/${t}${l}`,u=this.getHeaders(),d=await this.makeAPIRequest(decodeURIComponent(c),"PUT",JSON.stringify({status:o,cancellation_reason:s,salt:a}),u);if("error"in d){this.schedulerStore.set("isLoading",!1);const h=(g=d.error)==null?void 0:g.type;let m=d.error;if(h&&h in this.errors.api(r)){const p=this.getErrorMessage(m);m=this.errors.api(r)[h](p)}return{error:m}}return"data"in d&&o==="confirmed"?this.schedulerStore.set("confirmedEventInfo",d==null?void 0:d.data):"request_id"in d&&o==="cancelled"&&this.schedulerStore.set("cancelledEventInfo",{booking_id:t}),this.schedulerStore.set("organizerConfirmationBookingId",""),this.schedulerStore.set("isLoading",!1),d}async validateGroupEventTimeslot(e){var r,l;this.schedulerStore.set("isLoading",!0);const t=(r=this.schedulerStore.get("configSettings"))==null?void 0:r.configuration_id;if(!t)return{error:this.errors.component(i.instance.t("validateTimeslotErrorTitle")).no_config_id()};const o=this.getHeaders(),s=`/v3/scheduling/configurations/${t}/group-events/validate-timeslot`,a=await this.makeAPIRequest(decodeURIComponent(s),"POST",JSON.stringify({...e,start_time:e.start_time.getTime()/1e3,end_time:e.end_time.getTime()/1e3}),o);if("error"in a){this.schedulerStore.set("isLoading",!1);const c=(l=a.error)==null?void 0:l.type;let u=a.error;if(c&&c in this.errors.api(i.instance.t("validateTimeslotErrorTitle"))){const d=this.getErrorMessage(u);u=this.errors.api(i.instance.t("validateTimeslotErrorTitle"))[c](d)}return this.refetchAvailability(),{error:u}}return this.schedulerStore.set("selectedTimeslot",e),this.schedulerStore.set("showBookingForm",!0),this.schedulerStore.set("isLoading",!1),a}}class Q{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:o,configId:s,slug:a,clientId:r}){if(!e)throw new Error("schedulerAPIURL is required");if(!t)throw new Error("nylasSchedulerStore is required");if(!o&&!s&&!(a||r))throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.");e==="/"&&(e=new URL(window.location.href).origin),this.configId=s,this.sessionId=o,this.schedulerAPIURL=e,this.nylasSchedulerStore=t,this.slug=a,this.clientId=r}init(){i.debug("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new K({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId,slug:this.slug,clientId:this.clientId}),this._schedulerAPIConnector)}resetStores(){this.nylasSchedulerStore.reset()}}function V(n={}){const e={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:!1,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:!1,nylasBranding:!0,...n};i.debug("[defaultNylasStoreState]: ",e);const t=i.createStore(e);return t.onChange("availability",o=>{i.debug("[availability]: ",o);const s=o.map(l=>l.start_time);i.debug("[selectableDates]: ",s),t.set("selectableDates",s);const a=o[0];if(!a)return;const r=Math.floor((a.end_time.getTime()-a.start_time.getTime())/6e4);i.debug("[durationMinutes]: ",r),t.set("eventDuration",r)}),t.reset=()=>{for(const o in e){const s=e[o];t.set(o,s)}},t}const P=(n,e)=>{const t=n.isLoading,o=n.showNotification,s=n.nylasBranding;return i.h(i.Fragment,null,o&&i.h("nylas-notification",null),t&&i.h("div",{class:"loading"},i.h("div",{class:"left"},i.h("div",{class:"skeleton"})),i.h("div",{class:"right"},i.h("div",{class:"skeleton"}),i.h("div",{class:"skeleton"}),i.h("div",{class:"skeleton"}),i.h("div",{class:"skeleton"}),i.h("div",{class:"skeleton"}))),!t&&e,i.h("div",{class:"footer"},s&&i.h("a",{href:"https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler",class:"powered-by-nylas",target:"_blank",rel:"noreferrer noopener"},"Powered by ",i.h("span",{class:"sr-only"},"Nylas"),i.h("nylas-logo",{"aria-hidden":!0}))))},W=(n,e)=>i.h("div",{class:"message-banner"},e),ee=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 8px 2px rgba(0, 0, 0, 0.05), 0px 8px 16px -2px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin:0}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page,.manual-confirmation-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.manual-confirmation-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}.right-panel.reschedule{border-top-right-radius:0px}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto;border-left:none}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer .powered-by-nylas{display:flex;align-items:center;text-decoration:none;color:var(--nylas-base-500)}.footer .powered-by-nylas:hover{color:var(--nylas-base-800)}.footer svg{fill:var(--nylas-base-500)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}button-component#report-issue{width:auto;position:absolute;bottom:4px;left:16px}nylas-feedback-form{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}',te=ee,G={title:i.instance.t("genericErrorTitle"),type:R.nr.Error,category:L.Component},J=class{constructor(n){i.registerInstance(this,n),this.init=i.createEvent(this,"init",7),this.schedulerWillLoad=i.createEvent(this,"schedulerWillLoad",7),this.schedulerDidLoad=i.createEvent(this,"schedulerDidLoad",7),this.nylasSchedulerError=i.createEvent(this,"nylasSchedulerError",7),this.nylasSchedulerInfo=i.createEvent(this,"nylasSchedulerInfo",7),this.configSettingsLoaded=i.createEvent(this,"configSettingsLoaded",7),this.bookingRefExtracted=i.createEvent(this,"bookingRefExtracted",7),this.bookedEventInfo=i.createEvent(this,"bookedEventInfo",7),this.mode="app",this.defaultSchedulerState=void 0,this.sessionId=void 0,this.schedulerApiUrl="https://api.us.nylas.com",this.bookingInfo=void 0,this.rescheduleBookingRef=void 0,this.cancelBookingRef=void 0,this.organizerConfirmationBookingRef=void 0,this.configurationId=void 0,this.slug=void 0,this.clientId=void 0,this.nylasBranding=!0,this.eventOverrides={},this.isLoading=void 0,this.themeConfig=void 0,this.localization=void 0,this.showNotification=!0,this.enableUserFeedback=!0,this.hour12=void 0,this.automaticComponentRegistration=!0,this.selectedDateLabel=new Date().toLocaleDateString(navigator.language,{dateStyle:"full"})||`${i.instance.t("noDateSelected")}`,this.refConfigId=void 0,this.language=navigator.language,this.showFeedbackModal=!1,this.bookingInfoConfirmed=null}connectedCallback(){i.debug("[nylas-scheduler] connectedCallback")}async componentWillLoad(){var s,a;i.debug("[nylas-scheduler] Component will load"),this.enableUserFeedback&&!M.isInitialized()&&M.init({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:"1.4.5",integrations:r=>[...r.filter(l=>!1),M.feedbackSyncIntegration({colorScheme:"system",autoInject:!1})],autoSessionTracking:!1,beforeSend:()=>null});const n=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides&&(await this.eventOverrides.schedulerWillLoad(n,this.nylasSchedulerConnector),n.defaultPrevented))return;this.stores={scheduler:V({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,hour12:this.hour12,...this.defaultSchedulerState})},this.baseProvider=new R.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.refConfigId=this.configurationId;let e;if(this.rescheduleBookingRef){const[r,l,c]=i.compactStringToUUIDs(this.rescheduleBookingRef);this.refConfigId=r,this.stores.scheduler.set("rescheduleBookingId",l),e=this.bookingRefExtracted.emit({configurationId:r,bookingId:l})}else if(this.cancelBookingRef){const[r,l,c]=i.compactStringToUUIDs(this.cancelBookingRef);this.refConfigId=r,this.stores.scheduler.set("cancelBookingId",l),e=this.bookingRefExtracted.emit({configurationId:r,bookingId:l})}else if(this.organizerConfirmationBookingRef){const[r,l,c]=i.compactStringToUUIDs(this.organizerConfirmationBookingRef);this.refConfigId=r,this.stores.scheduler.set("organizerConfirmationBookingId",l),this.stores.scheduler.set("organizerConfirmationSalt",c),e=this.bookingRefExtracted.emit({configurationId:r,bookingId:l,salt:c})}if("bookingRefExtracted"in this.eventOverrides&&(await this.eventOverrides.bookingRefExtracted(e,this.nylasSchedulerConnector),e.defaultPrevented)||!this.checkIfSessionIdOrConfigIdExists())return;const t=(s=this.baseProvider)==null?void 0:s.getStore("scheduler");this.nylasSchedulerConnector=new Q({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:t});const o=this.init.emit(this.host);"init"in this.eventOverrides&&(await this.eventOverrides.init(o,this.nylasSchedulerConnector),o.defaultPrevented)||((a=this.baseProvider)==null||a.componentWillLoad(this.nylasSchedulerConnector),this.applyThemeConfig(this.themeConfig))}async componentDidLoad(){var c,u,d,g,h,m,p,w;(c=this.baseProvider)==null||c.componentDidLoad();const n=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides&&(await this.eventOverrides.schedulerDidLoad(n,this.nylasSchedulerConnector),n.defaultPrevented)||!this.checkIfSessionIdOrConfigIdExists())return;this.localizationChanged(this.localization);const e=await((u=this.nylasSchedulerConnector)==null?void 0:u.scheduler.getUISettings());if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e==null?void 0:e.error)},host:this.host});return}else{"data"in e&&((d=e.data)!=null&&d.appearance)&&console.info("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.");const f=this.configSettingsLoaded.emit({settings:e});if("configSettingsLoaded"in this.eventOverrides&&(await this.eventOverrides.configSettingsLoaded(f,this.nylasSchedulerConnector),f.defaultPrevented))return}const t=(g=this.baseProvider)==null?void 0:g.getStore("scheduler"),o=(m=(h=t==null?void 0:t.get("configSettings"))==null?void 0:h.scheduler)==null?void 0:m.available_days_in_future,s=t==null?void 0:t.get("selectedTimeslot");if(s&&(s!=null&&s.start_time)){if(!this.isTimeslotValid(s))return;if(t!=null&&t.get("showBookingForm")){t==null||t.set("selectedDate",s.start_time);return}}const a=t==null?void 0:t.get("selectedDate"),r=t==null?void 0:t.get("availability");let l;if(!(r&&r.length>0)){if(a){const{startTime:f,endTime:v,endTimeForAvailableDaysInFuture:k}=this.validateAvailableDaysInFuture(a,o||30);a.getTime()<k*1e3&&(l=await((w=this.nylasSchedulerConnector)==null?void 0:w.scheduler.getAvailability(f,v)))}else{const f=new Date,{startTime:v,endTime:k,endTimeForAvailableDaysInFuture:T}=this.validateAvailableDaysInFuture(f,o||30);f.getTime()<T*1e3&&(l=await((p=this.nylasSchedulerConnector)==null?void 0:p.scheduler.getAvailability(v,k)))}if((!l||"error"in l)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(l==null?void 0:l.error)},host:this.host}),!a){let f=new Date;const v=t==null?void 0:t.get("availability").find(k=>new Date(k.start_time)>new Date);v&&(f=v.start_time),t==null||t.set("selectedDate",f)}}}componentDisconnected(){var n;(n=this.baseProvider)==null||n.componentDisconnected()}bookingInfoChanged(n){var e;(e=this.stores)==null||e.scheduler.set("bookingInfo",n)}rescheduleBookingRefChanged(n){var e,t;if(n){const[o,s]=i.compactStringToUUIDs(n);(e=this.stores)==null||e.scheduler.set("rescheduleBookingId",s),this.refConfigId=o,(t=this.nylasSchedulerConnector)==null||t.scheduler.setConfigId(o)}}cancelBookingRefChanged(n){var e,t;if(n){const[o,s]=i.compactStringToUUIDs(n);(e=this.stores)==null||e.scheduler.set("cancelBookingId",s),this.refConfigId=o,(t=this.nylasSchedulerConnector)==null||t.scheduler.setConfigId(o)}}organizerConfirmationBookingRefChanged(n){var e,t;if(n){const[o,s]=i.compactStringToUUIDs(n);(e=this.stores)==null||e.scheduler.set("organizerConfirmationBookingId",s),this.refConfigId=o,(t=this.nylasSchedulerConnector)==null||t.scheduler.setConfigId(o)}}localizationChanged(n){n&&Object.keys(n).forEach(e=>{e in X.LANGUAGE_CODE&&i.instance.addResourceBundle(e,"translation",n[e],!1,!0)})}themeConfigChanged(n){var e,t;(t=(e=this.baseProvider)==null?void 0:e.getStore("scheduler"))==null||t.set("themeConfig",n),this.applyThemeConfig(n)}languageChanged(n){const e=n.detail;this.language=e,i.instance.changeLanguage(e)}async registerComponentHandler(n){var e;(e=this.baseProvider)==null||e.registerComponent(n.detail)}async unregisterComponentHandler(n){var e;(e=this.baseProvider)==null||e.unregisterComponent(n.detail)}async monthChangedHandler(n){var r,l,c,u,d,g,h;const e=n.detail,t=(u=(c=(l=(r=this.nylasSchedulerConnector)==null?void 0:r.schedulerStore)==null?void 0:l.get("configSettings"))==null?void 0:c.scheduler)==null?void 0:u.available_days_in_future,{startTime:o,endTime:s,endTimeForAvailableDaysInFuture:a}=this.validateAvailableDaysInFuture(e,t||30);if(!n.defaultPrevented&&o<a&&e.getTime()<a*1e3){const m=await((d=this.nylasSchedulerConnector)==null?void 0:d.scheduler.getAvailability(o,s));(!m||"error"in m)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(m==null?void 0:m.error)},host:this.host});const p=(g=this.stores)==null?void 0:g.scheduler.get("selectableDates");p&&p.length>0&&((h=this.stores)==null||h.scheduler.set("selectedDate",p[0]))}}mapToBookingData(n){var r,l,c;const e=(r=this.stores)==null?void 0:r.scheduler.get("selectedTimeslot"),t=(l=this.stores)==null?void 0:l.scheduler.get("selectedLanguage"),o=(c=this.stores)==null?void 0:c.scheduler.get("selectedTimezone"),s=e!=null&&e.start_time?new Date(e==null?void 0:e.start_time).getTime()/1e3:"",a=e!=null&&e.end_time?new Date(e==null?void 0:e.end_time).getTime()/1e3:"";return{additional_guests:n.guests,guest:{...n.primaryParticipant},additional_fields:{...n.additionalFields},start_time:s,end_time:a,email_language:t,timezone:o}}async bookButtonClickedHandler(n){var c,u,d,g;if(n.defaultPrevented)return;const e=n.detail,t=this.mapToBookingData(e);this.bookingInfoConfirmed=e;const s=(u=(c=this.nylasSchedulerConnector)==null?void 0:c.schedulerStore)==null?void 0:u.get("rescheduleBookingId");if(s){const h=await((d=this.nylasSchedulerConnector)==null?void 0:d.scheduler.rescheduleBooking(s,e));(!h||"error"in h)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(h==null?void 0:h.error)},host:this.host});const m=h==null?void 0:h.data,p=this.bookedEventInfo.emit({...h,data:{...m,...t}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...m},"bookedEventInfo"in this.eventOverrides&&await this.eventOverrides.bookedEventInfo(p,this.nylasSchedulerConnector);return}const a=await((g=this.nylasSchedulerConnector)==null?void 0:g.scheduler.bookTimeslot(e));(!a||"error"in a)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(a==null?void 0:a.error)},host:this.host});const r=a==null?void 0:a.data,l=this.bookedEventInfo.emit({...a,data:{...r,...t}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...r},"bookedEventInfo"in this.eventOverrides&&await this.eventOverrides.bookedEventInfo(l,this.nylasSchedulerConnector)}dateSelectedHandler(n){const e=n.detail;this.selectedDateLabel=e?e.toLocaleDateString(this.language,{dateStyle:"full"}):`${i.instance.t("noDateSelected")}`}cancelBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}confirmBookingErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=!1}eventIsFullHandler(n){const e=n.detail.error;n.detail.type==="error"?this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:e})},host:this.host}):this.nylasSchedulerInfo.emit({notification:{title:"Event is full",category:L.Component,type:R.nr.Info,description:"The event you selected is full. Please try a different time.",id:new Date().getTime().toString(),ttl:3e3},host:this.host})}feedbackSubmittedHandler(n){const t={eventId:M.captureMessage("Scheduling Page User Feedback",{extra:{configId:this.configurationId,slug:this.slug}}),message:n.detail.feedback};M.captureFeedback(t,{includeReplay:!0,captureContext:{tags:{"nylas-web-element":"nylas-scheduling","nylas-web-element-version":"1.4.5","nylas-config-id":this.configurationId,"nylas-slug":this.slug,"host-url":window.location.href},extra:{configId:this.configurationId,slug:this.slug}}}),this.showFeedbackModal=!1}async getNylasSchedulerStore(){var n;return(n=this.baseProvider)==null?void 0:n.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(n){return{title:(n==null?void 0:n.title)||G.title,category:(n==null?void 0:n.category)||G.category,type:R.nr.Error,description:(n==null?void 0:n.message)||"",id:new Date().getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){let n="";return this.sessionId||(n+=i.instance.t("sessionIdRequiredErrorMessage")),!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)&&(n=i.instance.t("sessionIdRequiredErrorMessage")+" "+i.instance.t("publicConfigErrorMessage")),this.nylasSchedulerError.emit({notification:{title:i.instance.t("schedulingComponentErrorTitle"),category:L.Component,type:R.nr.Error,description:n,id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1}return!0}isTimeslotValid(n){return new Date(n.start_time)<new Date?(this.nylasSchedulerError.emit({notification:{title:i.instance.t("invalidTimeslotErrorTitle"),category:L.Component,type:R.nr.Error,description:i.instance.t("invalidTimeslotErrorMessage"),id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1):!0}validateAvailableDaysInFuture(n,e){const t=new Date,o=new Date(n.getFullYear(),n.getMonth(),1).getTime()/1e3,s=new Date(n.getFullYear(),n.getMonth()+1,1).getTime()/1e3,a=Math.floor(i.addDaysToCurrentDate(t,e).getTime()/1e3),r=Math.min(a,s);return{startTime:o<t.getTime()/1e3?Math.floor(t.getTime()/1e3):o,endTime:r,endTimeForAvailableDaysInFuture:a}}applyThemeConfig(n){if(n)for(const[e,t]of Object.entries(n))this.host.style.setProperty(`${e}`,t)}onFeedbackClick(n){n.preventDefault(),this.showFeedbackModal=!0}redirectToCustomUrl(n){window.location.assign(n)}render(){var p,w,f,v,k,T,I,D,_,x,B,z;const n=this.mode==="app",e=(p=this.baseProvider)==null?void 0:p.getStore("scheduler"),t=e==null?void 0:e.get("eventInfo"),o=e==null?void 0:e.get("showBookingForm"),s=e==null?void 0:e.get("cancelledEventInfo"),a=e==null?void 0:e.get("cancelBookingId"),r=e==null?void 0:e.get("selectedTimeslot"),l=e==null?void 0:e.get("rescheduleBookingId"),c=e==null?void 0:e.get("organizerConfirmationBookingId"),u=e==null?void 0:e.get("rejectBookingId"),d=e==null?void 0:e.get("confirmedEventInfo"),g=(e==null?void 0:e.get("nylasBranding"))||this.nylasBranding,h=e==null?void 0:e.get("selectedDate"),m=(f=(w=e==null?void 0:e.get("configSettings"))==null?void 0:w.scheduler)==null?void 0:f.confirmation_redirect_url;if(this.selectedDateLabel=h&&this.language?i.capitalizeFirstLetter(h.toLocaleDateString(this.language,{dateStyle:"full"})):`${i.instance.t("noDateSelected")}`,n&&(a||u)&&!s)return i.h(i.Host,null,i.h(P,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},i.h("div",{class:"cancel-flow-page",part:"cancel-flow-page"},i.h("nylas-cancel-booking-form",{selectedTimeslot:r,cancelBookingId:a,rejectBookingId:u,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:b=>this.onFeedbackClick(b)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null));if(n&&c)return i.h(i.Host,null,i.h(P,null,i.h("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},i.h("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:c,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:b=>this.onFeedbackClick(b)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null));if(n&&s)return i.h(i.Host,null,i.h(P,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},i.h("div",{class:"cancelled-event-page",part:"cancelled-event-page"},i.h("nylas-cancelled-event-card",{cancelledEventInfo:s,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:b=>this.onFeedbackClick(b)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null));if(n&&d)return i.h(i.Host,null,i.h(P,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},i.h("div",{class:"cancelled-event-page",part:"confirmed-event-page"},i.h("nylas-confirmed-event-card",{confirmedEventInfo:d,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:b=>this.onFeedbackClick(b)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null));if(n&&t&&m){const b=(v=this.bookingInfoConfirmed)==null?void 0:v.primaryParticipant,S=(k=this.bookingInfoConfirmed)==null?void 0:k.location,A=(T=this.bookingInfoConfirmed)==null?void 0:T.booking_ref,F=((I=this.bookingInfoConfirmed)==null?void 0:I.additionalFields)||{};if(this.bookingInfo&&typeof((D=this.bookingInfo)==null?void 0:D.additionalFields)<"u"){const O=this.bookingInfo.additionalFields;Object.keys(O).forEach(N=>{!F[N]&&(O!=null&&O[N])&&(F[N]=O[N].value)})}const y=(_=this.stores)==null?void 0:_.scheduler.get("selectedTimeslot"),C=(x=this.stores)==null?void 0:x.scheduler.get("selectedTimezone"),U=(B=this.stores)==null?void 0:B.scheduler.get("selectedLanguage"),$=(z=this.stores)==null?void 0:z.scheduler.get("configSettings"),j=this.configurationId?this.configurationId:$==null?void 0:$.configuration_id,Y=window.location.search,E=new URLSearchParams(Y);E.set("booking_id",t.booking_id),b!=null&&b.name&&E.set("name",b.name),b!=null&&b.email&&E.set("email",b.email),y!=null&&y.start_time&&E.set("start_time",(new Date(y.start_time).getTime()/1e3).toString()),y!=null&&y.end_time&&E.set("end_time",(new Date(y.end_time).getTime()/1e3).toString()),C&&E.set("tz",C),U&&E.set("language",U),F&&E.set("additional_values",JSON.stringify(F)),this.slug&&E.set("page_slug",this.slug),j&&E.set("config_id",j),S&&E.set("location",S),A&&E.set("booking_ref",A),this.redirectToCustomUrl(`${m}?${E.toString()}`);return}if(n&&t)return i.h(i.Host,null,i.h(P,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},i.h("div",{class:"booked-event-page",part:"booked-event-page ns_booked-event-page"},i.h("nylas-booked-event-card",{selectedTimeslot:r,eventInfo:t,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:b=>this.onFeedbackClick(b)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null));if(n&&(!t||l)&&!o){const b=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return i.h(i.Host,null,i.h(P,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},l&&i.h(W,null,`${i.instance.t("rescheduleTitle")}`),i.h("div",{class:"select-date-page",part:"select-date-page ns_select-date-page"},i.h("div",{class:"left-panel",part:"ns_left-panel"},i.h("nylas-date-picker",{exportparts:"ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),i.h("nylas-locale-switch",{exportparts:"nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label"})),i.h("div",{class:`right-panel ${l?"reschedule":""}`,part:`ns_right-panel ${l?"ns_reschedule":""}`},i.h("h2",{part:"ns_right-panel__title"},i.h("calendar-icon",{part:"ns_right-panel__calendar-icon"}),i.h("span",{id:"selectedDate",part:"ns_right-panel__selected-date"},this.selectedDateLabel)),i.h("nylas-timeslot-picker",{exportparts:"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},b&&i.h("span",{slot:"timeslot-picker-cta-label"},i.h("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:S=>this.onFeedbackClick(S)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null))}return n&&!t&&o?i.h(i.Host,null,i.h(P,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},l&&i.h(W,null,`${i.instance.t("rescheduleTitle")}`),i.h("div",{class:"additional-data-page",part:"additional-data-page ns_additional-data-page"},i.h("div",{class:"left-panel ns_left-panel",part:"ns_left-panel"},i.h("div",{class:"wrapper",part:"ns_left-panel__wrapper"},i.h("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),i.h("div",{class:`right-panel ${l?"reschedule":""}`,part:`ns_right-panel ${l?"ns_reschedule":""}`},i.h("nylas-booking-form",{exportparts:"nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content"})))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:b=>this.onFeedbackClick(b)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null)):i.h(i.Host,null,i.h("slot",null))}get host(){return i.getElement(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],themeConfig:["themeConfigChanged"]}}};J.style=te;exports.nylas_scheduling=J;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-1e75512f.cjs"),R=require("./index.es-fc8588de-034ead51.cjs"),X=require("./constants-f51538ef-cd2a67c4.cjs"),M=require("./feedbackSync-172f942c-62f72bd2.cjs");require("react");require("react/jsx-runtime");require("react-dom");var H;(function(n){n.Error="error",n.Warning="warning",n.Info="info",n.Success="success"})(H||(H={}));var L;(function(n){n.Component="component",n.Api="api",n.Auth="auth"})(L||(L={}));var q;(function(n){n.endtime_not_in_future="endtime_not_in_future",n.no_booking_info="no_booking_info",n.no_timeslot_selected="no_timeslot_selected",n.no_timezone_selected="no_timezone_selected",n.no_booking_id="no_booking_id",n.no_salt="no_salt",n.invalid_start_time="invalid_start_time",n.invalid_end_time="invalid_end_time",n.invalid_timezone="invalid_timezone",n.no_config_id="no_config_id"})(q||(q={}));class Z{constructor(){this.component=e=>{const t=L.Component,o=`${e} Error`;return{endtime_not_in_future:(s='"endtime" can not be in the future')=>({title:o,message:s,category:t}),no_booking_info:(s="No booking info provided")=>({title:o,message:s,category:t}),no_timeslot_selected:(s="No timeslot selected")=>({title:o,message:s,category:t}),no_timezone_selected:(s="No timezone selected")=>({title:o,message:s,category:t}),no_booking_id:(s="No booking id provided")=>({title:o,message:s,category:t}),no_salt:(s="No salt provided")=>({title:o,message:s,category:t}),invalid_start_time:(s="Invalid start time")=>({title:o,message:s,category:t}),invalid_end_time:(s="Invalid end time")=>({title:o,message:s,category:t}),invalid_timezone:(s="Invalid timezone")=>({title:o,message:s,category:t}),no_config_id:(s="No configuration id provided")=>({title:o,message:s,category:t})}},this.api=e=>{const t=L.Api,o=`${e} Error`;return{invalid_session:s=>({title:o,message:s,category:t}),general_error:s=>({title:o,message:s,category:t}),internal_error:s=>({title:o,message:s,category:t}),invalid_request_error:s=>({title:o,message:s,category:t}),timeslot_not_available:s=>({title:o,message:s,category:t}),provider_error:s=>({title:o,message:s,category:t}),not_found_error:s=>({title:o,message:s,category:t})}}}}class K{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:o,configId:s,slug:a,clientId:r}){this.errors=new Z,this.schedulerStore=t,this.schedulerAPIURL=e,this.sessionId=o,this.configId=s,this.slug=a,this.clientId=r}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,o,s={}){try{const a=new URL(this.schedulerAPIURL),r="2.0.0";return a.pathname=e,await(await fetch(decodeURIComponent(a.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,"X-Source":"nylas-scheduling","X-Nylas-Web-Elements-Version":r,...s},body:o})).json()}catch(a){return{error:{message:a.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){var o,s,a,r;let t=(e==null?void 0:e.message)||(e==null?void 0:e.title)||"Something went wrong";return(e==null?void 0:e.type)==="provider_error"&&(t=((s=(o=e==null?void 0:e.provider_error)==null?void 0:o.error)==null?void 0:s.message)||((r=(a=e==null?void 0:e.provider_error)==null?void 0:a.error)==null?void 0:r.title)||"Something went wrong"),t}setConfigId(e){this.configId=e}selectDate(e){this.schedulerStore.set("selectedDate",e),this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}selectLanguage(e){this.schedulerStore.set("selectedLanguage",e),i.instance.changeLanguage(e)}async toggleAdditionalData(e){e||await this.refetchAvailability(),this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3,o=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t,s=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;return await this.getAvailability(o,s)}async resetStoreStateAndFetchAvailability(){const e=new Date,t=await this.refetchAvailability(),o=this.schedulerStore.get("availability").find(a=>new Date(a.start_time)>new Date);let s=e;return o&&(s=o.start_time),this.schedulerStore.set("selectedDate",s),this.schedulerStore.set("eventInfo",null),this.schedulerStore.set("showBookingForm",!1),this.schedulerStore.set("selectedTimeslot",null),t}async setReschedule(e){this.schedulerStore.set("isLoading",!0);const t=this.schedulerStore.state.eventInfo;return t&&this.schedulerStore.set("reschedulingEventInfo",t),this.schedulerStore.set("rescheduleBookingId",e),await this.getUISettings(),await this.resetStoreStateAndFetchAvailability().finally(()=>{this.schedulerStore.set("isLoading",!1)})}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async setReject(e){this.schedulerStore.set("rejectBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("cancelBookingId",""),this.schedulerStore.set("rejectBookingId",""),this.schedulerStore.set("cancelledEventInfo",null),e}async goBack(){this.schedulerStore.set("cancelBookingId","")}async resetConfirm(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("organizerConfirmationBookingId",""),this.schedulerStore.set("confirmedEventInfo",void 0),e}async bookTimeslot(e){var T,I,B;this.schedulerStore.set("isLoading",!0);const{selectedTimeslot:t,selectedTimezone:o,bookingInfo:s,selectedLanguage:a}=this.schedulerStore.state;if(!e&&!s)return{error:this.errors.component(i.instance.t("createBookingErrorTitle")).no_booking_info()};const r=(e==null?void 0:e.timeslot)||t;if(!r)return{error:this.errors.component(i.instance.t("createBookingErrorTitle")).no_timeslot_selected()};const l=e&&(e!=null&&e.timezone)?e==null?void 0:e.timezone:o,c=a||"en-US";if(!l)return{error:this.errors.component(i.instance.t("createBookingErrorTitle")).no_timezone_selected()};const u=[...this.schedulerStore.get("availabilityOrderEmails")];let d="";const g=(r==null?void 0:r.emails)||[],h={};Object.entries((s==null?void 0:s.additionalFields)||{}).forEach(([_,x])=>{h[_]=x.value});const m=e?e==null?void 0:e.primaryParticipant:s==null?void 0:s.primaryParticipant,p=e?(e==null?void 0:e.guests)||[]:(s==null?void 0:s.guests)||[],w=e?e==null?void 0:e.additionalFields:h,f=this.getHeaders(),k=`/v3/scheduling/bookings${!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:""}`;if(u.length===0){const _=await this.makeAPIRequest(decodeURIComponent(k),"POST",JSON.stringify({additional_fields:w,additional_guests:p,guest:{...m},start_time:r.start_time.getTime()/1e3,end_time:r.end_time.getTime()/1e3,timezone:l,event_id:(r==null?void 0:r.event_id)||void 0,master_id:(r==null?void 0:r.master_id)||void 0,calendar_id:(r==null?void 0:r.calendar_id)||void 0,email_language:this.getTwoLetterLanguageCode(c)}),f);return this.schedulerStore.set("isLoading",!1),"data"in _?(this.schedulerStore.set("eventInfo",_.data),_):{error:_.error}}for(;u.length>0;){if(d=u.shift(),!g.includes(d))continue;const _=await this.makeAPIRequest(decodeURIComponent(k),"POST",JSON.stringify({participants:d?[{email:d}]:void 0,additional_fields:w,additional_guests:p,guest:{...m},start_time:r.start_time.getTime()/1e3,end_time:r.end_time.getTime()/1e3,timezone:l,email_language:this.getTwoLetterLanguageCode(c)}),f);if("data"in _)return this.schedulerStore.set("isLoading",!1),this.schedulerStore.set("eventInfo",_==null?void 0:_.data),_;if((I=(T=_.error)==null?void 0:T.message)!=null&&I.startsWith("The selected timeslot is unavailable"))continue;{this.schedulerStore.set("isLoading",!1);const x=(B=_.error)==null?void 0:B.type;let D=_.error;if(x&&x in this.errors.api(i.instance.t("createBookingErrorTitle"))){const z=this.getErrorMessage(D);D=this.errors.api(i.instance.t("createBookingErrorTitle"))[x](z)}return{error:D}}}return this.schedulerStore.set("isLoading",!1),{error:this.errors.api(i.instance.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")}}async getUISettings(){var r;this.schedulerStore.set("isLoading",!0);const e=this.schedulerStore.get("rescheduleBookingId"),t=this.getHeaders();let o=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";e&&o?o+=`&booking_id=${e}`:e&&(o+=`?booking_id=${e}`);const s=`/v3/scheduling/ui-settings${o}`,a=await this.makeAPIRequest(s,"GET",void 0,t);if("error"in a){this.schedulerStore.set("isLoading",!1);const l=(r=a.error)==null?void 0:r.type;let c=a.error;return l&&l in this.errors.api(i.instance.t("getUISettingErrorTitle"))&&(c=this.errors.api(i.instance.t("getUISettingErrorTitle"))[l]((c==null?void 0:c.message)||(c==null?void 0:c.title)||"Something went wrong")),{error:c}}return"data"in a&&this.schedulerStore.set("configSettings",a.data),this.schedulerStore.set("isLoading",!1),a}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){var a;const t=(a=this.schedulerStore.get("configSettings"))==null?void 0:a.scheduler,o=t==null?void 0:t.min_booking_notice;if(!o)return e;const s=new Date().getTime();return e<(s+o*60*1e3)/1e3?Math.floor((s+o*60*1e3)/1e3):e}getEndTimeForAvailableDaysInFuture(e){var r,l;const t=new Date,o=(l=(r=this.schedulerStore.get("configSettings"))==null?void 0:r.scheduler)==null?void 0:l.available_days_in_future,s=Math.floor(i.addDaysToCurrentDate(t,o).getTime()/1e3);return Math.min(s,e)}async getAvailability(e=0,t=0){var h,m,p,w;this.schedulerStore.set("isLoading",!0);const o=new URLSearchParams,s=new Date,a=s.getTime();if(t&&t<a/1e3)return this.schedulerStore.set("isLoading",!1),{error:this.errors.component(i.instance.t("getAvailabilityErrorTitle")).endtime_not_in_future()};if(!e){const f=new Date(s.getFullYear(),s.getMonth(),1);e=Math.floor(f.getTime()/1e3)}if(!t){const f=new Date(s.getFullYear(),s.getMonth()+1,0);t=Math.floor(f.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const r=this.getStartTimeWithMinBookingNotice(e);e=r,t=r>t?r+1:t,o.append("start_time",encodeURIComponent(e.toString())),o.append("end_time",encodeURIComponent(t.toString())),this.configId&&!this.sessionId?o.append("configuration_id",encodeURIComponent(this.configId)):this.slug&&this.clientId&&!this.sessionId&&(o.append("slug",encodeURIComponent(this.slug)),o.append("client_id",encodeURIComponent(this.clientId)));const l=this.schedulerStore.get("rescheduleBookingId");l&&o.append("booking_id",encodeURIComponent(l));const c=o.toString(),u=`/v3/scheduling/availability${c?`?${c}`:""}`,d=this.getHeaders(),g=await this.makeAPIRequest(decodeURIComponent(u),"GET",void 0,d);if("error"in g){this.schedulerStore.set("availability",[]),this.schedulerStore.set("isLoading",!1);const f=(h=g.error)==null?void 0:h.type;let v=g.error;if(f&&f in this.errors.api(i.instance.t("getAvailabilityErrorTitle"))){const k=this.getErrorMessage(v);v=this.errors.api(i.instance.t("getAvailabilityErrorTitle"))[f](k)}return{error:v}}if("data"in g){const k=(((p=(m=g.data)==null?void 0:m.time_slots)==null?void 0:p.map(I=>({...I,start_time:new Date(I.start_time*1e3),end_time:new Date(I.end_time*1e3)})))||[]).filter(I=>I.start_time.getTime()>a).sort((I,B)=>I.start_time.getTime()-B.start_time.getTime());this.schedulerStore.set("availability",k);const T=((w=g.data)==null?void 0:w.order)||[];this.schedulerStore.set("availabilityOrderEmails",T)}return this.schedulerStore.set("isLoading",!1),g}async cancelBooking(e,t){var l;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(i.instance.t("cancelBookingErrorTitle")).no_booking_id()};const o=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",s=`/v3/scheduling/bookings/${e}${o}`,a=this.getHeaders(),r=await this.makeAPIRequest(decodeURIComponent(s),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),a);if("error"in r){this.schedulerStore.set("isLoading",!1);const c=(l=r.error)==null?void 0:l.type;let u=r.error;if(c&&c in this.errors.api(i.instance.t("cancelBookingErrorTitle"))){const d=this.getErrorMessage(u);u=this.errors.api(i.instance.t("cancelBookingErrorTitle"))[c](d)}return{error:u}}return this.schedulerStore.set("cancelledEventInfo",{booking_id:e}),this.schedulerStore.set("rescheduleBookingId",""),this.schedulerStore.set("isLoading",!1),r}async rescheduleBooking(e,t){var F;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(i.instance.t("rescheduleBookingErrorTitle")).no_booking_id()};const o=this.errors.api(i.instance.t("rescheduleBookingErrorTitle")),s=this.errors.component(i.instance.t("rescheduleBookingErrorTitle")),{bookingInfo:a,selectedTimeslot:r,selectedTimezone:l,selectedLanguage:c}=this.schedulerStore.state,{startTime:u,endTime:d,timezone:g}=t,h=u||(r==null?void 0:r.start_time);if(!h)return{error:s.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const m=d||(r==null?void 0:r.end_time);if(!m)return{error:s.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const p=this.schedulerStore.get("availabilityOrderEmails");let w="";if(p.length>0){const y=(r==null?void 0:r.emails)||[];for(let C=0;C<p.length;C++)if(y.includes(p[C])){w=p[C];break}}const f=g||l;if(!f)return{error:s.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')};const v=(r==null?void 0:r.event_id)||void 0,k=(r==null?void 0:r.master_id)||void 0,T=(r==null?void 0:r.calendar_id)||void 0,I={};Object.entries((a==null?void 0:a.additionalFields)||{}).forEach(([y,C])=>{I[y]=C.value});const B=t?t==null?void 0:t.primaryParticipant:a==null?void 0:a.primaryParticipant,_=t?(t==null?void 0:t.guests)||[]:(a==null?void 0:a.guests)||[],x=t?t==null?void 0:t.additionalFields:I,D=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",z=`/v3/scheduling/bookings/${e}${D}`,b=this.getHeaders(),S=await this.makeAPIRequest(decodeURIComponent(z),"PATCH",JSON.stringify({start_time:h.getTime()/1e3,end_time:m.getTime()/1e3,timezone:f,additional_fields:x,guest:{...B},additional_guests:_,participants:w?[{email:w}]:void 0,email_language:this.getTwoLetterLanguageCode(c),event_id:v,master_id:k,calendar_id:T}),b);if("error"in S){this.schedulerStore.set("isLoading",!1);const y=(F=S.error)==null?void 0:F.type;let C=S.error;if(y&&y in o){const U=this.getErrorMessage(C);C=o[y](U)}return{error:C}}const A=this.schedulerStore.get("reschedulingEventInfo");if("data"in S)this.schedulerStore.set("eventInfo",S==null?void 0:S.data);else if(A)this.schedulerStore.set("eventInfo",A);else{const y={booking_id:e};this.schedulerStore.set("eventInfo",y)}return this.schedulerStore.set("isLoading",!1),S}async updateBooking(e){var g;this.schedulerStore.set("isLoading",!0);const{bookingId:t,status:o,reason:s}=e,a=this.schedulerStore.get("organizerConfirmationSalt"),r=o==="confirmed"?i.instance.t("confirmBookingErrorTitle"):i.instance.t("rejectBookingErrorTitle");if(!t)return{error:this.errors.component(r).no_booking_id()};if(!a)return{error:this.errors.component(r).no_salt()};const l=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",c=`/v3/scheduling/bookings/${t}${l}`,u=this.getHeaders(),d=await this.makeAPIRequest(decodeURIComponent(c),"PUT",JSON.stringify({status:o,cancellation_reason:s,salt:a}),u);if("error"in d){this.schedulerStore.set("isLoading",!1);const h=(g=d.error)==null?void 0:g.type;let m=d.error;if(h&&h in this.errors.api(r)){const p=this.getErrorMessage(m);m=this.errors.api(r)[h](p)}return{error:m}}return"data"in d&&o==="confirmed"?this.schedulerStore.set("confirmedEventInfo",d==null?void 0:d.data):"request_id"in d&&o==="cancelled"&&this.schedulerStore.set("cancelledEventInfo",{booking_id:t}),this.schedulerStore.set("organizerConfirmationBookingId",""),this.schedulerStore.set("isLoading",!1),d}async validateGroupEventTimeslot(e){var r,l;this.schedulerStore.set("isLoading",!0);const t=(r=this.schedulerStore.get("configSettings"))==null?void 0:r.configuration_id;if(!t)return{error:this.errors.component(i.instance.t("validateTimeslotErrorTitle")).no_config_id()};const o=this.getHeaders(),s=`/v3/scheduling/configurations/${t}/group-events/validate-timeslot`,a=await this.makeAPIRequest(decodeURIComponent(s),"POST",JSON.stringify({...e,start_time:e.start_time.getTime()/1e3,end_time:e.end_time.getTime()/1e3}),o);if("error"in a){this.schedulerStore.set("isLoading",!1);const c=(l=a.error)==null?void 0:l.type;let u=a.error;if(c&&c in this.errors.api(i.instance.t("validateTimeslotErrorTitle"))){const d=this.getErrorMessage(u);u=this.errors.api(i.instance.t("validateTimeslotErrorTitle"))[c](d)}return this.refetchAvailability(),{error:u}}return this.schedulerStore.set("selectedTimeslot",e),this.schedulerStore.set("showBookingForm",!0),this.schedulerStore.set("isLoading",!1),a}}class Q{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:o,configId:s,slug:a,clientId:r}){if(!e)throw new Error("schedulerAPIURL is required");if(!t)throw new Error("nylasSchedulerStore is required");if(!o&&!s&&!(a||r))throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.");e==="/"&&(e=new URL(window.location.href).origin),this.configId=s,this.sessionId=o,this.schedulerAPIURL=e,this.nylasSchedulerStore=t,this.slug=a,this.clientId=r}init(){i.debug("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new K({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId,slug:this.slug,clientId:this.clientId}),this._schedulerAPIConnector)}resetStores(){this.nylasSchedulerStore.reset()}}function V(n={}){const e={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:!1,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:!1,nylasBranding:!0,...n};i.debug("[defaultNylasStoreState]: ",e);const t=i.createStore(e);return t.onChange("availability",o=>{i.debug("[availability]: ",o);const s=o.map(l=>l.start_time);i.debug("[selectableDates]: ",s),t.set("selectableDates",s);const a=o[0];if(!a)return;const r=Math.floor((a.end_time.getTime()-a.start_time.getTime())/6e4);i.debug("[durationMinutes]: ",r),t.set("eventDuration",r)}),t.reset=()=>{for(const o in e){const s=e[o];t.set(o,s)}},t}const P=(n,e)=>{const t=n.isLoading,o=n.showNotification,s=n.nylasBranding;return i.h(i.Fragment,null,o&&i.h("nylas-notification",null),t&&i.h("div",{class:"loading"},i.h("div",{class:"left"},i.h("div",{class:"skeleton"})),i.h("div",{class:"right"},i.h("div",{class:"skeleton"}),i.h("div",{class:"skeleton"}),i.h("div",{class:"skeleton"}),i.h("div",{class:"skeleton"}),i.h("div",{class:"skeleton"}))),!t&&e,i.h("div",{class:"footer"},s&&i.h("a",{href:"https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler",class:"powered-by-nylas",target:"_blank",rel:"noreferrer noopener"},"Powered by ",i.h("span",{class:"sr-only"},"Nylas"),i.h("nylas-logo",{"aria-hidden":!0}))))},W=(n,e)=>i.h("div",{class:"message-banner"},e),ee=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 8px 2px rgba(0, 0, 0, 0.05), 0px 8px 16px -2px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin:0}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page,.manual-confirmation-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.manual-confirmation-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}.right-panel.reschedule{border-top-right-radius:0px}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto;border-left:none}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer .powered-by-nylas{display:flex;align-items:center;text-decoration:none;color:var(--nylas-base-500)}.footer .powered-by-nylas:hover{color:var(--nylas-base-800)}.footer svg{fill:var(--nylas-base-500)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}button-component#report-issue{width:auto;position:absolute;bottom:4px;left:16px}nylas-feedback-form{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}',te=ee,G={title:i.instance.t("genericErrorTitle"),type:R.nr.Error,category:L.Component},J=class{constructor(n){i.registerInstance(this,n),this.init=i.createEvent(this,"init",7),this.schedulerWillLoad=i.createEvent(this,"schedulerWillLoad",7),this.schedulerDidLoad=i.createEvent(this,"schedulerDidLoad",7),this.nylasSchedulerError=i.createEvent(this,"nylasSchedulerError",7),this.nylasSchedulerInfo=i.createEvent(this,"nylasSchedulerInfo",7),this.configSettingsLoaded=i.createEvent(this,"configSettingsLoaded",7),this.bookingRefExtracted=i.createEvent(this,"bookingRefExtracted",7),this.bookedEventInfo=i.createEvent(this,"bookedEventInfo",7),this.mode="app",this.defaultSchedulerState=void 0,this.sessionId=void 0,this.schedulerApiUrl="https://api.us.nylas.com",this.bookingInfo=void 0,this.rescheduleBookingRef=void 0,this.cancelBookingRef=void 0,this.organizerConfirmationBookingRef=void 0,this.configurationId=void 0,this.slug=void 0,this.clientId=void 0,this.nylasBranding=!0,this.eventOverrides={},this.isLoading=void 0,this.themeConfig=void 0,this.localization=void 0,this.showNotification=!0,this.enableUserFeedback=!0,this.hour12=void 0,this.automaticComponentRegistration=!0,this.selectedDateLabel=new Date().toLocaleDateString(navigator.language,{dateStyle:"full"})||`${i.instance.t("noDateSelected")}`,this.refConfigId=void 0,this.language=navigator.language,this.showFeedbackModal=!1,this.bookingInfoConfirmed=null}connectedCallback(){i.debug("[nylas-scheduler] connectedCallback")}async componentWillLoad(){var s,a;i.debug("[nylas-scheduler] Component will load"),this.enableUserFeedback&&!M.isInitialized()&&M.init({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:"2.0.0",integrations:r=>[...r.filter(l=>!1),M.feedbackSyncIntegration({colorScheme:"system",autoInject:!1})],autoSessionTracking:!1,beforeSend:()=>null});const n=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides&&(await this.eventOverrides.schedulerWillLoad(n,this.nylasSchedulerConnector),n.defaultPrevented))return;this.stores={scheduler:V({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,hour12:this.hour12,...this.defaultSchedulerState})},this.baseProvider=new R.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.refConfigId=this.configurationId;let e;if(this.rescheduleBookingRef){const[r,l,c]=i.compactStringToUUIDs(this.rescheduleBookingRef);this.refConfigId=r,this.stores.scheduler.set("rescheduleBookingId",l),e=this.bookingRefExtracted.emit({configurationId:r,bookingId:l})}else if(this.cancelBookingRef){const[r,l,c]=i.compactStringToUUIDs(this.cancelBookingRef);this.refConfigId=r,this.stores.scheduler.set("cancelBookingId",l),e=this.bookingRefExtracted.emit({configurationId:r,bookingId:l})}else if(this.organizerConfirmationBookingRef){const[r,l,c]=i.compactStringToUUIDs(this.organizerConfirmationBookingRef);this.refConfigId=r,this.stores.scheduler.set("organizerConfirmationBookingId",l),this.stores.scheduler.set("organizerConfirmationSalt",c),e=this.bookingRefExtracted.emit({configurationId:r,bookingId:l,salt:c})}if("bookingRefExtracted"in this.eventOverrides&&(await this.eventOverrides.bookingRefExtracted(e,this.nylasSchedulerConnector),e.defaultPrevented)||!this.checkIfSessionIdOrConfigIdExists())return;const t=(s=this.baseProvider)==null?void 0:s.getStore("scheduler");this.nylasSchedulerConnector=new Q({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:t});const o=this.init.emit(this.host);"init"in this.eventOverrides&&(await this.eventOverrides.init(o,this.nylasSchedulerConnector),o.defaultPrevented)||((a=this.baseProvider)==null||a.componentWillLoad(this.nylasSchedulerConnector),this.applyThemeConfig(this.themeConfig))}async componentDidLoad(){var c,u,d,g,h,m,p,w;(c=this.baseProvider)==null||c.componentDidLoad();const n=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides&&(await this.eventOverrides.schedulerDidLoad(n,this.nylasSchedulerConnector),n.defaultPrevented)||!this.checkIfSessionIdOrConfigIdExists())return;this.localizationChanged(this.localization);const e=await((u=this.nylasSchedulerConnector)==null?void 0:u.scheduler.getUISettings());if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e==null?void 0:e.error)},host:this.host});return}else{"data"in e&&((d=e.data)!=null&&d.appearance)&&console.info("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.");const f=this.configSettingsLoaded.emit({settings:e});if("configSettingsLoaded"in this.eventOverrides&&(await this.eventOverrides.configSettingsLoaded(f,this.nylasSchedulerConnector),f.defaultPrevented))return}const t=(g=this.baseProvider)==null?void 0:g.getStore("scheduler"),o=(m=(h=t==null?void 0:t.get("configSettings"))==null?void 0:h.scheduler)==null?void 0:m.available_days_in_future,s=t==null?void 0:t.get("selectedTimeslot");if(s&&(s!=null&&s.start_time)){if(!this.isTimeslotValid(s))return;if(t!=null&&t.get("showBookingForm")){t==null||t.set("selectedDate",s.start_time);return}}const a=t==null?void 0:t.get("selectedDate"),r=t==null?void 0:t.get("availability");let l;if(!(r&&r.length>0)){if(a){const{startTime:f,endTime:v,endTimeForAvailableDaysInFuture:k}=this.validateAvailableDaysInFuture(a,o||30);a.getTime()<k*1e3&&(l=await((w=this.nylasSchedulerConnector)==null?void 0:w.scheduler.getAvailability(f,v)))}else{const f=new Date,{startTime:v,endTime:k,endTimeForAvailableDaysInFuture:T}=this.validateAvailableDaysInFuture(f,o||30);f.getTime()<T*1e3&&(l=await((p=this.nylasSchedulerConnector)==null?void 0:p.scheduler.getAvailability(v,k)))}if((!l||"error"in l)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(l==null?void 0:l.error)},host:this.host}),!a){let f=new Date;const v=t==null?void 0:t.get("availability").find(k=>new Date(k.start_time)>new Date);v&&(f=v.start_time),t==null||t.set("selectedDate",f)}}}componentDisconnected(){var n;(n=this.baseProvider)==null||n.componentDisconnected()}bookingInfoChanged(n){var e;(e=this.stores)==null||e.scheduler.set("bookingInfo",n)}rescheduleBookingRefChanged(n){var e,t;if(n){const[o,s]=i.compactStringToUUIDs(n);(e=this.stores)==null||e.scheduler.set("rescheduleBookingId",s),this.refConfigId=o,(t=this.nylasSchedulerConnector)==null||t.scheduler.setConfigId(o)}}cancelBookingRefChanged(n){var e,t;if(n){const[o,s]=i.compactStringToUUIDs(n);(e=this.stores)==null||e.scheduler.set("cancelBookingId",s),this.refConfigId=o,(t=this.nylasSchedulerConnector)==null||t.scheduler.setConfigId(o)}}organizerConfirmationBookingRefChanged(n){var e,t;if(n){const[o,s]=i.compactStringToUUIDs(n);(e=this.stores)==null||e.scheduler.set("organizerConfirmationBookingId",s),this.refConfigId=o,(t=this.nylasSchedulerConnector)==null||t.scheduler.setConfigId(o)}}localizationChanged(n){n&&Object.keys(n).forEach(e=>{e in X.LANGUAGE_CODE&&i.instance.addResourceBundle(e,"translation",n[e],!1,!0)})}themeConfigChanged(n){var e,t;(t=(e=this.baseProvider)==null?void 0:e.getStore("scheduler"))==null||t.set("themeConfig",n),this.applyThemeConfig(n)}languageChanged(n){const e=n.detail;this.language=e,i.instance.changeLanguage(e)}async registerComponentHandler(n){var e;(e=this.baseProvider)==null||e.registerComponent(n.detail)}async unregisterComponentHandler(n){var e;(e=this.baseProvider)==null||e.unregisterComponent(n.detail)}async monthChangedHandler(n){var r,l,c,u,d,g,h;const e=n.detail,t=(u=(c=(l=(r=this.nylasSchedulerConnector)==null?void 0:r.schedulerStore)==null?void 0:l.get("configSettings"))==null?void 0:c.scheduler)==null?void 0:u.available_days_in_future,{startTime:o,endTime:s,endTimeForAvailableDaysInFuture:a}=this.validateAvailableDaysInFuture(e,t||30);if(!n.defaultPrevented&&o<a&&e.getTime()<a*1e3){const m=await((d=this.nylasSchedulerConnector)==null?void 0:d.scheduler.getAvailability(o,s));(!m||"error"in m)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(m==null?void 0:m.error)},host:this.host});const p=(g=this.stores)==null?void 0:g.scheduler.get("selectableDates");p&&p.length>0&&((h=this.stores)==null||h.scheduler.set("selectedDate",p[0]))}}mapToBookingData(n){var r,l,c;const e=(r=this.stores)==null?void 0:r.scheduler.get("selectedTimeslot"),t=(l=this.stores)==null?void 0:l.scheduler.get("selectedLanguage"),o=(c=this.stores)==null?void 0:c.scheduler.get("selectedTimezone"),s=e!=null&&e.start_time?new Date(e==null?void 0:e.start_time).getTime()/1e3:"",a=e!=null&&e.end_time?new Date(e==null?void 0:e.end_time).getTime()/1e3:"";return{additional_guests:n.guests,guest:{...n.primaryParticipant},additional_fields:{...n.additionalFields},start_time:s,end_time:a,email_language:t,timezone:o}}async bookButtonClickedHandler(n){var c,u,d,g;if(n.defaultPrevented)return;const e=n.detail,t=this.mapToBookingData(e);this.bookingInfoConfirmed=e;const s=(u=(c=this.nylasSchedulerConnector)==null?void 0:c.schedulerStore)==null?void 0:u.get("rescheduleBookingId");if(s){const h=await((d=this.nylasSchedulerConnector)==null?void 0:d.scheduler.rescheduleBooking(s,e));(!h||"error"in h)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(h==null?void 0:h.error)},host:this.host});const m=h==null?void 0:h.data,p=this.bookedEventInfo.emit({...h,data:{...m,...t}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...m},"bookedEventInfo"in this.eventOverrides&&await this.eventOverrides.bookedEventInfo(p,this.nylasSchedulerConnector);return}const a=await((g=this.nylasSchedulerConnector)==null?void 0:g.scheduler.bookTimeslot(e));(!a||"error"in a)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(a==null?void 0:a.error)},host:this.host});const r=a==null?void 0:a.data,l=this.bookedEventInfo.emit({...a,data:{...r,...t}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...r},"bookedEventInfo"in this.eventOverrides&&await this.eventOverrides.bookedEventInfo(l,this.nylasSchedulerConnector)}dateSelectedHandler(n){const e=n.detail;this.selectedDateLabel=e?e.toLocaleDateString(this.language,{dateStyle:"full"}):`${i.instance.t("noDateSelected")}`}cancelBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}confirmBookingErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=!1}eventIsFullHandler(n){const e=n.detail.error;n.detail.type==="error"?this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:e})},host:this.host}):this.nylasSchedulerInfo.emit({notification:{title:"Event is full",category:L.Component,type:R.nr.Info,description:"The event you selected is full. Please try a different time.",id:new Date().getTime().toString(),ttl:3e3},host:this.host})}feedbackSubmittedHandler(n){const t={eventId:M.captureMessage("Scheduling Page User Feedback",{extra:{configId:this.configurationId,slug:this.slug}}),message:n.detail.feedback};M.captureFeedback(t,{includeReplay:!0,captureContext:{tags:{"nylas-web-element":"nylas-scheduling","nylas-web-element-version":"2.0.0","nylas-config-id":this.configurationId,"nylas-slug":this.slug,"host-url":window.location.href},extra:{configId:this.configurationId,slug:this.slug}}}),this.showFeedbackModal=!1}async getNylasSchedulerStore(){var n;return(n=this.baseProvider)==null?void 0:n.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(n){return{title:(n==null?void 0:n.title)||G.title,category:(n==null?void 0:n.category)||G.category,type:R.nr.Error,description:(n==null?void 0:n.message)||"",id:new Date().getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){let n="";return this.sessionId||(n+=i.instance.t("sessionIdRequiredErrorMessage")),!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)&&(n=i.instance.t("sessionIdRequiredErrorMessage")+" "+i.instance.t("publicConfigErrorMessage")),this.nylasSchedulerError.emit({notification:{title:i.instance.t("schedulingComponentErrorTitle"),category:L.Component,type:R.nr.Error,description:n,id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1}return!0}isTimeslotValid(n){return new Date(n.start_time)<new Date?(this.nylasSchedulerError.emit({notification:{title:i.instance.t("invalidTimeslotErrorTitle"),category:L.Component,type:R.nr.Error,description:i.instance.t("invalidTimeslotErrorMessage"),id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1):!0}validateAvailableDaysInFuture(n,e){const t=new Date,o=new Date(n.getFullYear(),n.getMonth(),1).getTime()/1e3,s=new Date(n.getFullYear(),n.getMonth()+1,1).getTime()/1e3,a=Math.floor(i.addDaysToCurrentDate(t,e).getTime()/1e3),r=Math.min(a,s);return{startTime:o<t.getTime()/1e3?Math.floor(t.getTime()/1e3):o,endTime:r,endTimeForAvailableDaysInFuture:a}}applyThemeConfig(n){if(n)for(const[e,t]of Object.entries(n))this.host.style.setProperty(`${e}`,t)}onFeedbackClick(n){n.preventDefault(),this.showFeedbackModal=!0}redirectToCustomUrl(n){window.location.assign(n)}render(){var p,w,f,v,k,T,I,B,_,x,D,z;const n=this.mode==="app",e=(p=this.baseProvider)==null?void 0:p.getStore("scheduler"),t=e==null?void 0:e.get("eventInfo"),o=e==null?void 0:e.get("showBookingForm"),s=e==null?void 0:e.get("cancelledEventInfo"),a=e==null?void 0:e.get("cancelBookingId"),r=e==null?void 0:e.get("selectedTimeslot"),l=e==null?void 0:e.get("rescheduleBookingId"),c=e==null?void 0:e.get("organizerConfirmationBookingId"),u=e==null?void 0:e.get("rejectBookingId"),d=e==null?void 0:e.get("confirmedEventInfo"),g=(e==null?void 0:e.get("nylasBranding"))||this.nylasBranding,h=e==null?void 0:e.get("selectedDate"),m=(f=(w=e==null?void 0:e.get("configSettings"))==null?void 0:w.scheduler)==null?void 0:f.confirmation_redirect_url;if(this.selectedDateLabel=h&&this.language?i.capitalizeFirstLetter(h.toLocaleDateString(this.language,{dateStyle:"full"})):`${i.instance.t("noDateSelected")}`,n&&(a||u)&&!s)return i.h(i.Host,null,i.h(P,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},i.h("div",{class:"cancel-flow-page",part:"cancel-flow-page"},i.h("nylas-cancel-booking-form",{selectedTimeslot:r,cancelBookingId:a,rejectBookingId:u,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:b=>this.onFeedbackClick(b)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null));if(n&&c)return i.h(i.Host,null,i.h(P,null,i.h("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},i.h("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:c,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:b=>this.onFeedbackClick(b)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null));if(n&&s)return i.h(i.Host,null,i.h(P,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},i.h("div",{class:"cancelled-event-page",part:"cancelled-event-page"},i.h("nylas-cancelled-event-card",{cancelledEventInfo:s,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:b=>this.onFeedbackClick(b)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null));if(n&&d)return i.h(i.Host,null,i.h(P,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},i.h("div",{class:"cancelled-event-page",part:"confirmed-event-page"},i.h("nylas-confirmed-event-card",{confirmedEventInfo:d,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:b=>this.onFeedbackClick(b)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null));if(n&&t&&m){const b=(v=this.bookingInfoConfirmed)==null?void 0:v.primaryParticipant,S=(k=this.bookingInfoConfirmed)==null?void 0:k.location,A=(T=this.bookingInfoConfirmed)==null?void 0:T.booking_ref,F=((I=this.bookingInfoConfirmed)==null?void 0:I.additionalFields)||{};if(this.bookingInfo&&typeof((B=this.bookingInfo)==null?void 0:B.additionalFields)<"u"){const O=this.bookingInfo.additionalFields;Object.keys(O).forEach(N=>{!F[N]&&(O!=null&&O[N])&&(F[N]=O[N].value)})}const y=(_=this.stores)==null?void 0:_.scheduler.get("selectedTimeslot"),C=(x=this.stores)==null?void 0:x.scheduler.get("selectedTimezone"),U=(D=this.stores)==null?void 0:D.scheduler.get("selectedLanguage"),$=(z=this.stores)==null?void 0:z.scheduler.get("configSettings"),j=this.configurationId?this.configurationId:$==null?void 0:$.configuration_id,Y=window.location.search,E=new URLSearchParams(Y);E.set("booking_id",t.booking_id),b!=null&&b.name&&E.set("name",b.name),b!=null&&b.email&&E.set("email",b.email),y!=null&&y.start_time&&E.set("start_time",(new Date(y.start_time).getTime()/1e3).toString()),y!=null&&y.end_time&&E.set("end_time",(new Date(y.end_time).getTime()/1e3).toString()),C&&E.set("tz",C),U&&E.set("language",U),F&&E.set("additional_values",JSON.stringify(F)),this.slug&&E.set("page_slug",this.slug),j&&E.set("config_id",j),S&&E.set("location",S),A&&E.set("booking_ref",A),this.redirectToCustomUrl(`${m}?${E.toString()}`);return}if(n&&t)return i.h(i.Host,null,i.h(P,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},i.h("div",{class:"booked-event-page",part:"booked-event-page ns_booked-event-page"},i.h("nylas-booked-event-card",{selectedTimeslot:r,eventInfo:t,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:b=>this.onFeedbackClick(b)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null));if(n&&(!t||l)&&!o){const b=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return i.h(i.Host,null,i.h(P,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},l&&i.h(W,null,`${i.instance.t("rescheduleTitle")}`),i.h("div",{class:"select-date-page",part:"select-date-page ns_select-date-page"},i.h("div",{class:"left-panel",part:"ns_left-panel"},i.h("nylas-date-picker",{exportparts:"ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),i.h("nylas-locale-switch",{exportparts:"nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label"})),i.h("div",{class:`right-panel ${l?"reschedule":""}`,part:`ns_right-panel ${l?"ns_reschedule":""}`},i.h("h2",{part:"ns_right-panel__title"},i.h("calendar-icon",{part:"ns_right-panel__calendar-icon"}),i.h("span",{id:"selectedDate",part:"ns_right-panel__selected-date"},this.selectedDateLabel)),i.h("nylas-timeslot-picker",{exportparts:"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},b&&i.h("span",{slot:"timeslot-picker-cta-label"},i.h("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:S=>this.onFeedbackClick(S)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null))}return n&&!t&&o?i.h(i.Host,null,i.h(P,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},l&&i.h(W,null,`${i.instance.t("rescheduleTitle")}`),i.h("div",{class:"additional-data-page",part:"additional-data-page ns_additional-data-page"},i.h("div",{class:"left-panel ns_left-panel",part:"ns_left-panel"},i.h("div",{class:"wrapper",part:"ns_left-panel__wrapper"},i.h("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),i.h("div",{class:`right-panel ${l?"reschedule":""}`,part:`ns_right-panel ${l?"ns_reschedule":""}`},i.h("nylas-booking-form",{exportparts:"nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content"})))),this.enableUserFeedback&&i.h("button-component",{id:"report-issue",variant:"basic",onClick:b=>this.onFeedbackClick(b)},i.h("feedback-icon",null)),this.showFeedbackModal&&i.h("nylas-feedback-form",null)):i.h(i.Host,null,i.h("slot",null))}get host(){return i.getElement(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],themeConfig:["themeConfigChanged"]}}};J.style=te;exports.nylas_scheduling=J;