@nylas/react 1.1.0-canary.16 → 1.1.0-canary.17

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 (121) hide show
  1. package/dist/add-circle-icon_2.entry-936fd73b.cjs +1 -0
  2. package/dist/add-circle-icon_2.entry-ce6aaa1d.js +25 -0
  3. package/dist/{archive-icon_7.entry-54dc5cc2.js → archive-icon_7.entry-60e900b6.js} +18 -18
  4. package/dist/{archive-icon_7.entry-073d9915.cjs → archive-icon_7.entry-8c8317e9.cjs} +1 -1
  5. package/dist/{arrow-icon.entry-869a1db9.js → arrow-icon.entry-057db95a.js} +2 -2
  6. package/dist/{arrow-icon.entry-bada78b8.cjs → arrow-icon.entry-2d4e9572.cjs} +1 -1
  7. package/dist/bold-icon_3.entry-557c6007.js +35 -0
  8. package/dist/{bold-icon_3.entry-cc6150c9.cjs → bold-icon_3.entry-ba732761.cjs} +1 -1
  9. package/dist/{button-component.entry-a0533c8b.js → button-component.entry-22d0ac2e.js} +2 -2
  10. package/dist/{button-component.entry-3703ecff.cjs → button-component.entry-385f9581.cjs} +1 -1
  11. package/dist/{calendar-cancel-icon.entry-a9ab0b09.js → calendar-cancel-icon.entry-820cf967.js} +5 -5
  12. package/dist/{calendar-cancel-icon.entry-0f1d98b3.cjs → calendar-cancel-icon.entry-b2657caf.cjs} +1 -1
  13. package/dist/{calendar-check-icon_2.entry-a62b5d2c.js → calendar-check-icon_2.entry-128a5d67.js} +9 -9
  14. package/dist/{calendar-check-icon_2.entry-6b83717e.cjs → calendar-check-icon_2.entry-b13e7cbb.cjs} +1 -1
  15. package/dist/{calendar-icon.entry-ddc22561.js → calendar-icon.entry-a43e6011.js} +5 -5
  16. package/dist/{calendar-icon.entry-08f83da9.cjs → calendar-icon.entry-d17d7cfb.cjs} +1 -1
  17. package/dist/calendar-info-icon_28.entry-b4f09bfe.cjs +1 -0
  18. package/dist/{calendar-info-icon_27.entry-f02f44b7.js → calendar-info-icon_28.entry-b71c23c5.js} +526 -700
  19. package/dist/{chevron-icon_3.entry-978b52d5.cjs → chevron-icon_3.entry-4807a0b1.cjs} +1 -1
  20. package/dist/{chevron-icon_3.entry-f27202a2.js → chevron-icon_3.entry-e0796c69.js} +5 -5
  21. package/dist/{clock-icon_2.entry-b7b8ef46.cjs → clock-icon_2.entry-267614c2.cjs} +1 -1
  22. package/dist/{clock-icon_2.entry-2277fd45.js → clock-icon_2.entry-e959ae50.js} +7 -7
  23. package/dist/{constants-f34b9c6e-ccdbc4ac.cjs → constants-f34b9c6e-ebc2e19c.cjs} +1 -1
  24. package/dist/{constants-f34b9c6e-bbca6b6e.js → constants-f34b9c6e-efe2836b.js} +1 -1
  25. package/dist/{document-refresh-icon.entry-656a5e02.js → document-refresh-icon.entry-b4c217df.js} +2 -2
  26. package/dist/{document-refresh-icon.entry-5795e2a9.cjs → document-refresh-icon.entry-b8850675.cjs} +1 -1
  27. package/dist/elements/index.d.ts +1 -0
  28. package/dist/{elements-dc5b338e-d48368b1.cjs → elements-dc5b338e-a33785e3.cjs} +1 -1
  29. package/dist/{elements-dc5b338e-c4a07acc.js → elements-dc5b338e-b0a290ae.js} +1 -1
  30. package/dist/{focus-visible-e8093c16-10c0fa06.js → focus-visible-e8093c16-5f1ae916.js} +1 -1
  31. package/dist/{focus-visible-e8093c16-c86f3687.cjs → focus-visible-e8093c16-d2afb13d.cjs} +1 -1
  32. package/dist/{forward-icon_6.entry-07cd4b52.cjs → forward-icon_6.entry-0009e4f0.cjs} +3 -3
  33. package/dist/{forward-icon_6.entry-39d788af.js → forward-icon_6.entry-53683e82.js} +9 -9
  34. package/dist/{globe-icon.entry-60a53e89.js → globe-icon.entry-dbb47687.js} +4 -4
  35. package/dist/{globe-icon.entry-76c90d97.cjs → globe-icon.entry-df67eab8.cjs} +1 -1
  36. package/dist/google-logo-icon_4.entry-77f3b86e.js +454 -0
  37. package/dist/google-logo-icon_4.entry-c5db1be3.cjs +1 -0
  38. package/dist/index-53420959-16700a42.cjs +1 -0
  39. package/dist/index-53420959-f0c4f9af.js +5 -0
  40. package/dist/{index-f383e3c4.js → index-5851f0a2.js} +902 -901
  41. package/dist/{index-6d9eeb53-38c9f47c.js → index-6d9eeb53-2f37342f.js} +2 -2
  42. package/dist/{index-6d9eeb53-66c114b2.cjs → index-6d9eeb53-ded66877.cjs} +1 -1
  43. package/dist/{index-f435e814.cjs → index-769f0fdd.cjs} +3 -3
  44. package/dist/{index.es-9cc0eb3c-510db795.js → index.es-9cc0eb3c-2cf4632f.js} +1 -1
  45. package/dist/{index.es-9cc0eb3c-09dc620b.cjs → index.es-9cc0eb3c-e8de46e6.cjs} +1 -1
  46. package/dist/{info-icon_2.entry-a61859ac.js → info-icon_2.entry-c27ac645.js} +3 -3
  47. package/dist/{info-icon_2.entry-7fe8bcd9.cjs → info-icon_2.entry-e355fb7d.cjs} +1 -1
  48. package/dist/{input-component.entry-12f60175.js → input-component.entry-a38a65da.js} +4 -4
  49. package/dist/{input-component.entry-04dcc655.cjs → input-component.entry-ef2b397d.cjs} +1 -1
  50. package/dist/input-dropdown_2.entry-9e50060e.cjs +1 -0
  51. package/dist/{input-dropdown_2.entry-0e5925a7.js → input-dropdown_2.entry-ce1da1b3.js} +35 -28
  52. package/dist/loading-icon.entry-175aca19.cjs +1 -0
  53. package/dist/loading-icon.entry-4ab88ed8.js +15 -0
  54. package/dist/{mailbox-store-64b4ef7c-017196a6.js → mailbox-store-64b4ef7c-47dac9aa.js} +2 -2
  55. package/dist/{mailbox-store-64b4ef7c-1e6c96cc.cjs → mailbox-store-64b4ef7c-ebe84c96.cjs} +1 -1
  56. package/dist/{nylas-booked-event-card_10.entry-5a9a4cc6.cjs → nylas-booked-event-card_10.entry-6de99d57.cjs} +1 -1
  57. package/dist/{nylas-booked-event-card_10.entry-2dff7f16.js → nylas-booked-event-card_10.entry-ef9c2d62.js} +9 -9
  58. package/dist/{nylas-custom-booking-flow.entry-36f7a943.cjs → nylas-custom-booking-flow.entry-c59c1306.cjs} +1 -1
  59. package/dist/{nylas-custom-booking-flow.entry-feed589b.js → nylas-custom-booking-flow.entry-f31400e2.js} +7 -7
  60. package/dist/{nylas-form-card.entry-49f519dd.js → nylas-form-card.entry-b189e066.js} +8 -8
  61. package/dist/{nylas-form-card.entry-e9f09602.cjs → nylas-form-card.entry-bc048703.cjs} +1 -1
  62. package/dist/{nylas-if-state.entry-127694a9.js → nylas-if-state.entry-5bdf8669.js} +3 -3
  63. package/dist/{nylas-if-state.entry-81916723.cjs → nylas-if-state.entry-933c79e0.cjs} +1 -1
  64. package/dist/{nylas-list-folders.entry-f4c68fb9.cjs → nylas-list-folders.entry-5d1bef7f.cjs} +1 -1
  65. package/dist/{nylas-list-folders.entry-e3e9ec1f.js → nylas-list-folders.entry-f0e7ae4e.js} +3 -3
  66. package/dist/{nylas-list-threads.entry-f0a1b9d1.cjs → nylas-list-threads.entry-3e300e7e.cjs} +1 -1
  67. package/dist/{nylas-list-threads.entry-fa4b5318.js → nylas-list-threads.entry-3f7451ad.js} +3 -3
  68. package/dist/{nylas-login.entry-aeac716e.cjs → nylas-login.entry-dbf9e11f.cjs} +1 -1
  69. package/dist/{nylas-login.entry-6d17e994.js → nylas-login.entry-e3b757a0.js} +7 -7
  70. package/dist/{nylas-mailbox-pagination.entry-50fba238.cjs → nylas-mailbox-pagination.entry-0db12a01.cjs} +1 -1
  71. package/dist/{nylas-mailbox-pagination.entry-c440f56a.js → nylas-mailbox-pagination.entry-6c845a2a.js} +2 -2
  72. package/dist/{nylas-mailbox-toolbar-button.entry-d3d0c870.cjs → nylas-mailbox-toolbar-button.entry-553f041a.cjs} +1 -1
  73. package/dist/{nylas-mailbox-toolbar-button.entry-14e30d36.js → nylas-mailbox-toolbar-button.entry-ec196947.js} +4 -4
  74. package/dist/{nylas-mailbox.entry-a59159c7.js → nylas-mailbox.entry-1552ad11.js} +7 -7
  75. package/dist/{nylas-mailbox.entry-2fdb3d4c.cjs → nylas-mailbox.entry-c0bbca56.cjs} +1 -1
  76. package/dist/{nylas-provider.entry-d7dbb5fc.js → nylas-provider.entry-6d286e92.js} +37 -37
  77. package/dist/{nylas-provider.entry-dfa8c7c1.cjs → nylas-provider.entry-d4bf23c2.cjs} +1 -1
  78. package/dist/{nylas-scheduler-editor.entry-67e71234.cjs → nylas-scheduler-editor.entry-00a71304.cjs} +1 -1
  79. package/dist/{nylas-scheduler-editor.entry-3b44b807.js → nylas-scheduler-editor.entry-caa1026b.js} +4 -4
  80. package/dist/{nylas-scheduling.entry-68f72bf7.js → nylas-scheduling.entry-19ff3d50.js} +3 -3
  81. package/dist/{nylas-scheduling.entry-0ce0dab9.cjs → nylas-scheduling.entry-f1fb67d2.cjs} +1 -1
  82. package/dist/{nylas-threads-refresh.entry-23a83bd4.js → nylas-threads-refresh.entry-6acf3c2b.js} +4 -4
  83. package/dist/{nylas-threads-refresh.entry-955e92c7.cjs → nylas-threads-refresh.entry-bc4c10ea.cjs} +1 -1
  84. package/dist/{nylas-threads-search.entry-8f01ee4a.js → nylas-threads-search.entry-82fa1504.js} +5 -5
  85. package/dist/{nylas-threads-search.entry-2fb6db63.cjs → nylas-threads-search.entry-ee28712c.cjs} +1 -1
  86. package/dist/nylas-time-window-picker.entry-131f84b4.cjs +1 -0
  87. package/dist/nylas-time-window-picker.entry-3c45d82e.js +316 -0
  88. package/dist/{nylas-view-thread.entry-3cf0c1ac.cjs → nylas-view-thread.entry-0d9a4aa9.cjs} +1 -1
  89. package/dist/{nylas-view-thread.entry-b957f88b.js → nylas-view-thread.entry-695a7b0b.js} +6 -6
  90. package/dist/{play-icon_2.entry-ecdf8ea4.js → play-icon_2.entry-ab47588e.js} +3 -3
  91. package/dist/{play-icon_2.entry-c92d5237.cjs → play-icon_2.entry-b1167d3a.cjs} +1 -1
  92. package/dist/react.cjs +1 -1
  93. package/dist/react.js +41 -40
  94. package/dist/{refresh-icon.entry-76e58ccb.cjs → refresh-icon.entry-28e3ade7.cjs} +1 -1
  95. package/dist/{refresh-icon.entry-480d28aa.js → refresh-icon.entry-43267155.js} +5 -5
  96. package/dist/{register-component-a5a9ca5d-438c8a96.js → register-component-a5a9ca5d-538c35c3.js} +1 -1
  97. package/dist/{register-component-a5a9ca5d-ebf633cf.cjs → register-component-a5a9ca5d-8b06415c.cjs} +1 -1
  98. package/dist/{scheduler-config-store-4a50a03d-d5a5899e.cjs → scheduler-config-store-4a50a03d-40e87f35.cjs} +1 -1
  99. package/dist/{scheduler-config-store-4a50a03d-defa6368.js → scheduler-config-store-4a50a03d-4a2e2abf.js} +1 -1
  100. package/dist/{scheduler-store-f02ce045-de4cb1f5.js → scheduler-store-f02ce045-121c1e09.js} +1 -1
  101. package/dist/{scheduler-store-f02ce045-00faab09.cjs → scheduler-store-f02ce045-f11cfad9.cjs} +1 -1
  102. package/dist/{textarea-component.entry-1c8d11af.js → textarea-component.entry-1ec19adb.js} +4 -4
  103. package/dist/{textarea-component.entry-5ff249a8.cjs → textarea-component.entry-402a369b.cjs} +1 -1
  104. package/dist/{translate-icon.entry-a55c013b.cjs → translate-icon.entry-59f4e190.cjs} +1 -1
  105. package/dist/{translate-icon.entry-3741cac0.js → translate-icon.entry-d412697e.js} +6 -6
  106. package/dist/{warning-icon.entry-445352b5.js → warning-icon.entry-3ee1f451.js} +5 -5
  107. package/dist/{warning-icon.entry-1a104c52.cjs → warning-icon.entry-aa6b2c2c.cjs} +1 -1
  108. package/package.json +2 -2
  109. package/dist/add-circle-icon_2.entry-035ffd48.cjs +0 -1
  110. package/dist/add-circle-icon_2.entry-5cadaf97.js +0 -25
  111. package/dist/bold-icon_3.entry-5695177e.js +0 -35
  112. package/dist/calendar-info-icon_27.entry-a8390790.cjs +0 -1
  113. package/dist/google-logo-icon_4.entry-5402eae2.cjs +0 -1
  114. package/dist/google-logo-icon_4.entry-d327d68f.js +0 -438
  115. package/dist/index-53420959-791b4e73.js +0 -5
  116. package/dist/index-53420959-9f979766.cjs +0 -1
  117. package/dist/input-dropdown_2.entry-d9bff099.cjs +0 -1
  118. package/dist/loading-icon.entry-51ddd748.js +0 -15
  119. package/dist/loading-icon.entry-f82786b4.cjs +0 -1
  120. package/dist/toggle-switch.entry-26d3d1c9.cjs +0 -1
  121. package/dist/toggle-switch.entry-339ab48b.js +0 -25
