@nylas/react 1.1.0-canary.20 → 1.1.0-canary.21

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 (145) hide show
  1. package/dist/add-circle-icon_2.entry-29cc2385.cjs +1 -0
  2. package/dist/add-circle-icon_2.entry-b8d6df60.js +69 -0
  3. package/dist/{archive-icon_7.entry-2f418a3e.js → archive-icon_7.entry-3830776a.js} +18 -18
  4. package/dist/{archive-icon_7.entry-eb90a353.cjs → archive-icon_7.entry-afaef817.cjs} +1 -1
  5. package/dist/{arrow-icon.entry-753eb942.js → arrow-icon.entry-19f00716.js} +1 -1
  6. package/dist/{arrow-icon.entry-ac5e1a47.cjs → arrow-icon.entry-460cdd9f.cjs} +1 -1
  7. package/dist/{bold-icon_3.entry-4fff7400.cjs → bold-icon_3.entry-1893eeec.cjs} +1 -1
  8. package/dist/{bold-icon_3.entry-18507c82.js → bold-icon_3.entry-80abafbb.js} +3 -3
  9. package/dist/button-component.entry-36137536.js +16 -0
  10. package/dist/button-component.entry-b78dc39e.cjs +1 -0
  11. package/dist/calendar-agenda-fill-icon_40.entry-62c66fce.cjs +10 -0
  12. package/dist/{calendar-agenda-fill-icon_35.entry-db989ce0.js → calendar-agenda-fill-icon_40.entry-f19d6ad7.js} +1469 -1076
  13. package/dist/{calendar-cancel-icon.entry-d2e10dfc.cjs → calendar-cancel-icon.entry-0d83ee82.cjs} +1 -1
  14. package/dist/{calendar-cancel-icon.entry-31caeae1.js → calendar-cancel-icon.entry-1fae00c5.js} +1 -1
  15. package/dist/{calendar-check-icon_2.entry-7f67c003.js → calendar-check-icon_2.entry-159c38af.js} +1 -1
  16. package/dist/{calendar-check-icon_2.entry-d32551e9.cjs → calendar-check-icon_2.entry-e01c9028.cjs} +1 -1
  17. package/dist/{calendar-icon.entry-f3f1c623.cjs → calendar-icon.entry-2e701aab.cjs} +1 -1
  18. package/dist/{calendar-icon.entry-6e89816b.js → calendar-icon.entry-3af9cb76.js} +1 -1
  19. package/dist/checkbox-component_2.entry-5eee51f6.js +56 -0
  20. package/dist/checkbox-component_2.entry-9ff2c85b.cjs +1 -0
  21. package/dist/checkmark-icon.entry-0749b942.js +15 -0
  22. package/dist/checkmark-icon.entry-f96f1117.cjs +1 -0
  23. package/dist/{chevron-icon_3.entry-2e20a83e.js → chevron-icon_3.entry-2e9eebbc.js} +10 -10
  24. package/dist/{chevron-icon_3.entry-3be68846.cjs → chevron-icon_3.entry-c3989df2.cjs} +1 -1
  25. package/dist/clock-icon_4.entry-9395d0cb.js +45 -0
  26. package/dist/clock-icon_4.entry-d4563931.cjs +1 -0
  27. package/dist/close-icon.entry-cf9f0a69.js +15 -0
  28. package/dist/close-icon.entry-e24af309.cjs +1 -0
  29. package/dist/{constants-7ce66b44-3952e81c.js → constants-67de2eec-b17f5b96.js} +37 -17
  30. package/dist/{constants-7ce66b44-a6b777d4.cjs → constants-67de2eec-e3b50fc6.cjs} +5 -5
  31. package/dist/{copy-icon_4.entry-187edab9.js → copy-icon_3.entry-7b276fa2.js} +9 -19
  32. package/dist/copy-icon_3.entry-7de3667f.cjs +1 -0
  33. package/dist/document-refresh-icon.entry-582ac233.cjs +1 -0
  34. package/dist/{document-refresh-icon.entry-9d7900d7.js → document-refresh-icon.entry-6dd65cb6.js} +2 -2
  35. package/dist/elements/index.d.ts +8 -0
  36. package/dist/{elements-dc5b338e-edf63aa6.cjs → elements-dc5b338e-158dce67.cjs} +1 -1
  37. package/dist/{elements-dc5b338e-e6271e48.js → elements-dc5b338e-5e8a704b.js} +1 -1
  38. package/dist/{focus-visible-e8093c16-84e41b3b.cjs → focus-visible-e8093c16-5883a317.cjs} +1 -1
  39. package/dist/{focus-visible-e8093c16-4c45967c.js → focus-visible-e8093c16-9d88e8ee.js} +1 -1
  40. package/dist/{forward-icon_6.entry-4cb6eb63.cjs → forward-icon_6.entry-a59dada5.cjs} +3 -3
  41. package/dist/{forward-icon_6.entry-949d0cfb.js → forward-icon_6.entry-acdf04ad.js} +7 -7
  42. package/dist/{globe-icon.entry-04b35395.js → globe-icon.entry-389c0391.js} +2 -2
  43. package/dist/{globe-icon.entry-741f8ad4.cjs → globe-icon.entry-eef27331.cjs} +1 -1
  44. package/dist/google-logo-icon_4.entry-e9be320c.cjs +1 -0
  45. package/dist/google-logo-icon_4.entry-eae19fc8.js +637 -0
  46. package/dist/index-53420959-82a5306f.cjs +1 -0
  47. package/dist/index-53420959-9b1699ec.js +5 -0
  48. package/dist/{index-6d9eeb53-8b16e3b5.cjs → index-6d9eeb53-15c69801.cjs} +1 -1
  49. package/dist/{index-6d9eeb53-b15263de.js → index-6d9eeb53-c70fc8a7.js} +2 -2
  50. package/dist/index-db48e0b6.cjs +42 -0
  51. package/dist/index-f8317a8e.js +7638 -0
  52. package/dist/{index.es-9cc0eb3c-e6c5dd2d.js → index.es-b16d0cf5-386496a9.js} +1 -1
  53. package/dist/{index.es-9cc0eb3c-2e0f7d11.cjs → index.es-b16d0cf5-d7f30c4a.cjs} +1 -1
  54. package/dist/{info-icon_2.entry-c3468951.cjs → info-icon_2.entry-63914227.cjs} +1 -1
  55. package/dist/{info-icon_2.entry-d0270899.js → info-icon_2.entry-97d75550.js} +5 -5
  56. package/dist/input-dropdown.entry-4d29246a.js +132 -0
  57. package/dist/input-dropdown.entry-629d7b54.cjs +1 -0
  58. package/dist/loading-icon.entry-2f15a09f.cjs +1 -0
  59. package/dist/loading-icon.entry-fc9bc740.js +15 -0
  60. package/dist/{mailbox-store-64b4ef7c-c609ac6d.cjs → mailbox-store-f11de360-02a6de93.cjs} +1 -1
  61. package/dist/{mailbox-store-64b4ef7c-7c793d9a.js → mailbox-store-f11de360-d781fd36.js} +2 -2
  62. package/dist/{multi-select-dropdown.entry-f298ca2c.cjs → multi-select-dropdown.entry-68fcca98.cjs} +1 -1
  63. package/dist/{multi-select-dropdown.entry-2ca73c71.js → multi-select-dropdown.entry-8e14e9af.js} +2 -2
  64. package/dist/nylas-booked-event-card_10.entry-4da23b61.cjs +1 -0
  65. package/dist/{nylas-booked-event-card_10.entry-2b01df7e.js → nylas-booked-event-card_10.entry-9487941d.js} +357 -316
  66. package/dist/{nylas-custom-booking-flow.entry-66beff43.js → nylas-custom-booking-flow.entry-0e16973b.js} +32 -32
  67. package/dist/{nylas-custom-booking-flow.entry-05b9522a.cjs → nylas-custom-booking-flow.entry-338b0a8f.cjs} +1 -1
  68. package/dist/nylas-form-card.entry-ca669dea.cjs +1 -0
  69. package/dist/{nylas-form-card.entry-3de9f477.js → nylas-form-card.entry-ccfa5692.js} +10 -10
  70. package/dist/{nylas-if-state.entry-a0689083.js → nylas-if-state.entry-93935670.js} +2 -2
  71. package/dist/{nylas-if-state.entry-a734df46.cjs → nylas-if-state.entry-faa11bb6.cjs} +1 -1
  72. package/dist/{nylas-list-folders.entry-4fb9d4c2.js → nylas-list-folders.entry-14fc1fe8.js} +4 -4
  73. package/dist/{nylas-list-folders.entry-74a56187.cjs → nylas-list-folders.entry-e7e179ea.cjs} +1 -1
  74. package/dist/{nylas-list-threads.entry-9a6d4c33.js → nylas-list-threads.entry-2118b146.js} +3 -3
  75. package/dist/{nylas-list-threads.entry-0addc621.cjs → nylas-list-threads.entry-3f52fc06.cjs} +1 -1
  76. package/dist/{nylas-login.entry-beb6e0d9.js → nylas-login.entry-87a902d6.js} +7 -7
  77. package/dist/{nylas-login.entry-bdac29c0.cjs → nylas-login.entry-915f0284.cjs} +1 -1
  78. package/dist/{nylas-mailbox-pagination.entry-c5d07bbe.cjs → nylas-mailbox-pagination.entry-9aa8a606.cjs} +1 -1
  79. package/dist/{nylas-mailbox-pagination.entry-1d71850a.js → nylas-mailbox-pagination.entry-eedbf796.js} +2 -2
  80. package/dist/{nylas-mailbox-toolbar-button.entry-882c97a0.js → nylas-mailbox-toolbar-button.entry-40b75810.js} +2 -2
  81. package/dist/{nylas-mailbox-toolbar-button.entry-7d9d6293.cjs → nylas-mailbox-toolbar-button.entry-ba5b826e.cjs} +1 -1
  82. package/dist/{nylas-mailbox.entry-d810adba.js → nylas-mailbox.entry-179e5a5c.js} +3 -3
  83. package/dist/{nylas-mailbox.entry-94eb97ec.cjs → nylas-mailbox.entry-31de7f8f.cjs} +1 -1
  84. package/dist/{nylas-provider.entry-5a4bb86e.cjs → nylas-provider.entry-46fe01b6.cjs} +1 -1
  85. package/dist/{nylas-provider.entry-fcaf9e1c.js → nylas-provider.entry-7b70bbdc.js} +36 -36
  86. package/dist/{nylas-scheduler-editor.entry-30597812.cjs → nylas-scheduler-editor.entry-76b68f66.cjs} +2 -2
  87. package/dist/{nylas-scheduler-editor.entry-1ca566d3.js → nylas-scheduler-editor.entry-f1f80de1.js} +7 -10
  88. package/dist/{nylas-scheduling.entry-aefefe3d.js → nylas-scheduling.entry-31d13205.js} +83 -70
  89. package/dist/nylas-scheduling.entry-3ce8c52f.cjs +1 -0
  90. package/dist/{nylas-threads-refresh.entry-a85222e2.js → nylas-threads-refresh.entry-a3ea46aa.js} +2 -2
  91. package/dist/{nylas-threads-refresh.entry-f3b9fdf2.cjs → nylas-threads-refresh.entry-c9f9db8c.cjs} +1 -1
  92. package/dist/{nylas-threads-search.entry-b1bf455b.js → nylas-threads-search.entry-01482ddf.js} +8 -8
  93. package/dist/{nylas-threads-search.entry-2c8ac7dc.cjs → nylas-threads-search.entry-a4ab0d47.cjs} +1 -1
  94. package/dist/{nylas-time-window-picker.entry-3a34b29b.cjs → nylas-time-window-picker.entry-5a3bb0b7.cjs} +1 -1
  95. package/dist/{nylas-time-window-picker.entry-6d664a05.js → nylas-time-window-picker.entry-5f063b2b.js} +18 -18
  96. package/dist/{nylas-view-thread.entry-bf6cab2a.cjs → nylas-view-thread.entry-82e78b82.cjs} +1 -1
  97. package/dist/{nylas-view-thread.entry-ddcb042f.js → nylas-view-thread.entry-cb057b9e.js} +6 -6
  98. package/dist/person-icon.entry-3e30c63c.js +15 -0
  99. package/dist/person-icon.entry-78cdc7f9.cjs +1 -0
  100. package/dist/play-icon_2.entry-4fb1938c.cjs +1 -0
  101. package/dist/play-icon_2.entry-71eaad5c.js +25 -0
  102. package/dist/react.cjs +1 -1
  103. package/dist/react.js +116 -108
  104. package/dist/{refresh-icon.entry-99761cb6.cjs → refresh-icon.entry-3570353d.cjs} +1 -1
  105. package/dist/{refresh-icon.entry-0fdcb7af.js → refresh-icon.entry-db85d14d.js} +4 -4
  106. package/dist/{register-component-a5a9ca5d-ddae10b3.js → register-component-b2a51b20-8a262dcf.js} +1 -1
  107. package/dist/{register-component-a5a9ca5d-4439e573.cjs → register-component-b2a51b20-9a913603.cjs} +1 -1
  108. package/dist/{scheduler-config-store-9ccfba4d-b774bfee.cjs → scheduler-config-store-9ccfba4d-6806e3cb.cjs} +1 -1
  109. package/dist/{scheduler-config-store-9ccfba4d-84025740.js → scheduler-config-store-9ccfba4d-a6745ccc.js} +1 -1
  110. package/dist/{scheduler-store-8a400448-8ab7b63e.js → scheduler-store-db06b30a-1e63b67f.js} +119 -116
  111. package/dist/scheduler-store-db06b30a-d5e6b6c3.cjs +1 -0
  112. package/dist/{textarea-component.entry-359e4665.cjs → textarea-component.entry-be870b8f.cjs} +1 -1
  113. package/dist/{textarea-component.entry-193d29fd.js → textarea-component.entry-f5f402a1.js} +4 -4
  114. package/dist/time-period-selector.entry-d1a8470b.js +93 -0
  115. package/dist/time-period-selector.entry-fc7d61c6.cjs +1 -0
  116. package/dist/{translate-icon.entry-32ec36de.cjs → translate-icon.entry-3ae0ddae.cjs} +1 -1
  117. package/dist/{translate-icon.entry-22a3e72e.js → translate-icon.entry-b91a0449.js} +2 -2
  118. package/dist/{warning-icon.entry-b8d483e1.cjs → warning-icon.entry-54127f45.cjs} +1 -1
  119. package/dist/{warning-icon.entry-8d9b59c0.js → warning-icon.entry-acdc811b.js} +5 -5
  120. package/package.json +3 -3
  121. package/dist/add-circle-icon_2.entry-5cefae99.js +0 -25
  122. package/dist/add-circle-icon_2.entry-85523420.cjs +0 -1
  123. package/dist/button-component_4.entry-3c508e3b.js +0 -115
  124. package/dist/button-component_4.entry-f8ab53dc.cjs +0 -1
  125. package/dist/calendar-agenda-fill-icon_35.entry-b56841a0.cjs +0 -7
  126. package/dist/clock-icon_2.entry-074eb053.cjs +0 -1
  127. package/dist/clock-icon_2.entry-bc938936.js +0 -25
  128. package/dist/copy-icon_4.entry-f704b2f1.cjs +0 -1
  129. package/dist/document-refresh-icon.entry-ea0e1ab9.cjs +0 -1
  130. package/dist/google-logo-icon_4.entry-8e87cf66.cjs +0 -1
  131. package/dist/google-logo-icon_4.entry-f50de25f.js +0 -598
  132. package/dist/index-53420959-507f0a27.js +0 -5
  133. package/dist/index-53420959-e6c2e510.cjs +0 -1
  134. package/dist/index-a4831dfe.cjs +0 -42
  135. package/dist/index-a68236be.js +0 -5011
  136. package/dist/input-dropdown_2.entry-2485dcc3.cjs +0 -1
  137. package/dist/input-dropdown_2.entry-2cd6cfc7.js +0 -220
  138. package/dist/loading-icon.entry-5ed52afe.cjs +0 -1
  139. package/dist/loading-icon.entry-96d9d1be.js +0 -15
  140. package/dist/nylas-booked-event-card_10.entry-97977ac7.cjs +0 -1
  141. package/dist/nylas-form-card.entry-3e1331c9.cjs +0 -1
  142. package/dist/nylas-scheduling.entry-00c418c8.cjs +0 -1
  143. package/dist/play-icon_2.entry-4f316c3d.cjs +0 -1
  144. package/dist/play-icon_2.entry-d55a018a.js +0 -25
  145. package/dist/scheduler-store-8a400448-eaa566fa.cjs +0 -1
