@nylas/react 2.0.6 → 2.1.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 (176) hide show
  1. package/dist/add-circle-icon_2.entry-8c3bb0bb.cjs +1 -0
  2. package/dist/{add-circle-icon_2.entry-f6f8b5e5.js → add-circle-icon_2.entry-a3daf6c4.js} +6 -4
  3. package/dist/archive-icon.entry-46ad0ff3.cjs +1 -0
  4. package/dist/{archive-icon.entry-b3a76711.js → archive-icon.entry-d5141486.js} +6 -4
  5. package/dist/{arrow-icon.entry-9b3441aa.js → arrow-icon.entry-1b89ce78.js} +6 -4
  6. package/dist/arrow-icon.entry-f696de4f.cjs +1 -0
  7. package/dist/bold-icon.entry-7827cd4e.cjs +1 -0
  8. package/dist/{bold-icon.entry-0749a116.js → bold-icon.entry-c117b4cf.js} +6 -4
  9. package/dist/button-component_2.entry-8cd4c5f3.cjs +1 -0
  10. package/dist/{button-component_2.entry-6eb55e97.js → button-component_2.entry-e68caa9b.js} +5 -3
  11. package/dist/{calendar-agenda-fill-icon_37.entry-4adf73a2.js → calendar-agenda-fill-icon_37.entry-52bdc8b3.js} +201 -198
  12. package/dist/calendar-agenda-fill-icon_37.entry-8c592cfa.cjs +6 -0
  13. package/dist/calendar-cancel-icon.entry-7facfa05.cjs +1 -0
  14. package/dist/{calendar-cancel-icon.entry-2a29cb3f.js → calendar-cancel-icon.entry-f5f1d499.js} +8 -6
  15. package/dist/{calendar-check-icon.entry-c12b63ea.js → calendar-check-icon.entry-55320137.js} +6 -4
  16. package/dist/calendar-check-icon.entry-72108702.cjs +1 -0
  17. package/dist/{calendar-icon.entry-e82a5169.js → calendar-icon.entry-afea361e.js} +9 -7
  18. package/dist/calendar-icon.entry-f5c6730f.cjs +1 -0
  19. package/dist/checkbox-component.entry-5722d263.cjs +1 -0
  20. package/dist/{checkbox-component.entry-59612a67.js → checkbox-component.entry-89fa6edd.js} +3 -1
  21. package/dist/checkbox-group_4.entry-30e8af17.cjs +28 -0
  22. package/dist/{checkbox-group_4.entry-7df47ad4.js → checkbox-group_4.entry-51f03009.js} +6 -3
  23. package/dist/checkmark-circle-icon.entry-ae11049d.cjs +1 -0
  24. package/dist/{checkmark-circle-icon.entry-677b0def.js → checkmark-circle-icon.entry-dfe67e22.js} +8 -6
  25. package/dist/{checkmark-icon_15.entry-9fd0ec58.js → checkmark-icon_15.entry-4c3979db.js} +21 -18
  26. package/dist/checkmark-icon_15.entry-e59c0f53.cjs +5 -0
  27. package/dist/{chevron-icon_3.entry-f0ad71d9.js → chevron-icon_3.entry-1f3c3ca6.js} +3 -1
  28. package/dist/chevron-icon_3.entry-ea791750.cjs +1 -0
  29. package/dist/clock-icon_4.entry-172fed74.cjs +1 -0
  30. package/dist/{clock-icon_4.entry-e7472d5f.js → clock-icon_4.entry-78878cb8.js} +3 -1
  31. package/dist/customParseFormat-b5d95b34-a6b6fcba.cjs +1 -0
  32. package/dist/{customParseFormat-eeec04f5-3ad26beb.js → customParseFormat-b5d95b34-ce80820c.js} +1 -1
  33. package/dist/delete-icon.entry-a8c0bf03.cjs +1 -0
  34. package/dist/{delete-icon.entry-813429d7.js → delete-icon.entry-cebdc90f.js} +7 -5
  35. package/dist/document-refresh-icon.entry-2d9a529d.cjs +1 -0
  36. package/dist/{document-refresh-icon.entry-c224c778.js → document-refresh-icon.entry-8780a2b8.js} +3 -1
  37. package/dist/{feedbackSync-0ebd0eda-e12b00d5.cjs → feedbackSync-92220b42-fbebe1f9.cjs} +1 -1
  38. package/dist/{feedbackSync-0ebd0eda-803c3ebe.js → feedbackSync-92220b42-fd5f5610.js} +1 -1
  39. package/dist/folder-icon.entry-3e61ccca.cjs +1 -0
  40. package/dist/{folder-icon.entry-9c1f7c41.js → folder-icon.entry-6ffd5191.js} +6 -4
  41. package/dist/forward-icon.entry-c7d88db8.cjs +1 -0
  42. package/dist/{forward-icon.entry-4ac22c16.js → forward-icon.entry-c9c4bf5b.js} +5 -3
  43. package/dist/globe-icon.entry-0b93cab8.cjs +1 -0
  44. package/dist/{globe-icon.entry-7798c93b.js → globe-icon.entry-7c0dca7b.js} +5 -3
  45. package/dist/{google-logo-icon_6.entry-b198c90a.js → google-logo-icon_6.entry-deef91ee.js} +177 -174
  46. package/dist/google-logo-icon_6.entry-e25ce3e7.cjs +2 -0
  47. package/dist/google-meet-icon_5.entry-214347f0.cjs +1 -0
  48. package/dist/{google-meet-icon_5.entry-fa6dc1dc.js → google-meet-icon_5.entry-f8b5a92a.js} +3 -1
  49. package/dist/{inbox-icon.entry-1b123e64.js → inbox-icon.entry-873062c3.js} +7 -5
  50. package/dist/inbox-icon.entry-f08f2fd5.cjs +1 -0
  51. package/dist/index-025be398.js +7187 -0
  52. package/dist/index-c510313d-1318f67a.js +289 -0
  53. package/dist/index-c510313d-b0508eee.cjs +1 -0
  54. package/dist/index-f42fe591.cjs +65 -0
  55. package/dist/{index.es-57d4a08f-b0a2ca19.cjs → index.es-488bc919-d02dd50a.cjs} +1 -1
  56. package/dist/{index.es-57d4a08f-184cbc01.js → index.es-488bc919-ea63a7e9.js} +1 -1
  57. package/dist/info-icon_2.entry-442b9097.cjs +1 -0
  58. package/dist/{info-icon_2.entry-f8b72d08.js → info-icon_2.entry-60fb8648.js} +3 -1
  59. package/dist/{input-component.entry-44607977.js → input-component.entry-5898a52e.js} +19 -16
  60. package/dist/input-component.entry-7274fd28.cjs +1 -0
  61. package/dist/{input-dropdown_2.entry-6898b420.js → input-dropdown_2.entry-4534436c.js} +4 -1
  62. package/dist/input-dropdown_2.entry-9b72f637.cjs +1 -0
  63. package/dist/{italic-icon.entry-16aa1ada.js → italic-icon.entry-62052cd8.js} +6 -4
  64. package/dist/italic-icon.entry-9bdbbd37.cjs +1 -0
  65. package/dist/lib/connect/index.d.ts +6 -0
  66. package/dist/lib/connect/types.d.ts +2 -0
  67. package/dist/lib/connect/useNylasConnect.d.ts +28 -0
  68. package/dist/lib/connect/useNylasConnect.test.d.ts +1 -0
  69. package/dist/lib/elements/index.d.ts +1 -1
  70. package/dist/lib/index.d.ts +1 -0
  71. package/dist/multi-select-dropdown.entry-77752d46.cjs +1 -0
  72. package/dist/{multi-select-dropdown.entry-50133d29.js → multi-select-dropdown.entry-9c9d05c1.js} +4 -1
  73. package/dist/{nylas-booked-event-card_11.entry-56768a09.js → nylas-booked-event-card_11.entry-32b2e9f1.js} +139 -136
  74. package/dist/nylas-booked-event-card_11.entry-4aba5146.cjs +1 -0
  75. package/dist/nylas-date-component_2.entry-6b058796.cjs +1 -0
  76. package/dist/{nylas-date-component_2.entry-df957150.js → nylas-date-component_2.entry-a869519f.js} +10 -7
  77. package/dist/{nylas-form-card.entry-7724e61f.js → nylas-form-card.entry-5390459f.js} +9 -6
  78. package/dist/nylas-form-card.entry-c2f34d73.cjs +1 -0
  79. package/dist/nylas-notification_2.entry-054392cf.cjs +1 -0
  80. package/dist/{nylas-notification_2.entry-af763b6c.js → nylas-notification_2.entry-f46e88e5.js} +4 -1
  81. package/dist/{nylas-scheduler-editor.entry-0e4ba46d.js → nylas-scheduler-editor.entry-40a48f47.js} +93 -35
  82. package/dist/nylas-scheduler-editor.entry-e29fdf07.cjs +2 -0
  83. package/dist/{nylas-scheduling.entry-1b207e91.js → nylas-scheduling.entry-115b1752.js} +17 -14
  84. package/dist/nylas-scheduling.entry-79cb1d9c.cjs +1 -0
  85. package/dist/person-icon.entry-2cae306c.cjs +1 -0
  86. package/dist/{person-icon.entry-f2979577.js → person-icon.entry-fd668b89.js} +6 -4
  87. package/dist/{play-icon.entry-d387df5d.js → play-icon.entry-7fc3c0fd.js} +5 -3
  88. package/dist/play-icon.entry-9989a520.cjs +1 -0
  89. package/dist/radio-button-group.entry-03385b5f.cjs +1 -0
  90. package/dist/{radio-button-group.entry-45dbd2df.js → radio-button-group.entry-9df82cd0.js} +7 -5
  91. package/dist/react.cjs +1 -1
  92. package/dist/react.js +142 -127
  93. package/dist/refresh-icon.entry-310954ba.cjs +1 -0
  94. package/dist/{refresh-icon.entry-777cff27.js → refresh-icon.entry-c56e5623.js} +8 -6
  95. package/dist/register-component-3acd57e7-5a79a90a.cjs +1 -0
  96. package/dist/{register-component-0aad9e3d-b395364a.js → register-component-3acd57e7-cb09c05e.js} +15 -14
  97. package/dist/{reply-all-icon.entry-e2dd6da9.js → reply-all-icon.entry-32e0e000.js} +7 -5
  98. package/dist/reply-all-icon.entry-68388f97.cjs +1 -0
  99. package/dist/{reply-icon.entry-00a97d9f.js → reply-icon.entry-3ac2e736.js} +6 -4
  100. package/dist/reply-icon.entry-e616a9a4.cjs +1 -0
  101. package/dist/{sent-icon.entry-949cf214.js → sent-icon.entry-0622ed04.js} +6 -4
  102. package/dist/sent-icon.entry-543eb3c4.cjs +1 -0
  103. package/dist/{spam-icon.entry-3baf9e79.js → spam-icon.entry-74bcfd4f.js} +3 -1
  104. package/dist/spam-icon.entry-e341ee3e.cjs +1 -0
  105. package/dist/{star-icon.entry-9fdb278b.js → star-icon.entry-864d2bf9.js} +5 -3
  106. package/dist/star-icon.entry-c90d40f6.cjs +1 -0
  107. package/dist/{stop-icon.entry-efa1ea66.js → stop-icon.entry-835908c5.js} +3 -1
  108. package/dist/stop-icon.entry-ffc46b42.cjs +1 -0
  109. package/dist/{textarea-component.entry-7c6fc4d8.js → textarea-component.entry-6adcf6a6.js} +12 -9
  110. package/dist/textarea-component.entry-dae8eb5c.cjs +1 -0
  111. package/dist/toggle-switch.entry-5ee29867.cjs +1 -0
  112. package/dist/{toggle-switch.entry-a0295d17.js → toggle-switch.entry-ff2ccb75.js} +7 -5
  113. package/dist/{translate-icon.entry-219cab17.js → translate-icon.entry-372dd808.js} +3 -1
  114. package/dist/translate-icon.entry-5606067d.cjs +1 -0
  115. package/dist/{trash-fill-icon.entry-03c90559.js → trash-fill-icon.entry-01b4379e.js} +3 -1
  116. package/dist/trash-fill-icon.entry-daed6c0a.cjs +1 -0
  117. package/dist/underline-icon.entry-2020ee64.cjs +1 -0
  118. package/dist/{underline-icon.entry-58fa18b5.js → underline-icon.entry-464b900d.js} +5 -3
  119. package/dist/utils-31933f5d-15041585.js +17878 -0
  120. package/dist/utils-31933f5d-1d4c81ab.cjs +54 -0
  121. package/package.json +4 -3
  122. package/dist/abstract-provider-45ada3b4-31e3ed72.cjs +0 -1
  123. package/dist/abstract-provider-45ada3b4-abd3105d.js +0 -187
  124. package/dist/add-circle-icon_2.entry-48953f9c.cjs +0 -1
  125. package/dist/archive-icon.entry-e2880dc7.cjs +0 -1
  126. package/dist/arrow-icon.entry-84d1e26c.cjs +0 -1
  127. package/dist/bold-icon.entry-e1d8ab5e.cjs +0 -1
  128. package/dist/button-component_2.entry-1a817230.cjs +0 -1
  129. package/dist/calendar-agenda-fill-icon_37.entry-0ca8b9f4.cjs +0 -6
  130. package/dist/calendar-cancel-icon.entry-e0dee585.cjs +0 -1
  131. package/dist/calendar-check-icon.entry-7f96d456.cjs +0 -1
  132. package/dist/calendar-icon.entry-a2d19ff2.cjs +0 -1
  133. package/dist/checkbox-component.entry-ddce70bc.cjs +0 -1
  134. package/dist/checkbox-group_4.entry-3311da64.cjs +0 -28
  135. package/dist/checkmark-circle-icon.entry-67df713b.cjs +0 -1
  136. package/dist/checkmark-icon_15.entry-2121e1b7.cjs +0 -5
  137. package/dist/chevron-icon_3.entry-1a42235c.cjs +0 -1
  138. package/dist/clock-icon_4.entry-88822a84.cjs +0 -1
  139. package/dist/customParseFormat-eeec04f5-d5957784.cjs +0 -1
  140. package/dist/delete-icon.entry-3cb58910.cjs +0 -1
  141. package/dist/document-refresh-icon.entry-ae361b0b.cjs +0 -1
  142. package/dist/folder-icon.entry-107841af.cjs +0 -1
  143. package/dist/forward-icon.entry-6cec1f94.cjs +0 -1
  144. package/dist/globe-icon.entry-909c1382.cjs +0 -1
  145. package/dist/google-logo-icon_6.entry-1f4ad364.cjs +0 -2
  146. package/dist/google-meet-icon_5.entry-82d87e77.cjs +0 -1
  147. package/dist/inbox-icon.entry-84f96d31.cjs +0 -1
  148. package/dist/index-140eb219.js +0 -24953
  149. package/dist/index-d8a42c15.cjs +0 -118
  150. package/dist/info-icon_2.entry-f09e7dae.cjs +0 -1
  151. package/dist/input-component.entry-fd38953d.cjs +0 -1
  152. package/dist/input-dropdown_2.entry-4c2e5e1a.cjs +0 -1
  153. package/dist/italic-icon.entry-beef2254.cjs +0 -1
  154. package/dist/multi-select-dropdown.entry-c82cd6d4.cjs +0 -1
  155. package/dist/nylas-booked-event-card_11.entry-eb4b3c5c.cjs +0 -1
  156. package/dist/nylas-date-component_2.entry-93f2f352.cjs +0 -1
  157. package/dist/nylas-form-card.entry-4d95a4ad.cjs +0 -1
  158. package/dist/nylas-notification_2.entry-448c2cb8.cjs +0 -1
  159. package/dist/nylas-scheduler-editor.entry-e36cdd9d.cjs +0 -2
  160. package/dist/nylas-scheduling.entry-904dd10e.cjs +0 -1
  161. package/dist/person-icon.entry-70d46ca6.cjs +0 -1
  162. package/dist/play-icon.entry-c2cf0b12.cjs +0 -1
  163. package/dist/radio-button-group.entry-94e06176.cjs +0 -1
  164. package/dist/refresh-icon.entry-5ab20f26.cjs +0 -1
  165. package/dist/register-component-0aad9e3d-d2f2e543.cjs +0 -1
  166. package/dist/reply-all-icon.entry-3c90510e.cjs +0 -1
  167. package/dist/reply-icon.entry-d96478be.cjs +0 -1
  168. package/dist/sent-icon.entry-2d16da4e.cjs +0 -1
  169. package/dist/spam-icon.entry-7ee61730.cjs +0 -1
  170. package/dist/star-icon.entry-dc702d73.cjs +0 -1
  171. package/dist/stop-icon.entry-b5ae7e55.cjs +0 -1
  172. package/dist/textarea-component.entry-247aca42.cjs +0 -1
  173. package/dist/toggle-switch.entry-d52b0338.cjs +0 -1
  174. package/dist/translate-icon.entry-985b3b29.cjs +0 -1
  175. package/dist/trash-fill-icon.entry-4dfd7d24.cjs +0 -1
  176. package/dist/underline-icon.entry-c60b77a6.cjs +0 -1