@@ -1,13 +1,13 @@
1
- import { r as C, c as h, d as a, h as g, H as S, g as m } from "./index-f383e3c4.js";
2
- import { N as b, e as f } from "./index.es-9cc0eb3c-510db795.js";
3
- import { C as A, a as p, H as v, N as P, b as _, c as N, d as w } from "./mailbox-store-64b4ef7c-017196a6.js";
4
- import { C as x, N as I } from "./scheduler-store-f02ce045-de4cb1f5.js";
5
- import { C as M } from "./scheduler-config-store-4a50a03d-defa6368.js";
1
+ import { r as C, c as h, d as a, h as g, H as S, g as f } from "./index-5851f0a2.js";
2
+ import { N as m, e as b } from "./index.es-9cc0eb3c-2cf4632f.js";
3
+ import { C as A, a as p, H as v, N as P, b as _, c as N, d as w } from "./mailbox-store-64b4ef7c-47dac9aa.js";
4
+ import { C as x, N as I } from "./scheduler-store-f02ce045-121c1e09.js";
5
+ import { C as M } from "./scheduler-config-store-4a50a03d-4a2e2abf.js";
6
6
  import "react";
7
7
  import "react-dom";
8
8
  class E {
9
- constructor(e, s, r, o, l, n, i = "https://api.us.nylas.com") {
10
- this.router = e, this.schedulerAPIURL = i, this.nylasAuth = s, this.nylasAuthStore = r, this.nylasMailboxStore = o, this.nylasSchedulerStore = l, this.nylasSchedulerConfigStore = n;
9
+ constructor(t, s, r, o, l, n, i = "https://api.us.nylas.com") {
10
+ this.router = t, this.schedulerAPIURL = i, this.nylasAuth = s, this.nylasAuthStore = r, this.nylasMailboxStore = o, this.nylasSchedulerStore = l, this.nylasSchedulerConfigStore = n;
11
11
  }
12
12
  init() {
13
13
  a("NylasConnector init");
@@ -53,9 +53,9 @@ class E {
53
53
  }
54
54
  }
55
55
  const L = ":host{display:contents}", R = L, T = class {
56
- constructor(t) {
57
- C(this, t), this.init = h(this, "init", 7), this.loggedIn = h(this, "loggedIn", 7), this.loggedOut = h(this, "loggedOut", 7), this.handleAuthChange = async (e) => {
58
- e ? this.loggedIn.emit(this.host) : this.loggedOut.emit(this.host);
56
+ constructor(e) {
57
+ C(this, e), this.init = h(this, "init", 7), this.loggedIn = h(this, "loggedIn", 7), this.loggedOut = h(this, "loggedOut", 7), this.handleAuthChange = async (t) => {
58
+ t ? this.loggedIn.emit(this.host) : this.loggedOut.emit(this.host);
59
59
  }, this.authConfig = void 0, this.eventOverrides = {}, this.automaticComponentRegistration = !0;
60
60
  }
61
61
  connectedCallback() {
@@ -68,9 +68,9 @@ const L = ":host{display:contents}", R = L, T = class {
68
68
  mailbox: p(),
69
69
  scheduler: x(),
70
70
  schedulerConfig: M()
71
- }, this.baseProvider = new b(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);
72
- const t = new v();
73
- this.nylasAuth = f({
71
+ }, this.baseProvider = new m(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);
72
+ const e = new v();
73
+ this.nylasAuth = b({
74
74
  apiUri: "https://api.us.nylas.com",
75
75
  elementsApiUri: "https://elements.us.nylas.com",
76
76
  storageType: "indexeddb",
@@ -79,8 +79,8 @@ const L = ":host{display:contents}", R = L, T = class {
79
79
  redirectURI: "/",
80
80
  ...this.authConfig
81
81
  });
82
- const e = (n = this.baseProvider) == null ? void 0 : n.getStore("mailbox");
83
- if (!e)
82
+ const t = (n = this.baseProvider) == null ? void 0 : n.getStore("mailbox");
83
+ if (!t)
84
84
  throw new Error("The mailbox store is not set");
85
85
  const s = (i = this.baseProvider) == null ? void 0 : i.getStore("auth");
86
86
  if (!s)
@@ -91,24 +91,24 @@ const L = ":host{display:contents}", R = L, T = class {
91
91
  const o = (u = this.baseProvider) == null ? void 0 : u.getStore("schedulerConfig");
92
92
  if (!o)
93
93
  throw new Error("The scheduler config store is not set");
94
- this.nylasConnector = new E(t, this.nylasAuth, s, e, r, o), this.init.emit(this.host).defaultPrevented || await ((d = this.nylasConnector) == null ? void 0 : d.auth.validateSession()), this.handleAuthChange(s.state.isAuthenticated), (y = this.baseProvider) == null || y.componentWillLoad(this.nylasConnector);
94
+ this.nylasConnector = new E(e, this.nylasAuth, s, t, r, o), this.init.emit(this.host).defaultPrevented || await ((d = this.nylasConnector) == null ? void 0 : d.auth.validateSession()), this.handleAuthChange(s.state.isAuthenticated), (y = this.baseProvider) == null || y.componentWillLoad(this.nylasConnector);
95
95
  }
96
96
  componentDidLoad() {
97
- var e, s;
98
- const t = (e = this.baseProvider) == null ? void 0 : e.getStore("auth");
99
- t == null || t.onChange("isAuthenticated", this.handleAuthChange), (s = this.baseProvider) == null || s.componentDidLoad();
97
+ var t, s;
98
+ const e = (t = this.baseProvider) == null ? void 0 : t.getStore("auth");
99
+ e == null || e.onChange("isAuthenticated", this.handleAuthChange), (s = this.baseProvider) == null || s.componentDidLoad();
100
100
  }
101
101
  componentDisconnected() {
102
- var t;
103
- (t = this.baseProvider) == null || t.componentDisconnected();
104
- }
105
- async registerComponentHandler(t) {
106
102
  var e;
107
- (e = this.baseProvider) == null || e.registerComponent(t.detail);
103
+ (e = this.baseProvider) == null || e.componentDisconnected();
108
104
  }
109
- async unregisterComponentHandler(t) {
110
- var e;
111
- (e = this.baseProvider) == null || e.unregisterComponent(t.detail);
105
+ async registerComponentHandler(e) {
106
+ var t;
107
+ (t = this.baseProvider) == null || t.registerComponent(e.detail);
108
+ }
109
+ async unregisterComponentHandler(e) {
110
+ var t;
111
+ (t = this.baseProvider) == null || t.unregisterComponent(e.detail);
112
112
  }
113
113
  async getNylasAuth() {
114
114
  return this.nylasAuth;
@@ -117,26 +117,26 @@ const L = ":host{display:contents}", R = L, T = class {
117
117
  return this.nylasConnector;
118
118
  }
119
119
  async getMailboxStore() {
120
- var t;
121
- return (t = this.baseProvider) == null ? void 0 : t.getStore("mailbox");
120
+ var e;
121
+ return (e = this.baseProvider) == null ? void 0 : e.getStore("mailbox");
122
122
  }
123
123
  async getAuthStore() {
124
- var t;
125
- return (t = this.baseProvider) == null ? void 0 : t.getStore("auth");
124
+ var e;
125
+ return (e = this.baseProvider) == null ? void 0 : e.getStore("auth");
126
126
  }
127
127
  async getNylasSchedulerStore() {
128
- var t;
129
- return (t = this.baseProvider) == null ? void 0 : t.getStore("scheduler");
128
+ var e;
129
+ return (e = this.baseProvider) == null ? void 0 : e.getStore("scheduler");
130
130
  }
131
131
  async getNylasSchedulerConfigStore() {
132
- var t;
133
- return (t = this.baseProvider) == null ? void 0 : t.getStore("schedulerConfig");
132
+ var e;
133
+ return (e = this.baseProvider) == null ? void 0 : e.getStore("schedulerConfig");
134
134
  }
135
135
  render() {
136
- return g(S, { key: "57612ac13296cebf2c8731bcb9329f980db034d3" }, g("slot", { key: "d752cd8c4cd47c9c17d57e23477d3a7720cbc8f5" }));
136
+ return g(S, { key: "7fee35047bafd5dc2f77e83012fe5149f17f7f9f" }, g("slot", { key: "96dcdef76b63b551e2deb56bfd0d1497ff897114" }));
137
137
  }
138
138
  get host() {
139
- return m(this);
139
+ return f(this);
140
140
  }
141
141
  };
142
142
  T.style = R;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-f435e814.cjs"),g=require("./index.es-9cc0eb3c-09dc620b.cjs"),o=require("./mailbox-store-64b4ef7c-1e6c96cc.cjs"),S=require("./scheduler-store-f02ce045-00faab09.cjs"),b=require("./scheduler-config-store-4a50a03d-d5a5899e.cjs");require("react");require("react-dom");class f{constructor(t,r,n,i,l,h,a="https://api.us.nylas.com"){this.router=t,this.schedulerAPIURL=a,this.nylasAuth=r,this.nylasAuthStore=n,this.nylasMailboxStore=i,this.nylasSchedulerStore=l,this.nylasSchedulerConfigStore=h}init(){s.debug("NylasConnector init")}get authStore(){return this.nylasAuthStore}get mailboxStore(){return this.nylasMailboxStore}get schedulerStore(){return this.nylasSchedulerStore}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get auth(){return this._authConnector?this._authConnector:(this._authConnector=new o.NylasAuthConnector(this.nylasAuth,this.nylasAuthStore),this._authConnector)}get threads(){return this._threadConnector?this._threadConnector:(this._threadConnector=new o.NylasThreadsConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore,this.router),this._threadConnector)}get messages(){return this._messageConnector?this._messageConnector:(this._messageConnector=new o.NylasMessagesConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._messageConnector)}get folders(){return this._foldersConnector?this._foldersConnector:(this._foldersConnector=new o.NylasFoldersConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._foldersConnector)}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new S.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore}),this._schedulerAPIConnector)}getAuth(){return this.nylasAuth}resetStores(){this.nylasAuthStore.reset(),this.nylasMailboxStore.reset()}async logout(){await this.nylasAuth.logout(),this.resetStores()}}const m=":host{display:contents}",A=m,C=class{constructor(e){s.registerInstance(this,e),this.init=s.createEvent(this,"init",7),this.loggedIn=s.createEvent(this,"loggedIn",7),this.loggedOut=s.createEvent(this,"loggedOut",7),this.handleAuthChange=async t=>{t?this.loggedIn.emit(this.host):this.loggedOut.emit(this.host)},this.authConfig=void 0,this.eventOverrides={},this.automaticComponentRegistration=!0}connectedCallback(){s.debug("[nylas-provider] connectedCallback")}async componentWillLoad(){var h,a,c,u,d,y;s.debug("[nylas-provider] componentWillLoad"),this.stores={auth:o.CreateNylasAuthStore(),mailbox:o.CreateNylasMailboxStore(),scheduler:S.CreateNylasSchedulerStore(),schedulerConfig:b.CreateNylasSchedulerConfigStore()},this.baseProvider=new g.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const e=new o.HashRouter;this.nylasAuth=g.es({apiUri:"https://api.us.nylas.com",elementsApiUri:"https://elements.us.nylas.com",storageType:"indexeddb",clientId:"YOUR_CLIENT_ID",defaultScopes:[],redirectURI:"/",...this.authConfig});const t=(h=this.baseProvider)==null?void 0:h.getStore("mailbox");if(!t)throw new Error("The mailbox store is not set");const r=(a=this.baseProvider)==null?void 0:a.getStore("auth");if(!r)throw new Error("The auth store is not set");const n=(c=this.baseProvider)==null?void 0:c.getStore("scheduler");if(!n)throw new Error("The scheduler store is not set");const i=(u=this.baseProvider)==null?void 0:u.getStore("schedulerConfig");if(!i)throw new Error("The scheduler config store is not set");this.nylasConnector=new f(e,this.nylasAuth,r,t,n,i),this.init.emit(this.host).defaultPrevented||await((d=this.nylasConnector)==null?void 0:d.auth.validateSession()),this.handleAuthChange(r.state.isAuthenticated),(y=this.baseProvider)==null||y.componentWillLoad(this.nylasConnector)}componentDidLoad(){var t,r;const e=(t=this.baseProvider)==null?void 0:t.getStore("auth");e==null||e.onChange("isAuthenticated",this.handleAuthChange),(r=this.baseProvider)==null||r.componentDidLoad()}componentDisconnected(){var e;(e=this.baseProvider)==null||e.componentDisconnected()}async registerComponentHandler(e){var t;(t=this.baseProvider)==null||t.registerComponent(e.detail)}async unregisterComponentHandler(e){var t;(t=this.baseProvider)==null||t.unregisterComponent(e.detail)}async getNylasAuth(){return this.nylasAuth}async getNylasConnector(){return this.nylasConnector}async getMailboxStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("mailbox")}async getAuthStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("auth")}async getNylasSchedulerStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("scheduler")}async getNylasSchedulerConfigStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("schedulerConfig")}render(){return s.h(s.Host,{key:"57612ac13296cebf2c8731bcb9329f980db034d3"},s.h("slot",{key:"d752cd8c4cd47c9c17d57e23477d3a7720cbc8f5"}))}get host(){return s.getElement(this)}};C.style=A;exports.nylas_provider=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-769f0fdd.cjs"),g=require("./index.es-9cc0eb3c-e8de46e6.cjs"),o=require("./mailbox-store-64b4ef7c-ebe84c96.cjs"),S=require("./scheduler-store-f02ce045-f11cfad9.cjs"),f=require("./scheduler-config-store-4a50a03d-40e87f35.cjs");require("react");require("react-dom");class b{constructor(t,r,n,i,l,h,a="https://api.us.nylas.com"){this.router=t,this.schedulerAPIURL=a,this.nylasAuth=r,this.nylasAuthStore=n,this.nylasMailboxStore=i,this.nylasSchedulerStore=l,this.nylasSchedulerConfigStore=h}init(){s.debug("NylasConnector init")}get authStore(){return this.nylasAuthStore}get mailboxStore(){return this.nylasMailboxStore}get schedulerStore(){return this.nylasSchedulerStore}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get auth(){return this._authConnector?this._authConnector:(this._authConnector=new o.NylasAuthConnector(this.nylasAuth,this.nylasAuthStore),this._authConnector)}get threads(){return this._threadConnector?this._threadConnector:(this._threadConnector=new o.NylasThreadsConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore,this.router),this._threadConnector)}get messages(){return this._messageConnector?this._messageConnector:(this._messageConnector=new o.NylasMessagesConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._messageConnector)}get folders(){return this._foldersConnector?this._foldersConnector:(this._foldersConnector=new o.NylasFoldersConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._foldersConnector)}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new S.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore}),this._schedulerAPIConnector)}getAuth(){return this.nylasAuth}resetStores(){this.nylasAuthStore.reset(),this.nylasMailboxStore.reset()}async logout(){await this.nylasAuth.logout(),this.resetStores()}}const m=":host{display:contents}",A=m,C=class{constructor(e){s.registerInstance(this,e),this.init=s.createEvent(this,"init",7),this.loggedIn=s.createEvent(this,"loggedIn",7),this.loggedOut=s.createEvent(this,"loggedOut",7),this.handleAuthChange=async t=>{t?this.loggedIn.emit(this.host):this.loggedOut.emit(this.host)},this.authConfig=void 0,this.eventOverrides={},this.automaticComponentRegistration=!0}connectedCallback(){s.debug("[nylas-provider] connectedCallback")}async componentWillLoad(){var h,a,c,u,d,y;s.debug("[nylas-provider] componentWillLoad"),this.stores={auth:o.CreateNylasAuthStore(),mailbox:o.CreateNylasMailboxStore(),scheduler:S.CreateNylasSchedulerStore(),schedulerConfig:f.CreateNylasSchedulerConfigStore()},this.baseProvider=new g.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const e=new o.HashRouter;this.nylasAuth=g.es({apiUri:"https://api.us.nylas.com",elementsApiUri:"https://elements.us.nylas.com",storageType:"indexeddb",clientId:"YOUR_CLIENT_ID",defaultScopes:[],redirectURI:"/",...this.authConfig});const t=(h=this.baseProvider)==null?void 0:h.getStore("mailbox");if(!t)throw new Error("The mailbox store is not set");const r=(a=this.baseProvider)==null?void 0:a.getStore("auth");if(!r)throw new Error("The auth store is not set");const n=(c=this.baseProvider)==null?void 0:c.getStore("scheduler");if(!n)throw new Error("The scheduler store is not set");const i=(u=this.baseProvider)==null?void 0:u.getStore("schedulerConfig");if(!i)throw new Error("The scheduler config store is not set");this.nylasConnector=new b(e,this.nylasAuth,r,t,n,i),this.init.emit(this.host).defaultPrevented||await((d=this.nylasConnector)==null?void 0:d.auth.validateSession()),this.handleAuthChange(r.state.isAuthenticated),(y=this.baseProvider)==null||y.componentWillLoad(this.nylasConnector)}componentDidLoad(){var t,r;const e=(t=this.baseProvider)==null?void 0:t.getStore("auth");e==null||e.onChange("isAuthenticated",this.handleAuthChange),(r=this.baseProvider)==null||r.componentDidLoad()}componentDisconnected(){var e;(e=this.baseProvider)==null||e.componentDisconnected()}async registerComponentHandler(e){var t;(t=this.baseProvider)==null||t.registerComponent(e.detail)}async unregisterComponentHandler(e){var t;(t=this.baseProvider)==null||t.unregisterComponent(e.detail)}async getNylasAuth(){return this.nylasAuth}async getNylasConnector(){return this.nylasConnector}async getMailboxStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("mailbox")}async getAuthStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("auth")}async getNylasSchedulerStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("scheduler")}async getNylasSchedulerConfigStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("schedulerConfig")}render(){return s.h(s.Host,{key:"7fee35047bafd5dc2f77e83012fe5149f17f7f9f"},s.h("slot",{key:"96dcdef76b63b551e2deb56bfd0d1497ff897114"}))}get host(){return s.getElement(this)}};C.style=A;exports.nylas_provider=C;
@@ -1,2 +1,2 @@
1
- "use strict";var I=Object.defineProperty;var P=(r,t,n)=>t in r?I(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n;var w=(r,t,n)=>(P(r,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const index=require("./index-f435e814.cjs"),index_es9cc0eb3c=require("./index.es-9cc0eb3c-09dc620b.cjs"),schedulerConfigStore4a50a03d=require("./scheduler-config-store-4a50a03d-d5a5899e.cjs"),index53420959=require("./index-53420959-9f979766.cjs");require("react");require("react-dom");class NylasSchedulerConfigAPIConnector{constructor({nylasApiRequest:t,nylasSchedulerConfigStore:n}){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 s;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.dataResponse(null,{message:"Error fetching calendars: Nylas API Request is not initialized"});const[t,n]=await this.nylasApiRequest.request({method:"GET",path:"calendars"});return n?index.dataResponse(null,{message:"Error fetching calendars: "+n.message}):index_es9cc0eb3c.Xr(t)?index.dataResponse(null,{message:"Error fetching calendars: "+((s=t.error)==null?void 0:s.message)}):(this.nylasSchedulerConfigStore.state.calendars=t.data,index.dataResponse(t.data))}async getConfigurationById(t,n=!1){var a;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.dataResponse(null,{message:"Error fetching configuration: Nylas API Request is not initialized"});if(!n){const l=this.nylasSchedulerConfigStore.state.configurations.find(d=>d.id===t);if(l)return this.nylasSchedulerConfigStore.state.selectedConfiguration=l,index.dataResponse(l)}const[s,c]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${t}`});return c?index.dataResponse(null,{message:"Error fetching configuration: "+c.message}):index_es9cc0eb3c.Xr(s)?index.dataResponse(null,{message:"Error fetching configuration: "+((a=s.error)==null?void 0:a.message)}):(this.nylasSchedulerConfigStore.state.selectedConfiguration=s.data,this.nylasSchedulerConfigStore.state.configurations.find(l=>l.id===t)?this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map(l=>l.id===t?s.data:l):this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,s.data],index.dataResponse(s.data))}async getConfigurations(){var s;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.dataResponse(null,{message:"Error fetching configurations: Nylas API Request is not initialized"});const[t,n]=await this.nylasApiRequest.request({method:"GET",path:"scheduling/configurations"});return n?index.dataResponse(null,{message:"Error fetching configurations: "+n.message}):index_es9cc0eb3c.Xr(t)?index.dataResponse(null,{message:"Error fetching configurations: "+((s=t.error)==null?void 0:s.message)}):(this.nylasSchedulerConfigStore.state.configurations=t.data,index.dataResponse(t.data))}async createConfiguration(t){var c;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.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?index.dataResponse(null,{message:"Error creating configuration: "+s.message}):index_es9cc0eb3c.Xr(n)?index.dataResponse(null,{message:"Error creating configuration: "+((c=n.error)==null?void 0:c.message)}):(this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data,this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data],index.dataResponse(n.data))}async updateConfiguration(t){var c;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.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?index.dataResponse(null,{message:"Error updating configuration: "+s.message}):index_es9cc0eb3c.Xr(n)?index.dataResponse(null,{message:"Error updating configuration: "+((c=n.error)==null?void 0:c.message)}):(this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data,this.nylasSchedulerConfigStore.state.configurations.find(a=>a.id===t.id)?this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map(a=>a.id===t.id?n.data:a):this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data],index.dataResponse(n.data))}async deleteConfiguration(t){var c,a;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.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?index.dataResponse(null,{message:"Error deleting configuration: "+s.message}):index_es9cc0eb3c.Xr(n)?index.dataResponse(null,{message:"Error deleting configuration: "+((c=n.error)==null?void 0:c.message)}):(this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.filter(l=>l.id!==t),((a=this.nylasSchedulerConfigStore.state.selectedConfiguration)==null?void 0:a.id)===t&&this.nylasSchedulerConfigStore.resetSelectedConfiguration(),index.dataResponse(n.data))}}class NylasSchedulerConfigConnector{constructor({nylasApiRequest:t,nylasSchedulerConfigStore:n}){this.nylasApiRequest=t,this.nylasSchedulerConfigStore=n}init(){index.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(){index.debug("NylasSchedulerConfigConnector resetStores"),this.nylasSchedulerConfigStore.reset()}async logout(){index.debug("NylasSchedulerConfigConnector logout"),this.resetStores()}}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){w(this,"Storage",new LocalStorage);if(t){this.Storage=t;return}}setPKCE(t){const n=index.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 index.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(c=>c.sub===t.sub)){const c=n.map(a=>(a.sub===t.sub&&(a=t),a));this.Storage.set(USER_KEY,c)}else{const c=[...n,t];this.Storage.set(USER_KEY,c)}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(c=>c.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(c=>c.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(){w(this,"databaseName","identity-db");w(this,"storeName","identity")}get(t){const n=this;return new Promise((s,c)=>{n.openDatabase().then(function(a){const l=a.transaction(n.storeName,"readwrite"),h=l.objectStore(n.storeName).get(t);h.onsuccess=()=>{s(h.result)},h.onerror=()=>{c(h.error)},l.oncomplete=()=>{a.close()}})})}async remove(t){const n=this;return new Promise((s,c)=>{const a=indexedDB.open(this.databaseName);a.onupgradeneeded=function(l){l.target.result.createObjectStore(n.storeName)},a.onerror=()=>{c(a.error)},a.onsuccess=l=>{const d=l.target.result,h=d.transaction(this.storeName,"readwrite"),f=h.objectStore(this.storeName).delete(t);f.onsuccess=()=>{s(null)},f.onerror=()=>{c(f.error)},h.oncomplete=()=>{d.close()}}})}set(t,n){return new Promise((s,c)=>{const a=indexedDB.open(this.databaseName);a.onerror=()=>{c(a.error)},a.onupgradeneeded=l=>{l.target.result.createObjectStore(this.storeName)},a.onsuccess=l=>{const d=l.target.result,h=d.transaction(this.storeName,"readwrite"),f=h.objectStore(this.storeName).put(n,t);f.onsuccess=()=>{s(n)},f.onerror=()=>{c(f.error)},h.oncomplete=()=>{d.close()}}})}openDatabase(){const t=this;return new Promise(function(n,s){const c=indexedDB.open(t.databaseName,2);c.onupgradeneeded=function(a){a.target.result.createObjectStore(t.storeName)},c.onsuccess=function(a){n(a.target.result)},c.onerror=function(a){s(a.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 index53420959.process=="object"&&index53420959.process.versions&&index53420959.process.versions.node;NODE_JS?root=index.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(c){return t.create().update(c)};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(c){return new HmacSha256(c,r)},t.update=function(c,a){return t.create(c).update(a)};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,c=0,a,l=r.length,d=this.blocks;c<l;){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(a=this.start;c<l&&a<64;++c)d[a>>2]|=r[c]<<SHIFT[a++&3];else for(a=this.start;c<l&&a<64;++c)s=r.charCodeAt(c),s<128?d[a>>2]|=s<<SHIFT[a++&3]:s<2048?(d[a>>2]|=(192|s>>6)<<SHIFT[a++&3],d[a>>2]|=(128|s&63)<<SHIFT[a++&3]):s<55296||s>=57344?(d[a>>2]|=(224|s>>12)<<SHIFT[a++&3],d[a>>2]|=(128|s>>6&63)<<SHIFT[a++&3],d[a>>2]|=(128|s&63)<<SHIFT[a++&3]):(s=65536+((s&1023)<<10|r.charCodeAt(++c)&1023),d[a>>2]|=(240|s>>18)<<SHIFT[a++&3],d[a>>2]|=(128|s>>12&63)<<SHIFT[a++&3],d[a>>2]|=(128|s>>6&63)<<SHIFT[a++&3],d[a>>2]|=(128|s&63)<<SHIFT[a++&3]);this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.block=d[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}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,c=this.h4,a=this.h5,l=this.h6,d=this.h7,h=this.blocks,u,f,p,y,g,x,S,m,v,R,_;for(u=16;u<64;++u)g=h[u-15],f=(g>>>7|g<<25)^(g>>>18|g<<14)^g>>>3,g=h[u-2],p=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10,h[u]=h[u-16]+f+h[u-7]+p<<0;for(_=t&n,u=0;u<64;u+=4)this.first?(this.is224?(m=300032,g=h[0]-1413257819,d=g-150054599<<0,s=g+24177077<<0):(m=704751109,g=h[0]-210244248,d=g-1521486534<<0,s=g+143694565<<0),this.first=!1):(f=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),p=(c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7),m=r&t,y=m^r&n^_,S=c&a^~c&l,g=d+p+S+K[u]+h[u],x=f+y,d=s+g<<0,s=g+x<<0),f=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),p=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7),v=s&r,y=v^s&t^m,S=d&c^~d&a,g=l+p+S+K[u+1]+h[u+1],x=f+y,l=n+g<<0,n=g+x<<0,f=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),p=(l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7),R=n&s,y=R^n&r^v,S=l&d^~l&c,g=a+p+S+K[u+2]+h[u+2],x=f+y,a=t+g<<0,t=g+x<<0,f=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),p=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),_=t&n,y=_^t&s^R,S=a&l^~a&d,g=c+p+S+K[u+3]+h[u+3],x=f+y,c=r+g<<0,r=g+x<<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+c<<0,this.h5=this.h5+a<<0,this.h6=this.h6+l<<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,c=this.h4,a=this.h5,l=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[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]+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];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,c=this.h4,a=this.h5,l=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,c>>24&255,c>>16&255,c>>8&255,c&255,a>>24&255,a>>16&255,a>>8&255,a&255,l>>24&255,l>>16&255,l>>8&255,l&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,c=typeof r;if(c==="string"){var a=[],l=r.length,d=0,h;for(s=0;s<l;++s)h=r.charCodeAt(s),h<128?a[d++]=h:h<2048?(a[d++]=192|h>>6,a[d++]=128|h&63):h<55296||h>=57344?(a[d++]=224|h>>12,a[d++]=128|h>>6&63,a[d++]=128|h&63):(h=65536+((h&1023)<<10|r.charCodeAt(++s)&1023),a[d++]=240|h>>18,a[d++]=128|h>>12&63,a[d++]=128|h>>6&63,a[d++]=128|h&63);r=a}else if(c==="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 p=r[s]||0;u[s]=92^p,f[s]=54^p}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 c=0;c<16;++c)t[n+c]=s[c];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,c=!1;return function(l){t===void 0?(t=l,n=0,s=-1):t=concat(t,l);const d=t.length;let h=0;for(;n<d;){c&&(t[n]===10&&(h=++n),c=!1);let u=-1;for(;n<d&&u===-1;++n)switch(t[n]){case 58:s===-1&&(s=n-h);break;case 13:c=!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 c=new TextDecoder;return function(l,d){if(l.length===0)n==null||n(s),s=newMessage();else if(d>0){const h=c.decode(l.subarray(0,d)),u=d+(l[d+1]===32?2:1),f=c.decode(l.subarray(u));switch(h){case"data":s.data=s.data?s.data+`
1
+ "use strict";var I=Object.defineProperty;var P=(r,t,n)=>t in r?I(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n;var w=(r,t,n)=>(P(r,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const index=require("./index-769f0fdd.cjs"),index_es9cc0eb3c=require("./index.es-9cc0eb3c-e8de46e6.cjs"),schedulerConfigStore4a50a03d=require("./scheduler-config-store-4a50a03d-40e87f35.cjs"),index53420959=require("./index-53420959-16700a42.cjs");require("react");require("react-dom");class NylasSchedulerConfigAPIConnector{constructor({nylasApiRequest:t,nylasSchedulerConfigStore:n}){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 s;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.dataResponse(null,{message:"Error fetching calendars: Nylas API Request is not initialized"});const[t,n]=await this.nylasApiRequest.request({method:"GET",path:"calendars"});return n?index.dataResponse(null,{message:"Error fetching calendars: "+n.message}):index_es9cc0eb3c.Xr(t)?index.dataResponse(null,{message:"Error fetching calendars: "+((s=t.error)==null?void 0:s.message)}):(this.nylasSchedulerConfigStore.state.calendars=t.data,index.dataResponse(t.data))}async getConfigurationById(t,n=!1){var a;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.dataResponse(null,{message:"Error fetching configuration: Nylas API Request is not initialized"});if(!n){const l=this.nylasSchedulerConfigStore.state.configurations.find(d=>d.id===t);if(l)return this.nylasSchedulerConfigStore.state.selectedConfiguration=l,index.dataResponse(l)}const[s,c]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${t}`});return c?index.dataResponse(null,{message:"Error fetching configuration: "+c.message}):index_es9cc0eb3c.Xr(s)?index.dataResponse(null,{message:"Error fetching configuration: "+((a=s.error)==null?void 0:a.message)}):(this.nylasSchedulerConfigStore.state.selectedConfiguration=s.data,this.nylasSchedulerConfigStore.state.configurations.find(l=>l.id===t)?this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map(l=>l.id===t?s.data:l):this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,s.data],index.dataResponse(s.data))}async getConfigurations(){var s;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.dataResponse(null,{message:"Error fetching configurations: Nylas API Request is not initialized"});const[t,n]=await this.nylasApiRequest.request({method:"GET",path:"scheduling/configurations"});return n?index.dataResponse(null,{message:"Error fetching configurations: "+n.message}):index_es9cc0eb3c.Xr(t)?index.dataResponse(null,{message:"Error fetching configurations: "+((s=t.error)==null?void 0:s.message)}):(this.nylasSchedulerConfigStore.state.configurations=t.data,index.dataResponse(t.data))}async createConfiguration(t){var c;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.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?index.dataResponse(null,{message:"Error creating configuration: "+s.message}):index_es9cc0eb3c.Xr(n)?index.dataResponse(null,{message:"Error creating configuration: "+((c=n.error)==null?void 0:c.message)}):(this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data,this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data],index.dataResponse(n.data))}async updateConfiguration(t){var c;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.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?index.dataResponse(null,{message:"Error updating configuration: "+s.message}):index_es9cc0eb3c.Xr(n)?index.dataResponse(null,{message:"Error updating configuration: "+((c=n.error)==null?void 0:c.message)}):(this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data,this.nylasSchedulerConfigStore.state.configurations.find(a=>a.id===t.id)?this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map(a=>a.id===t.id?n.data:a):this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data],index.dataResponse(n.data))}async deleteConfiguration(t){var c,a;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.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?index.dataResponse(null,{message:"Error deleting configuration: "+s.message}):index_es9cc0eb3c.Xr(n)?index.dataResponse(null,{message:"Error deleting configuration: "+((c=n.error)==null?void 0:c.message)}):(this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.filter(l=>l.id!==t),((a=this.nylasSchedulerConfigStore.state.selectedConfiguration)==null?void 0:a.id)===t&&this.nylasSchedulerConfigStore.resetSelectedConfiguration(),index.dataResponse(n.data))}}class NylasSchedulerConfigConnector{constructor({nylasApiRequest:t,nylasSchedulerConfigStore:n}){this.nylasApiRequest=t,this.nylasSchedulerConfigStore=n}init(){index.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(){index.debug("NylasSchedulerConfigConnector resetStores"),this.nylasSchedulerConfigStore.reset()}async logout(){index.debug("NylasSchedulerConfigConnector logout"),this.resetStores()}}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){w(this,"Storage",new LocalStorage);if(t){this.Storage=t;return}}setPKCE(t){const n=index.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 index.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(c=>c.sub===t.sub)){const c=n.map(a=>(a.sub===t.sub&&(a=t),a));this.Storage.set(USER_KEY,c)}else{const c=[...n,t];this.Storage.set(USER_KEY,c)}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(c=>c.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(c=>c.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(){w(this,"databaseName","identity-db");w(this,"storeName","identity")}get(t){const n=this;return new Promise((s,c)=>{n.openDatabase().then(function(a){const l=a.transaction(n.storeName,"readwrite"),h=l.objectStore(n.storeName).get(t);h.onsuccess=()=>{s(h.result)},h.onerror=()=>{c(h.error)},l.oncomplete=()=>{a.close()}})})}async remove(t){const n=this;return new Promise((s,c)=>{const a=indexedDB.open(this.databaseName);a.onupgradeneeded=function(l){l.target.result.createObjectStore(n.storeName)},a.onerror=()=>{c(a.error)},a.onsuccess=l=>{const d=l.target.result,h=d.transaction(this.storeName,"readwrite"),f=h.objectStore(this.storeName).delete(t);f.onsuccess=()=>{s(null)},f.onerror=()=>{c(f.error)},h.oncomplete=()=>{d.close()}}})}set(t,n){return new Promise((s,c)=>{const a=indexedDB.open(this.databaseName);a.onerror=()=>{c(a.error)},a.onupgradeneeded=l=>{l.target.result.createObjectStore(this.storeName)},a.onsuccess=l=>{const d=l.target.result,h=d.transaction(this.storeName,"readwrite"),f=h.objectStore(this.storeName).put(n,t);f.onsuccess=()=>{s(n)},f.onerror=()=>{c(f.error)},h.oncomplete=()=>{d.close()}}})}openDatabase(){const t=this;return new Promise(function(n,s){const c=indexedDB.open(t.databaseName,2);c.onupgradeneeded=function(a){a.target.result.createObjectStore(t.storeName)},c.onsuccess=function(a){n(a.target.result)},c.onerror=function(a){s(a.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 index53420959.process=="object"&&index53420959.process.versions&&index53420959.process.versions.node;NODE_JS?root=index.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(c){return t.create().update(c)};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(c){return new HmacSha256(c,r)},t.update=function(c,a){return t.create(c).update(a)};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,c=0,a,l=r.length,d=this.blocks;c<l;){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(a=this.start;c<l&&a<64;++c)d[a>>2]|=r[c]<<SHIFT[a++&3];else for(a=this.start;c<l&&a<64;++c)s=r.charCodeAt(c),s<128?d[a>>2]|=s<<SHIFT[a++&3]:s<2048?(d[a>>2]|=(192|s>>6)<<SHIFT[a++&3],d[a>>2]|=(128|s&63)<<SHIFT[a++&3]):s<55296||s>=57344?(d[a>>2]|=(224|s>>12)<<SHIFT[a++&3],d[a>>2]|=(128|s>>6&63)<<SHIFT[a++&3],d[a>>2]|=(128|s&63)<<SHIFT[a++&3]):(s=65536+((s&1023)<<10|r.charCodeAt(++c)&1023),d[a>>2]|=(240|s>>18)<<SHIFT[a++&3],d[a>>2]|=(128|s>>12&63)<<SHIFT[a++&3],d[a>>2]|=(128|s>>6&63)<<SHIFT[a++&3],d[a>>2]|=(128|s&63)<<SHIFT[a++&3]);this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.block=d[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}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,c=this.h4,a=this.h5,l=this.h6,d=this.h7,h=this.blocks,u,f,p,y,g,x,S,m,v,R,_;for(u=16;u<64;++u)g=h[u-15],f=(g>>>7|g<<25)^(g>>>18|g<<14)^g>>>3,g=h[u-2],p=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10,h[u]=h[u-16]+f+h[u-7]+p<<0;for(_=t&n,u=0;u<64;u+=4)this.first?(this.is224?(m=300032,g=h[0]-1413257819,d=g-150054599<<0,s=g+24177077<<0):(m=704751109,g=h[0]-210244248,d=g-1521486534<<0,s=g+143694565<<0),this.first=!1):(f=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),p=(c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7),m=r&t,y=m^r&n^_,S=c&a^~c&l,g=d+p+S+K[u]+h[u],x=f+y,d=s+g<<0,s=g+x<<0),f=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),p=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7),v=s&r,y=v^s&t^m,S=d&c^~d&a,g=l+p+S+K[u+1]+h[u+1],x=f+y,l=n+g<<0,n=g+x<<0,f=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),p=(l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7),R=n&s,y=R^n&r^v,S=l&d^~l&c,g=a+p+S+K[u+2]+h[u+2],x=f+y,a=t+g<<0,t=g+x<<0,f=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),p=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),_=t&n,y=_^t&s^R,S=a&l^~a&d,g=c+p+S+K[u+3]+h[u+3],x=f+y,c=r+g<<0,r=g+x<<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+c<<0,this.h5=this.h5+a<<0,this.h6=this.h6+l<<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,c=this.h4,a=this.h5,l=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[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]+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];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,c=this.h4,a=this.h5,l=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,c>>24&255,c>>16&255,c>>8&255,c&255,a>>24&255,a>>16&255,a>>8&255,a&255,l>>24&255,l>>16&255,l>>8&255,l&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,c=typeof r;if(c==="string"){var a=[],l=r.length,d=0,h;for(s=0;s<l;++s)h=r.charCodeAt(s),h<128?a[d++]=h:h<2048?(a[d++]=192|h>>6,a[d++]=128|h&63):h<55296||h>=57344?(a[d++]=224|h>>12,a[d++]=128|h>>6&63,a[d++]=128|h&63):(h=65536+((h&1023)<<10|r.charCodeAt(++s)&1023),a[d++]=240|h>>18,a[d++]=128|h>>12&63,a[d++]=128|h>>6&63,a[d++]=128|h&63);r=a}else if(c==="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 p=r[s]||0;u[s]=92^p,f[s]=54^p}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 c=0;c<16;++c)t[n+c]=s[c];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,c=!1;return function(l){t===void 0?(t=l,n=0,s=-1):t=concat(t,l);const d=t.length;let h=0;for(;n<d;){c&&(t[n]===10&&(h=++n),c=!1);let u=-1;for(;n<d&&u===-1;++n)switch(t[n]){case 58:s===-1&&(s=n-h);break;case 13:c=!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 c=new TextDecoder;return function(l,d){if(l.length===0)n==null||n(s),s=newMessage();else if(d>0){const h=c.decode(l.subarray(0,d)),u=d+(l[d+1]===32?2:1),f=c.decode(l.subarray(u));switch(h){case"data":s.data=s.data?s.data+`
2
2
  `+f:f;break;case"event":s.event=f;break;case"id":r(s.id=f);break;case"retry":const p=parseInt(f,10);isNaN(p)||t(s.retry=p);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 c=0,s=Object.getOwnPropertySymbols(r);c<s.length;c++)t.indexOf(s[c])<0&&Object.prototype.propertyIsEnumerable.call(r,s[c])&&(n[s[c]]=r[s[c]]);return n};const EventStreamContentType="text/event-stream",DefaultRetryInterval=1e3,LastEventId="last-event-id";function fetchEventSource(r,t){var{signal:n,headers:s,onopen:c,onmessage:a,onclose:l,onerror:d,openWhenHidden:h,fetch:u}=t,f=__rest(t,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((p,y)=>{const g=Object.assign({},s);g.accept||(g.accept=EventStreamContentType);let x;function S(){x.abort(),document.hidden||T()}h||document.addEventListener("visibilitychange",S);let m=DefaultRetryInterval,v=0;function R(){document.removeEventListener("visibilitychange",S),window.clearTimeout(v),x.abort()}n==null||n.addEventListener("abort",()=>{R(),p()});const _=u??window.fetch,U=c??defaultOnOpen;async function T(){var k;x=new AbortController;try{const A=await _(r,Object.assign(Object.assign({},f),{headers:g,signal:x.signal}));await U(A),await getBytes(A.body,getLines(getMessages(b=>{b?g[LastEventId]=b:delete g[LastEventId]},b=>{m=b},a))),l==null||l(),R(),p()}catch(A){if(!x.signal.aborted)try{const b=(k=d==null?void 0:d(A))!==null&&k!==void 0?k:m;window.clearTimeout(v),v=window.setTimeout(T,b)}catch(b){R(),y(b)}}}T()})}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,c=0,a=0,l="";s=t.charAt(a++);~s&&(n=c%4?64*n+s:s,c++%4)?l+=String.fromCharCode(255&n>>(-2*c&6)):0)s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(s);return l};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,c){var a=c.charCodeAt(0).toString(16).toUpperCase();return a.length<2&&(a="0"+a),"%"+a}))}(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){w(this,"clientId");w(this,"redirectUri");w(this,"accessType","online");w(this,"domain","http://api.nylas.com");w(this,"versioned",!1);w(this,"Storage");w(this,"hosted",!1);w(this,"multiAccount",!1);w(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),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 c=await fetch(`${this.domain}/connect/tokeninfo?id_token=${s}`,{method:"GET"});return!(c.status!==200||!(await c.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),c=await this.getCodeChallege();let a=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;return c&&(a+=`&code_challenge=${c}&code_challenge_method=S256&options=rotate_refresh_token`),s!=null&&s.provider&&(a+=`&provider=${s.provider}`),s!=null&&s.email&&(a+=`&login_hint=${s.email}`),n&&(a+=`&scope=${n.join(" ")}`),a}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=index.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.username,imap_password:t.password,imap_host:t.hostIMAP,imap_port:t.portIMAP,type:t.type,smtp_host:t.hostSMTP,smtp_port:t.portSMTP,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),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,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()).data}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"),c=n.get("state"),a=n.get("error"),l=n.get("error_description"),d=n.get("error_code");if(a&&l&&d){const u={detail:{error:a,error_description:l,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},p=await(await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(u)})).json();if(p){if(p.error){const g={detail:p};return window.dispatchEvent(new CustomEvent("onLoginFail",g)),!0}const y=await this.handleCodeExchangeResponse(p);if(y.valid){c&&(y.data.state=c);const g={detail:y.data};window.dispatchEvent(new CustomEvent("onLoginSuccess",g)),window.history.pushState({},document.title,window.location.pathname)}else{const g={detail:y.data};return window.dispatchEvent(new CustomEvent("onLoginFail",g)),!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 c={client_id:this.clientId,redirect_uri:this.redirectUri,refresh_token:s,grant_type:"refresh_token"},l=await(await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(c)})).json();if(l){if(l.error){const f={detail:l};return window.dispatchEvent(new CustomEvent("onTokenRefreshFail",f)),!0}const d=getTimestamp();if(l.expires_in=d+l.expires_in,this.Storage.setGrant(l,this.multiAccount),!await this.validateIDToken(t)){const f={detail:l};return window.dispatchEvent(new CustomEvent("onTokenRefreshFail",f)),!0}const u={detail:l};return window.dispatchEvent(new CustomEvent("onTokenRefreshSuccess",u)),!0}this.Storage.removePKCE()}catch(c){const a={detail:c};return window.dispatchEvent(new CustomEvent("onTokenRefreshFail",a)),!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 c=o(t.id_token);return c.status="authenticated",this.Storage.setUserToken(c),await this.validateIDToken(c.sub)?{data:t,valid:!0}:{data:t,valid:!1}}async popUp(t){const c=window.screenX+(window.outerWidth-500)/2,a=window.screenY+(window.outerHeight-600)/2.5,l="uas-popup",d=t,h=window.open(d,l,`width=500,height=600,left=${c},top=${a}`);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 p=h.location.search;if(h.history.pushState({},document.title,window.location.pathname),f[0]===this.redirectUri&&f.length>1){const y=await this.codeExchange(p);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:c,expires_in:a}=s,l=c;return l&&a&&a>getTimestamp()&&a-n>30?l:(await this.tokenExchange(t),(await this.Storage.getGrant(t,this.multiAccount)).access_token)}async sse(t,n){const s=n.headers||{},c=s["Grant-ID"];let a="";if(this.multiAccount){if(!c)throw this.logout(),new Error("Grant ID is required for multi account calls");a=await this.getAccessToken(c)}else a=await this.getAccessToken();return delete s["Grant-ID"],s.Authorization=`Bearer ${a}`,s["content-type"]||(s["content-type"]="application/json"),fetchEventSource(`${this.domain}/${t}`,{...n,headers:s})}async fetch(t,n,s=!0,c){let a="",l=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();l=h?h.length:1,a=await this.getAccessToken(n.grant_id)}else a=await this.getAccessToken();if(!a)throw new Error("Access token not found");let d=n.headers;Headers.prototype.isPrototypeOf(d)?(d.append("Authorization",`Bearer ${a}`),d.has("content-type")||d.append("content-type","application/json")):d=new Headers({Authorization:`Bearer ${a}`,"content-type":"application/json"});try{n!=null&&n.body&&(n.body=JSON.stringify(n==null?void 0:n.body));const h=await fetch(`${c||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(l>1){const p=await this.getProfile(n.grant_id);if(p){p.status="unauthorized",await this.Storage.setUserToken(p);const y={detail:{user:p}};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,c=!0,a,l){const d=await this.isLoggedIn(),h=new URL(t,a??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,...l||{}});return c?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"},index.h("div",{class:"card"},index.h("p",null,"Log into your account to use the Scheduler Editor."),index.h("button",{class:"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",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",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"},"* You will be redirected to authenticate your account."))),ExpressFlow=()=>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",null))),index.h("nylas-booking-calendar-picker",null)),nylasSchedulerEditorCss=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 0px 6px -2px rgba(0, 0, 0, 0.05), 0px 5px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}div.scheduler-editor-header{display:flex;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900)}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;width:858px;margin:0;font-size:18px;line-height:24px;font-weight:600}@media screen and (max-width: 768px){div.scheduler-editor-header h1.scheduler-editor-title{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary)}div.scheduler-editor-header button:disabled{cursor:not-allowed}nylas-editor-tabs{width:auto}nylas-editor-tabs nylas-event-info div[slot=inputs],nylas-editor-tabs nylas-event-limits div[slot=inputs]{display:flex;flex-direction:column;gap:1rem}.card{display:flex;flex-direction:column;padding:2rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;max-width:fit-content;align-self:center}.login-required{height:554px;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:1rem;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;margin-bottom:1rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;justify-content:center;gap:0.5rem;align-items:center}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:1rem;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;border:0;background-color:var(--nylas-base-0);height:48px;margin-bottom:1rem;font-size:0.95rem;justify-content:center;gap:0.25rem;align-items:center}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button svg{transform:rotate(180deg)}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .disclaimer-text{font-size:0.75rem;color:var(--nylas-base-600);align-self:center}.list-configurations{padding:2rem;height:554px;background:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.list-configurations{height:auto}}.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=>{this.schedulerConfigCloseClicked.emit(this.host).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.automaticComponentRegistration=!0}connectedCallback(){index.debug("[nylas-scheduler-editor] connectedCallback")}async componentWillLoad(){var n,s,c,a,l,d,h;if(index.debug("[nylas-scheduler-editor] componentWillLoad"),this.stores={schedulerConfig:schedulerConfigStore4a50a03d.CreateNylasSchedulerConfigStore({...this.defaultSchedulerConfigState,additionalParticipants:this.additionalParticipants})},!this.nylasApiRequest&&this.nylasSessionsConfig){const u=new NylasSessions(this.nylasSessionsConfig);await u.isLoggedIn(),u.onLoginSuccess(async()=>{var p,y;const f=await((y=(p=this.nylasSchedulerConfigConnector)==null?void 0:p.schedulerConfig)==null?void 0:y.currentUser());f&&(this.loggedIn.emit(this.host),this.loggedInHandler(f))}),u.onLoginFail(async()=>{var f,p;(p=(f=this.stores)==null?void 0:f.schedulerConfig)==null||p.set("currentUser",null),this.loggedOut.emit(this.host)}),this.nylasApiRequest=new index.NylasIdentityRequestWrapper(u)}this.nylasApiRequest&&this.defaultAuthArgs&&this.nylasApiRequest.setDefaultAuthArgs(this.defaultAuthArgs),this.baseProvider=new index_es9cc0eb3c.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const r=this.baseProvider.getStore("schedulerConfig");if(this.nylasSchedulerConfigConnector=new NylasSchedulerConfigConnector({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:r}),!this.init.emit(this.host).defaultPrevented){const u=await((s=(n=this.nylasSchedulerConfigConnector)==null?void 0:n.schedulerConfig)==null?void 0:s.currentUser());u?(this.loggedIn.emit(this.host),await this.loggedInHandler(u)):((a=(c=this.stores)==null?void 0:c.schedulerConfig)==null||a.set("currentUser",null),this.loggedOut.emit(this.host))}(d=(l=this.stores)==null?void 0:l.schedulerConfig)==null||d.onChange("selectedConfiguration",async u=>{u&&u.id&&(this.configurationId=u.id)}),(h=this.baseProvider)==null||h.componentWillLoad(this.nylasSchedulerConfigConnector)}async componentDidLoad(){var r;index.debug("[nylas-scheduler-editor] componentDidLoad"),(r=this.baseProvider)==null||r.componentDidLoad()}componentDisconnected(){var r;(r=this.baseProvider)==null||r.componentDisconnected()}async configurationIdChanged(r){var t,n,s,c,a,l,d,h;r?(await((n=(t=this.nylasSchedulerConfigConnector)==null?void 0:t.schedulerConfig)==null?void 0:n.getConfigurationById(r)),(c=(s=this.stores)==null?void 0:s.schedulerConfig)==null||c.set("action","edit")):((l=(a=this.stores)==null?void 0:a.schedulerConfig)==null||l.set("selectedConfiguration",{}),(h=(d=this.stores)==null?void 0:d.schedulerConfig)==null||h.set("action",null))}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)}async loggedInHandler(r){var t,n,s,c,a,l,d;if((n=(t=this.stores)==null?void 0:t.schedulerConfig)==null||n.set("currentUser",r),!!this.nylasSchedulerConfigConnector){if(this.configurationId){const h=await((s=this.nylasSchedulerConfigConnector.schedulerConfig)==null?void 0:s.getConfigurationById(this.configurationId));h&&((c=h[0])!=null&&c.id)&&((l=(a=this.stores)==null?void 0:a.schedulerConfig)==null||l.set("action","edit"))}await((d=this.nylasSchedulerConfigConnector.schedulerConfig)==null?void 0:d.getCalendars())}}render(){var r,t,n,s,c,a,l,d;return index.h(index.Host,{key:"d5f019173d3ec4f80d802de6989182b0e8e4c2d0"},index.h("div",{key:"7b1d14281fe950b0cd693349bb8cdd2cb428722f",class:"scheduler-editor-header",part:"nse__header"},index.h("h1",{key:"b24cf796d8db6a169757c552b9749568794b87fd",class:"scheduler-editor-title",part:"nse__title"},index.h("calendar-icon",{key:"d6721ba544b1c3c5f6e003034d491355de6b0cc7",width:"18",height:"18"}),"Scheduler editor"),index.h("button",{key:"bb9ce5bfa2e6df362b55c7f8cd1a2f1e06056ce7",class:"scheduler-editor-close",title:"logout",onClick:h=>this.handleSchedulerConfigCloseClicked(h),part:"nse__close-button"},index.h("close-icon",{key:"22dced4538079f05c5d036c9eef4882d79739cf9",width:"18",height:"18"}))),((t=(r=this.stores)==null?void 0:r.schedulerConfig)==null?void 0:t.state.currentUser)&&this.stores.schedulerConfig.state.action===null&&index.h("div",{class:"list-configurations"},index.h("nylas-list-configurations",null)),((s=(n=this.stores)==null?void 0:n.schedulerConfig)==null?void 0:s.state.currentUser)&&this.stores.schedulerConfig.state.action==="create"&&index.h("nylas-editor-tabs",{mode:"composable"},index.h(ExpressFlow,null)),((a=(c=this.stores)==null?void 0:c.schedulerConfig)==null?void 0:a.state.currentUser)&&this.stores.schedulerConfig.state.action==="edit"&&index.h("nylas-editor-tabs",{mode:this.mode},this.mode==="composable"&&index.h("slot",null)),!((d=(l=this.stores)==null?void 0:l.schedulerConfig)!=null&&d.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"]}}};NylasSchedulerEditor.style=NylasSchedulerEditorStyle0;exports.nylas_scheduler_editor=NylasSchedulerEditor;
@@ -1,10 +1,10 @@
1
1
  var P = Object.defineProperty;
2
2
  var O = (r, t, n) => t in r ? P(r, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[t] = n;
3
3
  var m = (r, t, n) => (O(r, typeof t != "symbol" ? t + "" : t, n), n);
4
- import { i as commonjsGlobal, r as registerInstance, c as createEvent, d as debug, N as NylasIdentityRequestWrapper, h, H as Host, g as getElement, B as Buffer, F as Fragment, j as dataResponse } from "./index-f383e3c4.js";
5
- import { N as NylasBaseProvider, X as Xr } from "./index.es-9cc0eb3c-510db795.js";
6
- import { C as CreateNylasSchedulerConfigStore } from "./scheduler-config-store-4a50a03d-defa6368.js";
7
- import { p as process } from "./index-53420959-791b4e73.js";
4
+ import { i as commonjsGlobal, r as registerInstance, c as createEvent, d as debug, N as NylasIdentityRequestWrapper, h, H as Host, g as getElement, B as Buffer, F as Fragment, j as dataResponse } from "./index-5851f0a2.js";
5
+ import { N as NylasBaseProvider, X as Xr } from "./index.es-9cc0eb3c-2cf4632f.js";
6
+ import { C as CreateNylasSchedulerConfigStore } from "./scheduler-config-store-4a50a03d-4a2e2abf.js";
7
+ import { p as process } from "./index-53420959-f0c4f9af.js";
8
8
  import "react";
9
9
  import "react-dom";
10
10
  class NylasSchedulerConfigAPIConnector {
@@ -1,6 +1,6 @@
1
- import { r as T, c as b, d as x, k as v, l as L, h as n, H as p, g as N, F as C } from "./index-f383e3c4.js";
2
- import { n as k, N as R } from "./index.es-9cc0eb3c-510db795.js";
3
- import { E as w, C as A, N as F } from "./scheduler-store-f02ce045-de4cb1f5.js";
1
+ import { r as T, c as b, d as x, k as v, l as L, h as n, H as p, g as N, F as C } from "./index-5851f0a2.js";
2
+ import { n as k, N as R } from "./index.es-9cc0eb3c-2cf4632f.js";
3
+ import { E as w, C as A, N as F } from "./scheduler-store-f02ce045-121c1e09.js";
4
4
  import "react";
5
5
  import "react-dom";
6
6
  class P {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-f435e814.cjs"),m=require("./index.es-9cc0eb3c-09dc620b.cjs"),y=require("./scheduler-store-f02ce045-00faab09.cjs");require("react");require("react-dom");class C{constructor({schedulerAPIURL:e,nylasSchedulerStore:o,sessionId:i,configId:s}){if(!e)throw new Error("schedulerAPIURL is required");if(!o)throw new Error("nylasSchedulerStore is required");if(!i&&!s)throw new Error("sessionId is required for private configs, if not config id is required for public configs");e==="/"&&(e=new URL(window.location.href).origin),this.configId=s,this.sessionId=i,this.schedulerAPIURL=e,this.nylasSchedulerStore=o}init(){t.debug("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new y.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId}),this._schedulerAPIConnector)}resetStores(){this.nylasSchedulerStore.reset()}}const b=(n,e)=>{const o=n.isLoading,i=n.showNotification,s=n.nylasBranding;return t.h(t.Fragment,null,i&&t.h("nylas-notification",null),o&&t.h("div",{class:"loading"},t.h("div",{class:"left"},t.h("div",{class:"skeleton"})),t.h("div",{class:"right"},t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}))),!o&&e,t.h("div",{class:"footer"},s&&t.h(t.Fragment,null,"Powered by ",t.h("nylas-logo",null))))},x=(n,e)=>t.h("div",{class:"message-banner"},e),E=':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 6px -2px rgba(0, 0, 0, 0.05), 0px 10px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;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-top:1rem}.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,.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{background-color:var(--nylas-base-50)}.cancelled-event-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:384px;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{padding:0.5rem 4px 0;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}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto}}.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:496px}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer svg{fill:var(--nylas-base-500)}.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;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-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}',D=E,I={title:"Something went wrong...",type:m.nr.Error,category:y.ErrorCategory.Component},w=class{constructor(n){t.registerInstance(this,n),this.init=t.createEvent(this,"init",7),this.schedulerWillLoad=t.createEvent(this,"schedulerWillLoad",7),this.schedulerDidLoad=t.createEvent(this,"schedulerDidLoad",7),this.nylasSchedulerError=t.createEvent(this,"nylasSchedulerError",7),this.bookingRefExtracted=t.createEvent(this,"bookingRefExtracted",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.configurationId=void 0,this.nylasBranding=!0,this.eventOverrides={},this.isLoading=void 0,this.themeConfig=void 0,this.showNotification=!0,this.automaticComponentRegistration=!0,this.selectedDateLabel=new Date().toLocaleDateString(void 0,{dateStyle:"full"})||"No date selected",this.refConfigId=void 0}connectedCallback(){t.debug("[nylas-scheduler] connectedCallback")}async componentWillLoad(){var o,i;if(t.debug("[nylas-scheduler] Component will load"),this.schedulerWillLoad.emit(this.host).defaultPrevented)return;if(this.stores={scheduler:y.CreateNylasSchedulerStore({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,...this.defaultSchedulerState})},this.baseProvider=new m.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.refConfigId=this.configurationId,this.rescheduleBookingRef){const[s,a]=t.compactStringToUUIDs(this.rescheduleBookingRef);this.refConfigId=s,this.stores.scheduler.set("rescheduleBookingId",a),this.bookingRefExtracted.emit({configurationId:s,bookingId:a})}else if(this.cancelBookingRef){const[s,a]=t.compactStringToUUIDs(this.cancelBookingRef);this.refConfigId=s,this.stores.scheduler.set("cancelBookingId",a),this.bookingRefExtracted.emit({configurationId:s,bookingId:a})}if(!this.checkIfSessionIdOrConfigIdExists())return;const e=(o=this.baseProvider)==null?void 0:o.getStore("scheduler");if(this.nylasSchedulerConnector=new C({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,nylasSchedulerStore:e}),this.init.emit(this.host),(i=this.baseProvider)==null||i.componentWillLoad(this.nylasSchedulerConnector),this.themeConfig)for(const[s,a]of Object.entries(this.themeConfig))this.host.style.setProperty(`${s}`,a)}async componentDidLoad(){var d,l,h,g,c,v,k;if((d=this.baseProvider)==null||d.componentDidLoad(),!this.checkIfSessionIdOrConfigIdExists())return;const n=await((l=this.nylasSchedulerConnector)==null?void 0:l.scheduler.getUISettings());(!n||"error"in n)&&this.nylasSchedulerError.emit({...this.getErrorObject(n==null?void 0:n.error)});const e=(h=this.baseProvider)==null?void 0:h.getStore("scheduler"),o=(c=(g=e==null?void 0:e.get("configSettings"))==null?void 0:g.scheduler)==null?void 0:c.available_days_in_future,i=e==null?void 0:e.get("selectedTimeslot");if(i&&(i!=null&&i.start_time)){if(!this.isTimeslotValid(i))return;if(e!=null&&e.get("showBookingForm")){e==null||e.set("selectedDate",i.start_time);return}}const s=e==null?void 0:e.get("selectedDate"),a=e==null?void 0:e.get("availability");let r;if(!(a&&a.length>0)){if(s){const{startTime:u,endTime:f,endTimeForAvailableDaysInFuture:p}=this.validateAvailableDaysInFuture(s,o||30);s.getTime()<p*1e3&&(r=await((k=this.nylasSchedulerConnector)==null?void 0:k.scheduler.getAvailability(u,f)))}else{const u=new Date,{startTime:f,endTime:p,endTimeForAvailableDaysInFuture:_}=this.validateAvailableDaysInFuture(u,o||30);u.getTime()<_*1e3&&(r=await((v=this.nylasSchedulerConnector)==null?void 0:v.scheduler.getAvailability(f,p)))}if((!r||"error"in r)&&this.nylasSchedulerError.emit({...this.getErrorObject(r==null?void 0:r.error)}),!s){let u=new Date;const f=e==null?void 0:e.get("availability").find(p=>new Date(p.start_time)>new Date);f&&(u=f.start_time),e==null||e.set("selectedDate",u)}}}componentDisconnected(){var n;(n=this.baseProvider)==null||n.componentDisconnected()}bookingInfoChanged(n){var e;(e=this.stores)==null||e.scheduler.set("bookingInfo",n)}rescheduleBookingRefChanged(n){var e,o;if(n){const[i,s]=t.compactStringToUUIDs(n);(e=this.stores)==null||e.scheduler.set("rescheduleBookingId",s),this.refConfigId=i,(o=this.nylasSchedulerConnector)==null||o.scheduler.setConfigId(i)}}cancelBookingRefChanged(n){var e,o;if(n){const[i,s]=t.compactStringToUUIDs(n);(e=this.stores)==null||e.scheduler.set("cancelBookingId",s),this.refConfigId=i,(o=this.nylasSchedulerConnector)==null||o.scheduler.setConfigId(i)}}async registerComponentHandler(n){var e;(e=this.baseProvider)==null||e.registerComponent(n.detail)}async unregisterComponentHandler(n){var e;(e=this.baseProvider)==null||e.unregisterComponent(n.detail)}async monthChangedHandler(n){var r,d,l,h,g;const e=n.detail,o=(h=(l=(d=(r=this.nylasSchedulerConnector)==null?void 0:r.schedulerStore)==null?void 0:d.get("configSettings"))==null?void 0:l.scheduler)==null?void 0:h.available_days_in_future,{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:a}=this.validateAvailableDaysInFuture(e,o||30);if(i<a&&e.getTime()<a*1e3){const c=await((g=this.nylasSchedulerConnector)==null?void 0:g.scheduler.getAvailability(i,s));(!c||"error"in c)&&this.nylasSchedulerError.emit({...this.getErrorObject(c==null?void 0:c.error)})}}async bookButtonClickedHandler(n){var s,a,r,d;const o=(a=(s=this.nylasSchedulerConnector)==null?void 0:s.schedulerStore)==null?void 0:a.get("rescheduleBookingId");if(o){const l=await((r=this.nylasSchedulerConnector)==null?void 0:r.scheduler.rescheduleBooking(o,n.detail));(!l||"error"in l)&&this.nylasSchedulerError.emit({...this.getErrorObject(l==null?void 0:l.error)});return}const i=await((d=this.nylasSchedulerConnector)==null?void 0:d.scheduler.bookTimeslot(n.detail));(!i||"error"in i)&&this.nylasSchedulerError.emit({...this.getErrorObject(i==null?void 0:i.error)})}dateSelectedHandler(n){const e=n.detail;this.selectedDateLabel=e?e.toLocaleDateString(void 0,{dateStyle:"full"}):"No date selected"}cancelBookedEventErrorHandler(n){this.nylasSchedulerError.emit({...this.getErrorObject(n.detail.error)})}cancelBookedEventValidationErrorHandler(n){this.nylasSchedulerError.emit({...this.getErrorObject(n.detail.error)})}rescheduleBookedEventErrorHandler(n){this.nylasSchedulerError.emit({...this.getErrorObject(n.detail.error)})}async getNylasSchedulerStore(){var n;return(n=this.baseProvider)==null?void 0:n.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(n){return{title:(n==null?void 0:n.title)||I.title,category:(n==null?void 0:n.category)||I.category,type:m.nr.Error,description:(n==null?void 0:n.message)||"",id:new Date().getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){return!this.sessionId&&!this.refConfigId?(this.nylasSchedulerError.emit({title:"No sessionId!",category:y.ErrorCategory.Component,type:m.nr.Error,description:"Session ID is required",id:new Date().getTime().toString(),ttl:"none"}),!1):!0}isTimeslotValid(n){return new Date(n.start_time)<new Date?(this.nylasSchedulerError.emit({title:"Invalid tiemslot!",category:y.ErrorCategory.Component,type:m.nr.Error,description:"The selected timeslot is invalid.",id:new Date().getTime().toString(),ttl:"none"}),!1):!0}validateAvailableDaysInFuture(n,e){const o=new Date,i=new Date(n.getFullYear(),n.getMonth(),1).getTime()/1e3,s=new Date(n.getFullYear(),n.getMonth()+1,1).getTime()/1e3,a=Math.floor(t.addDaysToCurrentDate(o,e).getTime()/1e3),r=Math.min(a,s);return{startTime:i<o.getTime()/1e3?Math.floor(o.getTime()/1e3):i,endTime:r,endTimeForAvailableDaysInFuture:a}}render(){var g;const n=this.mode==="app",e=(g=this.baseProvider)==null?void 0:g.getStore("scheduler"),o=e==null?void 0:e.get("eventInfo"),i=e==null?void 0:e.get("showBookingForm"),s=e==null?void 0:e.get("cancelledEventInfo"),a=e==null?void 0:e.get("cancelBookingId"),r=e==null?void 0:e.get("selectedTimeslot"),d=e==null?void 0:e.get("rescheduleBookingId"),l=(e==null?void 0:e.get("nylasBranding"))||this.nylasBranding,h=e==null?void 0:e.get("selectedDate");if(this.selectedDateLabel=h?h.toLocaleDateString(void 0,{dateStyle:"full"}):"No date selected",n&&a&&!s)return t.h(t.Host,null,t.h(b,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"cancel-flow-page",part:"cancel-flow-page"},t.h("nylas-cancel-booking-form",{cancelBookingId:a,exportparts:"ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label"}))));if(n&&s)return t.h(t.Host,null,t.h(b,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"cancelled-event-page",part:"cancelled-event-page"},t.h("nylas-cancelled-event-card",{cancelledEventInfo:s,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))));if(n&&o)return t.h(t.Host,null,t.h(b,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"booked-event-page",part:"booked-event-page"},t.h("nylas-booked-event-card",{selectedTimeslot:r,eventInfo:o,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))));if(n&&(!o||d)&&!i){const c=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return t.h(t.Host,null,t.h(b,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},d&&t.h(x,null,"Choose another time slot to reschedule your meeting"),t.h("div",{class:"select-date-page",part:"select-date-page"},t.h("div",{class:"left-panel"},t.h("nylas-date-picker",{exportparts:"ndp, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),t.h("nylas-locale-switch",null)),t.h("div",{class:"right-panel"},t.h("h2",null,t.h("calendar-icon",null),t.h("span",{id:"selectedDate"},this.selectedDateLabel)),t.h("nylas-timeslot-picker",{exportparts:"ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},c&&t.h("span",{slot:"timeslot-picker-cta-label"},t.h("slot",{name:"timeslot-picker-cta-label"})))))))}if(n&&!o&&i){const c=this.host.querySelector('[slot="custom-booking-form"]');return t.h(t.Host,null,t.h(b,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},d&&t.h(x,null,"Choose another time slot to reschedule your meeting"),t.h("div",{class:"additional-data-page",part:"additional-data-page"},t.h("div",{class:"left-panel"},t.h("div",{class:"wrapper"},t.h("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time"}))),t.h("div",{class:"right-panel"},t.h("nylas-booking-form",{exportparts:"nbf, nbf__input-label, nbf__input-textfield, nbf__button-ghost, nbf__button-primary, nbf__button-outline"},c&&t.h("div",{slot:"custom-booking-form"},t.h("slot",{name:"custom-booking-form"})))))))}return t.h(t.Host,null,t.h("slot",null))}get host(){return t.getElement(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"]}}};w.style=D;exports.nylas_scheduling=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-769f0fdd.cjs"),m=require("./index.es-9cc0eb3c-e8de46e6.cjs"),y=require("./scheduler-store-f02ce045-f11cfad9.cjs");require("react");require("react-dom");class C{constructor({schedulerAPIURL:e,nylasSchedulerStore:o,sessionId:i,configId:s}){if(!e)throw new Error("schedulerAPIURL is required");if(!o)throw new Error("nylasSchedulerStore is required");if(!i&&!s)throw new Error("sessionId is required for private configs, if not config id is required for public configs");e==="/"&&(e=new URL(window.location.href).origin),this.configId=s,this.sessionId=i,this.schedulerAPIURL=e,this.nylasSchedulerStore=o}init(){t.debug("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new y.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId}),this._schedulerAPIConnector)}resetStores(){this.nylasSchedulerStore.reset()}}const b=(n,e)=>{const o=n.isLoading,i=n.showNotification,s=n.nylasBranding;return t.h(t.Fragment,null,i&&t.h("nylas-notification",null),o&&t.h("div",{class:"loading"},t.h("div",{class:"left"},t.h("div",{class:"skeleton"})),t.h("div",{class:"right"},t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}))),!o&&e,t.h("div",{class:"footer"},s&&t.h(t.Fragment,null,"Powered by ",t.h("nylas-logo",null))))},x=(n,e)=>t.h("div",{class:"message-banner"},e),E=':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 6px -2px rgba(0, 0, 0, 0.05), 0px 10px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;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-top:1rem}.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,.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{background-color:var(--nylas-base-50)}.cancelled-event-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:384px;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{padding:0.5rem 4px 0;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}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto}}.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:496px}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer svg{fill:var(--nylas-base-500)}.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;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-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}',D=E,I={title:"Something went wrong...",type:m.nr.Error,category:y.ErrorCategory.Component},w=class{constructor(n){t.registerInstance(this,n),this.init=t.createEvent(this,"init",7),this.schedulerWillLoad=t.createEvent(this,"schedulerWillLoad",7),this.schedulerDidLoad=t.createEvent(this,"schedulerDidLoad",7),this.nylasSchedulerError=t.createEvent(this,"nylasSchedulerError",7),this.bookingRefExtracted=t.createEvent(this,"bookingRefExtracted",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.configurationId=void 0,this.nylasBranding=!0,this.eventOverrides={},this.isLoading=void 0,this.themeConfig=void 0,this.showNotification=!0,this.automaticComponentRegistration=!0,this.selectedDateLabel=new Date().toLocaleDateString(void 0,{dateStyle:"full"})||"No date selected",this.refConfigId=void 0}connectedCallback(){t.debug("[nylas-scheduler] connectedCallback")}async componentWillLoad(){var o,i;if(t.debug("[nylas-scheduler] Component will load"),this.schedulerWillLoad.emit(this.host).defaultPrevented)return;if(this.stores={scheduler:y.CreateNylasSchedulerStore({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,...this.defaultSchedulerState})},this.baseProvider=new m.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.refConfigId=this.configurationId,this.rescheduleBookingRef){const[s,a]=t.compactStringToUUIDs(this.rescheduleBookingRef);this.refConfigId=s,this.stores.scheduler.set("rescheduleBookingId",a),this.bookingRefExtracted.emit({configurationId:s,bookingId:a})}else if(this.cancelBookingRef){const[s,a]=t.compactStringToUUIDs(this.cancelBookingRef);this.refConfigId=s,this.stores.scheduler.set("cancelBookingId",a),this.bookingRefExtracted.emit({configurationId:s,bookingId:a})}if(!this.checkIfSessionIdOrConfigIdExists())return;const e=(o=this.baseProvider)==null?void 0:o.getStore("scheduler");if(this.nylasSchedulerConnector=new C({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,nylasSchedulerStore:e}),this.init.emit(this.host),(i=this.baseProvider)==null||i.componentWillLoad(this.nylasSchedulerConnector),this.themeConfig)for(const[s,a]of Object.entries(this.themeConfig))this.host.style.setProperty(`${s}`,a)}async componentDidLoad(){var d,l,h,g,c,v,k;if((d=this.baseProvider)==null||d.componentDidLoad(),!this.checkIfSessionIdOrConfigIdExists())return;const n=await((l=this.nylasSchedulerConnector)==null?void 0:l.scheduler.getUISettings());(!n||"error"in n)&&this.nylasSchedulerError.emit({...this.getErrorObject(n==null?void 0:n.error)});const e=(h=this.baseProvider)==null?void 0:h.getStore("scheduler"),o=(c=(g=e==null?void 0:e.get("configSettings"))==null?void 0:g.scheduler)==null?void 0:c.available_days_in_future,i=e==null?void 0:e.get("selectedTimeslot");if(i&&(i!=null&&i.start_time)){if(!this.isTimeslotValid(i))return;if(e!=null&&e.get("showBookingForm")){e==null||e.set("selectedDate",i.start_time);return}}const s=e==null?void 0:e.get("selectedDate"),a=e==null?void 0:e.get("availability");let r;if(!(a&&a.length>0)){if(s){const{startTime:u,endTime:f,endTimeForAvailableDaysInFuture:p}=this.validateAvailableDaysInFuture(s,o||30);s.getTime()<p*1e3&&(r=await((k=this.nylasSchedulerConnector)==null?void 0:k.scheduler.getAvailability(u,f)))}else{const u=new Date,{startTime:f,endTime:p,endTimeForAvailableDaysInFuture:_}=this.validateAvailableDaysInFuture(u,o||30);u.getTime()<_*1e3&&(r=await((v=this.nylasSchedulerConnector)==null?void 0:v.scheduler.getAvailability(f,p)))}if((!r||"error"in r)&&this.nylasSchedulerError.emit({...this.getErrorObject(r==null?void 0:r.error)}),!s){let u=new Date;const f=e==null?void 0:e.get("availability").find(p=>new Date(p.start_time)>new Date);f&&(u=f.start_time),e==null||e.set("selectedDate",u)}}}componentDisconnected(){var n;(n=this.baseProvider)==null||n.componentDisconnected()}bookingInfoChanged(n){var e;(e=this.stores)==null||e.scheduler.set("bookingInfo",n)}rescheduleBookingRefChanged(n){var e,o;if(n){const[i,s]=t.compactStringToUUIDs(n);(e=this.stores)==null||e.scheduler.set("rescheduleBookingId",s),this.refConfigId=i,(o=this.nylasSchedulerConnector)==null||o.scheduler.setConfigId(i)}}cancelBookingRefChanged(n){var e,o;if(n){const[i,s]=t.compactStringToUUIDs(n);(e=this.stores)==null||e.scheduler.set("cancelBookingId",s),this.refConfigId=i,(o=this.nylasSchedulerConnector)==null||o.scheduler.setConfigId(i)}}async registerComponentHandler(n){var e;(e=this.baseProvider)==null||e.registerComponent(n.detail)}async unregisterComponentHandler(n){var e;(e=this.baseProvider)==null||e.unregisterComponent(n.detail)}async monthChangedHandler(n){var r,d,l,h,g;const e=n.detail,o=(h=(l=(d=(r=this.nylasSchedulerConnector)==null?void 0:r.schedulerStore)==null?void 0:d.get("configSettings"))==null?void 0:l.scheduler)==null?void 0:h.available_days_in_future,{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:a}=this.validateAvailableDaysInFuture(e,o||30);if(i<a&&e.getTime()<a*1e3){const c=await((g=this.nylasSchedulerConnector)==null?void 0:g.scheduler.getAvailability(i,s));(!c||"error"in c)&&this.nylasSchedulerError.emit({...this.getErrorObject(c==null?void 0:c.error)})}}async bookButtonClickedHandler(n){var s,a,r,d;const o=(a=(s=this.nylasSchedulerConnector)==null?void 0:s.schedulerStore)==null?void 0:a.get("rescheduleBookingId");if(o){const l=await((r=this.nylasSchedulerConnector)==null?void 0:r.scheduler.rescheduleBooking(o,n.detail));(!l||"error"in l)&&this.nylasSchedulerError.emit({...this.getErrorObject(l==null?void 0:l.error)});return}const i=await((d=this.nylasSchedulerConnector)==null?void 0:d.scheduler.bookTimeslot(n.detail));(!i||"error"in i)&&this.nylasSchedulerError.emit({...this.getErrorObject(i==null?void 0:i.error)})}dateSelectedHandler(n){const e=n.detail;this.selectedDateLabel=e?e.toLocaleDateString(void 0,{dateStyle:"full"}):"No date selected"}cancelBookedEventErrorHandler(n){this.nylasSchedulerError.emit({...this.getErrorObject(n.detail.error)})}cancelBookedEventValidationErrorHandler(n){this.nylasSchedulerError.emit({...this.getErrorObject(n.detail.error)})}rescheduleBookedEventErrorHandler(n){this.nylasSchedulerError.emit({...this.getErrorObject(n.detail.error)})}async getNylasSchedulerStore(){var n;return(n=this.baseProvider)==null?void 0:n.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(n){return{title:(n==null?void 0:n.title)||I.title,category:(n==null?void 0:n.category)||I.category,type:m.nr.Error,description:(n==null?void 0:n.message)||"",id:new Date().getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){return!this.sessionId&&!this.refConfigId?(this.nylasSchedulerError.emit({title:"No sessionId!",category:y.ErrorCategory.Component,type:m.nr.Error,description:"Session ID is required",id:new Date().getTime().toString(),ttl:"none"}),!1):!0}isTimeslotValid(n){return new Date(n.start_time)<new Date?(this.nylasSchedulerError.emit({title:"Invalid tiemslot!",category:y.ErrorCategory.Component,type:m.nr.Error,description:"The selected timeslot is invalid.",id:new Date().getTime().toString(),ttl:"none"}),!1):!0}validateAvailableDaysInFuture(n,e){const o=new Date,i=new Date(n.getFullYear(),n.getMonth(),1).getTime()/1e3,s=new Date(n.getFullYear(),n.getMonth()+1,1).getTime()/1e3,a=Math.floor(t.addDaysToCurrentDate(o,e).getTime()/1e3),r=Math.min(a,s);return{startTime:i<o.getTime()/1e3?Math.floor(o.getTime()/1e3):i,endTime:r,endTimeForAvailableDaysInFuture:a}}render(){var g;const n=this.mode==="app",e=(g=this.baseProvider)==null?void 0:g.getStore("scheduler"),o=e==null?void 0:e.get("eventInfo"),i=e==null?void 0:e.get("showBookingForm"),s=e==null?void 0:e.get("cancelledEventInfo"),a=e==null?void 0:e.get("cancelBookingId"),r=e==null?void 0:e.get("selectedTimeslot"),d=e==null?void 0:e.get("rescheduleBookingId"),l=(e==null?void 0:e.get("nylasBranding"))||this.nylasBranding,h=e==null?void 0:e.get("selectedDate");if(this.selectedDateLabel=h?h.toLocaleDateString(void 0,{dateStyle:"full"}):"No date selected",n&&a&&!s)return t.h(t.Host,null,t.h(b,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"cancel-flow-page",part:"cancel-flow-page"},t.h("nylas-cancel-booking-form",{cancelBookingId:a,exportparts:"ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label"}))));if(n&&s)return t.h(t.Host,null,t.h(b,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"cancelled-event-page",part:"cancelled-event-page"},t.h("nylas-cancelled-event-card",{cancelledEventInfo:s,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))));if(n&&o)return t.h(t.Host,null,t.h(b,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"booked-event-page",part:"booked-event-page"},t.h("nylas-booked-event-card",{selectedTimeslot:r,eventInfo:o,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))));if(n&&(!o||d)&&!i){const c=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return t.h(t.Host,null,t.h(b,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},d&&t.h(x,null,"Choose another time slot to reschedule your meeting"),t.h("div",{class:"select-date-page",part:"select-date-page"},t.h("div",{class:"left-panel"},t.h("nylas-date-picker",{exportparts:"ndp, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),t.h("nylas-locale-switch",null)),t.h("div",{class:"right-panel"},t.h("h2",null,t.h("calendar-icon",null),t.h("span",{id:"selectedDate"},this.selectedDateLabel)),t.h("nylas-timeslot-picker",{exportparts:"ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},c&&t.h("span",{slot:"timeslot-picker-cta-label"},t.h("slot",{name:"timeslot-picker-cta-label"})))))))}if(n&&!o&&i){const c=this.host.querySelector('[slot="custom-booking-form"]');return t.h(t.Host,null,t.h(b,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},d&&t.h(x,null,"Choose another time slot to reschedule your meeting"),t.h("div",{class:"additional-data-page",part:"additional-data-page"},t.h("div",{class:"left-panel"},t.h("div",{class:"wrapper"},t.h("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time"}))),t.h("div",{class:"right-panel"},t.h("nylas-booking-form",{exportparts:"nbf, nbf__input-label, nbf__input-textfield, nbf__button-ghost, nbf__button-primary, nbf__button-outline"},c&&t.h("div",{slot:"custom-booking-form"},t.h("slot",{name:"custom-booking-form"})))))))}return t.h(t.Host,null,t.h("slot",null))}get host(){return t.getElement(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"]}}};w.style=D;exports.nylas_scheduling=w;
@@ -1,5 +1,5 @@
1
- import { r as f, c as p, d as i, h as o, H as u } from "./index-f383e3c4.js";
2
- import { R as m } from "./register-component-a5a9ca5d-438c8a96.js";
1
+ import { r as f, c as p, d as i, h as o, H as u } from "./index-5851f0a2.js";
2
+ import { R as m } from "./register-component-a5a9ca5d-538c35c3.js";
3
3
  import "react";
4
4
  import "react-dom";
5
5
  const g = ":host{display:contents}.container{width:100%;overflow:auto;-webkit-overflow-scrolling:touch}.pull-to-refresh{display:none;border:0;background-color:transparent;text-align:center;width:100%;justify-content:center}.pulling{position:relative;display:flex;margin:0 auto;padding:1rem}.pulling svg{width:24px;height:24px;color:var(--nylas-color-primary-500);transform:rotate(90deg)}.refreshing{position:relative;display:flex;margin:0 auto;padding:1rem}.refreshing svg{width:24px;height:24px;fill:var(--nylas-color-primary-500);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}", y = g;
@@ -45,11 +45,11 @@ const d = class {
45
45
  this.state = t;
46
46
  }
47
47
  render() {
48
- return o(u, { key: "1a5e154e652550169d5cbdc160be06da9ac1b8fd" }, o("div", { key: "294009192190ba042e972b35d669afe9eda99301", class: "container", ref: (t) => this.containerElement = t }, o("button", { key: "7ca1d0bcfe649891fb6448b5b31fd7d80238b47c", class: {
48
+ return o(u, { key: "78623dead3d55974c4f23b65b404fe4e23f899ef" }, o("div", { key: "5f569606f9e27b49a5e621bf5576713749053275", class: "container", ref: (t) => this.containerElement = t }, o("button", { key: "3a11bbafb81272c310ce0cad0a806293f04d231b", class: {
49
49
  "pull-to-refresh": !0,
50
50
  pulling: this.pulling,
51
51
  refreshing: this.state === "loading"
52
- }, "aria-label": "Refreshing..." }, this.state === "loading" && o("refresh-icon", { slot: "icon" }), this.state !== "loading" && o("arrow-icon", { slot: "icon" })), o("div", { key: "6086b2714b71f1c20d12afae5fc155d8653345e9", class: "content", ref: (t) => this.contentElement = t }, o("slot", { key: "f4c19825eaf317f60ac4c254f97c36237e123926" }))));
52
+ }, "aria-label": "Refreshing..." }, this.state === "loading" && o("refresh-icon", { slot: "icon" }), this.state !== "loading" && o("arrow-icon", { slot: "icon" })), o("div", { key: "e348316e54c25bce6df68d89d51a637657a91131", class: "content", ref: (t) => this.contentElement = t }, o("slot", { key: "502f560a3e42519b3b05f5009d71562ec8e257a4" }))));
53
53
  }
54
54
  };
55
55
  v([
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-f435e814.cjs"),d=require("./register-component-a5a9ca5d-ebf633cf.cjs");require("react");require("react-dom");const f=":host{display:contents}.container{width:100%;overflow:auto;-webkit-overflow-scrolling:touch}.pull-to-refresh{display:none;border:0;background-color:transparent;text-align:center;width:100%;justify-content:center}.pulling{position:relative;display:flex;margin:0 auto;padding:1rem}.pulling svg{width:24px;height:24px;color:var(--nylas-color-primary-500);transform:rotate(90deg)}.refreshing{position:relative;display:flex;margin:0 auto;padding:1rem}.refreshing svg{width:24px;height:24px;fill:var(--nylas-color-primary-500);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}",u=f;var p=function(t,e,n,a){var i=arguments.length,r=i<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,n):a,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,a);else for(var h=t.length-1;h>=0;h--)(o=t[h])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r},l=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const c=class{constructor(t){s.registerInstance(this,t),this.refresh=s.createEvent(this,"refresh",7),this.threshold=100,this.onTouchStart=e=>{var n,a,i,r;s.debug("[nylas-threads-refresh] Touch start",e.touches[0].pageY,(n=this.containerElement)==null?void 0:n.scrollTop,(a=this.containerElement)==null?void 0:a.offsetHeight,(i=this.contentElement)==null?void 0:i.scrollTop),((r=this.containerElement)==null?void 0:r.scrollTop)===0?this.start=e.touches[0].pageY:this.start=0},this.onTouchMove=e=>{this.start&&(e.touches[0].pageY-this.start>this.threshold?this.pulling=!0:this.pulling=!1)},this.onTouchEnd=e=>{this.start&&(e.changedTouches[0].pageY-this.start>this.threshold&&(this.pulling=!1,this.refresh.emit({updateState:this.updateState})),this.start=0)},this.start=0,this.state="ready",this.pulling=!1,s.debug("[nylas-threads-refresh] Constructor"),this.updateState=this.updateState.bind(this)}connectedCallback(){}async componentWillLoad(){s.debug("[nylas-threads-refresh] Component will load")}componentDidLoad(){var t,e,n;s.debug("[nylas-threads-refresh] Component did load"),(t=this.containerElement)==null||t.addEventListener("touchstart",this.onTouchStart),(e=this.containerElement)==null||e.addEventListener("touchmove",this.onTouchMove),(n=this.containerElement)==null||n.addEventListener("touchend",this.onTouchEnd)}disconnectedCallback(){var t,e,n;s.debug("[nylas-threads-refresh] Component disconnected"),(t=this.containerElement)==null||t.removeEventListener("touchstart",this.onTouchStart),(e=this.containerElement)==null||e.removeEventListener("touchmove",this.onTouchMove),(n=this.containerElement)==null||n.removeEventListener("touchend",this.onTouchEnd)}async updateState(t){this.state=t}render(){return s.h(s.Host,{key:"1a5e154e652550169d5cbdc160be06da9ac1b8fd"},s.h("div",{key:"294009192190ba042e972b35d669afe9eda99301",class:"container",ref:t=>this.containerElement=t},s.h("button",{key:"7ca1d0bcfe649891fb6448b5b31fd7d80238b47c",class:{"pull-to-refresh":!0,pulling:this.pulling,refreshing:this.state==="loading"},"aria-label":"Refreshing..."},this.state==="loading"&&s.h("refresh-icon",{slot:"icon"}),this.state!=="loading"&&s.h("arrow-icon",{slot:"icon"})),s.h("div",{key:"6086b2714b71f1c20d12afae5fc155d8653345e9",class:"content",ref:t=>this.contentElement=t},s.h("slot",{key:"f4c19825eaf317f60ac4c254f97c36237e123926"}))))}};p([d.RegisterComponent({name:"nylas-threads-refresh",eventToProps:{refresh:async(t,e)=>{s.debug("[nylas-threads-refresh] Refreshing threads");const{updateState:n}=t.detail;await n("loading"),await e.threads.getThreads(void 0,"overwrite",!1),await n("ready")}},fireRegisterEvent:!0}),l("design:type",Function),l("design:paramtypes",[]),l("design:returntype",void 0)],c.prototype,"render",null);c.style=u;exports.nylas_threads_refresh=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-769f0fdd.cjs"),d=require("./register-component-a5a9ca5d-8b06415c.cjs");require("react");require("react-dom");const f=":host{display:contents}.container{width:100%;overflow:auto;-webkit-overflow-scrolling:touch}.pull-to-refresh{display:none;border:0;background-color:transparent;text-align:center;width:100%;justify-content:center}.pulling{position:relative;display:flex;margin:0 auto;padding:1rem}.pulling svg{width:24px;height:24px;color:var(--nylas-color-primary-500);transform:rotate(90deg)}.refreshing{position:relative;display:flex;margin:0 auto;padding:1rem}.refreshing svg{width:24px;height:24px;fill:var(--nylas-color-primary-500);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}",u=f;var p=function(t,e,n,a){var i=arguments.length,r=i<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,n):a,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,a);else for(var h=t.length-1;h>=0;h--)(o=t[h])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r},l=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const c=class{constructor(t){s.registerInstance(this,t),this.refresh=s.createEvent(this,"refresh",7),this.threshold=100,this.onTouchStart=e=>{var n,a,i,r;s.debug("[nylas-threads-refresh] Touch start",e.touches[0].pageY,(n=this.containerElement)==null?void 0:n.scrollTop,(a=this.containerElement)==null?void 0:a.offsetHeight,(i=this.contentElement)==null?void 0:i.scrollTop),((r=this.containerElement)==null?void 0:r.scrollTop)===0?this.start=e.touches[0].pageY:this.start=0},this.onTouchMove=e=>{this.start&&(e.touches[0].pageY-this.start>this.threshold?this.pulling=!0:this.pulling=!1)},this.onTouchEnd=e=>{this.start&&(e.changedTouches[0].pageY-this.start>this.threshold&&(this.pulling=!1,this.refresh.emit({updateState:this.updateState})),this.start=0)},this.start=0,this.state="ready",this.pulling=!1,s.debug("[nylas-threads-refresh] Constructor"),this.updateState=this.updateState.bind(this)}connectedCallback(){}async componentWillLoad(){s.debug("[nylas-threads-refresh] Component will load")}componentDidLoad(){var t,e,n;s.debug("[nylas-threads-refresh] Component did load"),(t=this.containerElement)==null||t.addEventListener("touchstart",this.onTouchStart),(e=this.containerElement)==null||e.addEventListener("touchmove",this.onTouchMove),(n=this.containerElement)==null||n.addEventListener("touchend",this.onTouchEnd)}disconnectedCallback(){var t,e,n;s.debug("[nylas-threads-refresh] Component disconnected"),(t=this.containerElement)==null||t.removeEventListener("touchstart",this.onTouchStart),(e=this.containerElement)==null||e.removeEventListener("touchmove",this.onTouchMove),(n=this.containerElement)==null||n.removeEventListener("touchend",this.onTouchEnd)}async updateState(t){this.state=t}render(){return s.h(s.Host,{key:"78623dead3d55974c4f23b65b404fe4e23f899ef"},s.h("div",{key:"5f569606f9e27b49a5e621bf5576713749053275",class:"container",ref:t=>this.containerElement=t},s.h("button",{key:"3a11bbafb81272c310ce0cad0a806293f04d231b",class:{"pull-to-refresh":!0,pulling:this.pulling,refreshing:this.state==="loading"},"aria-label":"Refreshing..."},this.state==="loading"&&s.h("refresh-icon",{slot:"icon"}),this.state!=="loading"&&s.h("arrow-icon",{slot:"icon"})),s.h("div",{key:"e348316e54c25bce6df68d89d51a637657a91131",class:"content",ref:t=>this.contentElement=t},s.h("slot",{key:"502f560a3e42519b3b05f5009d71562ec8e257a4"}))))}};p([d.RegisterComponent({name:"nylas-threads-refresh",eventToProps:{refresh:async(t,e)=>{s.debug("[nylas-threads-refresh] Refreshing threads");const{updateState:n}=t.detail;await n("loading"),await e.threads.getThreads(void 0,"overwrite",!1),await n("ready")}},fireRegisterEvent:!0}),l("design:type",Function),l("design:paramtypes",[]),l("design:returntype",void 0)],c.prototype,"render",null);c.style=u;exports.nylas_threads_refresh=c;
@@ -1,5 +1,5 @@
1
- import { r as u, c as y, d as h, h as i, H as p } from "./index-f383e3c4.js";
2
- import { R as f } from "./register-component-a5a9ca5d-438c8a96.js";
1
+ import { r as u, c as f, d as h, h as i, H as y } from "./index-5851f0a2.js";
2
+ import { R as p } from "./register-component-a5a9ca5d-538c35c3.js";
3
3
  import "react";
4
4
  import "react-dom";
5
5
  const m = ":host{display:block}sp-search{width:100%;border:0}", b = m;
@@ -17,7 +17,7 @@ var g = function(t, e, n, r) {
17
17
  };
18
18
  const d = class {
19
19
  constructor(t) {
20
- u(this, t), this.search = y(this, "search", 7), this.onSearch = async (e) => {
20
+ u(this, t), this.search = f(this, "search", 7), this.onSearch = async (e) => {
21
21
  e.preventDefault(), e.stopPropagation();
22
22
  const r = e.target.value;
23
23
  r !== this.internalQuery && (this.internalQuery = r, this.search.emit(this.internalQuery));
@@ -37,7 +37,7 @@ const d = class {
37
37
  this.internalQuery = this.query;
38
38
  }
39
39
  render() {
40
- return i(p, { key: "9ac2361052b4def43a8bd3296a417a9c67044866" }, i("sp-theme", { key: "d5a0bfbb7b354b88e24f677038234c118c69a8e6", scale: "medium", color: "dark" }, i("sp-search", { key: "8080a39d996626207153323910be28951e21a2e5", quiet: !0, onSubmit: this.onSearch, onBlur: this.onSearch, value: this.internalQuery })));
40
+ return i(y, { key: "1687f5f2753a274f3ded1633a69873ff54ffb56c" }, i("sp-theme", { key: "63c6d6be18695a7e78eaf5a15745f5e6772c7f4d", scale: "medium", color: "dark" }, i("sp-search", { key: "2a107fb7f19d21db7a62ebed0775a8f7c31d4f9c", quiet: !0, onSubmit: this.onSearch, onBlur: this.onSearch, value: this.internalQuery })));
41
41
  }
42
42
  static get watchers() {
43
43
  return {
@@ -46,7 +46,7 @@ const d = class {
46
46
  }
47
47
  };
48
48
  g([
49
- f({
49
+ p({
50
50
  name: "nylas-pagination",
51
51
  stateToProps: /* @__PURE__ */ new Map([["mailbox.searchQuery", "query"]]),
52
52
  eventToProps: {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-f435e814.cjs"),u=require("./register-component-a5a9ca5d-ebf633cf.cjs");require("react");require("react-dom");const d=":host{display:block}sp-search{width:100%;border:0}",y=d;var p=function(t,e,s,n){var o=arguments.length,r=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,s,n);else for(var i=t.length-1;i>=0;i--)(c=t[i])&&(r=(o<3?c(r):o>3?c(e,s,r):c(e,s))||r);return o>3&&r&&Object.defineProperty(e,s,r),r},l=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const h=class{constructor(t){a.registerInstance(this,t),this.search=a.createEvent(this,"search",7),this.onSearch=async e=>{e.preventDefault(),e.stopPropagation();const n=e.target.value;n!==this.internalQuery&&(this.internalQuery=n,this.search.emit(this.internalQuery))},this.query="",this.internalQuery=""}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){a.debug("[nylas-threads-search] Component will load")}async componentDidLoad(){a.debug("[nylas-threads-search] Component did load")}onQueryChange(){this.internalQuery=this.query}render(){return a.h(a.Host,{key:"9ac2361052b4def43a8bd3296a417a9c67044866"},a.h("sp-theme",{key:"d5a0bfbb7b354b88e24f677038234c118c69a8e6",scale:"medium",color:"dark"},a.h("sp-search",{key:"8080a39d996626207153323910be28951e21a2e5",quiet:!0,onSubmit:this.onSearch,onBlur:this.onSearch,value:this.internalQuery})))}static get watchers(){return{query:["onQueryChange"]}}};p([u.RegisterComponent({name:"nylas-pagination",stateToProps:new Map([["mailbox.searchQuery","query"]]),eventToProps:{search:async(t,e)=>{await e.threads.getThreads({search_query_native:t.detail||void 0,page_token:void 0})}},fireRegisterEvent:!0}),l("design:type",Function),l("design:paramtypes",[]),l("design:returntype",void 0)],h.prototype,"render",null);h.style=y;exports.nylas_threads_search=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-769f0fdd.cjs"),h=require("./register-component-a5a9ca5d-8b06415c.cjs");require("react");require("react-dom");const u=":host{display:block}sp-search{width:100%;border:0}",f=u;var y=function(t,e,s,n){var o=arguments.length,r=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,s,n);else for(var i=t.length-1;i>=0;i--)(c=t[i])&&(r=(o<3?c(r):o>3?c(e,s,r):c(e,s))||r);return o>3&&r&&Object.defineProperty(e,s,r),r},l=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const d=class{constructor(t){a.registerInstance(this,t),this.search=a.createEvent(this,"search",7),this.onSearch=async e=>{e.preventDefault(),e.stopPropagation();const n=e.target.value;n!==this.internalQuery&&(this.internalQuery=n,this.search.emit(this.internalQuery))},this.query="",this.internalQuery=""}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){a.debug("[nylas-threads-search] Component will load")}async componentDidLoad(){a.debug("[nylas-threads-search] Component did load")}onQueryChange(){this.internalQuery=this.query}render(){return a.h(a.Host,{key:"1687f5f2753a274f3ded1633a69873ff54ffb56c"},a.h("sp-theme",{key:"63c6d6be18695a7e78eaf5a15745f5e6772c7f4d",scale:"medium",color:"dark"},a.h("sp-search",{key:"2a107fb7f19d21db7a62ebed0775a8f7c31d4f9c",quiet:!0,onSubmit:this.onSearch,onBlur:this.onSearch,value:this.internalQuery})))}static get watchers(){return{query:["onQueryChange"]}}};y([h.RegisterComponent({name:"nylas-pagination",stateToProps:new Map([["mailbox.searchQuery","query"]]),eventToProps:{search:async(t,e)=>{await e.threads.getThreads({search_query_native:t.detail||void 0,page_token:void 0})}},fireRegisterEvent:!0}),l("design:type",Function),l("design:paramtypes",[]),l("design:returntype",void 0)],d.prototype,"render",null);d.style=f;exports.nylas_threads_search=d;