@nylas/web-elements 1.0.0-prealpha1

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 (879) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/_commonjsHelpers-0a7b82d9.js +23 -0
  3. package/dist/cjs/_commonjsHelpers-0a7b82d9.js.map +1 -0
  4. package/dist/cjs/app-globals-d58ac016.js +11 -0
  5. package/dist/cjs/app-globals-d58ac016.js.map +1 -0
  6. package/dist/cjs/archive-icon_7.cjs.entry.js +120 -0
  7. package/dist/cjs/archive-icon_7.cjs.entry.js.map +1 -0
  8. package/dist/cjs/arrow-icon.cjs.entry.js +24 -0
  9. package/dist/cjs/arrow-icon.cjs.entry.js.map +1 -0
  10. package/dist/cjs/bold-icon_3.cjs.entry.js +56 -0
  11. package/dist/cjs/bold-icon_3.cjs.entry.js.map +1 -0
  12. package/dist/cjs/calendar-cancel-icon.cjs.entry.js +24 -0
  13. package/dist/cjs/calendar-cancel-icon.cjs.entry.js.map +1 -0
  14. package/dist/cjs/calendar-check-icon_3.cjs.entry.js +56 -0
  15. package/dist/cjs/calendar-check-icon_3.cjs.entry.js.map +1 -0
  16. package/dist/cjs/calendar-icon.cjs.entry.js +24 -0
  17. package/dist/cjs/calendar-icon.cjs.entry.js.map +1 -0
  18. package/dist/cjs/chevron-icon.cjs.entry.js +24 -0
  19. package/dist/cjs/chevron-icon.cjs.entry.js.map +1 -0
  20. package/dist/cjs/close-icon_2.cjs.entry.js +40 -0
  21. package/dist/cjs/close-icon_2.cjs.entry.js.map +1 -0
  22. package/dist/cjs/document-refresh-icon.cjs.entry.js +24 -0
  23. package/dist/cjs/document-refresh-icon.cjs.entry.js.map +1 -0
  24. package/dist/cjs/duration-18b22d1b.js +84 -0
  25. package/dist/cjs/duration-18b22d1b.js.map +1 -0
  26. package/dist/cjs/elements-b06c817b.js +21585 -0
  27. package/dist/cjs/elements-b06c817b.js.map +1 -0
  28. package/dist/cjs/flow-d922fbd4.js +891 -0
  29. package/dist/cjs/flow-d922fbd4.js.map +1 -0
  30. package/dist/cjs/focus-visible-857fc8f9.js +327 -0
  31. package/dist/cjs/focus-visible-857fc8f9.js.map +1 -0
  32. package/dist/cjs/forward-icon_6.cjs.entry.js +2216 -0
  33. package/dist/cjs/forward-icon_6.cjs.entry.js.map +1 -0
  34. package/dist/cjs/globe-icon.cjs.entry.js +24 -0
  35. package/dist/cjs/globe-icon.cjs.entry.js.map +1 -0
  36. package/dist/cjs/index-34e64e2d.js +2173 -0
  37. package/dist/cjs/index-34e64e2d.js.map +1 -0
  38. package/dist/cjs/index-e869130c.js +198 -0
  39. package/dist/cjs/index-e869130c.js.map +1 -0
  40. package/dist/cjs/index.cjs.js +12 -0
  41. package/dist/cjs/index.cjs.js.map +1 -0
  42. package/dist/cjs/index.es-e78884f5.js +3217 -0
  43. package/dist/cjs/index.es-e78884f5.js.map +1 -0
  44. package/dist/cjs/loader.cjs.js +17 -0
  45. package/dist/cjs/loader.cjs.js.map +1 -0
  46. package/dist/cjs/loading-icon.cjs.entry.js +24 -0
  47. package/dist/cjs/loading-icon.cjs.entry.js.map +1 -0
  48. package/dist/cjs/mailbox-store-0b1636fa.js +529 -0
  49. package/dist/cjs/mailbox-store-0b1636fa.js.map +1 -0
  50. package/dist/cjs/nylas-booked-event-card_9.cjs.entry.js +8127 -0
  51. package/dist/cjs/nylas-booked-event-card_9.cjs.entry.js.map +1 -0
  52. package/dist/cjs/nylas-if-state_3.cjs.entry.js +409 -0
  53. package/dist/cjs/nylas-if-state_3.cjs.entry.js.map +1 -0
  54. package/dist/cjs/nylas-list-folders.cjs.entry.js +120 -0
  55. package/dist/cjs/nylas-list-folders.cjs.entry.js.map +1 -0
  56. package/dist/cjs/nylas-list-threads.cjs.entry.js +89 -0
  57. package/dist/cjs/nylas-list-threads.cjs.entry.js.map +1 -0
  58. package/dist/cjs/nylas-mailbox-pagination.cjs.entry.js +140 -0
  59. package/dist/cjs/nylas-mailbox-pagination.cjs.entry.js.map +1 -0
  60. package/dist/cjs/nylas-mailbox-toolbar-button.cjs.entry.js +100 -0
  61. package/dist/cjs/nylas-mailbox-toolbar-button.cjs.entry.js.map +1 -0
  62. package/dist/cjs/nylas-open-hours-picker.cjs.entry.js +333 -0
  63. package/dist/cjs/nylas-open-hours-picker.cjs.entry.js.map +1 -0
  64. package/dist/cjs/nylas-provider.cjs.entry.js +184 -0
  65. package/dist/cjs/nylas-provider.cjs.entry.js.map +1 -0
  66. package/dist/cjs/nylas-scheduler.cjs.entry.js +242 -0
  67. package/dist/cjs/nylas-scheduler.cjs.entry.js.map +1 -0
  68. package/dist/cjs/nylas-threads-refresh.cjs.entry.js +118 -0
  69. package/dist/cjs/nylas-threads-refresh.cjs.entry.js.map +1 -0
  70. package/dist/cjs/nylas-threads-search.cjs.entry.js +84 -0
  71. package/dist/cjs/nylas-threads-search.cjs.entry.js.map +1 -0
  72. package/dist/cjs/nylas-view-thread.cjs.entry.js +234 -0
  73. package/dist/cjs/nylas-view-thread.cjs.entry.js.map +1 -0
  74. package/dist/cjs/nylas-web-elements.cjs.js +27 -0
  75. package/dist/cjs/nylas-web-elements.cjs.js.map +1 -0
  76. package/dist/cjs/play-icon_2.cjs.entry.js +40 -0
  77. package/dist/cjs/play-icon_2.cjs.entry.js.map +1 -0
  78. package/dist/cjs/property-d934a711.js +47 -0
  79. package/dist/cjs/property-d934a711.js.map +1 -0
  80. package/dist/cjs/refresh-icon.cjs.entry.js +24 -0
  81. package/dist/cjs/refresh-icon.cjs.entry.js.map +1 -0
  82. package/dist/cjs/register-component-f76b61a6.js +140 -0
  83. package/dist/cjs/register-component-f76b61a6.js.map +1 -0
  84. package/dist/cjs/scheduler-store-e9822441.js +254 -0
  85. package/dist/cjs/scheduler-store-e9822441.js.map +1 -0
  86. package/dist/cjs/translate-icon.cjs.entry.js +24 -0
  87. package/dist/cjs/translate-icon.cjs.entry.js.map +1 -0
  88. package/dist/cjs/utils-f91d4c73.js +161 -0
  89. package/dist/cjs/utils-f91d4c73.js.map +1 -0
  90. package/dist/collection/assets/icons/chevron.svg +3 -0
  91. package/dist/collection/collection-manifest.json +66 -0
  92. package/dist/collection/common/abstract-provider.js +231 -0
  93. package/dist/collection/common/abstract-provider.js.map +1 -0
  94. package/dist/collection/common/component-types.js +2 -0
  95. package/dist/collection/common/component-types.js.map +1 -0
  96. package/dist/collection/common/constants.js +12 -0
  97. package/dist/collection/common/constants.js.map +1 -0
  98. package/dist/collection/common/global.js +4 -0
  99. package/dist/collection/common/global.js.map +1 -0
  100. package/dist/collection/common/icons/archive.js +63 -0
  101. package/dist/collection/common/icons/archive.js.map +1 -0
  102. package/dist/collection/common/icons/arrow.js +63 -0
  103. package/dist/collection/common/icons/arrow.js.map +1 -0
  104. package/dist/collection/common/icons/bold.js +63 -0
  105. package/dist/collection/common/icons/bold.js.map +1 -0
  106. package/dist/collection/common/icons/calendar-cancel.js +63 -0
  107. package/dist/collection/common/icons/calendar-cancel.js.map +1 -0
  108. package/dist/collection/common/icons/calendar-check.js +63 -0
  109. package/dist/collection/common/icons/calendar-check.js.map +1 -0
  110. package/dist/collection/common/icons/calendar.js +63 -0
  111. package/dist/collection/common/icons/calendar.js.map +1 -0
  112. package/dist/collection/common/icons/checkmark-circle.js +63 -0
  113. package/dist/collection/common/icons/checkmark-circle.js.map +1 -0
  114. package/dist/collection/common/icons/chevron.js +63 -0
  115. package/dist/collection/common/icons/chevron.js.map +1 -0
  116. package/dist/collection/common/icons/close.js +63 -0
  117. package/dist/collection/common/icons/close.js.map +1 -0
  118. package/dist/collection/common/icons/document-refresh.js +63 -0
  119. package/dist/collection/common/icons/document-refresh.js.map +1 -0
  120. package/dist/collection/common/icons/folder.js +63 -0
  121. package/dist/collection/common/icons/folder.js.map +1 -0
  122. package/dist/collection/common/icons/forward.js +63 -0
  123. package/dist/collection/common/icons/forward.js.map +1 -0
  124. package/dist/collection/common/icons/globe.js +63 -0
  125. package/dist/collection/common/icons/globe.js.map +1 -0
  126. package/dist/collection/common/icons/icon.css +3 -0
  127. package/dist/collection/common/icons/inbox.js +63 -0
  128. package/dist/collection/common/icons/inbox.js.map +1 -0
  129. package/dist/collection/common/icons/italic.js +63 -0
  130. package/dist/collection/common/icons/italic.js.map +1 -0
  131. package/dist/collection/common/icons/loading.css +33 -0
  132. package/dist/collection/common/icons/loading.js +63 -0
  133. package/dist/collection/common/icons/loading.js.map +1 -0
  134. package/dist/collection/common/icons/nylas-logo.js +63 -0
  135. package/dist/collection/common/icons/nylas-logo.js.map +1 -0
  136. package/dist/collection/common/icons/people.js +63 -0
  137. package/dist/collection/common/icons/people.js.map +1 -0
  138. package/dist/collection/common/icons/play.js +63 -0
  139. package/dist/collection/common/icons/play.js.map +1 -0
  140. package/dist/collection/common/icons/refresh.js +63 -0
  141. package/dist/collection/common/icons/refresh.js.map +1 -0
  142. package/dist/collection/common/icons/reply-all.js +63 -0
  143. package/dist/collection/common/icons/reply-all.js.map +1 -0
  144. package/dist/collection/common/icons/reply.js +63 -0
  145. package/dist/collection/common/icons/reply.js.map +1 -0
  146. package/dist/collection/common/icons/sent.js +63 -0
  147. package/dist/collection/common/icons/sent.js.map +1 -0
  148. package/dist/collection/common/icons/spam.js +63 -0
  149. package/dist/collection/common/icons/spam.js.map +1 -0
  150. package/dist/collection/common/icons/star.js +63 -0
  151. package/dist/collection/common/icons/star.js.map +1 -0
  152. package/dist/collection/common/icons/stop.js +63 -0
  153. package/dist/collection/common/icons/stop.js.map +1 -0
  154. package/dist/collection/common/icons/translate.js +63 -0
  155. package/dist/collection/common/icons/translate.js.map +1 -0
  156. package/dist/collection/common/icons/trash.js +63 -0
  157. package/dist/collection/common/icons/trash.js.map +1 -0
  158. package/dist/collection/common/icons/underline.js +63 -0
  159. package/dist/collection/common/icons/underline.js.map +1 -0
  160. package/dist/collection/common/icons/warning.js +63 -0
  161. package/dist/collection/common/icons/warning.js.map +1 -0
  162. package/dist/collection/common/mocks/threads.js +57 -0
  163. package/dist/collection/common/mocks/threads.js.map +1 -0
  164. package/dist/collection/common/nylas-theme/index.js +4 -0
  165. package/dist/collection/common/nylas-theme/index.js.map +1 -0
  166. package/dist/collection/common/register-component.js +134 -0
  167. package/dist/collection/common/register-component.js.map +1 -0
  168. package/dist/collection/common/types.js +2 -0
  169. package/dist/collection/common/types.js.map +1 -0
  170. package/dist/collection/components/mailbox/nylas-composer/nylas-composer.css +89 -0
  171. package/dist/collection/components/mailbox/nylas-composer/nylas-composer.js +241 -0
  172. package/dist/collection/components/mailbox/nylas-composer/nylas-composer.js.map +1 -0
  173. package/dist/collection/components/mailbox/nylas-composer/test/nylas-composer.e2e.js +10 -0
  174. package/dist/collection/components/mailbox/nylas-composer/test/nylas-composer.e2e.js.map +1 -0
  175. package/dist/collection/components/mailbox/nylas-composer/test/nylas-composer.spec-disabled.js +12 -0
  176. package/dist/collection/components/mailbox/nylas-composer/test/nylas-composer.spec-disabled.js.map +1 -0
  177. package/dist/collection/components/mailbox/nylas-list-folders/nylas-list-folders.css +37 -0
  178. package/dist/collection/components/mailbox/nylas-list-folders/nylas-list-folders.js +193 -0
  179. package/dist/collection/components/mailbox/nylas-list-folders/nylas-list-folders.js.map +1 -0
  180. package/dist/collection/components/mailbox/nylas-list-folders/test/nylas-list-folders.e2e.js +10 -0
  181. package/dist/collection/components/mailbox/nylas-list-folders/test/nylas-list-folders.e2e.js.map +1 -0
  182. package/dist/collection/components/mailbox/nylas-list-folders/test/nylas-list-folders.spec.js +12 -0
  183. package/dist/collection/components/mailbox/nylas-list-folders/test/nylas-list-folders.spec.js.map +1 -0
  184. package/dist/collection/components/mailbox/nylas-list-threads/nylas-list-threads.css +156 -0
  185. package/dist/collection/components/mailbox/nylas-list-threads/nylas-list-threads.js +218 -0
  186. package/dist/collection/components/mailbox/nylas-list-threads/nylas-list-threads.js.map +1 -0
  187. package/dist/collection/components/mailbox/nylas-list-threads/test/nylas-list-threads.e2e.js +22 -0
  188. package/dist/collection/components/mailbox/nylas-list-threads/test/nylas-list-threads.e2e.js.map +1 -0
  189. package/dist/collection/components/mailbox/nylas-list-threads/test/nylas-list-threads.spec.js +25 -0
  190. package/dist/collection/components/mailbox/nylas-list-threads/test/nylas-list-threads.spec.js.map +1 -0
  191. package/dist/collection/components/mailbox/nylas-mailbox/nylas-mailbox.css +3 -0
  192. package/dist/collection/components/mailbox/nylas-mailbox/nylas-mailbox.js +474 -0
  193. package/dist/collection/components/mailbox/nylas-mailbox/nylas-mailbox.js.map +1 -0
  194. package/dist/collection/components/mailbox/nylas-mailbox/test/nylas-mailbox.e2e.js +16 -0
  195. package/dist/collection/components/mailbox/nylas-mailbox/test/nylas-mailbox.e2e.js.map +1 -0
  196. package/dist/collection/components/mailbox/nylas-mailbox/test/nylas-mailbox.spec.js +32 -0
  197. package/dist/collection/components/mailbox/nylas-mailbox/test/nylas-mailbox.spec.js.map +1 -0
  198. package/dist/collection/components/mailbox/nylas-mailbox-pagination/nylas-mailbox-pagination.css +55 -0
  199. package/dist/collection/components/mailbox/nylas-mailbox-pagination/nylas-mailbox-pagination.js +371 -0
  200. package/dist/collection/components/mailbox/nylas-mailbox-pagination/nylas-mailbox-pagination.js.map +1 -0
  201. package/dist/collection/components/mailbox/nylas-mailbox-pagination/test/nylas-mailbox-pagination.e2e.js +10 -0
  202. package/dist/collection/components/mailbox/nylas-mailbox-pagination/test/nylas-mailbox-pagination.e2e.js.map +1 -0
  203. package/dist/collection/components/mailbox/nylas-mailbox-pagination/test/nylas-mailbox-pagination.spec.js +12 -0
  204. package/dist/collection/components/mailbox/nylas-mailbox-pagination/test/nylas-mailbox-pagination.spec.js.map +1 -0
  205. package/dist/collection/components/mailbox/nylas-mailbox-toolbar-button/nylas-mailbox-toolbar-button.css +18 -0
  206. package/dist/collection/components/mailbox/nylas-mailbox-toolbar-button/nylas-mailbox-toolbar-button.js +182 -0
  207. package/dist/collection/components/mailbox/nylas-mailbox-toolbar-button/nylas-mailbox-toolbar-button.js.map +1 -0
  208. package/dist/collection/components/mailbox/nylas-summarize-message-button/nylas-summarize-message-button.css +61 -0
  209. package/dist/collection/components/mailbox/nylas-summarize-message-button/nylas-summarize-message-button.js +329 -0
  210. package/dist/collection/components/mailbox/nylas-summarize-message-button/nylas-summarize-message-button.js.map +1 -0
  211. package/dist/collection/components/mailbox/nylas-summarize-message-button/test/nylas-summarize-message-button.e2e.js +10 -0
  212. package/dist/collection/components/mailbox/nylas-summarize-message-button/test/nylas-summarize-message-button.e2e.js.map +1 -0
  213. package/dist/collection/components/mailbox/nylas-summarize-message-button/test/nylas-summarize-message-button.spec.js +12 -0
  214. package/dist/collection/components/mailbox/nylas-summarize-message-button/test/nylas-summarize-message-button.spec.js.map +1 -0
  215. package/dist/collection/components/mailbox/nylas-threads-refresh/nylas-threads-refresh.css +53 -0
  216. package/dist/collection/components/mailbox/nylas-threads-refresh/nylas-threads-refresh.js +172 -0
  217. package/dist/collection/components/mailbox/nylas-threads-refresh/nylas-threads-refresh.js.map +1 -0
  218. package/dist/collection/components/mailbox/nylas-threads-refresh/test/nylas-threads-refresh.e2e.js +10 -0
  219. package/dist/collection/components/mailbox/nylas-threads-refresh/test/nylas-threads-refresh.e2e.js.map +1 -0
  220. package/dist/collection/components/mailbox/nylas-threads-refresh/test/nylas-threads-refresh.spec.js +12 -0
  221. package/dist/collection/components/mailbox/nylas-threads-refresh/test/nylas-threads-refresh.spec.js.map +1 -0
  222. package/dist/collection/components/mailbox/nylas-threads-search/nylas-threads-search.css +8 -0
  223. package/dist/collection/components/mailbox/nylas-threads-search/nylas-threads-search.js +130 -0
  224. package/dist/collection/components/mailbox/nylas-threads-search/nylas-threads-search.js.map +1 -0
  225. package/dist/collection/components/mailbox/nylas-threads-search/test/nylas-threads-search.e2e.js +10 -0
  226. package/dist/collection/components/mailbox/nylas-threads-search/test/nylas-threads-search.e2e.js.map +1 -0
  227. package/dist/collection/components/mailbox/nylas-threads-search/test/nylas-threads-search.spec.js +12 -0
  228. package/dist/collection/components/mailbox/nylas-threads-search/test/nylas-threads-search.spec.js.map +1 -0
  229. package/dist/collection/components/mailbox/nylas-view-email/nylas-view-email.css +43 -0
  230. package/dist/collection/components/mailbox/nylas-view-email/nylas-view-email.js +282 -0
  231. package/dist/collection/components/mailbox/nylas-view-email/nylas-view-email.js.map +1 -0
  232. package/dist/collection/components/mailbox/nylas-view-thread/nylas-view-thread.css +243 -0
  233. package/dist/collection/components/mailbox/nylas-view-thread/nylas-view-thread.js +342 -0
  234. package/dist/collection/components/mailbox/nylas-view-thread/nylas-view-thread.js.map +1 -0
  235. package/dist/collection/components/mailbox/nylas-view-thread/view-thread-message.js +25 -0
  236. package/dist/collection/components/mailbox/nylas-view-thread/view-thread-message.js.map +1 -0
  237. package/dist/collection/components/nylas-if-state/nylas-if-state.css +84 -0
  238. package/dist/collection/components/nylas-if-state/nylas-if-state.js +241 -0
  239. package/dist/collection/components/nylas-if-state/nylas-if-state.js.map +1 -0
  240. package/dist/collection/components/nylas-if-state/test/nylas-if-state.e2e.js +10 -0
  241. package/dist/collection/components/nylas-if-state/test/nylas-if-state.e2e.js.map +1 -0
  242. package/dist/collection/components/nylas-if-state/test/nylas-if-state.spec.js +12 -0
  243. package/dist/collection/components/nylas-if-state/test/nylas-if-state.spec.js.map +1 -0
  244. package/dist/collection/components/nylas-login/nylas-login.css +94 -0
  245. package/dist/collection/components/nylas-login/nylas-login.js +289 -0
  246. package/dist/collection/components/nylas-login/nylas-login.js.map +1 -0
  247. package/dist/collection/components/nylas-login/test/nylas-login.e2e.js +10 -0
  248. package/dist/collection/components/nylas-login/test/nylas-login.e2e.js.map +1 -0
  249. package/dist/collection/components/nylas-login/test/nylas-login.spec.js +12 -0
  250. package/dist/collection/components/nylas-login/test/nylas-login.spec.js.map +1 -0
  251. package/dist/collection/components/nylas-provider/nylas-provider.css +3 -0
  252. package/dist/collection/components/nylas-provider/nylas-provider.js +423 -0
  253. package/dist/collection/components/nylas-provider/nylas-provider.js.map +1 -0
  254. package/dist/collection/components/nylas-provider/test/nylas-provider.e2e.js +10 -0
  255. package/dist/collection/components/nylas-provider/test/nylas-provider.e2e.js.map +1 -0
  256. package/dist/collection/components/nylas-provider/test/nylas-provider.spec.js +32 -0
  257. package/dist/collection/components/nylas-provider/test/nylas-provider.spec.js.map +1 -0
  258. package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.css +155 -0
  259. package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.js +178 -0
  260. package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.js.map +1 -0
  261. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.css +129 -0
  262. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js +323 -0
  263. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js.map +1 -0
  264. package/dist/collection/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.css +78 -0
  265. package/dist/collection/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.js +107 -0
  266. package/dist/collection/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.js.map +1 -0
  267. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.css +150 -0
  268. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js +213 -0
  269. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js.map +1 -0
  270. package/dist/collection/components/scheduler/nylas-locale-switch/nylas-locale-switch.css +72 -0
  271. package/dist/collection/components/scheduler/nylas-locale-switch/nylas-locale-switch.js +147 -0
  272. package/dist/collection/components/scheduler/nylas-locale-switch/nylas-locale-switch.js.map +1 -0
  273. package/dist/collection/components/scheduler/nylas-notification/nylas-notification.css +63 -0
  274. package/dist/collection/components/scheduler/nylas-notification/nylas-notification.js +132 -0
  275. package/dist/collection/components/scheduler/nylas-notification/nylas-notification.js.map +1 -0
  276. package/dist/collection/components/scheduler/nylas-open-hours-picker/nylas-open-hours-picker.css +105 -0
  277. package/dist/collection/components/scheduler/nylas-open-hours-picker/nylas-open-hours-picker.js +460 -0
  278. package/dist/collection/components/scheduler/nylas-open-hours-picker/nylas-open-hours-picker.js.map +1 -0
  279. package/dist/collection/components/scheduler/nylas-open-hours-picker/test/nylas-open-hours-picker.e2e.js +10 -0
  280. package/dist/collection/components/scheduler/nylas-open-hours-picker/test/nylas-open-hours-picker.e2e.js.map +1 -0
  281. package/dist/collection/components/scheduler/nylas-open-hours-picker/test/nylas-open-hours-picker.spec.js +12 -0
  282. package/dist/collection/components/scheduler/nylas-open-hours-picker/test/nylas-open-hours-picker.spec.js.map +1 -0
  283. package/dist/collection/components/scheduler/nylas-scheduler/nylas-scheduler.css +182 -0
  284. package/dist/collection/components/scheduler/nylas-scheduler/nylas-scheduler.js +533 -0
  285. package/dist/collection/components/scheduler/nylas-scheduler/nylas-scheduler.js.map +1 -0
  286. package/dist/collection/components/scheduler/nylas-scheduler/scheduler-view.js +6 -0
  287. package/dist/collection/components/scheduler/nylas-scheduler/scheduler-view.js.map +1 -0
  288. package/dist/collection/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.css +63 -0
  289. package/dist/collection/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.js +150 -0
  290. package/dist/collection/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.js.map +1 -0
  291. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.css +115 -0
  292. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js +311 -0
  293. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js.map +1 -0
  294. package/dist/collection/connector/connector-interface.js +2 -0
  295. package/dist/collection/connector/connector-interface.js.map +1 -0
  296. package/dist/collection/connector/nylas-connector/index.js +78 -0
  297. package/dist/collection/connector/nylas-connector/index.js.map +1 -0
  298. package/dist/collection/connector/nylas-mailbox-connector/index.js +62 -0
  299. package/dist/collection/connector/nylas-mailbox-connector/index.js.map +1 -0
  300. package/dist/collection/connector/nylas-scheduler-connector/index.js +43 -0
  301. package/dist/collection/connector/nylas-scheduler-connector/index.js.map +1 -0
  302. package/dist/collection/connector/shared/api/auth.js +60 -0
  303. package/dist/collection/connector/shared/api/auth.js.map +1 -0
  304. package/dist/collection/connector/shared/api/folders.js +33 -0
  305. package/dist/collection/connector/shared/api/folders.js.map +1 -0
  306. package/dist/collection/connector/shared/api/messages.js +95 -0
  307. package/dist/collection/connector/shared/api/messages.js.map +1 -0
  308. package/dist/collection/connector/shared/api/scheduler.js +203 -0
  309. package/dist/collection/connector/shared/api/scheduler.js.map +1 -0
  310. package/dist/collection/connector/shared/api/threads.js +165 -0
  311. package/dist/collection/connector/shared/api/threads.js.map +1 -0
  312. package/dist/collection/index.js +4 -0
  313. package/dist/collection/index.js.map +1 -0
  314. package/dist/collection/routers/hash-router.js +109 -0
  315. package/dist/collection/routers/hash-router.js.map +1 -0
  316. package/dist/collection/routers/router-interface.js +2 -0
  317. package/dist/collection/routers/router-interface.js.map +1 -0
  318. package/dist/collection/stores/auth-store.js +18 -0
  319. package/dist/collection/stores/auth-store.js.map +1 -0
  320. package/dist/collection/stores/mailbox-store.js +42 -0
  321. package/dist/collection/stores/mailbox-store.js.map +1 -0
  322. package/dist/collection/stores/scheduler-store.js +44 -0
  323. package/dist/collection/stores/scheduler-store.js.map +1 -0
  324. package/dist/collection/utils/color-utils.js +161 -0
  325. package/dist/collection/utils/color-utils.js.map +1 -0
  326. package/dist/collection/utils/utils.js +157 -0
  327. package/dist/collection/utils/utils.js.map +1 -0
  328. package/dist/collection/utils/utils.spec.js +16 -0
  329. package/dist/collection/utils/utils.spec.js.map +1 -0
  330. package/dist/components/_commonjsHelpers.js +20 -0
  331. package/dist/components/_commonjsHelpers.js.map +1 -0
  332. package/dist/components/archive-icon.d.ts +11 -0
  333. package/dist/components/archive-icon.js +8 -0
  334. package/dist/components/archive-icon.js.map +1 -0
  335. package/dist/components/archive.js +37 -0
  336. package/dist/components/archive.js.map +1 -0
  337. package/dist/components/arrow-icon.d.ts +11 -0
  338. package/dist/components/arrow-icon.js +8 -0
  339. package/dist/components/arrow-icon.js.map +1 -0
  340. package/dist/components/arrow.js +37 -0
  341. package/dist/components/arrow.js.map +1 -0
  342. package/dist/components/assets/chevron.svg +3 -0
  343. package/dist/components/bold-icon.d.ts +11 -0
  344. package/dist/components/bold-icon.js +8 -0
  345. package/dist/components/bold-icon.js.map +1 -0
  346. package/dist/components/bold.js +37 -0
  347. package/dist/components/bold.js.map +1 -0
  348. package/dist/components/calendar-cancel-icon.d.ts +11 -0
  349. package/dist/components/calendar-cancel-icon.js +8 -0
  350. package/dist/components/calendar-cancel-icon.js.map +1 -0
  351. package/dist/components/calendar-cancel.js +37 -0
  352. package/dist/components/calendar-cancel.js.map +1 -0
  353. package/dist/components/calendar-check-icon.d.ts +11 -0
  354. package/dist/components/calendar-check-icon.js +8 -0
  355. package/dist/components/calendar-check-icon.js.map +1 -0
  356. package/dist/components/calendar-check.js +37 -0
  357. package/dist/components/calendar-check.js.map +1 -0
  358. package/dist/components/calendar-icon.d.ts +11 -0
  359. package/dist/components/calendar-icon.js +8 -0
  360. package/dist/components/calendar-icon.js.map +1 -0
  361. package/dist/components/calendar.js +37 -0
  362. package/dist/components/calendar.js.map +1 -0
  363. package/dist/components/checkmark-circle-icon.d.ts +11 -0
  364. package/dist/components/checkmark-circle-icon.js +8 -0
  365. package/dist/components/checkmark-circle-icon.js.map +1 -0
  366. package/dist/components/checkmark-circle.js +37 -0
  367. package/dist/components/checkmark-circle.js.map +1 -0
  368. package/dist/components/chevron-icon.d.ts +11 -0
  369. package/dist/components/chevron-icon.js +8 -0
  370. package/dist/components/chevron-icon.js.map +1 -0
  371. package/dist/components/chevron.js +37 -0
  372. package/dist/components/chevron.js.map +1 -0
  373. package/dist/components/close-icon.d.ts +11 -0
  374. package/dist/components/close-icon.js +8 -0
  375. package/dist/components/close-icon.js.map +1 -0
  376. package/dist/components/close.js +37 -0
  377. package/dist/components/close.js.map +1 -0
  378. package/dist/components/constants.js +7296 -0
  379. package/dist/components/constants.js.map +1 -0
  380. package/dist/components/define-element.js +40 -0
  381. package/dist/components/define-element.js.map +1 -0
  382. package/dist/components/document-refresh-icon.d.ts +11 -0
  383. package/dist/components/document-refresh-icon.js +40 -0
  384. package/dist/components/document-refresh-icon.js.map +1 -0
  385. package/dist/components/duration.js +78 -0
  386. package/dist/components/duration.js.map +1 -0
  387. package/dist/components/elements.js +21583 -0
  388. package/dist/components/elements.js.map +1 -0
  389. package/dist/components/flow.js +888 -0
  390. package/dist/components/flow.js.map +1 -0
  391. package/dist/components/focus-visible.js +325 -0
  392. package/dist/components/focus-visible.js.map +1 -0
  393. package/dist/components/folder-icon.d.ts +11 -0
  394. package/dist/components/folder-icon.js +8 -0
  395. package/dist/components/folder-icon.js.map +1 -0
  396. package/dist/components/folder.js +37 -0
  397. package/dist/components/folder.js.map +1 -0
  398. package/dist/components/forward-icon.d.ts +11 -0
  399. package/dist/components/forward-icon.js +8 -0
  400. package/dist/components/forward-icon.js.map +1 -0
  401. package/dist/components/forward.js +37 -0
  402. package/dist/components/forward.js.map +1 -0
  403. package/dist/components/globe-icon.d.ts +11 -0
  404. package/dist/components/globe-icon.js +8 -0
  405. package/dist/components/globe-icon.js.map +1 -0
  406. package/dist/components/globe.js +37 -0
  407. package/dist/components/globe.js.map +1 -0
  408. package/dist/components/inbox-icon.d.ts +11 -0
  409. package/dist/components/inbox-icon.js +8 -0
  410. package/dist/components/inbox-icon.js.map +1 -0
  411. package/dist/components/inbox.js +37 -0
  412. package/dist/components/inbox.js.map +1 -0
  413. package/dist/components/index.d.ts +33 -0
  414. package/dist/components/index.es.js +3211 -0
  415. package/dist/components/index.es.js.map +1 -0
  416. package/dist/components/index.js +16 -0
  417. package/dist/components/index.js.map +1 -0
  418. package/dist/components/index2.js +196 -0
  419. package/dist/components/index2.js.map +1 -0
  420. package/dist/components/italic-icon.d.ts +11 -0
  421. package/dist/components/italic-icon.js +8 -0
  422. package/dist/components/italic-icon.js.map +1 -0
  423. package/dist/components/italic.js +37 -0
  424. package/dist/components/italic.js.map +1 -0
  425. package/dist/components/loading-icon.d.ts +11 -0
  426. package/dist/components/loading-icon.js +8 -0
  427. package/dist/components/loading-icon.js.map +1 -0
  428. package/dist/components/loading.js +38 -0
  429. package/dist/components/loading.js.map +1 -0
  430. package/dist/components/mailbox-store.js +521 -0
  431. package/dist/components/mailbox-store.js.map +1 -0
  432. package/dist/components/nylas-booked-event-card.d.ts +11 -0
  433. package/dist/components/nylas-booked-event-card.js +8 -0
  434. package/dist/components/nylas-booked-event-card.js.map +1 -0
  435. package/dist/components/nylas-booked-event-card2.js +121 -0
  436. package/dist/components/nylas-booked-event-card2.js.map +1 -0
  437. package/dist/components/nylas-booking-form.d.ts +11 -0
  438. package/dist/components/nylas-booking-form.js +8 -0
  439. package/dist/components/nylas-booking-form.js.map +1 -0
  440. package/dist/components/nylas-booking-form2.js +224 -0
  441. package/dist/components/nylas-booking-form2.js.map +1 -0
  442. package/dist/components/nylas-cancelled-event-card.d.ts +11 -0
  443. package/dist/components/nylas-cancelled-event-card.js +8 -0
  444. package/dist/components/nylas-cancelled-event-card.js.map +1 -0
  445. package/dist/components/nylas-cancelled-event-card2.js +85 -0
  446. package/dist/components/nylas-cancelled-event-card2.js.map +1 -0
  447. package/dist/components/nylas-composer.d.ts +11 -0
  448. package/dist/components/nylas-composer.js +8 -0
  449. package/dist/components/nylas-composer.js.map +1 -0
  450. package/dist/components/nylas-composer2.js +186 -0
  451. package/dist/components/nylas-composer2.js.map +1 -0
  452. package/dist/components/nylas-date-picker.d.ts +11 -0
  453. package/dist/components/nylas-date-picker.js +8 -0
  454. package/dist/components/nylas-date-picker.js.map +1 -0
  455. package/dist/components/nylas-date-picker2.js +150 -0
  456. package/dist/components/nylas-date-picker2.js.map +1 -0
  457. package/dist/components/nylas-if-state.d.ts +11 -0
  458. package/dist/components/nylas-if-state.js +153 -0
  459. package/dist/components/nylas-if-state.js.map +1 -0
  460. package/dist/components/nylas-list-folders.d.ts +11 -0
  461. package/dist/components/nylas-list-folders.js +183 -0
  462. package/dist/components/nylas-list-folders.js.map +1 -0
  463. package/dist/components/nylas-list-threads.d.ts +11 -0
  464. package/dist/components/nylas-list-threads.js +109 -0
  465. package/dist/components/nylas-list-threads.js.map +1 -0
  466. package/dist/components/nylas-locale-switch.d.ts +11 -0
  467. package/dist/components/nylas-locale-switch.js +8 -0
  468. package/dist/components/nylas-locale-switch.js.map +1 -0
  469. package/dist/components/nylas-locale-switch2.js +103 -0
  470. package/dist/components/nylas-locale-switch2.js.map +1 -0
  471. package/dist/components/nylas-login.d.ts +11 -0
  472. package/dist/components/nylas-login.js +127 -0
  473. package/dist/components/nylas-login.js.map +1 -0
  474. package/dist/components/nylas-logo.d.ts +11 -0
  475. package/dist/components/nylas-logo.js +8 -0
  476. package/dist/components/nylas-logo.js.map +1 -0
  477. package/dist/components/nylas-logo2.js +37 -0
  478. package/dist/components/nylas-logo2.js.map +1 -0
  479. package/dist/components/nylas-mailbox-pagination.d.ts +11 -0
  480. package/dist/components/nylas-mailbox-pagination.js +175 -0
  481. package/dist/components/nylas-mailbox-pagination.js.map +1 -0
  482. package/dist/components/nylas-mailbox-toolbar-button.d.ts +11 -0
  483. package/dist/components/nylas-mailbox-toolbar-button.js +119 -0
  484. package/dist/components/nylas-mailbox-toolbar-button.js.map +1 -0
  485. package/dist/components/nylas-mailbox.d.ts +11 -0
  486. package/dist/components/nylas-mailbox.js +219 -0
  487. package/dist/components/nylas-mailbox.js.map +1 -0
  488. package/dist/components/nylas-notification.d.ts +11 -0
  489. package/dist/components/nylas-notification.js +8 -0
  490. package/dist/components/nylas-notification.js.map +1 -0
  491. package/dist/components/nylas-notification2.js +90 -0
  492. package/dist/components/nylas-notification2.js.map +1 -0
  493. package/dist/components/nylas-open-hours-picker.d.ts +11 -0
  494. package/dist/components/nylas-open-hours-picker.js +365 -0
  495. package/dist/components/nylas-open-hours-picker.js.map +1 -0
  496. package/dist/components/nylas-provider.d.ts +11 -0
  497. package/dist/components/nylas-provider.js +206 -0
  498. package/dist/components/nylas-provider.js.map +1 -0
  499. package/dist/components/nylas-scheduler.d.ts +11 -0
  500. package/dist/components/nylas-scheduler.js +392 -0
  501. package/dist/components/nylas-scheduler.js.map +1 -0
  502. package/dist/components/nylas-selected-event-card.d.ts +11 -0
  503. package/dist/components/nylas-selected-event-card.js +8 -0
  504. package/dist/components/nylas-selected-event-card.js.map +1 -0
  505. package/dist/components/nylas-selected-event-card2.js +110 -0
  506. package/dist/components/nylas-selected-event-card2.js.map +1 -0
  507. package/dist/components/nylas-summarize-message-button.d.ts +11 -0
  508. package/dist/components/nylas-summarize-message-button.js +8 -0
  509. package/dist/components/nylas-summarize-message-button.js.map +1 -0
  510. package/dist/components/nylas-summarize-message-button2.js +233 -0
  511. package/dist/components/nylas-summarize-message-button2.js.map +1 -0
  512. package/dist/components/nylas-threads-refresh.d.ts +11 -0
  513. package/dist/components/nylas-threads-refresh.js +149 -0
  514. package/dist/components/nylas-threads-refresh.js.map +1 -0
  515. package/dist/components/nylas-threads-search.d.ts +11 -0
  516. package/dist/components/nylas-threads-search.js +103 -0
  517. package/dist/components/nylas-threads-search.js.map +1 -0
  518. package/dist/components/nylas-timeslot-picker.d.ts +11 -0
  519. package/dist/components/nylas-timeslot-picker.js +8 -0
  520. package/dist/components/nylas-timeslot-picker.js.map +1 -0
  521. package/dist/components/nylas-timeslot-picker2.js +174 -0
  522. package/dist/components/nylas-timeslot-picker2.js.map +1 -0
  523. package/dist/components/nylas-view-email.d.ts +11 -0
  524. package/dist/components/nylas-view-email.js +8 -0
  525. package/dist/components/nylas-view-email.js.map +1 -0
  526. package/dist/components/nylas-view-email2.js +1859 -0
  527. package/dist/components/nylas-view-email2.js.map +1 -0
  528. package/dist/components/nylas-view-thread.d.ts +11 -0
  529. package/dist/components/nylas-view-thread.js +338 -0
  530. package/dist/components/nylas-view-thread.js.map +1 -0
  531. package/dist/components/people-icon.d.ts +11 -0
  532. package/dist/components/people-icon.js +8 -0
  533. package/dist/components/people-icon.js.map +1 -0
  534. package/dist/components/people.js +37 -0
  535. package/dist/components/people.js.map +1 -0
  536. package/dist/components/play-icon.d.ts +11 -0
  537. package/dist/components/play-icon.js +8 -0
  538. package/dist/components/play-icon.js.map +1 -0
  539. package/dist/components/play.js +37 -0
  540. package/dist/components/play.js.map +1 -0
  541. package/dist/components/property.js +36 -0
  542. package/dist/components/property.js.map +1 -0
  543. package/dist/components/refresh-icon.d.ts +11 -0
  544. package/dist/components/refresh-icon.js +8 -0
  545. package/dist/components/refresh-icon.js.map +1 -0
  546. package/dist/components/refresh.js +37 -0
  547. package/dist/components/refresh.js.map +1 -0
  548. package/dist/components/register-component.js +138 -0
  549. package/dist/components/register-component.js.map +1 -0
  550. package/dist/components/reply-all-icon.d.ts +11 -0
  551. package/dist/components/reply-all-icon.js +8 -0
  552. package/dist/components/reply-all-icon.js.map +1 -0
  553. package/dist/components/reply-all.js +37 -0
  554. package/dist/components/reply-all.js.map +1 -0
  555. package/dist/components/reply-icon.d.ts +11 -0
  556. package/dist/components/reply-icon.js +8 -0
  557. package/dist/components/reply-icon.js.map +1 -0
  558. package/dist/components/reply.js +37 -0
  559. package/dist/components/reply.js.map +1 -0
  560. package/dist/components/scheduler-store.js +251 -0
  561. package/dist/components/scheduler-store.js.map +1 -0
  562. package/dist/components/sent-icon.d.ts +11 -0
  563. package/dist/components/sent-icon.js +8 -0
  564. package/dist/components/sent-icon.js.map +1 -0
  565. package/dist/components/sent.js +37 -0
  566. package/dist/components/sent.js.map +1 -0
  567. package/dist/components/sp-icon-chevron-left.js +23 -0
  568. package/dist/components/sp-icon-chevron-left.js.map +1 -0
  569. package/dist/components/spam-icon.d.ts +11 -0
  570. package/dist/components/spam-icon.js +8 -0
  571. package/dist/components/spam-icon.js.map +1 -0
  572. package/dist/components/spam.js +37 -0
  573. package/dist/components/spam.js.map +1 -0
  574. package/dist/components/star-icon.d.ts +11 -0
  575. package/dist/components/star-icon.js +8 -0
  576. package/dist/components/star-icon.js.map +1 -0
  577. package/dist/components/star.js +37 -0
  578. package/dist/components/star.js.map +1 -0
  579. package/dist/components/stop-icon.d.ts +11 -0
  580. package/dist/components/stop-icon.js +8 -0
  581. package/dist/components/stop-icon.js.map +1 -0
  582. package/dist/components/stop.js +37 -0
  583. package/dist/components/stop.js.map +1 -0
  584. package/dist/components/translate-icon.d.ts +11 -0
  585. package/dist/components/translate-icon.js +8 -0
  586. package/dist/components/translate-icon.js.map +1 -0
  587. package/dist/components/translate.js +37 -0
  588. package/dist/components/translate.js.map +1 -0
  589. package/dist/components/trash-icon.d.ts +11 -0
  590. package/dist/components/trash-icon.js +8 -0
  591. package/dist/components/trash-icon.js.map +1 -0
  592. package/dist/components/trash.js +37 -0
  593. package/dist/components/trash.js.map +1 -0
  594. package/dist/components/underline-icon.d.ts +11 -0
  595. package/dist/components/underline-icon.js +8 -0
  596. package/dist/components/underline-icon.js.map +1 -0
  597. package/dist/components/underline.js +37 -0
  598. package/dist/components/underline.js.map +1 -0
  599. package/dist/components/utils.js +140 -0
  600. package/dist/components/utils.js.map +1 -0
  601. package/dist/components/warning-icon.d.ts +11 -0
  602. package/dist/components/warning-icon.js +8 -0
  603. package/dist/components/warning-icon.js.map +1 -0
  604. package/dist/components/warning.js +37 -0
  605. package/dist/components/warning.js.map +1 -0
  606. package/dist/esm/_commonjsHelpers-57e89916.js +20 -0
  607. package/dist/esm/_commonjsHelpers-57e89916.js.map +1 -0
  608. package/dist/esm/app-globals-47969cee.js +9 -0
  609. package/dist/esm/app-globals-47969cee.js.map +1 -0
  610. package/dist/esm/archive-icon_7.entry.js +110 -0
  611. package/dist/esm/archive-icon_7.entry.js.map +1 -0
  612. package/dist/esm/arrow-icon.entry.js +20 -0
  613. package/dist/esm/arrow-icon.entry.js.map +1 -0
  614. package/dist/esm/bold-icon_3.entry.js +50 -0
  615. package/dist/esm/bold-icon_3.entry.js.map +1 -0
  616. package/dist/esm/calendar-cancel-icon.entry.js +20 -0
  617. package/dist/esm/calendar-cancel-icon.entry.js.map +1 -0
  618. package/dist/esm/calendar-check-icon_3.entry.js +50 -0
  619. package/dist/esm/calendar-check-icon_3.entry.js.map +1 -0
  620. package/dist/esm/calendar-icon.entry.js +20 -0
  621. package/dist/esm/calendar-icon.entry.js.map +1 -0
  622. package/dist/esm/chevron-icon.entry.js +20 -0
  623. package/dist/esm/chevron-icon.entry.js.map +1 -0
  624. package/dist/esm/close-icon_2.entry.js +35 -0
  625. package/dist/esm/close-icon_2.entry.js.map +1 -0
  626. package/dist/esm/document-refresh-icon.entry.js +20 -0
  627. package/dist/esm/document-refresh-icon.entry.js.map +1 -0
  628. package/dist/esm/duration-bddc4a13.js +78 -0
  629. package/dist/esm/duration-bddc4a13.js.map +1 -0
  630. package/dist/esm/elements-60ebdb01.js +21583 -0
  631. package/dist/esm/elements-60ebdb01.js.map +1 -0
  632. package/dist/esm/flow-40ff9cea.js +888 -0
  633. package/dist/esm/flow-40ff9cea.js.map +1 -0
  634. package/dist/esm/focus-visible-e8093c16.js +325 -0
  635. package/dist/esm/focus-visible-e8093c16.js.map +1 -0
  636. package/dist/esm/forward-icon_6.entry.js +2207 -0
  637. package/dist/esm/forward-icon_6.entry.js.map +1 -0
  638. package/dist/esm/globe-icon.entry.js +20 -0
  639. package/dist/esm/globe-icon.entry.js.map +1 -0
  640. package/dist/esm/index-2b85580a.js +196 -0
  641. package/dist/esm/index-2b85580a.js.map +1 -0
  642. package/dist/esm/index-b2270b4a.js +2141 -0
  643. package/dist/esm/index-b2270b4a.js.map +1 -0
  644. package/dist/esm/index.es-6f3582a1.js +3211 -0
  645. package/dist/esm/index.es-6f3582a1.js.map +1 -0
  646. package/dist/esm/index.js +8 -0
  647. package/dist/esm/index.js.map +1 -0
  648. package/dist/esm/loader.js +13 -0
  649. package/dist/esm/loader.js.map +1 -0
  650. package/dist/esm/loading-icon.entry.js +20 -0
  651. package/dist/esm/loading-icon.entry.js.map +1 -0
  652. package/dist/esm/mailbox-store-0019772c.js +521 -0
  653. package/dist/esm/mailbox-store-0019772c.js.map +1 -0
  654. package/dist/esm/nylas-booked-event-card_9.entry.js +8115 -0
  655. package/dist/esm/nylas-booked-event-card_9.entry.js.map +1 -0
  656. package/dist/esm/nylas-if-state_3.entry.js +403 -0
  657. package/dist/esm/nylas-if-state_3.entry.js.map +1 -0
  658. package/dist/esm/nylas-list-folders.entry.js +116 -0
  659. package/dist/esm/nylas-list-folders.entry.js.map +1 -0
  660. package/dist/esm/nylas-list-threads.entry.js +85 -0
  661. package/dist/esm/nylas-list-threads.entry.js.map +1 -0
  662. package/dist/esm/nylas-mailbox-pagination.entry.js +136 -0
  663. package/dist/esm/nylas-mailbox-pagination.entry.js.map +1 -0
  664. package/dist/esm/nylas-mailbox-toolbar-button.entry.js +96 -0
  665. package/dist/esm/nylas-mailbox-toolbar-button.entry.js.map +1 -0
  666. package/dist/esm/nylas-open-hours-picker.entry.js +329 -0
  667. package/dist/esm/nylas-open-hours-picker.entry.js.map +1 -0
  668. package/dist/esm/nylas-provider.entry.js +180 -0
  669. package/dist/esm/nylas-provider.entry.js.map +1 -0
  670. package/dist/esm/nylas-scheduler.entry.js +238 -0
  671. package/dist/esm/nylas-scheduler.entry.js.map +1 -0
  672. package/dist/esm/nylas-threads-refresh.entry.js +114 -0
  673. package/dist/esm/nylas-threads-refresh.entry.js.map +1 -0
  674. package/dist/esm/nylas-threads-search.entry.js +80 -0
  675. package/dist/esm/nylas-threads-search.entry.js.map +1 -0
  676. package/dist/esm/nylas-view-thread.entry.js +230 -0
  677. package/dist/esm/nylas-view-thread.entry.js.map +1 -0
  678. package/dist/esm/nylas-web-elements.js +22 -0
  679. package/dist/esm/nylas-web-elements.js.map +1 -0
  680. package/dist/esm/play-icon_2.entry.js +35 -0
  681. package/dist/esm/play-icon_2.entry.js.map +1 -0
  682. package/dist/esm/polyfills/core-js.js +11 -0
  683. package/dist/esm/polyfills/dom.js +79 -0
  684. package/dist/esm/polyfills/es5-html-element.js +1 -0
  685. package/dist/esm/polyfills/index.js +34 -0
  686. package/dist/esm/polyfills/system.js +6 -0
  687. package/dist/esm/property-0065dde7.js +36 -0
  688. package/dist/esm/property-0065dde7.js.map +1 -0
  689. package/dist/esm/refresh-icon.entry.js +20 -0
  690. package/dist/esm/refresh-icon.entry.js.map +1 -0
  691. package/dist/esm/register-component-55376f31.js +138 -0
  692. package/dist/esm/register-component-55376f31.js.map +1 -0
  693. package/dist/esm/scheduler-store-5a39585a.js +251 -0
  694. package/dist/esm/scheduler-store-5a39585a.js.map +1 -0
  695. package/dist/esm/translate-icon.entry.js +20 -0
  696. package/dist/esm/translate-icon.entry.js.map +1 -0
  697. package/dist/esm/utils-5074a070.js +140 -0
  698. package/dist/esm/utils-5074a070.js.map +1 -0
  699. package/dist/index.cjs.js +1 -0
  700. package/dist/index.js +1 -0
  701. package/dist/nylas-web-elements/index.esm.js +2 -0
  702. package/dist/nylas-web-elements/index.esm.js.map +1 -0
  703. package/dist/nylas-web-elements/nylas-web-elements.css +239 -0
  704. package/dist/nylas-web-elements/nylas-web-elements.esm.js +2 -0
  705. package/dist/nylas-web-elements/nylas-web-elements.esm.js.map +1 -0
  706. package/dist/nylas-web-elements/p-06974d68.js +2 -0
  707. package/dist/nylas-web-elements/p-06974d68.js.map +1 -0
  708. package/dist/nylas-web-elements/p-113fe52e.entry.js +2 -0
  709. package/dist/nylas-web-elements/p-113fe52e.entry.js.map +1 -0
  710. package/dist/nylas-web-elements/p-16fb3c85.entry.js +2 -0
  711. package/dist/nylas-web-elements/p-16fb3c85.entry.js.map +1 -0
  712. package/dist/nylas-web-elements/p-24c42c37.entry.js +2 -0
  713. package/dist/nylas-web-elements/p-24c42c37.entry.js.map +1 -0
  714. package/dist/nylas-web-elements/p-2881b62f.js +16519 -0
  715. package/dist/nylas-web-elements/p-2881b62f.js.map +1 -0
  716. package/dist/nylas-web-elements/p-33da6cf1.entry.js +2 -0
  717. package/dist/nylas-web-elements/p-33da6cf1.entry.js.map +1 -0
  718. package/dist/nylas-web-elements/p-37f99b96.entry.js +2 -0
  719. package/dist/nylas-web-elements/p-37f99b96.entry.js.map +1 -0
  720. package/dist/nylas-web-elements/p-3bc3426e.entry.js +2 -0
  721. package/dist/nylas-web-elements/p-3bc3426e.entry.js.map +1 -0
  722. package/dist/nylas-web-elements/p-3c8822f1.entry.js +2 -0
  723. package/dist/nylas-web-elements/p-3c8822f1.entry.js.map +1 -0
  724. package/dist/nylas-web-elements/p-5770704d.js +2 -0
  725. package/dist/nylas-web-elements/p-5770704d.js.map +1 -0
  726. package/dist/nylas-web-elements/p-5862975b.js +2 -0
  727. package/dist/nylas-web-elements/p-5862975b.js.map +1 -0
  728. package/dist/nylas-web-elements/p-647cf7be.entry.js +2 -0
  729. package/dist/nylas-web-elements/p-647cf7be.entry.js.map +1 -0
  730. package/dist/nylas-web-elements/p-663edeb8.entry.js +2 -0
  731. package/dist/nylas-web-elements/p-663edeb8.entry.js.map +1 -0
  732. package/dist/nylas-web-elements/p-67c9158e.entry.js +2 -0
  733. package/dist/nylas-web-elements/p-67c9158e.entry.js.map +1 -0
  734. package/dist/nylas-web-elements/p-6ba7a037.js +2 -0
  735. package/dist/nylas-web-elements/p-6ba7a037.js.map +1 -0
  736. package/dist/nylas-web-elements/p-6da0b8f0.entry.js +2 -0
  737. package/dist/nylas-web-elements/p-6da0b8f0.entry.js.map +1 -0
  738. package/dist/nylas-web-elements/p-6df00ba0.js +27 -0
  739. package/dist/nylas-web-elements/p-6df00ba0.js.map +1 -0
  740. package/dist/nylas-web-elements/p-74141ef6.entry.js +2 -0
  741. package/dist/nylas-web-elements/p-74141ef6.entry.js.map +1 -0
  742. package/dist/nylas-web-elements/p-85d41197.entry.js +2 -0
  743. package/dist/nylas-web-elements/p-85d41197.entry.js.map +1 -0
  744. package/dist/nylas-web-elements/p-97518578.entry.js +2 -0
  745. package/dist/nylas-web-elements/p-97518578.entry.js.map +1 -0
  746. package/dist/nylas-web-elements/p-98ec4a7a.js +2 -0
  747. package/dist/nylas-web-elements/p-98ec4a7a.js.map +1 -0
  748. package/dist/nylas-web-elements/p-998d25d5.entry.js +2 -0
  749. package/dist/nylas-web-elements/p-998d25d5.entry.js.map +1 -0
  750. package/dist/nylas-web-elements/p-a7bfd3af.entry.js +77 -0
  751. package/dist/nylas-web-elements/p-a7bfd3af.entry.js.map +1 -0
  752. package/dist/nylas-web-elements/p-a95208c7.js +2 -0
  753. package/dist/nylas-web-elements/p-a95208c7.js.map +1 -0
  754. package/dist/nylas-web-elements/p-adacdaeb.entry.js +2 -0
  755. package/dist/nylas-web-elements/p-adacdaeb.entry.js.map +1 -0
  756. package/dist/nylas-web-elements/p-b7d4b7b5.entry.js +2 -0
  757. package/dist/nylas-web-elements/p-b7d4b7b5.entry.js.map +1 -0
  758. package/dist/nylas-web-elements/p-b85dfeac.entry.js +2 -0
  759. package/dist/nylas-web-elements/p-b85dfeac.entry.js.map +1 -0
  760. package/dist/nylas-web-elements/p-b96b37f1.entry.js +2 -0
  761. package/dist/nylas-web-elements/p-b96b37f1.entry.js.map +1 -0
  762. package/dist/nylas-web-elements/p-c2e69618.entry.js +2 -0
  763. package/dist/nylas-web-elements/p-c2e69618.entry.js.map +1 -0
  764. package/dist/nylas-web-elements/p-c440f148.entry.js +2 -0
  765. package/dist/nylas-web-elements/p-c440f148.entry.js.map +1 -0
  766. package/dist/nylas-web-elements/p-c66e27d0.js +3 -0
  767. package/dist/nylas-web-elements/p-c66e27d0.js.map +1 -0
  768. package/dist/nylas-web-elements/p-c685e944.entry.js +3 -0
  769. package/dist/nylas-web-elements/p-c685e944.entry.js.map +1 -0
  770. package/dist/nylas-web-elements/p-cb65c223.js +2 -0
  771. package/dist/nylas-web-elements/p-cb65c223.js.map +1 -0
  772. package/dist/nylas-web-elements/p-cc21d351.js +17 -0
  773. package/dist/nylas-web-elements/p-cc21d351.js.map +1 -0
  774. package/dist/nylas-web-elements/p-d4b1e3e4.entry.js +2 -0
  775. package/dist/nylas-web-elements/p-d4b1e3e4.entry.js.map +1 -0
  776. package/dist/nylas-web-elements/p-db24cc70.entry.js +2 -0
  777. package/dist/nylas-web-elements/p-db24cc70.entry.js.map +1 -0
  778. package/dist/nylas-web-elements/p-de1bcc4a.js +2 -0
  779. package/dist/nylas-web-elements/p-de1bcc4a.js.map +1 -0
  780. package/dist/nylas-web-elements/p-df9f71ea.js +2 -0
  781. package/dist/nylas-web-elements/p-df9f71ea.js.map +1 -0
  782. package/dist/nylas-web-elements/p-eeb0a591.js +2 -0
  783. package/dist/nylas-web-elements/p-eeb0a591.js.map +1 -0
  784. package/dist/nylas-web-elements/p-f029c1b7.entry.js +2 -0
  785. package/dist/nylas-web-elements/p-f029c1b7.entry.js.map +1 -0
  786. package/dist/nylas-web-elements/p-f9a4758a.entry.js +2 -0
  787. package/dist/nylas-web-elements/p-f9a4758a.entry.js.map +1 -0
  788. package/dist/types/common/abstract-provider.d.ts +52 -0
  789. package/dist/types/common/component-types.d.ts +22 -0
  790. package/dist/types/common/constants.d.ts +6 -0
  791. package/dist/types/common/global.d.ts +1 -0
  792. package/dist/types/common/icons/archive.d.ts +5 -0
  793. package/dist/types/common/icons/arrow.d.ts +5 -0
  794. package/dist/types/common/icons/bold.d.ts +5 -0
  795. package/dist/types/common/icons/calendar-cancel.d.ts +5 -0
  796. package/dist/types/common/icons/calendar-check.d.ts +5 -0
  797. package/dist/types/common/icons/calendar.d.ts +5 -0
  798. package/dist/types/common/icons/checkmark-circle.d.ts +5 -0
  799. package/dist/types/common/icons/chevron.d.ts +5 -0
  800. package/dist/types/common/icons/close.d.ts +5 -0
  801. package/dist/types/common/icons/document-refresh.d.ts +5 -0
  802. package/dist/types/common/icons/folder.d.ts +5 -0
  803. package/dist/types/common/icons/forward.d.ts +5 -0
  804. package/dist/types/common/icons/globe.d.ts +5 -0
  805. package/dist/types/common/icons/inbox.d.ts +5 -0
  806. package/dist/types/common/icons/italic.d.ts +5 -0
  807. package/dist/types/common/icons/loading.d.ts +5 -0
  808. package/dist/types/common/icons/nylas-logo.d.ts +5 -0
  809. package/dist/types/common/icons/people.d.ts +5 -0
  810. package/dist/types/common/icons/play.d.ts +5 -0
  811. package/dist/types/common/icons/refresh.d.ts +5 -0
  812. package/dist/types/common/icons/reply-all.d.ts +5 -0
  813. package/dist/types/common/icons/reply.d.ts +5 -0
  814. package/dist/types/common/icons/sent.d.ts +5 -0
  815. package/dist/types/common/icons/spam.d.ts +5 -0
  816. package/dist/types/common/icons/star.d.ts +5 -0
  817. package/dist/types/common/icons/stop.d.ts +5 -0
  818. package/dist/types/common/icons/translate.d.ts +5 -0
  819. package/dist/types/common/icons/trash.d.ts +5 -0
  820. package/dist/types/common/icons/underline.d.ts +5 -0
  821. package/dist/types/common/icons/warning.d.ts +5 -0
  822. package/dist/types/common/mocks/threads.d.ts +3 -0
  823. package/dist/types/common/nylas-theme/index.d.ts +27 -0
  824. package/dist/types/common/register-component.d.ts +29 -0
  825. package/dist/types/common/types.d.ts +108 -0
  826. package/dist/types/components/mailbox/nylas-composer/nylas-composer.d.ts +22 -0
  827. package/dist/types/components/mailbox/nylas-composer/test/nylas-composer.spec-disabled.d.ts +1 -0
  828. package/dist/types/components/mailbox/nylas-list-folders/nylas-list-folders.d.ts +19 -0
  829. package/dist/types/components/mailbox/nylas-list-threads/nylas-list-threads.d.ts +19 -0
  830. package/dist/types/components/mailbox/nylas-mailbox/nylas-mailbox.d.ts +35 -0
  831. package/dist/types/components/mailbox/nylas-mailbox-pagination/nylas-mailbox-pagination.d.ts +30 -0
  832. package/dist/types/components/mailbox/nylas-mailbox-toolbar-button/nylas-mailbox-toolbar-button.d.ts +26 -0
  833. package/dist/types/components/mailbox/nylas-summarize-message-button/nylas-summarize-message-button.d.ts +25 -0
  834. package/dist/types/components/mailbox/nylas-threads-refresh/nylas-threads-refresh.d.ts +23 -0
  835. package/dist/types/components/mailbox/nylas-threads-search/nylas-threads-search.d.ts +13 -0
  836. package/dist/types/components/mailbox/nylas-view-email/nylas-view-email.d.ts +25 -0
  837. package/dist/types/components/mailbox/nylas-view-thread/nylas-view-thread.d.ts +30 -0
  838. package/dist/types/components/mailbox/nylas-view-thread/view-thread-message.d.ts +12 -0
  839. package/dist/types/components/nylas-if-state/nylas-if-state.d.ts +22 -0
  840. package/dist/types/components/nylas-login/nylas-login.d.ts +26 -0
  841. package/dist/types/components/nylas-provider/nylas-provider.d.ts +35 -0
  842. package/dist/types/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.d.ts +22 -0
  843. package/dist/types/components/scheduler/nylas-booking-form/nylas-booking-form.d.ts +33 -0
  844. package/dist/types/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.d.ts +13 -0
  845. package/dist/types/components/scheduler/nylas-date-picker/nylas-date-picker.d.ts +19 -0
  846. package/dist/types/components/scheduler/nylas-locale-switch/nylas-locale-switch.d.ts +13 -0
  847. package/dist/types/components/scheduler/nylas-notification/nylas-notification.d.ts +13 -0
  848. package/dist/types/components/scheduler/nylas-open-hours-picker/nylas-open-hours-picker.d.ts +40 -0
  849. package/dist/types/components/scheduler/nylas-scheduler/nylas-scheduler.d.ts +41 -0
  850. package/dist/types/components/scheduler/nylas-scheduler/scheduler-view.d.ts +6 -0
  851. package/dist/types/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.d.ts +15 -0
  852. package/dist/types/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.d.ts +28 -0
  853. package/dist/types/components.d.ts +2123 -0
  854. package/dist/types/connector/connector-interface.d.ts +35 -0
  855. package/dist/types/connector/nylas-connector/index.d.ts +59 -0
  856. package/dist/types/connector/nylas-mailbox-connector/index.d.ts +52 -0
  857. package/dist/types/connector/nylas-scheduler-connector/index.d.ts +24 -0
  858. package/dist/types/connector/shared/api/auth.d.ts +13 -0
  859. package/dist/types/connector/shared/api/folders.d.ts +10 -0
  860. package/dist/types/connector/shared/api/messages.d.ts +13 -0
  861. package/dist/types/connector/shared/api/scheduler.d.ts +29 -0
  862. package/dist/types/connector/shared/api/threads.d.ts +20 -0
  863. package/dist/types/index.d.ts +4 -0
  864. package/dist/types/routers/hash-router.d.ts +21 -0
  865. package/dist/types/routers/router-interface.d.ts +16 -0
  866. package/dist/types/stencil-public-runtime.d.ts +1681 -0
  867. package/dist/types/stores/auth-store.d.ts +9 -0
  868. package/dist/types/stores/mailbox-store.d.ts +19 -0
  869. package/dist/types/stores/scheduler-store.d.ts +32 -0
  870. package/dist/types/utils/color-utils.d.ts +9 -0
  871. package/dist/types/utils/utils.d.ts +28 -0
  872. package/loader/cdn.js +3 -0
  873. package/loader/index.cjs.js +3 -0
  874. package/loader/index.d.ts +21 -0
  875. package/loader/index.es2017.js +3 -0
  876. package/loader/index.js +4 -0
  877. package/loader/package.json +11 -0
  878. package/package.json +69 -0
  879. package/readme.md +42 -0