@@ -1,13 +1,71 @@
1
1
  var le = Object.defineProperty;
2
2
  var ce = (r, t, n) => t in r ? le(r, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[t] = n;
3
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-140eb219.js";
5
- import { N as NylasBaseProvider } from "./abstract-provider-45ada3b4-abd3105d.js";
6
- import { X as Xr } from "./index.es-57d4a08f-184cbc01.js";
4
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement, F as Fragment } from "./index-025be398.js";
5
+ import { N as NylasBaseProvider, c as createStore } from "./index-c510313d-1318f67a.js";
6
+ import { d as dataResponse, a as dayjs, u as utc, t as timezone, p as process, c as commonjsGlobal, b as debug, i as instance, B as Buffer, g as getCalendarRange } from "./utils-31933f5d-15041585.js";
7
+ import { X as Xr } from "./index.es-488bc919-ea63a7e9.js";
7
8
  import { L as LANGUAGE_CODE, a as LANGUAGE_MAP, C as CONFIGURATION_EVENT_TYPE } from "./constants-f51538ef-e0a5f026.js";
9
+ import "@nylas/web-elements";
8
10
  import "react";
11
+ import "@nylas/connect";
9
12
  import "react/jsx-runtime";
10
13
  import "react-dom";
14
+ class NylasIdentityRequestWrapper {
15
+ constructor(t) {
16
+ this.defaultAuthArgs = [], this.session = t;
17
+ }
18
+ setActiveGrantId(t) {
19
+ this.activeGrantId = t;
20
+ }
21
+ async request({ method: t, path: n, body: s, headers: a }) {
22
+ try {
23
+ const l = await this.session.fetch(`grants/me/${n}`, {
24
+ method: t,
25
+ headers: a ? new Headers(a) : void 0,
26
+ body: s,
27
+ ...this.session.isMultiAccount() && this.activeGrantId ? { grant_id: this.activeGrantId } : {}
28
+ });
29
+ if (typeof l > "u")
30
+ throw new Error("Response is undefined");
31
+ return dataResponse(l);
32
+ } catch (l) {
33
+ let d = String(l);
34
+ return String(l).includes("Access token not found") && (d = "Session expired, please log in again. Redirecting...", setTimeout(() => {
35
+ localStorage.removeItem("grant"), localStorage.removeItem("user"), window.location.reload();
36
+ }, 1e3)), dataResponse(null, {
37
+ message: d
38
+ });
39
+ }
40
+ }
41
+ async currentUser() {
42
+ const t = this.session.isMultiAccount() ? this.activeGrantId : void 0, n = await this.session.getProfile(t);
43
+ if (await this.session.isLoggedIn()) {
44
+ const a = (await this.session.fetch("grants/me", {
45
+ method: "GET",
46
+ ...this.session.isMultiAccount() && this.activeGrantId ? { grant_id: this.activeGrantId } : {}
47
+ })).data;
48
+ if (!n || !a)
49
+ return null;
50
+ const l = a.email;
51
+ return {
52
+ id: n.sub,
53
+ email: l,
54
+ name: n.name,
55
+ provider: n.provider
56
+ };
57
+ }
58
+ return null;
59
+ }
60
+ async authenticationUrl(t) {
61
+ const n = (t == null ? void 0 : t.provider) || "google";
62
+ let a = this.defaultAuthArgs.find((l) => l.provider === n) || {};
63
+ return t && (a = { ...a, ...t }), this.session.auth(a);
64
+ }
65
+ setDefaultAuthArgs(t) {
66
+ this.defaultAuthArgs = t;
67
+ }
68
+ }
11
69
  dayjs.extend(utc);
12
70
  dayjs.extend(timezone);
13
71
  class NylasSchedulerConfigAPIConnector {
@@ -235,9 +293,9 @@ class NylasSchedulerConfigAPIConnector {
235
293
  })) : (this.nylasSchedulerConfigStore.state.selectedGroupEvent = a.data, await this.getGroupEvents(n, this.nylasSchedulerConfigStore.state.selectedConfiguration), this.nylasSchedulerConfigStore.state.isLoading = !1, dataResponse(a.data));
236
294
  }
237
295
  async updateGroupEvent(t, n, s) {
238
- var p, m, y, w, _, x, R, A, k, U, N, O, I, T;
296
+ var p, m, y, w, v, x, R, A, I, U, N, O, k, T;
239
297
  this.nylasSchedulerConfigStore.state.isLoading = !0;
240
- const a = this.nylasSchedulerConfigStore.state.selectedGroupEvent, l = (p = a == null ? void 0 : a.event) == null ? void 0 : p.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(";") : "", g = c ? dayjs(c * 1e3).subtract(1, "minute").format("YYYYMMDDTHHmmss[Z]") : "";
298
+ const a = this.nylasSchedulerConfigStore.state.selectedGroupEvent, l = (p = a == null ? void 0 : a.event) == null ? void 0 : p.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 = (v = a == null ? void 0 : a.group_event_info) == null ? void 0 : v.rrule) == null ? void 0 : x[0], f = u ? u.split(";").filter((S) => !S.startsWith("UNTIL")).join(";") : "", g = c ? dayjs(c * 1e3).subtract(1, "minute").format("YYYYMMDDTHHmmss[Z]") : "";
241
299
  if (n === "this")
242
300
  return this.updateGroupEventById({
243
301
  ...t,
@@ -245,32 +303,32 @@ class NylasSchedulerConfigAPIConnector {
245
303
  recurrence: l ? void 0 : t.recurrence
246
304
  }, s);
247
305
  if (n === "future" && l) {
248
- const S = await this.createGroupEvent(t, s), v = {
306
+ const S = await this.createGroupEvent(t, s), _ = {
249
307
  location: (R = a == null ? void 0 : a.event) == null ? void 0 : R.location,
250
308
  conferencing: (A = a == null ? void 0 : a.event) == null ? void 0 : A.conferencing,
251
- title: (k = a == null ? void 0 : a.event) == null ? void 0 : k.title,
309
+ title: (I = a == null ? void 0 : a.event) == null ? void 0 : I.title,
252
310
  description: (U = a == null ? void 0 : a.event) == null ? void 0 : U.description,
253
311
  capacity: (N = a == null ? void 0 : a.group_event_info) == null ? void 0 : N.capacity,
254
312
  calendar_id: (O = a == null ? void 0 : a.event) == null ? void 0 : O.calendar_id,
255
313
  recurrence: f ? [f + ";UNTIL=" + g] : [`RRULE:FREQ=DAILY;UNTIL=${g}`]
256
314
  };
257
315
  return await this.updateGroupEventById({
258
- ...v,
316
+ ..._,
259
317
  id: l
260
- }, s), [v, S];
318
+ }, s), [_, S];
261
319
  } else if (n === "all") {
262
- 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];
320
+ const S = t == null ? void 0 : t.when, _ = (k = a == null ? void 0 : a.event) == null ? void 0 : k.when, L = (T = this.nylasSchedulerConfigStore.state.masterGroupEvents) == null ? void 0 : T[l];
263
321
  let b = L == null ? void 0 : L.when;
