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