@@ -1,9 +1,10 @@
1
- import { r as T, c as b, d as w, k as v, l as L, h as i, H as p, g as N, F as C } from "./index-a68236be.js";
2
- import { n as k, N as R } from "./index.es-9cc0eb3c-e6c5dd2d.js";
3
- import { E as x, C as A, N as F } from "./scheduler-store-8a400448-8ab7b63e.js";
1
+ import { k as h, r as L, c as k, d as _, l as x, m as A, n as N, h as i, H as b, g as S, F as E } from "./index-f8317a8e.js";
2
+ import { n as I, N as R } from "./index.es-b16d0cf5-386496a9.js";
3
+ import { E as C, C as F, N as P } from "./scheduler-store-db06b30a-1e63b67f.js";
4
+ import { L as O } from "./constants-67de2eec-b17f5b96.js";
4
5
  import "react";
5
6
  import "react-dom";
6
- class P {
7
+ class j {
7
8
  constructor({ schedulerAPIURL: e, nylasSchedulerStore: a, sessionId: n, configId: s }) {
8
9
  if (!e)
9
10
  throw new Error("schedulerAPIURL is required");
@@ -14,13 +15,13 @@ class P {
14
15
  e === "/" && (e = new URL(window.location.href).origin), this.configId = s, this.sessionId = n, this.schedulerAPIURL = e, this.nylasSchedulerStore = a;
15
16
  }
16
17
  init() {
17
- w("NylasConnector init");
18
+ _("NylasConnector init");
18
19
  }
19
20
  get schedulerStore() {
20
21
  return this.nylasSchedulerStore;
21
22
  }
22
23
  get scheduler() {
23
- return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new F({
24
+ return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new P({
24
25
  schedulerAPIURL: this.schedulerAPIURL,
25
26
  schedulerStore: this.schedulerStore,
26
27
  sessionId: this.sessionId,
@@ -31,10 +32,10 @@ class P {
31
32
  this.nylasSchedulerStore.reset();
32
33
  }
33
34
  }
34
- const y = (t, e) => {
35
+ const w = (t, e) => {
35
36
  const a = t.isLoading, n = t.showNotification, s = t.nylasBranding;
36
37
  return i(
37
- C,
38
+ E,
38
39
  null,
39
40
  n && i("nylas-notification", null),
40
41
  a && i(
@@ -57,40 +58,40 @@ const y = (t, e) => {
57
58
  ),
58
59
  !a && e,
59
60
  i("div", { class: "footer" }, s && i(
60
- C,
61
+ E,
61
62
  null,
62
63
  "Powered by ",
63
64
  i("nylas-logo", null)
64
65
  ))
65
66
  );
66
- }, E = (t, e) => i("div", { class: "message-banner" }, e), S = ':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:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer 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;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}', O = S, D = { title: "Something went wrong...", type: k.Error, category: x.Component }, j = class {
67
+ }, D = (t, e) => i("div", { class: "message-banner" }, e), H = ':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:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{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:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer 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;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}', M = H, B = { title: h.t("genericErrorTitle"), type: I.Error, category: C.Component }, U = class {
67
68
  constructor(t) {
68
- T(this, t), this.init = b(this, "init", 7), this.schedulerWillLoad = b(this, "schedulerWillLoad", 7), this.schedulerDidLoad = b(this, "schedulerDidLoad", 7), this.nylasSchedulerError = b(this, "nylasSchedulerError", 7), this.bookingRefExtracted = b(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 = (/* @__PURE__ */ new Date()).toLocaleDateString(void 0, { dateStyle: "full" }) || "No date selected", this.refConfigId = void 0;
69
+ L(this, t), this.init = k(this, "init", 7), this.schedulerWillLoad = k(this, "schedulerWillLoad", 7), this.schedulerDidLoad = k(this, "schedulerDidLoad", 7), this.nylasSchedulerError = k(this, "nylasSchedulerError", 7), this.bookingRefExtracted = k(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 = (/* @__PURE__ */ new Date()).toLocaleDateString(void 0, { dateStyle: "full" }) || `${h.t("noDateSelected")}`, this.refConfigId = void 0, this.language = navigator.language;
69
70
  }
70
71
  connectedCallback() {
71
- w("[nylas-scheduler] connectedCallback");
72
+ _("[nylas-scheduler] connectedCallback");
72
73
  }
73
74
  async componentWillLoad() {
74
75
  var a, n;
75
- if (w("[nylas-scheduler] Component will load"), this.schedulerWillLoad.emit(this.host).defaultPrevented)
76
+ if (_("[nylas-scheduler] Component will load"), this.schedulerWillLoad.emit(this.host).defaultPrevented)
76
77
  return;
77
78
  if (this.stores = {
78
- scheduler: A({
79
+ scheduler: F({
79
80
  bookingInfo: this.bookingInfo,
80
81
  nylasBranding: this.nylasBranding,
81
82
  ...this.defaultSchedulerState
82
83
  })
83
84
  }, this.baseProvider = new R(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.refConfigId = this.configurationId, this.rescheduleBookingRef) {
84
- const [s, o] = v(this.rescheduleBookingRef);
85
+ const [s, o] = x(this.rescheduleBookingRef);
85
86
  this.refConfigId = s, this.stores.scheduler.set("rescheduleBookingId", o), this.bookingRefExtracted.emit({ configurationId: s, bookingId: o });
86
87
  } else if (this.cancelBookingRef) {
87
- const [s, o] = v(this.cancelBookingRef);
88
+ const [s, o] = x(this.cancelBookingRef);
88
89
  this.refConfigId = s, this.stores.scheduler.set("cancelBookingId", o), this.bookingRefExtracted.emit({ configurationId: s, bookingId: o });
89
90
  }
90
91
  if (!this.checkIfSessionIdOrConfigIdExists())
91
92
  return;
92
93
  const e = (a = this.baseProvider) == null ? void 0 : a.getStore("scheduler");
93
- if (this.nylasSchedulerConnector = new P({
94
+ if (this.nylasSchedulerConnector = new j({
94
95
  schedulerAPIURL: this.schedulerApiUrl,
95
96
  sessionId: this.sessionId,
96
97
  configId: this.refConfigId,
@@ -100,12 +101,12 @@ const y = (t, e) => {
100
101
  this.host.style.setProperty(`${s}`, o);
101
102
  }
102
103
  async componentDidLoad() {
103
- var d, l, h, g, c, I, _;
104
+ var d, l, u, f, g, y, p;
104
105
  if ((d = this.baseProvider) == null || d.componentDidLoad(), !this.checkIfSessionIdOrConfigIdExists())
105
106
  return;
106
107
  const t = await ((l = this.nylasSchedulerConnector) == null ? void 0 : l.scheduler.getUISettings());
107
- (!t || "error" in t) && this.nylasSchedulerError.emit({ ...this.getErrorObject(t == null ? void 0 : t.error) });
108
- const e = (h = this.baseProvider) == null ? void 0 : h.getStore("scheduler"), a = (c = (g = e == null ? void 0 : e.get("configSettings")) == null ? void 0 : g.scheduler) == null ? void 0 : c.available_days_in_future, n = e == null ? void 0 : e.get("selectedTimeslot");
108
+ (!t || "error" in t) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t == null ? void 0 : t.error) }, host: this.host });
109
+ const e = (u = this.baseProvider) == null ? void 0 : u.getStore("scheduler"), a = (g = (f = e == null ? void 0 : e.get("configSettings")) == null ? void 0 : f.scheduler) == null ? void 0 : g.available_days_in_future, n = e == null ? void 0 : e.get("selectedTimeslot");
109
110
  if (n && (n != null && n.start_time)) {
110
111
  if (!this.isTimeslotValid(n))
111
112
  return;
@@ -118,16 +119,16 @@ const y = (t, e) => {
118
119
  let r;
119
120
  if (!(o && o.length > 0)) {
120
121
  if (s) {
121
- const { startTime: u, endTime: f, endTimeForAvailableDaysInFuture: m } = this.validateAvailableDaysInFuture(s, a || 30);
122
- s.getTime() < m * 1e3 && (r = await ((_ = this.nylasSchedulerConnector) == null ? void 0 : _.scheduler.getAvailability(u, f)));
122
+ const { startTime: c, endTime: m, endTimeForAvailableDaysInFuture: v } = this.validateAvailableDaysInFuture(s, a || 30);
123
+ s.getTime() < v * 1e3 && (r = await ((p = this.nylasSchedulerConnector) == null ? void 0 : p.scheduler.getAvailability(c, m)));
123
124
  } else {
124
- const u = /* @__PURE__ */ new Date(), { startTime: f, endTime: m, endTimeForAvailableDaysInFuture: B } = this.validateAvailableDaysInFuture(u, a || 30);
125
- u.getTime() < B * 1e3 && (r = await ((I = this.nylasSchedulerConnector) == null ? void 0 : I.scheduler.getAvailability(f, m)));
125
+ const c = /* @__PURE__ */ new Date(), { startTime: m, endTime: v, endTimeForAvailableDaysInFuture: T } = this.validateAvailableDaysInFuture(c, a || 30);
126
+ c.getTime() < T * 1e3 && (r = await ((y = this.nylasSchedulerConnector) == null ? void 0 : y.scheduler.getAvailability(m, v)));
126
127
  }
127
- if ((!r || "error" in r) && this.nylasSchedulerError.emit({ ...this.getErrorObject(r == null ? void 0 : r.error) }), !s) {
128
- let u = /* @__PURE__ */ new Date();
129
- const f = e == null ? void 0 : e.get("availability").find((m) => new Date(m.start_time) > /* @__PURE__ */ new Date());
130
- f && (u = f.start_time), e == null || e.set("selectedDate", u);
128
+ if ((!r || "error" in r) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(r == null ? void 0 : r.error) }, host: this.host }), !s) {
129
+ let c = /* @__PURE__ */ new Date();
130
+ const m = e == null ? void 0 : e.get("availability").find((v) => new Date(v.start_time) > /* @__PURE__ */ new Date());
131
+ m && (c = m.start_time), e == null || e.set("selectedDate", c);
131
132
  }
132
133
  }
133
134
  }
@@ -142,17 +143,21 @@ const y = (t, e) => {
142
143
  rescheduleBookingRefChanged(t) {
143
144
  var e, a;
144
145
  if (t) {
145
- const [n, s] = v(t);
146
+ const [n, s] = x(t);
146
147
  (e = this.stores) == null || e.scheduler.set("rescheduleBookingId", s), this.refConfigId = n, (a = this.nylasSchedulerConnector) == null || a.scheduler.setConfigId(n);
147
148
  }
148
149
  }
149
150
  cancelBookingRefChanged(t) {
150
151
  var e, a;
151
152
  if (t) {
152
- const [n, s] = v(t);
153
+ const [n, s] = x(t);
153
154
  (e = this.stores) == null || e.scheduler.set("cancelBookingId", s), this.refConfigId = n, (a = this.nylasSchedulerConnector) == null || a.scheduler.setConfigId(n);
154
155
  }
155
156
  }
157
+ languageChanged(t) {
158
+ const e = t.detail;
159
+ this.language = e, h.changeLanguage(e);
160
+ }
156
161
  async registerComponentHandler(t) {
157
162
  var e;
158
163
  (e = this.baseProvider) == null || e.registerComponent(t.detail);
@@ -162,11 +167,13 @@ const y = (t, e) => {
162
167
  (e = this.baseProvider) == null || e.unregisterComponent(t.detail);
163
168
  }
164
169
  async monthChangedHandler(t) {
165
- var r, d, l, h, g;
166
- const e = t.detail, a = (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: n, endTime: s, endTimeForAvailableDaysInFuture: o } = this.validateAvailableDaysInFuture(e, a || 30);
170
+ var r, d, l, u, f, g, y;
171
+ const e = t.detail, a = (u = (l = (d = (r = this.nylasSchedulerConnector) == null ? void 0 : r.schedulerStore) == null ? void 0 : d.get("configSettings")) == null ? void 0 : l.scheduler) == null ? void 0 : u.available_days_in_future, { startTime: n, endTime: s, endTimeForAvailableDaysInFuture: o } = this.validateAvailableDaysInFuture(e, a || 30);
167
172
  if (n < o && e.getTime() < o * 1e3) {
168
- const c = await ((g = this.nylasSchedulerConnector) == null ? void 0 : g.scheduler.getAvailability(n, s));
169
- (!c || "error" in c) && this.nylasSchedulerError.emit({ ...this.getErrorObject(c == null ? void 0 : c.error) });
173
+ const p = await ((f = this.nylasSchedulerConnector) == null ? void 0 : f.scheduler.getAvailability(n, s));
174
+ (!p || "error" in p) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(p == null ? void 0 : p.error) }, host: this.host });
175
+ const c = (g = this.stores) == null ? void 0 : g.scheduler.get("selectableDates");
176
+ c && c.length > 0 && ((y = this.stores) == null || y.scheduler.set("selectedDate", c[0]));
170
177
  }
171
178
  }
172
179
  async bookButtonClickedHandler(t) {
@@ -174,24 +181,24 @@ const y = (t, e) => {
174
181
  const a = (o = (s = this.nylasSchedulerConnector) == null ? void 0 : s.schedulerStore) == null ? void 0 : o.get("rescheduleBookingId");
175
182
  if (a) {
176
183
  const l = await ((r = this.nylasSchedulerConnector) == null ? void 0 : r.scheduler.rescheduleBooking(a, t.detail));
177
- (!l || "error" in l) && this.nylasSchedulerError.emit({ ...this.getErrorObject(l == null ? void 0 : l.error) });
184
+ (!l || "error" in l) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(l == null ? void 0 : l.error) }, host: this.host });
178
185
  return;
179
186
  }
180
187
  const n = await ((d = this.nylasSchedulerConnector) == null ? void 0 : d.scheduler.bookTimeslot(t.detail));
181
- (!n || "error" in n) && this.nylasSchedulerError.emit({ ...this.getErrorObject(n == null ? void 0 : n.error) });
188
+ (!n || "error" in n) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(n == null ? void 0 : n.error) }, host: this.host });
182
189
  }
183
190
  dateSelectedHandler(t) {
184
191
  const e = t.detail;
185
- this.selectedDateLabel = e ? e.toLocaleDateString(void 0, { dateStyle: "full" }) : "No date selected";
192
+ this.selectedDateLabel = e ? e.toLocaleDateString(void 0, { dateStyle: "full" }) : `${h.t("noDateSelected")}`;
186
193
  }
187
194
  cancelBookedEventErrorHandler(t) {
188
- this.nylasSchedulerError.emit({ ...this.getErrorObject(t.detail.error) });
195
+ this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
189
196
  }
190
197
  cancelBookedEventValidationErrorHandler(t) {
191
- this.nylasSchedulerError.emit({ ...this.getErrorObject(t.detail.error) });
198
+ this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
192
199
  }
193
200
  rescheduleBookedEventErrorHandler(t) {
194
- this.nylasSchedulerError.emit({ ...this.getErrorObject(t.detail.error) });
201
+ this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
195
202
  }
196
203
  async getNylasSchedulerStore() {
197
204
  var t;
@@ -205,9 +212,9 @@ const y = (t, e) => {
205
212
  }
206
213
  getErrorObject(t) {
207
214
  return {
208
- title: (t == null ? void 0 : t.title) || D.title,
209
- category: (t == null ? void 0 : t.category) || D.category,
210
- type: k.Error,
215
+ title: (t == null ? void 0 : t.title) || B.title,
216
+ category: (t == null ? void 0 : t.category) || B.category,
217
+ type: I.Error,
211
218
  description: (t == null ? void 0 : t.message) || "",
212
219
  id: (/* @__PURE__ */ new Date()).getTime().toString(),
213
220
  ttl: "none"
@@ -215,49 +222,55 @@ const y = (t, e) => {
215
222
  }
216
223
  checkIfSessionIdOrConfigIdExists() {
217
224
  return !this.sessionId && !this.refConfigId ? (this.nylasSchedulerError.emit({
218
- title: "No sessionId!",
219
- category: x.Component,
220
- type: k.Error,
221
- description: "Session ID is required",
222
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
223
- ttl: "none"
225
+ notification: {
226
+ title: h.t("noSessionIdErrorTitle"),
227
+ category: C.Component,
228
+ type: I.Error,
229
+ description: h.t("noSessionIdErrorMessage"),
230
+ id: (/* @__PURE__ */ new Date()).getTime().toString(),
231
+ ttl: "none"
232
+ },
233
+ host: this.host
224
234
  }), !1) : !0;
225
235
  }
226
236
  isTimeslotValid(t) {
227
237
  return new Date(t.start_time) < /* @__PURE__ */ new Date() ? (this.nylasSchedulerError.emit({
228
- title: "Invalid tiemslot!",
229
- category: x.Component,
230
- type: k.Error,
231
- description: "The selected timeslot is invalid.",
232
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
233
- ttl: "none"
238
+ notification: {
239
+ title: h.t("invalidTimeslotErrorTitle"),
240
+ category: C.Component,
241
+ type: I.Error,
242
+ description: h.t("invalidTimeslotErrorMessage"),
243
+ id: (/* @__PURE__ */ new Date()).getTime().toString(),
244
+ ttl: "none"
245
+ },
246
+ host: this.host
234
247
  }), !1) : !0;
235
248
  }
236
249
  validateAvailableDaysInFuture(t, e) {
237
- const a = /* @__PURE__ */ new Date(), n = new Date(t.getFullYear(), t.getMonth(), 1).getTime() / 1e3, s = new Date(t.getFullYear(), t.getMonth() + 1, 1).getTime() / 1e3, o = Math.floor(L(a, e).getTime() / 1e3), r = Math.min(o, s);
250
+ const a = /* @__PURE__ */ new Date(), n = new Date(t.getFullYear(), t.getMonth(), 1).getTime() / 1e3, s = new Date(t.getFullYear(), t.getMonth() + 1, 1).getTime() / 1e3, o = Math.floor(A(a, e).getTime() / 1e3), r = Math.min(o, s);
238
251
  return { startTime: n < a.getTime() / 1e3 ? Math.floor(a.getTime() / 1e3) : n, endTime: r, endTimeForAvailableDaysInFuture: o };
239
252
  }
240
253
  render() {
241
- var g;
242
- const t = this.mode === "app", e = (g = this.baseProvider) == null ? void 0 : g.getStore("scheduler"), a = e == null ? void 0 : e.get("eventInfo"), n = e == null ? void 0 : e.get("showBookingForm"), s = e == null ? void 0 : e.get("cancelledEventInfo"), o = 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");
243
- if (this.selectedDateLabel = h ? h.toLocaleDateString(void 0, { dateStyle: "full" }) : "No date selected", t && o && !s)
244
- return i(p, null, i(y, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, i("div", { class: "cancel-flow-page", part: "cancel-flow-page" }, i("nylas-cancel-booking-form", { selectedTimeslot: r, cancelBookingId: o, exportparts: "ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label" }))));
254
+ var f;
255
+ const t = this.mode === "app", e = (f = this.baseProvider) == null ? void 0 : f.getStore("scheduler"), a = e == null ? void 0 : e.get("eventInfo"), n = e == null ? void 0 : e.get("showBookingForm"), s = e == null ? void 0 : e.get("cancelledEventInfo"), o = 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, u = e == null ? void 0 : e.get("selectedDate");
256
+ if (this.selectedDateLabel = u && this.language ? N(u.toLocaleDateString(O[this.language], { dateStyle: "full" })) : `${h.t("noDateSelected")}`, t && o && !s)
257
+ return i(b, null, i(w, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, i("div", { class: "cancel-flow-page", part: "cancel-flow-page" }, i("nylas-cancel-booking-form", { selectedTimeslot: r, cancelBookingId: o, exportparts: "ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label" }))));
245
258
  if (t && s)
246
- return i(p, null, i(y, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, i("div", { class: "cancelled-event-page", part: "cancelled-event-page" }, i("nylas-cancelled-event-card", { cancelledEventInfo: s, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))));
259
+ return i(b, null, i(w, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, i("div", { class: "cancelled-event-page", part: "cancelled-event-page" }, i("nylas-cancelled-event-card", { cancelledEventInfo: s, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))));
247
260
  if (t && a)
248
- return i(p, null, i(y, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, i("div", { class: "booked-event-page", part: "booked-event-page" }, i("nylas-booked-event-card", { selectedTimeslot: r, eventInfo: a, exportparts: "nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta" }))));
261
+ return i(b, null, i(w, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, i("div", { class: "booked-event-page", part: "booked-event-page" }, i("nylas-booked-event-card", { selectedTimeslot: r, eventInfo: a, exportparts: "nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta" }))));
249
262
  if (t && (!a || d) && !n) {
250
- const c = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
251
- return i(p, null, i(y, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, d && i(E, null, "Choose another time slot to reschedule your meeting"), i("div", { class: "select-date-page", part: "select-date-page" }, i("div", { class: "left-panel" }, i("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" }), i("nylas-locale-switch", null)), i("div", { class: "right-panel" }, i("h2", null, i("calendar-icon", null), i("span", { id: "selectedDate" }, this.selectedDateLabel)), i("nylas-timeslot-picker", { exportparts: "ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary" }, c && i("span", { slot: "timeslot-picker-cta-label" }, i("slot", { name: "timeslot-picker-cta-label" })))))));
263
+ const g = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
264
+ return i(b, null, i(w, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, d && i(D, null, `${h.t("rescheduleTitle")}`), i("div", { class: "select-date-page", part: "select-date-page" }, i("div", { class: "left-panel" }, i("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" }), i("nylas-locale-switch", null)), i("div", { class: "right-panel" }, i("h2", null, i("calendar-icon", null), i("span", { id: "selectedDate" }, this.selectedDateLabel)), i("nylas-timeslot-picker", { exportparts: "ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary" }, g && i("span", { slot: "timeslot-picker-cta-label" }, i("slot", { name: "timeslot-picker-cta-label" })))))));
252
265
  }
253
266
  if (t && !a && n) {
254
- const c = this.host.querySelector('[slot="custom-booking-form"]');
255
- return i(p, null, i(y, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, d && i(E, null, "Choose another time slot to reschedule your meeting"), i("div", { class: "additional-data-page", part: "additional-data-page" }, i("div", { class: "left-panel" }, i("div", { class: "wrapper" }, i("nylas-selected-event-card", { exportparts: "nsec, nsec__card, nsec__icon, nsec__date, nsec__time" }))), i("div", { class: "right-panel" }, i("nylas-booking-form", { exportparts: "nbf, nbf__input-label, nbf__input-textfield, nbf__button-ghost, nbf__button-primary, nbf__button-outline" }, c && i("div", { slot: "custom-booking-form" }, i("slot", { name: "custom-booking-form" })))))));
267
+ const g = this.host.querySelector('[slot="custom-booking-form"]');
268
+ return i(b, null, i(w, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, d && i(D, null, `${h.t("rescheduleTitle")}`), i("div", { class: "additional-data-page", part: "additional-data-page" }, i("div", { class: "left-panel" }, i("div", { class: "wrapper" }, i("nylas-selected-event-card", { exportparts: "nsec, nsec__card, nsec__icon, nsec__date, nsec__time" }))), i("div", { class: "right-panel" }, i("nylas-booking-form", { exportparts: "nbf, nbf__input-label, nbf__input-textfield, nbf__button-ghost, nbf__button-primary, nbf__button-outline" }, g && i("div", { slot: "custom-booking-form" }, i("slot", { name: "custom-booking-form" })))))));
256
269
  }
257
- return i(p, null, i("slot", null));
270
+ return i(b, null, i("slot", null));
258
271
  }
259
272
  get host() {
260
- return N(this);
273
+ return S(this);
261
274
  }
262
275
  static get watchers() {
263
276
  return {
@@ -267,7 +280,7 @@ const y = (t, e) => {
267
280
  };
268
281
  }
269
282
  };
270
- j.style = O;
283
+ U.style = M;
271
284
  export {
272
- j as nylas_scheduling
285
+ U as nylas_scheduling
273
286
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-db48e0b6.cjs"),v=require("./index.es-b16d0cf5-d7f30c4a.cjs"),k=require("./scheduler-store-db06b30a-d5e6b6c3.cjs"),C=require("./constants-67de2eec-e3b50fc6.cjs");require("react");require("react-dom");class E{constructor({schedulerAPIURL:t,nylasSchedulerStore:a,sessionId:i,configId:s}){if(!t)throw new Error("schedulerAPIURL is required");if(!a)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");t==="/"&&(t=new URL(window.location.href).origin),this.configId=s,this.sessionId=i,this.schedulerAPIURL=t,this.nylasSchedulerStore=a}init(){e.debug("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new k.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId}),this._schedulerAPIConnector)}resetStores(){this.nylasSchedulerStore.reset()}}const y=(n,t)=>{const a=n.isLoading,i=n.showNotification,s=n.nylasBranding;return e.h(e.Fragment,null,i&&e.h("nylas-notification",null),a&&e.h("div",{class:"loading"},e.h("div",{class:"left"},e.h("div",{class:"skeleton"})),e.h("div",{class:"right"},e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}))),!a&&t,e.h("div",{class:"footer"},s&&e.h(e.Fragment,null,"Powered by ",e.h("nylas-logo",null))))},x=(n,t)=>e.h("div",{class:"message-banner"},t),D=':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:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{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:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer 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;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}',B=D,w={title:e.instance.t("genericErrorTitle"),type:v.nr.Error,category:k.ErrorCategory.Component},I=class{constructor(n){e.registerInstance(this,n),this.init=e.createEvent(this,"init",7),this.schedulerWillLoad=e.createEvent(this,"schedulerWillLoad",7),this.schedulerDidLoad=e.createEvent(this,"schedulerDidLoad",7),this.nylasSchedulerError=e.createEvent(this,"nylasSchedulerError",7),this.bookingRefExtracted=e.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"})||`${e.instance.t("noDateSelected")}`,this.refConfigId=void 0,this.language=navigator.language}connectedCallback(){e.debug("[nylas-scheduler] connectedCallback")}async componentWillLoad(){var a,i;if(e.debug("[nylas-scheduler] Component will load"),this.schedulerWillLoad.emit(this.host).defaultPrevented)return;if(this.stores={scheduler:k.CreateNylasSchedulerStore({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,...this.defaultSchedulerState})},this.baseProvider=new v.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.refConfigId=this.configurationId,this.rescheduleBookingRef){const[s,o]=e.compactStringToUUIDs(this.rescheduleBookingRef);this.refConfigId=s,this.stores.scheduler.set("rescheduleBookingId",o),this.bookingRefExtracted.emit({configurationId:s,bookingId:o})}else if(this.cancelBookingRef){const[s,o]=e.compactStringToUUIDs(this.cancelBookingRef);this.refConfigId=s,this.stores.scheduler.set("cancelBookingId",o),this.bookingRefExtracted.emit({configurationId:s,bookingId:o})}if(!this.checkIfSessionIdOrConfigIdExists())return;const t=(a=this.baseProvider)==null?void 0:a.getStore("scheduler");if(this.nylasSchedulerConnector=new E({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,nylasSchedulerStore:t}),this.init.emit(this.host),(i=this.baseProvider)==null||i.componentWillLoad(this.nylasSchedulerConnector),this.themeConfig)for(const[s,o]of Object.entries(this.themeConfig))this.host.style.setProperty(`${s}`,o)}async componentDidLoad(){var d,l,g,u,h,b,f;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({notification:{...this.getErrorObject(n==null?void 0:n.error)},host:this.host});const t=(g=this.baseProvider)==null?void 0:g.getStore("scheduler"),a=(h=(u=t==null?void 0:t.get("configSettings"))==null?void 0:u.scheduler)==null?void 0:h.available_days_in_future,i=t==null?void 0:t.get("selectedTimeslot");if(i&&(i!=null&&i.start_time)){if(!this.isTimeslotValid(i))return;if(t!=null&&t.get("showBookingForm")){t==null||t.set("selectedDate",i.start_time);return}}const s=t==null?void 0:t.get("selectedDate"),o=t==null?void 0:t.get("availability");let r;if(!(o&&o.length>0)){if(s){const{startTime:c,endTime:p,endTimeForAvailableDaysInFuture:m}=this.validateAvailableDaysInFuture(s,a||30);s.getTime()<m*1e3&&(r=await((f=this.nylasSchedulerConnector)==null?void 0:f.scheduler.getAvailability(c,p)))}else{const c=new Date,{startTime:p,endTime:m,endTimeForAvailableDaysInFuture:_}=this.validateAvailableDaysInFuture(c,a||30);c.getTime()<_*1e3&&(r=await((b=this.nylasSchedulerConnector)==null?void 0:b.scheduler.getAvailability(p,m)))}if((!r||"error"in r)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r==null?void 0:r.error)},host:this.host}),!s){let c=new Date;const p=t==null?void 0:t.get("availability").find(m=>new Date(m.start_time)>new Date);p&&(c=p.start_time),t==null||t.set("selectedDate",c)}}}componentDisconnected(){var n;(n=this.baseProvider)==null||n.componentDisconnected()}bookingInfoChanged(n){var t;(t=this.stores)==null||t.scheduler.set("bookingInfo",n)}rescheduleBookingRefChanged(n){var t,a;if(n){const[i,s]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("rescheduleBookingId",s),this.refConfigId=i,(a=this.nylasSchedulerConnector)==null||a.scheduler.setConfigId(i)}}cancelBookingRefChanged(n){var t,a;if(n){const[i,s]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("cancelBookingId",s),this.refConfigId=i,(a=this.nylasSchedulerConnector)==null||a.scheduler.setConfigId(i)}}languageChanged(n){const t=n.detail;this.language=t,e.instance.changeLanguage(t)}async registerComponentHandler(n){var t;(t=this.baseProvider)==null||t.registerComponent(n.detail)}async unregisterComponentHandler(n){var t;(t=this.baseProvider)==null||t.unregisterComponent(n.detail)}async monthChangedHandler(n){var r,d,l,g,u,h,b;const t=n.detail,a=(g=(l=(d=(r=this.nylasSchedulerConnector)==null?void 0:r.schedulerStore)==null?void 0:d.get("configSettings"))==null?void 0:l.scheduler)==null?void 0:g.available_days_in_future,{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,a||30);if(i<o&&t.getTime()<o*1e3){const f=await((u=this.nylasSchedulerConnector)==null?void 0:u.scheduler.getAvailability(i,s));(!f||"error"in f)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(f==null?void 0:f.error)},host:this.host});const c=(h=this.stores)==null?void 0:h.scheduler.get("selectableDates");c&&c.length>0&&((b=this.stores)==null||b.scheduler.set("selectedDate",c[0]))}}async bookButtonClickedHandler(n){var s,o,r,d;const a=(o=(s=this.nylasSchedulerConnector)==null?void 0:s.schedulerStore)==null?void 0:o.get("rescheduleBookingId");if(a){const l=await((r=this.nylasSchedulerConnector)==null?void 0:r.scheduler.rescheduleBooking(a,n.detail));(!l||"error"in l)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(l==null?void 0:l.error)},host:this.host});return}const i=await((d=this.nylasSchedulerConnector)==null?void 0:d.scheduler.bookTimeslot(n.detail));(!i||"error"in i)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(i==null?void 0:i.error)},host:this.host})}dateSelectedHandler(n){const t=n.detail;this.selectedDateLabel=t?t.toLocaleDateString(void 0,{dateStyle:"full"}):`${e.instance.t("noDateSelected")}`}cancelBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}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)||w.title,category:(n==null?void 0:n.category)||w.category,type:v.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({notification:{title:e.instance.t("noSessionIdErrorTitle"),category:k.ErrorCategory.Component,type:v.nr.Error,description:e.instance.t("noSessionIdErrorMessage"),id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1):!0}isTimeslotValid(n){return new Date(n.start_time)<new Date?(this.nylasSchedulerError.emit({notification:{title:e.instance.t("invalidTimeslotErrorTitle"),category:k.ErrorCategory.Component,type:v.nr.Error,description:e.instance.t("invalidTimeslotErrorMessage"),id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1):!0}validateAvailableDaysInFuture(n,t){const a=new Date,i=new Date(n.getFullYear(),n.getMonth(),1).getTime()/1e3,s=new Date(n.getFullYear(),n.getMonth()+1,1).getTime()/1e3,o=Math.floor(e.addDaysToCurrentDate(a,t).getTime()/1e3),r=Math.min(o,s);return{startTime:i<a.getTime()/1e3?Math.floor(a.getTime()/1e3):i,endTime:r,endTimeForAvailableDaysInFuture:o}}render(){var u;const n=this.mode==="app",t=(u=this.baseProvider)==null?void 0:u.getStore("scheduler"),a=t==null?void 0:t.get("eventInfo"),i=t==null?void 0:t.get("showBookingForm"),s=t==null?void 0:t.get("cancelledEventInfo"),o=t==null?void 0:t.get("cancelBookingId"),r=t==null?void 0:t.get("selectedTimeslot"),d=t==null?void 0:t.get("rescheduleBookingId"),l=(t==null?void 0:t.get("nylasBranding"))||this.nylasBranding,g=t==null?void 0:t.get("selectedDate");if(this.selectedDateLabel=g&&this.language?e.capitalizeFirstLetter(g.toLocaleDateString(C.LANGUAGE_CODE_MAP[this.language],{dateStyle:"full"})):`${e.instance.t("noDateSelected")}`,n&&o&&!s)return e.h(e.Host,null,e.h(y,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e.h("nylas-cancel-booking-form",{selectedTimeslot:r,cancelBookingId:o,exportparts:"ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label"}))));if(n&&s)return e.h(e.Host,null,e.h(y,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e.h("nylas-cancelled-event-card",{cancelledEventInfo:s,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))));if(n&&a)return e.h(e.Host,null,e.h(y,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"booked-event-page",part:"booked-event-page"},e.h("nylas-booked-event-card",{selectedTimeslot:r,eventInfo:a,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))));if(n&&(!a||d)&&!i){const h=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e.h(e.Host,null,e.h(y,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},d&&e.h(x,null,`${e.instance.t("rescheduleTitle")}`),e.h("div",{class:"select-date-page",part:"select-date-page"},e.h("div",{class:"left-panel"},e.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"}),e.h("nylas-locale-switch",null)),e.h("div",{class:"right-panel"},e.h("h2",null,e.h("calendar-icon",null),e.h("span",{id:"selectedDate"},this.selectedDateLabel)),e.h("nylas-timeslot-picker",{exportparts:"ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},h&&e.h("span",{slot:"timeslot-picker-cta-label"},e.h("slot",{name:"timeslot-picker-cta-label"})))))))}if(n&&!a&&i){const h=this.host.querySelector('[slot="custom-booking-form"]');return e.h(e.Host,null,e.h(y,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},d&&e.h(x,null,`${e.instance.t("rescheduleTitle")}`),e.h("div",{class:"additional-data-page",part:"additional-data-page"},e.h("div",{class:"left-panel"},e.h("div",{class:"wrapper"},e.h("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time"}))),e.h("div",{class:"right-panel"},e.h("nylas-booking-form",{exportparts:"nbf, nbf__input-label, nbf__input-textfield, nbf__button-ghost, nbf__button-primary, nbf__button-outline"},h&&e.h("div",{slot:"custom-booking-form"},e.h("slot",{name:"custom-booking-form"})))))))}return e.h(e.Host,null,e.h("slot",null))}get host(){return e.getElement(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"]}}};I.style=B;exports.nylas_scheduling=I;
@@ -1,5 +1,5 @@
1
- import { r as f, c as p, d as i, h as o, H as u } from "./index-a68236be.js";
2
- import { R as m } from "./register-component-a5a9ca5d-ddae10b3.js";
1
+ import { r as f, c as p, d as i, h as o, H as u } from "./index-f8317a8e.js";
2
+ import { R as m } from "./register-component-b2a51b20-8a262dcf.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;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-a4831dfe.cjs"),d=require("./register-component-a5a9ca5d-4439e573.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:"81ae0d8b4628bf87001b99241a1d037a02914de1"},s.h("div",{key:"b1459ff6f96d7f91b409bbb677bf9d70a900f8e5",class:"container",ref:t=>this.containerElement=t},s.h("button",{key:"6a114d596026a427518224311d44af229166082c",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:"44af3075217a91669d7d5ae386cde4b8e3c3349d",class:"content",ref:t=>this.contentElement=t},s.h("slot",{key:"79f6deb55632b74cc0c48ab164512ace49de04c7"}))))}};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-db48e0b6.cjs"),d=require("./register-component-b2a51b20-9a913603.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:"81ae0d8b4628bf87001b99241a1d037a02914de1"},s.h("div",{key:"b1459ff6f96d7f91b409bbb677bf9d70a900f8e5",class:"container",ref:t=>this.containerElement=t},s.h("button",{key:"6a114d596026a427518224311d44af229166082c",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:"44af3075217a91669d7d5ae386cde4b8e3c3349d",class:"content",ref:t=>this.contentElement=t},s.h("slot",{key:"79f6deb55632b74cc0c48ab164512ace49de04c7"}))))}};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,15 +1,15 @@
1
- import { r as u, c as y, d as h, h as i, H as p } from "./index-a68236be.js";
2
- import { R as f } from "./register-component-a5a9ca5d-ddae10b3.js";
1
+ import { r as u, c as y, d as h, h as i, H as p } from "./index-f8317a8e.js";
2
+ import { R as f } from "./register-component-b2a51b20-8a262dcf.js";
3
3
  import "react";
4
4
  import "react-dom";
5
- const m = ":host{display:block}sp-search{width:100%;border:0}", b = m;
5
+ const b = ":host{display:block}sp-search{width:100%;border:0}", m = b;
6
6
  var g = function(t, e, n, r) {
7
- var s = arguments.length, a = s < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, n) : r, c;
7
+ var s = arguments.length, a = s < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, n) : r, o;
8
8
  if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
9
9
  a = Reflect.decorate(t, e, n, r);
10
10
  else
11
- for (var o = t.length - 1; o >= 0; o--)
12
- (c = t[o]) && (a = (s < 3 ? c(a) : s > 3 ? c(e, n, a) : c(e, n)) || a);
11
+ for (var c = t.length - 1; c >= 0; c--)
12
+ (o = t[c]) && (a = (s < 3 ? o(a) : s > 3 ? o(e, n, a) : o(e, n)) || a);
13
13
  return s > 3 && a && Object.defineProperty(e, n, a), a;
14
14
  }, l = function(t, e) {
15
15
  if (typeof Reflect == "object" && typeof Reflect.metadata == "function")
@@ -37,7 +37,7 @@ const d = class {
37
37
  this.internalQuery = this.query;
38
38
  }
39
39
  render() {
40
- return i(p, { key: "0c80c811e61cb8c622fa19320ea93d6f98146ef1" }, i("sp-theme", { key: "e9ee0938779ab3be25c82c07ab275f5e1fa30d9e", scale: "medium", color: "dark" }, i("sp-search", { key: "d031b80043a03c19a4d8af232ec1ae531700cc7c", quiet: !0, onSubmit: this.onSearch, onBlur: this.onSearch, value: this.internalQuery })));
40
+ return i(p, { key: "e5e2b3b56de59d657b5f489e4b9f059a6ce9697d" }, i("sp-theme", { key: "de1f7b0c39e7d8ba1ebf262345fdbb44bbf5014b", scale: "medium", color: "dark" }, i("sp-search", { key: "3a9f8cfcd7796845bad81181252426298eec64da", quiet: !0, onSubmit: this.onSearch, onBlur: this.onSearch, value: this.internalQuery })));
41
41
  }
42
42
  static get watchers() {
43
43
  return {
@@ -63,7 +63,7 @@ g([
63
63
  l("design:paramtypes", []),
64
64
  l("design:returntype", void 0)
65
65
  ], d.prototype, "render", null);
66
- d.style = b;
66
+ d.style = m;
67
67
  export {
68
68
  d as nylas_threads_search
69
69
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-a4831dfe.cjs"),u=require("./register-component-a5a9ca5d-4439e573.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 c=arguments.length,r=c<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,o;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--)(o=t[i])&&(r=(c<3?o(r):c>3?o(e,s,r):o(e,s))||r);return c>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:"0c80c811e61cb8c622fa19320ea93d6f98146ef1"},a.h("sp-theme",{key:"e9ee0938779ab3be25c82c07ab275f5e1fa30d9e",scale:"medium",color:"dark"},a.h("sp-search",{key:"d031b80043a03c19a4d8af232ec1ae531700cc7c",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-db48e0b6.cjs"),h=require("./register-component-b2a51b20-9a913603.cjs");require("react");require("react-dom");const u=":host{display:block}sp-search{width:100%;border:0}",y=u;var f=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:"e5e2b3b56de59d657b5f489e4b9f059a6ce9697d"},a.h("sp-theme",{key:"de1f7b0c39e7d8ba1ebf262345fdbb44bbf5014b",scale:"medium",color:"dark"},a.h("sp-search",{key:"3a9f8cfcd7796845bad81181252426298eec64da",quiet:!0,onSubmit:this.onSearch,onBlur:this.onSearch,value:this.internalQuery})))}static get watchers(){return{query:["onQueryChange"]}}};f([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=y;exports.nylas_threads_search=d;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-a4831dfe.cjs");require("react");require("react-dom");var _={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(r.commonjsGlobal,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},i=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,a=/\d\d/,h=/\d\d?/,x=/\d*[^-_:/,()\s\d]+/,b={},Z=function(s){return(s=+s)+(s>68?1900:2e3)},d=function(s){return function(o){this[s]=+o}},B=[/[+-]\d\d:?(\d\d)?|Z/,function(s){(this.zone||(this.zone={})).offset=function(o){if(!o||o==="Z")return 0;var m=o.match(/([+-]|\d\d)/g),l=60*m[1]+(+m[2]||0);return l===0?0:m[0]==="+"?-l:l}(s)}],F=function(s){var o=b[s];return o&&(o.indexOf?o:o.s.concat(o.f))},V=function(s,o){var m,l=b.meridiem;if(l){for(var p=1;p<=24;p+=1)if(s.indexOf(l(p,0,o))>-1){m=p>12;break}}else m=s===(o?"pm":"PM");return m},q={A:[x,function(s){this.afternoon=V(s,!1)}],a:[x,function(s){this.afternoon=V(s,!0)}],S:[/\d/,function(s){this.milliseconds=100*+s}],SS:[a,function(s){this.milliseconds=10*+s}],SSS:[/\d{3}/,function(s){this.milliseconds=+s}],s:[h,d("seconds")],ss:[h,d("seconds")],m:[h,d("minutes")],mm:[h,d("minutes")],H:[h,d("hours")],h:[h,d("hours")],HH:[h,d("hours")],hh:[h,d("hours")],D:[h,d("day")],DD:[a,d("day")],Do:[x,function(s){var o=b.ordinal,m=s.match(/\d+/);if(this.day=m[0],o)for(var l=1;l<=31;l+=1)o(l).replace(/\[|\]/g,"")===s&&(this.day=l)}],M:[h,d("month")],MM:[a,d("month")],MMM:[x,function(s){var o=F("months"),m=(F("monthsShort")||o.map(function(l){return l.slice(0,3)})).indexOf(s)+1;if(m<1)throw new Error;this.month=m%12||m}],MMMM:[x,function(s){var o=F("months").indexOf(s)+1;if(o<1)throw new Error;this.month=o%12||o}],Y:[/[+-]?\d+/,d("year")],YY:[a,function(s){this.year=Z(s)}],YYYY:[/\d{4}/,d("year")],Z:B,ZZ:B};function N(s){var o,m;o=s,m=b&&b.formats;for(var l=(s=o.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(S,T,f){var c=f&&f.toUpperCase();return T||m[f]||n[f]||m[c].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(w,k,M){return k||M.slice(1)})})).match(i),p=l.length,y=0;y<p;y+=1){var C=l[y],I=q[C],v=I&&I[0],g=I&&I[1];l[y]=g?{regex:v,parser:g}:C.replace(/^\[|\]$/g,"")}return function(S){for(var T={},f=0,c=0;f<p;f+=1){var w=l[f];if(typeof w=="string")c+=w.length;else{var k=w.regex,M=w.parser,L=S.slice(c),A=k.exec(L)[0];M.call(T,A),S=S.replace(A,"")}}return function(D){var u=D.afternoon;if(u!==void 0){var Y=D.hours;u?Y<12&&(D.hours+=12):Y===12&&(D.hours=0),delete D.afternoon}}(T),T}}return function(s,o,m){m.p.customParseFormat=!0,s&&s.parseTwoDigitYear&&(Z=s.parseTwoDigitYear);var l=o.prototype,p=l.parse;l.parse=function(y){var C=y.date,I=y.utc,v=y.args;this.$u=I;var g=v[1];if(typeof g=="string"){var S=v[2]===!0,T=v[3]===!0,f=S||T,c=v[2];T&&(c=v[2]),b=this.$locale(),!S&&c&&(b=m.Ls[c]),this.$d=function(L,A,D){try{if(["x","X"].indexOf(A)>-1)return new Date((A==="X"?1e3:1)*L);var u=N(A)(L),Y=u.year,E=u.month,X=u.day,G=u.hours,J=u.minutes,Q=u.seconds,ee=u.milliseconds,W=u.zone,$=new Date,P=X||(Y||E?1:$.getDate()),z=Y||$.getFullYear(),O=0;Y&&!E||(O=E>0?E-1:$.getMonth());var j=G||0,H=J||0,K=Q||0,R=ee||0;return W?new Date(Date.UTC(z,O,P,j,H,K,R+60*W.offset*1e3)):D?new Date(Date.UTC(z,O,P,j,H,K,R)):new Date(z,O,P,j,H,K,R)}catch{return new Date("")}}(C,g,I),this.init(),c&&c!==!0&&(this.$L=this.locale(c).$L),f&&C!=this.format(g)&&(this.$d=new Date("")),b={}}else if(g instanceof Array)for(var w=g.length,k=1;k<=w;k+=1){v[1]=g[k-1];var M=m.apply(this,v);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}k===w&&(this.$d=new Date(""))}else p.call(this,y)}}})})(_);const te=_.exports,ie=':host{display:block;position:relative;--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}.time-picker{display:inline-block;width:150px;font-family:var(--nylas-font-family);position:relative}@media screen and (max-width: 768px){.time-picker{width:auto}}.time-picker input{width:150px;height:48px;text-align:center;font-size:16px;font-family:inherit;cursor:pointer;background:transparent;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.time-picker input{width:88px}}@media screen and (max-width: 504px){.time-picker input{width:68px;font-size:15px}}.time-picker input.focus{background:transparent}.time-picker input:hover,.time-picker input:active{border:1px solid var(--nylas-primary)}.time-picker input:active{outline:2px solid var(--nylas-primary)}.time-picker input span.open{transform:rotate(90deg)}.time-picker input span.closed{transform:rotate(270deg)}.time-picker input.error{border:1px solid var(--nylas-error)}.time-picker p.error{color:var(--nylas-error);font-size:0.875rem;margin:0}.times{display:block;margin-top:0.5rem;background-color:var(--nylas-base-0);width:100%;max-height:336px;overflow:auto;border:1px solid #ddd;z-index:1;border-radius:4px;position:absolute;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.0509803922);box-shadow:0px 10px 15px -3px rgba(0, 0, 0, 0.1019607843)}.times ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.times ul li{padding:16px, 12px, 16px, 12px;color:black;padding:12px 16px;text-decoration:none;display:block;font-family:inherit;font-size:14px;font-weight:400;line-height:20px;letter-spacing:0px;text-align:center;cursor:pointer}.times ul li.focused{background-color:var(--nylas-base-100)}.times ul li:hover,.times ul li:focus{background-color:var(--nylas-base-100)}.times ul li label{display:flex;align-items:center;gap:0.5rem}.times ul li label input{margin:0}',se=ie;r.dayjs.extend(te);const U=class{constructor(e){r.registerInstance(this,e),this.timeChange=r.createEvent(this,"timeChange",7),this.formError=r.createEvent(this,"formError",7),this.time=void 0,this.minimumStartTime=null,this.placeholder="hh:mmam/pm",this.name=void 0,this.hasError=!1,this.err="",this.showTimes=!1,this.ariaActivedescendant="",this.times=this.generateTimes(),this.shouldAutoScroll=!1}handleOutsideClick(e){!e.composedPath().includes(this.el)&&this.showTimes&&(this.showTimes=!1)}minimumStartTimeChangedHandler(){if(this.minimumStartTime){let e=r.dayjs().hour(parseInt(this.minimumStartTime)).minute(parseInt(this.minimumStartTime.slice(-4,-2)));this.minimumStartTime.slice(-2).toLowerCase()==="pm"&&parseInt(this.minimumStartTime)!==12?e=e.add(12,"hour"):this.minimumStartTime.slice(-2).toLowerCase()==="am"&&parseInt(this.minimumStartTime)===12&&(e=e.subtract(12,"hour")),this.times=this.generateTimes();const t=r.dayjs(this.times[0].value,"hh:mma");r.dayjs(this.time,"hh:mma").isBefore(t)&&(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"}))}}componentDidRender(){if(this.showTimes&&this.shouldAutoScroll){const e=r.autocompleteTimeFormat(this.time),t=this.times.findIndex(n=>n.value===e);t>-1&&(this.shouldAutoScroll=!1,this.scrollToViewWithinParent(t));return}}handleTimeChange(e,t){const n=t.split(":");n[0]==="00"&&n[1].slice(-2)=="pm"&&(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"})),r.validateTimeFormatInput(t)?(this.err="",this.formError.emit({key:this.el.id,message:""})):(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"})),this.timeChange.emit({key:this.el.id,value:t})}handleTimeAutocomplete(e){var n;const t=(n=e.target)==null?void 0:n.value;if(!r.validateTimeFormatInput(t)){this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"});return}if(t===""){const i=r.roundToNearest15Minutes().format("hh:mma");this.timeChange.emit({key:this.el.id,value:i});return}if(!r.validateExactTimeFormat(t)){const i=r.autocompleteTimeFormat(t);this.timeChange.emit({key:this.el.id,value:i});return}this.timeChange.emit({key:this.el.id,value:t})}handleOnInput(e){var n;const t=(n=e.target)==null?void 0:n.value;if(r.validateTimeFormatInput(t)){if(t===""){const i=r.roundToNearest15Minutes().format("hh:mma"),a=this.times.findIndex(h=>h.value===i);a>-1&&this.scrollToViewWithinParent(a);return}if(!r.validateExactTimeFormat(t)){const i=r.autocompleteTimeFormat(t),a=this.times.findIndex(h=>h.value===i);a>-1&&this.scrollToViewWithinParent(a);return}}}generateTimes(){const e=[];let t=r.dayjs().set("hour",0).set("minute",0).set("second",0);this.minimumStartTime&&(t=r.dayjs(this.minimumStartTime,"hh:mma"));const n=t.endOf("day").diff(t,"minutes"),i=Math.round(n/15);for(let a=0;a<i+1;a++){const h=t.add(a*15,"minute");if(a==i&&h.format("hh:mma").includes("am"))break;e.push({id:a,value:h.format("hh:mma")})}return e}handleComboboxKeyDown(e){if(e.key==="ArrowDown"){if(e.preventDefault(),!this.showTimes){this.showTimes=!0,this.shouldAutoScroll=!0;return}if(this.ariaActivedescendant==="")this.ariaActivedescendant=this.times[0].id.toString(),this.focusOption(0);else{const t=this.times.findIndex(i=>i.id.toString()===this.ariaActivedescendant),n=t+1<this.times.length?t+1:0;this.ariaActivedescendant=this.times[n].id.toString(),this.focusOption(n)}}else if(e.key==="ArrowUp")if(e.preventDefault(),this.ariaActivedescendant==="")this.ariaActivedescendant=this.times[this.times.length-1].id.toString(),this.focusOption(this.times.length-1);else{const t=this.times.findIndex(i=>i.id.toString()===this.ariaActivedescendant),n=t-1>=0?t-1:this.times.length-1;this.ariaActivedescendant=this.times[n].id.toString(),this.focusOption(n)}else e.key==="Escape"&&(this.showTimes=!1,this.timeInput.focus())}handleListboxKeydown(e){const t=this.times,n=t.findIndex(i=>i.id.toString()===this.ariaActivedescendant);if(e.key==="ArrowDown"||e.key==="Tab"&&!e.shiftKey){e.preventDefault();const i=n+1<t.length?n+1:0;this.ariaActivedescendant=t[i].id.toString(),this.focusOption(i)}else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey){e.preventDefault();const i=n-1>=0?n-1:t.length-1;this.ariaActivedescendant=t[i].id.toString(),this.focusOption(i)}else if(e.key==="Enter"){if(e.preventDefault(),this.ariaActivedescendant){const i=t[n];this.handleTimeChange(e,i.value),this.showTimes=!1,this.ariaActivedescendant="",this.timeInput.focus()}}else e.key==="Escape"&&(this.showTimes=!1,this.timeInput.focus())}scrollToViewWithinParent(e){var x;const t=this.times[e],n=(x=this.el.shadowRoot)==null?void 0:x.getElementById(t.id.toString()),i=this.timeMenu;this.ariaActivedescendant=t.id.toString();const a=n.getBoundingClientRect(),h=i.getBoundingClientRect();a.top<h.top?i.scrollTop-=h.top-a.top:a.bottom>h.bottom&&(i.scrollTop+=a.bottom-h.bottom),a.left<h.left?i.scrollLeft-=h.left-a.left:a.right>h.right&&(i.scrollLeft+=a.right-h.right)}focusOption(e){var a;const t=this.times[e];if(!t)return;const n=t.id.toString(),i=(a=this.el.shadowRoot)==null?void 0:a.getElementById(n);i&&(i.focus(),i.scrollIntoView({behavior:"smooth",block:"nearest"}))}render(){return r.h(r.Host,{key:"0ffd2bd4930bcb5fd19e0e9f4aa930206cd445ef"},r.h("div",{key:"94a265377b520768cfe2d755193bd88b6fd76b27",class:"time-picker",part:"time-picker"},r.h("input",{key:"957b8e3736cede01bdac8fc4c6050a058b45a717",type:"text",name:this.name,id:this.name,part:"time-input",class:{"time-input":!0,error:!!this.err||this.hasError},ref:e=>this.timeInput=e,value:this.time,onClick:()=>{this.showTimes=!this.showTimes,this.shouldAutoScroll=!0},"aria-haspopup":"listbox","aria-label":this.name,"aria-expanded":this.showTimes?"true":"false",placeholder:this.placeholder,onKeyDown:e=>this.handleComboboxKeyDown(e),onInput:e=>this.handleOnInput(e),onBlur:e=>this.handleTimeAutocomplete(e)}),this.err&&r.h("div",{class:"invalid-time-icon"}),this.showTimes&&r.h("div",{class:"times",part:"times",ref:e=>this.timeMenu=e},r.h("ul",{tabindex:"-1",role:"listbox","aria-label":this.name,"aria-activedescendant":this.ariaActivedescendant,onKeyDown:e=>this.handleListboxKeydown(e)},this.times.map(e=>r.h("li",{tabindex:"0",key:e.id,id:e.id.toString(),class:{focused:this.ariaActivedescendant===e.id.toString()},onClick:t=>{this.handleTimeChange(t,e.value),this.showTimes=!1,this.timeInput.focus()},role:"option"},`${e.value}`)))),!this.showTimes&&this.err&&r.h("p",{class:"error",id:"email-error"},this.err)))}get el(){return r.getElement(this)}static get watchers(){return{minimumStartTime:["minimumStartTimeChangedHandler"]}}};U.style=se;exports.nylas_time_window_picker=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-db48e0b6.cjs");require("react");require("react-dom");var _={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(r.commonjsGlobal,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},i=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,a=/\d\d/,h=/\d\d?/,x=/\d*[^-_:/,()\s\d]+/,b={},Z=function(s){return(s=+s)+(s>68?1900:2e3)},d=function(s){return function(o){this[s]=+o}},B=[/[+-]\d\d:?(\d\d)?|Z/,function(s){(this.zone||(this.zone={})).offset=function(o){if(!o||o==="Z")return 0;var m=o.match(/([+-]|\d\d)/g),l=60*m[1]+(+m[2]||0);return l===0?0:m[0]==="+"?-l:l}(s)}],F=function(s){var o=b[s];return o&&(o.indexOf?o:o.s.concat(o.f))},V=function(s,o){var m,l=b.meridiem;if(l){for(var p=1;p<=24;p+=1)if(s.indexOf(l(p,0,o))>-1){m=p>12;break}}else m=s===(o?"pm":"PM");return m},q={A:[x,function(s){this.afternoon=V(s,!1)}],a:[x,function(s){this.afternoon=V(s,!0)}],S:[/\d/,function(s){this.milliseconds=100*+s}],SS:[a,function(s){this.milliseconds=10*+s}],SSS:[/\d{3}/,function(s){this.milliseconds=+s}],s:[h,d("seconds")],ss:[h,d("seconds")],m:[h,d("minutes")],mm:[h,d("minutes")],H:[h,d("hours")],h:[h,d("hours")],HH:[h,d("hours")],hh:[h,d("hours")],D:[h,d("day")],DD:[a,d("day")],Do:[x,function(s){var o=b.ordinal,m=s.match(/\d+/);if(this.day=m[0],o)for(var l=1;l<=31;l+=1)o(l).replace(/\[|\]/g,"")===s&&(this.day=l)}],M:[h,d("month")],MM:[a,d("month")],MMM:[x,function(s){var o=F("months"),m=(F("monthsShort")||o.map(function(l){return l.slice(0,3)})).indexOf(s)+1;if(m<1)throw new Error;this.month=m%12||m}],MMMM:[x,function(s){var o=F("months").indexOf(s)+1;if(o<1)throw new Error;this.month=o%12||o}],Y:[/[+-]?\d+/,d("year")],YY:[a,function(s){this.year=Z(s)}],YYYY:[/\d{4}/,d("year")],Z:B,ZZ:B};function N(s){var o,m;o=s,m=b&&b.formats;for(var l=(s=o.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(S,T,f){var c=f&&f.toUpperCase();return T||m[f]||n[f]||m[c].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(w,k,M){return k||M.slice(1)})})).match(i),p=l.length,y=0;y<p;y+=1){var C=l[y],I=q[C],v=I&&I[0],g=I&&I[1];l[y]=g?{regex:v,parser:g}:C.replace(/^\[|\]$/g,"")}return function(S){for(var T={},f=0,c=0;f<p;f+=1){var w=l[f];if(typeof w=="string")c+=w.length;else{var k=w.regex,M=w.parser,L=S.slice(c),A=k.exec(L)[0];M.call(T,A),S=S.replace(A,"")}}return function(D){var u=D.afternoon;if(u!==void 0){var Y=D.hours;u?Y<12&&(D.hours+=12):Y===12&&(D.hours=0),delete D.afternoon}}(T),T}}return function(s,o,m){m.p.customParseFormat=!0,s&&s.parseTwoDigitYear&&(Z=s.parseTwoDigitYear);var l=o.prototype,p=l.parse;l.parse=function(y){var C=y.date,I=y.utc,v=y.args;this.$u=I;var g=v[1];if(typeof g=="string"){var S=v[2]===!0,T=v[3]===!0,f=S||T,c=v[2];T&&(c=v[2]),b=this.$locale(),!S&&c&&(b=m.Ls[c]),this.$d=function(L,A,D){try{if(["x","X"].indexOf(A)>-1)return new Date((A==="X"?1e3:1)*L);var u=N(A)(L),Y=u.year,E=u.month,X=u.day,G=u.hours,J=u.minutes,Q=u.seconds,ee=u.milliseconds,W=u.zone,$=new Date,P=X||(Y||E?1:$.getDate()),z=Y||$.getFullYear(),O=0;Y&&!E||(O=E>0?E-1:$.getMonth());var j=G||0,H=J||0,K=Q||0,R=ee||0;return W?new Date(Date.UTC(z,O,P,j,H,K,R+60*W.offset*1e3)):D?new Date(Date.UTC(z,O,P,j,H,K,R)):new Date(z,O,P,j,H,K,R)}catch{return new Date("")}}(C,g,I),this.init(),c&&c!==!0&&(this.$L=this.locale(c).$L),f&&C!=this.format(g)&&(this.$d=new Date("")),b={}}else if(g instanceof Array)for(var w=g.length,k=1;k<=w;k+=1){v[1]=g[k-1];var M=m.apply(this,v);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}k===w&&(this.$d=new Date(""))}else p.call(this,y)}}})})(_);const te=_.exports,ie=':host{display:block;position:relative;--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}.time-picker{display:inline-block;width:150px;font-family:var(--nylas-font-family);position:relative}@media screen and (max-width: 768px){.time-picker{width:auto}}.time-picker input{width:150px;height:48px;text-align:center;font-size:16px;font-family:inherit;cursor:pointer;background:transparent;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.time-picker input{width:88px}}@media screen and (max-width: 504px){.time-picker input{width:68px;font-size:15px}}.time-picker input.focus{background:transparent}.time-picker input:hover,.time-picker input:active{border:1px solid var(--nylas-primary)}.time-picker input:active{outline:2px solid var(--nylas-primary)}.time-picker input span.open{transform:rotate(90deg)}.time-picker input span.closed{transform:rotate(270deg)}.time-picker input.error{border:1px solid var(--nylas-error)}.time-picker p.error{color:var(--nylas-error);font-size:0.875rem;margin:0}.times{display:block;margin-top:0.5rem;background-color:var(--nylas-base-0);width:100%;max-height:336px;overflow:auto;border:1px solid #ddd;z-index:1;border-radius:4px;position:absolute;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.0509803922);box-shadow:0px 10px 15px -3px rgba(0, 0, 0, 0.1019607843)}.times ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.times ul li{padding:16px, 12px, 16px, 12px;color:black;padding:12px 16px;text-decoration:none;display:block;font-family:inherit;font-size:14px;font-weight:400;line-height:20px;letter-spacing:0px;text-align:center;cursor:pointer}.times ul li.focused{background-color:var(--nylas-base-100)}.times ul li:hover,.times ul li:focus{background-color:var(--nylas-base-100)}.times ul li label{display:flex;align-items:center;gap:0.5rem}.times ul li label input{margin:0}',se=ie;r.dayjs.extend(te);const U=class{constructor(e){r.registerInstance(this,e),this.timeChange=r.createEvent(this,"timeChange",7),this.formError=r.createEvent(this,"formError",7),this.time=void 0,this.minimumStartTime=null,this.placeholder="hh:mmam/pm",this.name=void 0,this.hasError=!1,this.err="",this.showTimes=!1,this.ariaActivedescendant="",this.times=this.generateTimes(),this.shouldAutoScroll=!1}handleOutsideClick(e){!e.composedPath().includes(this.el)&&this.showTimes&&(this.showTimes=!1)}minimumStartTimeChangedHandler(){if(this.minimumStartTime){let e=r.dayjs().hour(parseInt(this.minimumStartTime)).minute(parseInt(this.minimumStartTime.slice(-4,-2)));this.minimumStartTime.slice(-2).toLowerCase()==="pm"&&parseInt(this.minimumStartTime)!==12?e=e.add(12,"hour"):this.minimumStartTime.slice(-2).toLowerCase()==="am"&&parseInt(this.minimumStartTime)===12&&(e=e.subtract(12,"hour")),this.times=this.generateTimes();const t=r.dayjs(this.times[0].value,"hh:mma");r.dayjs(this.time,"hh:mma").isBefore(t)&&(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"}))}}componentDidRender(){if(this.showTimes&&this.shouldAutoScroll){const e=r.autocompleteTimeFormat(this.time),t=this.times.findIndex(n=>n.value===e);t>-1&&(this.shouldAutoScroll=!1,this.scrollToViewWithinParent(t));return}}handleTimeChange(e,t){const n=t.split(":");n[0]==="00"&&n[1].slice(-2)=="pm"&&(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"})),r.validateTimeFormatInput(t)?(this.err="",this.formError.emit({key:this.el.id,message:""})):(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"})),this.timeChange.emit({key:this.el.id,value:t})}handleTimeAutocomplete(e){var n;const t=(n=e.target)==null?void 0:n.value;if(!r.validateTimeFormatInput(t)){this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"});return}if(t===""){const i=r.roundToNearest15Minutes().format("hh:mma");this.timeChange.emit({key:this.el.id,value:i});return}if(!r.validateExactTimeFormat(t)){const i=r.autocompleteTimeFormat(t);this.timeChange.emit({key:this.el.id,value:i});return}this.timeChange.emit({key:this.el.id,value:t})}handleOnInput(e){var n;const t=(n=e.target)==null?void 0:n.value;if(r.validateTimeFormatInput(t)){if(t===""){const i=r.roundToNearest15Minutes().format("hh:mma"),a=this.times.findIndex(h=>h.value===i);a>-1&&this.scrollToViewWithinParent(a);return}if(!r.validateExactTimeFormat(t)){const i=r.autocompleteTimeFormat(t),a=this.times.findIndex(h=>h.value===i);a>-1&&this.scrollToViewWithinParent(a);return}}}generateTimes(){const e=[];let t=r.dayjs().set("hour",0).set("minute",0).set("second",0);this.minimumStartTime&&(t=r.dayjs(this.minimumStartTime,"hh:mma"));const n=t.endOf("day").diff(t,"minutes"),i=Math.round(n/15);for(let a=0;a<i+1;a++){const h=t.add(a*15,"minute");if(a==i&&h.format("hh:mma").includes("am"))break;e.push({id:a,value:h.format("hh:mma")})}return e}handleComboboxKeyDown(e){if(e.key==="ArrowDown"){if(e.preventDefault(),!this.showTimes){this.showTimes=!0,this.shouldAutoScroll=!0;return}if(this.ariaActivedescendant==="")this.ariaActivedescendant=this.times[0].id.toString(),this.focusOption(0);else{const t=this.times.findIndex(i=>i.id.toString()===this.ariaActivedescendant),n=t+1<this.times.length?t+1:0;this.ariaActivedescendant=this.times[n].id.toString(),this.focusOption(n)}}else if(e.key==="ArrowUp")if(e.preventDefault(),this.ariaActivedescendant==="")this.ariaActivedescendant=this.times[this.times.length-1].id.toString(),this.focusOption(this.times.length-1);else{const t=this.times.findIndex(i=>i.id.toString()===this.ariaActivedescendant),n=t-1>=0?t-1:this.times.length-1;this.ariaActivedescendant=this.times[n].id.toString(),this.focusOption(n)}else e.key==="Escape"&&(this.showTimes=!1,this.timeInput.focus())}handleListboxKeydown(e){const t=this.times,n=t.findIndex(i=>i.id.toString()===this.ariaActivedescendant);if(e.key==="ArrowDown"||e.key==="Tab"&&!e.shiftKey){e.preventDefault();const i=n+1<t.length?n+1:0;this.ariaActivedescendant=t[i].id.toString(),this.focusOption(i)}else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey){e.preventDefault();const i=n-1>=0?n-1:t.length-1;this.ariaActivedescendant=t[i].id.toString(),this.focusOption(i)}else if(e.key==="Enter"){if(e.preventDefault(),this.ariaActivedescendant){const i=t[n];this.handleTimeChange(e,i.value),this.showTimes=!1,this.ariaActivedescendant="",this.timeInput.focus()}}else e.key==="Escape"&&(this.showTimes=!1,this.timeInput.focus())}scrollToViewWithinParent(e){var x;const t=this.times[e],n=(x=this.el.shadowRoot)==null?void 0:x.getElementById(t.id.toString()),i=this.timeMenu;this.ariaActivedescendant=t.id.toString();const a=n.getBoundingClientRect(),h=i.getBoundingClientRect();a.top<h.top?i.scrollTop-=h.top-a.top:a.bottom>h.bottom&&(i.scrollTop+=a.bottom-h.bottom),a.left<h.left?i.scrollLeft-=h.left-a.left:a.right>h.right&&(i.scrollLeft+=a.right-h.right)}focusOption(e){var a;const t=this.times[e];if(!t)return;const n=t.id.toString(),i=(a=this.el.shadowRoot)==null?void 0:a.getElementById(n);i&&(i.focus(),i.scrollIntoView({behavior:"smooth",block:"nearest"}))}render(){return r.h(r.Host,{key:"5f167a6a87b1335e3d9fb2d861f6470ec94f2763"},r.h("div",{key:"02318b5b9e50f32e0be5b401013a244e87d37f94",class:"time-picker",part:"time-picker"},r.h("input",{key:"7c5d9aa9be2aa761ccebacb0338b00d2bee52317",type:"text",name:this.name,id:this.name,part:"time-input",class:{"time-input":!0,error:!!this.err||this.hasError},ref:e=>this.timeInput=e,value:this.time,onClick:()=>{this.showTimes=!this.showTimes,this.shouldAutoScroll=!0},"aria-haspopup":"listbox","aria-label":this.name,"aria-expanded":this.showTimes?"true":"false",placeholder:this.placeholder,onKeyDown:e=>this.handleComboboxKeyDown(e),onInput:e=>this.handleOnInput(e),onBlur:e=>this.handleTimeAutocomplete(e)}),this.err&&r.h("div",{class:"invalid-time-icon"}),this.showTimes&&r.h("div",{class:"times",part:"times",ref:e=>this.timeMenu=e},r.h("ul",{tabindex:"-1",role:"listbox","aria-label":this.name,"aria-activedescendant":this.ariaActivedescendant,onKeyDown:e=>this.handleListboxKeydown(e)},this.times.map(e=>r.h("li",{tabindex:"0",key:e.id,id:e.id.toString(),class:{focused:this.ariaActivedescendant===e.id.toString()},onClick:t=>{this.handleTimeChange(t,e.value),this.showTimes=!1,this.timeInput.focus()},role:"option"},`${e.value}`)))),!this.showTimes&&this.err&&r.h("p",{class:"error",id:"email-error"},this.err)))}get el(){return r.getElement(this)}static get watchers(){return{minimumStartTime:["minimumStartTimeChangedHandler"]}}};U.style=se;exports.nylas_time_window_picker=U;