264
- return (S == null ? void 0 : S.start_time) !== (v == null ? void 0 : v.start_time) && (b = {
322
+ return (S == null ? void 0 : S.start_time) !== (_ == null ? void 0 : _.start_time) && (b = {
265
323
  ...b,
266
324
  start_time: (S == null ? void 0 : S.start_time) || (b == null ? void 0 : b.start_time)
267
- }), (S == null ? void 0 : S.end_time) !== (v == null ? void 0 : v.end_time) && (b = {
325
+ }), (S == null ? void 0 : S.end_time) !== (_ == null ? void 0 : _.end_time) && (b = {
268
326
  ...b,
269
327
  end_time: (S == null ? void 0 : S.end_time) || (b == null ? void 0 : b.end_time)
270
- }), (S == null ? void 0 : S.start_timezone) !== (v == null ? void 0 : v.start_timezone) && (b = {
328
+ }), (S == null ? void 0 : S.start_timezone) !== (_ == null ? void 0 : _.start_timezone) && (b = {
271
329
  ...b,
272
330
  start_timezone: (S == null ? void 0 : S.start_timezone) || (b == null ? void 0 : b.start_timezone)
273
- }), (S == null ? void 0 : S.end_timezone) !== (v == null ? void 0 : v.end_timezone) && (b = {
331
+ }), (S == null ? void 0 : S.end_timezone) !== (_ == null ? void 0 : _.end_timezone) && (b = {
274
332
  ...b,
275
333
  end_timezone: (S == null ? void 0 : S.end_timezone) || (b == null ? void 0 : b.end_timezone)
276
334
  }), this.updateGroupEventById({
@@ -282,15 +340,15 @@ class NylasSchedulerConfigAPIConnector {
282
340
  throw this.nylasSchedulerConfigStore.state.isLoading = !1, new Error("Invalid option");
283
341
  }
284
342
  async deleteGroupEvent(t, n, s) {
285
- var m, y, w, _, x, R, A, k, U, N, O, I;
343
+ var m, y, w, v, x, R, A, I, U, N, O, k;
286
344
  this.nylasSchedulerConfigStore.state.isLoading = !0;
287
- 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(";") : "", g = c ? dayjs(c * 1e3).format("YYYYMMDDTHHmmss[Z]") : "", p = {
345
+ 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 = (v = (w = a == null ? void 0 : a.event) == null ? void 0 : w.when) == null ? void 0 : v.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(";") : "", g = c ? dayjs(c * 1e3).format("YYYYMMDDTHHmmss[Z]") : "", p = {
288
346
  location: (A = a == null ? void 0 : a.event) == null ? void 0 : A.location,
289
- conferencing: (k = a == null ? void 0 : a.event) == null ? void 0 : k.conferencing,
347
+ conferencing: (I = a == null ? void 0 : a.event) == null ? void 0 : I.conferencing,
290
348
  title: (U = a == null ? void 0 : a.event) == null ? void 0 : U.title,
291
349
  description: (N = a == null ? void 0 : a.event) == null ? void 0 : N.description,
292
350
  capacity: (O = a == null ? void 0 : a.group_event_info) == null ? void 0 : O.capacity,
293
- calendar_id: (I = a == null ? void 0 : a.event) == null ? void 0 : I.calendar_id,
351
+ calendar_id: (k = a == null ? void 0 : a.event) == null ? void 0 : k.calendar_id,
294
352
  recurrence: f ? [f + ";UNTIL=" + g] : [`RRULE:UNTIL=${g}`]
295
353
  };
296
354
  if (n === "this" && d)
@@ -714,11 +772,11 @@ var sha256 = { exports: {} };
714
772
  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();
715
773
  }
716
774
  }, Sha256.prototype.hash = function() {
717
- 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, g, p, m, y, w, _, x, R, A, k;
775
+ 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, g, p, m, y, w, v, x, R, A, I;
718
776
  for (f = 16; f < 64; ++f)
719
777
  y = u[f - 15], g = (y >>> 7 | y << 25) ^ (y >>> 18 | y << 14) ^ y >>> 3, y = u[f - 2], p = (y >>> 17 | y << 15) ^ (y >>> 19 | y << 13) ^ y >>> 10, u[f] = u[f - 16] + g + u[f - 7] + p << 0;
720
- for (k = t & n, f = 0; f < 64; f += 4)
721
- 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) : (g = (r >>> 2 | r << 30) ^ (r >>> 13 | r << 19) ^ (r >>> 22 | r << 10), p = (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 + p + _ + K[f] + u[f], w = g + m, c = s + y << 0, s = y + w << 0), g = (s >>> 2 | s << 30) ^ (s >>> 13 | s << 19) ^ (s >>> 22 | s << 10), p = (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 + p + _ + K[f + 1] + u[f + 1], w = g + m, d = n + y << 0, n = y + w << 0, g = (n >>> 2 | n << 30) ^ (n >>> 13 | n << 19) ^ (n >>> 22 | n << 10), p = (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 + p + _ + K[f + 2] + u[f + 2], w = g + m, l = t + y << 0, t = y + w << 0, g = (t >>> 2 | t << 30) ^ (t >>> 13 | t << 19) ^ (t >>> 22 | t << 10), p = (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 + p + _ + K[f + 3] + u[f + 3], w = g + m, a = r + y << 0, r = y + w << 0;
778
+ for (I = t & n, f = 0; f < 64; f += 4)
779
+ 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) : (g = (r >>> 2 | r << 30) ^ (r >>> 13 | r << 19) ^ (r >>> 22 | r << 10), p = (a >>> 6 | a << 26) ^ (a >>> 11 | a << 21) ^ (a >>> 25 | a << 7), x = r & t, m = x ^ r & n ^ I, v = a & l ^ ~a & d, y = c + p + v + K[f] + u[f], w = g + m, c = s + y << 0, s = y + w << 0), g = (s >>> 2 | s << 30) ^ (s >>> 13 | s << 19) ^ (s >>> 22 | s << 10), p = (c >>> 6 | c << 26) ^ (c >>> 11 | c << 21) ^ (c >>> 25 | c << 7), R = s & r, m = R ^ s & t ^ x, v = c & a ^ ~c & l, y = d + p + v + K[f + 1] + u[f + 1], w = g + m, d = n + y << 0, n = y + w << 0, g = (n >>> 2 | n << 30) ^ (n >>> 13 | n << 19) ^ (n >>> 22 | n << 10), p = (d >>> 6 | d << 26) ^ (d >>> 11 | d << 21) ^ (d >>> 25 | d << 7), A = n & s, m = A ^ n & r ^ R, v = d & c ^ ~d & a, y = l + p + v + K[f + 2] + u[f + 2], w = g + m, l = t + y << 0, t = y + w << 0, g = (t >>> 2 | t << 30) ^ (t >>> 13 | t << 19) ^ (t >>> 22 | t << 10), p = (l >>> 6 | l << 26) ^ (l >>> 11 | l << 21) ^ (l >>> 25 | l << 7), I = t & n, m = I ^ t & s ^ A, v = l & d ^ ~l & c, y = a + p + v + K[f + 3] + u[f + 3], w = g + m, a = r + y << 0, r = y + w << 0;
722
780
  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;
723
781
  }, Sha256.prototype.hex = function() {
724
782
  this.finalize();
@@ -915,32 +973,32 @@ function fetchEventSource(r, t) {
915
973
  const y = Object.assign({}, s);
916
974
  y.accept || (y.accept = EventStreamContentType);
917
975
  let w;
918
- function _() {
976
+ function v() {
919
977
  w.abort(), document.hidden || N();
920
978
  }
921
- u || document.addEventListener("visibilitychange", _);
979
+ u || document.addEventListener("visibilitychange", v);
922
980
  let x = DefaultRetryInterval, R = 0;
923
981
  function A() {
924
- document.removeEventListener("visibilitychange", _), window.clearTimeout(R), w.abort();
982
+ document.removeEventListener("visibilitychange", v), window.clearTimeout(R), w.abort();
925
983
  }
926
984
  n == null || n.addEventListener("abort", () => {
927
985
  A(), p();
928
986
  });
929
- const k = f ?? window.fetch, U = a ?? defaultOnOpen;
987
+ const I = f ?? window.fetch, U = a ?? defaultOnOpen;
930
988
  async function N() {
931
989
  var O;
932
990
  w = new AbortController();
933
991
  try {
934
- const I = await k(r, Object.assign(Object.assign({}, g), { headers: y, signal: w.signal }));
935
- await U(I), await getBytes(I.body, getLines(getMessages((T) => {
992
+ const k = await I(r, Object.assign(Object.assign({}, g), { headers: y, signal: w.signal }));
993
+ await U(k), await getBytes(k.body, getLines(getMessages((T) => {
936
994
  T ? y[LastEventId] = T : delete y[LastEventId];
937
995
  }, (T) => {
938
996
  x = T;
939
997
  }, l))), d == null || d(), A(), p();
940
- } catch (I) {
998
+ } catch (k) {
941
999
  if (!w.signal.aborted)
942
1000
  try {
943
- const T = (O = c == null ? void 0 : c(I)) !== null && O !== void 0 ? O : x;
1001
+ const T = (O = c == null ? void 0 : c(k)) !== null && O !== void 0 ? O : x;
944
1002
  window.clearTimeout(R), R = window.setTimeout(N, T);
945
1003
  } catch (T) {
946
1004
  A(), m(T);
@@ -1629,7 +1687,7 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
1629
1687
  max_fairness: !0,
1630
1688
  max_availability: !0,
1631
1689
  group: !0
1632
- }, this.themeConfig = void 0, this.automaticComponentRegistration = !0, this.selectedLanguage = this.defaultLanguage || LANGUAGE_CODE.en, this.langVersion = 0, this.version = "2.0.6";
1690
+ }, this.themeConfig = void 0, this.automaticComponentRegistration = !0, this.selectedLanguage = this.defaultLanguage || LANGUAGE_CODE.en, this.langVersion = 0, this.version = "2.1.0";
1633
1691
  }
1634
1692
  connectedCallback() {
1635
1693
  debug("[nylas-scheduler-editor] connectedCallback");
@@ -1665,8 +1723,8 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
1665
1723
  var y, w;
1666
1724
  const m = await ((w = (y = this.nylasSchedulerConfigConnector) == null ? void 0 : y.schedulerConfig) == null ? void 0 : w.currentUser());
1667
1725
  if (m) {
1668
- const _ = this.loggedIn.emit(this.host);
1669
- "loggedIn" in this.eventOverrides && await this.eventOverrides.loggedIn(_, this.nylasSchedulerConfigConnector), _.defaultPrevented || await this.loggedInHandler(m);
1726
+ const v = this.loggedIn.emit(this.host);
1727
+ "loggedIn" in this.eventOverrides && await this.eventOverrides.loggedIn(v, this.nylasSchedulerConfigConnector), v.defaultPrevented || await this.loggedInHandler(m);
1670
1728
  }
1671
1729
  }), p.onLoginFail(async () => {
1672
1730
  var y, w;
@@ -1700,7 +1758,7 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
1700
1758
  }
1701
1759
  async componentDidLoad() {
1702
1760
  var r;
1703
- debug("[nylas-scheduler-editor] componentDidLoad"), await ((r = this.baseProvider) == null ? void 0 : r.componentDidLoad()), this.updateLocalization(this.localization), this.version = "2.0.6";
1761
+ debug("[nylas-scheduler-editor] componentDidLoad"), await ((r = this.baseProvider) == null ? void 0 : r.componentDidLoad()), this.updateLocalization(this.localization), this.version = "2.1.0";
1704
1762
  }
1705
1763
  async componentDisconnected() {
1706
1764
  var r;
@@ -1764,7 +1822,7 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
1764
1822
  }
1765
1823
  }
1766
1824
  render() {
1767
- var a, l, d, c, u, f, g, p, 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;
1825
+ var a, l, d, c, u, f, g, p, m, y, w, v, x, R, A, I, U, N, O, k, T, S, _, L, b, $, X, j, z, Y, M, V, J, W, Z, Q, ee, te, ne, se, re, ie, oe, ae;
1768
1826
  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) => ({
1769
1827
  label: LANGUAGE_MAP[q],
1770
1828
  value: q
@@ -1774,7 +1832,7 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
1774
1832
  }, part: "nse__language" }, h("select-dropdown", { key: "9f788d9d39f2a190ef388cacca206374e19da11c", name: "language", searchPlaceholder: instance.t("search"), options: n, withChevron: !1, themeConfig: this.themeConfig, 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: "76aa9b5b9adea974e1e8a7ac1f47faee3fc8a320", slot: "select-icon" }, h("translate-icon", { key: "9dd3b210004d04b42c3d0209db60414c6c86c54c", width: "20", height: "20" })))), h("button", { key: "fa401a8ffb5f77caae60852e7a7be15f21868002", class: "scheduler-editor-close", title: "logout", onClick: (q) => this.handleSchedulerConfigCloseClicked(q), part: "nse__close-button" }, h("close-icon", { key: "96135ba113ecdad2d3223cc8df293d46b62565e5", width: "18", height: "18" }))), h("div", { key: "48970044629cfeafd07b4ccdb34e8d3ab67e0076", class: {
1775
1833
  "scheduler-editor-content": !0,
1776
1834
  "scheduler-editor-content--group": s
1777
- }, 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 }))));
1835
+ }, 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" })), ((v = (w = this.stores) == null ? void 0 : w.schedulerConfig) == null ? void 0 : v.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 = (I = (A = this.stores) == null ? void 0 : A.schedulerConfig) == null ? void 0 : I.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 = (k = this.stores) == null ? void 0 : k.schedulerConfig) == null ? void 0 : T.state) == null ? void 0 : S.calendars, selectedConfiguration: (b = (L = (_ = this.stores) == null ? void 0 : _.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" }))), ((ie = (re = this.stores) == null ? void 0 : re.schedulerConfig) == null ? void 0 : ie.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 = (oe = this.stores) == null ? void 0 : oe.schedulerConfig) != null && ae.state.currentUser) && h("slot", { name: "login-required" }, h(LoginRequired, { authenticationUrl: this.authenticationUrl }))));
1778
1836
  }