@@ -0,0 +1,3217 @@
1
+ 'use strict';
2
+
3
+ const utils = require('./utils-f91d4c73.js');
4
+
5
+ class NylasAbstractProvider {
6
+ constructor(host, stores, automaticComponentRegistration = true, eventOverrides) {
7
+ this.automaticComponentRegistration = true;
8
+ this.registeredComponents = {};
9
+ this.propStateRegistrations = new Map();
10
+ this.eventListenerRegistrations = new Map();
11
+ this.host = host;
12
+ this.stores = stores;
13
+ this.automaticComponentRegistration = automaticComponentRegistration;
14
+ this.eventOverrides = eventOverrides;
15
+ utils.debug(`[${this.hostTagName}] Initializing (abstract) provider.`, { eventOverrides });
16
+ this.registerComponent = this.registerComponent.bind(this);
17
+ this.getStore = this.getStore.bind(this);
18
+ Object.keys(this.stores).forEach(storeName => {
19
+ this.propStateRegistrations.set(storeName, new Map());
20
+ });
21
+ }
22
+ async componentWillLoad(nylasConnector) {
23
+ utils.debug(`[${this.hostTagName}] Will load`);
24
+ this.setupStoreListeners();
25
+ this.nylasConnector = nylasConnector;
26
+ const childComponents = Array.from(this.host.querySelectorAll('*')).filter(child => child.tagName.toLowerCase().startsWith('nylas-'));
27
+ utils.debug(`[${this.hostTagName}] Found ${childComponents.length} child component(s).`, { childComponents });
28
+ childComponents.forEach(child => {
29
+ const component = child;
30
+ if (!component) {
31
+ utils.debug(`[~${this.hostTagName}] Component ${component.tagName} does not have a name. Skipping.`);
32
+ return;
33
+ }
34
+ if (!component.registerNylasComponent) {
35
+ utils.debug(`[~${this.hostTagName}] Component ${component.tagName} is not a component that can be registered. Skipping.`, { component });
36
+ return;
37
+ }
38
+ const registeredComponent = {
39
+ element: component,
40
+ name: component.tagName.toLowerCase(),
41
+ getStoresToProp: component.getStoresToProp,
42
+ storeToProps: component.storeToProps,
43
+ stateToProps: component.stateToProps,
44
+ authToProp: component.authToProp,
45
+ eventToProps: component.eventToProps,
46
+ connectorToProp: component.connectorToProp,
47
+ };
48
+ this.registerComponent(registeredComponent);
49
+ });
50
+ }
51
+ async componentDidLoad() {
52
+ utils.debug(`[${this.hostTagName}] Did load`);
53
+ }
54
+ async componentDisconnected() {
55
+ Object.values(this.stores).forEach(store => {
56
+ store.dispose();
57
+ });
58
+ }
59
+ async registerComponentHandler(event) {
60
+ event.stopPropagation();
61
+ if (!this.automaticComponentRegistration) {
62
+ utils.debug(`[${this.hostTagName}] Automatic component registration disabled. Skipping registration of ${event.detail.name}.`);
63
+ return;
64
+ }
65
+ this.registerComponent(event.detail);
66
+ }
67
+ async unregisterComponentHandler(event) {
68
+ event.stopPropagation();
69
+ if (!this.automaticComponentRegistration) {
70
+ utils.debug(`[${this.hostTagName}] Automatic component registration disabled. Skipping unregistration of ${event.detail.name}.`);
71
+ return;
72
+ }
73
+ this.unregisterComponent(event.detail);
74
+ }
75
+ registerComponent(component) {
76
+ utils.debug(`[${this.hostTagName}] Registering component ${component.name}.`);
77
+ const elementId = component.element.dataset.nylasId;
78
+ if (elementId && this.registeredComponents[elementId]) {
79
+ utils.debug(`[${this.hostTagName}] Component ${component.name} already registered. Skipping.`);
80
+ return;
81
+ }
82
+ const { stateToProps, getStoresToProp, eventToProps, storeToProps, connectorToProp, element } = component;
83
+ element.dataset.nylasId = utils.uniqueID();
84
+ this.registeredComponents[element.dataset.nylasId] = component;
85
+ const eventOverrides = this.eventOverrides;
86
+ eventToProps?.forEach((customEventHandler, propKey) => {
87
+ const nylasConnector = this.nylasConnector;
88
+ const handler = async (event) => {
89
+ utils.debug(`[${this.hostTagName}] Handling "${component.name}" prop "${String(propKey)}" event.`, { eventOverrides });
90
+ if (propKey in eventOverrides) {
91
+ utils.debug(`[${this.hostTagName}] Found event override for "${String(propKey)}" event. Calling override.`);
92
+ await eventOverrides[propKey](event, nylasConnector);
93
+ }
94
+ if (!event.defaultPrevented) {
95
+ await customEventHandler(event, nylasConnector);
96
+ }
97
+ return;
98
+ };
99
+ const elementId = component.element.dataset.nylasId;
100
+ if (elementId && !this.eventListenerRegistrations.has(elementId)) {
101
+ this.eventListenerRegistrations.set(elementId, []);
102
+ }
103
+ if (elementId) {
104
+ this.eventListenerRegistrations.get(elementId)?.push([element, propKey, handler]);
105
+ }
106
+ utils.debug(`[${this.hostTagName}] Setting "${component.name}" event "${String(propKey)}" to automcially call NylasConnector method.`);
107
+ const eventName = utils.formatEventName(propKey.toString());
108
+ utils.debug(`[${this.hostTagName}] Adding event listener for "${eventName}" on "${element.tagName}"`);
109
+ element.addEventListener(eventName, handler);
110
+ });
111
+ stateToProps?.forEach((propKey, stateKey) => {
112
+ const [storeName, stateName] = stateKey.split('.');
113
+ const store = this.getStore(storeName);
114
+ const stateValue = store.state[stateName];
115
+ if (!element.dataset.nylasId) {
116
+ utils.debug(`[${this.hostTagName}] Component "${component.name}" not registered. Skipping.`, { component });
117
+ return;
118
+ }
119
+ if (!this.propStateRegistrations.has(storeName)) {
120
+ this.propStateRegistrations.set(storeName, new Map());
121
+ }
122
+ if (!this.propStateRegistrations.get(storeName)?.has(stateName)) {
123
+ this.propStateRegistrations.get(storeName)?.set(stateName, [
124
+ {
125
+ elementId: element.dataset.nylasId,
126
+ propKey,
127
+ },
128
+ ]);
129
+ }
130
+ else {
131
+ this.propStateRegistrations
132
+ .get(storeName)
133
+ ?.get(stateName)
134
+ ?.push({
135
+ elementId: element.dataset.nylasId,
136
+ propKey,
137
+ });
138
+ }
139
+ element[propKey.toString()] = stateValue;
140
+ utils.debug(`[${this.hostTagName}] Setting "${component.name}" prop "${propKey.toString()}" to "${stateKey}" value.`, { stateValue });
141
+ });
142
+ if (getStoresToProp) {
143
+ element[getStoresToProp?.toString()] = this.getStore;
144
+ utils.debug(`[${this.hostTagName}] Setting "${component.name}" prop "${getStoresToProp.toString()}" to "getStore" method.`);
145
+ }
146
+ storeToProps?.forEach((propKey, storeKey) => {
147
+ const store = this.getStore(storeKey);
148
+ element[propKey.toString()] = store;
149
+ utils.debug(`[${this.hostTagName}] Setting "${component.name}" prop "${propKey.toString()}" to "${storeKey}" store.`, { store });
150
+ });
151
+ if (connectorToProp) {
152
+ element[connectorToProp?.toString()] = this.nylasConnector;
153
+ utils.debug(`[${this.hostTagName}] Setting "${component.name}" prop "${connectorToProp.toString()}" to "nylasConnector" value.`, { connectorToProp });
154
+ }
155
+ utils.debug(`[${this.hostTagName}] Component ${component.name} registered.`);
156
+ }
157
+ unregisterComponent(component) {
158
+ utils.debug(`[${this.hostTagName}] Unregistering component ${component.name}.`);
159
+ const elementId = component.element.dataset.nylasId;
160
+ if (!elementId) {
161
+ utils.debug(`[${this.hostTagName}] Component ${component.name} not registered. Skipping.`);
162
+ return;
163
+ }
164
+ if (this.registeredComponents[elementId]) {
165
+ utils.debug(`[${this.hostTagName}] Component ${component.name} not registered. Skipping.`);
166
+ return;
167
+ }
168
+ this.propStateRegistrations.forEach((stateToProps, storeName) => {
169
+ stateToProps.forEach((_, stateKey) => {
170
+ const props = this.propStateRegistrations.get(storeName)?.get(stateKey);
171
+ const filteredProps = props?.filter(prop => prop.elementId !== elementId);
172
+ if (filteredProps) {
173
+ this.propStateRegistrations.get(storeName)?.set(stateKey, filteredProps);
174
+ }
175
+ });
176
+ });
177
+ const eventListenerRegistrations = this.eventListenerRegistrations.get(elementId);
178
+ eventListenerRegistrations?.forEach(([element, propKey, handler]) => {
179
+ const eventName = utils.formatEventName(propKey.toString());
180
+ utils.debug(`[${this.hostTagName}] Removing event listener for "${eventName}" on "${element.tagName}"`);
181
+ element.removeEventListener(eventName, handler);
182
+ });
183
+ delete this.registeredComponents[elementId];
184
+ }
185
+ getStore(name) {
186
+ const store = this.stores[name];
187
+ if (!store) {
188
+ throw new Error(`[${this.hostTagName}] Store "${name.toString()}" not found.`);
189
+ }
190
+ return store;
191
+ }
192
+ async setupStoreListeners() {
193
+ const self = this;
194
+ Object.entries(this.stores).forEach(([storeName, store]) => {
195
+ utils.debug(`[${self.hostTagName}] Listening for changes in "${storeName}" store.`);
196
+ store.use({
197
+ set(stateKey, newValue, oldValue) {
198
+ utils.debug(`[${self.hostTagName}] Store "${storeName}" state "${stateKey.toString()}" changed`, { newValue, oldValue });
199
+ if (newValue === oldValue) {
200
+ utils.debug(`[${self.hostTagName}] Store "${storeName}" state "${stateKey.toString()}" unchanged. Skipping.`);
201
+ return;
202
+ }
203
+ const registeredComponents = self.registeredComponents;
204
+ if (!registeredComponents) {
205
+ utils.debug(`[${self.hostTagName}] No registered components found. Skipping.`);
206
+ return;
207
+ }
208
+ const props = self.propStateRegistrations.get(storeName)?.get(stateKey.toString()) || [];
209
+ utils.debug(`[${self.hostTagName}] Found ${props.length} prop(s) registered for "${stateKey.toString()}" store.`, {
210
+ props,
211
+ propStateRegistrations: self.propStateRegistrations,
212
+ });
213
+ props.forEach(({ elementId, propKey }) => {
214
+ const component = registeredComponents[elementId];
215
+ if (!component) {
216
+ utils.debug(`[${self.hostTagName}] Component "${elementId}" not found. Skipping.`, { component });
217
+ return;
218
+ }
219
+ const loadedStore = self.getStore(storeName);
220
+ const stateValue = loadedStore.state[stateKey];
221
+ component.element[propKey.toString()] = stateValue;
222
+ utils.debug(`[${self.hostTagName}] Setting "${component.name}" prop "${propKey.toString()}" to "${stateKey.toString()}" value.`, { stateValue });
223
+ });
224
+ },
225
+ });
226
+ });
227
+ }
228
+ get hostTagName() {
229
+ return this.host?.tagName?.toLowerCase() ?? 'nylas-provider';
230
+ }
231
+ }
232
+ class NylasBaseProvider extends NylasAbstractProvider {
233
+ }
234
+
235
+ var er = Object.defineProperty;
236
+ var tr = (t, e, n) => e in t ? er(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
237
+ var Oe = (t, e, n) => (tr(t, typeof e != "symbol" ? e + "" : e, n), n);
238
+ var nr = /* @__PURE__ */ ((t) => (t.Error = "error", t.Warning = "warning", t.Info = "info", t.Success = "success", t))(nr || {});
239
+ const Xr = (t) => "error" in t;
240
+ class Zr extends Error {
241
+ constructor(n) {
242
+ super(n == null ? void 0 : n.message);
243
+ Oe(this, "apiError");
244
+ this.name = "NylasAPIError", this.stack = new Error().stack, this.apiError = n;
245
+ }
246
+ }
247
+ async function ln(t) {
248
+ const n = new TextEncoder().encode(t), r = await crypto.subtle.digest("SHA-256", n), i = Array.from(new Uint8Array(r)).map((u) => u.toString(16).padStart(2, "0")).join("");
249
+ return btoa(i).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
250
+ }
251
+ const I = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, B = Object.keys, M = Array.isArray;
252
+ function U(t, e) {
253
+ return typeof e != "object" || B(e).forEach(function(n) {
254
+ t[n] = e[n];
255
+ }), t;
256
+ }
257
+ typeof Promise > "u" || I.Promise || (I.Promise = Promise);
258
+ const Fe = Object.getPrototypeOf, rr = {}.hasOwnProperty;
259
+ function W(t, e) {
260
+ return rr.call(t, e);
261
+ }
262
+ function Pe(t, e) {
263
+ typeof e == "function" && (e = e(Fe(t))), (typeof Reflect > "u" ? B : Reflect.ownKeys)(e).forEach((n) => {
264
+ Z(t, n, e[n]);
265
+ });
266
+ }
267
+ const xn = Object.defineProperty;
268
+ function Z(t, e, n, r) {
269
+ xn(t, e, U(n && W(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, r));
270
+ }
271
+ function ke(t) {
272
+ return { from: function(e) {
273
+ return t.prototype = Object.create(e.prototype), Z(t.prototype, "constructor", t), { extend: Pe.bind(null, t.prototype) };
274
+ } };
275
+ }
276
+ const sr = Object.getOwnPropertyDescriptor;
277
+ function Jt(t, e) {
278
+ let n;
279
+ return sr(t, e) || (n = Fe(t)) && Jt(n, e);
280
+ }
281
+ const ir = [].slice;
282
+ function ut(t, e, n) {
283
+ return ir.call(t, e, n);
284
+ }
285
+ function En(t, e) {
286
+ return e(t);
287
+ }
288
+ function Ie(t) {
289
+ if (!t)
290
+ throw new Error("Assertion Failed");
291
+ }
292
+ function Pn(t) {
293
+ I.setImmediate ? setImmediate(t) : setTimeout(t, 0);
294
+ }
295
+ function An(t, e) {
296
+ return t.reduce((n, r, s) => {
297
+ var i = e(r, s);
298
+ return i && (n[i[0]] = i[1]), n;
299
+ }, {});
300
+ }
301
+ function ee(t, e) {
302
+ if (W(t, e))
303
+ return t[e];
304
+ if (!e)
305
+ return t;
306
+ if (typeof e != "string") {
307
+ for (var n = [], r = 0, s = e.length; r < s; ++r) {
308
+ var i = ee(t, e[r]);
309
+ n.push(i);
310
+ }
311
+ return n;
312
+ }
313
+ var o = e.indexOf(".");
314
+ if (o !== -1) {
315
+ var u = t[e.substr(0, o)];
316
+ return u === void 0 ? void 0 : ee(u, e.substr(o + 1));
317
+ }
318
+ }
319
+ function z(t, e, n) {
320
+ if (t && e !== void 0 && (!("isFrozen" in Object) || !Object.isFrozen(t)))
321
+ if (typeof e != "string" && "length" in e) {
322
+ Ie(typeof n != "string" && "length" in n);
323
+ for (var r = 0, s = e.length; r < s; ++r)
324
+ z(t, e[r], n[r]);
325
+ } else {
326
+ var i = e.indexOf(".");
327
+ if (i !== -1) {
328
+ var o = e.substr(0, i), u = e.substr(i + 1);
329
+ if (u === "")
330
+ n === void 0 ? M(t) && !isNaN(parseInt(o)) ? t.splice(o, 1) : delete t[o] : t[o] = n;
331
+ else {
332
+ var a = t[o];
333
+ a && W(t, o) || (a = t[o] = {}), z(a, u, n);
334
+ }
335
+ } else
336
+ n === void 0 ? M(t) && !isNaN(parseInt(e)) ? t.splice(e, 1) : delete t[e] : t[e] = n;
337
+ }
338
+ }
339
+ function Sn(t) {
340
+ var e = {};
341
+ for (var n in t)
342
+ W(t, n) && (e[n] = t[n]);
343
+ return e;
344
+ }
345
+ const or = [].concat;
346
+ function Kn(t) {
347
+ return or.apply([], t);
348
+ }
349
+ const On = "Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(Kn([8, 16, 32, 64].map((t) => ["Int", "Uint", "Float"].map((e) => e + t + "Array")))).filter((t) => I[t]), ar = On.map((t) => I[t]);
350
+ An(On, (t) => [t, !0]);
351
+ let re = null;
352
+ function We(t) {
353
+ re = typeof WeakMap < "u" && /* @__PURE__ */ new WeakMap();
354
+ const e = At(t);
355
+ return re = null, e;
356
+ }
357
+ function At(t) {
358
+ if (!t || typeof t != "object")
359
+ return t;
360
+ let e = re && re.get(t);
361
+ if (e)
362
+ return e;
363
+ if (M(t)) {
364
+ e = [], re && re.set(t, e);
365
+ for (var n = 0, r = t.length; n < r; ++n)
366
+ e.push(At(t[n]));
367
+ } else if (ar.indexOf(t.constructor) >= 0)
368
+ e = t;
369
+ else {
370
+ const i = Fe(t);
371
+ for (var s in e = i === Object.prototype ? {} : Object.create(i), re && re.set(t, e), t)
372
+ W(t, s) && (e[s] = At(t[s]));
373
+ }
374
+ return e;
375
+ }
376
+ const { toString: ur } = {};
377
+ function St(t) {
378
+ return ur.call(t).slice(8, -1);
379
+ }
380
+ const Kt = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", cr = typeof Kt == "symbol" ? function(t) {
381
+ var e;
382
+ return t != null && (e = t[Kt]) && e.apply(t);
383
+ } : function() {
384
+ return null;
385
+ }, _e = {};
386
+ function J(t) {
387
+ var e, n, r, s;
388
+ if (arguments.length === 1) {
389
+ if (M(t))
390
+ return t.slice();
391
+ if (this === _e && typeof t == "string")
392
+ return [t];
393
+ if (s = cr(t)) {
394
+ for (n = []; !(r = s.next()).done; )
395
+ n.push(r.value);
396
+ return n;
397
+ }
398
+ if (t == null)
399
+ return [t];
400
+ if (typeof (e = t.length) == "number") {
401
+ for (n = new Array(e); e--; )
402
+ n[e] = t[e];
403
+ return n;
404
+ }
405
+ return [t];
406
+ }
407
+ for (e = arguments.length, n = new Array(e); e--; )
408
+ n[e] = arguments[e];
409
+ return n;
410
+ }
411
+ const Xt = typeof Symbol < "u" ? (t) => t[Symbol.toStringTag] === "AsyncFunction" : () => !1;
412
+ var Y = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
413
+ function Cn(t, e) {
414
+ Y = t, In = e;
415
+ }
416
+ var In = () => !0;
417
+ const lr = !new Error("").stack;
418
+ function me() {
419
+ if (lr)
420
+ try {
421
+ throw new Error();
422
+ } catch (t) {
423
+ return t;
424
+ }
425
+ return new Error();
426
+ }
427
+ function Ot(t, e) {
428
+ var n = t.stack;
429
+ return n ? (e = e || 0, n.indexOf(t.name) === 0 && (e += (t.name + t.message).split(`
430
+ `).length), n.split(`
431
+ `).slice(e).filter(In).map((r) => `
432
+ ` + r).join("")) : "";
433
+ }
434
+ var jn = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], Zt = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(jn), hr = { VersionChanged: "Database version changed by other database connection", DatabaseClosed: "Database has been closed", Abort: "Transaction aborted", TransactionInactive: "Transaction has already completed or failed", MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb" };
435
+ function xe(t, e) {
436
+ this._e = me(), this.name = t, this.message = e;
437
+ }
438
+ function Tn(t, e) {
439
+ return t + ". Errors: " + Object.keys(e).map((n) => e[n].toString()).filter((n, r, s) => s.indexOf(n) === r).join(`
440
+ `);
441
+ }
442
+ function ct(t, e, n, r) {
443
+ this._e = me(), this.failures = e, this.failedKeys = r, this.successCount = n, this.message = Tn(t, e);
444
+ }
445
+ function Te(t, e) {
446
+ this._e = me(), this.name = "BulkError", this.failures = Object.keys(e).map((n) => e[n]), this.failuresByPos = e, this.message = Tn(t, e);
447
+ }
448
+ ke(xe).from(Error).extend({ stack: { get: function() {
449
+ return this._stack || (this._stack = this.name + ": " + this.message + Ot(this._e, 2));
450
+ } }, toString: function() {
451
+ return this.name + ": " + this.message;
452
+ } }), ke(ct).from(xe), ke(Te).from(xe);
453
+ var en = Zt.reduce((t, e) => (t[e] = e + "Error", t), {});
454
+ const dr = xe;
455
+ var S = Zt.reduce((t, e) => {
456
+ var n = e + "Error";
457
+ function r(s, i) {
458
+ this._e = me(), this.name = n, s ? typeof s == "string" ? (this.message = `${s}${i ? `
459
+ ` + i : ""}`, this.inner = i || null) : typeof s == "object" && (this.message = `${s.name} ${s.message}`, this.inner = s) : (this.message = hr[e] || n, this.inner = null);
460
+ }
461
+ return ke(r).from(dr), t[e] = r, t;
462
+ }, {});
463
+ S.Syntax = SyntaxError, S.Type = TypeError, S.Range = RangeError;
464
+ var hn = jn.reduce((t, e) => (t[e + "Error"] = S[e], t), {}), tt = Zt.reduce((t, e) => (["Syntax", "Type", "Range"].indexOf(e) === -1 && (t[e + "Error"] = S[e]), t), {});
465
+ function C() {
466
+ }
467
+ function Me(t) {
468
+ return t;
469
+ }
470
+ function fr(t, e) {
471
+ return t == null || t === Me ? e : function(n) {
472
+ return e(t(n));
473
+ };
474
+ }
475
+ function pe(t, e) {
476
+ return function() {
477
+ t.apply(this, arguments), e.apply(this, arguments);
478
+ };
479
+ }
480
+ function pr(t, e) {
481
+ return t === C ? e : function() {
482
+ var n = t.apply(this, arguments);
483
+ n !== void 0 && (arguments[0] = n);
484
+ var r = this.onsuccess, s = this.onerror;
485
+ this.onsuccess = null, this.onerror = null;
486
+ var i = e.apply(this, arguments);
487
+ return r && (this.onsuccess = this.onsuccess ? pe(r, this.onsuccess) : r), s && (this.onerror = this.onerror ? pe(s, this.onerror) : s), i !== void 0 ? i : n;
488
+ };
489
+ }
490
+ function yr(t, e) {
491
+ return t === C ? e : function() {
492
+ t.apply(this, arguments);
493
+ var n = this.onsuccess, r = this.onerror;
494
+ this.onsuccess = this.onerror = null, e.apply(this, arguments), n && (this.onsuccess = this.onsuccess ? pe(n, this.onsuccess) : n), r && (this.onerror = this.onerror ? pe(r, this.onerror) : r);
495
+ };
496
+ }
497
+ function mr(t, e) {
498
+ return t === C ? e : function(n) {
499
+ var r = t.apply(this, arguments);
500
+ U(n, r);
501
+ var s = this.onsuccess, i = this.onerror;
502
+ this.onsuccess = null, this.onerror = null;
503
+ var o = e.apply(this, arguments);
504
+ return s && (this.onsuccess = this.onsuccess ? pe(s, this.onsuccess) : s), i && (this.onerror = this.onerror ? pe(i, this.onerror) : i), r === void 0 ? o === void 0 ? void 0 : o : U(r, o);
505
+ };
506
+ }
507
+ function gr(t, e) {
508
+ return t === C ? e : function() {
509
+ return e.apply(this, arguments) !== !1 && t.apply(this, arguments);
510
+ };
511
+ }
512
+ function tn(t, e) {
513
+ return t === C ? e : function() {
514
+ var n = t.apply(this, arguments);
515
+ if (n && typeof n.then == "function") {
516
+ for (var r = this, s = arguments.length, i = new Array(s); s--; )
517
+ i[s] = arguments[s];
518
+ return n.then(function() {
519
+ return e.apply(r, i);
520
+ });
521
+ }
522
+ return e.apply(this, arguments);
523
+ };
524
+ }
525
+ tt.ModifyError = ct, tt.DexieError = xe, tt.BulkError = Te;
526
+ var qe = {};
527
+ const Dn = 100, [Ct, lt, It] = typeof Promise > "u" ? [] : (() => {
528
+ let t = Promise.resolve();
529
+ if (typeof crypto > "u" || !crypto.subtle)
530
+ return [t, Fe(t), t];
531
+ const e = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
532
+ return [e, Fe(e), t];
533
+ })(), Bn = lt && lt.then, nt = Ct && Ct.constructor, nn = !!It;
534
+ var jt = !1, vr = It ? () => {
535
+ It.then(Ye);
536
+ } : I.setImmediate ? setImmediate.bind(null, Ye) : I.MutationObserver ? () => {
537
+ var t = document.createElement("div");
538
+ new MutationObserver(() => {
539
+ Ye(), t = null;
540
+ }).observe(t, { attributes: !0 }), t.setAttribute("i", "1");
541
+ } : () => {
542
+ setTimeout(Ye, 0);
543
+ }, De = function(t, e) {
544
+ je.push([t, e]), ht && (vr(), ht = !1);
545
+ }, Tt = !0, ht = !0, he = [], rt = [], Dt = null, Bt = Me, Ee = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: pn, pgp: !1, env: {}, finalize: function() {
546
+ this.unhandleds.forEach((t) => {
547
+ try {
548
+ pn(t[0], t[1]);
549
+ } catch {
550
+ }
551
+ });
552
+ } }, A = Ee, je = [], de = 0, st = [];
553
+ function E(t) {
554
+ if (typeof this != "object")
555
+ throw new TypeError("Promises must be constructed via new");
556
+ this._listeners = [], this.onuncatched = C, this._lib = !1;
557
+ var e = this._PSD = A;
558
+ if (Y && (this._stackHolder = me(), this._prev = null, this._numPrev = 0), typeof t != "function") {
559
+ if (t !== qe)
560
+ throw new TypeError("Not a function");
561
+ return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && Nt(this, this._value));
562
+ }
563
+ this._state = null, this._value = null, ++e.ref, Nn(this, t);
564
+ }
565
+ const Rt = { get: function() {
566
+ var t = A, e = dt;
567
+ function n(r, s) {
568
+ var i = !t.global && (t !== A || e !== dt);
569
+ const o = i && !te();
570
+ var u = new E((a, d) => {
571
+ rn(this, new Rn(ft(r, t, i, o), ft(s, t, i, o), a, d, t));
572
+ });
573
+ return Y && qn(u, this), u;
574
+ }
575
+ return n.prototype = qe, n;
576
+ }, set: function(t) {
577
+ Z(this, "then", t && t.prototype === qe ? Rt : { get: function() {
578
+ return t;
579
+ }, set: Rt.set });
580
+ } };
581
+ function Rn(t, e, n, r, s) {
582
+ this.onFulfilled = typeof t == "function" ? t : null, this.onRejected = typeof e == "function" ? e : null, this.resolve = n, this.reject = r, this.psd = s;
583
+ }
584
+ function Nn(t, e) {
585
+ try {
586
+ e((n) => {
587
+ if (t._state === null) {
588
+ if (n === t)
589
+ throw new TypeError("A promise cannot be resolved with itself.");
590
+ var r = t._lib && ze();
591
+ n && typeof n.then == "function" ? Nn(t, (s, i) => {
592
+ n instanceof E ? n._then(s, i) : n.then(s, i);
593
+ }) : (t._state = !0, t._value = n, Fn(t)), r && He();
594
+ }
595
+ }, Nt.bind(null, t));
596
+ } catch (n) {
597
+ Nt(t, n);
598
+ }
599
+ }
600
+ function Nt(t, e) {
601
+ if (rt.push(e), t._state === null) {
602
+ var n = t._lib && ze();
603
+ e = Bt(e), t._state = !1, t._value = e, Y && e !== null && typeof e == "object" && !e._promise && function(r, s, i) {
604
+ try {
605
+ r.apply(null, i);
606
+ } catch (o) {
607
+ s && s(o);
608
+ }
609
+ }(() => {
610
+ var r = Jt(e, "stack");
611
+ e._promise = t, Z(e, "stack", { get: () => jt ? r && (r.get ? r.get.apply(e) : r.value) : t.stack });
612
+ }), function(r) {
613
+ he.some((s) => s._value === r._value) || he.push(r);
614
+ }(t), Fn(t), n && He();
615
+ }
616
+ }
617
+ function Fn(t) {
618
+ var e = t._listeners;
619
+ t._listeners = [];
620
+ for (var n = 0, r = e.length; n < r; ++n)
621
+ rn(t, e[n]);
622
+ var s = t._PSD;
623
+ --s.ref || s.finalize(), de === 0 && (++de, De(() => {
624
+ --de == 0 && sn();
625
+ }, []));
626
+ }
627
+ function rn(t, e) {
628
+ if (t._state !== null) {
629
+ var n = t._state ? e.onFulfilled : e.onRejected;
630
+ if (n === null)
631
+ return (t._state ? e.resolve : e.reject)(t._value);
632
+ ++e.psd.ref, ++de, De(br, [n, t, e]);
633
+ } else
634
+ t._listeners.push(e);
635
+ }
636
+ function br(t, e, n) {
637
+ try {
638
+ Dt = e;
639
+ var r, s = e._value;
640
+ e._state ? r = t(s) : (rt.length && (rt = []), r = t(s), rt.indexOf(s) === -1 && function(i) {
641
+ for (var o = he.length; o; )
642
+ if (he[--o]._value === i._value)
643
+ return void he.splice(o, 1);
644
+ }(e)), n.resolve(r);
645
+ } catch (i) {
646
+ n.reject(i);
647
+ } finally {
648
+ Dt = null, --de == 0 && sn(), --n.psd.ref || n.psd.finalize();
649
+ }
650
+ }
651
+ function Mn(t, e, n) {
652
+ if (e.length === n)
653
+ return e;
654
+ var r = "";
655
+ if (t._state === !1) {
656
+ var s, i, o = t._value;
657
+ o != null ? (s = o.name || "Error", i = o.message || o, r = Ot(o, 0)) : (s = o, i = ""), e.push(s + (i ? ": " + i : "") + r);
658
+ }
659
+ return Y && ((r = Ot(t._stackHolder, 2)) && e.indexOf(r) === -1 && e.push(r), t._prev && Mn(t._prev, e, n)), e;
660
+ }
661
+ function qn(t, e) {
662
+ var n = e ? e._numPrev + 1 : 0;
663
+ n < 100 && (t._prev = e, t._numPrev = n);
664
+ }
665
+ function Ye() {
666
+ ze() && He();
667
+ }
668
+ function ze() {
669
+ var t = Tt;
670
+ return Tt = !1, ht = !1, t;
671
+ }
672
+ function He() {
673
+ var t, e, n;
674
+ do
675
+ for (; je.length > 0; )
676
+ for (t = je, je = [], n = t.length, e = 0; e < n; ++e) {
677
+ var r = t[e];
678
+ r[0].apply(null, r[1]);
679
+ }
680
+ while (je.length > 0);
681
+ Tt = !0, ht = !0;
682
+ }
683
+ function sn() {
684
+ var t = he;
685
+ he = [], t.forEach((r) => {
686
+ r._PSD.onunhandled.call(null, r._value, r);
687
+ });
688
+ for (var e = st.slice(0), n = e.length; n; )
689
+ e[--n]();
690
+ }
691
+ function Ge(t) {
692
+ return new E(qe, !1, t);
693
+ }
694
+ function j(t, e) {
695
+ var n = A;
696
+ return function() {
697
+ var r = ze(), s = A;
698
+ try {
699
+ return oe(n, !0), t.apply(this, arguments);
700
+ } catch (i) {
701
+ e && e(i);
702
+ } finally {
703
+ oe(s, !1), r && He();
704
+ }
705
+ };
706
+ }
707
+ Pe(E.prototype, { then: Rt, _then: function(t, e) {
708
+ rn(this, new Rn(null, null, t, e, A));
709
+ }, catch: function(t) {
710
+ if (arguments.length === 1)
711
+ return this.then(null, t);
712
+ var e = arguments[0], n = arguments[1];
713
+ return typeof e == "function" ? this.then(null, (r) => r instanceof e ? n(r) : Ge(r)) : this.then(null, (r) => r && r.name === e ? n(r) : Ge(r));
714
+ }, finally: function(t) {
715
+ return this.then((e) => (t(), e), (e) => (t(), Ge(e)));
716
+ }, stack: { get: function() {
717
+ if (this._stack)
718
+ return this._stack;
719
+ try {
720
+ jt = !0;
721
+ var t = Mn(this, [], 20).join(`
722
+ From previous: `);
723
+ return this._state !== null && (this._stack = t), t;
724
+ } finally {
725
+ jt = !1;
726
+ }
727
+ } }, timeout: function(t, e) {
728
+ return t < 1 / 0 ? new E((n, r) => {
729
+ var s = setTimeout(() => r(new S.Timeout(e)), t);
730
+ this.then(n, r).finally(clearTimeout.bind(null, s));
731
+ }) : this;
732
+ } }), typeof Symbol < "u" && Symbol.toStringTag && Z(E.prototype, Symbol.toStringTag, "Dexie.Promise"), Ee.env = $n(), Pe(E, { all: function() {
733
+ var t = J.apply(null, arguments).map(Qe);
734
+ return new E(function(e, n) {
735
+ t.length === 0 && e([]);
736
+ var r = t.length;
737
+ t.forEach((s, i) => E.resolve(s).then((o) => {
738
+ t[i] = o, --r || e(t);
739
+ }, n));
740
+ });
741
+ }, resolve: (t) => {
742
+ if (t instanceof E)
743
+ return t;
744
+ if (t && typeof t.then == "function")
745
+ return new E((n, r) => {
746
+ t.then(n, r);
747
+ });
748
+ var e = new E(qe, !0, t);
749
+ return qn(e, Dt), e;
750
+ }, reject: Ge, race: function() {
751
+ var t = J.apply(null, arguments).map(Qe);
752
+ return new E((e, n) => {
753
+ t.map((r) => E.resolve(r).then(e, n));
754
+ });
755
+ }, PSD: { get: () => A, set: (t) => A = t }, totalEchoes: { get: () => dt }, newPSD: ie, usePSD: Se, scheduler: { get: () => De, set: (t) => {
756
+ De = t;
757
+ } }, rejectionMapper: { get: () => Bt, set: (t) => {
758
+ Bt = t;
759
+ } }, follow: (t, e) => new E((n, r) => ie((s, i) => {
760
+ var o = A;
761
+ o.unhandleds = [], o.onunhandled = i, o.finalize = pe(function() {
762
+ (function(u) {
763
+ function a() {
764
+ u(), st.splice(st.indexOf(a), 1);
765
+ }
766
+ st.push(a), ++de, De(() => {
767
+ --de == 0 && sn();
768
+ }, []);
769
+ })(() => {
770
+ this.unhandleds.length === 0 ? s() : i(this.unhandleds[0]);
771
+ });
772
+ }, o.finalize), t();
773
+ }, e, n, r)) }), nt && (nt.allSettled && Z(E, "allSettled", function() {
774
+ const t = J.apply(null, arguments).map(Qe);
775
+ return new E((e) => {
776
+ t.length === 0 && e([]);
777
+ let n = t.length;
778
+ const r = new Array(n);
779
+ t.forEach((s, i) => E.resolve(s).then((o) => r[i] = { status: "fulfilled", value: o }, (o) => r[i] = { status: "rejected", reason: o }).then(() => --n || e(r)));
780
+ });
781
+ }), nt.any && typeof AggregateError < "u" && Z(E, "any", function() {
782
+ const t = J.apply(null, arguments).map(Qe);
783
+ return new E((e, n) => {
784
+ t.length === 0 && n(new AggregateError([]));
785
+ let r = t.length;
786
+ const s = new Array(r);
787
+ t.forEach((i, o) => E.resolve(i).then((u) => e(u), (u) => {
788
+ s[o] = u, --r || n(new AggregateError(s));
789
+ }));
790
+ });
791
+ }));
792
+ const F = { awaits: 0, echoes: 0, id: 0 };
793
+ var wr = 0, it = [], bt = 0, dt = 0, _r = 0;
794
+ function ie(t, e, n, r) {
795
+ var s = A, i = Object.create(s);
796
+ i.parent = s, i.ref = 0, i.global = !1, i.id = ++_r;
797
+ var o = Ee.env;
798
+ i.env = nn ? { Promise: E, PromiseProp: { value: E, configurable: !0, writable: !0 }, all: E.all, race: E.race, allSettled: E.allSettled, any: E.any, resolve: E.resolve, reject: E.reject, nthen: dn(o.nthen, i), gthen: dn(o.gthen, i) } : {}, e && U(i, e), ++s.ref, i.finalize = function() {
799
+ --this.parent.ref || this.parent.finalize();
800
+ };
801
+ var u = Se(i, t, n, r);
802
+ return i.ref === 0 && i.finalize(), u;
803
+ }
804
+ function Ae() {
805
+ return F.id || (F.id = ++wr), ++F.awaits, F.echoes += Dn, F.id;
806
+ }
807
+ function te() {
808
+ return !!F.awaits && (--F.awaits == 0 && (F.id = 0), F.echoes = F.awaits * Dn, !0);
809
+ }
810
+ function Qe(t) {
811
+ return F.echoes && t && t.constructor === nt ? (Ae(), t.then((e) => (te(), e), (e) => (te(), R(e)))) : t;
812
+ }
813
+ function kr(t) {
814
+ ++dt, F.echoes && --F.echoes != 0 || (F.echoes = F.id = 0), it.push(A), oe(t, !0);
815
+ }
816
+ function xr() {
817
+ var t = it[it.length - 1];
818
+ it.pop(), oe(t, !1);
819
+ }
820
+ function oe(t, e) {
821
+ var n = A;
822
+ if ((e ? !F.echoes || bt++ && t === A : !bt || --bt && t === A) || Un(e ? kr.bind(null, t) : xr), t !== A && (A = t, n === Ee && (Ee.env = $n()), nn)) {
823
+ var r = Ee.env.Promise, s = t.env;
824
+ lt.then = s.nthen, r.prototype.then = s.gthen, (n.global || t.global) && (Object.defineProperty(I, "Promise", s.PromiseProp), r.all = s.all, r.race = s.race, r.resolve = s.resolve, r.reject = s.reject, s.allSettled && (r.allSettled = s.allSettled), s.any && (r.any = s.any));
825
+ }
826
+ }
827
+ function $n() {
828
+ var t = I.Promise;
829
+ return nn ? { Promise: t, PromiseProp: Object.getOwnPropertyDescriptor(I, "Promise"), all: t.all, race: t.race, allSettled: t.allSettled, any: t.any, resolve: t.resolve, reject: t.reject, nthen: lt.then, gthen: t.prototype.then } : {};
830
+ }
831
+ function Se(t, e, n, r, s) {
832
+ var i = A;
833
+ try {
834
+ return oe(t, !0), e(n, r, s);
835
+ } finally {
836
+ oe(i, !1);
837
+ }
838
+ }
839
+ function Un(t) {
840
+ Bn.call(Ct, t);
841
+ }
842
+ function ft(t, e, n, r) {
843
+ return typeof t != "function" ? t : function() {
844
+ var s = A;
845
+ n && Ae(), oe(e, !0);
846
+ try {
847
+ return t.apply(this, arguments);
848
+ } finally {
849
+ oe(s, !1), r && Un(te);
850
+ }
851
+ };
852
+ }
853
+ function dn(t, e) {
854
+ return function(n, r) {
855
+ return t.call(this, ft(n, e), ft(r, e));
856
+ };
857
+ }
858
+ ("" + Bn).indexOf("[native code]") === -1 && (Ae = te = C);
859
+ const fn = "unhandledrejection";
860
+ function pn(t, e) {
861
+ var n;
862
+ try {
863
+ n = e.onuncatched(t);
864
+ } catch {
865
+ }
866
+ if (n !== !1)
867
+ try {
868
+ var r, s = { promise: e, reason: t };
869
+ if (I.document && document.createEvent ? ((r = document.createEvent("Event")).initEvent(fn, !0, !0), U(r, s)) : I.CustomEvent && U(r = new CustomEvent(fn, { detail: s }), s), r && I.dispatchEvent && (dispatchEvent(r), !I.PromiseRejectionEvent && I.onunhandledrejection))
870
+ try {
871
+ I.onunhandledrejection(r);
872
+ } catch {
873
+ }
874
+ Y && r && !r.defaultPrevented && console.warn(`Unhandled rejection: ${t.stack || t}`);
875
+ } catch {
876
+ }
877
+ }
878
+ var R = E.reject;
879
+ function Ft(t, e, n, r) {
880
+ if (t.idbdb && (t._state.openComplete || A.letThrough || t._vip)) {
881
+ var s = t._createTransaction(e, n, t._dbSchema);
882
+ try {
883
+ s.create(), t._state.PR1398_maxLoop = 3;
884
+ } catch (i) {
885
+ return i.name === en.InvalidState && t.isOpen() && --t._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), t._close(), t.open().then(() => Ft(t, e, n, r))) : R(i);
886
+ }
887
+ return s._promise(e, (i, o) => ie(() => (A.trans = s, r(i, o, s)))).then((i) => s._completion.then(() => i));
888
+ }
889
+ if (t._state.openComplete)
890
+ return R(new S.DatabaseClosed(t._state.dbOpenError));
891
+ if (!t._state.isBeingOpened) {
892
+ if (!t._options.autoOpen)
893
+ return R(new S.DatabaseClosed());
894
+ t.open().catch(C);
895
+ }
896
+ return t._state.dbReadyPromise.then(() => Ft(t, e, n, r));
897
+ }
898
+ const yn = "3.2.4", le = String.fromCharCode(65535), Mt = -1 / 0, G = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Vn = "String expected.", Be = [], mt = typeof navigator < "u" && /(MSIE|Trident|Edge)/.test(navigator.userAgent), Er = mt, Pr = mt, Ln = (t) => !/(dexie\.js|dexie\.min\.js)/.test(t), gt = "__dbnames", wt = "readonly", _t = "readwrite";
899
+ function ye(t, e) {
900
+ return t ? e ? function() {
901
+ return t.apply(this, arguments) && e.apply(this, arguments);
902
+ } : t : e;
903
+ }
904
+ const Wn = { type: 3, lower: -1 / 0, lowerOpen: !1, upper: [[]], upperOpen: !1 };
905
+ function Je(t) {
906
+ return typeof t != "string" || /\./.test(t) ? (e) => e : (e) => (e[t] === void 0 && t in e && delete (e = We(e))[t], e);
907
+ }
908
+ class Ar {
909
+ _trans(e, n, r) {
910
+ const s = this._tx || A.trans, i = this.name;
911
+ function o(a, d, c) {
912
+ if (!c.schema[i])
913
+ throw new S.NotFound("Table " + i + " not part of transaction");
914
+ return n(c.idbtrans, c);
915
+ }
916
+ const u = ze();
917
+ try {
918
+ return s && s.db === this.db ? s === A.trans ? s._promise(e, o, r) : ie(() => s._promise(e, o, r), { trans: s, transless: A.transless || A }) : Ft(this.db, e, [this.name], o);
919
+ } finally {
920
+ u && He();
921
+ }
922
+ }
923
+ get(e, n) {
924
+ return e && e.constructor === Object ? this.where(e).first(n) : this._trans("readonly", (r) => this.core.get({ trans: r, key: e }).then((s) => this.hook.reading.fire(s))).then(n);
925
+ }
926
+ where(e) {
927
+ if (typeof e == "string")
928
+ return new this.db.WhereClause(this, e);
929
+ if (M(e))
930
+ return new this.db.WhereClause(this, `[${e.join("+")}]`);
931
+ const n = B(e);
932
+ if (n.length === 1)
933
+ return this.where(n[0]).equals(e[n[0]]);
934
+ const r = this.schema.indexes.concat(this.schema.primKey).filter((d) => d.compound && n.every((c) => d.keyPath.indexOf(c) >= 0) && d.keyPath.every((c) => n.indexOf(c) >= 0))[0];
935
+ if (r && this.db._maxKey !== le)
936
+ return this.where(r.name).equals(r.keyPath.map((d) => e[d]));
937
+ !r && Y && console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);
938
+ const { idxByName: s } = this.schema, i = this.db._deps.indexedDB;
939
+ function o(d, c) {
940
+ try {
941
+ return i.cmp(d, c) === 0;
942
+ } catch {
943
+ return !1;
944
+ }
945
+ }
946
+ const [u, a] = n.reduce(([d, c], l) => {
947
+ const h = s[l], p = e[l];
948
+ return [d || h, d || !h ? ye(c, h && h.multi ? (g) => {
949
+ const f = ee(g, l);
950
+ return M(f) && f.some((v) => o(p, v));
951
+ } : (g) => o(p, ee(g, l))) : c];
952
+ }, [null, null]);
953
+ return u ? this.where(u.name).equals(e[u.keyPath]).filter(a) : r ? this.filter(a) : this.where(n).equals("");
954
+ }
955
+ filter(e) {
956
+ return this.toCollection().and(e);
957
+ }
958
+ count(e) {
959
+ return this.toCollection().count(e);
960
+ }
961
+ offset(e) {
962
+ return this.toCollection().offset(e);
963
+ }
964
+ limit(e) {
965
+ return this.toCollection().limit(e);
966
+ }
967
+ each(e) {
968
+ return this.toCollection().each(e);
969
+ }
970
+ toArray(e) {
971
+ return this.toCollection().toArray(e);
972
+ }
973
+ toCollection() {
974
+ return new this.db.Collection(new this.db.WhereClause(this));
975
+ }
976
+ orderBy(e) {
977
+ return new this.db.Collection(new this.db.WhereClause(this, M(e) ? `[${e.join("+")}]` : e));
978
+ }
979
+ reverse() {
980
+ return this.toCollection().reverse();
981
+ }
982
+ mapToClass(e) {
983
+ this.schema.mappedClass = e;
984
+ const n = (r) => {
985
+ if (!r)
986
+ return r;
987
+ const s = Object.create(e.prototype);
988
+ for (var i in r)
989
+ if (W(r, i))
990
+ try {
991
+ s[i] = r[i];
992
+ } catch {
993
+ }
994
+ return s;
995
+ };
996
+ return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = n, this.hook("reading", n), e;
997
+ }
998
+ defineClass() {
999
+ return this.mapToClass(function(e) {
1000
+ U(this, e);
1001
+ });
1002
+ }
1003
+ add(e, n) {
1004
+ const { auto: r, keyPath: s } = this.schema.primKey;
1005
+ let i = e;
1006
+ return s && r && (i = Je(s)(e)), this._trans("readwrite", (o) => this.core.mutate({ trans: o, type: "add", keys: n != null ? [n] : null, values: [i] })).then((o) => o.numFailures ? E.reject(o.failures[0]) : o.lastResult).then((o) => {
1007
+ if (s)
1008
+ try {
1009
+ z(e, s, o);
1010
+ } catch {
1011
+ }
1012
+ return o;
1013
+ });
1014
+ }
1015
+ update(e, n) {
1016
+ if (typeof e != "object" || M(e))
1017
+ return this.where(":id").equals(e).modify(n);
1018
+ {
1019
+ const r = ee(e, this.schema.primKey.keyPath);
1020
+ if (r === void 0)
1021
+ return R(new S.InvalidArgument("Given object does not contain its primary key"));
1022
+ try {
1023
+ typeof n != "function" ? B(n).forEach((s) => {
1024
+ z(e, s, n[s]);
1025
+ }) : n(e, { value: e, primKey: r });
1026
+ } catch {
1027
+ }
1028
+ return this.where(":id").equals(r).modify(n);
1029
+ }
1030
+ }
1031
+ put(e, n) {
1032
+ const { auto: r, keyPath: s } = this.schema.primKey;
1033
+ let i = e;
1034
+ return s && r && (i = Je(s)(e)), this._trans("readwrite", (o) => this.core.mutate({ trans: o, type: "put", values: [i], keys: n != null ? [n] : null })).then((o) => o.numFailures ? E.reject(o.failures[0]) : o.lastResult).then((o) => {
1035
+ if (s)
1036
+ try {
1037
+ z(e, s, o);
1038
+ } catch {
1039
+ }
1040
+ return o;
1041
+ });
1042
+ }
1043
+ delete(e) {
1044
+ return this._trans("readwrite", (n) => this.core.mutate({ trans: n, type: "delete", keys: [e] })).then((n) => n.numFailures ? E.reject(n.failures[0]) : void 0);
1045
+ }
1046
+ clear() {
1047
+ return this._trans("readwrite", (e) => this.core.mutate({ trans: e, type: "deleteRange", range: Wn })).then((e) => e.numFailures ? E.reject(e.failures[0]) : void 0);
1048
+ }
1049
+ bulkGet(e) {
1050
+ return this._trans("readonly", (n) => this.core.getMany({ keys: e, trans: n }).then((r) => r.map((s) => this.hook.reading.fire(s))));
1051
+ }
1052
+ bulkAdd(e, n, r) {
1053
+ const s = Array.isArray(n) ? n : void 0, i = (r = r || (s ? void 0 : n)) ? r.allKeys : void 0;
1054
+ return this._trans("readwrite", (o) => {
1055
+ const { auto: u, keyPath: a } = this.schema.primKey;
1056
+ if (a && s)
1057
+ throw new S.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
1058
+ if (s && s.length !== e.length)
1059
+ throw new S.InvalidArgument("Arguments objects and keys must have the same length");
1060
+ const d = e.length;
1061
+ let c = a && u ? e.map(Je(a)) : e;
1062
+ return this.core.mutate({ trans: o, type: "add", keys: s, values: c, wantResults: i }).then(({ numFailures: l, results: h, lastResult: p, failures: g }) => {
1063
+ if (l === 0)
1064
+ return i ? h : p;
1065
+ throw new Te(`${this.name}.bulkAdd(): ${l} of ${d} operations failed`, g);
1066
+ });
1067
+ });
1068
+ }
1069
+ bulkPut(e, n, r) {
1070
+ const s = Array.isArray(n) ? n : void 0, i = (r = r || (s ? void 0 : n)) ? r.allKeys : void 0;
1071
+ return this._trans("readwrite", (o) => {
1072
+ const { auto: u, keyPath: a } = this.schema.primKey;
1073
+ if (a && s)
1074
+ throw new S.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
1075
+ if (s && s.length !== e.length)
1076
+ throw new S.InvalidArgument("Arguments objects and keys must have the same length");
1077
+ const d = e.length;
1078
+ let c = a && u ? e.map(Je(a)) : e;
1079
+ return this.core.mutate({ trans: o, type: "put", keys: s, values: c, wantResults: i }).then(({ numFailures: l, results: h, lastResult: p, failures: g }) => {
1080
+ if (l === 0)
1081
+ return i ? h : p;
1082
+ throw new Te(`${this.name}.bulkPut(): ${l} of ${d} operations failed`, g);
1083
+ });
1084
+ });
1085
+ }
1086
+ bulkDelete(e) {
1087
+ const n = e.length;
1088
+ return this._trans("readwrite", (r) => this.core.mutate({ trans: r, type: "delete", keys: e })).then(({ numFailures: r, lastResult: s, failures: i }) => {
1089
+ if (r === 0)
1090
+ return s;
1091
+ throw new Te(`${this.name}.bulkDelete(): ${r} of ${n} operations failed`, i);
1092
+ });
1093
+ }
1094
+ }
1095
+ function Re(t) {
1096
+ var e = {}, n = function(o, u) {
1097
+ if (u) {
1098
+ for (var a = arguments.length, d = new Array(a - 1); --a; )
1099
+ d[a - 1] = arguments[a];
1100
+ return e[o].subscribe.apply(null, d), t;
1101
+ }
1102
+ if (typeof o == "string")
1103
+ return e[o];
1104
+ };
1105
+ n.addEventType = i;
1106
+ for (var r = 1, s = arguments.length; r < s; ++r)
1107
+ i(arguments[r]);
1108
+ return n;
1109
+ function i(o, u, a) {
1110
+ if (typeof o != "object") {
1111
+ var d;
1112
+ u || (u = gr), a || (a = C);
1113
+ var c = { subscribers: [], fire: a, subscribe: function(l) {
1114
+ c.subscribers.indexOf(l) === -1 && (c.subscribers.push(l), c.fire = u(c.fire, l));
1115
+ }, unsubscribe: function(l) {
1116
+ c.subscribers = c.subscribers.filter(function(h) {
1117
+ return h !== l;
1118
+ }), c.fire = c.subscribers.reduce(u, a);
1119
+ } };
1120
+ return e[o] = n[o] = c, c;
1121
+ }
1122
+ B(d = o).forEach(function(l) {
1123
+ var h = d[l];
1124
+ if (M(h))
1125
+ i(l, d[l][0], d[l][1]);
1126
+ else {
1127
+ if (h !== "asap")
1128
+ throw new S.InvalidArgument("Invalid event config");
1129
+ var p = i(l, Me, function() {
1130
+ for (var g = arguments.length, f = new Array(g); g--; )
1131
+ f[g] = arguments[g];
1132
+ p.subscribers.forEach(function(v) {
1133
+ Pn(function() {
1134
+ v.apply(null, f);
1135
+ });
1136
+ });
1137
+ });
1138
+ }
1139
+ });
1140
+ }
1141
+ }
1142
+ function Ce(t, e) {
1143
+ return ke(e).from({ prototype: t }), e;
1144
+ }
1145
+ function be(t, e) {
1146
+ return !(t.filter || t.algorithm || t.or) && (e ? t.justLimit : !t.replayFilter);
1147
+ }
1148
+ function kt(t, e) {
1149
+ t.filter = ye(t.filter, e);
1150
+ }
1151
+ function xt(t, e, n) {
1152
+ var r = t.replayFilter;
1153
+ t.replayFilter = r ? () => ye(r(), e()) : e, t.justLimit = n && !r;
1154
+ }
1155
+ function ot(t, e) {
1156
+ if (t.isPrimKey)
1157
+ return e.primaryKey;
1158
+ const n = e.getIndexByKeyPath(t.index);
1159
+ if (!n)
1160
+ throw new S.Schema("KeyPath " + t.index + " on object store " + e.name + " is not indexed");
1161
+ return n;
1162
+ }
1163
+ function mn(t, e, n) {
1164
+ const r = ot(t, e.schema);
1165
+ return e.openCursor({ trans: n, values: !t.keysOnly, reverse: t.dir === "prev", unique: !!t.unique, query: { index: r, range: t.range } });
1166
+ }
1167
+ function Xe(t, e, n, r) {
1168
+ const s = t.replayFilter ? ye(t.filter, t.replayFilter()) : t.filter;
1169
+ if (t.or) {
1170
+ const i = {}, o = (u, a, d) => {
1171
+ if (!s || s(a, d, (h) => a.stop(h), (h) => a.fail(h))) {
1172
+ var c = a.primaryKey, l = "" + c;
1173
+ l === "[object ArrayBuffer]" && (l = "" + new Uint8Array(c)), W(i, l) || (i[l] = !0, e(u, a, d));
1174
+ }
1175
+ };
1176
+ return Promise.all([t.or._iterate(o, n), gn(mn(t, r, n), t.algorithm, o, !t.keysOnly && t.valueMapper)]);
1177
+ }
1178
+ return gn(mn(t, r, n), ye(t.algorithm, s), e, !t.keysOnly && t.valueMapper);
1179
+ }
1180
+ function gn(t, e, n, r) {
1181
+ var s = j(r ? (i, o, u) => n(r(i), o, u) : n);
1182
+ return t.then((i) => {
1183
+ if (i)
1184
+ return i.start(() => {
1185
+ var o = () => i.continue();
1186
+ e && !e(i, (u) => o = u, (u) => {
1187
+ i.stop(u), o = C;
1188
+ }, (u) => {
1189
+ i.fail(u), o = C;
1190
+ }) || s(i.value, i, (u) => o = u), o();
1191
+ });
1192
+ });
1193
+ }
1194
+ function $(t, e) {
1195
+ try {
1196
+ const n = vn(t), r = vn(e);
1197
+ if (n !== r)
1198
+ return n === "Array" ? 1 : r === "Array" ? -1 : n === "binary" ? 1 : r === "binary" ? -1 : n === "string" ? 1 : r === "string" ? -1 : n === "Date" ? 1 : r !== "Date" ? NaN : -1;
1199
+ switch (n) {
1200
+ case "number":
1201
+ case "Date":
1202
+ case "string":
1203
+ return t > e ? 1 : t < e ? -1 : 0;
1204
+ case "binary":
1205
+ return function(s, i) {
1206
+ const o = s.length, u = i.length, a = o < u ? o : u;
1207
+ for (let d = 0; d < a; ++d)
1208
+ if (s[d] !== i[d])
1209
+ return s[d] < i[d] ? -1 : 1;
1210
+ return o === u ? 0 : o < u ? -1 : 1;
1211
+ }(bn(t), bn(e));
1212
+ case "Array":
1213
+ return function(s, i) {
1214
+ const o = s.length, u = i.length, a = o < u ? o : u;
1215
+ for (let d = 0; d < a; ++d) {
1216
+ const c = $(s[d], i[d]);
1217
+ if (c !== 0)
1218
+ return c;
1219
+ }
1220
+ return o === u ? 0 : o < u ? -1 : 1;
1221
+ }(t, e);
1222
+ }
1223
+ } catch {
1224
+ }
1225
+ return NaN;
1226
+ }
1227
+ function vn(t) {
1228
+ const e = typeof t;
1229
+ if (e !== "object")
1230
+ return e;
1231
+ if (ArrayBuffer.isView(t))
1232
+ return "binary";
1233
+ const n = St(t);
1234
+ return n === "ArrayBuffer" ? "binary" : n;
1235
+ }
1236
+ function bn(t) {
1237
+ return t instanceof Uint8Array ? t : ArrayBuffer.isView(t) ? new Uint8Array(t.buffer, t.byteOffset, t.byteLength) : new Uint8Array(t);
1238
+ }
1239
+ class Sr {
1240
+ _read(e, n) {
1241
+ var r = this._ctx;
1242
+ return r.error ? r.table._trans(null, R.bind(null, r.error)) : r.table._trans("readonly", e).then(n);
1243
+ }
1244
+ _write(e) {
1245
+ var n = this._ctx;
1246
+ return n.error ? n.table._trans(null, R.bind(null, n.error)) : n.table._trans("readwrite", e, "locked");
1247
+ }
1248
+ _addAlgorithm(e) {
1249
+ var n = this._ctx;
1250
+ n.algorithm = ye(n.algorithm, e);
1251
+ }
1252
+ _iterate(e, n) {
1253
+ return Xe(this._ctx, e, n, this._ctx.table.core);
1254
+ }
1255
+ clone(e) {
1256
+ var n = Object.create(this.constructor.prototype), r = Object.create(this._ctx);
1257
+ return e && U(r, e), n._ctx = r, n;
1258
+ }
1259
+ raw() {
1260
+ return this._ctx.valueMapper = null, this;
1261
+ }
1262
+ each(e) {
1263
+ var n = this._ctx;
1264
+ return this._read((r) => Xe(n, e, r, n.table.core));
1265
+ }
1266
+ count(e) {
1267
+ return this._read((n) => {
1268
+ const r = this._ctx, s = r.table.core;
1269
+ if (be(r, !0))
1270
+ return s.count({ trans: n, query: { index: ot(r, s.schema), range: r.range } }).then((o) => Math.min(o, r.limit));
1271
+ var i = 0;
1272
+ return Xe(r, () => (++i, !1), n, s).then(() => i);
1273
+ }).then(e);
1274
+ }
1275
+ sortBy(e, n) {
1276
+ const r = e.split(".").reverse(), s = r[0], i = r.length - 1;
1277
+ function o(d, c) {
1278
+ return c ? o(d[r[c]], c - 1) : d[s];
1279
+ }
1280
+ var u = this._ctx.dir === "next" ? 1 : -1;
1281
+ function a(d, c) {
1282
+ var l = o(d, i), h = o(c, i);
1283
+ return l < h ? -u : l > h ? u : 0;
1284
+ }
1285
+ return this.toArray(function(d) {
1286
+ return d.sort(a);
1287
+ }).then(n);
1288
+ }
1289
+ toArray(e) {
1290
+ return this._read((n) => {
1291
+ var r = this._ctx;
1292
+ if (r.dir === "next" && be(r, !0) && r.limit > 0) {
1293
+ const { valueMapper: s } = r, i = ot(r, r.table.core.schema);
1294
+ return r.table.core.query({ trans: n, limit: r.limit, values: !0, query: { index: i, range: r.range } }).then(({ result: o }) => s ? o.map(s) : o);
1295
+ }
1296
+ {
1297
+ const s = [];
1298
+ return Xe(r, (i) => s.push(i), n, r.table.core).then(() => s);
1299
+ }
1300
+ }, e);
1301
+ }
1302
+ offset(e) {
1303
+ var n = this._ctx;
1304
+ return e <= 0 || (n.offset += e, be(n) ? xt(n, () => {
1305
+ var r = e;
1306
+ return (s, i) => r === 0 || (r === 1 ? (--r, !1) : (i(() => {
1307
+ s.advance(r), r = 0;
1308
+ }), !1));
1309
+ }) : xt(n, () => {
1310
+ var r = e;
1311
+ return () => --r < 0;
1312
+ })), this;
1313
+ }
1314
+ limit(e) {
1315
+ return this._ctx.limit = Math.min(this._ctx.limit, e), xt(this._ctx, () => {
1316
+ var n = e;
1317
+ return function(r, s, i) {
1318
+ return --n <= 0 && s(i), n >= 0;
1319
+ };
1320
+ }, !0), this;
1321
+ }
1322
+ until(e, n) {
1323
+ return kt(this._ctx, function(r, s, i) {
1324
+ return !e(r.value) || (s(i), n);
1325
+ }), this;
1326
+ }
1327
+ first(e) {
1328
+ return this.limit(1).toArray(function(n) {
1329
+ return n[0];
1330
+ }).then(e);
1331
+ }
1332
+ last(e) {
1333
+ return this.reverse().first(e);
1334
+ }
1335
+ filter(e) {
1336
+ var n, r;
1337
+ return kt(this._ctx, function(s) {
1338
+ return e(s.value);
1339
+ }), n = this._ctx, r = e, n.isMatch = ye(n.isMatch, r), this;
1340
+ }
1341
+ and(e) {
1342
+ return this.filter(e);
1343
+ }
1344
+ or(e) {
1345
+ return new this.db.WhereClause(this._ctx.table, e, this);
1346
+ }
1347
+ reverse() {
1348
+ return this._ctx.dir = this._ctx.dir === "prev" ? "next" : "prev", this._ondirectionchange && this._ondirectionchange(this._ctx.dir), this;
1349
+ }
1350
+ desc() {
1351
+ return this.reverse();
1352
+ }
1353
+ eachKey(e) {
1354
+ var n = this._ctx;
1355
+ return n.keysOnly = !n.isMatch, this.each(function(r, s) {
1356
+ e(s.key, s);
1357
+ });
1358
+ }
1359
+ eachUniqueKey(e) {
1360
+ return this._ctx.unique = "unique", this.eachKey(e);
1361
+ }
1362
+ eachPrimaryKey(e) {
1363
+ var n = this._ctx;
1364
+ return n.keysOnly = !n.isMatch, this.each(function(r, s) {
1365
+ e(s.primaryKey, s);
1366
+ });
1367
+ }
1368
+ keys(e) {
1369
+ var n = this._ctx;
1370
+ n.keysOnly = !n.isMatch;
1371
+ var r = [];
1372
+ return this.each(function(s, i) {
1373
+ r.push(i.key);
1374
+ }).then(function() {
1375
+ return r;
1376
+ }).then(e);
1377
+ }
1378
+ primaryKeys(e) {
1379
+ var n = this._ctx;
1380
+ if (n.dir === "next" && be(n, !0) && n.limit > 0)
1381
+ return this._read((s) => {
1382
+ var i = ot(n, n.table.core.schema);
1383
+ return n.table.core.query({ trans: s, values: !1, limit: n.limit, query: { index: i, range: n.range } });
1384
+ }).then(({ result: s }) => s).then(e);
1385
+ n.keysOnly = !n.isMatch;
1386
+ var r = [];
1387
+ return this.each(function(s, i) {
1388
+ r.push(i.primaryKey);
1389
+ }).then(function() {
1390
+ return r;
1391
+ }).then(e);
1392
+ }
1393
+ uniqueKeys(e) {
1394
+ return this._ctx.unique = "unique", this.keys(e);
1395
+ }
1396
+ firstKey(e) {
1397
+ return this.limit(1).keys(function(n) {
1398
+ return n[0];
1399
+ }).then(e);
1400
+ }
1401
+ lastKey(e) {
1402
+ return this.reverse().firstKey(e);
1403
+ }
1404
+ distinct() {
1405
+ var e = this._ctx, n = e.index && e.table.schema.idxByName[e.index];
1406
+ if (!n || !n.multi)
1407
+ return this;
1408
+ var r = {};
1409
+ return kt(this._ctx, function(s) {
1410
+ var i = s.primaryKey.toString(), o = W(r, i);
1411
+ return r[i] = !0, !o;
1412
+ }), this;
1413
+ }
1414
+ modify(e) {
1415
+ var n = this._ctx;
1416
+ return this._write((r) => {
1417
+ var s;
1418
+ if (typeof e == "function")
1419
+ s = e;
1420
+ else {
1421
+ var i = B(e), o = i.length;
1422
+ s = function(f) {
1423
+ for (var v = !1, m = 0; m < o; ++m) {
1424
+ var y = i[m], w = e[y];
1425
+ ee(f, y) !== w && (z(f, y, w), v = !0);
1426
+ }
1427
+ return v;
1428
+ };
1429
+ }
1430
+ const u = n.table.core, { outbound: a, extractKey: d } = u.schema.primaryKey, c = this.db._options.modifyChunkSize || 200, l = [];
1431
+ let h = 0;
1432
+ const p = [], g = (f, v) => {
1433
+ const { failures: m, numFailures: y } = v;
1434
+ h += f - y;
1435
+ for (let w of B(m))
1436
+ l.push(m[w]);
1437
+ };
1438
+ return this.clone().primaryKeys().then((f) => {
1439
+ const v = (m) => {
1440
+ const y = Math.min(c, f.length - m);
1441
+ return u.getMany({ trans: r, keys: f.slice(m, m + y), cache: "immutable" }).then((w) => {
1442
+ const P = [], x = [], k = a ? [] : null, b = [];
1443
+ for (let _ = 0; _ < y; ++_) {
1444
+ const T = w[_], O = { value: We(T), primKey: f[m + _] };
1445
+ s.call(O, O.value, O) !== !1 && (O.value == null ? b.push(f[m + _]) : a || $(d(T), d(O.value)) === 0 ? (x.push(O.value), a && k.push(f[m + _])) : (b.push(f[m + _]), P.push(O.value)));
1446
+ }
1447
+ const K = be(n) && n.limit === 1 / 0 && (typeof e != "function" || e === Et) && { index: n.index, range: n.range };
1448
+ return Promise.resolve(P.length > 0 && u.mutate({ trans: r, type: "add", values: P }).then((_) => {
1449
+ for (let T in _.failures)
1450
+ b.splice(parseInt(T), 1);
1451
+ g(P.length, _);
1452
+ })).then(() => (x.length > 0 || K && typeof e == "object") && u.mutate({ trans: r, type: "put", keys: k, values: x, criteria: K, changeSpec: typeof e != "function" && e }).then((_) => g(x.length, _))).then(() => (b.length > 0 || K && e === Et) && u.mutate({ trans: r, type: "delete", keys: b, criteria: K }).then((_) => g(b.length, _))).then(() => f.length > m + y && v(m + c));
1453
+ });
1454
+ };
1455
+ return v(0).then(() => {
1456
+ if (l.length > 0)
1457
+ throw new ct("Error modifying one or more objects", l, h, p);
1458
+ return f.length;
1459
+ });
1460
+ });
1461
+ });
1462
+ }
1463
+ delete() {
1464
+ var e = this._ctx, n = e.range;
1465
+ return be(e) && (e.isPrimKey && !Pr || n.type === 3) ? this._write((r) => {
1466
+ const { primaryKey: s } = e.table.core.schema, i = n;
1467
+ return e.table.core.count({ trans: r, query: { index: s, range: i } }).then((o) => e.table.core.mutate({ trans: r, type: "deleteRange", range: i }).then(({ failures: u, lastResult: a, results: d, numFailures: c }) => {
1468
+ if (c)
1469
+ throw new ct("Could not delete some values", Object.keys(u).map((l) => u[l]), o - c);
1470
+ return o - c;
1471
+ }));
1472
+ }) : this.modify(Et);
1473
+ }
1474
+ }
1475
+ const Et = (t, e) => e.value = null;
1476
+ function Kr(t, e) {
1477
+ return t < e ? -1 : t === e ? 0 : 1;
1478
+ }
1479
+ function Or(t, e) {
1480
+ return t > e ? -1 : t === e ? 0 : 1;
1481
+ }
1482
+ function L(t, e, n) {
1483
+ var r = t instanceof Hn ? new t.Collection(t) : t;
1484
+ return r._ctx.error = n ? new n(e) : new TypeError(e), r;
1485
+ }
1486
+ function we(t) {
1487
+ return new t.Collection(t, () => zn("")).limit(0);
1488
+ }
1489
+ function Cr(t, e, n, r, s, i) {
1490
+ for (var o = Math.min(t.length, r.length), u = -1, a = 0; a < o; ++a) {
1491
+ var d = e[a];
1492
+ if (d !== r[a])
1493
+ return s(t[a], n[a]) < 0 ? t.substr(0, a) + n[a] + n.substr(a + 1) : s(t[a], r[a]) < 0 ? t.substr(0, a) + r[a] + n.substr(a + 1) : u >= 0 ? t.substr(0, u) + e[u] + n.substr(u + 1) : null;
1494
+ s(t[a], d) < 0 && (u = a);
1495
+ }
1496
+ return o < r.length && i === "next" ? t + n.substr(t.length) : o < t.length && i === "prev" ? t.substr(0, n.length) : u < 0 ? null : t.substr(0, u) + r[u] + n.substr(u + 1);
1497
+ }
1498
+ function Ze(t, e, n, r) {
1499
+ var s, i, o, u, a, d, c, l = n.length;
1500
+ if (!n.every((f) => typeof f == "string"))
1501
+ return L(t, Vn);
1502
+ function h(f) {
1503
+ s = function(m) {
1504
+ return m === "next" ? (y) => y.toUpperCase() : (y) => y.toLowerCase();
1505
+ }(f), i = function(m) {
1506
+ return m === "next" ? (y) => y.toLowerCase() : (y) => y.toUpperCase();
1507
+ }(f), o = f === "next" ? Kr : Or;
1508
+ var v = n.map(function(m) {
1509
+ return { lower: i(m), upper: s(m) };
1510
+ }).sort(function(m, y) {
1511
+ return o(m.lower, y.lower);
1512
+ });
1513
+ u = v.map(function(m) {
1514
+ return m.upper;
1515
+ }), a = v.map(function(m) {
1516
+ return m.lower;
1517
+ }), d = f, c = f === "next" ? "" : r;
1518
+ }
1519
+ h("next");
1520
+ var p = new t.Collection(t, () => ne(u[0], a[l - 1] + r));
1521
+ p._ondirectionchange = function(f) {
1522
+ h(f);
1523
+ };
1524
+ var g = 0;
1525
+ return p._addAlgorithm(function(f, v, m) {
1526
+ var y = f.key;
1527
+ if (typeof y != "string")
1528
+ return !1;
1529
+ var w = i(y);
1530
+ if (e(w, a, g))
1531
+ return !0;
1532
+ for (var P = null, x = g; x < l; ++x) {
1533
+ var k = Cr(y, w, u[x], a[x], o, d);
1534
+ k === null && P === null ? g = x + 1 : (P === null || o(P, k) > 0) && (P = k);
1535
+ }
1536
+ return v(P !== null ? function() {
1537
+ f.continue(P + c);
1538
+ } : m), !1;
1539
+ }), p;
1540
+ }
1541
+ function ne(t, e, n, r) {
1542
+ return { type: 2, lower: t, upper: e, lowerOpen: n, upperOpen: r };
1543
+ }
1544
+ function zn(t) {
1545
+ return { type: 1, lower: t, upper: t };
1546
+ }
1547
+ class Hn {
1548
+ get Collection() {
1549
+ return this._ctx.table.db.Collection;
1550
+ }
1551
+ between(e, n, r, s) {
1552
+ r = r !== !1, s = s === !0;
1553
+ try {
1554
+ return this._cmp(e, n) > 0 || this._cmp(e, n) === 0 && (r || s) && (!r || !s) ? we(this) : new this.Collection(this, () => ne(e, n, !r, !s));
1555
+ } catch {
1556
+ return L(this, G);
1557
+ }
1558
+ }
1559
+ equals(e) {
1560
+ return e == null ? L(this, G) : new this.Collection(this, () => zn(e));
1561
+ }
1562
+ above(e) {
1563
+ return e == null ? L(this, G) : new this.Collection(this, () => ne(e, void 0, !0));
1564
+ }
1565
+ aboveOrEqual(e) {
1566
+ return e == null ? L(this, G) : new this.Collection(this, () => ne(e, void 0, !1));
1567
+ }
1568
+ below(e) {
1569
+ return e == null ? L(this, G) : new this.Collection(this, () => ne(void 0, e, !1, !0));
1570
+ }
1571
+ belowOrEqual(e) {
1572
+ return e == null ? L(this, G) : new this.Collection(this, () => ne(void 0, e));
1573
+ }
1574
+ startsWith(e) {
1575
+ return typeof e != "string" ? L(this, Vn) : this.between(e, e + le, !0, !0);
1576
+ }
1577
+ startsWithIgnoreCase(e) {
1578
+ return e === "" ? this.startsWith(e) : Ze(this, (n, r) => n.indexOf(r[0]) === 0, [e], le);
1579
+ }
1580
+ equalsIgnoreCase(e) {
1581
+ return Ze(this, (n, r) => n === r[0], [e], "");
1582
+ }
1583
+ anyOfIgnoreCase() {
1584
+ var e = J.apply(_e, arguments);
1585
+ return e.length === 0 ? we(this) : Ze(this, (n, r) => r.indexOf(n) !== -1, e, "");
1586
+ }
1587
+ startsWithAnyOfIgnoreCase() {
1588
+ var e = J.apply(_e, arguments);
1589
+ return e.length === 0 ? we(this) : Ze(this, (n, r) => r.some((s) => n.indexOf(s) === 0), e, le);
1590
+ }
1591
+ anyOf() {
1592
+ const e = J.apply(_e, arguments);
1593
+ let n = this._cmp;
1594
+ try {
1595
+ e.sort(n);
1596
+ } catch {
1597
+ return L(this, G);
1598
+ }
1599
+ if (e.length === 0)
1600
+ return we(this);
1601
+ const r = new this.Collection(this, () => ne(e[0], e[e.length - 1]));
1602
+ r._ondirectionchange = (i) => {
1603
+ n = i === "next" ? this._ascending : this._descending, e.sort(n);
1604
+ };
1605
+ let s = 0;
1606
+ return r._addAlgorithm((i, o, u) => {
1607
+ const a = i.key;
1608
+ for (; n(a, e[s]) > 0; )
1609
+ if (++s, s === e.length)
1610
+ return o(u), !1;
1611
+ return n(a, e[s]) === 0 || (o(() => {
1612
+ i.continue(e[s]);
1613
+ }), !1);
1614
+ }), r;
1615
+ }
1616
+ notEqual(e) {
1617
+ return this.inAnyRange([[Mt, e], [e, this.db._maxKey]], { includeLowers: !1, includeUppers: !1 });
1618
+ }
1619
+ noneOf() {
1620
+ const e = J.apply(_e, arguments);
1621
+ if (e.length === 0)
1622
+ return new this.Collection(this);
1623
+ try {
1624
+ e.sort(this._ascending);
1625
+ } catch {
1626
+ return L(this, G);
1627
+ }
1628
+ const n = e.reduce((r, s) => r ? r.concat([[r[r.length - 1][1], s]]) : [[Mt, s]], null);
1629
+ return n.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(n, { includeLowers: !1, includeUppers: !1 });
1630
+ }
1631
+ inAnyRange(e, n) {
1632
+ const r = this._cmp, s = this._ascending, i = this._descending, o = this._min, u = this._max;
1633
+ if (e.length === 0)
1634
+ return we(this);
1635
+ if (!e.every((y) => y[0] !== void 0 && y[1] !== void 0 && s(y[0], y[1]) <= 0))
1636
+ return L(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", S.InvalidArgument);
1637
+ const a = !n || n.includeLowers !== !1, d = n && n.includeUppers === !0;
1638
+ let c, l = s;
1639
+ function h(y, w) {
1640
+ return l(y[0], w[0]);
1641
+ }
1642
+ try {
1643
+ c = e.reduce(function(y, w) {
1644
+ let P = 0, x = y.length;
1645
+ for (; P < x; ++P) {
1646
+ const k = y[P];
1647
+ if (r(w[0], k[1]) < 0 && r(w[1], k[0]) > 0) {
1648
+ k[0] = o(k[0], w[0]), k[1] = u(k[1], w[1]);
1649
+ break;
1650
+ }
1651
+ }
1652
+ return P === x && y.push(w), y;
1653
+ }, []), c.sort(h);
1654
+ } catch {
1655
+ return L(this, G);
1656
+ }
1657
+ let p = 0;
1658
+ const g = d ? (y) => s(y, c[p][1]) > 0 : (y) => s(y, c[p][1]) >= 0, f = a ? (y) => i(y, c[p][0]) > 0 : (y) => i(y, c[p][0]) >= 0;
1659
+ let v = g;
1660
+ const m = new this.Collection(this, () => ne(c[0][0], c[c.length - 1][1], !a, !d));
1661
+ return m._ondirectionchange = (y) => {
1662
+ y === "next" ? (v = g, l = s) : (v = f, l = i), c.sort(h);
1663
+ }, m._addAlgorithm((y, w, P) => {
1664
+ for (var x = y.key; v(x); )
1665
+ if (++p, p === c.length)
1666
+ return w(P), !1;
1667
+ return !!function(k) {
1668
+ return !g(k) && !f(k);
1669
+ }(x) || (this._cmp(x, c[p][1]) === 0 || this._cmp(x, c[p][0]) === 0 || w(() => {
1670
+ l === s ? y.continue(c[p][0]) : y.continue(c[p][1]);
1671
+ }), !1);
1672
+ }), m;
1673
+ }
1674
+ startsWithAnyOf() {
1675
+ const e = J.apply(_e, arguments);
1676
+ return e.every((n) => typeof n == "string") ? e.length === 0 ? we(this) : this.inAnyRange(e.map((n) => [n, n + le])) : L(this, "startsWithAnyOf() only works with strings");
1677
+ }
1678
+ }
1679
+ function H(t) {
1680
+ return j(function(e) {
1681
+ return $e(e), t(e.target.error), !1;
1682
+ });
1683
+ }
1684
+ function $e(t) {
1685
+ t.stopPropagation && t.stopPropagation(), t.preventDefault && t.preventDefault();
1686
+ }
1687
+ const Ue = "storagemutated", se = "x-storagemutated-1", ae = Re(null, Ue);
1688
+ class Ir {
1689
+ _lock() {
1690
+ return Ie(!A.global), ++this._reculock, this._reculock !== 1 || A.global || (A.lockOwnerFor = this), this;
1691
+ }
1692
+ _unlock() {
1693
+ if (Ie(!A.global), --this._reculock == 0)
1694
+ for (A.global || (A.lockOwnerFor = null); this._blockedFuncs.length > 0 && !this._locked(); ) {
1695
+ var e = this._blockedFuncs.shift();
1696
+ try {
1697
+ Se(e[1], e[0]);
1698
+ } catch {
1699
+ }
1700
+ }
1701
+ return this;
1702
+ }
1703
+ _locked() {
1704
+ return this._reculock && A.lockOwnerFor !== this;
1705
+ }
1706
+ create(e) {
1707
+ if (!this.mode)
1708
+ return this;
1709
+ const n = this.db.idbdb, r = this.db._state.dbOpenError;
1710
+ if (Ie(!this.idbtrans), !e && !n)
1711
+ switch (r && r.name) {
1712
+ case "DatabaseClosedError":
1713
+ throw new S.DatabaseClosed(r);
1714
+ case "MissingAPIError":
1715
+ throw new S.MissingAPI(r.message, r);
1716
+ default:
1717
+ throw new S.OpenFailed(r);
1718
+ }
1719
+ if (!this.active)
1720
+ throw new S.TransactionInactive();
1721
+ return Ie(this._completion._state === null), (e = this.idbtrans = e || (this.db.core ? this.db.core.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }) : n.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }))).onerror = j((s) => {
1722
+ $e(s), this._reject(e.error);
1723
+ }), e.onabort = j((s) => {
1724
+ $e(s), this.active && this._reject(new S.Abort(e.error)), this.active = !1, this.on("abort").fire(s);
1725
+ }), e.oncomplete = j(() => {
1726
+ this.active = !1, this._resolve(), "mutatedParts" in e && ae.storagemutated.fire(e.mutatedParts);
1727
+ }), this;
1728
+ }
1729
+ _promise(e, n, r) {
1730
+ if (e === "readwrite" && this.mode !== "readwrite")
1731
+ return R(new S.ReadOnly("Transaction is readonly"));
1732
+ if (!this.active)
1733
+ return R(new S.TransactionInactive());
1734
+ if (this._locked())
1735
+ return new E((i, o) => {
1736
+ this._blockedFuncs.push([() => {
1737
+ this._promise(e, n, r).then(i, o);
1738
+ }, A]);
1739
+ });
1740
+ if (r)
1741
+ return ie(() => {
1742
+ var i = new E((o, u) => {
1743
+ this._lock();
1744
+ const a = n(o, u, this);
1745
+ a && a.then && a.then(o, u);
1746
+ });
1747
+ return i.finally(() => this._unlock()), i._lib = !0, i;
1748
+ });
1749
+ var s = new E((i, o) => {
1750
+ var u = n(i, o, this);
1751
+ u && u.then && u.then(i, o);
1752
+ });
1753
+ return s._lib = !0, s;
1754
+ }
1755
+ _root() {
1756
+ return this.parent ? this.parent._root() : this;
1757
+ }
1758
+ waitFor(e) {
1759
+ var n = this._root();
1760
+ const r = E.resolve(e);
1761
+ if (n._waitingFor)
1762
+ n._waitingFor = n._waitingFor.then(() => r);
1763
+ else {
1764
+ n._waitingFor = r, n._waitingQueue = [];
1765
+ var s = n.idbtrans.objectStore(n.storeNames[0]);
1766
+ (function o() {
1767
+ for (++n._spinCount; n._waitingQueue.length; )
1768
+ n._waitingQueue.shift()();
1769
+ n._waitingFor && (s.get(-1 / 0).onsuccess = o);
1770
+ })();
1771
+ }
1772
+ var i = n._waitingFor;
1773
+ return new E((o, u) => {
1774
+ r.then((a) => n._waitingQueue.push(j(o.bind(null, a))), (a) => n._waitingQueue.push(j(u.bind(null, a)))).finally(() => {
1775
+ n._waitingFor === i && (n._waitingFor = null);
1776
+ });
1777
+ });
1778
+ }
1779
+ abort() {
1780
+ this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new S.Abort()));
1781
+ }
1782
+ table(e) {
1783
+ const n = this._memoizedTables || (this._memoizedTables = {});
1784
+ if (W(n, e))
1785
+ return n[e];
1786
+ const r = this.schema[e];
1787
+ if (!r)
1788
+ throw new S.NotFound("Table " + e + " not part of transaction");
1789
+ const s = new this.db.Table(e, r, this);
1790
+ return s.core = this.db.core.table(e), n[e] = s, s;
1791
+ }
1792
+ }
1793
+ function qt(t, e, n, r, s, i, o) {
1794
+ return { name: t, keyPath: e, unique: n, multi: r, auto: s, compound: i, src: (n && !o ? "&" : "") + (r ? "*" : "") + (s ? "++" : "") + Yn(e) };
1795
+ }
1796
+ function Yn(t) {
1797
+ return typeof t == "string" ? t : t ? "[" + [].join.call(t, "+") + "]" : "";
1798
+ }
1799
+ function Gn(t, e, n) {
1800
+ return { name: t, primKey: e, indexes: n, mappedClass: null, idxByName: An(n, (r) => [r.name, r]) };
1801
+ }
1802
+ let Ve = (t) => {
1803
+ try {
1804
+ return t.only([[]]), Ve = () => [[]], [[]];
1805
+ } catch {
1806
+ return Ve = () => le, le;
1807
+ }
1808
+ };
1809
+ function $t(t) {
1810
+ return t == null ? () => {
1811
+ } : typeof t == "string" ? function(e) {
1812
+ return e.split(".").length === 1 ? (r) => r[e] : (r) => ee(r, e);
1813
+ }(t) : (e) => ee(e, t);
1814
+ }
1815
+ function wn(t) {
1816
+ return [].slice.call(t);
1817
+ }
1818
+ let jr = 0;
1819
+ function Ne(t) {
1820
+ return t == null ? ":id" : typeof t == "string" ? t : `[${t.join("+")}]`;
1821
+ }
1822
+ function Tr(t, e, n) {
1823
+ function r(a) {
1824
+ if (a.type === 3)
1825
+ return null;
1826
+ if (a.type === 4)
1827
+ throw new Error("Cannot convert never type to IDBKeyRange");
1828
+ const { lower: d, upper: c, lowerOpen: l, upperOpen: h } = a;
1829
+ return d === void 0 ? c === void 0 ? null : e.upperBound(c, !!h) : c === void 0 ? e.lowerBound(d, !!l) : e.bound(d, c, !!l, !!h);
1830
+ }
1831
+ const { schema: s, hasGetAll: i } = function(a, d) {
1832
+ const c = wn(a.objectStoreNames);
1833
+ return { schema: { name: a.name, tables: c.map((l) => d.objectStore(l)).map((l) => {
1834
+ const { keyPath: h, autoIncrement: p } = l, g = M(h), f = h == null, v = {}, m = { name: l.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: f, compound: g, keyPath: h, autoIncrement: p, unique: !0, extractKey: $t(h) }, indexes: wn(l.indexNames).map((y) => l.index(y)).map((y) => {
1835
+ const { name: w, unique: P, multiEntry: x, keyPath: k } = y, b = { name: w, compound: M(k), keyPath: k, unique: P, multiEntry: x, extractKey: $t(k) };
1836
+ return v[Ne(k)] = b, b;
1837
+ }), getIndexByKeyPath: (y) => v[Ne(y)] };
1838
+ return v[":id"] = m.primaryKey, h != null && (v[Ne(h)] = m.primaryKey), m;
1839
+ }) }, hasGetAll: c.length > 0 && "getAll" in d.objectStore(c[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) };
1840
+ }(t, n), o = s.tables.map((a) => function(d) {
1841
+ const c = d.name;
1842
+ return { name: c, schema: d, mutate: function({ trans: l, type: h, keys: p, values: g, range: f }) {
1843
+ return new Promise((v, m) => {
1844
+ v = j(v);
1845
+ const y = l.objectStore(c), w = y.keyPath == null, P = h === "put" || h === "add";
1846
+ if (!P && h !== "delete" && h !== "deleteRange")
1847
+ throw new Error("Invalid operation type: " + h);
1848
+ const { length: x } = p || g || { length: 1 };
1849
+ if (p && g && p.length !== g.length)
1850
+ throw new Error("Given keys array must have same length as given values array.");
1851
+ if (x === 0)
1852
+ return v({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
1853
+ let k;
1854
+ const b = [], K = [];
1855
+ let _ = 0;
1856
+ const T = (q) => {
1857
+ ++_, $e(q);
1858
+ };
1859
+ if (h === "deleteRange") {
1860
+ if (f.type === 4)
1861
+ return v({ numFailures: _, failures: K, results: [], lastResult: void 0 });
1862
+ f.type === 3 ? b.push(k = y.clear()) : b.push(k = y.delete(r(f)));
1863
+ } else {
1864
+ const [q, N] = P ? w ? [g, p] : [g, null] : [p, null];
1865
+ if (P)
1866
+ for (let D = 0; D < x; ++D)
1867
+ b.push(k = N && N[D] !== void 0 ? y[h](q[D], N[D]) : y[h](q[D])), k.onerror = T;
1868
+ else
1869
+ for (let D = 0; D < x; ++D)
1870
+ b.push(k = y[h](q[D])), k.onerror = T;
1871
+ }
1872
+ const O = (q) => {
1873
+ const N = q.target.result;
1874
+ b.forEach((D, ge) => D.error != null && (K[ge] = D.error)), v({ numFailures: _, failures: K, results: h === "delete" ? p : b.map((D) => D.result), lastResult: N });
1875
+ };
1876
+ k.onerror = (q) => {
1877
+ T(q), O(q);
1878
+ }, k.onsuccess = O;
1879
+ });
1880
+ }, getMany: ({ trans: l, keys: h }) => new Promise((p, g) => {
1881
+ p = j(p);
1882
+ const f = l.objectStore(c), v = h.length, m = new Array(v);
1883
+ let y, w = 0, P = 0;
1884
+ const x = (b) => {
1885
+ const K = b.target;
1886
+ m[K._pos] = K.result, ++P === w && p(m);
1887
+ }, k = H(g);
1888
+ for (let b = 0; b < v; ++b)
1889
+ h[b] != null && (y = f.get(h[b]), y._pos = b, y.onsuccess = x, y.onerror = k, ++w);
1890
+ w === 0 && p(m);
1891
+ }), get: ({ trans: l, key: h }) => new Promise((p, g) => {
1892
+ p = j(p);
1893
+ const f = l.objectStore(c).get(h);
1894
+ f.onsuccess = (v) => p(v.target.result), f.onerror = H(g);
1895
+ }), query: function(l) {
1896
+ return (h) => new Promise((p, g) => {
1897
+ p = j(p);
1898
+ const { trans: f, values: v, limit: m, query: y } = h, w = m === 1 / 0 ? void 0 : m, { index: P, range: x } = y, k = f.objectStore(c), b = P.isPrimaryKey ? k : k.index(P.name), K = r(x);
1899
+ if (m === 0)
1900
+ return p({ result: [] });
1901
+ if (l) {
1902
+ const _ = v ? b.getAll(K, w) : b.getAllKeys(K, w);
1903
+ _.onsuccess = (T) => p({ result: T.target.result }), _.onerror = H(g);
1904
+ } else {
1905
+ let _ = 0;
1906
+ const T = v || !("openKeyCursor" in b) ? b.openCursor(K) : b.openKeyCursor(K), O = [];
1907
+ T.onsuccess = (q) => {
1908
+ const N = T.result;
1909
+ return N ? (O.push(v ? N.value : N.primaryKey), ++_ === m ? p({ result: O }) : void N.continue()) : p({ result: O });
1910
+ }, T.onerror = H(g);
1911
+ }
1912
+ });
1913
+ }(i), openCursor: function({ trans: l, values: h, query: p, reverse: g, unique: f }) {
1914
+ return new Promise((v, m) => {
1915
+ v = j(v);
1916
+ const { index: y, range: w } = p, P = l.objectStore(c), x = y.isPrimaryKey ? P : P.index(y.name), k = g ? f ? "prevunique" : "prev" : f ? "nextunique" : "next", b = h || !("openKeyCursor" in x) ? x.openCursor(r(w), k) : x.openKeyCursor(r(w), k);
1917
+ b.onerror = H(m), b.onsuccess = j((K) => {
1918
+ const _ = b.result;
1919
+ if (!_)
1920
+ return void v(null);
1921
+ _.___id = ++jr, _.done = !1;
1922
+ const T = _.continue.bind(_);
1923
+ let O = _.continuePrimaryKey;
1924
+ O && (O = O.bind(_));
1925
+ const q = _.advance.bind(_), N = () => {
1926
+ throw new Error("Cursor not stopped");
1927
+ };
1928
+ _.trans = l, _.stop = _.continue = _.continuePrimaryKey = _.advance = () => {
1929
+ throw new Error("Cursor not started");
1930
+ }, _.fail = j(m), _.next = function() {
1931
+ let D = 1;
1932
+ return this.start(() => D-- ? this.continue() : this.stop()).then(() => this);
1933
+ }, _.start = (D) => {
1934
+ const ge = new Promise((V, ue) => {
1935
+ V = j(V), b.onerror = H(ue), _.fail = ue, _.stop = (Ke) => {
1936
+ _.stop = _.continue = _.continuePrimaryKey = _.advance = N, V(Ke);
1937
+ };
1938
+ }), ve = () => {
1939
+ if (b.result)
1940
+ try {
1941
+ D();
1942
+ } catch (V) {
1943
+ _.fail(V);
1944
+ }
1945
+ else
1946
+ _.done = !0, _.start = () => {
1947
+ throw new Error("Cursor behind last entry");
1948
+ }, _.stop();
1949
+ };
1950
+ return b.onsuccess = j((V) => {
1951
+ b.onsuccess = ve, ve();
1952
+ }), _.continue = T, _.continuePrimaryKey = O, _.advance = q, ve(), ge;
1953
+ }, v(_);
1954
+ }, m);
1955
+ });
1956
+ }, count({ query: l, trans: h }) {
1957
+ const { index: p, range: g } = l;
1958
+ return new Promise((f, v) => {
1959
+ const m = h.objectStore(c), y = p.isPrimaryKey ? m : m.index(p.name), w = r(g), P = w ? y.count(w) : y.count();
1960
+ P.onsuccess = j((x) => f(x.target.result)), P.onerror = H(v);
1961
+ });
1962
+ } };
1963
+ }(a)), u = {};
1964
+ return o.forEach((a) => u[a.name] = a), { stack: "dbcore", transaction: t.transaction.bind(t), table(a) {
1965
+ if (!u[a])
1966
+ throw new Error(`Table '${a}' not found`);
1967
+ return u[a];
1968
+ }, MIN_KEY: -1 / 0, MAX_KEY: Ve(e), schema: s };
1969
+ }
1970
+ function Ut({ _novip: t }, e) {
1971
+ const n = e.db, r = function(s, i, { IDBKeyRange: o, indexedDB: u }, a) {
1972
+ return { dbcore: function(c, l) {
1973
+ return l.reduce((h, { create: p }) => ({ ...h, ...p(h) }), c);
1974
+ }(Tr(i, o, a), s.dbcore) };
1975
+ }(t._middlewares, n, t._deps, e);
1976
+ t.core = r.dbcore, t.tables.forEach((s) => {
1977
+ const i = s.name;
1978
+ t.core.schema.tables.some((o) => o.name === i) && (s.core = t.core.table(i), t[i] instanceof t.Table && (t[i].core = s.core));
1979
+ });
1980
+ }
1981
+ function pt({ _novip: t }, e, n, r) {
1982
+ n.forEach((s) => {
1983
+ const i = r[s];
1984
+ e.forEach((o) => {
1985
+ const u = Jt(o, s);
1986
+ (!u || "value" in u && u.value === void 0) && (o === t.Transaction.prototype || o instanceof t.Transaction ? Z(o, s, { get() {
1987
+ return this.table(s);
1988
+ }, set(a) {
1989
+ xn(this, s, { value: a, writable: !0, configurable: !0, enumerable: !0 });
1990
+ } }) : o[s] = new t.Table(s, i));
1991
+ });
1992
+ });
1993
+ }
1994
+ function Vt({ _novip: t }, e) {
1995
+ e.forEach((n) => {
1996
+ for (let r in n)
1997
+ n[r] instanceof t.Table && delete n[r];
1998
+ });
1999
+ }
2000
+ function Dr(t, e) {
2001
+ return t._cfg.version - e._cfg.version;
2002
+ }
2003
+ function Br(t, e, n, r) {
2004
+ const s = t._dbSchema, i = t._createTransaction("readwrite", t._storeNames, s);
2005
+ i.create(n), i._completion.catch(r);
2006
+ const o = i._reject.bind(i), u = A.transless || A;
2007
+ ie(() => {
2008
+ A.trans = i, A.transless = u, e === 0 ? (B(s).forEach((a) => {
2009
+ Pt(n, a, s[a].primKey, s[a].indexes);
2010
+ }), Ut(t, n), E.follow(() => t.on.populate.fire(i)).catch(o)) : function({ _novip: a }, d, c, l) {
2011
+ const h = [], p = a._versions;
2012
+ let g = a._dbSchema = Wt(a, a.idbdb, l), f = !1;
2013
+ const v = p.filter((y) => y._cfg.version >= d);
2014
+ function m() {
2015
+ return h.length ? E.resolve(h.shift()(c.idbtrans)).then(m) : E.resolve();
2016
+ }
2017
+ return v.forEach((y) => {
2018
+ h.push(() => {
2019
+ const w = g, P = y._cfg.dbschema;
2020
+ zt(a, w, l), zt(a, P, l), g = a._dbSchema = P;
2021
+ const x = Qn(w, P);
2022
+ x.add.forEach((b) => {
2023
+ Pt(l, b[0], b[1].primKey, b[1].indexes);
2024
+ }), x.change.forEach((b) => {
2025
+ if (b.recreate)
2026
+ throw new S.Upgrade("Not yet support for changing primary key");
2027
+ {
2028
+ const K = l.objectStore(b.name);
2029
+ b.add.forEach((_) => Lt(K, _)), b.change.forEach((_) => {
2030
+ K.deleteIndex(_.name), Lt(K, _);
2031
+ }), b.del.forEach((_) => K.deleteIndex(_));
2032
+ }
2033
+ });
2034
+ const k = y._cfg.contentUpgrade;
2035
+ if (k && y._cfg.version > d) {
2036
+ Ut(a, l), c._memoizedTables = {}, f = !0;
2037
+ let b = Sn(P);
2038
+ x.del.forEach((O) => {
2039
+ b[O] = w[O];
2040
+ }), Vt(a, [a.Transaction.prototype]), pt(a, [a.Transaction.prototype], B(b), b), c.schema = b;
2041
+ const K = Xt(k);
2042
+ let _;
2043
+ K && Ae();
2044
+ const T = E.follow(() => {
2045
+ if (_ = k(c), _ && K) {
2046
+ var O = te.bind(null, null);
2047
+ _.then(O, O);
2048
+ }
2049
+ });
2050
+ return _ && typeof _.then == "function" ? E.resolve(_) : T.then(() => _);
2051
+ }
2052
+ }), h.push((w) => {
2053
+ (!f || !Er) && function(P, x) {
2054
+ [].slice.call(x.db.objectStoreNames).forEach((k) => P[k] == null && x.db.deleteObjectStore(k));
2055
+ }(y._cfg.dbschema, w), Vt(a, [a.Transaction.prototype]), pt(a, [a.Transaction.prototype], a._storeNames, a._dbSchema), c.schema = a._dbSchema;
2056
+ });
2057
+ }), m().then(() => {
2058
+ var y, w;
2059
+ w = l, B(y = g).forEach((P) => {
2060
+ w.db.objectStoreNames.contains(P) || Pt(w, P, y[P].primKey, y[P].indexes);
2061
+ });
2062
+ });
2063
+ }(t, e, i, n).catch(o);
2064
+ });
2065
+ }
2066
+ function Qn(t, e) {
2067
+ const n = { del: [], add: [], change: [] };
2068
+ let r;
2069
+ for (r in t)
2070
+ e[r] || n.del.push(r);
2071
+ for (r in e) {
2072
+ const s = t[r], i = e[r];
2073
+ if (s) {
2074
+ const o = { name: r, def: i, recreate: !1, del: [], add: [], change: [] };
2075
+ if ("" + (s.primKey.keyPath || "") != "" + (i.primKey.keyPath || "") || s.primKey.auto !== i.primKey.auto && !mt)
2076
+ o.recreate = !0, n.change.push(o);
2077
+ else {
2078
+ const u = s.idxByName, a = i.idxByName;
2079
+ let d;
2080
+ for (d in u)
2081
+ a[d] || o.del.push(d);
2082
+ for (d in a) {
2083
+ const c = u[d], l = a[d];
2084
+ c ? c.src !== l.src && o.change.push(l) : o.add.push(l);
2085
+ }
2086
+ (o.del.length > 0 || o.add.length > 0 || o.change.length > 0) && n.change.push(o);
2087
+ }
2088
+ } else
2089
+ n.add.push([r, i]);
2090
+ }
2091
+ return n;
2092
+ }
2093
+ function Pt(t, e, n, r) {
2094
+ const s = t.db.createObjectStore(e, n.keyPath ? { keyPath: n.keyPath, autoIncrement: n.auto } : { autoIncrement: n.auto });
2095
+ return r.forEach((i) => Lt(s, i)), s;
2096
+ }
2097
+ function Lt(t, e) {
2098
+ t.createIndex(e.name, e.keyPath, { unique: e.unique, multiEntry: e.multi });
2099
+ }
2100
+ function Wt(t, e, n) {
2101
+ const r = {};
2102
+ return ut(e.objectStoreNames, 0).forEach((s) => {
2103
+ const i = n.objectStore(s);
2104
+ let o = i.keyPath;
2105
+ const u = qt(Yn(o), o || "", !1, !1, !!i.autoIncrement, o && typeof o != "string", !0), a = [];
2106
+ for (let c = 0; c < i.indexNames.length; ++c) {
2107
+ const l = i.index(i.indexNames[c]);
2108
+ o = l.keyPath;
2109
+ var d = qt(l.name, o, !!l.unique, !!l.multiEntry, !1, o && typeof o != "string", !1);
2110
+ a.push(d);
2111
+ }
2112
+ r[s] = Gn(s, u, a);
2113
+ }), r;
2114
+ }
2115
+ function zt({ _novip: t }, e, n) {
2116
+ const r = n.db.objectStoreNames;
2117
+ for (let s = 0; s < r.length; ++s) {
2118
+ const i = r[s], o = n.objectStore(i);
2119
+ t._hasGetAll = "getAll" in o;
2120
+ for (let u = 0; u < o.indexNames.length; ++u) {
2121
+ const a = o.indexNames[u], d = o.index(a).keyPath, c = typeof d == "string" ? d : "[" + ut(d).join("+") + "]";
2122
+ if (e[i]) {
2123
+ const l = e[i].idxByName[c];
2124
+ l && (l.name = a, delete e[i].idxByName[c], e[i].idxByName[a] = l);
2125
+ }
2126
+ }
2127
+ }
2128
+ typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && I.WorkerGlobalScope && I instanceof I.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (t._hasGetAll = !1);
2129
+ }
2130
+ class Rr {
2131
+ _parseStoresSpec(e, n) {
2132
+ B(e).forEach((r) => {
2133
+ if (e[r] !== null) {
2134
+ var s = e[r].split(",").map((o, u) => {
2135
+ const a = (o = o.trim()).replace(/([&*]|\+\+)/g, ""), d = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
2136
+ return qt(a, d || null, /\&/.test(o), /\*/.test(o), /\+\+/.test(o), M(d), u === 0);
2137
+ }), i = s.shift();
2138
+ if (i.multi)
2139
+ throw new S.Schema("Primary key cannot be multi-valued");
2140
+ s.forEach((o) => {
2141
+ if (o.auto)
2142
+ throw new S.Schema("Only primary key can be marked as autoIncrement (++)");
2143
+ if (!o.keyPath)
2144
+ throw new S.Schema("Index must have a name and cannot be an empty string");
2145
+ }), n[r] = Gn(r, i, s);
2146
+ }
2147
+ });
2148
+ }
2149
+ stores(e) {
2150
+ const n = this.db;
2151
+ this._cfg.storesSource = this._cfg.storesSource ? U(this._cfg.storesSource, e) : e;
2152
+ const r = n._versions, s = {};
2153
+ let i = {};
2154
+ return r.forEach((o) => {
2155
+ U(s, o._cfg.storesSource), i = o._cfg.dbschema = {}, o._parseStoresSpec(s, i);
2156
+ }), n._dbSchema = i, Vt(n, [n._allTables, n, n.Transaction.prototype]), pt(n, [n._allTables, n, n.Transaction.prototype, this._cfg.tables], B(i), i), n._storeNames = B(i), this;
2157
+ }
2158
+ upgrade(e) {
2159
+ return this._cfg.contentUpgrade = tn(this._cfg.contentUpgrade || C, e), this;
2160
+ }
2161
+ }
2162
+ function on(t, e) {
2163
+ let n = t._dbNamesDB;
2164
+ return n || (n = t._dbNamesDB = new fe(gt, { addons: [], indexedDB: t, IDBKeyRange: e }), n.version(1).stores({ dbnames: "name" })), n.table("dbnames");
2165
+ }
2166
+ function an(t) {
2167
+ return t && typeof t.databases == "function";
2168
+ }
2169
+ function Ht(t) {
2170
+ return ie(function() {
2171
+ return A.letThrough = !0, t();
2172
+ });
2173
+ }
2174
+ function Nr() {
2175
+ var t;
2176
+ return !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(e) {
2177
+ var n = function() {
2178
+ return indexedDB.databases().finally(e);
2179
+ };
2180
+ t = setInterval(n, 100), n();
2181
+ }).finally(function() {
2182
+ return clearInterval(t);
2183
+ }) : Promise.resolve();
2184
+ }
2185
+ function Fr(t) {
2186
+ const e = t._state, { indexedDB: n } = t._deps;
2187
+ if (e.isBeingOpened || t.idbdb)
2188
+ return e.dbReadyPromise.then(() => e.dbOpenError ? R(e.dbOpenError) : t);
2189
+ Y && (e.openCanceller._stackHolder = me()), e.isBeingOpened = !0, e.dbOpenError = null, e.openComplete = !1;
2190
+ const r = e.openCanceller;
2191
+ function s() {
2192
+ if (e.openCanceller !== r)
2193
+ throw new S.DatabaseClosed("db.open() was cancelled");
2194
+ }
2195
+ let i = e.dbReadyResolve, o = null, u = !1;
2196
+ return E.race([r, (typeof navigator > "u" ? E.resolve() : Nr()).then(() => new E((a, d) => {
2197
+ if (s(), !n)
2198
+ throw new S.MissingAPI();
2199
+ const c = t.name, l = e.autoSchema ? n.open(c) : n.open(c, Math.round(10 * t.verno));
2200
+ if (!l)
2201
+ throw new S.MissingAPI();
2202
+ l.onerror = H(d), l.onblocked = j(t._fireOnBlocked), l.onupgradeneeded = j((h) => {
2203
+ if (o = l.transaction, e.autoSchema && !t._options.allowEmptyDB) {
2204
+ l.onerror = $e, o.abort(), l.result.close();
2205
+ const g = n.deleteDatabase(c);
2206
+ g.onsuccess = g.onerror = j(() => {
2207
+ d(new S.NoSuchDatabase(`Database ${c} doesnt exist`));
2208
+ });
2209
+ } else {
2210
+ o.onerror = H(d);
2211
+ var p = h.oldVersion > Math.pow(2, 62) ? 0 : h.oldVersion;
2212
+ u = p < 1, t._novip.idbdb = l.result, Br(t, p / 10, o, d);
2213
+ }
2214
+ }, d), l.onsuccess = j(() => {
2215
+ o = null;
2216
+ const h = t._novip.idbdb = l.result, p = ut(h.objectStoreNames);
2217
+ if (p.length > 0)
2218
+ try {
2219
+ const f = h.transaction((g = p).length === 1 ? g[0] : g, "readonly");
2220
+ e.autoSchema ? function({ _novip: v }, m, y) {
2221
+ v.verno = m.version / 10;
2222
+ const w = v._dbSchema = Wt(0, m, y);
2223
+ v._storeNames = ut(m.objectStoreNames, 0), pt(v, [v._allTables], B(w), w);
2224
+ }(t, h, f) : (zt(t, t._dbSchema, f), function(v, m) {
2225
+ const y = Qn(Wt(0, v.idbdb, m), v._dbSchema);
2226
+ return !(y.add.length || y.change.some((w) => w.add.length || w.change.length));
2227
+ }(t, f) || console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")), Ut(t, f);
2228
+ } catch {
2229
+ }
2230
+ var g;
2231
+ Be.push(t), h.onversionchange = j((f) => {
2232
+ e.vcFired = !0, t.on("versionchange").fire(f);
2233
+ }), h.onclose = j((f) => {
2234
+ t.on("close").fire(f);
2235
+ }), u && function({ indexedDB: f, IDBKeyRange: v }, m) {
2236
+ !an(f) && m !== gt && on(f, v).put({ name: m }).catch(C);
2237
+ }(t._deps, c), a();
2238
+ }, d);
2239
+ }))]).then(() => (s(), e.onReadyBeingFired = [], E.resolve(Ht(() => t.on.ready.fire(t.vip))).then(function a() {
2240
+ if (e.onReadyBeingFired.length > 0) {
2241
+ let d = e.onReadyBeingFired.reduce(tn, C);
2242
+ return e.onReadyBeingFired = [], E.resolve(Ht(() => d(t.vip))).then(a);
2243
+ }
2244
+ }))).finally(() => {
2245
+ e.onReadyBeingFired = null, e.isBeingOpened = !1;
2246
+ }).then(() => t).catch((a) => {
2247
+ e.dbOpenError = a;
2248
+ try {
2249
+ o && o.abort();
2250
+ } catch {
2251
+ }
2252
+ return r === e.openCanceller && t._close(), R(a);
2253
+ }).finally(() => {
2254
+ e.openComplete = !0, i();
2255
+ });
2256
+ }
2257
+ function Yt(t) {
2258
+ var e = (i) => t.next(i), n = s(e), r = s((i) => t.throw(i));
2259
+ function s(i) {
2260
+ return (o) => {
2261
+ var u = i(o), a = u.value;
2262
+ return u.done ? a : a && typeof a.then == "function" ? a.then(n, r) : M(a) ? Promise.all(a).then(n, r) : n(a);
2263
+ };
2264
+ }
2265
+ return s(e)();
2266
+ }
2267
+ function Mr(t, e, n) {
2268
+ var r = arguments.length;
2269
+ if (r < 2)
2270
+ throw new S.InvalidArgument("Too few arguments");
2271
+ for (var s = new Array(r - 1); --r; )
2272
+ s[r - 1] = arguments[r];
2273
+ return n = s.pop(), [t, Kn(s), n];
2274
+ }
2275
+ function Jn(t, e, n, r, s) {
2276
+ return E.resolve().then(() => {
2277
+ const i = A.transless || A, o = t._createTransaction(e, n, t._dbSchema, r), u = { trans: o, transless: i };
2278
+ if (r)
2279
+ o.idbtrans = r.idbtrans;
2280
+ else
2281
+ try {
2282
+ o.create(), t._state.PR1398_maxLoop = 3;
2283
+ } catch (l) {
2284
+ return l.name === en.InvalidState && t.isOpen() && --t._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), t._close(), t.open().then(() => Jn(t, e, n, null, s))) : R(l);
2285
+ }
2286
+ const a = Xt(s);
2287
+ let d;
2288
+ a && Ae();
2289
+ const c = E.follow(() => {
2290
+ if (d = s.call(o, o), d)
2291
+ if (a) {
2292
+ var l = te.bind(null, null);
2293
+ d.then(l, l);
2294
+ } else
2295
+ typeof d.next == "function" && typeof d.throw == "function" && (d = Yt(d));
2296
+ }, u);
2297
+ return (d && typeof d.then == "function" ? E.resolve(d).then((l) => o.active ? l : R(new S.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))) : c.then(() => d)).then((l) => (r && o._resolve(), o._completion.then(() => l))).catch((l) => (o._reject(l), R(l)));
2298
+ });
2299
+ }
2300
+ function et(t, e, n) {
2301
+ const r = M(t) ? t.slice() : [t];
2302
+ for (let s = 0; s < n; ++s)
2303
+ r.push(e);
2304
+ return r;
2305
+ }
2306
+ const qr = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(t) {
2307
+ return { ...t, table(e) {
2308
+ const n = t.table(e), { schema: r } = n, s = {}, i = [];
2309
+ function o(c, l, h) {
2310
+ const p = Ne(c), g = s[p] = s[p] || [], f = c == null ? 0 : typeof c == "string" ? 1 : c.length, v = l > 0, m = { ...h, isVirtual: v, keyTail: l, keyLength: f, extractKey: $t(c), unique: !v && h.unique };
2311
+ return g.push(m), m.isPrimaryKey || i.push(m), f > 1 && o(f === 2 ? c[0] : c.slice(0, f - 1), l + 1, h), g.sort((y, w) => y.keyTail - w.keyTail), m;
2312
+ }
2313
+ const u = o(r.primaryKey.keyPath, 0, r.primaryKey);
2314
+ s[":id"] = [u];
2315
+ for (const c of r.indexes)
2316
+ o(c.keyPath, 0, c);
2317
+ function a(c) {
2318
+ const l = c.query.index;
2319
+ return l.isVirtual ? { ...c, query: { index: l, range: (h = c.query.range, p = l.keyTail, { type: h.type === 1 ? 2 : h.type, lower: et(h.lower, h.lowerOpen ? t.MAX_KEY : t.MIN_KEY, p), lowerOpen: !0, upper: et(h.upper, h.upperOpen ? t.MIN_KEY : t.MAX_KEY, p), upperOpen: !0 }) } } : c;
2320
+ var h, p;
2321
+ }
2322
+ return { ...n, schema: { ...r, primaryKey: u, indexes: i, getIndexByKeyPath: function(c) {
2323
+ const l = s[Ne(c)];
2324
+ return l && l[0];
2325
+ } }, count: (c) => n.count(a(c)), query: (c) => n.query(a(c)), openCursor(c) {
2326
+ const { keyTail: l, isVirtual: h, keyLength: p } = c.query.index;
2327
+ return h ? n.openCursor(a(c)).then((g) => g && function(f) {
2328
+ return Object.create(f, { continue: { value: function(m) {
2329
+ m != null ? f.continue(et(m, c.reverse ? t.MAX_KEY : t.MIN_KEY, l)) : c.unique ? f.continue(f.key.slice(0, p).concat(c.reverse ? t.MIN_KEY : t.MAX_KEY, l)) : f.continue();
2330
+ } }, continuePrimaryKey: { value(m, y) {
2331
+ f.continuePrimaryKey(et(m, t.MAX_KEY, l), y);
2332
+ } }, primaryKey: { get: () => f.primaryKey }, key: { get() {
2333
+ const m = f.key;
2334
+ return p === 1 ? m[0] : m.slice(0, p);
2335
+ } }, value: { get: () => f.value } });
2336
+ }(g)) : n.openCursor(c);
2337
+ } };
2338
+ } };
2339
+ } };
2340
+ function un(t, e, n, r) {
2341
+ return n = n || {}, r = r || "", B(t).forEach((s) => {
2342
+ if (W(e, s)) {
2343
+ var i = t[s], o = e[s];
2344
+ if (typeof i == "object" && typeof o == "object" && i && o) {
2345
+ const u = St(i);
2346
+ u !== St(o) ? n[r + s] = e[s] : u === "Object" ? un(i, o, n, r + s + ".") : i !== o && (n[r + s] = e[s]);
2347
+ } else
2348
+ i !== o && (n[r + s] = e[s]);
2349
+ } else
2350
+ n[r + s] = void 0;
2351
+ }), B(e).forEach((s) => {
2352
+ W(t, s) || (n[r + s] = e[s]);
2353
+ }), n;
2354
+ }
2355
+ const $r = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: (t) => ({ ...t, table(e) {
2356
+ const n = t.table(e), { primaryKey: r } = n.schema;
2357
+ return { ...n, mutate(i) {
2358
+ const o = A.trans, { deleting: u, creating: a, updating: d } = o.table(e).hook;
2359
+ switch (i.type) {
2360
+ case "add":
2361
+ if (a.fire === C)
2362
+ break;
2363
+ return o._promise("readwrite", () => c(i), !0);
2364
+ case "put":
2365
+ if (a.fire === C && d.fire === C)
2366
+ break;
2367
+ return o._promise("readwrite", () => c(i), !0);
2368
+ case "delete":
2369
+ if (u.fire === C)
2370
+ break;
2371
+ return o._promise("readwrite", () => c(i), !0);
2372
+ case "deleteRange":
2373
+ if (u.fire === C)
2374
+ break;
2375
+ return o._promise("readwrite", () => function(h) {
2376
+ return l(h.trans, h.range, 1e4);
2377
+ }(i), !0);
2378
+ }
2379
+ return n.mutate(i);
2380
+ function c(h) {
2381
+ const p = A.trans, g = h.keys || function(f, v) {
2382
+ return v.type === "delete" ? v.keys : v.keys || v.values.map(f.extractKey);
2383
+ }(r, h);
2384
+ if (!g)
2385
+ throw new Error("Keys missing");
2386
+ return (h = h.type === "add" || h.type === "put" ? { ...h, keys: g } : { ...h }).type !== "delete" && (h.values = [...h.values]), h.keys && (h.keys = [...h.keys]), function(f, v, m) {
2387
+ return v.type === "add" ? Promise.resolve([]) : f.getMany({ trans: v.trans, keys: m, cache: "immutable" });
2388
+ }(n, h, g).then((f) => {
2389
+ const v = g.map((m, y) => {
2390
+ const w = f[y], P = { onerror: null, onsuccess: null };
2391
+ if (h.type === "delete")
2392
+ u.fire.call(P, m, w, p);
2393
+ else if (h.type === "add" || w === void 0) {
2394
+ const x = a.fire.call(P, m, h.values[y], p);
2395
+ m == null && x != null && (m = x, h.keys[y] = m, r.outbound || z(h.values[y], r.keyPath, m));
2396
+ } else {
2397
+ const x = un(w, h.values[y]), k = d.fire.call(P, x, m, w, p);
2398
+ if (k) {
2399
+ const b = h.values[y];
2400
+ Object.keys(k).forEach((K) => {
2401
+ W(b, K) ? b[K] = k[K] : z(b, K, k[K]);
2402
+ });
2403
+ }
2404
+ }
2405
+ return P;
2406
+ });
2407
+ return n.mutate(h).then(({ failures: m, results: y, numFailures: w, lastResult: P }) => {
2408
+ for (let x = 0; x < g.length; ++x) {
2409
+ const k = y ? y[x] : g[x], b = v[x];
2410
+ k == null ? b.onerror && b.onerror(m[x]) : b.onsuccess && b.onsuccess(h.type === "put" && f[x] ? h.values[x] : k);
2411
+ }
2412
+ return { failures: m, results: y, numFailures: w, lastResult: P };
2413
+ }).catch((m) => (v.forEach((y) => y.onerror && y.onerror(m)), Promise.reject(m)));
2414
+ });
2415
+ }
2416
+ function l(h, p, g) {
2417
+ return n.query({ trans: h, values: !1, query: { index: r, range: p }, limit: g }).then(({ result: f }) => c({ type: "delete", keys: f, trans: h }).then((v) => v.numFailures > 0 ? Promise.reject(v.failures[0]) : f.length < g ? { failures: [], numFailures: 0, lastResult: void 0 } : l(h, { ...p, lower: f[f.length - 1], lowerOpen: !0 }, g)));
2418
+ }
2419
+ } };
2420
+ } }) };
2421
+ function Xn(t, e, n) {
2422
+ try {
2423
+ if (!e || e.keys.length < t.length)
2424
+ return null;
2425
+ const r = [];
2426
+ for (let s = 0, i = 0; s < e.keys.length && i < t.length; ++s)
2427
+ $(e.keys[s], t[i]) === 0 && (r.push(n ? We(e.values[s]) : e.values[s]), ++i);
2428
+ return r.length === t.length ? r : null;
2429
+ } catch {
2430
+ return null;
2431
+ }
2432
+ }
2433
+ const Ur = { stack: "dbcore", level: -1, create: (t) => ({ table: (e) => {
2434
+ const n = t.table(e);
2435
+ return { ...n, getMany: (r) => {
2436
+ if (!r.cache)
2437
+ return n.getMany(r);
2438
+ const s = Xn(r.keys, r.trans._cache, r.cache === "clone");
2439
+ return s ? E.resolve(s) : n.getMany(r).then((i) => (r.trans._cache = { keys: r.keys, values: r.cache === "clone" ? We(i) : i }, i));
2440
+ }, mutate: (r) => (r.type !== "add" && (r.trans._cache = null), n.mutate(r)) };
2441
+ } }) };
2442
+ function cn(t) {
2443
+ return !("from" in t);
2444
+ }
2445
+ const Q = function(t, e) {
2446
+ if (!this) {
2447
+ const n = new Q();
2448
+ return t && "d" in t && U(n, t), n;
2449
+ }
2450
+ U(this, arguments.length ? { d: 1, from: t, to: arguments.length > 1 ? e : t } : { d: 0 });
2451
+ };
2452
+ function Le(t, e, n) {
2453
+ const r = $(e, n);
2454
+ if (isNaN(r))
2455
+ return;
2456
+ if (r > 0)
2457
+ throw RangeError();
2458
+ if (cn(t))
2459
+ return U(t, { from: e, to: n, d: 1 });
2460
+ const s = t.l, i = t.r;
2461
+ if ($(n, t.from) < 0)
2462
+ return s ? Le(s, e, n) : t.l = { from: e, to: n, d: 1, l: null, r: null }, _n(t);
2463
+ if ($(e, t.to) > 0)
2464
+ return i ? Le(i, e, n) : t.r = { from: e, to: n, d: 1, l: null, r: null }, _n(t);
2465
+ $(e, t.from) < 0 && (t.from = e, t.l = null, t.d = i ? i.d + 1 : 1), $(n, t.to) > 0 && (t.to = n, t.r = null, t.d = t.l ? t.l.d + 1 : 1);
2466
+ const o = !t.r;
2467
+ s && !t.l && yt(t, s), i && o && yt(t, i);
2468
+ }
2469
+ function yt(t, e) {
2470
+ cn(e) || function n(r, { from: s, to: i, l: o, r: u }) {
2471
+ Le(r, s, i), o && n(r, o), u && n(r, u);
2472
+ }(t, e);
2473
+ }
2474
+ function Vr(t, e) {
2475
+ const n = Gt(e);
2476
+ let r = n.next();
2477
+ if (r.done)
2478
+ return !1;
2479
+ let s = r.value;
2480
+ const i = Gt(t);
2481
+ let o = i.next(s.from), u = o.value;
2482
+ for (; !r.done && !o.done; ) {
2483
+ if ($(u.from, s.to) <= 0 && $(u.to, s.from) >= 0)
2484
+ return !0;
2485
+ $(s.from, u.from) < 0 ? s = (r = n.next(u.from)).value : u = (o = i.next(s.from)).value;
2486
+ }
2487
+ return !1;
2488
+ }
2489
+ function Gt(t) {
2490
+ let e = cn(t) ? null : { s: 0, n: t };
2491
+ return { next(n) {
2492
+ const r = arguments.length > 0;
2493
+ for (; e; )
2494
+ switch (e.s) {
2495
+ case 0:
2496
+ if (e.s = 1, r)
2497
+ for (; e.n.l && $(n, e.n.from) < 0; )
2498
+ e = { up: e, n: e.n.l, s: 1 };
2499
+ else
2500
+ for (; e.n.l; )
2501
+ e = { up: e, n: e.n.l, s: 1 };
2502
+ case 1:
2503
+ if (e.s = 2, !r || $(n, e.n.to) <= 0)
2504
+ return { value: e.n, done: !1 };
2505
+ case 2:
2506
+ if (e.n.r) {
2507
+ e.s = 3, e = { up: e, n: e.n.r, s: 0 };
2508
+ continue;
2509
+ }
2510
+ case 3:
2511
+ e = e.up;
2512
+ }
2513
+ return { done: !0 };
2514
+ } };
2515
+ }
2516
+ function _n(t) {
2517
+ var e, n;
2518
+ const r = (((e = t.r) === null || e === void 0 ? void 0 : e.d) || 0) - (((n = t.l) === null || n === void 0 ? void 0 : n.d) || 0), s = r > 1 ? "r" : r < -1 ? "l" : "";
2519
+ if (s) {
2520
+ const i = s === "r" ? "l" : "r", o = { ...t }, u = t[s];
2521
+ t.from = u.from, t.to = u.to, t[s] = u[s], o[s] = u[i], t[i] = o, o.d = kn(o);
2522
+ }
2523
+ t.d = kn(t);
2524
+ }
2525
+ function kn({ r: t, l: e }) {
2526
+ return (t ? e ? Math.max(t.d, e.d) : t.d : e ? e.d : 0) + 1;
2527
+ }
2528
+ Pe(Q.prototype, { add(t) {
2529
+ return yt(this, t), this;
2530
+ }, addKey(t) {
2531
+ return Le(this, t, t), this;
2532
+ }, addKeys(t) {
2533
+ return t.forEach((e) => Le(this, e, e)), this;
2534
+ }, [Kt]() {
2535
+ return Gt(this);
2536
+ } });
2537
+ const Lr = { stack: "dbcore", level: 0, create: (t) => {
2538
+ const e = t.schema.name, n = new Q(t.MIN_KEY, t.MAX_KEY);
2539
+ return { ...t, table: (r) => {
2540
+ const s = t.table(r), { schema: i } = s, { primaryKey: o } = i, { extractKey: u, outbound: a } = o, d = { ...s, mutate: (h) => {
2541
+ const p = h.trans, g = p.mutatedParts || (p.mutatedParts = {}), f = (k) => {
2542
+ const b = `idb://${e}/${r}/${k}`;
2543
+ return g[b] || (g[b] = new Q());
2544
+ }, v = f(""), m = f(":dels"), { type: y } = h;
2545
+ let [w, P] = h.type === "deleteRange" ? [h.range] : h.type === "delete" ? [h.keys] : h.values.length < 50 ? [[], h.values] : [];
2546
+ const x = h.trans._cache;
2547
+ return s.mutate(h).then((k) => {
2548
+ if (M(w)) {
2549
+ y !== "delete" && (w = k.results), v.addKeys(w);
2550
+ const b = Xn(w, x);
2551
+ b || y === "add" || m.addKeys(w), (b || P) && function(K, _, T, O) {
2552
+ function q(N) {
2553
+ const D = K(N.name || "");
2554
+ function ge(V) {
2555
+ return V != null ? N.extractKey(V) : null;
2556
+ }
2557
+ const ve = (V) => N.multiEntry && M(V) ? V.forEach((ue) => D.addKey(ue)) : D.addKey(V);
2558
+ (T || O).forEach((V, ue) => {
2559
+ const Ke = T && ge(T[ue]), vt = O && ge(O[ue]);
2560
+ $(Ke, vt) !== 0 && (Ke != null && ve(Ke), vt != null && ve(vt));
2561
+ });
2562
+ }
2563
+ _.indexes.forEach(q);
2564
+ }(f, i, b, P);
2565
+ } else if (w) {
2566
+ const b = { from: w.lower, to: w.upper };
2567
+ m.add(b), v.add(b);
2568
+ } else
2569
+ v.add(n), m.add(n), i.indexes.forEach((b) => f(b.name).add(n));
2570
+ return k;
2571
+ });
2572
+ } }, c = ({ query: { index: h, range: p } }) => {
2573
+ var g, f;
2574
+ return [h, new Q((g = p.lower) !== null && g !== void 0 ? g : t.MIN_KEY, (f = p.upper) !== null && f !== void 0 ? f : t.MAX_KEY)];
2575
+ }, l = { get: (h) => [o, new Q(h.key)], getMany: (h) => [o, new Q().addKeys(h.keys)], count: c, query: c, openCursor: c };
2576
+ return B(l).forEach((h) => {
2577
+ d[h] = function(p) {
2578
+ const { subscr: g } = A;
2579
+ if (g) {
2580
+ const f = (P) => {
2581
+ const x = `idb://${e}/${r}/${P}`;
2582
+ return g[x] || (g[x] = new Q());
2583
+ }, v = f(""), m = f(":dels"), [y, w] = l[h](p);
2584
+ if (f(y.name || "").add(w), !y.isPrimaryKey) {
2585
+ if (h !== "count") {
2586
+ const P = h === "query" && a && p.values && s.query({ ...p, values: !1 });
2587
+ return s[h].apply(this, arguments).then((x) => {
2588
+ if (h === "query") {
2589
+ if (a && p.values)
2590
+ return P.then(({ result: b }) => (v.addKeys(b), x));
2591
+ const k = p.values ? x.result.map(u) : x.result;
2592
+ p.values ? v.addKeys(k) : m.addKeys(k);
2593
+ } else if (h === "openCursor") {
2594
+ const k = x, b = p.values;
2595
+ return k && Object.create(k, { key: { get: () => (m.addKey(k.primaryKey), k.key) }, primaryKey: { get() {
2596
+ const K = k.primaryKey;
2597
+ return m.addKey(K), K;
2598
+ } }, value: { get: () => (b && v.addKey(k.primaryKey), k.value) } });
2599
+ }
2600
+ return x;
2601
+ });
2602
+ }
2603
+ m.add(n);
2604
+ }
2605
+ }
2606
+ return s[h].apply(this, arguments);
2607
+ };
2608
+ }), d;
2609
+ } };
2610
+ } };
2611
+ class fe {
2612
+ constructor(e, n) {
2613
+ this._middlewares = {}, this.verno = 0;
2614
+ const r = fe.dependencies;
2615
+ this._options = n = { addons: fe.addons, autoOpen: !0, indexedDB: r.indexedDB, IDBKeyRange: r.IDBKeyRange, ...n }, this._deps = { indexedDB: n.indexedDB, IDBKeyRange: n.IDBKeyRange };
2616
+ const { addons: s } = n;
2617
+ this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
2618
+ const i = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: C, dbReadyPromise: null, cancelOpen: C, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3 };
2619
+ var o;
2620
+ i.dbReadyPromise = new E((u) => {
2621
+ i.dbReadyResolve = u;
2622
+ }), i.openCanceller = new E((u, a) => {
2623
+ i.cancelOpen = a;
2624
+ }), this._state = i, this.name = e, this.on = Re(this, "populate", "blocked", "versionchange", "close", { ready: [tn, C] }), this.on.ready.subscribe = En(this.on.ready.subscribe, (u) => (a, d) => {
2625
+ fe.vip(() => {
2626
+ const c = this._state;
2627
+ if (c.openComplete)
2628
+ c.dbOpenError || E.resolve().then(a), d && u(a);
2629
+ else if (c.onReadyBeingFired)
2630
+ c.onReadyBeingFired.push(a), d && u(a);
2631
+ else {
2632
+ u(a);
2633
+ const l = this;
2634
+ d || u(function h() {
2635
+ l.on.ready.unsubscribe(a), l.on.ready.unsubscribe(h);
2636
+ });
2637
+ }
2638
+ });
2639
+ }), this.Collection = (o = this, Ce(Sr.prototype, function(u, a) {
2640
+ this.db = o;
2641
+ let d = Wn, c = null;
2642
+ if (a)
2643
+ try {
2644
+ d = a();
2645
+ } catch (g) {
2646
+ c = g;
2647
+ }
2648
+ const l = u._ctx, h = l.table, p = h.hook.reading.fire;
2649
+ this._ctx = { table: h, index: l.index, isPrimKey: !l.index || h.schema.primKey.keyPath && l.index === h.schema.primKey.name, range: d, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: c, or: l.or, valueMapper: p !== Me ? p : null };
2650
+ })), this.Table = function(u) {
2651
+ return Ce(Ar.prototype, function(a, d, c) {
2652
+ this.db = u, this._tx = c, this.name = a, this.schema = d, this.hook = u._allTables[a] ? u._allTables[a].hook : Re(null, { creating: [pr, C], reading: [fr, Me], updating: [mr, C], deleting: [yr, C] });
2653
+ });
2654
+ }(this), this.Transaction = function(u) {
2655
+ return Ce(Ir.prototype, function(a, d, c, l, h) {
2656
+ this.db = u, this.mode = a, this.storeNames = d, this.schema = c, this.chromeTransactionDurability = l, this.idbtrans = null, this.on = Re(this, "complete", "error", "abort"), this.parent = h || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new E((p, g) => {
2657
+ this._resolve = p, this._reject = g;
2658
+ }), this._completion.then(() => {
2659
+ this.active = !1, this.on.complete.fire();
2660
+ }, (p) => {
2661
+ var g = this.active;
2662
+ return this.active = !1, this.on.error.fire(p), this.parent ? this.parent._reject(p) : g && this.idbtrans && this.idbtrans.abort(), R(p);
2663
+ });
2664
+ });
2665
+ }(this), this.Version = function(u) {
2666
+ return Ce(Rr.prototype, function(a) {
2667
+ this.db = u, this._cfg = { version: a, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
2668
+ });
2669
+ }(this), this.WhereClause = function(u) {
2670
+ return Ce(Hn.prototype, function(a, d, c) {
2671
+ this.db = u, this._ctx = { table: a, index: d === ":id" ? null : d, or: c };
2672
+ const l = u._deps.indexedDB;
2673
+ if (!l)
2674
+ throw new S.MissingAPI();
2675
+ this._cmp = this._ascending = l.cmp.bind(l), this._descending = (h, p) => l.cmp(p, h), this._max = (h, p) => l.cmp(h, p) > 0 ? h : p, this._min = (h, p) => l.cmp(h, p) < 0 ? h : p, this._IDBKeyRange = u._deps.IDBKeyRange;
2676
+ });
2677
+ }(this), this.on("versionchange", (u) => {
2678
+ u.newVersion > 0 ? console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`) : console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`), this.close();
2679
+ }), this.on("blocked", (u) => {
2680
+ !u.newVersion || u.newVersion < u.oldVersion ? console.warn(`Dexie.delete('${this.name}') was blocked`) : console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${u.oldVersion / 10}`);
2681
+ }), this._maxKey = Ve(n.IDBKeyRange), this._createTransaction = (u, a, d, c) => new this.Transaction(u, a, d, this._options.chromeTransactionDurability, c), this._fireOnBlocked = (u) => {
2682
+ this.on("blocked").fire(u), Be.filter((a) => a.name === this.name && a !== this && !a._state.vcFired).map((a) => a.on("versionchange").fire(u));
2683
+ }, this.use(qr), this.use($r), this.use(Lr), this.use(Ur), this.vip = Object.create(this, { _vip: { value: !0 } }), s.forEach((u) => u(this));
2684
+ }
2685
+ version(e) {
2686
+ if (isNaN(e) || e < 0.1)
2687
+ throw new S.Type("Given version is not a positive number");
2688
+ if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened)
2689
+ throw new S.Schema("Cannot add version when database is open");
2690
+ this.verno = Math.max(this.verno, e);
2691
+ const n = this._versions;
2692
+ var r = n.filter((s) => s._cfg.version === e)[0];
2693
+ return r || (r = new this.Version(e), n.push(r), n.sort(Dr), r.stores({}), this._state.autoSchema = !1, r);
2694
+ }
2695
+ _whenReady(e) {
2696
+ return this.idbdb && (this._state.openComplete || A.letThrough || this._vip) ? e() : new E((n, r) => {
2697
+ if (this._state.openComplete)
2698
+ return r(new S.DatabaseClosed(this._state.dbOpenError));
2699
+ if (!this._state.isBeingOpened) {
2700
+ if (!this._options.autoOpen)
2701
+ return void r(new S.DatabaseClosed());
2702
+ this.open().catch(C);
2703
+ }
2704
+ this._state.dbReadyPromise.then(n, r);
2705
+ }).then(e);
2706
+ }
2707
+ use({ stack: e, create: n, level: r, name: s }) {
2708
+ s && this.unuse({ stack: e, name: s });
2709
+ const i = this._middlewares[e] || (this._middlewares[e] = []);
2710
+ return i.push({ stack: e, create: n, level: r ?? 10, name: s }), i.sort((o, u) => o.level - u.level), this;
2711
+ }
2712
+ unuse({ stack: e, name: n, create: r }) {
2713
+ return e && this._middlewares[e] && (this._middlewares[e] = this._middlewares[e].filter((s) => r ? s.create !== r : !!n && s.name !== n)), this;
2714
+ }
2715
+ open() {
2716
+ return Fr(this);
2717
+ }
2718
+ _close() {
2719
+ const e = this._state, n = Be.indexOf(this);
2720
+ if (n >= 0 && Be.splice(n, 1), this.idbdb) {
2721
+ try {
2722
+ this.idbdb.close();
2723
+ } catch {
2724
+ }
2725
+ this._novip.idbdb = null;
2726
+ }
2727
+ e.dbReadyPromise = new E((r) => {
2728
+ e.dbReadyResolve = r;
2729
+ }), e.openCanceller = new E((r, s) => {
2730
+ e.cancelOpen = s;
2731
+ });
2732
+ }
2733
+ close() {
2734
+ this._close();
2735
+ const e = this._state;
2736
+ this._options.autoOpen = !1, e.dbOpenError = new S.DatabaseClosed(), e.isBeingOpened && e.cancelOpen(e.dbOpenError);
2737
+ }
2738
+ delete() {
2739
+ const e = arguments.length > 0, n = this._state;
2740
+ return new E((r, s) => {
2741
+ const i = () => {
2742
+ this.close();
2743
+ var o = this._deps.indexedDB.deleteDatabase(this.name);
2744
+ o.onsuccess = j(() => {
2745
+ ((function({ indexedDB: u, IDBKeyRange: a }, d) {
2746
+ !an(u) && d !== gt && on(u, a).delete(d).catch(C);
2747
+ }))(this._deps, this.name), r();
2748
+ }), o.onerror = H(s), o.onblocked = this._fireOnBlocked;
2749
+ };
2750
+ if (e)
2751
+ throw new S.InvalidArgument("Arguments not allowed in db.delete()");
2752
+ n.isBeingOpened ? n.dbReadyPromise.then(i) : i();
2753
+ });
2754
+ }
2755
+ backendDB() {
2756
+ return this.idbdb;
2757
+ }
2758
+ isOpen() {
2759
+ return this.idbdb !== null;
2760
+ }
2761
+ hasBeenClosed() {
2762
+ const e = this._state.dbOpenError;
2763
+ return e && e.name === "DatabaseClosed";
2764
+ }
2765
+ hasFailed() {
2766
+ return this._state.dbOpenError !== null;
2767
+ }
2768
+ dynamicallyOpened() {
2769
+ return this._state.autoSchema;
2770
+ }
2771
+ get tables() {
2772
+ return B(this._allTables).map((e) => this._allTables[e]);
2773
+ }
2774
+ transaction() {
2775
+ const e = Mr.apply(this, arguments);
2776
+ return this._transaction.apply(this, e);
2777
+ }
2778
+ _transaction(e, n, r) {
2779
+ let s = A.trans;
2780
+ s && s.db === this && e.indexOf("!") === -1 || (s = null);
2781
+ const i = e.indexOf("?") !== -1;
2782
+ let o, u;
2783
+ e = e.replace("!", "").replace("?", "");
2784
+ try {
2785
+ if (u = n.map((d) => {
2786
+ var c = d instanceof this.Table ? d.name : d;
2787
+ if (typeof c != "string")
2788
+ throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
2789
+ return c;
2790
+ }), e == "r" || e === wt)
2791
+ o = wt;
2792
+ else {
2793
+ if (e != "rw" && e != _t)
2794
+ throw new S.InvalidArgument("Invalid transaction mode: " + e);
2795
+ o = _t;
2796
+ }
2797
+ if (s) {
2798
+ if (s.mode === wt && o === _t) {
2799
+ if (!i)
2800
+ throw new S.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
2801
+ s = null;
2802
+ }
2803
+ s && u.forEach((d) => {
2804
+ if (s && s.storeNames.indexOf(d) === -1) {
2805
+ if (!i)
2806
+ throw new S.SubTransaction("Table " + d + " not included in parent transaction.");
2807
+ s = null;
2808
+ }
2809
+ }), i && s && !s.active && (s = null);
2810
+ }
2811
+ } catch (d) {
2812
+ return s ? s._promise(null, (c, l) => {
2813
+ l(d);
2814
+ }) : R(d);
2815
+ }
2816
+ const a = Jn.bind(null, this, o, u, s, r);
2817
+ return s ? s._promise(o, a, "lock") : A.trans ? Se(A.transless, () => this._whenReady(a)) : this._whenReady(a);
2818
+ }
2819
+ table(e) {
2820
+ if (!W(this._allTables, e))
2821
+ throw new S.InvalidTable(`Table ${e} does not exist`);
2822
+ return this._allTables[e];
2823
+ }
2824
+ }
2825
+ const Wr = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable";
2826
+ class zr {
2827
+ constructor(e) {
2828
+ this._subscribe = e;
2829
+ }
2830
+ subscribe(e, n, r) {
2831
+ return this._subscribe(e && typeof e != "function" ? e : { next: e, error: n, complete: r });
2832
+ }
2833
+ [Wr]() {
2834
+ return this;
2835
+ }
2836
+ }
2837
+ function Zn(t, e) {
2838
+ return B(e).forEach((n) => {
2839
+ yt(t[n] || (t[n] = new Q()), e[n]);
2840
+ }), t;
2841
+ }
2842
+ function Hr(t) {
2843
+ let e, n = !1;
2844
+ const r = new zr((s) => {
2845
+ const i = Xt(t);
2846
+ let o = !1, u = {}, a = {};
2847
+ const d = { get closed() {
2848
+ return o;
2849
+ }, unsubscribe: () => {
2850
+ o = !0, ae.storagemutated.unsubscribe(p);
2851
+ } };
2852
+ s.start && s.start(d);
2853
+ let c = !1, l = !1;
2854
+ function h() {
2855
+ return B(a).some((f) => u[f] && Vr(u[f], a[f]));
2856
+ }
2857
+ const p = (f) => {
2858
+ Zn(u, f), h() && g();
2859
+ }, g = () => {
2860
+ if (c || o)
2861
+ return;
2862
+ u = {};
2863
+ const f = {}, v = function(m) {
2864
+ i && Ae();
2865
+ const y = () => ie(t, { subscr: m, trans: null }), w = A.trans ? Se(A.transless, y) : y();
2866
+ return i && w.then(te, te), w;
2867
+ }(f);
2868
+ l || (ae(Ue, p), l = !0), c = !0, Promise.resolve(v).then((m) => {
2869
+ n = !0, e = m, c = !1, o || (h() ? g() : (u = {}, a = f, s.next && s.next(m)));
2870
+ }, (m) => {
2871
+ c = !1, n = !1, s.error && s.error(m), d.unsubscribe();
2872
+ });
2873
+ };
2874
+ return g(), d;
2875
+ });
2876
+ return r.hasValue = () => n, r.getValue = () => e, r;
2877
+ }
2878
+ let Qt;
2879
+ try {
2880
+ Qt = { indexedDB: I.indexedDB || I.mozIndexedDB || I.webkitIndexedDB || I.msIndexedDB, IDBKeyRange: I.IDBKeyRange || I.webkitIDBKeyRange };
2881
+ } catch {
2882
+ Qt = { indexedDB: null, IDBKeyRange: null };
2883
+ }
2884
+ const ce = fe;
2885
+ function at(t) {
2886
+ let e = X;
2887
+ try {
2888
+ X = !0, ae.storagemutated.fire(t);
2889
+ } finally {
2890
+ X = e;
2891
+ }
2892
+ }
2893
+ Pe(ce, { ...tt, delete: (t) => new ce(t, { addons: [] }).delete(), exists: (t) => new ce(t, { addons: [] }).open().then((e) => (e.close(), !0)).catch("NoSuchDatabaseError", () => !1), getDatabaseNames(t) {
2894
+ try {
2895
+ return function({ indexedDB: e, IDBKeyRange: n }) {
2896
+ return an(e) ? Promise.resolve(e.databases()).then((r) => r.map((s) => s.name).filter((s) => s !== gt)) : on(e, n).toCollection().primaryKeys();
2897
+ }(ce.dependencies).then(t);
2898
+ } catch {
2899
+ return R(new S.MissingAPI());
2900
+ }
2901
+ }, defineClass: () => function(t) {
2902
+ U(this, t);
2903
+ }, ignoreTransaction: (t) => A.trans ? Se(A.transless, t) : t(), vip: Ht, async: function(t) {
2904
+ return function() {
2905
+ try {
2906
+ var e = Yt(t.apply(this, arguments));
2907
+ return e && typeof e.then == "function" ? e : E.resolve(e);
2908
+ } catch (n) {
2909
+ return R(n);
2910
+ }
2911
+ };
2912
+ }, spawn: function(t, e, n) {
2913
+ try {
2914
+ var r = Yt(t.apply(n, e || []));
2915
+ return r && typeof r.then == "function" ? r : E.resolve(r);
2916
+ } catch (s) {
2917
+ return R(s);
2918
+ }
2919
+ }, currentTransaction: { get: () => A.trans || null }, waitFor: function(t, e) {
2920
+ const n = E.resolve(typeof t == "function" ? ce.ignoreTransaction(t) : t).timeout(e || 6e4);
2921
+ return A.trans ? A.trans.waitFor(n) : n;
2922
+ }, Promise: E, debug: { get: () => Y, set: (t) => {
2923
+ Cn(t, t === "dexie" ? () => !0 : Ln);
2924
+ } }, derive: ke, extend: U, props: Pe, override: En, Events: Re, on: ae, liveQuery: Hr, extendObservabilitySet: Zn, getByKeyPath: ee, setByKeyPath: z, delByKeyPath: function(t, e) {
2925
+ typeof e == "string" ? z(t, e, void 0) : "length" in e && [].map.call(e, function(n) {
2926
+ z(t, n, void 0);
2927
+ });
2928
+ }, shallowClone: Sn, deepClone: We, getObjectDiff: un, cmp: $, asap: Pn, minKey: Mt, addons: [], connections: Be, errnames: en, dependencies: Qt, semVer: yn, version: yn.split(".").map((t) => parseInt(t)).reduce((t, e, n) => t + e / Math.pow(10, 2 * n)) }), ce.maxKey = Ve(ce.dependencies.IDBKeyRange), typeof dispatchEvent < "u" && typeof addEventListener < "u" && (ae(Ue, (t) => {
2929
+ if (!X) {
2930
+ let e;
2931
+ mt ? (e = document.createEvent("CustomEvent"), e.initCustomEvent(se, !0, !0, t)) : e = new CustomEvent(se, { detail: t }), X = !0, dispatchEvent(e), X = !1;
2932
+ }
2933
+ }), addEventListener(se, ({ detail: t }) => {
2934
+ X || at(t);
2935
+ }));
2936
+ let X = !1;
2937
+ if (typeof BroadcastChannel < "u") {
2938
+ const t = new BroadcastChannel(se);
2939
+ typeof t.unref == "function" && t.unref(), ae(Ue, (e) => {
2940
+ X || t.postMessage(e);
2941
+ }), t.onmessage = (e) => {
2942
+ e.data && at(e.data);
2943
+ };
2944
+ } else if (typeof self < "u" && typeof navigator < "u") {
2945
+ ae(Ue, (e) => {
2946
+ try {
2947
+ X || (typeof localStorage < "u" && localStorage.setItem(se, JSON.stringify({ trig: Math.random(), changedParts: e })), typeof self.clients == "object" && [...self.clients.matchAll({ includeUncontrolled: !0 })].forEach((n) => n.postMessage({ type: se, changedParts: e })));
2948
+ } catch {
2949
+ }
2950
+ }), typeof addEventListener < "u" && addEventListener("storage", (e) => {
2951
+ if (e.key === se) {
2952
+ const n = JSON.parse(e.newValue);
2953
+ n && at(n.changedParts);
2954
+ }
2955
+ });
2956
+ const t = self.document && navigator.serviceWorker;
2957
+ t && t.addEventListener("message", function({ data: e }) {
2958
+ e && e.type === se && at(e.changedParts);
2959
+ });
2960
+ }
2961
+ E.rejectionMapper = function(t, e) {
2962
+ if (!t || t instanceof xe || t instanceof TypeError || t instanceof SyntaxError || !t.name || !hn[t.name])
2963
+ return t;
2964
+ var n = new hn[t.name](e || t.message, t);
2965
+ return "stack" in t && Z(n, "stack", { get: function() {
2966
+ return this.inner.stack;
2967
+ } }), n;
2968
+ }, Cn(Y, Ln);
2969
+ class Yr extends fe {
2970
+ constructor() {
2971
+ super("NylasAuthDatabase");
2972
+ Oe(this, "grant");
2973
+ Oe(this, "pkce");
2974
+ this.version(1).stores({
2975
+ grant: "++id,token",
2976
+ pkce: "++id,codeVerifier"
2977
+ }), this.grant = this.table("grant"), this.pkce = this.table("pkce");
2978
+ }
2979
+ }
2980
+ class Gr {
2981
+ constructor() {
2982
+ Oe(this, "theDB");
2983
+ this.theDB = new Yr();
2984
+ }
2985
+ async setCodeVerifier(e) {
2986
+ await this.theDB.pkce.put({ id: 1, codeVerifier: e }, 1);
2987
+ }
2988
+ async getCodeVerifier() {
2989
+ const [e] = await this.theDB.pkce.toArray();
2990
+ return e ? e.codeVerifier : null;
2991
+ }
2992
+ async getTokenInfo() {
2993
+ const e = await this.theDB.grant.get(1);
2994
+ return e ? e.token : null;
2995
+ }
2996
+ async setTokenInfo(e) {
2997
+ await this.theDB.grant.put({ id: 1, token: e }, 1);
2998
+ }
2999
+ async reset() {
3000
+ await this.theDB.grant.clear();
3001
+ }
3002
+ }
3003
+ function es(t) {
3004
+ const e = "NylasAuth";
3005
+ if (!t)
3006
+ throw new Error("NylasAuth requires a config object");
3007
+ let n = null;
3008
+ if (t.storageType === "indexeddb" && (n = new Gr()), !n)
3009
+ throw new Error("NylasAuth requires a storage object");
3010
+ const r = [
3011
+ {
3012
+ type: "read-only",
3013
+ value: "https://www.googleapis.com/auth/gmail.readonly"
3014
+ },
3015
+ {
3016
+ type: "modify",
3017
+ value: "https://www.googleapis.com/auth/gmail.modify"
3018
+ },
3019
+ {
3020
+ type: "compose",
3021
+ value: "https://www.googleapis.com/auth/gmail.compose"
3022
+ },
3023
+ {
3024
+ type: "insert",
3025
+ value: "https://www.googleapis.com/auth/gmail.insert"
3026
+ },
3027
+ {
3028
+ type: "labels",
3029
+ value: "https://www.googleapis.com/auth/gmail.labels"
3030
+ },
3031
+ {
3032
+ type: "metadata",
3033
+ value: "https://www.googleapis.com/auth/gmail.metadata"
3034
+ },
3035
+ {
3036
+ type: "settings.basic",
3037
+ value: "https://www.googleapis.com/auth/gmail.settings.basic"
3038
+ },
3039
+ {
3040
+ type: "settings.sharing",
3041
+ value: "https://www.googleapis.com/auth/gmail.settings.sharing"
3042
+ }
3043
+ ], s = [
3044
+ {
3045
+ type: "read-only",
3046
+ value: "https://outlook.office.com/mail.read"
3047
+ },
3048
+ {
3049
+ type: "modify",
3050
+ value: "https://outlook.office.com/mail.readwrite"
3051
+ },
3052
+ {
3053
+ type: "send",
3054
+ value: "https://outlook.office.com/mail.send"
3055
+ },
3056
+ {
3057
+ type: "offline",
3058
+ value: "offline_access"
3059
+ }
3060
+ ];
3061
+ async function i(o, u, a, d = !0, c, l) {
3062
+ const h = await (n == null ? void 0 : n.getTokenInfo()), p = new URL(o, c ?? t.apiUri), g = new Headers();
3063
+ g.append("Accept", "application/json"), g.append("Content-Type", "application/json"), g.append("User-Agent", e), h && g.append("Authorization", `Bearer ${h.access_token}`);
3064
+ const f = await fetch(p.toString(), {
3065
+ method: u || "GET",
3066
+ headers: g,
3067
+ mode: "cors",
3068
+ referrer: location.origin,
3069
+ body: a ? JSON.stringify(a) : void 0,
3070
+ ...l || {}
3071
+ });
3072
+ return d ? await f.json() : f.body;
3073
+ }
3074
+ return {
3075
+ config: t,
3076
+ /**
3077
+ * This method will make a request to the Nylas API to exchange an authorization code for an access token.
3078
+ * @param scopes The scopes that were used to generate the authorization code
3079
+ * @param email The email that was used to generate the authorization code
3080
+ * @param provider The provider that was used to generate the authorization code
3081
+ * @returns A promise that resolves to a URL string that can be used to redirect the user to the Nylas API to complete the authorization flow
3082
+ */
3083
+ async getHostedAuthRedirectURL(o = t.defaultScopes, u, a) {
3084
+ const d = await ln(Math.random().toString()), c = await ln(d);
3085
+ await (n == null ? void 0 : n.setCodeVerifier(d));
3086
+ const l = new URL(`${t.apiUri}/v3/connect/auth`);
3087
+ return l.searchParams.set("client_id", t.clientId), l.searchParams.set("response_type", "code"), l.searchParams.set("scope", o.join(" ")), l.searchParams.set("redirect_uri", t.redirectURI), l.searchParams.set("access_type", "offline"), l.searchParams.set("code_challenge", c), l.searchParams.set("code_challenge_method", "S256"), l.searchParams.set("options", "rotate_refresh_token"), a && l.searchParams.set("provider", a), u && l.searchParams.set("login_hint", u), l.toString();
3088
+ },
3089
+ /**
3090
+ * This method will make a request to the Nylas API to exchange an authorization code for an access token.
3091
+ * @param path A path to the Nylas API, e.g. `/v3/grants/methreads`
3092
+ * @param method GET, POST, PUT, DELETE, etc.
3093
+ * @param body A JSON object to send as the body of the request
3094
+ * @param domain The domain to use for the request, e.g. `api.us.nylas.com`
3095
+ * @param parseJSON Whether to parse the response as JSON or return the raw response (default: true)
3096
+ * @returns
3097
+ */
3098
+ nylasAPIRequest: i,
3099
+ /**
3100
+ * This method will make a request to the Nylas API to exchange an authorization code for an access token.
3101
+ * @param code The authorization code that was returned from the Nylas API
3102
+ * @returns A promise that resolves to a TokenExchangeResponse object
3103
+ */
3104
+ async exchangeAuthCodeForTokenInfo(o) {
3105
+ if (!o)
3106
+ return null;
3107
+ const u = await (n == null ? void 0 : n.getCodeVerifier()), a = await this.nylasAPIRequest("/v3/connect/token", "POST", {
3108
+ code: o,
3109
+ client_id: t.clientId,
3110
+ grant_type: "authorization_code",
3111
+ redirect_uri: t.redirectURI,
3112
+ code_verifier: u
3113
+ });
3114
+ return "error" in a || await (n == null ? void 0 : n.setTokenInfo(a)), a;
3115
+ },
3116
+ /**
3117
+ * This method will make a `application/octet-stream` request to the Nylas API to download a file.
3118
+ */
3119
+ async nylasDownloadFileRequest(o, u = "GET", a) {
3120
+ const d = await (n == null ? void 0 : n.getTokenInfo()), c = new URL(o, t.apiUri), l = new Headers();
3121
+ return l.append("Accept", "application/json"), l.append("Content-Type", "application/octet-stream"), l.append("User-Agent", e), d && l.append("Authorization", `Bearer ${d.access_token}`), (await fetch(c.toString(), {
3122
+ method: u,
3123
+ headers: l,
3124
+ mode: "cors",
3125
+ referrer: location.origin,
3126
+ body: a ? JSON.stringify(a) : void 0
3127
+ })).blob();
3128
+ },
3129
+ /**
3130
+ * This methid will clear the access token from the storage object
3131
+ */
3132
+ async logout() {
3133
+ const o = await (n == null ? void 0 : n.getTokenInfo());
3134
+ o && await this.nylasAPIRequest(`/v3/connect/revoke?token=${o.access_token}`, "POST"), await (n == null ? void 0 : n.reset());
3135
+ },
3136
+ /**
3137
+ * This method will make a request to the Nylas API to exchange an authorization code for an access token.
3138
+ * @returns A promise that resolves to a boolean indicating whether the user is authenticated
3139
+ */
3140
+ async isAuthenticated() {
3141
+ return !!await (n == null ? void 0 : n.getTokenInfo());
3142
+ },
3143
+ /**
3144
+ * This method will return information about the current access token.
3145
+ * @returns A promise with the token info
3146
+ */
3147
+ async getTokenInfo() {
3148
+ const o = await (n == null ? void 0 : n.getTokenInfo());
3149
+ if (!o)
3150
+ return null;
3151
+ const { access_token: u, ...a } = o;
3152
+ return a;
3153
+ },
3154
+ /**
3155
+ * This method will make a request to the Nylas API to validate if the current access token is valid.
3156
+ * @returns A promise that resolves to a boolean indicating whether the current access token is valid
3157
+ */
3158
+ async isAccessTokenValid() {
3159
+ const o = await (n == null ? void 0 : n.getTokenInfo());
3160
+ return o ? "data" in await this.nylasAPIRequest(
3161
+ `/v3/connect/tokeninfo?id_token=${o.id_token}`,
3162
+ "GET"
3163
+ ) : !1;
3164
+ },
3165
+ /**
3166
+ * This method will make a request to the Nylas API to refresh the current access token.
3167
+ * @returns A promise that resolves to a TokenExchangeResponse object
3168
+ */
3169
+ async refreshAccessToken() {
3170
+ const o = await (n == null ? void 0 : n.getTokenInfo());
3171
+ if (!o)
3172
+ return null;
3173
+ const u = await this.nylasAPIRequest("/v3/connect/token", "POST", {
3174
+ client_id: t.clientId,
3175
+ grant_type: "refresh_token",
3176
+ refresh_token: o.refresh_token
3177
+ });
3178
+ return "error" in u || await (n == null ? void 0 : n.setTokenInfo(u)), u;
3179
+ },
3180
+ /**
3181
+ * This method will return true if the current access token has the given scope
3182
+ * based on the type of scope (e.g. 'read-only', 'modify', 'compose', 'insert', 'labels', 'metadata', 'settings.basic', or 'settings.sharing')
3183
+ * @param type Either 'read-only', 'modify', 'compose', 'insert', 'labels', 'metadata', 'settings.basic', or 'settings.sharing'
3184
+ */
3185
+ async hasScopeByType(o = "email", u) {
3186
+ const a = await (n == null ? void 0 : n.getTokenInfo());
3187
+ if (!a)
3188
+ return !1;
3189
+ const d = a.scope.toLowerCase().split(" ");
3190
+ let c = [];
3191
+ const l = Array.isArray(u) ? u : [u];
3192
+ return o === "email" && (c = [...s, ...r].filter(
3193
+ (h) => l.includes(h.type)
3194
+ )), c.every((h) => d.includes(h.value));
3195
+ },
3196
+ /**
3197
+ * A helper method to check if the current access token has a given scope.
3198
+ * @param scope The scope(s) to check for in the current access token (e.g. https://www.googleapis.com/auth/gmail.modify)
3199
+ * @returns boolean indicating whether the current access token has the given scope
3200
+ */
3201
+ async hasScope(o) {
3202
+ const u = await (n == null ? void 0 : n.getTokenInfo());
3203
+ if (!u)
3204
+ return !1;
3205
+ const a = u.scope.toLowerCase().split(" ");
3206
+ return (Array.isArray(o) ? o : [o]).some((c) => a.includes(c.toLowerCase()));
3207
+ }
3208
+ };
3209
+ }
3210
+
3211
+ exports.NylasBaseProvider = NylasBaseProvider;
3212
+ exports.Xr = Xr;
3213
+ exports.Zr = Zr;
3214
+ exports.es = es;
3215
+ exports.nr = nr;
3216
+
3217
+ //# sourceMappingURL=index.es-e78884f5.js.map