1779
1837
  get host() {
1780
1838
  return getElement(this);
@@ -0,0 +1,2 @@
1
+ "use strict";var ae=Object.defineProperty;var le=(r,t,n)=>t in r?ae(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n;var I=(r,t,n)=>(le(r,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const index=require("./index-f42fe591.cjs"),indexC510313d=require("./index-c510313d-b0508eee.cjs"),utils31933f5d=require("./utils-31933f5d-1d4c81ab.cjs"),index_es488bc919=require("./index.es-488bc919-d02dd50a.cjs"),constantsF51538ef=require("./constants-f51538ef-cd2a67c4.cjs");require("@nylas/web-elements");require("react");require("@nylas/connect");require("react/jsx-runtime");require("react-dom");class NylasIdentityRequestWrapper{constructor(t){this.defaultAuthArgs=[],this.session=t}setActiveGrantId(t){this.activeGrantId=t}async request({method:t,path:n,body:s,headers:a}){try{const l=await this.session.fetch(`grants/me/${n}`,{method:t,headers:a?new Headers(a):void 0,body:s,...this.session.isMultiAccount()&&this.activeGrantId?{grant_id:this.activeGrantId}:{}});if(typeof l>"u")throw new Error("Response is undefined");return utils31933f5d.dataResponse(l)}catch(l){let c=String(l);return String(l).includes("Access token not found")&&(c="Session expired, please log in again. Redirecting...",setTimeout(()=>{localStorage.removeItem("grant"),localStorage.removeItem("user"),window.location.reload()},1e3)),utils31933f5d.dataResponse(null,{message:c})}}async currentUser(){const t=this.session.isMultiAccount()?this.activeGrantId:void 0,n=await this.session.getProfile(t);if(await this.session.isLoggedIn()){const a=(await this.session.fetch("grants/me",{method:"GET",...this.session.isMultiAccount()&&this.activeGrantId?{grant_id:this.activeGrantId}:{}})).data;if(!n||!a)return null;const l=a.email;return{id:n.sub,email:l,name:n.name,provider:n.provider}}return null}async authenticationUrl(t){const n=(t==null?void 0:t.provider)||"google";let a=this.defaultAuthArgs.find(l=>l.provider===n)||{};return t&&(a={...a,...t}),this.session.auth(a)}setDefaultAuthArgs(t){this.defaultAuthArgs=t}}utils31933f5d.dayjs.extend(utils31933f5d.utc);utils31933f5d.dayjs.extend(utils31933f5d.timezone);class NylasSchedulerConfigAPIConnector{constructor({nylasApiRequest:t,nylasSchedulerConfigStore:n}){this.groupEventsCache=new Map,this.CACHE_DURATION=1*60*1e3,this.nylasApiRequest=t,this.nylasSchedulerConfigStore=n}async currentUser(){return this.nylasApiRequest?this.nylasApiRequest.currentUser():(console.warn("Nylas API Request is not initialized"),null)}async getCalendars(){var a;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),utils31933f5d.dataResponse(null,{message:"Error fetching calendars: Nylas API Request is not initialized"});const t=[];let n=null;const s=50;do{const[l,c]=await this.nylasApiRequest.request({method:"GET",path:`calendars?limit=${s}${n?`&page_token=${n}`:""}`});if(c)return utils31933f5d.dataResponse(null,{message:"Error fetching calendars: "+c.message});if(index_es488bc919.Xr(l))return utils31933f5d.dataResponse(null,{message:"Error fetching calendars: "+((a=l.error)==null?void 0:a.message)});t.push(...l.data),n=l.next_cursor||null}while(n);return this.nylasSchedulerConfigStore.state.calendars=t,utils31933f5d.dataResponse(t)}async getConfigurationById(t,n=!1){var l;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),utils31933f5d.dataResponse(null,{message:"Error fetching configuration: Nylas API Request is not initialized"});if(!n){const c=this.nylasSchedulerConfigStore.state.configurations.find(d=>d.id===t);if(c)return this.nylasSchedulerConfigStore.state.selectedConfiguration=c,utils31933f5d.dataResponse(c)}const[s,a]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${t}`});return a?utils31933f5d.dataResponse(null,{message:"Error fetching configuration: "+a.message}):index_es488bc919.Xr(s)?utils31933f5d.dataResponse(null,{message:"Error fetching configuration: "+((l=s.error)==null?void 0:l.message)}):(this.nylasSchedulerConfigStore.state.selectedConfiguration=s.data,this.nylasSchedulerConfigStore.state.configurations.find(c=>c.id===t)?this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map(c=>c.id===t?s.data:c):this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,s.data],utils31933f5d.dataResponse(s.data))}async getConfigurations(t){var l;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),utils31933f5d.dataResponse(null,{message:"Error fetching configurations: Nylas API Request is not initialized"});const n=50,[s,a]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations?limit=${n}${t?`&page_token=${t}`:""}`});return a?utils31933f5d.dataResponse(null,{message:"Error fetching configurations: "+a.message}):index_es488bc919.Xr(s)?utils31933f5d.dataResponse(null,{message:"Error fetching configurations: "+((l=s.error)==null?void 0:l.message)}):(this.nylasSchedulerConfigStore.state.configurations=s.data,this.nylasSchedulerConfigStore.state.listConfigurationsNextCursor=s.next_cursor||null,utils31933f5d.dataResponse(s.data))}async getMasterEventById(t){var h,u;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),utils31933f5d.dataResponse(null,{message:"Error fetching master event: Nylas API Request is not initialized"});const n=this.nylasSchedulerConfigStore.state.selectedGroupEvent,s=(h=n==null?void 0:n.event)==null?void 0:h.calendar_id;if(!s)return console.warn("Calendar ID is not present"),utils31933f5d.dataResponse(null,{message:"Error fetching master event: Calendar ID is not present"});const a=new URLSearchParams;a.append("calendar_id",s);const[l,c]=await this.nylasApiRequest.request({method:"GET",path:`events/${t}?${a.toString()}`});if(c)return utils31933f5d.dataResponse(null,{message:"Error fetching master event: "+c.message});if(index_es488bc919.Xr(l))return utils31933f5d.dataResponse(null,{message:"Error fetching master event: "+((u=l.error)==null?void 0:u.message)});const d=this.nylasSchedulerConfigStore.state.masterGroupEvents;return d[t]?this.nylasSchedulerConfigStore.state.masterGroupEvents[t]=l.data:this.nylasSchedulerConfigStore.state.masterGroupEvents={...d,[t]:l.data},utils31933f5d.dataResponse(l.data)}async createConfiguration(t){var a;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),utils31933f5d.dataResponse(null,{message:"Error creating configuration: Nylas API Request is not initialized"});const[n,s]=await this.nylasApiRequest.request({method:"POST",path:"scheduling/configurations",body:t});return s?utils31933f5d.dataResponse(null,{message:"Error creating configuration: "+s.message}):index_es488bc919.Xr(n)?utils31933f5d.dataResponse(null,{message:"Error creating configuration: "+((a=n.error)==null?void 0:a.message)}):(this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data,this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data],utils31933f5d.dataResponse(n.data))}async updateConfiguration(t){var a;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),utils31933f5d.dataResponse(null,{message:"Error updating configuration: Nylas API Request is not initialized"});const[n,s]=await this.nylasApiRequest.request({method:"PUT",path:`scheduling/configurations/${t.id}`,body:t});return s?utils31933f5d.dataResponse(null,{message:"Error updating configuration: "+s.message}):index_es488bc919.Xr(n)?utils31933f5d.dataResponse(null,{message:"Error updating configuration: "+((a=n.error)==null?void 0:a.message)}):(this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data,this.nylasSchedulerConfigStore.state.configurations.find(l=>l.id===t.id)?this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map(l=>l.id===t.id?n.data:l):this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data],utils31933f5d.dataResponse(n.data))}async deleteConfiguration(t){var a,l;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),utils31933f5d.dataResponse(null,{message:"Error deleting configuration: Nylas API Request is not initialized"});const[n,s]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${t}`});return s?utils31933f5d.dataResponse(null,{message:"Error deleting configuration: "+s.message}):index_es488bc919.Xr(n)?utils31933f5d.dataResponse(null,{message:"Error deleting configuration: "+((a=n.error)==null?void 0:a.message)}):(this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.filter(c=>c.id!==t),((l=this.nylasSchedulerConfigStore.state.selectedConfiguration)==null?void 0:l.id)===t&&this.nylasSchedulerConfigStore.resetSelectedConfiguration(),utils31933f5d.dataResponse(n.data))}async createGroupEvent(t,n){var l;if(this.nylasSchedulerConfigStore.state.isLoading=!0,!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),utils31933f5d.dataResponse(null,{message:"Error creating group event: Nylas API Request is not initialized"});const[s,a]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations/${n}/group-events`,body:t});return a?(this.nylasSchedulerConfigStore.state.isLoading=!1,utils31933f5d.dataResponse(null,{message:"Error creating group event: "+a.message})):index_es488bc919.Xr(s)?(this.nylasSchedulerConfigStore.state.isLoading=!1,utils31933f5d.dataResponse(null,{message:"Error creating group event: "+((l=s.error)==null?void 0:l.message)})):(this.nylasSchedulerConfigStore.state.selectedGroupEvent=s.data,await this.getGroupEvents(n,this.nylasSchedulerConfigStore.state.selectedConfiguration),this.nylasSchedulerConfigStore.state.isLoading=!1,utils31933f5d.dataResponse(s.data))}async getGroupEvents(t,n){var y,p;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),utils31933f5d.dataResponse(null,{message:"Error fetching group events: Nylas API Request is not initialized"});const s=new URLSearchParams;s.append("show_all","true");const a=this.nylasSchedulerConfigStore.state.calendarViewDateRange;let l,c;if(a)l=a.start_time,c=a.end_time;else{const m=utils31933f5d.getCalendarRange(new Date().toISOString(),"week");l=m.startTime.toString(),c=m.endTime.toString()}const d=`${t}-${l}-${c}`,h=this.groupEventsCache.get(d);if(h&&Date.now()-h.timestamp<this.CACHE_DURATION)return this.nylasSchedulerConfigStore.state.groupEvents=h.data,utils31933f5d.dataResponse(h.data);s.append("start_time",l),s.append("end_time",c);const u=(y=n==null?void 0:n.group_booking)==null?void 0:y.calendar_id;u&&s.append("calendar_id",u);const[f,g]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${t}/group-events?${s.toString()}`});return g?utils31933f5d.dataResponse(null,{message:"Error fetching group events: "+g.message}):index_es488bc919.Xr(f)?utils31933f5d.dataResponse(null,{message:"Error fetching group events: "+((p=f.error)==null?void 0:p.message)}):(this.groupEventsCache.set(d,{data:f.data,timestamp:Date.now()}),this.cleanupExpiredCache(),this.nylasSchedulerConfigStore.state.groupEvents=f.data,utils31933f5d.dataResponse(f.data))}cleanupExpiredCache(){const t=Date.now();for(const[n,s]of this.groupEventsCache.entries())t-s.timestamp>this.CACHE_DURATION&&this.groupEventsCache.delete(n)}async updateGroupEventById(t,n){var c;if(this.nylasSchedulerConfigStore.state.isLoading=!0,!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),utils31933f5d.dataResponse(null,{message:"Error updating group event: Nylas API Request is not initialized"});const s=t.id;delete t.id;const[a,l]=await this.nylasApiRequest.request({method:"PATCH",path:`scheduling/configurations/${n}/group-events/${s}`,body:t});return l?(this.nylasSchedulerConfigStore.state.isLoading=!1,utils31933f5d.dataResponse(null,{message:"Error updating group event: "+l.message})):index_es488bc919.Xr(a)?(this.nylasSchedulerConfigStore.state.isLoading=!1,utils31933f5d.dataResponse(null,{message:"Error updating group event: "+((c=a.error)==null?void 0:c.message)})):(this.nylasSchedulerConfigStore.state.selectedGroupEvent=a.data,await this.getGroupEvents(n,this.nylasSchedulerConfigStore.state.selectedConfiguration),this.nylasSchedulerConfigStore.state.isLoading=!1,utils31933f5d.dataResponse(a.data))}async updateGroupEvent(t,n,s){var g,y,p,m,x,_,v,R,T,O,P,N,k,A;this.nylasSchedulerConfigStore.state.isLoading=!0;const a=this.nylasSchedulerConfigStore.state.selectedGroupEvent,l=(g=a==null?void 0:a.event)==null?void 0:g.master_event_id,c=(y=a==null?void 0:a.event)==null?void 0:y.id,d=(m=(p=a==null?void 0:a.event)==null?void 0:p.when)==null?void 0:m.start_time,h=(_=(x=a==null?void 0:a.group_event_info)==null?void 0:x.rrule)==null?void 0:_[0],u=h?h.split(";").filter(w=>!w.startsWith("UNTIL")).join(";"):"",f=d?utils31933f5d.dayjs(d*1e3).subtract(1,"minute").format("YYYYMMDDTHHmmss[Z]"):"";if(n==="this")return this.updateGroupEventById({...t,id:c,recurrence:l?void 0:t.recurrence},s);if(n==="future"&&l){const w=await this.createGroupEvent(t,s),b={location:(v=a==null?void 0:a.event)==null?void 0:v.location,conferencing:(R=a==null?void 0:a.event)==null?void 0:R.conferencing,title:(T=a==null?void 0:a.event)==null?void 0:T.title,description:(O=a==null?void 0:a.event)==null?void 0:O.description,capacity:(P=a==null?void 0:a.group_event_info)==null?void 0:P.capacity,calendar_id:(N=a==null?void 0:a.event)==null?void 0:N.calendar_id,recurrence:u?[u+";UNTIL="+f]:[`RRULE:FREQ=DAILY;UNTIL=${f}`]};return await this.updateGroupEventById({...b,id:l},s),[b,w]}else if(n==="all"){const w=t==null?void 0:t.when,b=(k=a==null?void 0:a.event)==null?void 0:k.when,q=(A=this.nylasSchedulerConfigStore.state.masterGroupEvents)==null?void 0:A[l];let S=q==null?void 0:q.when;return(w==null?void 0:w.start_time)!==(b==null?void 0:b.start_time)&&(S={...S,start_time:(w==null?void 0:w.start_time)||(S==null?void 0:S.start_time)}),(w==null?void 0:w.end_time)!==(b==null?void 0:b.end_time)&&(S={...S,end_time:(w==null?void 0:w.end_time)||(S==null?void 0:S.end_time)}),(w==null?void 0:w.start_timezone)!==(b==null?void 0:b.start_timezone)&&(S={...S,start_timezone:(w==null?void 0:w.start_timezone)||(S==null?void 0:S.start_timezone)}),(w==null?void 0:w.end_timezone)!==(b==null?void 0:b.end_timezone)&&(S={...S,end_timezone:(w==null?void 0:w.end_timezone)||(S==null?void 0:S.end_timezone)}),this.updateGroupEventById({...t,when:S,id:l},s)}throw this.nylasSchedulerConfigStore.state.isLoading=!1,new Error("Invalid option")}async deleteGroupEvent(t,n,s){var y,p,m,x,_,v,R,T,O,P,N,k;this.nylasSchedulerConfigStore.state.isLoading=!0;const a=this.nylasSchedulerConfigStore.state.selectedGroupEvent,l=(y=a==null?void 0:a.event)==null?void 0:y.master_event_id,c=(p=a==null?void 0:a.event)==null?void 0:p.id,d=(x=(m=a==null?void 0:a.event)==null?void 0:m.when)==null?void 0:x.start_time,h=(v=(_=a==null?void 0:a.group_event_info)==null?void 0:_.rrule)==null?void 0:v[0],u=h?h.split(";").filter(A=>!A.startsWith("UNTIL")).join(";"):"",f=d?utils31933f5d.dayjs(d*1e3).format("YYYYMMDDTHHmmss[Z]"):"",g={location:(R=a==null?void 0:a.event)==null?void 0:R.location,conferencing:(T=a==null?void 0:a.event)==null?void 0:T.conferencing,title:(O=a==null?void 0:a.event)==null?void 0:O.title,description:(P=a==null?void 0:a.event)==null?void 0:P.description,capacity:(N=a==null?void 0:a.group_event_info)==null?void 0:N.capacity,calendar_id:(k=a==null?void 0:a.event)==null?void 0:k.calendar_id,recurrence:u?[u+";UNTIL="+f]:[`RRULE:UNTIL=${f}`]};if(n==="this"&&c)return this.deleteGroupEventById(c,s);if(n==="future"&&l&&c)return await this.deleteGroupEventById(c,s),await this.updateGroupEventById({...g,id:l},s);if(n==="all"&&l)return this.deleteGroupEventById(l,s);throw this.nylasSchedulerConfigStore.state.isLoading=!1,new Error("Invalid option")}async deleteGroupEventById(t,n){var d,h,u;if(this.nylasSchedulerConfigStore.state.isLoading=!0,!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),utils31933f5d.dataResponse(null,{message:"Error deleting group event: Nylas API Request is not initialized"});const s=new URLSearchParams,a=(h=(d=this.nylasSchedulerConfigStore.state.selectedConfiguration)==null?void 0:d.group_booking)==null?void 0:h.calendar_id;a&&s.append("calendar_id",a);const[l,c]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${n}/group-events/${t}?calendar_id=${a}`});return c?(this.nylasSchedulerConfigStore.state.isLoading=!1,utils31933f5d.dataResponse(null,{message:"Error deleting group event: "+c.message})):index_es488bc919.Xr(l)?(this.nylasSchedulerConfigStore.state.isLoading=!1,utils31933f5d.dataResponse(null,{message:"Error deleting group event: "+((u=l.error)==null?void 0:u.message)})):(await this.getGroupEvents(n,this.nylasSchedulerConfigStore.state.selectedConfiguration),this.nylasSchedulerConfigStore.state.isLoading=!1,utils31933f5d.dataResponse(l.data))}async importGroupEvent(t,n){var d,h,u,f,g;if(this.nylasSchedulerConfigStore.state.isLoading=!0,!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),utils31933f5d.dataResponse(null,{message:"Error importing group event: Nylas API Request is not initialized"});const s=new URLSearchParams,a=(h=(d=this.nylasSchedulerConfigStore.state.selectedConfiguration)==null?void 0:d.group_booking)==null?void 0:h.calendar_id;a&&s.append("calendar_id",a);const[l,c]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations/${n}/import-group-events?${s.toString()}`,body:t});return c?(this.nylasSchedulerConfigStore.state.isLoading=!1,utils31933f5d.dataResponse(null,{message:"Error importing group event: "+c.message})):index_es488bc919.Xr(l)?(this.nylasSchedulerConfigStore.state.isLoading=!1,utils31933f5d.dataResponse(null,{message:"Error importing group event: "+((u=l.error)==null?void 0:u.message)})):(((g=(f=l.data)==null?void 0:f.imported_events)==null?void 0:g.length)>0&&await this.getGroupEvents(n,this.nylasSchedulerConfigStore.state.selectedConfiguration),this.nylasSchedulerConfigStore.state.isLoading=!1,utils31933f5d.dataResponse(l.data))}}class NylasSchedulerConfigConnector{constructor({nylasApiRequest:t,nylasSchedulerConfigStore:n}){this.nylasApiRequest=t,this.nylasSchedulerConfigStore=n}init(){utils31933f5d.debug("NylasSchedulerConfigConnector init")}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get schedulerConfig(){return this._schedulerConfigConnector?this._schedulerConfigConnector:(this._schedulerConfigConnector=new NylasSchedulerConfigAPIConnector({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:this.nylasSchedulerConfigStore}),this._schedulerConfigConnector)}resetStores(){utils31933f5d.debug("NylasSchedulerConfigConnector resetStores"),this.nylasSchedulerConfigStore.reset()}async logout(){utils31933f5d.debug("NylasSchedulerConfigConnector logout"),this.resetStores()}}function CreateNylasSchedulerConfigStore(r={}){const t={selectedConfiguration:{},configurations:[],groupEvents:[],listConfigurationsNextCursor:null,calendars:[],currentUser:null,action:null,additionalParticipants:[],requiresSlug:!1,masterGroupEvents:{},isLoading:!1,...r},n=indexC510313d.createStore(t);function s(){n.set("selectedConfiguration",{...r.selectedConfiguration})}return n.onChange("action",async a=>{a||s()}),{...n,resetSelectedConfiguration:s}}class LocalStorage{get(t){return new Promise(n=>{const s=window.localStorage.getItem(t);n(s?JSON.parse(s):null)})}async remove(t){return window.localStorage.removeItem(t),new Promise(n=>{n(null)})}set(t,n){return window.localStorage.setItem(t,JSON.stringify(n)),new Promise(s=>{s(null)})}}const PKCE_KEY="pkce",GRANT_KEY="grant",USER_KEY="user";class Storage{constructor(t){I(this,"Storage",new LocalStorage);if(t){this.Storage=t;return}}setPKCE(t){const n=utils31933f5d.Buffer.from(t);this.Storage.set(PKCE_KEY,n.toString("base64"))}async getPKCE(){try{const t=await this.Storage.get(PKCE_KEY);if(t)return utils31933f5d.Buffer.from(t,"base64").toString("utf8")}catch{return null}return null}removePKCE(){this.Storage.remove(PKCE_KEY)}setGrant(t,n=!1){const{grant_id:s}=t;this.Storage.set(`${GRANT_KEY}${n?"-"+s:""}`,t)}removeGrant(t,n=!1){this.Storage.remove(`${GRANT_KEY}${n?"-"+t:""}`)}async getGrant(t,n=!1){const s=await this.Storage.get(`${GRANT_KEY}${n?"-"+t:""}`);return s||null}async setUserToken(t){const n=await this.getUserTokens();if(n)if(n.find(a=>a.sub===t.sub)){const a=n.map(l=>(l.sub===t.sub&&(l=t),l));this.Storage.set(USER_KEY,a)}else{const a=[...n,t];this.Storage.set(USER_KEY,a)}else this.Storage.set(USER_KEY,[t])}async getUserToken(t=""){const n=await this.Storage.get(USER_KEY);return n?t===""?n[0]:n.find(a=>a.sub===t):null}async getUserTokens(){const t=await this.Storage.get(USER_KEY);return t||null}removeUserTokens(){this.Storage.remove(USER_KEY)}async removeUserToken(t){const n=await this.getUserTokens(),s=n==null?void 0:n.filter(a=>a.sub!==t);this.Storage.set(USER_KEY,s)}async clearSession(){const t=await this.getUserTokens();t==null||t.forEach(n=>{this.removeGrant(n.sub)}),this.removePKCE(),this.removeUserTokens()}}class IndexedDBStorage{constructor(){I(this,"databaseName","identity-db");I(this,"storeName","identity")}get(t){const n=this;return new Promise((s,a)=>{n.openDatabase().then(function(l){const c=l.transaction(n.storeName,"readwrite"),h=c.objectStore(n.storeName).get(t);h.onsuccess=()=>{s(h.result)},h.onerror=()=>{a(h.error)},c.oncomplete=()=>{l.close()}})})}async remove(t){const n=this;return new Promise((s,a)=>{const l=indexedDB.open(this.databaseName);l.onupgradeneeded=function(c){c.target.result.createObjectStore(n.storeName)},l.onerror=()=>{a(l.error)},l.onsuccess=c=>{const d=c.target.result,h=d.transaction(this.storeName,"readwrite"),f=h.objectStore(this.storeName).delete(t);f.onsuccess=()=>{s(null)},f.onerror=()=>{a(f.error)},h.oncomplete=()=>{d.close()}}})}set(t,n){return new Promise((s,a)=>{const l=indexedDB.open(this.databaseName);l.onerror=()=>{a(l.error)},l.onupgradeneeded=c=>{c.target.result.createObjectStore(this.storeName)},l.onsuccess=c=>{const d=c.target.result,h=d.transaction(this.storeName,"readwrite"),f=h.objectStore(this.storeName).put(n,t);f.onsuccess=()=>{s(n)},f.onerror=()=>{a(f.error)},h.oncomplete=()=>{d.close()}}})}openDatabase(){const t=this;return new Promise(function(n,s){const a=indexedDB.open(t.databaseName,2);a.onupgradeneeded=function(l){l.target.result.createObjectStore(t.storeName)},a.onsuccess=function(l){n(l.target.result)},a.onerror=function(l){s(l.error)}})}}var sha256={exports:{}};(function(module){(function(){var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof utils31933f5d.process=="object"&&utils31933f5d.process.versions&&utils31933f5d.process.versions.node;NODE_JS?root=utils31933f5d.commonjsGlobal:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&!0&&module.exports,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(r){return Object.prototype.toString.call(r)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(r){return typeof r=="object"&&r.buffer&&r.buffer.constructor===ArrayBuffer});var createOutputMethod=function(r,t){return function(n){return new Sha256(t,!0).update(n)[r]()}},createMethod=function(r){var t=createOutputMethod("hex",r);NODE_JS&&(t=nodeWrap(t,r)),t.create=function(){return new Sha256(r)},t.update=function(a){return t.create().update(a)};for(var n=0;n<OUTPUT_TYPES.length;++n){var s=OUTPUT_TYPES[n];t[s]=createOutputMethod(s,r)}return t},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(r){if(typeof r=="string")return crypto.createHash(algorithm).update(r,"utf8").digest("hex");if(r==null)throw new Error(ERROR);return r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),Array.isArray(r)||ArrayBuffer.isView(r)||r.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(r)).digest("hex"):method(r)};return nodeMethod},createHmacOutputMethod=function(r,t){return function(n,s){return new HmacSha256(n,t,!0).update(s)[r]()}},createHmacMethod=function(r){var t=createHmacOutputMethod("hex",r);t.create=function(a){return new HmacSha256(a,r)},t.update=function(a,l){return t.create(a).update(l)};for(var n=0;n<OUTPUT_TYPES.length;++n){var s=OUTPUT_TYPES[n];t[s]=createHmacOutputMethod(s,r)}return t};function Sha256(r,t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=r}Sha256.prototype.update=function(r){if(!this.finalized){var t,n=typeof r;if(n!=="string"){if(n==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);t=!0}for(var s,a=0,l,c=r.length,d=this.blocks;a<c;){if(this.hashed&&(this.hashed=!1,d[0]=this.block,d[16]=d[1]=d[2]=d[3]=d[4]=d[5]=d[6]=d[7]=d[8]=d[9]=d[10]=d[11]=d[12]=d[13]=d[14]=d[15]=0),t)for(l=this.start;a<c&&l<64;++a)d[l>>2]|=r[a]<<SHIFT[l++&3];else for(l=this.start;a<c&&l<64;++a)s=r.charCodeAt(a),s<128?d[l>>2]|=s<<SHIFT[l++&3]:s<2048?(d[l>>2]|=(192|s>>6)<<SHIFT[l++&3],d[l>>2]|=(128|s&63)<<SHIFT[l++&3]):s<55296||s>=57344?(d[l>>2]|=(224|s>>12)<<SHIFT[l++&3],d[l>>2]|=(128|s>>6&63)<<SHIFT[l++&3],d[l>>2]|=(128|s&63)<<SHIFT[l++&3]):(s=65536+((s&1023)<<10|r.charCodeAt(++a)&1023),d[l>>2]|=(240|s>>18)<<SHIFT[l++&3],d[l>>2]|=(128|s>>12&63)<<SHIFT[l++&3],d[l>>2]|=(128|s>>6&63)<<SHIFT[l++&3],d[l>>2]|=(128|s&63)<<SHIFT[l++&3]);this.lastByteIndex=l,this.bytes+=l-this.start,l>=64?(this.block=d[16],this.start=l-64,this.hash(),this.hashed=!0):this.start=l}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var r=this.blocks,t=this.lastByteIndex;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()}},Sha256.prototype.hash=function(){var r=this.h0,t=this.h1,n=this.h2,s=this.h3,a=this.h4,l=this.h5,c=this.h6,d=this.h7,h=this.blocks,u,f,g,y,p,m,x,_,v,R,T;for(u=16;u<64;++u)p=h[u-15],f=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=h[u-2],g=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,h[u]=h[u-16]+f+h[u-7]+g<<0;for(T=t&n,u=0;u<64;u+=4)this.first?(this.is224?(_=300032,p=h[0]-1413257819,d=p-150054599<<0,s=p+24177077<<0):(_=704751109,p=h[0]-210244248,d=p-1521486534<<0,s=p+143694565<<0),this.first=!1):(f=(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),_=r&t,y=_^r&n^T,x=a&l^~a&c,p=d+g+x+K[u]+h[u],m=f+y,d=s+p<<0,s=p+m<<0),f=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),g=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7),v=s&r,y=v^s&t^_,x=d&a^~d&l,p=c+g+x+K[u+1]+h[u+1],m=f+y,c=n+p<<0,n=p+m<<0,f=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),g=(c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7),R=n&s,y=R^n&r^v,x=c&d^~c&a,p=l+g+x+K[u+2]+h[u+2],m=f+y,l=t+p<<0,t=p+m<<0,f=(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),T=t&n,y=T^t&s^R,x=l&c^~l&d,p=a+g+x+K[u+3]+h[u+3],m=f+y,a=r+p<<0,r=p+m<<0;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+c<<0,this.h7=this.h7+d<<0},Sha256.prototype.hex=function(){this.finalize();var r=this.h0,t=this.h1,n=this.h2,s=this.h3,a=this.h4,l=this.h5,c=this.h6,d=this.h7,h=HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15]+HEX_CHARS[l>>28&15]+HEX_CHARS[l>>24&15]+HEX_CHARS[l>>20&15]+HEX_CHARS[l>>16&15]+HEX_CHARS[l>>12&15]+HEX_CHARS[l>>8&15]+HEX_CHARS[l>>4&15]+HEX_CHARS[l&15]+HEX_CHARS[c>>28&15]+HEX_CHARS[c>>24&15]+HEX_CHARS[c>>20&15]+HEX_CHARS[c>>16&15]+HEX_CHARS[c>>12&15]+HEX_CHARS[c>>8&15]+HEX_CHARS[c>>4&15]+HEX_CHARS[c&15];return this.is224||(h+=HEX_CHARS[d>>28&15]+HEX_CHARS[d>>24&15]+HEX_CHARS[d>>20&15]+HEX_CHARS[d>>16&15]+HEX_CHARS[d>>12&15]+HEX_CHARS[d>>8&15]+HEX_CHARS[d>>4&15]+HEX_CHARS[d&15]),h},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var r=this.h0,t=this.h1,n=this.h2,s=this.h3,a=this.h4,l=this.h5,c=this.h6,d=this.h7,h=[r>>24&255,r>>16&255,r>>8&255,r&255,t>>24&255,t>>16&255,t>>8&255,t&255,n>>24&255,n>>16&255,n>>8&255,n&255,s>>24&255,s>>16&255,s>>8&255,s&255,a>>24&255,a>>16&255,a>>8&255,a&255,l>>24&255,l>>16&255,l>>8&255,l&255,c>>24&255,c>>16&255,c>>8&255,c&255];return this.is224||h.push(d>>24&255,d>>16&255,d>>8&255,d&255),h},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var r=new ArrayBuffer(this.is224?28:32),t=new DataView(r);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),r};function HmacSha256(r,t,n){var s,a=typeof r;if(a==="string"){var l=[],c=r.length,d=0,h;for(s=0;s<c;++s)h=r.charCodeAt(s),h<128?l[d++]=h:h<2048?(l[d++]=192|h>>6,l[d++]=128|h&63):h<55296||h>=57344?(l[d++]=224|h>>12,l[d++]=128|h>>6&63,l[d++]=128|h&63):(h=65536+((h&1023)<<10|r.charCodeAt(++s)&1023),l[d++]=240|h>>18,l[d++]=128|h>>12&63,l[d++]=128|h>>6&63,l[d++]=128|h&63);r=l}else if(a==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);r.length>64&&(r=new Sha256(t,!0).update(r).array());var u=[],f=[];for(s=0;s<64;++s){var g=r[s]||0;u[s]=92^g,f[s]=54^g}Sha256.call(this,t,n),this.update(f),this.oKeyPad=u,this.inner=!0,this.sharedMemory=n}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var r=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(r),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224)})()})(sha256);var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}const REGEX=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function validate(r){return typeof r=="string"&&REGEX.test(r)}var byteToHex=[];for(var i=0;i<256;++i)byteToHex.push((i+256).toString(16).substr(1));function stringify(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(byteToHex[r[t+0]]+byteToHex[r[t+1]]+byteToHex[r[t+2]]+byteToHex[r[t+3]]+"-"+byteToHex[r[t+4]]+byteToHex[r[t+5]]+"-"+byteToHex[r[t+6]]+byteToHex[r[t+7]]+"-"+byteToHex[r[t+8]]+byteToHex[r[t+9]]+"-"+byteToHex[r[t+10]]+byteToHex[r[t+11]]+byteToHex[r[t+12]]+byteToHex[r[t+13]]+byteToHex[r[t+14]]+byteToHex[r[t+15]]).toLowerCase();if(!validate(n))throw TypeError("Stringified UUID is invalid");return n}function v4(r,t,n){r=r||{};var s=r.random||(r.rng||rng)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,t){n=n||0;for(var a=0;a<16;++a)t[n+a]=s[a];return t}return stringify(s)}async function getBytes(r,t){const n=r.getReader();let s;for(;!(s=await n.read()).done;)t(s.value)}function getLines(r){let t,n,s,a=!1;return function(c){t===void 0?(t=c,n=0,s=-1):t=concat(t,c);const d=t.length;let h=0;for(;n<d;){a&&(t[n]===10&&(h=++n),a=!1);let u=-1;for(;n<d&&u===-1;++n)switch(t[n]){case 58:s===-1&&(s=n-h);break;case 13:a=!0;case 10:u=n;break}if(u===-1)break;r(t.subarray(h,u),s),h=n,s=-1}h===d?t=void 0:h!==0&&(t=t.subarray(h),n-=h)}}function getMessages(r,t,n){let s=newMessage();const a=new TextDecoder;return function(c,d){if(c.length===0)n==null||n(s),s=newMessage();else if(d>0){const h=a.decode(c.subarray(0,d)),u=d+(c[d+1]===32?2:1),f=a.decode(c.subarray(u));switch(h){case"data":s.data=s.data?s.data+`
2
+ `+f:f;break;case"event":s.event=f;break;case"id":r(s.id=f);break;case"retry":const g=parseInt(f,10);isNaN(g)||t(s.retry=g);break}}}}function concat(r,t){const n=new Uint8Array(r.length+t.length);return n.set(r),n.set(t,r.length),n}function newMessage(){return{data:"",event:"",id:"",retry:void 0}}var __rest=function(r,t){var n={};for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&t.indexOf(s)<0&&(n[s]=r[s]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(r);a<s.length;a++)t.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(r,s[a])&&(n[s[a]]=r[s[a]]);return n};const EventStreamContentType="text/event-stream",DefaultRetryInterval=1e3,LastEventId="last-event-id";function fetchEventSource(r,t){var{signal:n,headers:s,onopen:a,onmessage:l,onclose:c,onerror:d,openWhenHidden:h,fetch:u}=t,f=__rest(t,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((g,y)=>{const p=Object.assign({},s);p.accept||(p.accept=EventStreamContentType);let m;function x(){m.abort(),document.hidden||P()}h||document.addEventListener("visibilitychange",x);let _=DefaultRetryInterval,v=0;function R(){document.removeEventListener("visibilitychange",x),window.clearTimeout(v),m.abort()}n==null||n.addEventListener("abort",()=>{R(),g()});const T=u??window.fetch,O=a??defaultOnOpen;async function P(){var N;m=new AbortController;try{const k=await T(r,Object.assign(Object.assign({},f),{headers:p,signal:m.signal}));await O(k),await getBytes(k.body,getLines(getMessages(A=>{A?p[LastEventId]=A:delete p[LastEventId]},A=>{_=A},l))),c==null||c(),R(),g()}catch(k){if(!m.signal.aborted)try{const A=(N=d==null?void 0:d(k))!==null&&N!==void 0?N:_;window.clearTimeout(v),v=window.setTimeout(P,A)}catch(A){R(),y(A)}}}P()})}function defaultOnOpen(r){const t=r.headers.get("content-type");if(!(t!=null&&t.startsWith(EventStreamContentType)))throw new Error(`Expected content-type to be ${EventStreamContentType}, Actual: ${t}`)}function Base64EncodeUrl(r){return r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function getTimestamp(){return Math.floor(Date.now()/1e3)}function e(r){this.message=r}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r$1=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,s,a=0,l=0,c="";s=t.charAt(l++);~s&&(n=a%4?64*n+s:s,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(s);return c};function t$1(r){var t=r.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(n){return decodeURIComponent(r$1(n).replace(/(.)/g,function(s,a){var l=a.charCodeAt(0).toString(16).toUpperCase();return l.length<2&&(l="0"+l),"%"+l}))}(t)}catch{return r$1(t)}}function n$1(r){this.message=r}function o(r,t){if(typeof r!="string")throw new n$1("Invalid token specified");var n=(t=t||{}).header===!0?0:1;try{return JSON.parse(t$1(r.split(".")[n]))}catch(s){throw new n$1("Invalid token specified: "+s.message)}}n$1.prototype=new Error,n$1.prototype.name="InvalidTokenError";class NylasSessions{constructor(t){I(this,"clientId");I(this,"redirectUri");I(this,"accessType","online");I(this,"domain","http://api.nylas.com");I(this,"versioned",!1);I(this,"Storage");I(this,"hosted",!1);I(this,"multiAccount",!1);I(this,"loginId","");if(this.clientId=t.clientId,this.redirectUri=t.redirectUri,t.domain&&(this.domain=t.domain,this.domain.substring(this.domain.length-3).includes("/v")&&(this.versioned=!0)),t.multiAccount&&(this.multiAccount=t.multiAccount),t.sw){const n=new IndexedDBStorage;this.Storage=new Storage(n)}else this.Storage=new Storage;t.accessType&&(this.accessType=t.accessType),t.loginId&&(this.loginId=t.loginId),t.hosted&&(this.hosted=t.hosted),t.disableInitCodeExchange!==!0&&this.codeExchange(null)}async validateAccessToken(t=""){const n=await this.Storage.getGrant(t,this.multiAccount);if(!n)return!1;const{access_token:s}=n;try{return!!(await(await fetch(`${this.domain}/connect/tokeninfo?access_token=${s}`,{method:"GET"})).json()).data}catch{return!1}}async validateIDToken(t=""){const n=await this.Storage.getGrant(t,this.multiAccount);if(!n)return!1;const{id_token:s}=n;try{const a=await fetch(`${this.domain}/connect/tokeninfo?id_token=${s}`,{method:"GET"});return!(a.status!==200||!(await a.json()).data)}catch{return!1}}getDomain(){return this.domain}async auth(t){this.hosted&&(this.domain===window.location.origin||this.versioned&&this.domain.includes(window.location.origin))&&await this.hostedSetCodeChallenge();const n=await this.generateAuthURL(t);if(t.popup){this.popUp(n);return}return n}async generateAuthURL(t){const n=await this.getCodeChallege();let s=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;return n&&(s+=`&code_challenge=${n}&code_challenge_method=S256&options=rotate_refresh_token`),t.provider&&(s+=`&provider=${t.provider}`),t.loginHint&&(s+=`&login_hint=${t.loginHint}`,t.includeGrantScopes&&(s+=`&include_grant_scopes=${t.includeGrantScopes}`)),t.scope&&(s+=`&scope=${t.scope.join(" ")}`),t.prompt&&(s+=`&prompt=${t.prompt}`),t.metadata&&(s+=`&metadata=${t.metadata}`),(t.state||this.loginId)&&(s+=`&state=${this.loginId?this.loginId:t.state}`),s}async generateReauthURL(t,n){if(!t)throw new Error("Grant ID is required");const s=await this.Storage.getUserToken(t),a=await this.getCodeChallege();let l=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;return a&&(l+=`&code_challenge=${a}&code_challenge_method=S256&options=rotate_refresh_token`),s!=null&&s.provider&&(l+=`&provider=${s.provider}`),s!=null&&s.email&&(l+=`&login_hint=${s.email}`),n&&(l+=`&scope=${n.join(" ")}`),l}async generateCodeChallenge(){if(await this.Storage.getPKCE())return;const n=v4();this.Storage.setPKCE(n)}async hostedSetCodeChallenge(){if(!this.hosted)throw console.error("Method only used with hosted flag enabled");const n=new URLSearchParams(window.location.search).get("code_challenge");if(!n){if(await this.Storage.getPKCE())return;console.warn("Code challenge is recomended");return}this.Storage.setPKCE(n)}async getCodeChallege(){if(this.hosted&&(this.domain===window.location.origin||this.versioned&&this.domain.includes(window.location.origin))){const s=new URLSearchParams(window.location.search).get("code_challenge");return s||(console.warn("Code challenge is recomended"),"")}const t=await this.Storage.getPKCE();if(t){const n=sha256.exports.sha256(t);let s=utils31933f5d.Buffer.from(n).toString("base64");return s=Base64EncodeUrl(s),s}return""}async isLoggedIn(){if(this.hosted&&(this.domain===window.location.origin||this.versioned&&this.domain.includes(window.location.origin)))return!1;const t=await this.Storage.getUserTokens();return t&&t.length>0?(this.multiAccount&&await this.generateCodeChallenge(),!0):(await this.generateCodeChallenge(),!1)}isMultiAccount(){return this.multiAccount}async logout(){const t=await this.getProfile();await this.Storage.clearSession();const n={detail:t};window.dispatchEvent(new CustomEvent("onLogoutSuccess",n))}async getProfile(t=""){let n;return t?n=await this.Storage.getUserToken(t):n=await this.Storage.getUserToken(),n||null}async getProfiles(){const t=await this.Storage.getUserTokens();return t||null}async removeProfile(t){return await this.Storage.removeUserToken(t),await this.Storage.removeGrant(t),null}async authIMAP(t){const n=await this.getCodeChallege(),s={imap_username:t.imap_username,imap_password:t.imap_password,imap_host:t.imap_host,imap_port:t.imap_port,type:t.type,smtp_host:t.smtp_host,smtp_port:t.smtp_port,provider:t.provider,redirect_uri:this.redirectUri,state:t.state,public_application_id:this.clientId,access_type:this.accessType};return this.loginId&&(s.id=this.loginId),t.smtp_username&&t.smtp_password&&(s.smtp_username=t.smtp_username,s.smtp_password=t.smtp_password),n!=""&&(s.code_challenge=n,s.code_challenge_method="S256"),await(await fetch(`${this.domain}/connect/login/imap`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(s)})).json()}async authEWS(t){const n=await this.getCodeChallege(),s={...t,provider:"ews",redirect_uri:this.redirectUri,public_application_id:this.clientId,access_type:this.accessType};return this.loginId&&(s.id=this.loginId),n!=""&&(s.code_challenge=n,s.code_challenge_method="S256"),await(await fetch(`${this.domain}/connect/login/ews`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(s)})).json()}async detectEmail(t){return await(await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/providers/detect?client_id=${this.clientId}&email=${t}`,{method:"POST",headers:new Headers({"content-type":"application/json"})})).json()}async applicationInfo(){return(await(await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/applications?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})})).json()).data}async getAvailableProviders(){const t=await fetch(`${this.domain}/connect/providers/find?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});return t?(await t.json()).data:null}onLoginSuccess(t){window.addEventListener("onLoginSuccess",n=>t(n))}onLogoutSuccess(t){window.addEventListener("onLogoutSuccess",n=>t(n))}onLoginFail(t){window.addEventListener("onLoginFail",n=>t(n))}onTokenRefreshSuccess(t){window.addEventListener("onTokenRefreshSuccess",n=>t(n))}onTokenRefreshFail(t){window.addEventListener("onTokenRefreshFail",n=>t(n))}onSessionExpired(t){window.addEventListener("onSessionExpired",n=>t(n))}async codeExchange(t){let n=new URLSearchParams(window.location.search);t&&(n=new URLSearchParams(t));const s=n.get("code"),a=n.get("state"),l=n.get("error"),c=n.get("error_description"),d=n.get("error_code");if(l&&c&&d){const u={detail:{error:l,error_description:c,error_code:d}};return window.dispatchEvent(new CustomEvent("onLoginFail",u)),window.history.pushState({},document.title,window.location.pathname),!1}if(!s)return console.warn("No code found"),!1;if(window.opener&&window.name==="uas-popup")return console.warn("Popup window detected"),!1;const h=await this.Storage.getPKCE();if(!h)return console.warn("No code verifier found"),!1;try{const u={client_id:this.clientId,redirect_uri:this.redirectUri,code:s,grant_type:"authorization_code",code_verifier:h},g=await(await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(u)})).json();if(g){if(g.error){const p={detail:g};return window.dispatchEvent(new CustomEvent("onLoginFail",p)),!0}const y=await this.handleCodeExchangeResponse(g);if(y.valid){a&&(y.data.state=a);const p={detail:y.data};window.dispatchEvent(new CustomEvent("onLoginSuccess",p)),window.history.pushState({},document.title,window.location.pathname)}else{const p={detail:y.data};return window.dispatchEvent(new CustomEvent("onLoginFail",p)),!0}}return this.Storage.removePKCE(),!0}catch(u){const f={detail:u};return window.dispatchEvent(new CustomEvent("onLoginFail",f)),window.history.pushState({},document.title,window.location.pathname),!1}}async tokenExchange(t=""){const n=await this.Storage.getGrant(t,this.multiAccount);if(!n)return!1;const s=n.refresh_token;try{const a={client_id:this.clientId,redirect_uri:this.redirectUri,refresh_token:s,grant_type:"refresh_token"},c=await(await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(a)})).json();if(c){if(c.error){const f={detail:c};return window.dispatchEvent(new CustomEvent("onTokenRefreshFail",f)),!0}const d=getTimestamp();if(c.expires_in=d+c.expires_in,this.Storage.setGrant(c,this.multiAccount),!await this.validateIDToken(t)){const f={detail:c};return window.dispatchEvent(new CustomEvent("onTokenRefreshFail",f)),!0}const u={detail:c};return window.dispatchEvent(new CustomEvent("onTokenRefreshSuccess",u)),!0}this.Storage.removePKCE()}catch(a){const l={detail:a};return window.dispatchEvent(new CustomEvent("onTokenRefreshFail",l)),!1}}async handleCodeExchangeResponse(t){if(t.error)return{data:t,valid:!1};const s=getTimestamp();t.expires_in=s+t.expires_in,this.Storage.setGrant(t,this.multiAccount);const a=o(t.id_token);return a.status="authenticated",this.Storage.setUserToken(a),await this.validateIDToken(a.sub)?{data:t,valid:!0}:{data:t,valid:!1}}async popUp(t){const a=window.screenX+(window.outerWidth-500)/2,l=window.screenY+(window.outerHeight-600)/2.5,c="uas-popup",d=t,h=window.open(d,c,`width=500,height=600,left=${a},top=${l}`);if(!h)return;const u=setInterval(async()=>{if(h.closed){const f={detail:{error_description:"OAuth provider window closed"}};window.dispatchEvent(new CustomEvent("onLoginFail",f)),u&&clearInterval(u);return}try{const f=h.location.href.split("?");if(!f[0])return;const g=h.location.search;if(h.history.pushState({},document.title,window.location.pathname),f[0]===this.redirectUri&&f.length>1){const y=await this.codeExchange(g);h.close(),y&&location.reload(),u&&clearInterval(u);return}}catch{return}},1e3)}async getAccessToken(t=""){const n=getTimestamp(),s=await this.Storage.getGrant(t,this.multiAccount);if(!s)return null;const{access_token:a,expires_in:l}=s,c=a;return c&&l&&l>getTimestamp()&&l-n>30?c:(await this.tokenExchange(t),(await this.Storage.getGrant(t,this.multiAccount)).access_token)}async sse(t,n){const s=n.headers||{},a=s["Grant-ID"];let l="";if(this.multiAccount){if(!a)throw this.logout(),new Error("Grant ID is required for multi account calls");l=await this.getAccessToken(a)}else l=await this.getAccessToken();return delete s["Grant-ID"],s.Authorization=`Bearer ${l}`,s["content-type"]||(s["content-type"]="application/json"),fetchEventSource(`${this.domain}/${t}`,{...n,headers:s})}async fetch(t,n,s=!0,a){let l="",c=1;if(this.multiAccount){if(!n.grant_id)throw this.logout(),new Error("Grant ID is required for multi account calls");const h=await this.getProfiles();c=h?h.length:1,l=await this.getAccessToken(n.grant_id)}else l=await this.getAccessToken();if(!l)throw new Error("Access token not found");let d=n.headers;Headers.prototype.isPrototypeOf(d)?(d.append("Authorization",`Bearer ${l}`),d.has("content-type")||d.append("content-type","application/json")):d=new Headers({Authorization:`Bearer ${l}`,"content-type":"application/json"});try{n!=null&&n.body&&(n.body=JSON.stringify(n==null?void 0:n.body));const h=await fetch(`${a||this.domain}/${t}`,{...n,headers:d});if(!s)return h;const u=await(h==null?void 0:h.json());if(!await this.isAuthenticatedResponse(h.status,u)){if(c>1){const g=await this.getProfile(n.grant_id);if(g){g.status="unauthorized",await this.Storage.setUserToken(g);const y={detail:{user:g}};window.dispatchEvent(new CustomEvent("onSessionExpired",y))}}else{const y={detail:{user:await this.Storage.getUserToken()}};window.dispatchEvent(new CustomEvent("onSessionExpired",y))}this.logout();return}return u}catch(h){throw h}}async fetchRequest(t,n,s,a=!0,l,c){const d=await this.isLoggedIn(),h=new URL(t,l??this.domain),u=new Headers;if(u.append("Accept","application/json"),u.append("Content-Type","application/json"),u.append("User-Agent","nylas-identity"),d){const y=await this.getAccessToken();u.append("Authorization",`Bearer ${y}`)}const f=await fetch(h.toString(),{method:n||"GET",headers:u,mode:"cors",referrer:location.origin,body:s?JSON.stringify(s):void 0,...c||{}});return a?await f.json():f.body}async isAuthenticatedResponse(t,n){var s;return!(t==401&&((s=n==null?void 0:n.error)==null?void 0:s.type)=="token.unauthorized_access")}addAPIKey(t,n,s){this.Storage.setUserToken({aud:"https://api-staging.us.nylas.com/",exp:2e9,email_verified:!0,iat:getTimestamp(),iss:"",email:n,provider:"virtual-calendar",status:"authenticated",name:n,sub:t}),this.Storage.setGrant({grant_id:t,access_token:s,expires_in:2e9},this.multiAccount)}}var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(r,t,n){this.props=r,this.context=t,this.refs=D,this.updater=n||B}E.prototype.isReactComponent={};E.prototype.setState=function(r,t){if(typeof r!="object"&&typeof r!="function"&&r!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,r,t,"setState")};E.prototype.forceUpdate=function(r){this.updater.enqueueForceUpdate(this,r,"forceUpdate")};function F(){}F.prototype=E.prototype;function G(r,t,n){this.props=r,this.context=t,this.refs=D,this.updater=n||B}var H=G.prototype=new F;H.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;const LoginRequired=({authenticationUrl:r})=>index.h("div",{class:"login-required",part:"nse__login-required login-component"},index.h("div",{class:"card",part:"nse__login-required-card"},index.h("p",{part:"nse__login-required-text"},"Log into your account to use the Scheduler Editor."),index.h("button",{class:"google-button",part:"nse__login-required-google-button",onClick:async t=>{t.preventDefault();const n=await r("google");n?window.location.href=n:console.error("[nylas-scheduler-editor] Unable to get authentication URL.")}},index.h("span",{class:"icon"},index.h("google-logo-icon",{width:"15",height:"15"})),"Continue with Google"),index.h("button",{class:"microsoft-button",part:"nse__login-required-microsoft-button",onClick:async t=>{t.preventDefault();const n=await r("microsoft");n?window.location.href=n:console.error("[nylas-scheduler-editor] Unable to get authentication URL.")}},index.h("span",{class:"icon"},index.h("microsoft-logo-icon",{width:"15",height:"15"})),"Continue with Microsoft"),index.h("button",{class:"other-provider-button",part:"nse__login-required-other-provider-button",onClick:async t=>{t.preventDefault();const n=await r();n?window.location.href=n:console.error("[nylas-scheduler-editor] Unable to get authentication URL.")}},"View all providers ",index.h("chevron-icon",{width:"17",height:"17"})),index.h("small",{class:"disclaimer-text",part:"nse__login-required-disclaimer-text"},"* You will be redirected to authenticate your account.")));function ExpressFlow({currentUser:r,calendars:t,selectedEventType:n}){const s=(t==null?void 0:t.find(a=>a.is_primary))||(t==null?void 0:t[0]);switch(n){case constantsF51538ef.CONFIGURATION_EVENT_TYPE.one_on_one:case constantsF51538ef.CONFIGURATION_EVENT_TYPE.max_availability:case constantsF51538ef.CONFIGURATION_EVENT_TYPE.max_fairness:return index.h(index.Fragment,null,index.h("nylas-event-info",null,index.h("div",{slot:"inputs"},index.h("nylas-event-title",null),index.h("nylas-event-duration",null),index.h("nylas-event-location",{userProvider:r.provider}))),index.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}),index.h("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}));case constantsF51538ef.CONFIGURATION_EVENT_TYPE.collective:return index.h(index.Fragment,null,index.h("nylas-event-info",null,index.h("div",{slot:"inputs"},index.h("nylas-event-title",null),index.h("nylas-event-duration",null),index.h("nylas-event-location",{userProvider:r.provider}))),index.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}),index.h("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}),index.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"}));case constantsF51538ef.CONFIGURATION_EVENT_TYPE.group:return index.h(index.Fragment,null,index.h("nylas-event-info",null,index.h("div",{slot:"inputs"},index.h("nylas-event-title",{noTemplates:!0}),index.h("nylas-event-description",{noTemplates:!0,hideAutoPopulateButton:!0}),index.h("nylas-event-location",{userProvider:r.provider}),index.h("nylas-event-timeslot",{name:"event-timeslot"}),index.h("nylas-event-capacity",null))),index.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}),index.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"}),index.h("nylas-page-name",{requirePageName:!0,pageName:"Group events page"}),index.h("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}))}}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-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--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}}:host nylas-notification{position:absolute;top:0;right:0}div.scheduler-editor-content{height:800px}@media screen and (max-width: 768px){div.scheduler-editor-content{height:auto}}div.scheduler-editor-content slot[name=login-required]{height:inherit}div.scheduler-editor-content--group{height:800px}@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;color:var(--nylas-base-900)}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;color:var(--nylas-base-900);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;color:var(--nylas-base-900)}.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;color:var(--nylas-base-900)}.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{constructor(r){index.registerInstance(this,r),this.init=index.createEvent(this,"init",7),this.loggedIn=index.createEvent(this,"loggedIn",7),this.loggedOut=index.createEvent(this,"loggedOut",7),this.schedulerConfigCloseClicked=index.createEvent(this,"schedulerConfigCloseClicked",7),this.handleSchedulerConfigCloseClicked=t=>{const n=this.schedulerConfigCloseClicked.emit(this.host);"schedulerConfigCloseClicked"in this.eventOverrides&&this.eventOverrides.schedulerConfigCloseClicked(n,this.nylasSchedulerConfigConnector),n.defaultPrevented||(localStorage.removeItem("grant"),localStorage.removeItem("user"),window.location.reload())},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={one_on_one:!0,collective:!0,max_fairness:!0,max_availability:!0,group:!0},this.themeConfig=void 0,this.automaticComponentRegistration=!0,this.selectedLanguage=this.defaultLanguage||constantsF51538ef.LANGUAGE_CODE.en,this.langVersion=0,this.version="2.1.0"}connectedCallback(){utils31933f5d.debug("[nylas-scheduler-editor] connectedCallback")}async componentWillLoad(){var s,a,l,c,d,h,u,f;utils31933f5d.debug("[nylas-scheduler-editor] componentWillLoad");const r=(s=this.additionalParticipants)==null?void 0:s.filter(g=>{var p;const y=((p=g.calendars)==null?void 0:p.length)>0?g.calendars.filter(m=>m.id&&m.name):[];if(g.name&&g.email&&y.length>0)return{name:g.name,email:g.email,calendars:y}});if(this.stores={schedulerConfig:CreateNylasSchedulerConfigStore({...this.defaultSchedulerConfigState,additionalParticipants:r,conferenceProviders:this.conferenceProviders,requiresSlug:this.requiresSlug,selectedLanguage:this.defaultLanguage||constantsF51538ef.LANGUAGE_CODE.en,nylasBranding:this.nylasBranding,experimentalFeatures:this.experimentalFeatures,enableEventTypes:this.enableEventTypes,themeConfig:this.themeConfig})},!this.nylasApiRequest&&this.nylasSessionsConfig){const g=new NylasSessions(this.nylasSessionsConfig);await g.isLoggedIn(),g.onLoginSuccess(async()=>{var p,m;const y=await((m=(p=this.nylasSchedulerConfigConnector)==null?void 0:p.schedulerConfig)==null?void 0:m.currentUser());if(y){const x=this.loggedIn.emit(this.host);"loggedIn"in this.eventOverrides&&await this.eventOverrides.loggedIn(x,this.nylasSchedulerConfigConnector),x.defaultPrevented||await this.loggedInHandler(y)}}),g.onLoginFail(async()=>{var p,m;(m=(p=this.stores)==null?void 0:p.schedulerConfig)==null||m.set("currentUser",null);const y=this.loggedOut.emit(this.host);"loggedOut"in this.eventOverrides&&(await this.eventOverrides.loggedOut(y,this.nylasSchedulerConfigConnector),y.defaultPrevented)}),this.nylasApiRequest=new NylasIdentityRequestWrapper(g)}this.nylasApiRequest&&this.defaultAuthArgs&&this.nylasApiRequest.setDefaultAuthArgs(this.defaultAuthArgs),this.baseProvider=new indexC510313d.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const t=this.baseProvider.getStore("schedulerConfig");this.nylasSchedulerConfigConnector=new NylasSchedulerConfigConnector({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:t});const n=this.init.emit(this.host);if("init"in this.eventOverrides&&await this.eventOverrides.init(n,this.nylasSchedulerConfigConnector),!n.defaultPrevented){const g=await((l=(a=this.nylasSchedulerConfigConnector)==null?void 0:a.schedulerConfig)==null?void 0:l.currentUser());if(g){const y=this.loggedIn.emit(this.host);"loggedIn"in this.eventOverrides&&await this.eventOverrides.loggedIn(y,this.nylasSchedulerConfigConnector),y.defaultPrevented||await this.loggedInHandler(g)}else{(d=(c=this.stores)==null?void 0:c.schedulerConfig)==null||d.set("currentUser",null);const y=this.loggedOut.emit(this.host);if("loggedOut"in this.eventOverrides&&(await this.eventOverrides.loggedOut(y,this.nylasSchedulerConfigConnector),y.defaultPrevented))return}}(u=(h=this.stores)==null?void 0:h.schedulerConfig)==null||u.onChange("selectedConfiguration",async g=>{g&&g.id&&(this.configurationId=g.id)}),(f=this.baseProvider)==null||f.componentWillLoad(this.nylasSchedulerConfigConnector),this.applyThemeConfig(this.themeConfig)}async componentDidLoad(){var r;utils31933f5d.debug("[nylas-scheduler-editor] componentDidLoad"),await((r=this.baseProvider)==null?void 0:r.componentDidLoad()),this.updateLocalization(this.localization),this.version="2.1.0"}async componentDisconnected(){var r;await((r=this.baseProvider)==null?void 0:r.componentDisconnected())}async configurationIdChanged(r){var t,n,s,a,l,c,d,h;r?(await((n=(t=this.nylasSchedulerConfigConnector)==null?void 0:t.schedulerConfig)==null?void 0:n.getConfigurationById(r)),(a=(s=this.stores)==null?void 0:s.schedulerConfig)==null||a.set("action","edit")):((c=(l=this.stores)==null?void 0:l.schedulerConfig)==null||c.set("selectedConfiguration",{}),(h=(d=this.stores)==null?void 0:d.schedulerConfig)==null||h.set("action",null))}updateLocalization(r){r&&(Object.keys(r).forEach(t=>{t in constantsF51538ef.LANGUAGE_CODE&&utils31933f5d.instance.addResourceBundle(t,"translation",r[t],!1,!0)}),this.langVersion++)}updateNylasBranding(r){var t,n;(n=(t=this.stores)==null?void 0:t.schedulerConfig)==null||n.set("nylasBranding",r)}updateExperimentalFeatures(r){var t,n;(n=(t=this.stores)==null?void 0:t.schedulerConfig)==null||n.set("experimentalFeatures",r)}updateEnableEventTypes(r){var t,n;(n=(t=this.stores)==null?void 0:t.schedulerConfig)==null||n.set("enableEventTypes",r)}themeConfigChanged(r){var t,n;(n=(t=this.baseProvider)==null?void 0:t.getStore("schedulerConfig"))==null||n.set("themeConfig",r),this.applyThemeConfig(r)}applyThemeConfig(r){if(r)for(const[t,n]of Object.entries(r))this.host.style.setProperty(`${t}`,n)}async store(){var r;return(r=this.stores)==null?void 0:r.schedulerConfig}async schedulerConnector(){return this.nylasSchedulerConfigConnector}async registerComponentHandler(r){var t;(t=this.baseProvider)==null||t.registerComponent(r.detail)}async unregisterComponentHandler(r){var t;(t=this.baseProvider)==null||t.unregisterComponent(r.detail)}nylasFormDropdownChangedHandler(r){var s,a;const{name:t,value:n}=r.detail;t==="language"&&(this.selectedLanguage=constantsF51538ef.LANGUAGE_CODE[n],utils31933f5d.instance.changeLanguage(this.selectedLanguage),(a=(s=this.stores)==null?void 0:s.schedulerConfig)==null||a.set("selectedLanguage",this.selectedLanguage))}async loggedInHandler(r){var t,n,s,a,l,c,d;if((n=(t=this.stores)==null?void 0:t.schedulerConfig)==null||n.set("currentUser",r),!!this.nylasSchedulerConfigConnector&&(await((s=this.nylasSchedulerConfigConnector.schedulerConfig)==null?void 0:s.getCalendars()),this.configurationId)){const h=await((a=this.nylasSchedulerConfigConnector.schedulerConfig)==null?void 0:a.getConfigurationById(this.configurationId));h&&((l=h[0])!=null&&l.id)&&((d=(c=this.stores)==null?void 0:c.schedulerConfig)==null||d.set("action","edit"))}}render(){var a,l,c,d,h,u,f,g,y,p,m,x,_,v,R,T,O,P,N,k,A,w,b,q,S,L,$,X,j,z,Y,M,V,J,W,Z,Q,ee,te,ne,se,ie,re,oe;const r=this.host.querySelector('[slot="custom-page-style-inputs"]'),t=(c=(l=(a=this.stores)==null?void 0:a.schedulerConfig)==null?void 0:l.state.selectedConfiguration)==null?void 0:c.id,n=Object.keys(constantsF51538ef.LANGUAGE_MAP).map(U=>({label:constantsF51538ef.LANGUAGE_MAP[U],value:U})),s=((h=(d=this.stores)==null?void 0:d.schedulerConfig)==null?void 0:h.state.selectedEventType)===constantsF51538ef.CONFIGURATION_EVENT_TYPE.group||((g=(f=(u=this.stores)==null?void 0:u.schedulerConfig)==null?void 0:f.state.selectedConfiguration)==null?void 0:g.type)===constantsF51538ef.CONFIGURATION_EVENT_TYPE.group;return index.h(index.Host,{key:"8125ba9d8bbd8c1604ec4e57d769882137c7a6c5"},index.h("div",{key:"51222baddda6bd200080440ac46c390b5c754734",class:"scheduler-editor-header",part:"nse__header"},index.h("h1",{key:"91e8379a5068634421d8f272a5251ab578496e05",class:"scheduler-editor-title",part:"nse__title"},index.h("calendar-icon",{key:"1c040d10dff4fc86d257e446c8228033b9a02032",width:"18",height:"18"}),utils31933f5d.instance.t("schedulerEditorTitle"),index.h("tooltip-component",{key:"1e6c30c0958fbc8dde357d03c597eb70ce35271f"},index.h("info-icon",{key:"4ebd6aea27a62c33849659066860c5de75c0b7c7",slot:"tooltip-icon"}),index.h("span",{key:"4ddc14ba968a1d0053f5a5fb07473333186a8476",slot:"tooltip-content"},this.version))),index.h("div",{key:"679bbc03e8d3e155f843ae86af0ec037ee8c2d05",class:{language:!0},part:"nse__language"},index.h("select-dropdown",{key:"9f788d9d39f2a190ef388cacca206374e19da11c",name:"language",searchPlaceholder:utils31933f5d.instance.t("search"),options:n,withChevron:!1,themeConfig:this.themeConfig,defaultSelectedOption:n.find(U=>U.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"},index.h("span",{key:"76aa9b5b9adea974e1e8a7ac1f47faee3fc8a320",slot:"select-icon"},index.h("translate-icon",{key:"9dd3b210004d04b42c3d0209db60414c6c86c54c",width:"20",height:"20"})))),index.h("button",{key:"fa401a8ffb5f77caae60852e7a7be15f21868002",class:"scheduler-editor-close",title:"logout",onClick:U=>this.handleSchedulerConfigCloseClicked(U),part:"nse__close-button"},index.h("close-icon",{key:"96135ba113ecdad2d3223cc8df293d46b62565e5",width:"18",height:"18"}))),index.h("div",{key:"48970044629cfeafd07b4ccdb34e8d3ab67e0076",class:{"scheduler-editor-content":!0,"scheduler-editor-content--group":s},part:"nse__content"},((p=(y=this.stores)==null?void 0:y.schedulerConfig)==null?void 0:p.state.currentUser)&&this.stores.schedulerConfig.state.action===null&&index.h("div",{class:"list-configurations",part:"nse__list-configurations"},index.h("nylas-list-configurations",{exportparts:"nlc__create-new-cta, actions__dropdown, actions__dropdown-button, actions__dropdown-content, actions-Copy, actions-Preview, actions-Delete"})),((x=(m=this.stores)==null?void 0:m.schedulerConfig)==null?void 0:x.state.currentUser)&&this.stores.schedulerConfig.state.action==="create-select"&&index.h("nylas-select-event-type",null),((v=(_=this.stores)==null?void 0:_.schedulerConfig)==null?void 0:v.state.currentUser)&&this.stores.schedulerConfig.state.action==="create"&&s&&index.h("nylas-editor-tabs-group",{mode:"composable"},index.h(ExpressFlow,{selectedEventType:((O=(T=(R=this.stores)==null?void 0:R.schedulerConfig)==null?void 0:T.state)==null?void 0:O.selectedEventType)||constantsF51538ef.CONFIGURATION_EVENT_TYPE.one_on_one,currentUser:(N=(P=this.stores)==null?void 0:P.schedulerConfig)==null?void 0:N.state.currentUser,calendars:(w=(A=(k=this.stores)==null?void 0:k.schedulerConfig)==null?void 0:A.state)==null?void 0:w.calendars,selectedConfiguration:(S=(q=(b=this.stores)==null?void 0:b.schedulerConfig)==null?void 0:q.state)==null?void 0:S.selectedConfiguration})),(($=(L=this.stores)==null?void 0:L.schedulerConfig)==null?void 0:$.state.currentUser)&&this.stores.schedulerConfig.state.action==="create"&&!s&&index.h("nylas-editor-tabs",{mode:"composable"},index.h(ExpressFlow,{selectedEventType:((z=(j=(X=this.stores)==null?void 0:X.schedulerConfig)==null?void 0:j.state)==null?void 0:z.selectedEventType)||constantsF51538ef.CONFIGURATION_EVENT_TYPE.one_on_one,currentUser:(M=(Y=this.stores)==null?void 0:Y.schedulerConfig)==null?void 0:M.state.currentUser,calendars:(W=(J=(V=this.stores)==null?void 0:V.schedulerConfig)==null?void 0:J.state)==null?void 0:W.calendars,selectedConfiguration:(ee=(Q=(Z=this.stores)==null?void 0:Z.schedulerConfig)==null?void 0:Q.state)==null?void 0:ee.selectedConfiguration})),((ne=(te=this.stores)==null?void 0:te.schedulerConfig)==null?void 0:ne.state.currentUser)&&this.stores.schedulerConfig.state.action==="edit"&&s&&index.h("nylas-editor-tabs-group",{key:t,mode:this.mode},this.mode==="composable"&&index.h("slot",null),this.mode==="app"&&r&&index.h("div",{style:{display:"none"},slot:"custom-page-style-inputs",key:t},index.h("slot",{name:"custom-page-style-inputs"}))),((ie=(se=this.stores)==null?void 0:se.schedulerConfig)==null?void 0:ie.state.currentUser)&&this.stores.schedulerConfig.state.action==="edit"&&!s&&index.h("nylas-editor-tabs",{key:t,mode:this.mode},this.mode==="composable"&&index.h("slot",null),this.mode==="app"&&r&&index.h("div",{style:{display:"none"},slot:"custom-page-style-inputs",key:t},index.h("slot",{name:"custom-page-style-inputs"}))),!((oe=(re=this.stores)==null?void 0:re.schedulerConfig)!=null&&oe.state.currentUser)&&index.h("slot",{name:"login-required"},index.h(LoginRequired,{authenticationUrl:this.authenticationUrl}))))}get host(){return index.getElement(this)}static get watchers(){return{configurationId:["configurationIdChanged"],localization:["updateLocalization"],nylasBranding:["updateNylasBranding"],experimentalFeatures:["updateExperimentalFeatures"],enableEventTypes:["updateEnableEventTypes"],themeConfig:["themeConfigChanged"]}}};NylasSchedulerEditor.style=NylasSchedulerEditorStyle0;exports.nylas_scheduler_editor=NylasSchedulerEditor;
@@ -1,9 +1,12 @@
1
- import { i as d, r as te, a as P, b as A, k as N, l as V, m as ne, h as s, H as R, g as ie, e as se, F as oe } from "./index-140eb219.js";
2
- import { N as re } from "./abstract-provider-45ada3b4-abd3105d.js";
3
- import { E as M, i as ae, a as le, f as de, c as ce, b as he } from "./feedbackSync-0ebd0eda-803c3ebe.js";
4
- import { n as H } from "./index.es-57d4a08f-184cbc01.js";
1
+ import { r as te, c as P, h as s, H as R, g as ne, F as ie } from "./index-025be398.js";
2
+ import { N as se, c as oe } from "./index-c510313d-1318f67a.js";
3
+ import { i as d, b as A, e as N, f as V, h as re } from "./utils-31933f5d-15041585.js";
4
+ import { E as M, i as ae, a as le, f as de, c as ce, b as he } from "./feedbackSync-92220b42-fd5f5610.js";
5
+ import { n as H } from "./index.es-488bc919-ea63a7e9.js";
5
6
  import { L as j, a as Z } from "./constants-f51538ef-e0a5f026.js";
7
+ import "@nylas/web-elements";
6
8
  import "react";
9
+ import "@nylas/connect";
7
10
  import "react/jsx-runtime";
8
11
  import "react-dom";
9
12
  class ge {
@@ -115,7 +118,7 @@ class ue {
115
118
  }
116
119
  async makeAPIRequest(e, t, o, n = {}) {
117
120
  try {
118
- const a = new URL(this.schedulerAPIURL), r = "2.0.6";
121
+ const a = new URL(this.schedulerAPIURL), r = "2.1.0";
119
122
  return a.pathname = e, await (await fetch(decodeURIComponent(a.toString()), {
120
123
  method: t,
121
124
  headers: {
@@ -548,7 +551,7 @@ function pe(i = {}) {
548
551
  ...i
549
552
  };
550
553
  A("[defaultNylasStoreState]: ", e);
551
- const t = se(e);
554
+ const t = oe(e);
552
555
  return t.onChange("availability", (o) => {
553
556
  A("[availability]: ", o);
554
557
  const n = o.map((l) => l.start_time);
@@ -568,7 +571,7 @@ function pe(i = {}) {
568
571
  const z = (i, e) => {
569
572
  const t = i.isLoading, o = i.showNotification, n = i.nylasBranding, a = i.version;
570
573
  return s(
571
- oe,
574
+ ie,
572
575
  null,
573
576
  o && s("nylas-notification", null),
574
577
  t && s(
@@ -610,14 +613,14 @@ const z = (i, e) => {
610
613
  );
611
614
  }, K = (i, e) => s("div", { class: "message-banner" }, e), me = ':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-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--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;gap:8px;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}.language-feedback-container{width:auto;position:absolute;bottom:4px;left:16px;display:flex;gap:8px;align-items:center}.language-feedback-container button-component#report-issue{position:initial}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}', be = me, Q = { title: d.t("genericErrorTitle"), type: H.Error, category: M.Component }, _e = class {
612
615
  constructor(i) {
613
- te(this, i), this.init = P(this, "init", 7), this.schedulerWillLoad = P(this, "schedulerWillLoad", 7), this.schedulerDidLoad = P(this, "schedulerDidLoad", 7), this.nylasSchedulerError = P(this, "nylasSchedulerError", 7), this.nylasSchedulerInfo = P(this, "nylasSchedulerInfo", 7), this.configSettingsLoaded = P(this, "configSettingsLoaded", 7), this.bookingRefExtracted = P(this, "bookingRefExtracted", 7), this.bookedEventInfo = P(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.defaultLanguage = void 0, this.showNotification = !0, this.enableUserFeedback = !0, this.hour12 = void 0, this.automaticComponentRegistration = !0, this.selectedDateLabel = (/* @__PURE__ */ new Date()).toLocaleDateString(navigator.language, { dateStyle: "full" }) || `${d.t("noDateSelected")}`, this.refConfigId = void 0, this.language = navigator.language, this.showFeedbackModal = !1, this.bookingInfoConfirmed = null, this.version = "2.0.6";
616
+ te(this, i), this.init = P(this, "init", 7), this.schedulerWillLoad = P(this, "schedulerWillLoad", 7), this.schedulerDidLoad = P(this, "schedulerDidLoad", 7), this.nylasSchedulerError = P(this, "nylasSchedulerError", 7), this.nylasSchedulerInfo = P(this, "nylasSchedulerInfo", 7), this.configSettingsLoaded = P(this, "configSettingsLoaded", 7), this.bookingRefExtracted = P(this, "bookingRefExtracted", 7), this.bookedEventInfo = P(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.defaultLanguage = void 0, this.showNotification = !0, this.enableUserFeedback = !0, this.hour12 = void 0, this.automaticComponentRegistration = !0, this.selectedDateLabel = (/* @__PURE__ */ new Date()).toLocaleDateString(navigator.language, { dateStyle: "full" }) || `${d.t("noDateSelected")}`, this.refConfigId = void 0, this.language = navigator.language, this.showFeedbackModal = !1, this.bookingInfoConfirmed = null, this.version = "2.1.0";
614
617
  }
615
618
  connectedCallback() {
616
619
  A("[nylas-scheduler] connectedCallback");
617
620
  }
618
621
  async componentWillLoad() {
619
622
  var l, c, m;
620
- A("[nylas-scheduler] Component will load"), this.version = "2.0.6", this.enableUserFeedback && !ae() && le({
623
+ A("[nylas-scheduler] Component will load"), this.version = "2.1.0", this.enableUserFeedback && !ae() && le({
621
624
  dsn: "https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",
622
625
  release: this.version,
623
626
  integrations: (h) => [
@@ -643,7 +646,7 @@ const z = (i, e) => {
643
646
  selectedLanguage: o || this.defaultLanguage || ((l = this.bookingInfo) == null ? void 0 : l.language) || j.en,
644
647
  ...this.defaultSchedulerState
645
648
  })
646
- }, this.baseProvider = new re(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.refConfigId = this.configurationId;
649
+ }, this.baseProvider = new se(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.refConfigId = this.configurationId;
647
650
  let n;
648
651
  if (this.rescheduleBookingRef) {
649
652
  const [h, g, f] = N(this.rescheduleBookingRef);
@@ -655,7 +658,7 @@ const z = (i, e) => {
655
658
  const [h, g, f] = N(this.organizerConfirmationBookingRef);
656
659
  this.refConfigId = h, this.stores.scheduler.set("organizerConfirmationBookingId", g), this.stores.scheduler.set("organizerConfirmationSalt", f), n = this.bookingRefExtracted.emit({ configurationId: h, bookingId: g, salt: f });
657
660
  }
658
- if ("bookingRefExtracted" in this.eventOverrides && (await this.eventOverrides.bookingRefExtracted(n, this.nylasSchedulerConnector), n.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
661
+ if (this.applyThemeConfig(this.themeConfig), "bookingRefExtracted" in this.eventOverrides && (await this.eventOverrides.bookingRefExtracted(n, this.nylasSchedulerConnector), n.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
659
662
  return;
660
663
  const a = (c = this.baseProvider) == null ? void 0 : c.getStore("scheduler");
661
664
  this.nylasSchedulerConnector = new fe({
@@ -667,7 +670,7 @@ const z = (i, e) => {
667
670
  nylasSchedulerStore: a
668
671
  });
669
672
  const r = this.init.emit(this.host);
670
- "init" in this.eventOverrides && (await this.eventOverrides.init(r, this.nylasSchedulerConnector), r.defaultPrevented) || ((m = this.baseProvider) == null || m.componentWillLoad(this.nylasSchedulerConnector), this.applyThemeConfig(this.themeConfig));
673
+ "init" in this.eventOverrides && (await this.eventOverrides.init(r, this.nylasSchedulerConnector), r.defaultPrevented) || (m = this.baseProvider) == null || m.componentWillLoad(this.nylasSchedulerConnector);
671
674
  }
672
675
  async componentDidLoad() {
673
676
  var c, m, h, g, f, b, p, I;
@@ -945,7 +948,7 @@ const z = (i, e) => {
945
948
  render() {
946
949
  var _, y, k, w, L, C, v, B, F, U, q, x;
947
950
  const i = this.mode === "app", e = (_ = this.baseProvider) == null ? void 0 : _.getStore("scheduler"), t = e == null ? void 0 : e.get("eventInfo"), o = e == null ? void 0 : e.get("showBookingForm"), n = 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"), m = e == null ? void 0 : e.get("rejectBookingId"), h = e == null ? void 0 : e.get("confirmedEventInfo"), g = (e == null ? void 0 : e.get("nylasBranding")) || this.nylasBranding, f = e == null ? void 0 : e.get("selectedDate"), b = (k = (y = e == null ? void 0 : e.get("configSettings")) == null ? void 0 : y.scheduler) == null ? void 0 : k.confirmation_redirect_url;
948
- this.selectedDateLabel = f && this.language ? ne(f.toLocaleDateString(this.language, { dateStyle: "full" })) : `${d.t("noDateSelected")}`;
951
+ this.selectedDateLabel = f && this.language ? re(f.toLocaleDateString(this.language, { dateStyle: "full" })) : `${d.t("noDateSelected")}`;
949
952
  const p = Object.keys(Z).map((u) => ({
950
953
  label: Z[u],
951
954
  value: u
@@ -979,7 +982,7 @@ const z = (i, e) => {
979
982
  return i && !t && o ? s(R, null, s(z, { version: this.version, nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, l && s(K, null, `${d.t("rescheduleTitle")}`), s("div", { class: "additional-data-page", part: "additional-data-page ns_additional-data-page" }, s("div", { class: "left-panel ns_left-panel", part: "ns_left-panel" }, s("div", { class: "wrapper", part: "ns_left-panel__wrapper" }, s("nylas-selected-event-card", { exportparts: "nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone" }))), s("div", { class: `right-panel ${l ? "reschedule" : ""}`, part: `ns_right-panel ${l ? "ns_reschedule" : ""}` }, s("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" })))), s("div", { class: "language-feedback-container" }, this.enableUserFeedback && s("button-component", { id: "report-issue", variant: "basic", onClick: (u) => this.onFeedbackClick(u) }, s("feedback-icon", null)), s("select-dropdown", { name: "language", searchPlaceholder: d.t("search"), options: p, withChevron: !1, themeConfig: this.themeConfig, defaultSelectedOption: p.find((u) => u.value == I), 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" }, s("span", { slot: "select-icon" }, s("translate-icon", { width: "20", height: "20" })))), this.showFeedbackModal && s("nylas-feedback-form", null)) : s(R, null, s("slot", null));
980
983
  }
981
984
  get host() {
982
- return ie(this);
985
+ return ne(this);
983
986
  }
984
987
  static get watchers() {
985
988
  return {