{"version":3,"sources":["node_modules/flat/index.js","node_modules/@babel/runtime/helpers/interopRequireDefault.js","node_modules/@babel/runtime/helpers/typeof.js","node_modules/date-fns/_lib/requiredArgs/index.js","node_modules/date-fns/isDate/index.js","node_modules/date-fns/toDate/index.js","node_modules/date-fns/isValid/index.js","node_modules/date-fns/_lib/toInteger/index.js","node_modules/date-fns/addMilliseconds/index.js","node_modules/date-fns/subMilliseconds/index.js","node_modules/date-fns/_lib/getUTCDayOfYear/index.js","node_modules/date-fns/_lib/startOfUTCISOWeek/index.js","node_modules/date-fns/_lib/getUTCISOWeekYear/index.js","node_modules/date-fns/_lib/startOfUTCISOWeekYear/index.js","node_modules/date-fns/_lib/getUTCISOWeek/index.js","node_modules/date-fns/_lib/defaultOptions/index.js","node_modules/date-fns/_lib/startOfUTCWeek/index.js","node_modules/date-fns/_lib/getUTCWeekYear/index.js","node_modules/date-fns/_lib/startOfUTCWeekYear/index.js","node_modules/date-fns/_lib/getUTCWeek/index.js","node_modules/date-fns/_lib/addLeadingZeros/index.js","node_modules/date-fns/_lib/format/lightFormatters/index.js","node_modules/date-fns/_lib/format/formatters/index.js","node_modules/date-fns/_lib/format/longFormatters/index.js","node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds/index.js","node_modules/date-fns/_lib/protectedTokens/index.js","node_modules/date-fns/locale/en-US/_lib/formatDistance/index.js","node_modules/date-fns/locale/_lib/buildFormatLongFn/index.js","node_modules/date-fns/locale/en-US/_lib/formatLong/index.js","node_modules/date-fns/locale/en-US/_lib/formatRelative/index.js","node_modules/date-fns/locale/_lib/buildLocalizeFn/index.js","node_modules/date-fns/locale/en-US/_lib/localize/index.js","node_modules/date-fns/locale/_lib/buildMatchFn/index.js","node_modules/date-fns/locale/_lib/buildMatchPatternFn/index.js","node_modules/date-fns/locale/en-US/_lib/match/index.js","node_modules/date-fns/locale/en-US/index.js","node_modules/date-fns/_lib/defaultLocale/index.js","node_modules/date-fns/format/index.js","node_modules/date-fns/_lib/assign/index.js","node_modules/date-fns/_lib/cloneObject/index.js","node_modules/remove-accents/index.js","node_modules/dexie/dist/dexie.js","node_modules/leaflet/dist/leaflet-src.js","libs/outlook-addin/shared/src/lib/services/config.service.ts","apps/assist/src/environments/environment.ts","apps/outlook-addin/src/main.ts","libs/outlook-addin/cue-http/src/lib/services/auth-http.service.ts","node_modules/@angular/common/fesm2022/http.mjs","libs/outlook-addin/cue-http/src/lib/jwt.helper.ts","libs/outlook-addin/cue-http/src/lib/services/common-http.service.ts","libs/outlook-addin/cue-http/src/lib/services/dashboard-http.service.ts","libs/outlook-addin/cue-http/src/lib/services/azure-auth.service.ts","libs/outlook-addin/cue-http/src/lib/services/reservations-http.service.ts","libs/outlook-addin/cue-http/src/lib/services/touch-one-http.service.ts","libs/outlook-addin/cue-http/src/lib/cue-http.provider.ts","libs/outlook-addin/cue-http/src/lib/models/reservations.models.ts","libs/outlook-addin/cue-http/src/lib/models/resources.models.ts","node_modules/@angular/platform-browser/fesm2022/platform-browser.mjs","node_modules/@angular/router/fesm2022/router.mjs","node_modules/@ngrx/store/fesm2022/ngrx-store.mjs","node_modules/@angular/core/fesm2022/rxjs-interop.mjs","apps/outlook-addin/src/app/ngrx/actions/accunt.actions.ts","apps/outlook-addin/src/app/ngrx/actions/reservation.actions.ts","apps/outlook-addin/src/app/ngrx/actions/resources.actions.ts","apps/outlook-addin/src/app/ngrx/actions/user-info.actions.ts","libs/shared/translate/src/lib/helpers/get-localization.helper.ts","libs/shared/translate/src/lib/helpers/configure.helper.ts","libs/shared/api/src/models/resources/assist-resource-file-bm.model.ts","libs/shared/api/src/models/resources/cscode.model.ts","libs/shared/api/src/models/common/localized-string.ts","libs/shared/api/src/models/navigation/navigation-model.ts","libs/shared/api/src/services/requests.ts","libs/shared/api/src/services/user.requests.ts","libs/shared/api/src/services/signalR.service.ts","node_modules/@microsoft/signalr/dist/esm/Errors.js","node_modules/@microsoft/signalr/dist/esm/HttpClient.js","node_modules/@microsoft/signalr/dist/esm/ILogger.js","node_modules/@microsoft/signalr/dist/esm/Loggers.js","node_modules/@microsoft/signalr/dist/esm/Utils.js","node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js","node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js","node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js","node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js","node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js","node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js","node_modules/@microsoft/signalr/dist/esm/Subject.js","node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js","node_modules/@microsoft/signalr/dist/esm/HubConnection.js","node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js","node_modules/@microsoft/signalr/dist/esm/HeaderNames.js","node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js","node_modules/@microsoft/signalr/dist/esm/ITransport.js","node_modules/@microsoft/signalr/dist/esm/AbortController.js","node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js","node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js","node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js","node_modules/@microsoft/signalr/dist/esm/HttpConnection.js","node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js","node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js","libs/shared/api/src/services/api.service.ts","libs/shared/api/src/api.provider.ts","libs/shared/translate/src/lib/helpers/localized.ts","libs/shared/translate/src/lib/di/tokens.ts","libs/shared/translate/src/lib/translate.provider.ts","node_modules/@ngneat/transloco/fesm2020/ngneat-transloco.mjs","libs/assist/shared/translations/src/lib/index.ts","apps/outlook-addin/src/app/app.component.ts","apps/outlook-addin/src/app/app.component.html","apps/outlook-addin/src/app/app.config.ts","node_modules/@angular/cdk/fesm2022/a11y.mjs","node_modules/@angular/cdk/fesm2022/platform.mjs","node_modules/@angular/cdk/fesm2022/private.mjs","node_modules/@angular/cdk/fesm2022/keycodes.mjs","node_modules/@angular/cdk/fesm2022/coercion/private.mjs","node_modules/@angular/cdk/fesm2022/coercion.mjs","node_modules/@angular/cdk/fesm2022/observers.mjs","node_modules/@angular/cdk/fesm2022/layout.mjs","node_modules/@angular/cdk/fesm2022/scrolling.mjs","node_modules/@angular/cdk/fesm2022/bidi.mjs","node_modules/@angular/cdk/fesm2022/collections.mjs","node_modules/@angular/cdk/fesm2022/overlay.mjs","node_modules/@angular/cdk/fesm2022/portal.mjs","node_modules/@angular/cdk/fesm2022/dialog.mjs","apps/outlook-addin/src/app/shared/reducers/index.ts","node_modules/@ngrx/router-store/fesm2022/ngrx-router-store.mjs","apps/outlook-addin/src/environments/environment.ts","node_modules/@ngrx/effects/fesm2022/ngrx-effects.mjs","apps/outlook-addin/src/app/ngrx/effects/account.effects.ts","apps/outlook-addin/src/app/ngrx/effects/reservation.effects.ts","libs/assist/shared/data/src/lib/models/app/operations.model.ts","libs/assist/shared/data/src/lib/models/app/assist-event.model.ts","libs/assist/shared/data/src/lib/models/app/navigation.model.ts","libs/assist/shared/data/src/lib/utils/constants.ts","libs/assist/shared/data/src/lib/utils/array.utils.ts","node_modules/date-fns-tz/esm/format/index.js","node_modules/date-fns-tz/esm/_lib/tzIntlTimeZoneName/index.js","node_modules/date-fns-tz/esm/_lib/tzTokenizeDate/index.js","node_modules/date-fns-tz/esm/_lib/newDateUTC/index.js","node_modules/date-fns-tz/esm/_lib/tzParseTimezone/index.js","node_modules/date-fns-tz/esm/format/formatters/index.js","node_modules/date-fns-tz/esm/toDate/index.js","node_modules/date-fns-tz/esm/_lib/tzPattern/index.js","node_modules/date-fns-tz/esm/formatInTimeZone/index.js","node_modules/date-fns-tz/esm/utcToZonedTime/index.js","node_modules/date-fns-tz/esm/getTimezoneOffset/index.js","node_modules/date-fns-tz/esm/zonedTimeToUtc/index.js","node_modules/@babel/runtime/helpers/esm/typeof.js","node_modules/date-fns/esm/_lib/toInteger/index.js","node_modules/date-fns/esm/_lib/requiredArgs/index.js","node_modules/date-fns/esm/toDate/index.js","node_modules/date-fns/esm/addDays/index.js","node_modules/date-fns/esm/addMonths/index.js","node_modules/date-fns/esm/add/index.js","node_modules/date-fns/esm/addMilliseconds/index.js","node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js","node_modules/date-fns/esm/startOfDay/index.js","node_modules/date-fns/esm/differenceInCalendarDays/index.js","node_modules/date-fns/esm/addMinutes/index.js","node_modules/date-fns/esm/constants/index.js","node_modules/date-fns/esm/differenceInDays/index.js","node_modules/date-fns/esm/differenceInMilliseconds/index.js","node_modules/date-fns/esm/_lib/roundingMethods/index.js","node_modules/date-fns/esm/differenceInMinutes/index.js","node_modules/date-fns/esm/endOfDay/index.js","node_modules/date-fns/esm/getDaysInMonth/index.js","node_modules/date-fns/esm/getHours/index.js","node_modules/date-fns/esm/getMinutes/index.js","node_modules/date-fns/esm/getSeconds/index.js","node_modules/date-fns/esm/isWithinInterval/index.js","node_modules/date-fns/esm/setMonth/index.js","node_modules/date-fns/esm/set/index.js","libs/shared/calendars/src/services/implementations/calendars.service.ts","libs/shared/calendars/src/services/implementations/windows-iana-map.ts","libs/shared/calendars/src/models/calendar-event-datetime.model.ts","libs/shared/calendars/src/models/calendar-availability.model.ts","libs/shared/calendars/src/di/calendars-registration.model.ts","libs/assist/shared/data/src/lib/utils/timezone.function.ts","node_modules/typescript-memoize/dist/es2015/memoize-decorator.js","libs/assist/shared/data/src/lib/utils/calculations.functions.ts","libs/assist/shared/data/src/lib/utils/schedule-helper.ts","libs/assist/shared/data/src/lib/utils/event.utils.ts","libs/assist/shared/data/src/lib/utils/better-latest-from.operator.ts","libs/assist/shared/data/src/lib/utils/color.utils.ts","libs/assist/shared/data/src/lib/actions/user.actions.ts","libs/assist/shared/data/src/lib/actions/events.actions.ts","libs/assist/shared/data/src/lib/actions/resources.actions.ts","libs/assist/shared/data/src/lib/actions/filter.actions.ts","libs/assist/shared/data/src/lib/actions/schedules.actions.ts","libs/assist/shared/data/src/lib/actions/timeline.actions.ts","libs/assist/shared/data/src/lib/actions/operations.actions.ts","libs/assist/shared/data/src/lib/actions/selections.actions.ts","libs/assist/shared/data/src/lib/actions/portal.actions.ts","libs/assist/shared/data/src/lib/actions/areas.actions.ts","libs/assist/shared/data/src/lib/actions/current-user.actions.ts","libs/assist/shared/data/src/lib/actions/dashboard.actions.ts","libs/assist/shared/data/src/lib/actions/controllable-objects.actions.ts","libs/assist/shared/data/src/lib/selectors/shared.selectors.ts","libs/assist/shared/data/src/lib/selectors/user.selectors.ts","libs/assist/shared/data/src/lib/selectors/events.selectors.ts","libs/assist/shared/data/src/lib/selectors/filter.selectors.ts","libs/assist/shared/data/src/lib/selectors/schedules.selectors.ts","libs/assist/shared/data/src/lib/selectors/current-user.selectors.ts","libs/assist/shared/data/src/lib/selectors/resources.selectors.ts","libs/assist/shared/data/src/lib/selectors/areas.selectors.ts","libs/assist/shared/data/src/lib/selectors/filter-attendees.selectors.ts","libs/assist/shared/data/src/lib/selectors/timeline.selectors.ts","libs/assist/shared/data/src/lib/selectors/operations.selectors.ts","libs/assist/shared/data/src/lib/selectors/favourites.selectors.ts","libs/assist/shared/data/src/lib/selectors/controllable-objects.selectors.ts","libs/assist/shared/data/src/lib/selectors/my-events.selectors.ts","libs/assist/shared/data/src/lib/reducers/user.reducer.ts","libs/assist/shared/data/src/lib/reducers/events.reducer.ts","libs/assist/shared/data/src/lib/reducers/resources.reducer.ts","libs/assist/shared/data/src/lib/reducers/filter.reducer.ts","libs/assist/shared/data/src/lib/reducers/schedules.reducer.ts","libs/assist/shared/data/src/lib/reducers/timeline.reducer.ts","libs/assist/shared/data/src/lib/reducers/operations.reducer.ts","libs/assist/shared/data/src/lib/reducers/areas.reducer.ts","libs/assist/shared/data/src/lib/reducers/favourites.reducer.ts","libs/assist/shared/data/src/lib/reducers/current-user.reducer.ts","libs/assist/shared/data/src/lib/reducers/user-settings.reducer.ts","libs/assist/shared/data/src/lib/reducers/filter-attendees.reducer.ts","libs/assist/shared/data/src/lib/reducers/controllable-objects.reducer.ts","libs/assist/shared/data/src/lib/reducers/my-events.reducer.ts","libs/assist/shared/data/src/lib/reducers/index.ts","libs/assist/shared/data/src/lib/effects/user.effects.ts","libs/assist/shared/data/src/lib/effects/events.effects.ts","libs/assist/shared/data/src/lib/services/data.service.ts","node_modules/dexie/import-wrapper.mjs","libs/assist/shared/data/src/lib/services/assistDB.ts","libs/assist/shared/data/src/lib/services/config.service.ts","libs/assist/shared/data/src/lib/services/auth.service.ts","node_modules/@ngrx/operators/fesm2022/ngrx-operators.mjs","libs/assist/shared/data/src/lib/services/db.service.ts","libs/shared/licensing/src/lib/licensing.service.ts","libs/assist/shared/data/src/lib/services/locale.service.ts","libs/assist/shared/data/src/lib/services/resource.service.ts","libs/assist/shared/data/src/lib/services/error-handler.ts","libs/assist/shared/data/src/lib/services/layout.service.ts","libs/assist/shared/data/src/lib/services/currrent-map-item.service.ts","libs/assist/shared/data/src/lib/services/navigation-movement.service.ts","libs/assist/shared/data/src/lib/effects/rooms.effects.ts","libs/assist/shared/data/src/lib/effects/schedules.effects.ts","libs/assist/shared/data/src/lib/effects/areas.effects.ts","libs/assist/shared/data/src/lib/effects/favourites.effects.ts","libs/assist/shared/data/src/lib/effects/current-user.effects.ts","libs/assist/shared/data/src/lib/data.providers.ts","libs/assist/shared/data/src/lib/guards/user-required.guard.ts","libs/assist/shared/data/src/lib/guards/oauth-callback.guard.ts","libs/assist/shared/data/src/lib/guards/user-prohibited.guard.ts","libs/assist/shared/data/src/lib/guards/resources-loaded.guard.ts","libs/assist/shared/data/src/lib/guards/navigation-enabled.guard.ts","libs/assist/shared/data/src/lib/guards/reservations-enabled.guard.ts","libs/assist/shared/data/src/lib/guards/reservations-or-navigation-enabled.guard.ts","apps/outlook-addin/src/app/ngrx/reducers/account.reducers.ts","apps/outlook-addin/src/app/ngrx/reducers/reservation.reducers.ts","apps/outlook-addin/src/app/ngrx/reducers/resources.reducers.ts","apps/outlook-addin/src/app/ngrx/reducers/user-info.reducers.ts","apps/outlook-addin/src/app/ngrx/reducers/index.ts","apps/outlook-addin/src/app/ngrx/effects/resources.effects.ts","apps/outlook-addin/src/app/ngrx/effects/user-info.effects.ts","apps/outlook-addin/src/app/shared/models/common.models.ts","apps/outlook-addin/src/app/core/utils/jwt.interceptor.ts","apps/outlook-addin/src/app/core/core.config.ts","libs/shared/ui/icons/src/components/icon/icon.component.ts","libs/shared/ui/icons/src/services/icons-cache.service.ts","libs/shared/ui/icons/src/library/icons.ts","libs/assist/ui/dropdowns/src/directives/fixed-group-template.directive.ts","libs/assist/ui/dropdowns/src/directives/footer-template.directive.ts","libs/assist/ui/dropdowns/src/directives/group-template.directive.ts","libs/assist/ui/dropdowns/src/directives/item-template.directive.ts","libs/assist/ui/dropdowns/src/directives/list-group-template.directive.ts","libs/assist/ui/dropdowns/src/directives/no-data-template.directive.ts","libs/assist/ui/dropdowns/src/directives/tag-template.directive.ts","libs/assist/ui/dropdowns/src/directives/value-template.directive.ts","libs/assist/ui/dropdowns/src/components/multiselect/multiselect.component.ts","libs/assist/ui/dropdowns/src/components/multiselect/multiselect.component.html","node_modules/@progress/kendo-angular-dropdowns/fesm2022/progress-kendo-angular-dropdowns.mjs","node_modules/@progress/kendo-angular-common/fesm2022/progress-kendo-angular-common.mjs","node_modules/@progress/kendo-common/dist/es2015/util.js","node_modules/@progress/kendo-common/dist/es2015/support.js","node_modules/@progress/kendo-common/dist/es2015/accessors/field-list.js","node_modules/@progress/kendo-common/dist/es2015/accessors/getter.js","node_modules/@progress/kendo-common/dist/es2015/accessors/setter.js","node_modules/@progress/kendo-common/dist/es2015/parse-style.js","node_modules/@progress/kendo-draggable/dist/es2015/main.js","node_modules/@progress/kendo-angular-utils/fesm2022/progress-kendo-angular-utils.mjs","node_modules/@progress/kendo-draggable-common/dist/es2015/algorithms/intersect.js","node_modules/@progress/kendo-draggable-common/dist/es2015/utils/index.js","node_modules/@progress/kendo-draggable-common/dist/es2015/drag-n-drop.js","node_modules/@progress/kendo-draggable-common/dist/es2015/auto-scroll.js","node_modules/@angular/forms/fesm2022/forms.mjs","node_modules/@progress/kendo-angular-l10n/fesm2022/progress-kendo-angular-l10n.mjs","node_modules/@progress/kendo-angular-popup/fesm2022/progress-kendo-angular-popup.mjs","node_modules/@progress/kendo-popup-common/dist/es2015/align-point.js","node_modules/@progress/kendo-popup-common/dist/es2015/align.js","node_modules/@progress/kendo-popup-common/dist/es2015/add-scroll.js","node_modules/@progress/kendo-popup-common/dist/es2015/owner-document.js","node_modules/@progress/kendo-popup-common/dist/es2015/window.js","node_modules/@progress/kendo-popup-common/dist/es2015/document.js","node_modules/@progress/kendo-popup-common/dist/es2015/scrollbar-width.js","node_modules/@progress/kendo-popup-common/dist/es2015/window-viewport.js","node_modules/@progress/kendo-popup-common/dist/es2015/bounding-offset.js","node_modules/@progress/kendo-popup-common/dist/es2015/offset-parent.js","node_modules/@progress/kendo-popup-common/dist/es2015/offset.js","node_modules/@progress/kendo-popup-common/dist/es2015/parents.js","node_modules/@progress/kendo-popup-common/dist/es2015/scroll-position.js","node_modules/@progress/kendo-popup-common/dist/es2015/element-scroll-position.js","node_modules/@progress/kendo-popup-common/dist/es2015/parent-scroll-position.js","node_modules/@progress/kendo-popup-common/dist/es2015/position.js","node_modules/@progress/kendo-popup-common/dist/es2015/offset-parent-scroll-position.js","node_modules/@progress/kendo-popup-common/dist/es2015/position-with-scroll.js","node_modules/@progress/kendo-popup-common/dist/es2015/remove-scroll.js","node_modules/@progress/kendo-popup-common/dist/es2015/collision.js","node_modules/@progress/kendo-popup-common/dist/es2015/restrict-to-view.js","node_modules/@progress/kendo-popup-common/dist/es2015/siblings.js","node_modules/@progress/kendo-popup-common/dist/es2015/sibling-container.js","node_modules/@progress/kendo-popup-common/dist/es2015/utils.js","node_modules/@progress/kendo-svg-icons/dist/index.es.js","node_modules/@progress/kendo-angular-icons/fesm2022/progress-kendo-angular-icons.mjs","node_modules/@progress/kendo-angular-navigation/fesm2022/progress-kendo-angular-navigation.mjs","node_modules/@progress/kendo-angular-inputs/fesm2022/progress-kendo-angular-inputs.mjs","node_modules/@progress/kendo-angular-buttons/fesm2022/progress-kendo-angular-buttons.mjs","node_modules/@progress/kendo-drawing/dist/es2015/drawing.js","node_modules/@progress/kendo-drawing/dist/es2015/common/class.js","node_modules/@progress/kendo-drawing/dist/es2015/common/observable.js","node_modules/@progress/kendo-drawing/dist/es2015/common/animation-frame.js","node_modules/@progress/kendo-drawing/dist/es2015/common/html-encode.js","node_modules/@progress/kendo-drawing/dist/es2015/common/log-to-console.js","node_modules/@progress/kendo-drawing/dist/es2015/common/support.js","node_modules/@progress/kendo-drawing/dist/es2015/util/now.js","node_modules/@progress/kendo-drawing/dist/es2015/common/throttle.js","node_modules/@progress/kendo-drawing/dist/es2015/common/color/named-colors.js","node_modules/@progress/kendo-drawing/dist/es2015/common/color/parse-color.js","node_modules/@progress/kendo-drawing/dist/es2015/common/color/color.js","node_modules/@progress/kendo-drawing/dist/es2015/core/has-observers.js","node_modules/@progress/kendo-drawing/dist/es2015/util.js","node_modules/@progress/kendo-drawing/dist/es2015/util/append.js","node_modules/@progress/kendo-drawing/dist/es2015/util/arabic-to-roman.js","node_modules/@progress/kendo-drawing/dist/es2015/util/create-promise.js","node_modules/@progress/kendo-drawing/dist/es2015/util/defined.js","node_modules/@progress/kendo-drawing/dist/es2015/util/definition-id.js","node_modules/@progress/kendo-drawing/dist/es2015/util/constants.js","node_modules/@progress/kendo-drawing/dist/es2015/util/deg.js","node_modules/@progress/kendo-drawing/dist/es2015/util/encode-utf.js","node_modules/@progress/kendo-drawing/dist/es2015/util/encode-base64.js","node_modules/@progress/kendo-drawing/dist/es2015/util/event-coordinates.js","node_modules/@progress/kendo-drawing/dist/es2015/util/event-element.js","node_modules/@progress/kendo-drawing/dist/es2015/util/is-transparent.js","node_modules/@progress/kendo-drawing/dist/es2015/util/last.js","node_modules/@progress/kendo-drawing/dist/es2015/util/limit-value.js","node_modules/@progress/kendo-drawing/dist/es2015/util/merge-sort.js","node_modules/@progress/kendo-drawing/dist/es2015/util/promise-all.js","node_modules/@progress/kendo-drawing/dist/es2015/util/rad.js","node_modules/@progress/kendo-drawing/dist/es2015/util/round.js","node_modules/@progress/kendo-drawing/dist/es2015/util/value-or-default.js","node_modules/@progress/kendo-drawing/dist/es2015/util/bind-events.js","node_modules/@progress/kendo-drawing/dist/es2015/util/element-offset.js","node_modules/@progress/kendo-drawing/dist/es2015/util/element-styles.js","node_modules/@progress/kendo-drawing/dist/es2015/util/element-size.js","node_modules/@progress/kendo-drawing/dist/es2015/util/unbind-events.js","node_modules/@progress/kendo-drawing/dist/es2015/util/element-padding.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/matrix.js","node_modules/@progress/kendo-drawing/dist/es2015/util/element-scale.js","node_modules/@progress/kendo-drawing/dist/es2015/text-metrics/lru-cache.js","node_modules/@progress/kendo-drawing/dist/es2015/text-metrics/util.js","node_modules/@progress/kendo-drawing/dist/es2015/text-metrics/text-metrics.js","node_modules/@progress/kendo-drawing/dist/es2015/text-metrics/measure-text.js","node_modules/@progress/kendo-drawing/dist/es2015/core/options-store.js","node_modules/@progress/kendo-drawing/dist/es2015/mixins/with-accessors.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/to-matrix.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/point.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/size.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/rect.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/transformation.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/transform.js","node_modules/@progress/kendo-drawing/dist/es2015/core/constants.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/element.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/math/ellipse-extreme-angles.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/circle.js","node_modules/@progress/kendo-drawing/dist/es2015/mixins/paintable.js","node_modules/@progress/kendo-drawing/dist/es2015/mixins/measurable.js","node_modules/@progress/kendo-drawing/dist/es2015/mixins/with-geometry.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/circle.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/constants.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/math/close.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/math/close-or-less.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/math/line-intersection.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/arc.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/elements-array.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/geometry-elements-array.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/math/is-out-of-end-point.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/math/calculate-curve-at.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/math/to-cubic-polynomial.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/math/complex-number.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/math/solve-cubic-equation.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/math/has-roots-in-range.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/math/curve-intersections-count.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/math/line-intersections-count.js","node_modules/@progress/kendo-drawing/dist/es2015/mixins/with-points.js","node_modules/@progress/kendo-drawing/dist/es2015/geometry/segment.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/utils/points-to-curve.js","node_modules/@progress/kendo-drawing/dist/es2015/parsing/shape-map.js","node_modules/@progress/kendo-drawing/dist/es2015/parsing/parse-path.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/utils/elements-bounding-box.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/utils/elements-clippend-bounding-box.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/path.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/arc.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/text.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/image.js","node_modules/@progress/kendo-drawing/dist/es2015/mixins/traversable.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/group.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/translate-to-point.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/align-start.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/align-start-reverse.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/layout.js","node_modules/@progress/kendo-drawing/dist/es2015/shapes/rect.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/align-elements.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/align.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/v-align.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/stack-elements.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/create-stack-elements.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/stack.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/v-stack.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/wrap-elements.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/wrap.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/v-wrap.js","node_modules/@progress/kendo-drawing/dist/es2015/alignment/fit.js","node_modules/@progress/kendo-drawing/dist/es2015/gradients/stops-array.js","node_modules/@progress/kendo-drawing/dist/es2015/mixins/with-options.js","node_modules/@progress/kendo-drawing/dist/es2015/gradients/gradient-stop.js","node_modules/@progress/kendo-drawing/dist/es2015/gradients/gradient.js","node_modules/@progress/kendo-drawing/dist/es2015/gradients/linear-gradient.js","node_modules/@progress/kendo-drawing/dist/es2015/gradients/radial-gradient.js","node_modules/@progress/kendo-drawing/dist/es2015/patterns/pattern.js","node_modules/@progress/kendo-drawing/dist/es2015/animations/easing-functions.js","node_modules/@progress/kendo-drawing/dist/es2015/animations/animation-factory.js","node_modules/@progress/kendo-drawing/dist/es2015/animations/animation.js","node_modules/@progress/kendo-drawing/dist/es2015/parsing/path-parser.js","node_modules/@progress/kendo-drawing/dist/es2015/core/base-node.js","node_modules/@progress/kendo-drawing/dist/es2015/core/surface.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/utils/render-attribute.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/utils/render-all-attributes.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/utils/render-style.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/node-map.js","node_modules/@progress/kendo-drawing/dist/es2015/util/element-set-styles-safe.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/constants.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/utils/render-svg.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/gradient-stop-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/gradient-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/linear-gradient-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/radial-gradient-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/pattern-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/clip-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/definition-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/root-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/path-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/arc-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/circle-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/group-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/image-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/multi-path-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/rect-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/text-node.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/surface.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/node-map.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/node.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/group-node.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/root-node.js","node_modules/@progress/kendo-drawing/dist/es2015/search/quad-root.js","node_modules/@progress/kendo-drawing/dist/es2015/search/quad-node.js","node_modules/@progress/kendo-drawing/dist/es2015/search/shapes-quad-tree.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/surface-cursor.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/utils/render-path.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/path-node.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/arc-node.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/circle-node.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/image-node.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/multi-path-node.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/rect-node.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/text-node.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/surface.js","node_modules/@progress/kendo-drawing/dist/es2015/surface-factory.js","node_modules/@progress/kendo-drawing/dist/es2015/surface.js","node_modules/@progress/kendo-drawing/dist/es2015/svg.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/export-group.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas.js","node_modules/@progress/kendo-drawing/dist/es2015/canvas/export-image.js","node_modules/@progress/kendo-drawing/dist/es2015/svg/export-svg.js","node_modules/@progress/kendo-inputs-common/dist/es2015/common/drawing-utils.js","node_modules/@progress/kendo-inputs-common/dist/es2015/signature/signature-pad.js","node_modules/@progress/kendo-angular-dialog/fesm2022/progress-kendo-angular-dialog.mjs","node_modules/@progress/kendo-angular-treeview/fesm2022/progress-kendo-angular-treeview.mjs","node_modules/@progress/kendo-angular-label/fesm2022/progress-kendo-angular-label.mjs","libs/assist/ui/dropdowns/src/components/dropdownlist/dropdownlist.component.ts","libs/assist/ui/dropdowns/src/components/dropdownlist/dropdownlist.component.html","apps/outlook-addin/src/app/navigations/menu/menu.component.ts","apps/outlook-addin/src/app/navigations/menu/menu.component.html","apps/outlook-addin/src/app/navigations/main-menu-container/main-menu-container.component.ts","apps/outlook-addin/src/app/navigations/main-menu-container/main-menu-container.component.html","apps/outlook-addin/src/app/login/login.component.ts","apps/outlook-addin/src/app/login/login.component.html","apps/outlook-addin/src/app/authorize/authorize.component.ts","apps/outlook-addin/src/app/shared/guards/login.guard.ts","apps/outlook-addin/src/app/shared/guards/microsoft-login.guard.ts","apps/outlook-addin/src/app/meeting-finder/meeting-finder.component.ts","apps/outlook-addin/src/app/meeting-finder/meeting-finder.component.html","apps/outlook-addin/src/app/appointment-edit/appointment-edit.component.ts","apps/outlook-addin/src/app/appointment-edit/appointment-edit.component.html","apps/outlook-addin/src/app/dashboard/dashboard.component.ts","apps/outlook-addin/src/app/dashboard/dashboard.component.html","apps/outlook-addin/src/app/resource-filter/resource-filter.component.ts","apps/outlook-addin/src/app/resource-filter/resource-filter.component.html","node_modules/uuid/dist/esm-browser/rng.js","node_modules/uuid/dist/esm-browser/regex.js","node_modules/uuid/dist/esm-browser/validate.js","node_modules/uuid/dist/esm-browser/stringify.js","node_modules/uuid/dist/esm-browser/v4.js","node_modules/@progress/kendo-angular-layout/fesm2022/progress-kendo-angular-layout.mjs","node_modules/@progress/kendo-angular-progressbar/fesm2022/progress-kendo-angular-progressbar.mjs","libs/assist/ui/inputs/src/components/textbox/textbox.component.ts","libs/assist/ui/inputs/src/components/textbox/textbox.component.html","libs/shared/ui/src/lib/components/working-hours/working-hours.component.ts","libs/shared/ui/src/lib/components/working-hours/working-hours.component.html","node_modules/@progress/kendo-angular-dateinputs/fesm2022/progress-kendo-angular-dateinputs.mjs","node_modules/@progress/kendo-date-math/dist/es2015/clone-date.js","node_modules/@progress/kendo-date-math/dist/es2015/adjust-dst.js","node_modules/@progress/kendo-date-math/dist/es2015/add-days.js","node_modules/@progress/kendo-date-math/dist/es2015/create-date.js","node_modules/@progress/kendo-date-math/dist/es2015/last-day-of-month.js","node_modules/@progress/kendo-date-math/dist/es2015/add-months.js","node_modules/@progress/kendo-date-math/dist/es2015/set-year.js","node_modules/@progress/kendo-date-math/dist/es2015/add-years.js","node_modules/@progress/kendo-date-math/dist/es2015/add-centuries.js","node_modules/@progress/kendo-date-math/dist/es2015/add-decades.js","node_modules/@progress/kendo-date-math/dist/es2015/add-weeks.js","node_modules/@progress/kendo-date-math/dist/es2015/constants.js","node_modules/@progress/kendo-date-math/dist/es2015/direction.enum.js","node_modules/@progress/kendo-date-math/dist/es2015/day-of-week.js","node_modules/@progress/kendo-date-math/dist/es2015/day.enum.js","node_modules/@progress/kendo-date-math/dist/es2015/normalize-year.js","node_modules/@progress/kendo-date-math/dist/es2015/first-decade-of-century.js","node_modules/@progress/kendo-date-math/dist/es2015/duration-in-centuries.js","node_modules/@progress/kendo-date-math/dist/es2015/first-year-of-decade.js","node_modules/@progress/kendo-date-math/dist/es2015/duration-in-decades.js","node_modules/@progress/kendo-date-math/dist/es2015/duration-in-months.js","node_modules/@progress/kendo-date-math/dist/es2015/duration-in-years.js","node_modules/@progress/kendo-date-math/dist/es2015/first-day-of-month.js","node_modules/@progress/kendo-date-math/dist/es2015/set-month.js","node_modules/@progress/kendo-date-math/dist/es2015/first-month-of-year.js","node_modules/@progress/kendo-date-math/dist/es2015/get-date.js","node_modules/@progress/kendo-date-math/dist/es2015/is-equal.js","node_modules/@progress/kendo-date-math/dist/es2015/last-decade-of-century.js","node_modules/@progress/kendo-date-math/dist/es2015/last-month-of-year.js","node_modules/@progress/kendo-date-math/dist/es2015/last-year-of-decade.js","node_modules/@progress/kendo-date-math/dist/es2015/prev-day-of-week.js","node_modules/@progress/kendo-date-math/dist/es2015/week-in-year.js","node_modules/@progress/kendo-dateinputs-common/dist/es2015/common/mask.js","node_modules/@progress/kendo-dateinputs-common/dist/es2015/common/constants.js","node_modules/@progress/kendo-dateinputs-common/dist/es2015/common/key.js","node_modules/@progress/kendo-dateinputs-common/dist/es2015/dateinput/utils.js","node_modules/@progress/kendo-dateinputs-common/dist/es2015/common/utils.js","node_modules/@progress/kendo-dateinputs-common/dist/es2015/common/dateobject.js","node_modules/@progress/kendo-dateinputs-common/dist/es2015/common/keycode.js","node_modules/@progress/kendo-dateinputs-common/dist/es2015/common/observable.js","node_modules/@progress/kendo-dateinputs-common/dist/es2015/dateinput/interaction-mode.js","node_modules/@progress/kendo-dateinputs-common/dist/es2015/dateinput/dateinput.js","libs/shared/utilities/src/directives/scroll-picker.directive.ts","libs/shared/utilities/src/directives/classerize-parent.directive.ts","libs/shared/utilities/src/directives/textarea-autoresize.directive.ts","libs/shared/utilities/src/directives/save-scroll.directive.ts","libs/shared/utilities/src/directives/move-next-max-length.directive.ts","libs/shared/utilities/src/directives/foldable.directive.ts","libs/shared/utilities/src/directives/drag-scroll.directive.ts","libs/shared/utilities/src/services/qr.service.ts","libs/shared/utilities/src/pipes/group-by.pipe.ts","libs/shared/utilities/src/pipes/safe-html.pipe.ts","libs/shared/utilities/src/pipes/image-width.pipe.ts","libs/shared/utilities/src/pipes/image-height.pipe.ts","libs/shared/utilities/src/pipes/image-dimensions.pipe.ts","libs/shared/utilities/src/services/favicon.service.ts","libs/shared/utilities/src/directives/inactivity.directive.ts","libs/shared/utilities/src/pipes/localized-string.pipe.ts","libs/shared/utilities/src/pipes/cm-unity-localized-string.pipe.ts","libs/shared/utilities/src/pipes/safe-url.pipe.ts","libs/shared/ui/src/lib/directives/clearable.directive.ts","libs/assist/ui/inputs/src/components/checkbox/checkbox.component.ts","libs/assist/ui/inputs/src/components/checkbox/checkbox.component.html","libs/assist/ui/area-tree/src/area-tree.component.ts","libs/assist/ui/area-tree/src/area-tree.component.html","apps/outlook-addin/src/app/resource-list/resource-list.component.ts","apps/outlook-addin/src/app/resource-list/resource-list.component.html","libs/shared/loading/src/lib/components/loading/loading.component.ts","libs/shared/loading/src/lib/components/loading/loading.component.html","apps/outlook-addin/src/app/resource-summary-detail/resource-summary-detail.component.ts","apps/outlook-addin/src/app/resource-summary-detail/resource-summary-detail.component.html","apps/outlook-addin/src/app/shared/pipes/filter-count.pipe.ts","apps/outlook-addin/src/app/shared/pipes/assign-to-icon.pipe.ts","apps/outlook-addin/src/app/shared/pipes/resource-external-url.pipe.ts","apps/outlook-addin/src/app/shared/pipes/assign-to-translate-key.pipe.ts","apps/outlook-addin/src/app/shared/pipes/reservation-status.pipe.ts","apps/outlook-addin/src/app/shared/pipes/resource-timeline-state-to-color.pipe.ts","apps/outlook-addin/src/app/shared/pipes/photos-to-files.pipe.ts","apps/outlook-addin/src/app/reservation/resource-map/resource-map.component.ts","apps/outlook-addin/src/app/reservation/resource-map/resource-map.component.html","libs/shared/responsivity/src/lib/responsive.service.ts","libs/shared/images/src/lib/di.ts","libs/shared/images/src/lib/services/image-state.service.ts","libs/shared/images/src/lib/components/progressive-image/progressive-image.component.ts","libs/shared/images/src/lib/components/progressive-image/progressive-image.component.html","libs/shared/images/src/lib/components/image/image.component.ts","libs/shared/images/src/lib/components/image/image.component.html","libs/shared/images/src/lib/directives/progressive-image-placeholder.directive.ts","libs/shared/images/src/lib/models/display.model.ts","libs/shared/images/src/lib/models/dimensions.model.ts","libs/shared/images/src/lib/directives/progressive-image.directive.ts","libs/shared/security/src/lib/services/custom-unsafe-sanitizer-do-not-use-me.service.ts","libs/shared/security/src/lib/pipes/custom-unsafe-sanitize.pipe.ts","libs/shared/ui/file-gallery/src/models/file-item-file-type.ts","libs/shared/ui/file-gallery/src/components/file-gallery/file-gallery.component.ts","libs/shared/ui/file-gallery/src/components/file-gallery/file-gallery.component.html","apps/outlook-addin/src/app/resource-availability/resource-availability.component.ts","apps/outlook-addin/src/app/resource-availability/resource-availability.component.html","apps/outlook-addin/src/app/reservation-list/reservation-list.component.ts","apps/outlook-addin/src/app/reservation-list/reservation-list.component.html","apps/outlook-addin/src/app/reservation/reservation-cannot-fetch/reservation-cannot-fetch.component.ts","apps/outlook-addin/src/app/reservation/reservation-cannot-fetch/reservation-cannot-fetch.component.html","apps/outlook-addin/src/app/reservation/reservation-container/reservation-container.component.ts","apps/outlook-addin/src/app/reservation/reservation-container/reservation-container.component.html","apps/outlook-addin/src/app/reservation/resource-detail/resource-detail.component.ts","apps/outlook-addin/src/app/reservation/resource-detail/resource-detail.component.html","apps/outlook-addin/src/app/reservation/location-detail/location-detail.component.ts","apps/outlook-addin/src/app/reservation/location-detail/location-detail.component.html","apps/outlook-addin/src/app/reservation/order-detail/order-detail.component.ts","apps/outlook-addin/src/app/reservation/order-detail/order-detail.component.html","apps/outlook-addin/src/app/main-start/main-start.component.ts","apps/outlook-addin/src/app/main-start/main-start.component.html","node_modules/@ngrx/store-devtools/fesm2022/ngrx-store-devtools.mjs","node_modules/@angular/platform-browser/fesm2022/animations/async.mjs","libs/assist/ui/pipes/src/lib/availability-color.pipe.ts","libs/assist/ui/pipes/src/lib/time-format.pipe.ts","libs/assist/ui/pipes/src/lib/pipes.service.ts","libs/assist/ui/pipes/src/lib/date-format.pipe.ts","libs/assist/ui/pipes/src/lib/date-time-format.pipe.ts","libs/assist/ui/pipes/src/lib/resource-title.pipe.ts","libs/assist/ui/pipes/src/lib/pipes.provider.ts","libs/shared/google-analytics/src/lib/google-analytics.provider.ts","node_modules/@hakimio/ngx-google-analytics/fesm2022/hakimio-ngx-google-analytics.mjs"],"sourcesContent":["module.exports = flatten;\nflatten.flatten = flatten;\nflatten.unflatten = unflatten;\nfunction isBuffer(obj) {\n return obj && obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);\n}\nfunction keyIdentity(key) {\n return key;\n}\nfunction flatten(target, opts) {\n opts = opts || {};\n const delimiter = opts.delimiter || '.';\n const maxDepth = opts.maxDepth;\n const transformKey = opts.transformKey || keyIdentity;\n const output = {};\n function step(object, prev, currentDepth) {\n currentDepth = currentDepth || 1;\n Object.keys(object).forEach(function (key) {\n const value = object[key];\n const isarray = opts.safe && Array.isArray(value);\n const type = Object.prototype.toString.call(value);\n const isbuffer = isBuffer(value);\n const isobject = type === '[object Object]' || type === '[object Array]';\n const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);\n if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) {\n return step(value, newKey, currentDepth + 1);\n }\n output[newKey] = value;\n });\n }\n step(target);\n return output;\n}\nfunction unflatten(target, opts) {\n opts = opts || {};\n const delimiter = opts.delimiter || '.';\n const overwrite = opts.overwrite || false;\n const transformKey = opts.transformKey || keyIdentity;\n const result = {};\n const isbuffer = isBuffer(target);\n if (isbuffer || Object.prototype.toString.call(target) !== '[object Object]') {\n return target;\n }\n\n // safely ensure that the key is\n // an integer.\n function getkey(key) {\n const parsedKey = Number(key);\n return isNaN(parsedKey) || key.indexOf('.') !== -1 || opts.object ? key : parsedKey;\n }\n function addKeys(keyPrefix, recipient, target) {\n return Object.keys(target).reduce(function (result, key) {\n result[keyPrefix + delimiter + key] = target[key];\n return result;\n }, recipient);\n }\n function isEmpty(val) {\n const type = Object.prototype.toString.call(val);\n const isArray = type === '[object Array]';\n const isObject = type === '[object Object]';\n if (!val) {\n return true;\n } else if (isArray) {\n return !val.length;\n } else if (isObject) {\n return !Object.keys(val).length;\n }\n }\n target = Object.keys(target).reduce(function (result, key) {\n const type = Object.prototype.toString.call(target[key]);\n const isObject = type === '[object Object]' || type === '[object Array]';\n if (!isObject || isEmpty(target[key])) {\n result[key] = target[key];\n return result;\n } else {\n return addKeys(key, result, flatten(target[key], opts));\n }\n }, {});\n Object.keys(target).forEach(function (key) {\n const split = key.split(delimiter).map(transformKey);\n let key1 = getkey(split.shift());\n let key2 = getkey(split[0]);\n let recipient = result;\n while (key2 !== undefined) {\n if (key1 === '__proto__') {\n return;\n }\n const type = Object.prototype.toString.call(recipient[key1]);\n const isobject = type === '[object Object]' || type === '[object Array]';\n\n // do not write over falsey, non-undefined values if overwrite is false\n if (!overwrite && !isobject && typeof recipient[key1] !== 'undefined') {\n return;\n }\n if (overwrite && !isobject || !overwrite && recipient[key1] == null) {\n recipient[key1] = typeof key2 === 'number' && !opts.object ? [] : {};\n }\n recipient = recipient[key1];\n if (split.length > 0) {\n key1 = getkey(split.shift());\n key2 = getkey(split[0]);\n }\n }\n\n // unflatten again for 'messy objects'\n recipient[key1] = unflatten(target[key], opts);\n });\n return result;\n}","function _interopRequireDefault(e) {\n return e && e.__esModule ? e : {\n \"default\": e\n };\n}\nmodule.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports, _typeof(o);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = requiredArgs;\nfunction requiredArgs(required, args) {\n if (args.length < required) {\n throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');\n }\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isDate;\nvar _typeof2 = _interopRequireDefault(require(\"@babel/runtime/helpers/typeof\"));\nvar _index = _interopRequireDefault(require(\"../_lib/requiredArgs/index.js\"));\n/**\n * @name isDate\n * @category Common Helpers\n * @summary Is the given value a date?\n *\n * @description\n * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.\n *\n * @param {*} value - the value to check\n * @returns {boolean} true if the given value is a date\n * @throws {TypeError} 1 arguments required\n *\n * @example\n * // For a valid date:\n * const result = isDate(new Date())\n * //=> true\n *\n * @example\n * // For an invalid date:\n * const result = isDate(new Date(NaN))\n * //=> true\n *\n * @example\n * // For some value:\n * const result = isDate('2014-02-31')\n * //=> false\n *\n * @example\n * // For an object:\n * const result = isDate({})\n * //=> false\n */\nfunction isDate(value) {\n (0, _index.default)(1, arguments);\n return value instanceof Date || (0, _typeof2.default)(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = toDate;\nvar _typeof2 = _interopRequireDefault(require(\"@babel/runtime/helpers/typeof\"));\nvar _index = _interopRequireDefault(require(\"../_lib/requiredArgs/index.js\"));\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @param {Date|Number} argument - the value to convert\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nfunction toDate(argument) {\n (0, _index.default)(1, arguments);\n var argStr = Object.prototype.toString.call(argument);\n\n // Clone the date\n if (argument instanceof Date || (0, _typeof2.default)(argument) === 'object' && argStr === '[object Date]') {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime());\n } else if (typeof argument === 'number' || argStr === '[object Number]') {\n return new Date(argument);\n } else {\n if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(\"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments\");\n // eslint-disable-next-line no-console\n console.warn(new Error().stack);\n }\n return new Date(NaN);\n }\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isValid;\nvar _index = _interopRequireDefault(require(\"../isDate/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../toDate/index.js\"));\nvar _index3 = _interopRequireDefault(require(\"../_lib/requiredArgs/index.js\"));\n/**\n * @name isValid\n * @category Common Helpers\n * @summary Is the given date valid?\n *\n * @description\n * Returns false if argument is Invalid Date and true otherwise.\n * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * Invalid Date is a Date, whose time value is NaN.\n *\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param {*} date - the date to check\n * @returns {Boolean} the date is valid\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // For the valid date:\n * const result = isValid(new Date(2014, 1, 31))\n * //=> true\n *\n * @example\n * // For the value, convertable into a date:\n * const result = isValid(1393804800000)\n * //=> true\n *\n * @example\n * // For the invalid date:\n * const result = isValid(new Date(''))\n * //=> false\n */\nfunction isValid(dirtyDate) {\n (0, _index3.default)(1, arguments);\n if (!(0, _index.default)(dirtyDate) && typeof dirtyDate !== 'number') {\n return false;\n }\n var date = (0, _index2.default)(dirtyDate);\n return !isNaN(Number(date));\n}\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = toInteger;\nfunction toInteger(dirtyNumber) {\n if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {\n return NaN;\n }\n var number = Number(dirtyNumber);\n if (isNaN(number)) {\n return number;\n }\n return number < 0 ? Math.ceil(number) : Math.floor(number);\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = addMilliseconds;\nvar _index = _interopRequireDefault(require(\"../_lib/toInteger/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../toDate/index.js\"));\nvar _index3 = _interopRequireDefault(require(\"../_lib/requiredArgs/index.js\"));\n/**\n * @name addMilliseconds\n * @category Millisecond Helpers\n * @summary Add the specified number of milliseconds to the given date.\n *\n * @description\n * Add the specified number of milliseconds to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the milliseconds added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 750 milliseconds to 10 July 2014 12:45:30.000:\n * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:30.750\n */\nfunction addMilliseconds(dirtyDate, dirtyAmount) {\n (0, _index3.default)(2, arguments);\n var timestamp = (0, _index2.default)(dirtyDate).getTime();\n var amount = (0, _index.default)(dirtyAmount);\n return new Date(timestamp + amount);\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = subMilliseconds;\nvar _index = _interopRequireDefault(require(\"../addMilliseconds/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../_lib/requiredArgs/index.js\"));\nvar _index3 = _interopRequireDefault(require(\"../_lib/toInteger/index.js\"));\n/**\n * @name subMilliseconds\n * @category Millisecond Helpers\n * @summary Subtract the specified number of milliseconds from the given date.\n *\n * @description\n * Subtract the specified number of milliseconds from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the milliseconds subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:\n * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:29.250\n */\nfunction subMilliseconds(dirtyDate, dirtyAmount) {\n (0, _index2.default)(2, arguments);\n var amount = (0, _index3.default)(dirtyAmount);\n return (0, _index.default)(dirtyDate, -amount);\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = getUTCDayOfYear;\nvar _index = _interopRequireDefault(require(\"../../toDate/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../requiredArgs/index.js\"));\nvar MILLISECONDS_IN_DAY = 86400000;\nfunction getUTCDayOfYear(dirtyDate) {\n (0, _index2.default)(1, arguments);\n var date = (0, _index.default)(dirtyDate);\n var timestamp = date.getTime();\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n var startOfYearTimestamp = date.getTime();\n var difference = timestamp - startOfYearTimestamp;\n return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = startOfUTCISOWeek;\nvar _index = _interopRequireDefault(require(\"../../toDate/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../requiredArgs/index.js\"));\nfunction startOfUTCISOWeek(dirtyDate) {\n (0, _index2.default)(1, arguments);\n var weekStartsOn = 1;\n var date = (0, _index.default)(dirtyDate);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = getUTCISOWeekYear;\nvar _index = _interopRequireDefault(require(\"../../toDate/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../requiredArgs/index.js\"));\nvar _index3 = _interopRequireDefault(require(\"../startOfUTCISOWeek/index.js\"));\nfunction getUTCISOWeekYear(dirtyDate) {\n (0, _index2.default)(1, arguments);\n var date = (0, _index.default)(dirtyDate);\n var year = date.getUTCFullYear();\n var fourthOfJanuaryOfNextYear = new Date(0);\n fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);\n fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = (0, _index3.default)(fourthOfJanuaryOfNextYear);\n var fourthOfJanuaryOfThisYear = new Date(0);\n fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);\n fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = (0, _index3.default)(fourthOfJanuaryOfThisYear);\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = startOfUTCISOWeekYear;\nvar _index = _interopRequireDefault(require(\"../getUTCISOWeekYear/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../startOfUTCISOWeek/index.js\"));\nvar _index3 = _interopRequireDefault(require(\"../requiredArgs/index.js\"));\nfunction startOfUTCISOWeekYear(dirtyDate) {\n (0, _index3.default)(1, arguments);\n var year = (0, _index.default)(dirtyDate);\n var fourthOfJanuary = new Date(0);\n fourthOfJanuary.setUTCFullYear(year, 0, 4);\n fourthOfJanuary.setUTCHours(0, 0, 0, 0);\n var date = (0, _index2.default)(fourthOfJanuary);\n return date;\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = getUTCISOWeek;\nvar _index = _interopRequireDefault(require(\"../../toDate/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../startOfUTCISOWeek/index.js\"));\nvar _index3 = _interopRequireDefault(require(\"../startOfUTCISOWeekYear/index.js\"));\nvar _index4 = _interopRequireDefault(require(\"../requiredArgs/index.js\"));\nvar MILLISECONDS_IN_WEEK = 604800000;\nfunction getUTCISOWeek(dirtyDate) {\n (0, _index4.default)(1, arguments);\n var date = (0, _index.default)(dirtyDate);\n var diff = (0, _index2.default)(date).getTime() - (0, _index3.default)(date).getTime();\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;\n}\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.getDefaultOptions = getDefaultOptions;\nexports.setDefaultOptions = setDefaultOptions;\nvar defaultOptions = {};\nfunction getDefaultOptions() {\n return defaultOptions;\n}\nfunction setDefaultOptions(newOptions) {\n defaultOptions = newOptions;\n}","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = startOfUTCWeek;\nvar _index = _interopRequireDefault(require(\"../../toDate/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../requiredArgs/index.js\"));\nvar _index3 = _interopRequireDefault(require(\"../toInteger/index.js\"));\nvar _index4 = require(\"../defaultOptions/index.js\");\nfunction startOfUTCWeek(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n (0, _index2.default)(1, arguments);\n var defaultOptions = (0, _index4.getDefaultOptions)();\n var weekStartsOn = (0, _index3.default)((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n var date = (0, _index.default)(dirtyDate);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = getUTCWeekYear;\nvar _index = _interopRequireDefault(require(\"../../toDate/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../requiredArgs/index.js\"));\nvar _index3 = _interopRequireDefault(require(\"../startOfUTCWeek/index.js\"));\nvar _index4 = _interopRequireDefault(require(\"../toInteger/index.js\"));\nvar _index5 = require(\"../defaultOptions/index.js\");\nfunction getUTCWeekYear(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n (0, _index2.default)(1, arguments);\n var date = (0, _index.default)(dirtyDate);\n var year = date.getUTCFullYear();\n var defaultOptions = (0, _index5.getDefaultOptions)();\n var firstWeekContainsDate = (0, _index4.default)((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);\n\n // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n var firstWeekOfNextYear = new Date(0);\n firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);\n firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = (0, _index3.default)(firstWeekOfNextYear, options);\n var firstWeekOfThisYear = new Date(0);\n firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = (0, _index3.default)(firstWeekOfThisYear, options);\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = startOfUTCWeekYear;\nvar _index = _interopRequireDefault(require(\"../getUTCWeekYear/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../requiredArgs/index.js\"));\nvar _index3 = _interopRequireDefault(require(\"../startOfUTCWeek/index.js\"));\nvar _index4 = _interopRequireDefault(require(\"../toInteger/index.js\"));\nvar _index5 = require(\"../defaultOptions/index.js\");\nfunction startOfUTCWeekYear(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n (0, _index2.default)(1, arguments);\n var defaultOptions = (0, _index5.getDefaultOptions)();\n var firstWeekContainsDate = (0, _index4.default)((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);\n var year = (0, _index.default)(dirtyDate, options);\n var firstWeek = new Date(0);\n firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeek.setUTCHours(0, 0, 0, 0);\n var date = (0, _index3.default)(firstWeek, options);\n return date;\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = getUTCWeek;\nvar _index = _interopRequireDefault(require(\"../../toDate/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../startOfUTCWeek/index.js\"));\nvar _index3 = _interopRequireDefault(require(\"../startOfUTCWeekYear/index.js\"));\nvar _index4 = _interopRequireDefault(require(\"../requiredArgs/index.js\"));\nvar MILLISECONDS_IN_WEEK = 604800000;\nfunction getUTCWeek(dirtyDate, options) {\n (0, _index4.default)(1, arguments);\n var date = (0, _index.default)(dirtyDate);\n var diff = (0, _index2.default)(date, options).getTime() - (0, _index3.default)(date, options).getTime();\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;\n}\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = addLeadingZeros;\nfunction addLeadingZeros(number, targetLength) {\n var sign = number < 0 ? '-' : '';\n var output = Math.abs(number).toString();\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return sign + output;\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _index = _interopRequireDefault(require(\"../../addLeadingZeros/index.js\"));\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | |\n * | d | Day of month | D | |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | m | Minute | M | Month |\n * | s | Second | S | Fraction of second |\n * | y | Year (abs) | Y | |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n */\n\nvar formatters = {\n // Year\n y: function y(date, token) {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n\n var signedYear = date.getUTCFullYear();\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n var year = signedYear > 0 ? signedYear : 1 - signedYear;\n return (0, _index.default)(token === 'yy' ? year % 100 : year, token.length);\n },\n // Month\n M: function M(date, token) {\n var month = date.getUTCMonth();\n return token === 'M' ? String(month + 1) : (0, _index.default)(month + 1, 2);\n },\n // Day of the month\n d: function d(date, token) {\n return (0, _index.default)(date.getUTCDate(), token.length);\n },\n // AM or PM\n a: function a(date, token) {\n var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';\n switch (token) {\n case 'a':\n case 'aa':\n return dayPeriodEnumValue.toUpperCase();\n case 'aaa':\n return dayPeriodEnumValue;\n case 'aaaaa':\n return dayPeriodEnumValue[0];\n case 'aaaa':\n default:\n return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';\n }\n },\n // Hour [1-12]\n h: function h(date, token) {\n return (0, _index.default)(date.getUTCHours() % 12 || 12, token.length);\n },\n // Hour [0-23]\n H: function H(date, token) {\n return (0, _index.default)(date.getUTCHours(), token.length);\n },\n // Minute\n m: function m(date, token) {\n return (0, _index.default)(date.getUTCMinutes(), token.length);\n },\n // Second\n s: function s(date, token) {\n return (0, _index.default)(date.getUTCSeconds(), token.length);\n },\n // Fraction of second\n S: function S(date, token) {\n var numberOfDigits = token.length;\n var milliseconds = date.getUTCMilliseconds();\n var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));\n return (0, _index.default)(fractionalSeconds, token.length);\n }\n};\nvar _default = formatters;\nexports.default = _default;\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _index = _interopRequireDefault(require(\"../../../_lib/getUTCDayOfYear/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../../../_lib/getUTCISOWeek/index.js\"));\nvar _index3 = _interopRequireDefault(require(\"../../../_lib/getUTCISOWeekYear/index.js\"));\nvar _index4 = _interopRequireDefault(require(\"../../../_lib/getUTCWeek/index.js\"));\nvar _index5 = _interopRequireDefault(require(\"../../../_lib/getUTCWeekYear/index.js\"));\nvar _index6 = _interopRequireDefault(require(\"../../addLeadingZeros/index.js\"));\nvar _index7 = _interopRequireDefault(require(\"../lightFormatters/index.js\"));\nvar dayPeriodEnum = {\n am: 'am',\n pm: 'pm',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n};\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O | Timezone (GMT) |\n * | p! | Long localized time | P! | Long localized date |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n * - `P` is long localized date format\n * - `p` is long localized time format\n */\n\nvar formatters = {\n // Era\n G: function G(date, token, localize) {\n var era = date.getUTCFullYear() > 0 ? 1 : 0;\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return localize.era(era, {\n width: 'abbreviated'\n });\n // A, B\n case 'GGGGG':\n return localize.era(era, {\n width: 'narrow'\n });\n // Anno Domini, Before Christ\n case 'GGGG':\n default:\n return localize.era(era, {\n width: 'wide'\n });\n }\n },\n // Year\n y: function y(date, token, localize) {\n // Ordinal number\n if (token === 'yo') {\n var signedYear = date.getUTCFullYear();\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n var year = signedYear > 0 ? signedYear : 1 - signedYear;\n return localize.ordinalNumber(year, {\n unit: 'year'\n });\n }\n return _index7.default.y(date, token);\n },\n // Local week-numbering year\n Y: function Y(date, token, localize, options) {\n var signedWeekYear = (0, _index5.default)(date, options);\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;\n\n // Two digit year\n if (token === 'YY') {\n var twoDigitYear = weekYear % 100;\n return (0, _index6.default)(twoDigitYear, 2);\n }\n\n // Ordinal number\n if (token === 'Yo') {\n return localize.ordinalNumber(weekYear, {\n unit: 'year'\n });\n }\n\n // Padding\n return (0, _index6.default)(weekYear, token.length);\n },\n // ISO week-numbering year\n R: function R(date, token) {\n var isoWeekYear = (0, _index3.default)(date);\n\n // Padding\n return (0, _index6.default)(isoWeekYear, token.length);\n },\n // Extended year. This is a single number designating the year of this calendar system.\n // The main difference between `y` and `u` localizers are B.C. years:\n // | Year | `y` | `u` |\n // |------|-----|-----|\n // | AC 1 | 1 | 1 |\n // | BC 1 | 1 | 0 |\n // | BC 2 | 2 | -1 |\n // Also `yy` always returns the last two digits of a year,\n // while `uu` pads single digit years to 2 characters and returns other years unchanged.\n u: function u(date, token) {\n var year = date.getUTCFullYear();\n return (0, _index6.default)(year, token.length);\n },\n // Quarter\n Q: function Q(date, token, localize) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n return String(quarter);\n // 01, 02, 03, 04\n case 'QQ':\n return (0, _index6.default)(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n case 'Qo':\n return localize.ordinalNumber(quarter, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n case 'QQQ':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'QQQQQ':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1st quarter, 2nd quarter, ...\n case 'QQQQ':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone quarter\n q: function q(date, token, localize) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n return String(quarter);\n // 01, 02, 03, 04\n case 'qq':\n return (0, _index6.default)(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n case 'qo':\n return localize.ordinalNumber(quarter, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n case 'qqq':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'qqqqq':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1st quarter, 2nd quarter, ...\n case 'qqqq':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // Month\n M: function M(date, token, localize) {\n var month = date.getUTCMonth();\n switch (token) {\n case 'M':\n case 'MM':\n return _index7.default.M(date, token);\n // 1st, 2nd, ..., 12th\n case 'Mo':\n return localize.ordinalNumber(month + 1, {\n unit: 'month'\n });\n // Jan, Feb, ..., Dec\n case 'MMM':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // J, F, ..., D\n case 'MMMMM':\n return localize.month(month, {\n width: 'narrow',\n context: 'formatting'\n });\n // January, February, ..., December\n case 'MMMM':\n default:\n return localize.month(month, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone month\n L: function L(date, token, localize) {\n var month = date.getUTCMonth();\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return String(month + 1);\n // 01, 02, ..., 12\n case 'LL':\n return (0, _index6.default)(month + 1, 2);\n // 1st, 2nd, ..., 12th\n case 'Lo':\n return localize.ordinalNumber(month + 1, {\n unit: 'month'\n });\n // Jan, Feb, ..., Dec\n case 'LLL':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // J, F, ..., D\n case 'LLLLL':\n return localize.month(month, {\n width: 'narrow',\n context: 'standalone'\n });\n // January, February, ..., December\n case 'LLLL':\n default:\n return localize.month(month, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // Local week of year\n w: function w(date, token, localize, options) {\n var week = (0, _index4.default)(date, options);\n if (token === 'wo') {\n return localize.ordinalNumber(week, {\n unit: 'week'\n });\n }\n return (0, _index6.default)(week, token.length);\n },\n // ISO week of year\n I: function I(date, token, localize) {\n var isoWeek = (0, _index2.default)(date);\n if (token === 'Io') {\n return localize.ordinalNumber(isoWeek, {\n unit: 'week'\n });\n }\n return (0, _index6.default)(isoWeek, token.length);\n },\n // Day of the month\n d: function d(date, token, localize) {\n if (token === 'do') {\n return localize.ordinalNumber(date.getUTCDate(), {\n unit: 'date'\n });\n }\n return _index7.default.d(date, token);\n },\n // Day of year\n D: function D(date, token, localize) {\n var dayOfYear = (0, _index.default)(date);\n if (token === 'Do') {\n return localize.ordinalNumber(dayOfYear, {\n unit: 'dayOfYear'\n });\n }\n return (0, _index6.default)(dayOfYear, token.length);\n },\n // Day of week\n E: function E(date, token, localize) {\n var dayOfWeek = date.getUTCDay();\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n case 'EEEEE':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n case 'EEEEEE':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n case 'EEEE':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Local day of week\n e: function e(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n switch (token) {\n // Numerical value (Nth day of week with current locale or weekStartsOn)\n case 'e':\n return String(localDayOfWeek);\n // Padded numerical value\n case 'ee':\n return (0, _index6.default)(localDayOfWeek, 2);\n // 1st, 2nd, ..., 7th\n case 'eo':\n return localize.ordinalNumber(localDayOfWeek, {\n unit: 'day'\n });\n case 'eee':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n case 'eeeee':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n case 'eeeeee':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n case 'eeee':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone local day of week\n c: function c(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n switch (token) {\n // Numerical value (same as in `e`)\n case 'c':\n return String(localDayOfWeek);\n // Padded numerical value\n case 'cc':\n return (0, _index6.default)(localDayOfWeek, token.length);\n // 1st, 2nd, ..., 7th\n case 'co':\n return localize.ordinalNumber(localDayOfWeek, {\n unit: 'day'\n });\n case 'ccc':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // T\n case 'ccccc':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tu\n case 'cccccc':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'standalone'\n });\n // Tuesday\n case 'cccc':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // ISO day of week\n i: function i(date, token, localize) {\n var dayOfWeek = date.getUTCDay();\n var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;\n switch (token) {\n // 2\n case 'i':\n return String(isoDayOfWeek);\n // 02\n case 'ii':\n return (0, _index6.default)(isoDayOfWeek, token.length);\n // 2nd\n case 'io':\n return localize.ordinalNumber(isoDayOfWeek, {\n unit: 'day'\n });\n // Tue\n case 'iii':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n case 'iiiii':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n case 'iiiiii':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n case 'iiii':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // AM or PM\n a: function a(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';\n switch (token) {\n case 'a':\n case 'aa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n case 'aaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n }).toLowerCase();\n case 'aaaaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n case 'aaaa':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // AM, PM, midnight, noon\n b: function b(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n if (hours === 12) {\n dayPeriodEnumValue = dayPeriodEnum.noon;\n } else if (hours === 0) {\n dayPeriodEnumValue = dayPeriodEnum.midnight;\n } else {\n dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';\n }\n switch (token) {\n case 'b':\n case 'bb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n case 'bbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n }).toLowerCase();\n case 'bbbbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n case 'bbbb':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // in the morning, in the afternoon, in the evening, at night\n B: function B(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n if (hours >= 17) {\n dayPeriodEnumValue = dayPeriodEnum.evening;\n } else if (hours >= 12) {\n dayPeriodEnumValue = dayPeriodEnum.afternoon;\n } else if (hours >= 4) {\n dayPeriodEnumValue = dayPeriodEnum.morning;\n } else {\n dayPeriodEnumValue = dayPeriodEnum.night;\n }\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n case 'BBBBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n case 'BBBB':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Hour [1-12]\n h: function h(date, token, localize) {\n if (token === 'ho') {\n var hours = date.getUTCHours() % 12;\n if (hours === 0) hours = 12;\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n return _index7.default.h(date, token);\n },\n // Hour [0-23]\n H: function H(date, token, localize) {\n if (token === 'Ho') {\n return localize.ordinalNumber(date.getUTCHours(), {\n unit: 'hour'\n });\n }\n return _index7.default.H(date, token);\n },\n // Hour [0-11]\n K: function K(date, token, localize) {\n var hours = date.getUTCHours() % 12;\n if (token === 'Ko') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n return (0, _index6.default)(hours, token.length);\n },\n // Hour [1-24]\n k: function k(date, token, localize) {\n var hours = date.getUTCHours();\n if (hours === 0) hours = 24;\n if (token === 'ko') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n return (0, _index6.default)(hours, token.length);\n },\n // Minute\n m: function m(date, token, localize) {\n if (token === 'mo') {\n return localize.ordinalNumber(date.getUTCMinutes(), {\n unit: 'minute'\n });\n }\n return _index7.default.m(date, token);\n },\n // Second\n s: function s(date, token, localize) {\n if (token === 'so') {\n return localize.ordinalNumber(date.getUTCSeconds(), {\n unit: 'second'\n });\n }\n return _index7.default.s(date, token);\n },\n // Fraction of second\n S: function S(date, token) {\n return _index7.default.S(date, token);\n },\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function X(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n if (timezoneOffset === 0) {\n return 'Z';\n }\n switch (token) {\n // Hours and optional minutes\n case 'X':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n case 'XXXX':\n case 'XX':\n // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n case 'XXXXX':\n case 'XXX': // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function x(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n switch (token) {\n // Hours and optional minutes\n case 'x':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n case 'xxxx':\n case 'xx':\n // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n case 'xxxxx':\n case 'xxx': // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (GMT)\n O: function O(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n switch (token) {\n // Short\n case 'O':\n case 'OO':\n case 'OOO':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n case 'OOOO':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (specific non-location)\n z: function z(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n switch (token) {\n // Short\n case 'z':\n case 'zz':\n case 'zzz':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n case 'zzzz':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Seconds timestamp\n t: function t(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = Math.floor(originalDate.getTime() / 1000);\n return (0, _index6.default)(timestamp, token.length);\n },\n // Milliseconds timestamp\n T: function T(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = originalDate.getTime();\n return (0, _index6.default)(timestamp, token.length);\n }\n};\nfunction formatTimezoneShort(offset, dirtyDelimiter) {\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = Math.floor(absOffset / 60);\n var minutes = absOffset % 60;\n if (minutes === 0) {\n return sign + String(hours);\n }\n var delimiter = dirtyDelimiter || '';\n return sign + String(hours) + delimiter + (0, _index6.default)(minutes, 2);\n}\nfunction formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {\n if (offset % 60 === 0) {\n var sign = offset > 0 ? '-' : '+';\n return sign + (0, _index6.default)(Math.abs(offset) / 60, 2);\n }\n return formatTimezone(offset, dirtyDelimiter);\n}\nfunction formatTimezone(offset, dirtyDelimiter) {\n var delimiter = dirtyDelimiter || '';\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = (0, _index6.default)(Math.floor(absOffset / 60), 2);\n var minutes = (0, _index6.default)(absOffset % 60, 2);\n return sign + hours + delimiter + minutes;\n}\nvar _default = formatters;\nexports.default = _default;\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar dateLongFormatter = function dateLongFormatter(pattern, formatLong) {\n switch (pattern) {\n case 'P':\n return formatLong.date({\n width: 'short'\n });\n case 'PP':\n return formatLong.date({\n width: 'medium'\n });\n case 'PPP':\n return formatLong.date({\n width: 'long'\n });\n case 'PPPP':\n default:\n return formatLong.date({\n width: 'full'\n });\n }\n};\nvar timeLongFormatter = function timeLongFormatter(pattern, formatLong) {\n switch (pattern) {\n case 'p':\n return formatLong.time({\n width: 'short'\n });\n case 'pp':\n return formatLong.time({\n width: 'medium'\n });\n case 'ppp':\n return formatLong.time({\n width: 'long'\n });\n case 'pppp':\n default:\n return formatLong.time({\n width: 'full'\n });\n }\n};\nvar dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {\n var matchResult = pattern.match(/(P+)(p+)?/) || [];\n var datePattern = matchResult[1];\n var timePattern = matchResult[2];\n if (!timePattern) {\n return dateLongFormatter(pattern, formatLong);\n }\n var dateTimeFormat;\n switch (datePattern) {\n case 'P':\n dateTimeFormat = formatLong.dateTime({\n width: 'short'\n });\n break;\n case 'PP':\n dateTimeFormat = formatLong.dateTime({\n width: 'medium'\n });\n break;\n case 'PPP':\n dateTimeFormat = formatLong.dateTime({\n width: 'long'\n });\n break;\n case 'PPPP':\n default:\n dateTimeFormat = formatLong.dateTime({\n width: 'full'\n });\n break;\n }\n return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));\n};\nvar longFormatters = {\n p: timeLongFormatter,\n P: dateTimeLongFormatter\n};\nvar _default = longFormatters;\nexports.default = _default;\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = getTimezoneOffsetInMilliseconds;\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nfunction getTimezoneOffsetInMilliseconds(date) {\n var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));\n utcDate.setUTCFullYear(date.getFullYear());\n return date.getTime() - utcDate.getTime();\n}\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.isProtectedDayOfYearToken = isProtectedDayOfYearToken;\nexports.isProtectedWeekYearToken = isProtectedWeekYearToken;\nexports.throwProtectedError = throwProtectedError;\nvar protectedDayOfYearTokens = ['D', 'DD'];\nvar protectedWeekYearTokens = ['YY', 'YYYY'];\nfunction isProtectedDayOfYearToken(token) {\n return protectedDayOfYearTokens.indexOf(token) !== -1;\n}\nfunction isProtectedWeekYearToken(token) {\n return protectedWeekYearTokens.indexOf(token) !== -1;\n}\nfunction throwProtectedError(token, format, input) {\n if (token === 'YYYY') {\n throw new RangeError(\"Use `yyyy` instead of `YYYY` (in `\".concat(format, \"`) for formatting years to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'YY') {\n throw new RangeError(\"Use `yy` instead of `YY` (in `\".concat(format, \"`) for formatting years to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'D') {\n throw new RangeError(\"Use `d` instead of `D` (in `\".concat(format, \"`) for formatting days of the month to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'DD') {\n throw new RangeError(\"Use `dd` instead of `DD` (in `\".concat(format, \"`) for formatting days of the month to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n }\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar formatDistanceLocale = {\n lessThanXSeconds: {\n one: 'less than a second',\n other: 'less than {{count}} seconds'\n },\n xSeconds: {\n one: '1 second',\n other: '{{count}} seconds'\n },\n halfAMinute: 'half a minute',\n lessThanXMinutes: {\n one: 'less than a minute',\n other: 'less than {{count}} minutes'\n },\n xMinutes: {\n one: '1 minute',\n other: '{{count}} minutes'\n },\n aboutXHours: {\n one: 'about 1 hour',\n other: 'about {{count}} hours'\n },\n xHours: {\n one: '1 hour',\n other: '{{count}} hours'\n },\n xDays: {\n one: '1 day',\n other: '{{count}} days'\n },\n aboutXWeeks: {\n one: 'about 1 week',\n other: 'about {{count}} weeks'\n },\n xWeeks: {\n one: '1 week',\n other: '{{count}} weeks'\n },\n aboutXMonths: {\n one: 'about 1 month',\n other: 'about {{count}} months'\n },\n xMonths: {\n one: '1 month',\n other: '{{count}} months'\n },\n aboutXYears: {\n one: 'about 1 year',\n other: 'about {{count}} years'\n },\n xYears: {\n one: '1 year',\n other: '{{count}} years'\n },\n overXYears: {\n one: 'over 1 year',\n other: 'over {{count}} years'\n },\n almostXYears: {\n one: 'almost 1 year',\n other: 'almost {{count}} years'\n }\n};\nvar formatDistance = function formatDistance(token, count, options) {\n var result;\n var tokenValue = formatDistanceLocale[token];\n if (typeof tokenValue === 'string') {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace('{{count}}', count.toString());\n }\n if (options !== null && options !== void 0 && options.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return 'in ' + result;\n } else {\n return result + ' ago';\n }\n }\n return result;\n};\nvar _default = formatDistance;\nexports.default = _default;\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = buildFormatLongFn;\nfunction buildFormatLongFn(args) {\n return function () {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n // TODO: Remove String()\n var width = options.width ? String(options.width) : args.defaultWidth;\n var format = args.formats[width] || args.formats[args.defaultWidth];\n return format;\n };\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _index = _interopRequireDefault(require(\"../../../_lib/buildFormatLongFn/index.js\"));\nvar dateFormats = {\n full: 'EEEE, MMMM do, y',\n long: 'MMMM do, y',\n medium: 'MMM d, y',\n short: 'MM/dd/yyyy'\n};\nvar timeFormats = {\n full: 'h:mm:ss a zzzz',\n long: 'h:mm:ss a z',\n medium: 'h:mm:ss a',\n short: 'h:mm a'\n};\nvar dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n};\nvar formatLong = {\n date: (0, _index.default)({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: (0, _index.default)({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: (0, _index.default)({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nvar _default = formatLong;\nexports.default = _default;\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar formatRelativeLocale = {\n lastWeek: \"'last' eeee 'at' p\",\n yesterday: \"'yesterday at' p\",\n today: \"'today at' p\",\n tomorrow: \"'tomorrow at' p\",\n nextWeek: \"eeee 'at' p\",\n other: 'P'\n};\nvar formatRelative = function formatRelative(token, _date, _baseDate, _options) {\n return formatRelativeLocale[token];\n};\nvar _default = formatRelative;\nexports.default = _default;\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = buildLocalizeFn;\nfunction buildLocalizeFn(args) {\n return function (dirtyIndex, options) {\n var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';\n var valuesArray;\n if (context === 'formatting' && args.formattingValues) {\n var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;\n var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;\n valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];\n } else {\n var _defaultWidth = args.defaultWidth;\n var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;\n valuesArray = args.values[_width] || args.values[_defaultWidth];\n }\n var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;\n // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!\n return valuesArray[index];\n };\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _index = _interopRequireDefault(require(\"../../../_lib/buildLocalizeFn/index.js\"));\nvar eraValues = {\n narrow: ['B', 'A'],\n abbreviated: ['BC', 'AD'],\n wide: ['Before Christ', 'Anno Domini']\n};\nvar quarterValues = {\n narrow: ['1', '2', '3', '4'],\n abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],\n wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']\n};\n\n// Note: in English, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\nvar monthValues = {\n narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],\n abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n};\nvar dayValues = {\n narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],\n short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],\n abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']\n};\nvar dayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n }\n};\nvar formattingDayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n }\n};\nvar ordinalNumber = function ordinalNumber(dirtyNumber, _options) {\n var number = Number(dirtyNumber);\n\n // If ordinal numbers depend on context, for example,\n // if they are different for different grammatical genders,\n // use `options.unit`.\n //\n // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',\n // 'day', 'hour', 'minute', 'second'.\n\n var rem100 = number % 100;\n if (rem100 > 20 || rem100 < 10) {\n switch (rem100 % 10) {\n case 1:\n return number + 'st';\n case 2:\n return number + 'nd';\n case 3:\n return number + 'rd';\n }\n }\n return number + 'th';\n};\nvar localize = {\n ordinalNumber: ordinalNumber,\n era: (0, _index.default)({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n quarter: (0, _index.default)({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function argumentCallback(quarter) {\n return quarter - 1;\n }\n }),\n month: (0, _index.default)({\n values: monthValues,\n defaultWidth: 'wide'\n }),\n day: (0, _index.default)({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n dayPeriod: (0, _index.default)({\n values: dayPeriodValues,\n defaultWidth: 'wide',\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: 'wide'\n })\n};\nvar _default = localize;\nexports.default = _default;\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = buildMatchFn;\nfunction buildMatchFn(args) {\n return function (string) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var width = options.width;\n var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];\n var matchResult = string.match(matchPattern);\n if (!matchResult) {\n return null;\n }\n var matchedString = matchResult[0];\n var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];\n var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {\n return pattern.test(matchedString);\n }) : findKey(parsePatterns, function (pattern) {\n return pattern.test(matchedString);\n });\n var value;\n value = args.valueCallback ? args.valueCallback(key) : key;\n value = options.valueCallback ? options.valueCallback(value) : value;\n var rest = string.slice(matchedString.length);\n return {\n value: value,\n rest: rest\n };\n };\n}\nfunction findKey(object, predicate) {\n for (var key in object) {\n if (object.hasOwnProperty(key) && predicate(object[key])) {\n return key;\n }\n }\n return undefined;\n}\nfunction findIndex(array, predicate) {\n for (var key = 0; key < array.length; key++) {\n if (predicate(array[key])) {\n return key;\n }\n }\n return undefined;\n}\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = buildMatchPatternFn;\nfunction buildMatchPatternFn(args) {\n return function (string) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var matchResult = string.match(args.matchPattern);\n if (!matchResult) return null;\n var matchedString = matchResult[0];\n var parseResult = string.match(args.parsePattern);\n if (!parseResult) return null;\n var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];\n value = options.valueCallback ? options.valueCallback(value) : value;\n var rest = string.slice(matchedString.length);\n return {\n value: value,\n rest: rest\n };\n };\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _index = _interopRequireDefault(require(\"../../../_lib/buildMatchFn/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../../../_lib/buildMatchPatternFn/index.js\"));\nvar matchOrdinalNumberPattern = /^(\\d+)(th|st|nd|rd)?/i;\nvar parseOrdinalNumberPattern = /\\d+/i;\nvar matchEraPatterns = {\n narrow: /^(b|a)/i,\n abbreviated: /^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,\n wide: /^(before christ|before common era|anno domini|common era)/i\n};\nvar parseEraPatterns = {\n any: [/^b/i, /^(a|c)/i]\n};\nvar matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](th|st|nd|rd)? quarter/i\n};\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n};\nvar matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,\n wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i\n};\nvar parseMonthPatterns = {\n narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]\n};\nvar matchDayPatterns = {\n narrow: /^[smtwf]/i,\n short: /^(su|mo|tu|we|th|fr|sa)/i,\n abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,\n wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i\n};\nvar parseDayPatterns = {\n narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],\n any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]\n};\nvar matchDayPeriodPatterns = {\n narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,\n any: /^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i\n};\nvar parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mi/i,\n noon: /^no/i,\n morning: /morning/i,\n afternoon: /afternoon/i,\n evening: /evening/i,\n night: /night/i\n }\n};\nvar match = {\n ordinalNumber: (0, _index2.default)({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function valueCallback(value) {\n return parseInt(value, 10);\n }\n }),\n era: (0, _index.default)({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n quarter: (0, _index.default)({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function valueCallback(index) {\n return index + 1;\n }\n }),\n month: (0, _index.default)({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n day: (0, _index.default)({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n dayPeriod: (0, _index.default)({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'any',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n};\nvar _default = match;\nexports.default = _default;\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _index = _interopRequireDefault(require(\"./_lib/formatDistance/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"./_lib/formatLong/index.js\"));\nvar _index3 = _interopRequireDefault(require(\"./_lib/formatRelative/index.js\"));\nvar _index4 = _interopRequireDefault(require(\"./_lib/localize/index.js\"));\nvar _index5 = _interopRequireDefault(require(\"./_lib/match/index.js\"));\n/**\n * @type {Locale}\n * @category Locales\n * @summary English locale (United States).\n * @language English\n * @iso-639-2 eng\n * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}\n * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}\n */\nvar locale = {\n code: 'en-US',\n formatDistance: _index.default,\n formatLong: _index2.default,\n formatRelative: _index3.default,\n localize: _index4.default,\n match: _index5.default,\n options: {\n weekStartsOn: 0 /* Sunday */,\n firstWeekContainsDate: 1\n }\n};\nvar _default = locale;\nexports.default = _default;\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _index = _interopRequireDefault(require(\"../../locale/en-US/index.js\"));\nvar _default = _index.default;\nexports.default = _default;\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = format;\nvar _index = _interopRequireDefault(require(\"../isValid/index.js\"));\nvar _index2 = _interopRequireDefault(require(\"../subMilliseconds/index.js\"));\nvar _index3 = _interopRequireDefault(require(\"../toDate/index.js\"));\nvar _index4 = _interopRequireDefault(require(\"../_lib/format/formatters/index.js\"));\nvar _index5 = _interopRequireDefault(require(\"../_lib/format/longFormatters/index.js\"));\nvar _index6 = _interopRequireDefault(require(\"../_lib/getTimezoneOffsetInMilliseconds/index.js\"));\nvar _index7 = require(\"../_lib/protectedTokens/index.js\");\nvar _index8 = _interopRequireDefault(require(\"../_lib/toInteger/index.js\"));\nvar _index9 = _interopRequireDefault(require(\"../_lib/requiredArgs/index.js\"));\nvar _index10 = require(\"../_lib/defaultOptions/index.js\");\nvar _index11 = _interopRequireDefault(require(\"../_lib/defaultLocale/index.js\"));\n// This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g;\n\n// This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\nvar longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\nvar escapedStringRegExp = /^'([^]*?)'?$/;\nvar doubleQuoteRegExp = /''/g;\nvar unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n\n/**\n * @name format\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 9 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 9 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Sun | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | a..aa | AM, PM | |\n * | | aaa | am, pm | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |\n * | | bbb | am, pm, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 04/29/1453 | 7 |\n * | | PP | Apr 29, 1453 | 7 |\n * | | PPP | April 29th, 1453 | 7 |\n * | | PPPP | Friday, April 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |\n * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | April 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}\n * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * @param {Date|Number} date - the original date\n * @param {String} format - the string of tokens\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is\n * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @returns {String} the formatted date string\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `options.locale` must contain `localize` property\n * @throws {RangeError} `options.locale` must contain `formatLong` property\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} format string contains an unescaped latin alphabet character\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * const result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\n\nfunction format(dirtyDate, dirtyFormatStr, options) {\n var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;\n (0, _index9.default)(2, arguments);\n var formatStr = String(dirtyFormatStr);\n var defaultOptions = (0, _index10.getDefaultOptions)();\n var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : _index11.default;\n var firstWeekContainsDate = (0, _index8.default)((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);\n\n // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n var weekStartsOn = (0, _index8.default)((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n if (!locale.localize) {\n throw new RangeError('locale must contain localize property');\n }\n if (!locale.formatLong) {\n throw new RangeError('locale must contain formatLong property');\n }\n var originalDate = (0, _index3.default)(dirtyDate);\n if (!(0, _index.default)(originalDate)) {\n throw new RangeError('Invalid time value');\n }\n\n // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n // This ensures that when UTC functions will be implemented, locales will be compatible with them.\n // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376\n var timezoneOffset = (0, _index6.default)(originalDate);\n var utcDate = (0, _index2.default)(originalDate, timezoneOffset);\n var formatterOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale,\n _originalDate: originalDate\n };\n var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {\n var firstCharacter = substring[0];\n if (firstCharacter === 'p' || firstCharacter === 'P') {\n var longFormatter = _index5.default[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n return substring;\n }).join('').match(formattingTokensRegExp).map(function (substring) {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return \"'\";\n }\n var firstCharacter = substring[0];\n if (firstCharacter === \"'\") {\n return cleanEscapedString(substring);\n }\n var formatter = _index4.default[firstCharacter];\n if (formatter) {\n if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && (0, _index7.isProtectedWeekYearToken)(substring)) {\n (0, _index7.throwProtectedError)(substring, dirtyFormatStr, String(dirtyDate));\n }\n if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && (0, _index7.isProtectedDayOfYearToken)(substring)) {\n (0, _index7.throwProtectedError)(substring, dirtyFormatStr, String(dirtyDate));\n }\n return formatter(utcDate, substring, locale.localize, formatterOptions);\n }\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');\n }\n return substring;\n }).join('');\n return result;\n}\nfunction cleanEscapedString(input) {\n var matched = input.match(escapedStringRegExp);\n if (!matched) {\n return input;\n }\n return matched[1].replace(doubleQuoteRegExp, \"'\");\n}\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = assign;\nfunction assign(target, object) {\n if (target == null) {\n throw new TypeError('assign requires that input parameter not be null or undefined');\n }\n for (var property in object) {\n if (Object.prototype.hasOwnProperty.call(object, property)) {\n ;\n target[property] = object[property];\n }\n }\n return target;\n}\nmodule.exports = exports.default;","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = cloneObject;\nvar _index = _interopRequireDefault(require(\"../assign/index.js\"));\nfunction cloneObject(object) {\n return (0, _index.default)({}, object);\n}\nmodule.exports = exports.default;","var characterMap = {\n \"À\": \"A\",\n \"Á\": \"A\",\n \"Â\": \"A\",\n \"Ã\": \"A\",\n \"Ä\": \"A\",\n \"Å\": \"A\",\n \"Ấ\": \"A\",\n \"Ắ\": \"A\",\n \"Ẳ\": \"A\",\n \"Ẵ\": \"A\",\n \"Ặ\": \"A\",\n \"Æ\": \"AE\",\n \"Ầ\": \"A\",\n \"Ằ\": \"A\",\n \"Ȃ\": \"A\",\n \"Ç\": \"C\",\n \"Ḉ\": \"C\",\n \"È\": \"E\",\n \"É\": \"E\",\n \"Ê\": \"E\",\n \"Ë\": \"E\",\n \"Ế\": \"E\",\n \"Ḗ\": \"E\",\n \"Ề\": \"E\",\n \"Ḕ\": \"E\",\n \"Ḝ\": \"E\",\n \"Ȇ\": \"E\",\n \"Ì\": \"I\",\n \"Í\": \"I\",\n \"Î\": \"I\",\n \"Ï\": \"I\",\n \"Ḯ\": \"I\",\n \"Ȋ\": \"I\",\n \"Ð\": \"D\",\n \"Ñ\": \"N\",\n \"Ò\": \"O\",\n \"Ó\": \"O\",\n \"Ô\": \"O\",\n \"Õ\": \"O\",\n \"Ö\": \"O\",\n \"Ø\": \"O\",\n \"Ố\": \"O\",\n \"Ṍ\": \"O\",\n \"Ṓ\": \"O\",\n \"Ȏ\": \"O\",\n \"Ù\": \"U\",\n \"Ú\": \"U\",\n \"Û\": \"U\",\n \"Ü\": \"U\",\n \"Ý\": \"Y\",\n \"à\": \"a\",\n \"á\": \"a\",\n \"â\": \"a\",\n \"ã\": \"a\",\n \"ä\": \"a\",\n \"å\": \"a\",\n \"ấ\": \"a\",\n \"ắ\": \"a\",\n \"ẳ\": \"a\",\n \"ẵ\": \"a\",\n \"ặ\": \"a\",\n \"æ\": \"ae\",\n \"ầ\": \"a\",\n \"ằ\": \"a\",\n \"ȃ\": \"a\",\n \"ç\": \"c\",\n \"ḉ\": \"c\",\n \"è\": \"e\",\n \"é\": \"e\",\n \"ê\": \"e\",\n \"ë\": \"e\",\n \"ế\": \"e\",\n \"ḗ\": \"e\",\n \"ề\": \"e\",\n \"ḕ\": \"e\",\n \"ḝ\": \"e\",\n \"ȇ\": \"e\",\n \"ì\": \"i\",\n \"í\": \"i\",\n \"î\": \"i\",\n \"ï\": \"i\",\n \"ḯ\": \"i\",\n \"ȋ\": \"i\",\n \"ð\": \"d\",\n \"ñ\": \"n\",\n \"ò\": \"o\",\n \"ó\": \"o\",\n \"ô\": \"o\",\n \"õ\": \"o\",\n \"ö\": \"o\",\n \"ø\": \"o\",\n \"ố\": \"o\",\n \"ṍ\": \"o\",\n \"ṓ\": \"o\",\n \"ȏ\": \"o\",\n \"ù\": \"u\",\n \"ú\": \"u\",\n \"û\": \"u\",\n \"ü\": \"u\",\n \"ý\": \"y\",\n \"ÿ\": \"y\",\n \"Ā\": \"A\",\n \"ā\": \"a\",\n \"Ă\": \"A\",\n \"ă\": \"a\",\n \"Ą\": \"A\",\n \"ą\": \"a\",\n \"Ć\": \"C\",\n \"ć\": \"c\",\n \"Ĉ\": \"C\",\n \"ĉ\": \"c\",\n \"Ċ\": \"C\",\n \"ċ\": \"c\",\n \"Č\": \"C\",\n \"č\": \"c\",\n \"C̆\": \"C\",\n \"c̆\": \"c\",\n \"Ď\": \"D\",\n \"ď\": \"d\",\n \"Đ\": \"D\",\n \"đ\": \"d\",\n \"Ē\": \"E\",\n \"ē\": \"e\",\n \"Ĕ\": \"E\",\n \"ĕ\": \"e\",\n \"Ė\": \"E\",\n \"ė\": \"e\",\n \"Ę\": \"E\",\n \"ę\": \"e\",\n \"Ě\": \"E\",\n \"ě\": \"e\",\n \"Ĝ\": \"G\",\n \"Ǵ\": \"G\",\n \"ĝ\": \"g\",\n \"ǵ\": \"g\",\n \"Ğ\": \"G\",\n \"ğ\": \"g\",\n \"Ġ\": \"G\",\n \"ġ\": \"g\",\n \"Ģ\": \"G\",\n \"ģ\": \"g\",\n \"Ĥ\": \"H\",\n \"ĥ\": \"h\",\n \"Ħ\": \"H\",\n \"ħ\": \"h\",\n \"Ḫ\": \"H\",\n \"ḫ\": \"h\",\n \"Ĩ\": \"I\",\n \"ĩ\": \"i\",\n \"Ī\": \"I\",\n \"ī\": \"i\",\n \"Ĭ\": \"I\",\n \"ĭ\": \"i\",\n \"Į\": \"I\",\n \"į\": \"i\",\n \"İ\": \"I\",\n \"ı\": \"i\",\n \"IJ\": \"IJ\",\n \"ij\": \"ij\",\n \"Ĵ\": \"J\",\n \"ĵ\": \"j\",\n \"Ķ\": \"K\",\n \"ķ\": \"k\",\n \"Ḱ\": \"K\",\n \"ḱ\": \"k\",\n \"K̆\": \"K\",\n \"k̆\": \"k\",\n \"Ĺ\": \"L\",\n \"ĺ\": \"l\",\n \"Ļ\": \"L\",\n \"ļ\": \"l\",\n \"Ľ\": \"L\",\n \"ľ\": \"l\",\n \"Ŀ\": \"L\",\n \"ŀ\": \"l\",\n \"Ł\": \"l\",\n \"ł\": \"l\",\n \"Ḿ\": \"M\",\n \"ḿ\": \"m\",\n \"M̆\": \"M\",\n \"m̆\": \"m\",\n \"Ń\": \"N\",\n \"ń\": \"n\",\n \"Ņ\": \"N\",\n \"ņ\": \"n\",\n \"Ň\": \"N\",\n \"ň\": \"n\",\n \"ʼn\": \"n\",\n \"N̆\": \"N\",\n \"n̆\": \"n\",\n \"Ō\": \"O\",\n \"ō\": \"o\",\n \"Ŏ\": \"O\",\n \"ŏ\": \"o\",\n \"Ő\": \"O\",\n \"ő\": \"o\",\n \"Œ\": \"OE\",\n \"œ\": \"oe\",\n \"P̆\": \"P\",\n \"p̆\": \"p\",\n \"Ŕ\": \"R\",\n \"ŕ\": \"r\",\n \"Ŗ\": \"R\",\n \"ŗ\": \"r\",\n \"Ř\": \"R\",\n \"ř\": \"r\",\n \"R̆\": \"R\",\n \"r̆\": \"r\",\n \"Ȓ\": \"R\",\n \"ȓ\": \"r\",\n \"Ś\": \"S\",\n \"ś\": \"s\",\n \"Ŝ\": \"S\",\n \"ŝ\": \"s\",\n \"Ş\": \"S\",\n \"Ș\": \"S\",\n \"ș\": \"s\",\n \"ş\": \"s\",\n \"Š\": \"S\",\n \"š\": \"s\",\n \"ß\": \"ss\",\n \"Ţ\": \"T\",\n \"ţ\": \"t\",\n \"ț\": \"t\",\n \"Ț\": \"T\",\n \"Ť\": \"T\",\n \"ť\": \"t\",\n \"Ŧ\": \"T\",\n \"ŧ\": \"t\",\n \"T̆\": \"T\",\n \"t̆\": \"t\",\n \"Ũ\": \"U\",\n \"ũ\": \"u\",\n \"Ū\": \"U\",\n \"ū\": \"u\",\n \"Ŭ\": \"U\",\n \"ŭ\": \"u\",\n \"Ů\": \"U\",\n \"ů\": \"u\",\n \"Ű\": \"U\",\n \"ű\": \"u\",\n \"Ų\": \"U\",\n \"ų\": \"u\",\n \"Ȗ\": \"U\",\n \"ȗ\": \"u\",\n \"V̆\": \"V\",\n \"v̆\": \"v\",\n \"Ŵ\": \"W\",\n \"ŵ\": \"w\",\n \"Ẃ\": \"W\",\n \"ẃ\": \"w\",\n \"X̆\": \"X\",\n \"x̆\": \"x\",\n \"Ŷ\": \"Y\",\n \"ŷ\": \"y\",\n \"Ÿ\": \"Y\",\n \"Y̆\": \"Y\",\n \"y̆\": \"y\",\n \"Ź\": \"Z\",\n \"ź\": \"z\",\n \"Ż\": \"Z\",\n \"ż\": \"z\",\n \"Ž\": \"Z\",\n \"ž\": \"z\",\n \"ſ\": \"s\",\n \"ƒ\": \"f\",\n \"Ơ\": \"O\",\n \"ơ\": \"o\",\n \"Ư\": \"U\",\n \"ư\": \"u\",\n \"Ǎ\": \"A\",\n \"ǎ\": \"a\",\n \"Ǐ\": \"I\",\n \"ǐ\": \"i\",\n \"Ǒ\": \"O\",\n \"ǒ\": \"o\",\n \"Ǔ\": \"U\",\n \"ǔ\": \"u\",\n \"Ǖ\": \"U\",\n \"ǖ\": \"u\",\n \"Ǘ\": \"U\",\n \"ǘ\": \"u\",\n \"Ǚ\": \"U\",\n \"ǚ\": \"u\",\n \"Ǜ\": \"U\",\n \"ǜ\": \"u\",\n \"Ứ\": \"U\",\n \"ứ\": \"u\",\n \"Ṹ\": \"U\",\n \"ṹ\": \"u\",\n \"Ǻ\": \"A\",\n \"ǻ\": \"a\",\n \"Ǽ\": \"AE\",\n \"ǽ\": \"ae\",\n \"Ǿ\": \"O\",\n \"ǿ\": \"o\",\n \"Þ\": \"TH\",\n \"þ\": \"th\",\n \"Ṕ\": \"P\",\n \"ṕ\": \"p\",\n \"Ṥ\": \"S\",\n \"ṥ\": \"s\",\n \"X́\": \"X\",\n \"x́\": \"x\",\n \"Ѓ\": \"Г\",\n \"ѓ\": \"г\",\n \"Ќ\": \"К\",\n \"ќ\": \"к\",\n \"A̋\": \"A\",\n \"a̋\": \"a\",\n \"E̋\": \"E\",\n \"e̋\": \"e\",\n \"I̋\": \"I\",\n \"i̋\": \"i\",\n \"Ǹ\": \"N\",\n \"ǹ\": \"n\",\n \"Ồ\": \"O\",\n \"ồ\": \"o\",\n \"Ṑ\": \"O\",\n \"ṑ\": \"o\",\n \"Ừ\": \"U\",\n \"ừ\": \"u\",\n \"Ẁ\": \"W\",\n \"ẁ\": \"w\",\n \"Ỳ\": \"Y\",\n \"ỳ\": \"y\",\n \"Ȁ\": \"A\",\n \"ȁ\": \"a\",\n \"Ȅ\": \"E\",\n \"ȅ\": \"e\",\n \"Ȉ\": \"I\",\n \"ȉ\": \"i\",\n \"Ȍ\": \"O\",\n \"ȍ\": \"o\",\n \"Ȑ\": \"R\",\n \"ȑ\": \"r\",\n \"Ȕ\": \"U\",\n \"ȕ\": \"u\",\n \"B̌\": \"B\",\n \"b̌\": \"b\",\n \"Č̣\": \"C\",\n \"č̣\": \"c\",\n \"Ê̌\": \"E\",\n \"ê̌\": \"e\",\n \"F̌\": \"F\",\n \"f̌\": \"f\",\n \"Ǧ\": \"G\",\n \"ǧ\": \"g\",\n \"Ȟ\": \"H\",\n \"ȟ\": \"h\",\n \"J̌\": \"J\",\n \"ǰ\": \"j\",\n \"Ǩ\": \"K\",\n \"ǩ\": \"k\",\n \"M̌\": \"M\",\n \"m̌\": \"m\",\n \"P̌\": \"P\",\n \"p̌\": \"p\",\n \"Q̌\": \"Q\",\n \"q̌\": \"q\",\n \"Ř̩\": \"R\",\n \"ř̩\": \"r\",\n \"Ṧ\": \"S\",\n \"ṧ\": \"s\",\n \"V̌\": \"V\",\n \"v̌\": \"v\",\n \"W̌\": \"W\",\n \"w̌\": \"w\",\n \"X̌\": \"X\",\n \"x̌\": \"x\",\n \"Y̌\": \"Y\",\n \"y̌\": \"y\",\n \"A̧\": \"A\",\n \"a̧\": \"a\",\n \"B̧\": \"B\",\n \"b̧\": \"b\",\n \"Ḑ\": \"D\",\n \"ḑ\": \"d\",\n \"Ȩ\": \"E\",\n \"ȩ\": \"e\",\n \"Ɛ̧\": \"E\",\n \"ɛ̧\": \"e\",\n \"Ḩ\": \"H\",\n \"ḩ\": \"h\",\n \"I̧\": \"I\",\n \"i̧\": \"i\",\n \"Ɨ̧\": \"I\",\n \"ɨ̧\": \"i\",\n \"M̧\": \"M\",\n \"m̧\": \"m\",\n \"O̧\": \"O\",\n \"o̧\": \"o\",\n \"Q̧\": \"Q\",\n \"q̧\": \"q\",\n \"U̧\": \"U\",\n \"u̧\": \"u\",\n \"X̧\": \"X\",\n \"x̧\": \"x\",\n \"Z̧\": \"Z\",\n \"z̧\": \"z\",\n \"й\": \"и\",\n \"Й\": \"И\",\n \"ё\": \"е\",\n \"Ё\": \"Е\"\n};\nvar chars = Object.keys(characterMap).join('|');\nvar allAccents = new RegExp(chars, 'g');\nvar firstAccent = new RegExp(chars, '');\nfunction matcher(match) {\n return characterMap[match];\n}\nvar removeAccents = function (string) {\n return string.replace(allAccents, matcher);\n};\nvar hasAccents = function (string) {\n return !!string.match(firstAccent);\n};\nmodule.exports = removeAccents;\nmodule.exports.has = hasAccents;\nmodule.exports.remove = removeAccents;","/*\n * Dexie.js - a minimalistic wrapper for IndexedDB\n * ===============================================\n *\n * By David Fahlander, david.fahlander@gmail.com\n *\n * Version 4.0.10, Fri Nov 15 2024\n *\n * https://dexie.org\n *\n * Apache License Version 2.0, January 2004, http://www.apache.org/licenses/\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dexie = factory());\n})(this, function () {\n 'use strict';\n\n /*! *****************************************************************************\n Copyright (c) Microsoft Corporation.\n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted.\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n PERFORMANCE OF THIS SOFTWARE.\n ***************************************************************************** */\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n };\n return extendStatics(d, b);\n };\n function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null) throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n }\n var __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n }\n var _global = typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;\n var keys = Object.keys;\n var isArray = Array.isArray;\n if (typeof Promise !== 'undefined' && !_global.Promise) {\n _global.Promise = Promise;\n }\n function extend(obj, extension) {\n if (typeof extension !== 'object') return obj;\n keys(extension).forEach(function (key) {\n obj[key] = extension[key];\n });\n return obj;\n }\n var getProto = Object.getPrototypeOf;\n var _hasOwn = {}.hasOwnProperty;\n function hasOwn(obj, prop) {\n return _hasOwn.call(obj, prop);\n }\n function props(proto, extension) {\n if (typeof extension === 'function') extension = extension(getProto(proto));\n (typeof Reflect === \"undefined\" ? keys : Reflect.ownKeys)(extension).forEach(function (key) {\n setProp(proto, key, extension[key]);\n });\n }\n var defineProperty = Object.defineProperty;\n function setProp(obj, prop, functionOrGetSet, options) {\n defineProperty(obj, prop, extend(functionOrGetSet && hasOwn(functionOrGetSet, \"get\") && typeof functionOrGetSet.get === 'function' ? {\n get: functionOrGetSet.get,\n set: functionOrGetSet.set,\n configurable: true\n } : {\n value: functionOrGetSet,\n configurable: true,\n writable: true\n }, options));\n }\n function derive(Child) {\n return {\n from: function (Parent) {\n Child.prototype = Object.create(Parent.prototype);\n setProp(Child.prototype, \"constructor\", Child);\n return {\n extend: props.bind(null, Child.prototype)\n };\n }\n };\n }\n var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n function getPropertyDescriptor(obj, prop) {\n var pd = getOwnPropertyDescriptor(obj, prop);\n var proto;\n return pd || (proto = getProto(obj)) && getPropertyDescriptor(proto, prop);\n }\n var _slice = [].slice;\n function slice(args, start, end) {\n return _slice.call(args, start, end);\n }\n function override(origFunc, overridedFactory) {\n return overridedFactory(origFunc);\n }\n function assert(b) {\n if (!b) throw new Error(\"Assertion Failed\");\n }\n function asap$1(fn) {\n if (_global.setImmediate) setImmediate(fn);else setTimeout(fn, 0);\n }\n function arrayToObject(array, extractor) {\n return array.reduce(function (result, item, i) {\n var nameAndValue = extractor(item, i);\n if (nameAndValue) result[nameAndValue[0]] = nameAndValue[1];\n return result;\n }, {});\n }\n function getByKeyPath(obj, keyPath) {\n if (typeof keyPath === 'string' && hasOwn(obj, keyPath)) return obj[keyPath];\n if (!keyPath) return obj;\n if (typeof keyPath !== 'string') {\n var rv = [];\n for (var i = 0, l = keyPath.length; i < l; ++i) {\n var val = getByKeyPath(obj, keyPath[i]);\n rv.push(val);\n }\n return rv;\n }\n var period = keyPath.indexOf('.');\n if (period !== -1) {\n var innerObj = obj[keyPath.substr(0, period)];\n return innerObj == null ? undefined : getByKeyPath(innerObj, keyPath.substr(period + 1));\n }\n return undefined;\n }\n function setByKeyPath(obj, keyPath, value) {\n if (!obj || keyPath === undefined) return;\n if ('isFrozen' in Object && Object.isFrozen(obj)) return;\n if (typeof keyPath !== 'string' && 'length' in keyPath) {\n assert(typeof value !== 'string' && 'length' in value);\n for (var i = 0, l = keyPath.length; i < l; ++i) {\n setByKeyPath(obj, keyPath[i], value[i]);\n }\n } else {\n var period = keyPath.indexOf('.');\n if (period !== -1) {\n var currentKeyPath = keyPath.substr(0, period);\n var remainingKeyPath = keyPath.substr(period + 1);\n if (remainingKeyPath === \"\") {\n if (value === undefined) {\n if (isArray(obj) && !isNaN(parseInt(currentKeyPath))) obj.splice(currentKeyPath, 1);else delete obj[currentKeyPath];\n } else obj[currentKeyPath] = value;\n } else {\n var innerObj = obj[currentKeyPath];\n if (!innerObj || !hasOwn(obj, currentKeyPath)) innerObj = obj[currentKeyPath] = {};\n setByKeyPath(innerObj, remainingKeyPath, value);\n }\n } else {\n if (value === undefined) {\n if (isArray(obj) && !isNaN(parseInt(keyPath))) obj.splice(keyPath, 1);else delete obj[keyPath];\n } else obj[keyPath] = value;\n }\n }\n }\n function delByKeyPath(obj, keyPath) {\n if (typeof keyPath === 'string') setByKeyPath(obj, keyPath, undefined);else if ('length' in keyPath) [].map.call(keyPath, function (kp) {\n setByKeyPath(obj, kp, undefined);\n });\n }\n function shallowClone(obj) {\n var rv = {};\n for (var m in obj) {\n if (hasOwn(obj, m)) rv[m] = obj[m];\n }\n return rv;\n }\n var concat = [].concat;\n function flatten(a) {\n return concat.apply([], a);\n }\n var intrinsicTypeNames = \"BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey\".split(',').concat(flatten([8, 16, 32, 64].map(function (num) {\n return [\"Int\", \"Uint\", \"Float\"].map(function (t) {\n return t + num + \"Array\";\n });\n }))).filter(function (t) {\n return _global[t];\n });\n var intrinsicTypes = new Set(intrinsicTypeNames.map(function (t) {\n return _global[t];\n }));\n function cloneSimpleObjectTree(o) {\n var rv = {};\n for (var k in o) if (hasOwn(o, k)) {\n var v = o[k];\n rv[k] = !v || typeof v !== 'object' || intrinsicTypes.has(v.constructor) ? v : cloneSimpleObjectTree(v);\n }\n return rv;\n }\n function objectIsEmpty(o) {\n for (var k in o) if (hasOwn(o, k)) return false;\n return true;\n }\n var circularRefs = null;\n function deepClone(any) {\n circularRefs = new WeakMap();\n var rv = innerDeepClone(any);\n circularRefs = null;\n return rv;\n }\n function innerDeepClone(x) {\n if (!x || typeof x !== 'object') return x;\n var rv = circularRefs.get(x);\n if (rv) return rv;\n if (isArray(x)) {\n rv = [];\n circularRefs.set(x, rv);\n for (var i = 0, l = x.length; i < l; ++i) {\n rv.push(innerDeepClone(x[i]));\n }\n } else if (intrinsicTypes.has(x.constructor)) {\n rv = x;\n } else {\n var proto = getProto(x);\n rv = proto === Object.prototype ? {} : Object.create(proto);\n circularRefs.set(x, rv);\n for (var prop in x) {\n if (hasOwn(x, prop)) {\n rv[prop] = innerDeepClone(x[prop]);\n }\n }\n }\n return rv;\n }\n var toString = {}.toString;\n function toStringTag(o) {\n return toString.call(o).slice(8, -1);\n }\n var iteratorSymbol = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';\n var getIteratorOf = typeof iteratorSymbol === \"symbol\" ? function (x) {\n var i;\n return x != null && (i = x[iteratorSymbol]) && i.apply(x);\n } : function () {\n return null;\n };\n function delArrayItem(a, x) {\n var i = a.indexOf(x);\n if (i >= 0) a.splice(i, 1);\n return i >= 0;\n }\n var NO_CHAR_ARRAY = {};\n function getArrayOf(arrayLike) {\n var i, a, x, it;\n if (arguments.length === 1) {\n if (isArray(arrayLike)) return arrayLike.slice();\n if (this === NO_CHAR_ARRAY && typeof arrayLike === 'string') return [arrayLike];\n if (it = getIteratorOf(arrayLike)) {\n a = [];\n while (x = it.next(), !x.done) a.push(x.value);\n return a;\n }\n if (arrayLike == null) return [arrayLike];\n i = arrayLike.length;\n if (typeof i === 'number') {\n a = new Array(i);\n while (i--) a[i] = arrayLike[i];\n return a;\n }\n return [arrayLike];\n }\n i = arguments.length;\n a = new Array(i);\n while (i--) a[i] = arguments[i];\n return a;\n }\n var isAsyncFunction = typeof Symbol !== 'undefined' ? function (fn) {\n return fn[Symbol.toStringTag] === 'AsyncFunction';\n } : function () {\n return false;\n };\n var dexieErrorNames = ['Modify', 'Bulk', 'OpenFailed', 'VersionChange', 'Schema', 'Upgrade', 'InvalidTable', 'MissingAPI', 'NoSuchDatabase', 'InvalidArgument', 'SubTransaction', 'Unsupported', 'Internal', 'DatabaseClosed', 'PrematureCommit', 'ForeignAwait'];\n var idbDomErrorNames = ['Unknown', 'Constraint', 'Data', 'TransactionInactive', 'ReadOnly', 'Version', 'NotFound', 'InvalidState', 'InvalidAccess', 'Abort', 'Timeout', 'QuotaExceeded', 'Syntax', 'DataClone'];\n var errorList = dexieErrorNames.concat(idbDomErrorNames);\n var defaultTexts = {\n VersionChanged: \"Database version changed by other database connection\",\n DatabaseClosed: \"Database has been closed\",\n Abort: \"Transaction aborted\",\n TransactionInactive: \"Transaction has already completed or failed\",\n MissingAPI: \"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb\"\n };\n function DexieError(name, msg) {\n this.name = name;\n this.message = msg;\n }\n derive(DexieError).from(Error).extend({\n toString: function () {\n return this.name + \": \" + this.message;\n }\n });\n function getMultiErrorMessage(msg, failures) {\n return msg + \". Errors: \" + Object.keys(failures).map(function (key) {\n return failures[key].toString();\n }).filter(function (v, i, s) {\n return s.indexOf(v) === i;\n }).join('\\n');\n }\n function ModifyError(msg, failures, successCount, failedKeys) {\n this.failures = failures;\n this.failedKeys = failedKeys;\n this.successCount = successCount;\n this.message = getMultiErrorMessage(msg, failures);\n }\n derive(ModifyError).from(DexieError);\n function BulkError(msg, failures) {\n this.name = \"BulkError\";\n this.failures = Object.keys(failures).map(function (pos) {\n return failures[pos];\n });\n this.failuresByPos = failures;\n this.message = getMultiErrorMessage(msg, this.failures);\n }\n derive(BulkError).from(DexieError);\n var errnames = errorList.reduce(function (obj, name) {\n return obj[name] = name + \"Error\", obj;\n }, {});\n var BaseException = DexieError;\n var exceptions = errorList.reduce(function (obj, name) {\n var fullName = name + \"Error\";\n function DexieError(msgOrInner, inner) {\n this.name = fullName;\n if (!msgOrInner) {\n this.message = defaultTexts[name] || fullName;\n this.inner = null;\n } else if (typeof msgOrInner === 'string') {\n this.message = \"\".concat(msgOrInner).concat(!inner ? '' : '\\n ' + inner);\n this.inner = inner || null;\n } else if (typeof msgOrInner === 'object') {\n this.message = \"\".concat(msgOrInner.name, \" \").concat(msgOrInner.message);\n this.inner = msgOrInner;\n }\n }\n derive(DexieError).from(BaseException);\n obj[name] = DexieError;\n return obj;\n }, {});\n exceptions.Syntax = SyntaxError;\n exceptions.Type = TypeError;\n exceptions.Range = RangeError;\n var exceptionMap = idbDomErrorNames.reduce(function (obj, name) {\n obj[name + \"Error\"] = exceptions[name];\n return obj;\n }, {});\n function mapError(domError, message) {\n if (!domError || domError instanceof DexieError || domError instanceof TypeError || domError instanceof SyntaxError || !domError.name || !exceptionMap[domError.name]) return domError;\n var rv = new exceptionMap[domError.name](message || domError.message, domError);\n if (\"stack\" in domError) {\n setProp(rv, \"stack\", {\n get: function () {\n return this.inner.stack;\n }\n });\n }\n return rv;\n }\n var fullNameExceptions = errorList.reduce(function (obj, name) {\n if ([\"Syntax\", \"Type\", \"Range\"].indexOf(name) === -1) obj[name + \"Error\"] = exceptions[name];\n return obj;\n }, {});\n fullNameExceptions.ModifyError = ModifyError;\n fullNameExceptions.DexieError = DexieError;\n fullNameExceptions.BulkError = BulkError;\n function nop() {}\n function mirror(val) {\n return val;\n }\n function pureFunctionChain(f1, f2) {\n if (f1 == null || f1 === mirror) return f2;\n return function (val) {\n return f2(f1(val));\n };\n }\n function callBoth(on1, on2) {\n return function () {\n on1.apply(this, arguments);\n on2.apply(this, arguments);\n };\n }\n function hookCreatingChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n var res = f1.apply(this, arguments);\n if (res !== undefined) arguments[0] = res;\n var onsuccess = this.onsuccess,\n onerror = this.onerror;\n this.onsuccess = null;\n this.onerror = null;\n var res2 = f2.apply(this, arguments);\n if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n return res2 !== undefined ? res2 : res;\n };\n }\n function hookDeletingChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n f1.apply(this, arguments);\n var onsuccess = this.onsuccess,\n onerror = this.onerror;\n this.onsuccess = this.onerror = null;\n f2.apply(this, arguments);\n if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n };\n }\n function hookUpdatingChain(f1, f2) {\n if (f1 === nop) return f2;\n return function (modifications) {\n var res = f1.apply(this, arguments);\n extend(modifications, res);\n var onsuccess = this.onsuccess,\n onerror = this.onerror;\n this.onsuccess = null;\n this.onerror = null;\n var res2 = f2.apply(this, arguments);\n if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n return res === undefined ? res2 === undefined ? undefined : res2 : extend(res, res2);\n };\n }\n function reverseStoppableEventChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n if (f2.apply(this, arguments) === false) return false;\n return f1.apply(this, arguments);\n };\n }\n function promisableChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n var res = f1.apply(this, arguments);\n if (res && typeof res.then === 'function') {\n var thiz = this,\n i = arguments.length,\n args = new Array(i);\n while (i--) args[i] = arguments[i];\n return res.then(function () {\n return f2.apply(thiz, args);\n });\n }\n return f2.apply(this, arguments);\n };\n }\n var debug = typeof location !== 'undefined' && /^(http|https):\\/\\/(localhost|127\\.0\\.0\\.1)/.test(location.href);\n function setDebug(value, filter) {\n debug = value;\n }\n var INTERNAL = {};\n var ZONE_ECHO_LIMIT = 100,\n _a$1 = typeof Promise === 'undefined' ? [] : function () {\n var globalP = Promise.resolve();\n if (typeof crypto === 'undefined' || !crypto.subtle) return [globalP, getProto(globalP), globalP];\n var nativeP = crypto.subtle.digest(\"SHA-512\", new Uint8Array([0]));\n return [nativeP, getProto(nativeP), globalP];\n }(),\n resolvedNativePromise = _a$1[0],\n nativePromiseProto = _a$1[1],\n resolvedGlobalPromise = _a$1[2],\n nativePromiseThen = nativePromiseProto && nativePromiseProto.then;\n var NativePromise = resolvedNativePromise && resolvedNativePromise.constructor;\n var patchGlobalPromise = !!resolvedGlobalPromise;\n function schedulePhysicalTick() {\n queueMicrotask(physicalTick);\n }\n var asap = function (callback, args) {\n microtickQueue.push([callback, args]);\n if (needsNewPhysicalTick) {\n schedulePhysicalTick();\n needsNewPhysicalTick = false;\n }\n };\n var isOutsideMicroTick = true,\n needsNewPhysicalTick = true,\n unhandledErrors = [],\n rejectingErrors = [],\n rejectionMapper = mirror;\n var globalPSD = {\n id: 'global',\n global: true,\n ref: 0,\n unhandleds: [],\n onunhandled: nop,\n pgp: false,\n env: {},\n finalize: nop\n };\n var PSD = globalPSD;\n var microtickQueue = [];\n var numScheduledCalls = 0;\n var tickFinalizers = [];\n function DexiePromise(fn) {\n if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new');\n this._listeners = [];\n this._lib = false;\n var psd = this._PSD = PSD;\n if (typeof fn !== 'function') {\n if (fn !== INTERNAL) throw new TypeError('Not a function');\n this._state = arguments[1];\n this._value = arguments[2];\n if (this._state === false) handleRejection(this, this._value);\n return;\n }\n this._state = null;\n this._value = null;\n ++psd.ref;\n executePromiseTask(this, fn);\n }\n var thenProp = {\n get: function () {\n var psd = PSD,\n microTaskId = totalEchoes;\n function then(onFulfilled, onRejected) {\n var _this = this;\n var possibleAwait = !psd.global && (psd !== PSD || microTaskId !== totalEchoes);\n var cleanup = possibleAwait && !decrementExpectedAwaits();\n var rv = new DexiePromise(function (resolve, reject) {\n propagateToListener(_this, new Listener(nativeAwaitCompatibleWrap(onFulfilled, psd, possibleAwait, cleanup), nativeAwaitCompatibleWrap(onRejected, psd, possibleAwait, cleanup), resolve, reject, psd));\n });\n if (this._consoleTask) rv._consoleTask = this._consoleTask;\n return rv;\n }\n then.prototype = INTERNAL;\n return then;\n },\n set: function (value) {\n setProp(this, 'then', value && value.prototype === INTERNAL ? thenProp : {\n get: function () {\n return value;\n },\n set: thenProp.set\n });\n }\n };\n props(DexiePromise.prototype, {\n then: thenProp,\n _then: function (onFulfilled, onRejected) {\n propagateToListener(this, new Listener(null, null, onFulfilled, onRejected, PSD));\n },\n catch: function (onRejected) {\n if (arguments.length === 1) return this.then(null, onRejected);\n var type = arguments[0],\n handler = arguments[1];\n return typeof type === 'function' ? this.then(null, function (err) {\n return err instanceof type ? handler(err) : PromiseReject(err);\n }) : this.then(null, function (err) {\n return err && err.name === type ? handler(err) : PromiseReject(err);\n });\n },\n finally: function (onFinally) {\n return this.then(function (value) {\n return DexiePromise.resolve(onFinally()).then(function () {\n return value;\n });\n }, function (err) {\n return DexiePromise.resolve(onFinally()).then(function () {\n return PromiseReject(err);\n });\n });\n },\n timeout: function (ms, msg) {\n var _this = this;\n return ms < Infinity ? new DexiePromise(function (resolve, reject) {\n var handle = setTimeout(function () {\n return reject(new exceptions.Timeout(msg));\n }, ms);\n _this.then(resolve, reject).finally(clearTimeout.bind(null, handle));\n }) : this;\n }\n });\n if (typeof Symbol !== 'undefined' && Symbol.toStringTag) setProp(DexiePromise.prototype, Symbol.toStringTag, 'Dexie.Promise');\n globalPSD.env = snapShot();\n function Listener(onFulfilled, onRejected, resolve, reject, zone) {\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.resolve = resolve;\n this.reject = reject;\n this.psd = zone;\n }\n props(DexiePromise, {\n all: function () {\n var values = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);\n return new DexiePromise(function (resolve, reject) {\n if (values.length === 0) resolve([]);\n var remaining = values.length;\n values.forEach(function (a, i) {\n return DexiePromise.resolve(a).then(function (x) {\n values[i] = x;\n if (! --remaining) resolve(values);\n }, reject);\n });\n });\n },\n resolve: function (value) {\n if (value instanceof DexiePromise) return value;\n if (value && typeof value.then === 'function') return new DexiePromise(function (resolve, reject) {\n value.then(resolve, reject);\n });\n var rv = new DexiePromise(INTERNAL, true, value);\n return rv;\n },\n reject: PromiseReject,\n race: function () {\n var values = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);\n return new DexiePromise(function (resolve, reject) {\n values.map(function (value) {\n return DexiePromise.resolve(value).then(resolve, reject);\n });\n });\n },\n PSD: {\n get: function () {\n return PSD;\n },\n set: function (value) {\n return PSD = value;\n }\n },\n totalEchoes: {\n get: function () {\n return totalEchoes;\n }\n },\n newPSD: newScope,\n usePSD: usePSD,\n scheduler: {\n get: function () {\n return asap;\n },\n set: function (value) {\n asap = value;\n }\n },\n rejectionMapper: {\n get: function () {\n return rejectionMapper;\n },\n set: function (value) {\n rejectionMapper = value;\n }\n },\n follow: function (fn, zoneProps) {\n return new DexiePromise(function (resolve, reject) {\n return newScope(function (resolve, reject) {\n var psd = PSD;\n psd.unhandleds = [];\n psd.onunhandled = reject;\n psd.finalize = callBoth(function () {\n var _this = this;\n run_at_end_of_this_or_next_physical_tick(function () {\n _this.unhandleds.length === 0 ? resolve() : reject(_this.unhandleds[0]);\n });\n }, psd.finalize);\n fn();\n }, zoneProps, resolve, reject);\n });\n }\n });\n if (NativePromise) {\n if (NativePromise.allSettled) setProp(DexiePromise, \"allSettled\", function () {\n var possiblePromises = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);\n return new DexiePromise(function (resolve) {\n if (possiblePromises.length === 0) resolve([]);\n var remaining = possiblePromises.length;\n var results = new Array(remaining);\n possiblePromises.forEach(function (p, i) {\n return DexiePromise.resolve(p).then(function (value) {\n return results[i] = {\n status: \"fulfilled\",\n value: value\n };\n }, function (reason) {\n return results[i] = {\n status: \"rejected\",\n reason: reason\n };\n }).then(function () {\n return --remaining || resolve(results);\n });\n });\n });\n });\n if (NativePromise.any && typeof AggregateError !== 'undefined') setProp(DexiePromise, \"any\", function () {\n var possiblePromises = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);\n return new DexiePromise(function (resolve, reject) {\n if (possiblePromises.length === 0) reject(new AggregateError([]));\n var remaining = possiblePromises.length;\n var failures = new Array(remaining);\n possiblePromises.forEach(function (p, i) {\n return DexiePromise.resolve(p).then(function (value) {\n return resolve(value);\n }, function (failure) {\n failures[i] = failure;\n if (! --remaining) reject(new AggregateError(failures));\n });\n });\n });\n });\n if (NativePromise.withResolvers) DexiePromise.withResolvers = NativePromise.withResolvers;\n }\n function executePromiseTask(promise, fn) {\n try {\n fn(function (value) {\n if (promise._state !== null) return;\n if (value === promise) throw new TypeError('A promise cannot be resolved with itself.');\n var shouldExecuteTick = promise._lib && beginMicroTickScope();\n if (value && typeof value.then === 'function') {\n executePromiseTask(promise, function (resolve, reject) {\n value instanceof DexiePromise ? value._then(resolve, reject) : value.then(resolve, reject);\n });\n } else {\n promise._state = true;\n promise._value = value;\n propagateAllListeners(promise);\n }\n if (shouldExecuteTick) endMicroTickScope();\n }, handleRejection.bind(null, promise));\n } catch (ex) {\n handleRejection(promise, ex);\n }\n }\n function handleRejection(promise, reason) {\n rejectingErrors.push(reason);\n if (promise._state !== null) return;\n var shouldExecuteTick = promise._lib && beginMicroTickScope();\n reason = rejectionMapper(reason);\n promise._state = false;\n promise._value = reason;\n addPossiblyUnhandledError(promise);\n propagateAllListeners(promise);\n if (shouldExecuteTick) endMicroTickScope();\n }\n function propagateAllListeners(promise) {\n var listeners = promise._listeners;\n promise._listeners = [];\n for (var i = 0, len = listeners.length; i < len; ++i) {\n propagateToListener(promise, listeners[i]);\n }\n var psd = promise._PSD;\n --psd.ref || psd.finalize();\n if (numScheduledCalls === 0) {\n ++numScheduledCalls;\n asap(function () {\n if (--numScheduledCalls === 0) finalizePhysicalTick();\n }, []);\n }\n }\n function propagateToListener(promise, listener) {\n if (promise._state === null) {\n promise._listeners.push(listener);\n return;\n }\n var cb = promise._state ? listener.onFulfilled : listener.onRejected;\n if (cb === null) {\n return (promise._state ? listener.resolve : listener.reject)(promise._value);\n }\n ++listener.psd.ref;\n ++numScheduledCalls;\n asap(callListener, [cb, promise, listener]);\n }\n function callListener(cb, promise, listener) {\n try {\n var ret,\n value = promise._value;\n if (!promise._state && rejectingErrors.length) rejectingErrors = [];\n ret = debug && promise._consoleTask ? promise._consoleTask.run(function () {\n return cb(value);\n }) : cb(value);\n if (!promise._state && rejectingErrors.indexOf(value) === -1) {\n markErrorAsHandled(promise);\n }\n listener.resolve(ret);\n } catch (e) {\n listener.reject(e);\n } finally {\n if (--numScheduledCalls === 0) finalizePhysicalTick();\n --listener.psd.ref || listener.psd.finalize();\n }\n }\n function physicalTick() {\n usePSD(globalPSD, function () {\n beginMicroTickScope() && endMicroTickScope();\n });\n }\n function beginMicroTickScope() {\n var wasRootExec = isOutsideMicroTick;\n isOutsideMicroTick = false;\n needsNewPhysicalTick = false;\n return wasRootExec;\n }\n function endMicroTickScope() {\n var callbacks, i, l;\n do {\n while (microtickQueue.length > 0) {\n callbacks = microtickQueue;\n microtickQueue = [];\n l = callbacks.length;\n for (i = 0; i < l; ++i) {\n var item = callbacks[i];\n item[0].apply(null, item[1]);\n }\n }\n } while (microtickQueue.length > 0);\n isOutsideMicroTick = true;\n needsNewPhysicalTick = true;\n }\n function finalizePhysicalTick() {\n var unhandledErrs = unhandledErrors;\n unhandledErrors = [];\n unhandledErrs.forEach(function (p) {\n p._PSD.onunhandled.call(null, p._value, p);\n });\n var finalizers = tickFinalizers.slice(0);\n var i = finalizers.length;\n while (i) finalizers[--i]();\n }\n function run_at_end_of_this_or_next_physical_tick(fn) {\n function finalizer() {\n fn();\n tickFinalizers.splice(tickFinalizers.indexOf(finalizer), 1);\n }\n tickFinalizers.push(finalizer);\n ++numScheduledCalls;\n asap(function () {\n if (--numScheduledCalls === 0) finalizePhysicalTick();\n }, []);\n }\n function addPossiblyUnhandledError(promise) {\n if (!unhandledErrors.some(function (p) {\n return p._value === promise._value;\n })) unhandledErrors.push(promise);\n }\n function markErrorAsHandled(promise) {\n var i = unhandledErrors.length;\n while (i) if (unhandledErrors[--i]._value === promise._value) {\n unhandledErrors.splice(i, 1);\n return;\n }\n }\n function PromiseReject(reason) {\n return new DexiePromise(INTERNAL, false, reason);\n }\n function wrap(fn, errorCatcher) {\n var psd = PSD;\n return function () {\n var wasRootExec = beginMicroTickScope(),\n outerScope = PSD;\n try {\n switchToZone(psd, true);\n return fn.apply(this, arguments);\n } catch (e) {\n errorCatcher && errorCatcher(e);\n } finally {\n switchToZone(outerScope, false);\n if (wasRootExec) endMicroTickScope();\n }\n };\n }\n var task = {\n awaits: 0,\n echoes: 0,\n id: 0\n };\n var taskCounter = 0;\n var zoneStack = [];\n var zoneEchoes = 0;\n var totalEchoes = 0;\n var zone_id_counter = 0;\n function newScope(fn, props, a1, a2) {\n var parent = PSD,\n psd = Object.create(parent);\n psd.parent = parent;\n psd.ref = 0;\n psd.global = false;\n psd.id = ++zone_id_counter;\n globalPSD.env;\n psd.env = patchGlobalPromise ? {\n Promise: DexiePromise,\n PromiseProp: {\n value: DexiePromise,\n configurable: true,\n writable: true\n },\n all: DexiePromise.all,\n race: DexiePromise.race,\n allSettled: DexiePromise.allSettled,\n any: DexiePromise.any,\n resolve: DexiePromise.resolve,\n reject: DexiePromise.reject\n } : {};\n if (props) extend(psd, props);\n ++parent.ref;\n psd.finalize = function () {\n --this.parent.ref || this.parent.finalize();\n };\n var rv = usePSD(psd, fn, a1, a2);\n if (psd.ref === 0) psd.finalize();\n return rv;\n }\n function incrementExpectedAwaits() {\n if (!task.id) task.id = ++taskCounter;\n ++task.awaits;\n task.echoes += ZONE_ECHO_LIMIT;\n return task.id;\n }\n function decrementExpectedAwaits() {\n if (!task.awaits) return false;\n if (--task.awaits === 0) task.id = 0;\n task.echoes = task.awaits * ZONE_ECHO_LIMIT;\n return true;\n }\n if (('' + nativePromiseThen).indexOf('[native code]') === -1) {\n incrementExpectedAwaits = decrementExpectedAwaits = nop;\n }\n function onPossibleParallellAsync(possiblePromise) {\n if (task.echoes && possiblePromise && possiblePromise.constructor === NativePromise) {\n incrementExpectedAwaits();\n return possiblePromise.then(function (x) {\n decrementExpectedAwaits();\n return x;\n }, function (e) {\n decrementExpectedAwaits();\n return rejection(e);\n });\n }\n return possiblePromise;\n }\n function zoneEnterEcho(targetZone) {\n ++totalEchoes;\n if (!task.echoes || --task.echoes === 0) {\n task.echoes = task.awaits = task.id = 0;\n }\n zoneStack.push(PSD);\n switchToZone(targetZone, true);\n }\n function zoneLeaveEcho() {\n var zone = zoneStack[zoneStack.length - 1];\n zoneStack.pop();\n switchToZone(zone, false);\n }\n function switchToZone(targetZone, bEnteringZone) {\n var currentZone = PSD;\n if (bEnteringZone ? task.echoes && (!zoneEchoes++ || targetZone !== PSD) : zoneEchoes && (! --zoneEchoes || targetZone !== PSD)) {\n queueMicrotask(bEnteringZone ? zoneEnterEcho.bind(null, targetZone) : zoneLeaveEcho);\n }\n if (targetZone === PSD) return;\n PSD = targetZone;\n if (currentZone === globalPSD) globalPSD.env = snapShot();\n if (patchGlobalPromise) {\n var GlobalPromise = globalPSD.env.Promise;\n var targetEnv = targetZone.env;\n if (currentZone.global || targetZone.global) {\n Object.defineProperty(_global, 'Promise', targetEnv.PromiseProp);\n GlobalPromise.all = targetEnv.all;\n GlobalPromise.race = targetEnv.race;\n GlobalPromise.resolve = targetEnv.resolve;\n GlobalPromise.reject = targetEnv.reject;\n if (targetEnv.allSettled) GlobalPromise.allSettled = targetEnv.allSettled;\n if (targetEnv.any) GlobalPromise.any = targetEnv.any;\n }\n }\n }\n function snapShot() {\n var GlobalPromise = _global.Promise;\n return patchGlobalPromise ? {\n Promise: GlobalPromise,\n PromiseProp: Object.getOwnPropertyDescriptor(_global, \"Promise\"),\n all: GlobalPromise.all,\n race: GlobalPromise.race,\n allSettled: GlobalPromise.allSettled,\n any: GlobalPromise.any,\n resolve: GlobalPromise.resolve,\n reject: GlobalPromise.reject\n } : {};\n }\n function usePSD(psd, fn, a1, a2, a3) {\n var outerScope = PSD;\n try {\n switchToZone(psd, true);\n return fn(a1, a2, a3);\n } finally {\n switchToZone(outerScope, false);\n }\n }\n function nativeAwaitCompatibleWrap(fn, zone, possibleAwait, cleanup) {\n return typeof fn !== 'function' ? fn : function () {\n var outerZone = PSD;\n if (possibleAwait) incrementExpectedAwaits();\n switchToZone(zone, true);\n try {\n return fn.apply(this, arguments);\n } finally {\n switchToZone(outerZone, false);\n if (cleanup) queueMicrotask(decrementExpectedAwaits);\n }\n };\n }\n function execInGlobalContext(cb) {\n if (Promise === NativePromise && task.echoes === 0) {\n if (zoneEchoes === 0) {\n cb();\n } else {\n enqueueNativeMicroTask(cb);\n }\n } else {\n setTimeout(cb, 0);\n }\n }\n var rejection = DexiePromise.reject;\n function tempTransaction(db, mode, storeNames, fn) {\n if (!db.idbdb || !db._state.openComplete && !PSD.letThrough && !db._vip) {\n if (db._state.openComplete) {\n return rejection(new exceptions.DatabaseClosed(db._state.dbOpenError));\n }\n if (!db._state.isBeingOpened) {\n if (!db._state.autoOpen) return rejection(new exceptions.DatabaseClosed());\n db.open().catch(nop);\n }\n return db._state.dbReadyPromise.then(function () {\n return tempTransaction(db, mode, storeNames, fn);\n });\n } else {\n var trans = db._createTransaction(mode, storeNames, db._dbSchema);\n try {\n trans.create();\n db._state.PR1398_maxLoop = 3;\n } catch (ex) {\n if (ex.name === errnames.InvalidState && db.isOpen() && --db._state.PR1398_maxLoop > 0) {\n console.warn('Dexie: Need to reopen db');\n db.close({\n disableAutoOpen: false\n });\n return db.open().then(function () {\n return tempTransaction(db, mode, storeNames, fn);\n });\n }\n return rejection(ex);\n }\n return trans._promise(mode, function (resolve, reject) {\n return newScope(function () {\n PSD.trans = trans;\n return fn(resolve, reject, trans);\n });\n }).then(function (result) {\n if (mode === 'readwrite') try {\n trans.idbtrans.commit();\n } catch (_a) {}\n return mode === 'readonly' ? result : trans._completion.then(function () {\n return result;\n });\n });\n }\n }\n var DEXIE_VERSION = '4.0.10';\n var maxString = String.fromCharCode(65535);\n var minKey = -Infinity;\n var INVALID_KEY_ARGUMENT = \"Invalid key provided. Keys must be of type string, number, Date or Array.\";\n var STRING_EXPECTED = \"String expected.\";\n var connections = [];\n var DBNAMES_DB = '__dbnames';\n var READONLY = 'readonly';\n var READWRITE = 'readwrite';\n function combine(filter1, filter2) {\n return filter1 ? filter2 ? function () {\n return filter1.apply(this, arguments) && filter2.apply(this, arguments);\n } : filter1 : filter2;\n }\n var AnyRange = {\n type: 3,\n lower: -Infinity,\n lowerOpen: false,\n upper: [[]],\n upperOpen: false\n };\n function workaroundForUndefinedPrimKey(keyPath) {\n return typeof keyPath === \"string\" && !/\\./.test(keyPath) ? function (obj) {\n if (obj[keyPath] === undefined && keyPath in obj) {\n obj = deepClone(obj);\n delete obj[keyPath];\n }\n return obj;\n } : function (obj) {\n return obj;\n };\n }\n function Entity() {\n throw exceptions.Type();\n }\n function cmp(a, b) {\n try {\n var ta = type(a);\n var tb = type(b);\n if (ta !== tb) {\n if (ta === 'Array') return 1;\n if (tb === 'Array') return -1;\n if (ta === 'binary') return 1;\n if (tb === 'binary') return -1;\n if (ta === 'string') return 1;\n if (tb === 'string') return -1;\n if (ta === 'Date') return 1;\n if (tb !== 'Date') return NaN;\n return -1;\n }\n switch (ta) {\n case 'number':\n case 'Date':\n case 'string':\n return a > b ? 1 : a < b ? -1 : 0;\n case 'binary':\n {\n return compareUint8Arrays(getUint8Array(a), getUint8Array(b));\n }\n case 'Array':\n return compareArrays(a, b);\n }\n } catch (_a) {}\n return NaN;\n }\n function compareArrays(a, b) {\n var al = a.length;\n var bl = b.length;\n var l = al < bl ? al : bl;\n for (var i = 0; i < l; ++i) {\n var res = cmp(a[i], b[i]);\n if (res !== 0) return res;\n }\n return al === bl ? 0 : al < bl ? -1 : 1;\n }\n function compareUint8Arrays(a, b) {\n var al = a.length;\n var bl = b.length;\n var l = al < bl ? al : bl;\n for (var i = 0; i < l; ++i) {\n if (a[i] !== b[i]) return a[i] < b[i] ? -1 : 1;\n }\n return al === bl ? 0 : al < bl ? -1 : 1;\n }\n function type(x) {\n var t = typeof x;\n if (t !== 'object') return t;\n if (ArrayBuffer.isView(x)) return 'binary';\n var tsTag = toStringTag(x);\n return tsTag === 'ArrayBuffer' ? 'binary' : tsTag;\n }\n function getUint8Array(a) {\n if (a instanceof Uint8Array) return a;\n if (ArrayBuffer.isView(a)) return new Uint8Array(a.buffer, a.byteOffset, a.byteLength);\n return new Uint8Array(a);\n }\n var Table = function () {\n function Table() {}\n Table.prototype._trans = function (mode, fn, writeLocked) {\n var trans = this._tx || PSD.trans;\n var tableName = this.name;\n var task = debug && typeof console !== 'undefined' && console.createTask && console.createTask(\"Dexie: \".concat(mode === 'readonly' ? 'read' : 'write', \" \").concat(this.name));\n function checkTableInTransaction(resolve, reject, trans) {\n if (!trans.schema[tableName]) throw new exceptions.NotFound(\"Table \" + tableName + \" not part of transaction\");\n return fn(trans.idbtrans, trans);\n }\n var wasRootExec = beginMicroTickScope();\n try {\n var p = trans && trans.db._novip === this.db._novip ? trans === PSD.trans ? trans._promise(mode, checkTableInTransaction, writeLocked) : newScope(function () {\n return trans._promise(mode, checkTableInTransaction, writeLocked);\n }, {\n trans: trans,\n transless: PSD.transless || PSD\n }) : tempTransaction(this.db, mode, [this.name], checkTableInTransaction);\n if (task) {\n p._consoleTask = task;\n p = p.catch(function (err) {\n console.trace(err);\n return rejection(err);\n });\n }\n return p;\n } finally {\n if (wasRootExec) endMicroTickScope();\n }\n };\n Table.prototype.get = function (keyOrCrit, cb) {\n var _this = this;\n if (keyOrCrit && keyOrCrit.constructor === Object) return this.where(keyOrCrit).first(cb);\n if (keyOrCrit == null) return rejection(new exceptions.Type(\"Invalid argument to Table.get()\"));\n return this._trans('readonly', function (trans) {\n return _this.core.get({\n trans: trans,\n key: keyOrCrit\n }).then(function (res) {\n return _this.hook.reading.fire(res);\n });\n }).then(cb);\n };\n Table.prototype.where = function (indexOrCrit) {\n if (typeof indexOrCrit === 'string') return new this.db.WhereClause(this, indexOrCrit);\n if (isArray(indexOrCrit)) return new this.db.WhereClause(this, \"[\".concat(indexOrCrit.join('+'), \"]\"));\n var keyPaths = keys(indexOrCrit);\n if (keyPaths.length === 1) return this.where(keyPaths[0]).equals(indexOrCrit[keyPaths[0]]);\n var compoundIndex = this.schema.indexes.concat(this.schema.primKey).filter(function (ix) {\n if (ix.compound && keyPaths.every(function (keyPath) {\n return ix.keyPath.indexOf(keyPath) >= 0;\n })) {\n for (var i = 0; i < keyPaths.length; ++i) {\n if (keyPaths.indexOf(ix.keyPath[i]) === -1) return false;\n }\n return true;\n }\n return false;\n }).sort(function (a, b) {\n return a.keyPath.length - b.keyPath.length;\n })[0];\n if (compoundIndex && this.db._maxKey !== maxString) {\n var keyPathsInValidOrder = compoundIndex.keyPath.slice(0, keyPaths.length);\n return this.where(keyPathsInValidOrder).equals(keyPathsInValidOrder.map(function (kp) {\n return indexOrCrit[kp];\n }));\n }\n if (!compoundIndex && debug) console.warn(\"The query \".concat(JSON.stringify(indexOrCrit), \" on \").concat(this.name, \" would benefit from a \") + \"compound index [\".concat(keyPaths.join('+'), \"]\"));\n var idxByName = this.schema.idxByName;\n function equals(a, b) {\n return cmp(a, b) === 0;\n }\n var _a = keyPaths.reduce(function (_a, keyPath) {\n var prevIndex = _a[0],\n prevFilterFn = _a[1];\n var index = idxByName[keyPath];\n var value = indexOrCrit[keyPath];\n return [prevIndex || index, prevIndex || !index ? combine(prevFilterFn, index && index.multi ? function (x) {\n var prop = getByKeyPath(x, keyPath);\n return isArray(prop) && prop.some(function (item) {\n return equals(value, item);\n });\n } : function (x) {\n return equals(value, getByKeyPath(x, keyPath));\n }) : prevFilterFn];\n }, [null, null]),\n idx = _a[0],\n filterFunction = _a[1];\n return idx ? this.where(idx.name).equals(indexOrCrit[idx.keyPath]).filter(filterFunction) : compoundIndex ? this.filter(filterFunction) : this.where(keyPaths).equals('');\n };\n Table.prototype.filter = function (filterFunction) {\n return this.toCollection().and(filterFunction);\n };\n Table.prototype.count = function (thenShortcut) {\n return this.toCollection().count(thenShortcut);\n };\n Table.prototype.offset = function (offset) {\n return this.toCollection().offset(offset);\n };\n Table.prototype.limit = function (numRows) {\n return this.toCollection().limit(numRows);\n };\n Table.prototype.each = function (callback) {\n return this.toCollection().each(callback);\n };\n Table.prototype.toArray = function (thenShortcut) {\n return this.toCollection().toArray(thenShortcut);\n };\n Table.prototype.toCollection = function () {\n return new this.db.Collection(new this.db.WhereClause(this));\n };\n Table.prototype.orderBy = function (index) {\n return new this.db.Collection(new this.db.WhereClause(this, isArray(index) ? \"[\".concat(index.join('+'), \"]\") : index));\n };\n Table.prototype.reverse = function () {\n return this.toCollection().reverse();\n };\n Table.prototype.mapToClass = function (constructor) {\n var _a = this,\n db = _a.db,\n tableName = _a.name;\n this.schema.mappedClass = constructor;\n if (constructor.prototype instanceof Entity) {\n constructor = function (_super) {\n __extends(class_1, _super);\n function class_1() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Object.defineProperty(class_1.prototype, \"db\", {\n get: function () {\n return db;\n },\n enumerable: false,\n configurable: true\n });\n class_1.prototype.table = function () {\n return tableName;\n };\n return class_1;\n }(constructor);\n }\n var inheritedProps = new Set();\n for (var proto = constructor.prototype; proto; proto = getProto(proto)) {\n Object.getOwnPropertyNames(proto).forEach(function (propName) {\n return inheritedProps.add(propName);\n });\n }\n var readHook = function (obj) {\n if (!obj) return obj;\n var res = Object.create(constructor.prototype);\n for (var m in obj) if (!inheritedProps.has(m)) try {\n res[m] = obj[m];\n } catch (_) {}\n return res;\n };\n if (this.schema.readHook) {\n this.hook.reading.unsubscribe(this.schema.readHook);\n }\n this.schema.readHook = readHook;\n this.hook(\"reading\", readHook);\n return constructor;\n };\n Table.prototype.defineClass = function () {\n function Class(content) {\n extend(this, content);\n }\n return this.mapToClass(Class);\n };\n Table.prototype.add = function (obj, key) {\n var _this = this;\n var _a = this.schema.primKey,\n auto = _a.auto,\n keyPath = _a.keyPath;\n var objToAdd = obj;\n if (keyPath && auto) {\n objToAdd = workaroundForUndefinedPrimKey(keyPath)(obj);\n }\n return this._trans('readwrite', function (trans) {\n return _this.core.mutate({\n trans: trans,\n type: 'add',\n keys: key != null ? [key] : null,\n values: [objToAdd]\n });\n }).then(function (res) {\n return res.numFailures ? DexiePromise.reject(res.failures[0]) : res.lastResult;\n }).then(function (lastResult) {\n if (keyPath) {\n try {\n setByKeyPath(obj, keyPath, lastResult);\n } catch (_) {}\n }\n return lastResult;\n });\n };\n Table.prototype.update = function (keyOrObject, modifications) {\n if (typeof keyOrObject === 'object' && !isArray(keyOrObject)) {\n var key = getByKeyPath(keyOrObject, this.schema.primKey.keyPath);\n if (key === undefined) return rejection(new exceptions.InvalidArgument(\"Given object does not contain its primary key\"));\n return this.where(\":id\").equals(key).modify(modifications);\n } else {\n return this.where(\":id\").equals(keyOrObject).modify(modifications);\n }\n };\n Table.prototype.put = function (obj, key) {\n var _this = this;\n var _a = this.schema.primKey,\n auto = _a.auto,\n keyPath = _a.keyPath;\n var objToAdd = obj;\n if (keyPath && auto) {\n objToAdd = workaroundForUndefinedPrimKey(keyPath)(obj);\n }\n return this._trans('readwrite', function (trans) {\n return _this.core.mutate({\n trans: trans,\n type: 'put',\n values: [objToAdd],\n keys: key != null ? [key] : null\n });\n }).then(function (res) {\n return res.numFailures ? DexiePromise.reject(res.failures[0]) : res.lastResult;\n }).then(function (lastResult) {\n if (keyPath) {\n try {\n setByKeyPath(obj, keyPath, lastResult);\n } catch (_) {}\n }\n return lastResult;\n });\n };\n Table.prototype.delete = function (key) {\n var _this = this;\n return this._trans('readwrite', function (trans) {\n return _this.core.mutate({\n trans: trans,\n type: 'delete',\n keys: [key]\n });\n }).then(function (res) {\n return res.numFailures ? DexiePromise.reject(res.failures[0]) : undefined;\n });\n };\n Table.prototype.clear = function () {\n var _this = this;\n return this._trans('readwrite', function (trans) {\n return _this.core.mutate({\n trans: trans,\n type: 'deleteRange',\n range: AnyRange\n });\n }).then(function (res) {\n return res.numFailures ? DexiePromise.reject(res.failures[0]) : undefined;\n });\n };\n Table.prototype.bulkGet = function (keys) {\n var _this = this;\n return this._trans('readonly', function (trans) {\n return _this.core.getMany({\n keys: keys,\n trans: trans\n }).then(function (result) {\n return result.map(function (res) {\n return _this.hook.reading.fire(res);\n });\n });\n });\n };\n Table.prototype.bulkAdd = function (objects, keysOrOptions, options) {\n var _this = this;\n var keys = Array.isArray(keysOrOptions) ? keysOrOptions : undefined;\n options = options || (keys ? undefined : keysOrOptions);\n var wantResults = options ? options.allKeys : undefined;\n return this._trans('readwrite', function (trans) {\n var _a = _this.schema.primKey,\n auto = _a.auto,\n keyPath = _a.keyPath;\n if (keyPath && keys) throw new exceptions.InvalidArgument(\"bulkAdd(): keys argument invalid on tables with inbound keys\");\n if (keys && keys.length !== objects.length) throw new exceptions.InvalidArgument(\"Arguments objects and keys must have the same length\");\n var numObjects = objects.length;\n var objectsToAdd = keyPath && auto ? objects.map(workaroundForUndefinedPrimKey(keyPath)) : objects;\n return _this.core.mutate({\n trans: trans,\n type: 'add',\n keys: keys,\n values: objectsToAdd,\n wantResults: wantResults\n }).then(function (_a) {\n var numFailures = _a.numFailures,\n results = _a.results,\n lastResult = _a.lastResult,\n failures = _a.failures;\n var result = wantResults ? results : lastResult;\n if (numFailures === 0) return result;\n throw new BulkError(\"\".concat(_this.name, \".bulkAdd(): \").concat(numFailures, \" of \").concat(numObjects, \" operations failed\"), failures);\n });\n });\n };\n Table.prototype.bulkPut = function (objects, keysOrOptions, options) {\n var _this = this;\n var keys = Array.isArray(keysOrOptions) ? keysOrOptions : undefined;\n options = options || (keys ? undefined : keysOrOptions);\n var wantResults = options ? options.allKeys : undefined;\n return this._trans('readwrite', function (trans) {\n var _a = _this.schema.primKey,\n auto = _a.auto,\n keyPath = _a.keyPath;\n if (keyPath && keys) throw new exceptions.InvalidArgument(\"bulkPut(): keys argument invalid on tables with inbound keys\");\n if (keys && keys.length !== objects.length) throw new exceptions.InvalidArgument(\"Arguments objects and keys must have the same length\");\n var numObjects = objects.length;\n var objectsToPut = keyPath && auto ? objects.map(workaroundForUndefinedPrimKey(keyPath)) : objects;\n return _this.core.mutate({\n trans: trans,\n type: 'put',\n keys: keys,\n values: objectsToPut,\n wantResults: wantResults\n }).then(function (_a) {\n var numFailures = _a.numFailures,\n results = _a.results,\n lastResult = _a.lastResult,\n failures = _a.failures;\n var result = wantResults ? results : lastResult;\n if (numFailures === 0) return result;\n throw new BulkError(\"\".concat(_this.name, \".bulkPut(): \").concat(numFailures, \" of \").concat(numObjects, \" operations failed\"), failures);\n });\n });\n };\n Table.prototype.bulkUpdate = function (keysAndChanges) {\n var _this = this;\n var coreTable = this.core;\n var keys = keysAndChanges.map(function (entry) {\n return entry.key;\n });\n var changeSpecs = keysAndChanges.map(function (entry) {\n return entry.changes;\n });\n var offsetMap = [];\n return this._trans('readwrite', function (trans) {\n return coreTable.getMany({\n trans: trans,\n keys: keys,\n cache: 'clone'\n }).then(function (objs) {\n var resultKeys = [];\n var resultObjs = [];\n keysAndChanges.forEach(function (_a, idx) {\n var key = _a.key,\n changes = _a.changes;\n var obj = objs[idx];\n if (obj) {\n for (var _i = 0, _b = Object.keys(changes); _i < _b.length; _i++) {\n var keyPath = _b[_i];\n var value = changes[keyPath];\n if (keyPath === _this.schema.primKey.keyPath) {\n if (cmp(value, key) !== 0) {\n throw new exceptions.Constraint(\"Cannot update primary key in bulkUpdate()\");\n }\n } else {\n setByKeyPath(obj, keyPath, value);\n }\n }\n offsetMap.push(idx);\n resultKeys.push(key);\n resultObjs.push(obj);\n }\n });\n var numEntries = resultKeys.length;\n return coreTable.mutate({\n trans: trans,\n type: 'put',\n keys: resultKeys,\n values: resultObjs,\n updates: {\n keys: keys,\n changeSpecs: changeSpecs\n }\n }).then(function (_a) {\n var numFailures = _a.numFailures,\n failures = _a.failures;\n if (numFailures === 0) return numEntries;\n for (var _i = 0, _b = Object.keys(failures); _i < _b.length; _i++) {\n var offset = _b[_i];\n var mappedOffset = offsetMap[Number(offset)];\n if (mappedOffset != null) {\n var failure = failures[offset];\n delete failures[offset];\n failures[mappedOffset] = failure;\n }\n }\n throw new BulkError(\"\".concat(_this.name, \".bulkUpdate(): \").concat(numFailures, \" of \").concat(numEntries, \" operations failed\"), failures);\n });\n });\n });\n };\n Table.prototype.bulkDelete = function (keys) {\n var _this = this;\n var numKeys = keys.length;\n return this._trans('readwrite', function (trans) {\n return _this.core.mutate({\n trans: trans,\n type: 'delete',\n keys: keys\n });\n }).then(function (_a) {\n var numFailures = _a.numFailures,\n lastResult = _a.lastResult,\n failures = _a.failures;\n if (numFailures === 0) return lastResult;\n throw new BulkError(\"\".concat(_this.name, \".bulkDelete(): \").concat(numFailures, \" of \").concat(numKeys, \" operations failed\"), failures);\n });\n };\n return Table;\n }();\n function Events(ctx) {\n var evs = {};\n var rv = function (eventName, subscriber) {\n if (subscriber) {\n var i = arguments.length,\n args = new Array(i - 1);\n while (--i) args[i - 1] = arguments[i];\n evs[eventName].subscribe.apply(null, args);\n return ctx;\n } else if (typeof eventName === 'string') {\n return evs[eventName];\n }\n };\n rv.addEventType = add;\n for (var i = 1, l = arguments.length; i < l; ++i) {\n add(arguments[i]);\n }\n return rv;\n function add(eventName, chainFunction, defaultFunction) {\n if (typeof eventName === 'object') return addConfiguredEvents(eventName);\n if (!chainFunction) chainFunction = reverseStoppableEventChain;\n if (!defaultFunction) defaultFunction = nop;\n var context = {\n subscribers: [],\n fire: defaultFunction,\n subscribe: function (cb) {\n if (context.subscribers.indexOf(cb) === -1) {\n context.subscribers.push(cb);\n context.fire = chainFunction(context.fire, cb);\n }\n },\n unsubscribe: function (cb) {\n context.subscribers = context.subscribers.filter(function (fn) {\n return fn !== cb;\n });\n context.fire = context.subscribers.reduce(chainFunction, defaultFunction);\n }\n };\n evs[eventName] = rv[eventName] = context;\n return context;\n }\n function addConfiguredEvents(cfg) {\n keys(cfg).forEach(function (eventName) {\n var args = cfg[eventName];\n if (isArray(args)) {\n add(eventName, cfg[eventName][0], cfg[eventName][1]);\n } else if (args === 'asap') {\n var context = add(eventName, mirror, function fire() {\n var i = arguments.length,\n args = new Array(i);\n while (i--) args[i] = arguments[i];\n context.subscribers.forEach(function (fn) {\n asap$1(function fireEvent() {\n fn.apply(null, args);\n });\n });\n });\n } else throw new exceptions.InvalidArgument(\"Invalid event config\");\n });\n }\n }\n function makeClassConstructor(prototype, constructor) {\n derive(constructor).from({\n prototype: prototype\n });\n return constructor;\n }\n function createTableConstructor(db) {\n return makeClassConstructor(Table.prototype, function Table(name, tableSchema, trans) {\n this.db = db;\n this._tx = trans;\n this.name = name;\n this.schema = tableSchema;\n this.hook = db._allTables[name] ? db._allTables[name].hook : Events(null, {\n \"creating\": [hookCreatingChain, nop],\n \"reading\": [pureFunctionChain, mirror],\n \"updating\": [hookUpdatingChain, nop],\n \"deleting\": [hookDeletingChain, nop]\n });\n });\n }\n function isPlainKeyRange(ctx, ignoreLimitFilter) {\n return !(ctx.filter || ctx.algorithm || ctx.or) && (ignoreLimitFilter ? ctx.justLimit : !ctx.replayFilter);\n }\n function addFilter(ctx, fn) {\n ctx.filter = combine(ctx.filter, fn);\n }\n function addReplayFilter(ctx, factory, isLimitFilter) {\n var curr = ctx.replayFilter;\n ctx.replayFilter = curr ? function () {\n return combine(curr(), factory());\n } : factory;\n ctx.justLimit = isLimitFilter && !curr;\n }\n function addMatchFilter(ctx, fn) {\n ctx.isMatch = combine(ctx.isMatch, fn);\n }\n function getIndexOrStore(ctx, coreSchema) {\n if (ctx.isPrimKey) return coreSchema.primaryKey;\n var index = coreSchema.getIndexByKeyPath(ctx.index);\n if (!index) throw new exceptions.Schema(\"KeyPath \" + ctx.index + \" on object store \" + coreSchema.name + \" is not indexed\");\n return index;\n }\n function openCursor(ctx, coreTable, trans) {\n var index = getIndexOrStore(ctx, coreTable.schema);\n return coreTable.openCursor({\n trans: trans,\n values: !ctx.keysOnly,\n reverse: ctx.dir === 'prev',\n unique: !!ctx.unique,\n query: {\n index: index,\n range: ctx.range\n }\n });\n }\n function iter(ctx, fn, coreTrans, coreTable) {\n var filter = ctx.replayFilter ? combine(ctx.filter, ctx.replayFilter()) : ctx.filter;\n if (!ctx.or) {\n return iterate(openCursor(ctx, coreTable, coreTrans), combine(ctx.algorithm, filter), fn, !ctx.keysOnly && ctx.valueMapper);\n } else {\n var set_1 = {};\n var union = function (item, cursor, advance) {\n if (!filter || filter(cursor, advance, function (result) {\n return cursor.stop(result);\n }, function (err) {\n return cursor.fail(err);\n })) {\n var primaryKey = cursor.primaryKey;\n var key = '' + primaryKey;\n if (key === '[object ArrayBuffer]') key = '' + new Uint8Array(primaryKey);\n if (!hasOwn(set_1, key)) {\n set_1[key] = true;\n fn(item, cursor, advance);\n }\n }\n };\n return Promise.all([ctx.or._iterate(union, coreTrans), iterate(openCursor(ctx, coreTable, coreTrans), ctx.algorithm, union, !ctx.keysOnly && ctx.valueMapper)]);\n }\n }\n function iterate(cursorPromise, filter, fn, valueMapper) {\n var mappedFn = valueMapper ? function (x, c, a) {\n return fn(valueMapper(x), c, a);\n } : fn;\n var wrappedFn = wrap(mappedFn);\n return cursorPromise.then(function (cursor) {\n if (cursor) {\n return cursor.start(function () {\n var c = function () {\n return cursor.continue();\n };\n if (!filter || filter(cursor, function (advancer) {\n return c = advancer;\n }, function (val) {\n cursor.stop(val);\n c = nop;\n }, function (e) {\n cursor.fail(e);\n c = nop;\n })) wrappedFn(cursor.value, cursor, function (advancer) {\n return c = advancer;\n });\n c();\n });\n }\n });\n }\n var PropModSymbol = Symbol();\n var PropModification = function () {\n function PropModification(spec) {\n Object.assign(this, spec);\n }\n PropModification.prototype.execute = function (value) {\n var _a;\n if (this.add !== undefined) {\n var term = this.add;\n if (isArray(term)) {\n return __spreadArray(__spreadArray([], isArray(value) ? value : [], true), term, true).sort();\n }\n if (typeof term === 'number') return (Number(value) || 0) + term;\n if (typeof term === 'bigint') {\n try {\n return BigInt(value) + term;\n } catch (_b) {\n return BigInt(0) + term;\n }\n }\n throw new TypeError(\"Invalid term \".concat(term));\n }\n if (this.remove !== undefined) {\n var subtrahend_1 = this.remove;\n if (isArray(subtrahend_1)) {\n return isArray(value) ? value.filter(function (item) {\n return !subtrahend_1.includes(item);\n }).sort() : [];\n }\n if (typeof subtrahend_1 === 'number') return Number(value) - subtrahend_1;\n if (typeof subtrahend_1 === 'bigint') {\n try {\n return BigInt(value) - subtrahend_1;\n } catch (_c) {\n return BigInt(0) - subtrahend_1;\n }\n }\n throw new TypeError(\"Invalid subtrahend \".concat(subtrahend_1));\n }\n var prefixToReplace = (_a = this.replacePrefix) === null || _a === void 0 ? void 0 : _a[0];\n if (prefixToReplace && typeof value === 'string' && value.startsWith(prefixToReplace)) {\n return this.replacePrefix[1] + value.substring(prefixToReplace.length);\n }\n return value;\n };\n return PropModification;\n }();\n var Collection = function () {\n function Collection() {}\n Collection.prototype._read = function (fn, cb) {\n var ctx = this._ctx;\n return ctx.error ? ctx.table._trans(null, rejection.bind(null, ctx.error)) : ctx.table._trans('readonly', fn).then(cb);\n };\n Collection.prototype._write = function (fn) {\n var ctx = this._ctx;\n return ctx.error ? ctx.table._trans(null, rejection.bind(null, ctx.error)) : ctx.table._trans('readwrite', fn, \"locked\");\n };\n Collection.prototype._addAlgorithm = function (fn) {\n var ctx = this._ctx;\n ctx.algorithm = combine(ctx.algorithm, fn);\n };\n Collection.prototype._iterate = function (fn, coreTrans) {\n return iter(this._ctx, fn, coreTrans, this._ctx.table.core);\n };\n Collection.prototype.clone = function (props) {\n var rv = Object.create(this.constructor.prototype),\n ctx = Object.create(this._ctx);\n if (props) extend(ctx, props);\n rv._ctx = ctx;\n return rv;\n };\n Collection.prototype.raw = function () {\n this._ctx.valueMapper = null;\n return this;\n };\n Collection.prototype.each = function (fn) {\n var ctx = this._ctx;\n return this._read(function (trans) {\n return iter(ctx, fn, trans, ctx.table.core);\n });\n };\n Collection.prototype.count = function (cb) {\n var _this = this;\n return this._read(function (trans) {\n var ctx = _this._ctx;\n var coreTable = ctx.table.core;\n if (isPlainKeyRange(ctx, true)) {\n return coreTable.count({\n trans: trans,\n query: {\n index: getIndexOrStore(ctx, coreTable.schema),\n range: ctx.range\n }\n }).then(function (count) {\n return Math.min(count, ctx.limit);\n });\n } else {\n var count = 0;\n return iter(ctx, function () {\n ++count;\n return false;\n }, trans, coreTable).then(function () {\n return count;\n });\n }\n }).then(cb);\n };\n Collection.prototype.sortBy = function (keyPath, cb) {\n var parts = keyPath.split('.').reverse(),\n lastPart = parts[0],\n lastIndex = parts.length - 1;\n function getval(obj, i) {\n if (i) return getval(obj[parts[i]], i - 1);\n return obj[lastPart];\n }\n var order = this._ctx.dir === \"next\" ? 1 : -1;\n function sorter(a, b) {\n var aVal = getval(a, lastIndex),\n bVal = getval(b, lastIndex);\n return cmp(aVal, bVal) * order;\n }\n return this.toArray(function (a) {\n return a.sort(sorter);\n }).then(cb);\n };\n Collection.prototype.toArray = function (cb) {\n var _this = this;\n return this._read(function (trans) {\n var ctx = _this._ctx;\n if (ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {\n var valueMapper_1 = ctx.valueMapper;\n var index = getIndexOrStore(ctx, ctx.table.core.schema);\n return ctx.table.core.query({\n trans: trans,\n limit: ctx.limit,\n values: true,\n query: {\n index: index,\n range: ctx.range\n }\n }).then(function (_a) {\n var result = _a.result;\n return valueMapper_1 ? result.map(valueMapper_1) : result;\n });\n } else {\n var a_1 = [];\n return iter(ctx, function (item) {\n return a_1.push(item);\n }, trans, ctx.table.core).then(function () {\n return a_1;\n });\n }\n }, cb);\n };\n Collection.prototype.offset = function (offset) {\n var ctx = this._ctx;\n if (offset <= 0) return this;\n ctx.offset += offset;\n if (isPlainKeyRange(ctx)) {\n addReplayFilter(ctx, function () {\n var offsetLeft = offset;\n return function (cursor, advance) {\n if (offsetLeft === 0) return true;\n if (offsetLeft === 1) {\n --offsetLeft;\n return false;\n }\n advance(function () {\n cursor.advance(offsetLeft);\n offsetLeft = 0;\n });\n return false;\n };\n });\n } else {\n addReplayFilter(ctx, function () {\n var offsetLeft = offset;\n return function () {\n return --offsetLeft < 0;\n };\n });\n }\n return this;\n };\n Collection.prototype.limit = function (numRows) {\n this._ctx.limit = Math.min(this._ctx.limit, numRows);\n addReplayFilter(this._ctx, function () {\n var rowsLeft = numRows;\n return function (cursor, advance, resolve) {\n if (--rowsLeft <= 0) advance(resolve);\n return rowsLeft >= 0;\n };\n }, true);\n return this;\n };\n Collection.prototype.until = function (filterFunction, bIncludeStopEntry) {\n addFilter(this._ctx, function (cursor, advance, resolve) {\n if (filterFunction(cursor.value)) {\n advance(resolve);\n return bIncludeStopEntry;\n } else {\n return true;\n }\n });\n return this;\n };\n Collection.prototype.first = function (cb) {\n return this.limit(1).toArray(function (a) {\n return a[0];\n }).then(cb);\n };\n Collection.prototype.last = function (cb) {\n return this.reverse().first(cb);\n };\n Collection.prototype.filter = function (filterFunction) {\n addFilter(this._ctx, function (cursor) {\n return filterFunction(cursor.value);\n });\n addMatchFilter(this._ctx, filterFunction);\n return this;\n };\n Collection.prototype.and = function (filter) {\n return this.filter(filter);\n };\n Collection.prototype.or = function (indexName) {\n return new this.db.WhereClause(this._ctx.table, indexName, this);\n };\n Collection.prototype.reverse = function () {\n this._ctx.dir = this._ctx.dir === \"prev\" ? \"next\" : \"prev\";\n if (this._ondirectionchange) this._ondirectionchange(this._ctx.dir);\n return this;\n };\n Collection.prototype.desc = function () {\n return this.reverse();\n };\n Collection.prototype.eachKey = function (cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n return this.each(function (val, cursor) {\n cb(cursor.key, cursor);\n });\n };\n Collection.prototype.eachUniqueKey = function (cb) {\n this._ctx.unique = \"unique\";\n return this.eachKey(cb);\n };\n Collection.prototype.eachPrimaryKey = function (cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n return this.each(function (val, cursor) {\n cb(cursor.primaryKey, cursor);\n });\n };\n Collection.prototype.keys = function (cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n var a = [];\n return this.each(function (item, cursor) {\n a.push(cursor.key);\n }).then(function () {\n return a;\n }).then(cb);\n };\n Collection.prototype.primaryKeys = function (cb) {\n var ctx = this._ctx;\n if (ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {\n return this._read(function (trans) {\n var index = getIndexOrStore(ctx, ctx.table.core.schema);\n return ctx.table.core.query({\n trans: trans,\n values: false,\n limit: ctx.limit,\n query: {\n index: index,\n range: ctx.range\n }\n });\n }).then(function (_a) {\n var result = _a.result;\n return result;\n }).then(cb);\n }\n ctx.keysOnly = !ctx.isMatch;\n var a = [];\n return this.each(function (item, cursor) {\n a.push(cursor.primaryKey);\n }).then(function () {\n return a;\n }).then(cb);\n };\n Collection.prototype.uniqueKeys = function (cb) {\n this._ctx.unique = \"unique\";\n return this.keys(cb);\n };\n Collection.prototype.firstKey = function (cb) {\n return this.limit(1).keys(function (a) {\n return a[0];\n }).then(cb);\n };\n Collection.prototype.lastKey = function (cb) {\n return this.reverse().firstKey(cb);\n };\n Collection.prototype.distinct = function () {\n var ctx = this._ctx,\n idx = ctx.index && ctx.table.schema.idxByName[ctx.index];\n if (!idx || !idx.multi) return this;\n var set = {};\n addFilter(this._ctx, function (cursor) {\n var strKey = cursor.primaryKey.toString();\n var found = hasOwn(set, strKey);\n set[strKey] = true;\n return !found;\n });\n return this;\n };\n Collection.prototype.modify = function (changes) {\n var _this = this;\n var ctx = this._ctx;\n return this._write(function (trans) {\n var modifyer;\n if (typeof changes === 'function') {\n modifyer = changes;\n } else {\n var keyPaths = keys(changes);\n var numKeys = keyPaths.length;\n modifyer = function (item) {\n var anythingModified = false;\n for (var i = 0; i < numKeys; ++i) {\n var keyPath = keyPaths[i];\n var val = changes[keyPath];\n var origVal = getByKeyPath(item, keyPath);\n if (val instanceof PropModification) {\n setByKeyPath(item, keyPath, val.execute(origVal));\n anythingModified = true;\n } else if (origVal !== val) {\n setByKeyPath(item, keyPath, val);\n anythingModified = true;\n }\n }\n return anythingModified;\n };\n }\n var coreTable = ctx.table.core;\n var _a = coreTable.schema.primaryKey,\n outbound = _a.outbound,\n extractKey = _a.extractKey;\n var limit = 200;\n var modifyChunkSize = _this.db._options.modifyChunkSize;\n if (modifyChunkSize) {\n if (typeof modifyChunkSize == 'object') {\n limit = modifyChunkSize[coreTable.name] || modifyChunkSize['*'] || 200;\n } else {\n limit = modifyChunkSize;\n }\n }\n var totalFailures = [];\n var successCount = 0;\n var failedKeys = [];\n var applyMutateResult = function (expectedCount, res) {\n var failures = res.failures,\n numFailures = res.numFailures;\n successCount += expectedCount - numFailures;\n for (var _i = 0, _a = keys(failures); _i < _a.length; _i++) {\n var pos = _a[_i];\n totalFailures.push(failures[pos]);\n }\n };\n return _this.clone().primaryKeys().then(function (keys) {\n var criteria = isPlainKeyRange(ctx) && ctx.limit === Infinity && (typeof changes !== 'function' || changes === deleteCallback) && {\n index: ctx.index,\n range: ctx.range\n };\n var nextChunk = function (offset) {\n var count = Math.min(limit, keys.length - offset);\n return coreTable.getMany({\n trans: trans,\n keys: keys.slice(offset, offset + count),\n cache: \"immutable\"\n }).then(function (values) {\n var addValues = [];\n var putValues = [];\n var putKeys = outbound ? [] : null;\n var deleteKeys = [];\n for (var i = 0; i < count; ++i) {\n var origValue = values[i];\n var ctx_1 = {\n value: deepClone(origValue),\n primKey: keys[offset + i]\n };\n if (modifyer.call(ctx_1, ctx_1.value, ctx_1) !== false) {\n if (ctx_1.value == null) {\n deleteKeys.push(keys[offset + i]);\n } else if (!outbound && cmp(extractKey(origValue), extractKey(ctx_1.value)) !== 0) {\n deleteKeys.push(keys[offset + i]);\n addValues.push(ctx_1.value);\n } else {\n putValues.push(ctx_1.value);\n if (outbound) putKeys.push(keys[offset + i]);\n }\n }\n }\n return Promise.resolve(addValues.length > 0 && coreTable.mutate({\n trans: trans,\n type: 'add',\n values: addValues\n }).then(function (res) {\n for (var pos in res.failures) {\n deleteKeys.splice(parseInt(pos), 1);\n }\n applyMutateResult(addValues.length, res);\n })).then(function () {\n return (putValues.length > 0 || criteria && typeof changes === 'object') && coreTable.mutate({\n trans: trans,\n type: 'put',\n keys: putKeys,\n values: putValues,\n criteria: criteria,\n changeSpec: typeof changes !== 'function' && changes,\n isAdditionalChunk: offset > 0\n }).then(function (res) {\n return applyMutateResult(putValues.length, res);\n });\n }).then(function () {\n return (deleteKeys.length > 0 || criteria && changes === deleteCallback) && coreTable.mutate({\n trans: trans,\n type: 'delete',\n keys: deleteKeys,\n criteria: criteria,\n isAdditionalChunk: offset > 0\n }).then(function (res) {\n return applyMutateResult(deleteKeys.length, res);\n });\n }).then(function () {\n return keys.length > offset + count && nextChunk(offset + limit);\n });\n });\n };\n return nextChunk(0).then(function () {\n if (totalFailures.length > 0) throw new ModifyError(\"Error modifying one or more objects\", totalFailures, successCount, failedKeys);\n return keys.length;\n });\n });\n });\n };\n Collection.prototype.delete = function () {\n var ctx = this._ctx,\n range = ctx.range;\n if (isPlainKeyRange(ctx) && (ctx.isPrimKey || range.type === 3)) {\n return this._write(function (trans) {\n var primaryKey = ctx.table.core.schema.primaryKey;\n var coreRange = range;\n return ctx.table.core.count({\n trans: trans,\n query: {\n index: primaryKey,\n range: coreRange\n }\n }).then(function (count) {\n return ctx.table.core.mutate({\n trans: trans,\n type: 'deleteRange',\n range: coreRange\n }).then(function (_a) {\n var failures = _a.failures;\n _a.lastResult;\n _a.results;\n var numFailures = _a.numFailures;\n if (numFailures) throw new ModifyError(\"Could not delete some values\", Object.keys(failures).map(function (pos) {\n return failures[pos];\n }), count - numFailures);\n return count - numFailures;\n });\n });\n });\n }\n return this.modify(deleteCallback);\n };\n return Collection;\n }();\n var deleteCallback = function (value, ctx) {\n return ctx.value = null;\n };\n function createCollectionConstructor(db) {\n return makeClassConstructor(Collection.prototype, function Collection(whereClause, keyRangeGenerator) {\n this.db = db;\n var keyRange = AnyRange,\n error = null;\n if (keyRangeGenerator) try {\n keyRange = keyRangeGenerator();\n } catch (ex) {\n error = ex;\n }\n var whereCtx = whereClause._ctx;\n var table = whereCtx.table;\n var readingHook = table.hook.reading.fire;\n this._ctx = {\n table: table,\n index: whereCtx.index,\n isPrimKey: !whereCtx.index || table.schema.primKey.keyPath && whereCtx.index === table.schema.primKey.name,\n range: keyRange,\n keysOnly: false,\n dir: \"next\",\n unique: \"\",\n algorithm: null,\n filter: null,\n replayFilter: null,\n justLimit: true,\n isMatch: null,\n offset: 0,\n limit: Infinity,\n error: error,\n or: whereCtx.or,\n valueMapper: readingHook !== mirror ? readingHook : null\n };\n });\n }\n function simpleCompare(a, b) {\n return a < b ? -1 : a === b ? 0 : 1;\n }\n function simpleCompareReverse(a, b) {\n return a > b ? -1 : a === b ? 0 : 1;\n }\n function fail(collectionOrWhereClause, err, T) {\n var collection = collectionOrWhereClause instanceof WhereClause ? new collectionOrWhereClause.Collection(collectionOrWhereClause) : collectionOrWhereClause;\n collection._ctx.error = T ? new T(err) : new TypeError(err);\n return collection;\n }\n function emptyCollection(whereClause) {\n return new whereClause.Collection(whereClause, function () {\n return rangeEqual(\"\");\n }).limit(0);\n }\n function upperFactory(dir) {\n return dir === \"next\" ? function (s) {\n return s.toUpperCase();\n } : function (s) {\n return s.toLowerCase();\n };\n }\n function lowerFactory(dir) {\n return dir === \"next\" ? function (s) {\n return s.toLowerCase();\n } : function (s) {\n return s.toUpperCase();\n };\n }\n function nextCasing(key, lowerKey, upperNeedle, lowerNeedle, cmp, dir) {\n var length = Math.min(key.length, lowerNeedle.length);\n var llp = -1;\n for (var i = 0; i < length; ++i) {\n var lwrKeyChar = lowerKey[i];\n if (lwrKeyChar !== lowerNeedle[i]) {\n if (cmp(key[i], upperNeedle[i]) < 0) return key.substr(0, i) + upperNeedle[i] + upperNeedle.substr(i + 1);\n if (cmp(key[i], lowerNeedle[i]) < 0) return key.substr(0, i) + lowerNeedle[i] + upperNeedle.substr(i + 1);\n if (llp >= 0) return key.substr(0, llp) + lowerKey[llp] + upperNeedle.substr(llp + 1);\n return null;\n }\n if (cmp(key[i], lwrKeyChar) < 0) llp = i;\n }\n if (length < lowerNeedle.length && dir === \"next\") return key + upperNeedle.substr(key.length);\n if (length < key.length && dir === \"prev\") return key.substr(0, upperNeedle.length);\n return llp < 0 ? null : key.substr(0, llp) + lowerNeedle[llp] + upperNeedle.substr(llp + 1);\n }\n function addIgnoreCaseAlgorithm(whereClause, match, needles, suffix) {\n var upper,\n lower,\n compare,\n upperNeedles,\n lowerNeedles,\n direction,\n nextKeySuffix,\n needlesLen = needles.length;\n if (!needles.every(function (s) {\n return typeof s === 'string';\n })) {\n return fail(whereClause, STRING_EXPECTED);\n }\n function initDirection(dir) {\n upper = upperFactory(dir);\n lower = lowerFactory(dir);\n compare = dir === \"next\" ? simpleCompare : simpleCompareReverse;\n var needleBounds = needles.map(function (needle) {\n return {\n lower: lower(needle),\n upper: upper(needle)\n };\n }).sort(function (a, b) {\n return compare(a.lower, b.lower);\n });\n upperNeedles = needleBounds.map(function (nb) {\n return nb.upper;\n });\n lowerNeedles = needleBounds.map(function (nb) {\n return nb.lower;\n });\n direction = dir;\n nextKeySuffix = dir === \"next\" ? \"\" : suffix;\n }\n initDirection(\"next\");\n var c = new whereClause.Collection(whereClause, function () {\n return createRange(upperNeedles[0], lowerNeedles[needlesLen - 1] + suffix);\n });\n c._ondirectionchange = function (direction) {\n initDirection(direction);\n };\n var firstPossibleNeedle = 0;\n c._addAlgorithm(function (cursor, advance, resolve) {\n var key = cursor.key;\n if (typeof key !== 'string') return false;\n var lowerKey = lower(key);\n if (match(lowerKey, lowerNeedles, firstPossibleNeedle)) {\n return true;\n } else {\n var lowestPossibleCasing = null;\n for (var i = firstPossibleNeedle; i < needlesLen; ++i) {\n var casing = nextCasing(key, lowerKey, upperNeedles[i], lowerNeedles[i], compare, direction);\n if (casing === null && lowestPossibleCasing === null) firstPossibleNeedle = i + 1;else if (lowestPossibleCasing === null || compare(lowestPossibleCasing, casing) > 0) {\n lowestPossibleCasing = casing;\n }\n }\n if (lowestPossibleCasing !== null) {\n advance(function () {\n cursor.continue(lowestPossibleCasing + nextKeySuffix);\n });\n } else {\n advance(resolve);\n }\n return false;\n }\n });\n return c;\n }\n function createRange(lower, upper, lowerOpen, upperOpen) {\n return {\n type: 2,\n lower: lower,\n upper: upper,\n lowerOpen: lowerOpen,\n upperOpen: upperOpen\n };\n }\n function rangeEqual(value) {\n return {\n type: 1,\n lower: value,\n upper: value\n };\n }\n var WhereClause = function () {\n function WhereClause() {}\n Object.defineProperty(WhereClause.prototype, \"Collection\", {\n get: function () {\n return this._ctx.table.db.Collection;\n },\n enumerable: false,\n configurable: true\n });\n WhereClause.prototype.between = function (lower, upper, includeLower, includeUpper) {\n includeLower = includeLower !== false;\n includeUpper = includeUpper === true;\n try {\n if (this._cmp(lower, upper) > 0 || this._cmp(lower, upper) === 0 && (includeLower || includeUpper) && !(includeLower && includeUpper)) return emptyCollection(this);\n return new this.Collection(this, function () {\n return createRange(lower, upper, !includeLower, !includeUpper);\n });\n } catch (e) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n };\n WhereClause.prototype.equals = function (value) {\n if (value == null) return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, function () {\n return rangeEqual(value);\n });\n };\n WhereClause.prototype.above = function (value) {\n if (value == null) return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, function () {\n return createRange(value, undefined, true);\n });\n };\n WhereClause.prototype.aboveOrEqual = function (value) {\n if (value == null) return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, function () {\n return createRange(value, undefined, false);\n });\n };\n WhereClause.prototype.below = function (value) {\n if (value == null) return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, function () {\n return createRange(undefined, value, false, true);\n });\n };\n WhereClause.prototype.belowOrEqual = function (value) {\n if (value == null) return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, function () {\n return createRange(undefined, value);\n });\n };\n WhereClause.prototype.startsWith = function (str) {\n if (typeof str !== 'string') return fail(this, STRING_EXPECTED);\n return this.between(str, str + maxString, true, true);\n };\n WhereClause.prototype.startsWithIgnoreCase = function (str) {\n if (str === \"\") return this.startsWith(str);\n return addIgnoreCaseAlgorithm(this, function (x, a) {\n return x.indexOf(a[0]) === 0;\n }, [str], maxString);\n };\n WhereClause.prototype.equalsIgnoreCase = function (str) {\n return addIgnoreCaseAlgorithm(this, function (x, a) {\n return x === a[0];\n }, [str], \"\");\n };\n WhereClause.prototype.anyOfIgnoreCase = function () {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0) return emptyCollection(this);\n return addIgnoreCaseAlgorithm(this, function (x, a) {\n return a.indexOf(x) !== -1;\n }, set, \"\");\n };\n WhereClause.prototype.startsWithAnyOfIgnoreCase = function () {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0) return emptyCollection(this);\n return addIgnoreCaseAlgorithm(this, function (x, a) {\n return a.some(function (n) {\n return x.indexOf(n) === 0;\n });\n }, set, maxString);\n };\n WhereClause.prototype.anyOf = function () {\n var _this = this;\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n var compare = this._cmp;\n try {\n set.sort(compare);\n } catch (e) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n if (set.length === 0) return emptyCollection(this);\n var c = new this.Collection(this, function () {\n return createRange(set[0], set[set.length - 1]);\n });\n c._ondirectionchange = function (direction) {\n compare = direction === \"next\" ? _this._ascending : _this._descending;\n set.sort(compare);\n };\n var i = 0;\n c._addAlgorithm(function (cursor, advance, resolve) {\n var key = cursor.key;\n while (compare(key, set[i]) > 0) {\n ++i;\n if (i === set.length) {\n advance(resolve);\n return false;\n }\n }\n if (compare(key, set[i]) === 0) {\n return true;\n } else {\n advance(function () {\n cursor.continue(set[i]);\n });\n return false;\n }\n });\n return c;\n };\n WhereClause.prototype.notEqual = function (value) {\n return this.inAnyRange([[minKey, value], [value, this.db._maxKey]], {\n includeLowers: false,\n includeUppers: false\n });\n };\n WhereClause.prototype.noneOf = function () {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0) return new this.Collection(this);\n try {\n set.sort(this._ascending);\n } catch (e) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n var ranges = set.reduce(function (res, val) {\n return res ? res.concat([[res[res.length - 1][1], val]]) : [[minKey, val]];\n }, null);\n ranges.push([set[set.length - 1], this.db._maxKey]);\n return this.inAnyRange(ranges, {\n includeLowers: false,\n includeUppers: false\n });\n };\n WhereClause.prototype.inAnyRange = function (ranges, options) {\n var _this = this;\n var cmp = this._cmp,\n ascending = this._ascending,\n descending = this._descending,\n min = this._min,\n max = this._max;\n if (ranges.length === 0) return emptyCollection(this);\n if (!ranges.every(function (range) {\n return range[0] !== undefined && range[1] !== undefined && ascending(range[0], range[1]) <= 0;\n })) {\n return fail(this, \"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower\", exceptions.InvalidArgument);\n }\n var includeLowers = !options || options.includeLowers !== false;\n var includeUppers = options && options.includeUppers === true;\n function addRange(ranges, newRange) {\n var i = 0,\n l = ranges.length;\n for (; i < l; ++i) {\n var range = ranges[i];\n if (cmp(newRange[0], range[1]) < 0 && cmp(newRange[1], range[0]) > 0) {\n range[0] = min(range[0], newRange[0]);\n range[1] = max(range[1], newRange[1]);\n break;\n }\n }\n if (i === l) ranges.push(newRange);\n return ranges;\n }\n var sortDirection = ascending;\n function rangeSorter(a, b) {\n return sortDirection(a[0], b[0]);\n }\n var set;\n try {\n set = ranges.reduce(addRange, []);\n set.sort(rangeSorter);\n } catch (ex) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n var rangePos = 0;\n var keyIsBeyondCurrentEntry = includeUppers ? function (key) {\n return ascending(key, set[rangePos][1]) > 0;\n } : function (key) {\n return ascending(key, set[rangePos][1]) >= 0;\n };\n var keyIsBeforeCurrentEntry = includeLowers ? function (key) {\n return descending(key, set[rangePos][0]) > 0;\n } : function (key) {\n return descending(key, set[rangePos][0]) >= 0;\n };\n function keyWithinCurrentRange(key) {\n return !keyIsBeyondCurrentEntry(key) && !keyIsBeforeCurrentEntry(key);\n }\n var checkKey = keyIsBeyondCurrentEntry;\n var c = new this.Collection(this, function () {\n return createRange(set[0][0], set[set.length - 1][1], !includeLowers, !includeUppers);\n });\n c._ondirectionchange = function (direction) {\n if (direction === \"next\") {\n checkKey = keyIsBeyondCurrentEntry;\n sortDirection = ascending;\n } else {\n checkKey = keyIsBeforeCurrentEntry;\n sortDirection = descending;\n }\n set.sort(rangeSorter);\n };\n c._addAlgorithm(function (cursor, advance, resolve) {\n var key = cursor.key;\n while (checkKey(key)) {\n ++rangePos;\n if (rangePos === set.length) {\n advance(resolve);\n return false;\n }\n }\n if (keyWithinCurrentRange(key)) {\n return true;\n } else if (_this._cmp(key, set[rangePos][1]) === 0 || _this._cmp(key, set[rangePos][0]) === 0) {\n return false;\n } else {\n advance(function () {\n if (sortDirection === ascending) cursor.continue(set[rangePos][0]);else cursor.continue(set[rangePos][1]);\n });\n return false;\n }\n });\n return c;\n };\n WhereClause.prototype.startsWithAnyOf = function () {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (!set.every(function (s) {\n return typeof s === 'string';\n })) {\n return fail(this, \"startsWithAnyOf() only works with strings\");\n }\n if (set.length === 0) return emptyCollection(this);\n return this.inAnyRange(set.map(function (str) {\n return [str, str + maxString];\n }));\n };\n return WhereClause;\n }();\n function createWhereClauseConstructor(db) {\n return makeClassConstructor(WhereClause.prototype, function WhereClause(table, index, orCollection) {\n this.db = db;\n this._ctx = {\n table: table,\n index: index === \":id\" ? null : index,\n or: orCollection\n };\n this._cmp = this._ascending = cmp;\n this._descending = function (a, b) {\n return cmp(b, a);\n };\n this._max = function (a, b) {\n return cmp(a, b) > 0 ? a : b;\n };\n this._min = function (a, b) {\n return cmp(a, b) < 0 ? a : b;\n };\n this._IDBKeyRange = db._deps.IDBKeyRange;\n if (!this._IDBKeyRange) throw new exceptions.MissingAPI();\n });\n }\n function eventRejectHandler(reject) {\n return wrap(function (event) {\n preventDefault(event);\n reject(event.target.error);\n return false;\n });\n }\n function preventDefault(event) {\n if (event.stopPropagation) event.stopPropagation();\n if (event.preventDefault) event.preventDefault();\n }\n var DEXIE_STORAGE_MUTATED_EVENT_NAME = 'storagemutated';\n var STORAGE_MUTATED_DOM_EVENT_NAME = 'x-storagemutated-1';\n var globalEvents = Events(null, DEXIE_STORAGE_MUTATED_EVENT_NAME);\n var Transaction = function () {\n function Transaction() {}\n Transaction.prototype._lock = function () {\n assert(!PSD.global);\n ++this._reculock;\n if (this._reculock === 1 && !PSD.global) PSD.lockOwnerFor = this;\n return this;\n };\n Transaction.prototype._unlock = function () {\n assert(!PSD.global);\n if (--this._reculock === 0) {\n if (!PSD.global) PSD.lockOwnerFor = null;\n while (this._blockedFuncs.length > 0 && !this._locked()) {\n var fnAndPSD = this._blockedFuncs.shift();\n try {\n usePSD(fnAndPSD[1], fnAndPSD[0]);\n } catch (e) {}\n }\n }\n return this;\n };\n Transaction.prototype._locked = function () {\n return this._reculock && PSD.lockOwnerFor !== this;\n };\n Transaction.prototype.create = function (idbtrans) {\n var _this = this;\n if (!this.mode) return this;\n var idbdb = this.db.idbdb;\n var dbOpenError = this.db._state.dbOpenError;\n assert(!this.idbtrans);\n if (!idbtrans && !idbdb) {\n switch (dbOpenError && dbOpenError.name) {\n case \"DatabaseClosedError\":\n throw new exceptions.DatabaseClosed(dbOpenError);\n case \"MissingAPIError\":\n throw new exceptions.MissingAPI(dbOpenError.message, dbOpenError);\n default:\n throw new exceptions.OpenFailed(dbOpenError);\n }\n }\n if (!this.active) throw new exceptions.TransactionInactive();\n assert(this._completion._state === null);\n idbtrans = this.idbtrans = idbtrans || (this.db.core ? this.db.core.transaction(this.storeNames, this.mode, {\n durability: this.chromeTransactionDurability\n }) : idbdb.transaction(this.storeNames, this.mode, {\n durability: this.chromeTransactionDurability\n }));\n idbtrans.onerror = wrap(function (ev) {\n preventDefault(ev);\n _this._reject(idbtrans.error);\n });\n idbtrans.onabort = wrap(function (ev) {\n preventDefault(ev);\n _this.active && _this._reject(new exceptions.Abort(idbtrans.error));\n _this.active = false;\n _this.on(\"abort\").fire(ev);\n });\n idbtrans.oncomplete = wrap(function () {\n _this.active = false;\n _this._resolve();\n if ('mutatedParts' in idbtrans) {\n globalEvents.storagemutated.fire(idbtrans[\"mutatedParts\"]);\n }\n });\n return this;\n };\n Transaction.prototype._promise = function (mode, fn, bWriteLock) {\n var _this = this;\n if (mode === 'readwrite' && this.mode !== 'readwrite') return rejection(new exceptions.ReadOnly(\"Transaction is readonly\"));\n if (!this.active) return rejection(new exceptions.TransactionInactive());\n if (this._locked()) {\n return new DexiePromise(function (resolve, reject) {\n _this._blockedFuncs.push([function () {\n _this._promise(mode, fn, bWriteLock).then(resolve, reject);\n }, PSD]);\n });\n } else if (bWriteLock) {\n return newScope(function () {\n var p = new DexiePromise(function (resolve, reject) {\n _this._lock();\n var rv = fn(resolve, reject, _this);\n if (rv && rv.then) rv.then(resolve, reject);\n });\n p.finally(function () {\n return _this._unlock();\n });\n p._lib = true;\n return p;\n });\n } else {\n var p = new DexiePromise(function (resolve, reject) {\n var rv = fn(resolve, reject, _this);\n if (rv && rv.then) rv.then(resolve, reject);\n });\n p._lib = true;\n return p;\n }\n };\n Transaction.prototype._root = function () {\n return this.parent ? this.parent._root() : this;\n };\n Transaction.prototype.waitFor = function (promiseLike) {\n var root = this._root();\n var promise = DexiePromise.resolve(promiseLike);\n if (root._waitingFor) {\n root._waitingFor = root._waitingFor.then(function () {\n return promise;\n });\n } else {\n root._waitingFor = promise;\n root._waitingQueue = [];\n var store = root.idbtrans.objectStore(root.storeNames[0]);\n (function spin() {\n ++root._spinCount;\n while (root._waitingQueue.length) root._waitingQueue.shift()();\n if (root._waitingFor) store.get(-Infinity).onsuccess = spin;\n })();\n }\n var currentWaitPromise = root._waitingFor;\n return new DexiePromise(function (resolve, reject) {\n promise.then(function (res) {\n return root._waitingQueue.push(wrap(resolve.bind(null, res)));\n }, function (err) {\n return root._waitingQueue.push(wrap(reject.bind(null, err)));\n }).finally(function () {\n if (root._waitingFor === currentWaitPromise) {\n root._waitingFor = null;\n }\n });\n });\n };\n Transaction.prototype.abort = function () {\n if (this.active) {\n this.active = false;\n if (this.idbtrans) this.idbtrans.abort();\n this._reject(new exceptions.Abort());\n }\n };\n Transaction.prototype.table = function (tableName) {\n var memoizedTables = this._memoizedTables || (this._memoizedTables = {});\n if (hasOwn(memoizedTables, tableName)) return memoizedTables[tableName];\n var tableSchema = this.schema[tableName];\n if (!tableSchema) {\n throw new exceptions.NotFound(\"Table \" + tableName + \" not part of transaction\");\n }\n var transactionBoundTable = new this.db.Table(tableName, tableSchema, this);\n transactionBoundTable.core = this.db.core.table(tableName);\n memoizedTables[tableName] = transactionBoundTable;\n return transactionBoundTable;\n };\n return Transaction;\n }();\n function createTransactionConstructor(db) {\n return makeClassConstructor(Transaction.prototype, function Transaction(mode, storeNames, dbschema, chromeTransactionDurability, parent) {\n var _this = this;\n this.db = db;\n this.mode = mode;\n this.storeNames = storeNames;\n this.schema = dbschema;\n this.chromeTransactionDurability = chromeTransactionDurability;\n this.idbtrans = null;\n this.on = Events(this, \"complete\", \"error\", \"abort\");\n this.parent = parent || null;\n this.active = true;\n this._reculock = 0;\n this._blockedFuncs = [];\n this._resolve = null;\n this._reject = null;\n this._waitingFor = null;\n this._waitingQueue = null;\n this._spinCount = 0;\n this._completion = new DexiePromise(function (resolve, reject) {\n _this._resolve = resolve;\n _this._reject = reject;\n });\n this._completion.then(function () {\n _this.active = false;\n _this.on.complete.fire();\n }, function (e) {\n var wasActive = _this.active;\n _this.active = false;\n _this.on.error.fire(e);\n _this.parent ? _this.parent._reject(e) : wasActive && _this.idbtrans && _this.idbtrans.abort();\n return rejection(e);\n });\n });\n }\n function createIndexSpec(name, keyPath, unique, multi, auto, compound, isPrimKey) {\n return {\n name: name,\n keyPath: keyPath,\n unique: unique,\n multi: multi,\n auto: auto,\n compound: compound,\n src: (unique && !isPrimKey ? '&' : '') + (multi ? '*' : '') + (auto ? \"++\" : \"\") + nameFromKeyPath(keyPath)\n };\n }\n function nameFromKeyPath(keyPath) {\n return typeof keyPath === 'string' ? keyPath : keyPath ? '[' + [].join.call(keyPath, '+') + ']' : \"\";\n }\n function createTableSchema(name, primKey, indexes) {\n return {\n name: name,\n primKey: primKey,\n indexes: indexes,\n mappedClass: null,\n idxByName: arrayToObject(indexes, function (index) {\n return [index.name, index];\n })\n };\n }\n function safariMultiStoreFix(storeNames) {\n return storeNames.length === 1 ? storeNames[0] : storeNames;\n }\n var getMaxKey = function (IdbKeyRange) {\n try {\n IdbKeyRange.only([[]]);\n getMaxKey = function () {\n return [[]];\n };\n return [[]];\n } catch (e) {\n getMaxKey = function () {\n return maxString;\n };\n return maxString;\n }\n };\n function getKeyExtractor(keyPath) {\n if (keyPath == null) {\n return function () {\n return undefined;\n };\n } else if (typeof keyPath === 'string') {\n return getSinglePathKeyExtractor(keyPath);\n } else {\n return function (obj) {\n return getByKeyPath(obj, keyPath);\n };\n }\n }\n function getSinglePathKeyExtractor(keyPath) {\n var split = keyPath.split('.');\n if (split.length === 1) {\n return function (obj) {\n return obj[keyPath];\n };\n } else {\n return function (obj) {\n return getByKeyPath(obj, keyPath);\n };\n }\n }\n function arrayify(arrayLike) {\n return [].slice.call(arrayLike);\n }\n var _id_counter = 0;\n function getKeyPathAlias(keyPath) {\n return keyPath == null ? \":id\" : typeof keyPath === 'string' ? keyPath : \"[\".concat(keyPath.join('+'), \"]\");\n }\n function createDBCore(db, IdbKeyRange, tmpTrans) {\n function extractSchema(db, trans) {\n var tables = arrayify(db.objectStoreNames);\n return {\n schema: {\n name: db.name,\n tables: tables.map(function (table) {\n return trans.objectStore(table);\n }).map(function (store) {\n var keyPath = store.keyPath,\n autoIncrement = store.autoIncrement;\n var compound = isArray(keyPath);\n var outbound = keyPath == null;\n var indexByKeyPath = {};\n var result = {\n name: store.name,\n primaryKey: {\n name: null,\n isPrimaryKey: true,\n outbound: outbound,\n compound: compound,\n keyPath: keyPath,\n autoIncrement: autoIncrement,\n unique: true,\n extractKey: getKeyExtractor(keyPath)\n },\n indexes: arrayify(store.indexNames).map(function (indexName) {\n return store.index(indexName);\n }).map(function (index) {\n var name = index.name,\n unique = index.unique,\n multiEntry = index.multiEntry,\n keyPath = index.keyPath;\n var compound = isArray(keyPath);\n var result = {\n name: name,\n compound: compound,\n keyPath: keyPath,\n unique: unique,\n multiEntry: multiEntry,\n extractKey: getKeyExtractor(keyPath)\n };\n indexByKeyPath[getKeyPathAlias(keyPath)] = result;\n return result;\n }),\n getIndexByKeyPath: function (keyPath) {\n return indexByKeyPath[getKeyPathAlias(keyPath)];\n }\n };\n indexByKeyPath[\":id\"] = result.primaryKey;\n if (keyPath != null) {\n indexByKeyPath[getKeyPathAlias(keyPath)] = result.primaryKey;\n }\n return result;\n })\n },\n hasGetAll: tables.length > 0 && 'getAll' in trans.objectStore(tables[0]) && !(typeof navigator !== 'undefined' && /Safari/.test(navigator.userAgent) && !/(Chrome\\/|Edge\\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\\/(\\d*)/))[1] < 604)\n };\n }\n function makeIDBKeyRange(range) {\n if (range.type === 3) return null;\n if (range.type === 4) throw new Error(\"Cannot convert never type to IDBKeyRange\");\n var lower = range.lower,\n upper = range.upper,\n lowerOpen = range.lowerOpen,\n upperOpen = range.upperOpen;\n var idbRange = lower === undefined ? upper === undefined ? null : IdbKeyRange.upperBound(upper, !!upperOpen) : upper === undefined ? IdbKeyRange.lowerBound(lower, !!lowerOpen) : IdbKeyRange.bound(lower, upper, !!lowerOpen, !!upperOpen);\n return idbRange;\n }\n function createDbCoreTable(tableSchema) {\n var tableName = tableSchema.name;\n function mutate(_a) {\n var trans = _a.trans,\n type = _a.type,\n keys = _a.keys,\n values = _a.values,\n range = _a.range;\n return new Promise(function (resolve, reject) {\n resolve = wrap(resolve);\n var store = trans.objectStore(tableName);\n var outbound = store.keyPath == null;\n var isAddOrPut = type === \"put\" || type === \"add\";\n if (!isAddOrPut && type !== 'delete' && type !== 'deleteRange') throw new Error(\"Invalid operation type: \" + type);\n var length = (keys || values || {\n length: 1\n }).length;\n if (keys && values && keys.length !== values.length) {\n throw new Error(\"Given keys array must have same length as given values array.\");\n }\n if (length === 0) return resolve({\n numFailures: 0,\n failures: {},\n results: [],\n lastResult: undefined\n });\n var req;\n var reqs = [];\n var failures = [];\n var numFailures = 0;\n var errorHandler = function (event) {\n ++numFailures;\n preventDefault(event);\n };\n if (type === 'deleteRange') {\n if (range.type === 4) return resolve({\n numFailures: numFailures,\n failures: failures,\n results: [],\n lastResult: undefined\n });\n if (range.type === 3) reqs.push(req = store.clear());else reqs.push(req = store.delete(makeIDBKeyRange(range)));\n } else {\n var _a = isAddOrPut ? outbound ? [values, keys] : [values, null] : [keys, null],\n args1 = _a[0],\n args2 = _a[1];\n if (isAddOrPut) {\n for (var i = 0; i < length; ++i) {\n reqs.push(req = args2 && args2[i] !== undefined ? store[type](args1[i], args2[i]) : store[type](args1[i]));\n req.onerror = errorHandler;\n }\n } else {\n for (var i = 0; i < length; ++i) {\n reqs.push(req = store[type](args1[i]));\n req.onerror = errorHandler;\n }\n }\n }\n var done = function (event) {\n var lastResult = event.target.result;\n reqs.forEach(function (req, i) {\n return req.error != null && (failures[i] = req.error);\n });\n resolve({\n numFailures: numFailures,\n failures: failures,\n results: type === \"delete\" ? keys : reqs.map(function (req) {\n return req.result;\n }),\n lastResult: lastResult\n });\n };\n req.onerror = function (event) {\n errorHandler(event);\n done(event);\n };\n req.onsuccess = done;\n });\n }\n function openCursor(_a) {\n var trans = _a.trans,\n values = _a.values,\n query = _a.query,\n reverse = _a.reverse,\n unique = _a.unique;\n return new Promise(function (resolve, reject) {\n resolve = wrap(resolve);\n var index = query.index,\n range = query.range;\n var store = trans.objectStore(tableName);\n var source = index.isPrimaryKey ? store : store.index(index.name);\n var direction = reverse ? unique ? \"prevunique\" : \"prev\" : unique ? \"nextunique\" : \"next\";\n var req = values || !('openKeyCursor' in source) ? source.openCursor(makeIDBKeyRange(range), direction) : source.openKeyCursor(makeIDBKeyRange(range), direction);\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = wrap(function (ev) {\n var cursor = req.result;\n if (!cursor) {\n resolve(null);\n return;\n }\n cursor.___id = ++_id_counter;\n cursor.done = false;\n var _cursorContinue = cursor.continue.bind(cursor);\n var _cursorContinuePrimaryKey = cursor.continuePrimaryKey;\n if (_cursorContinuePrimaryKey) _cursorContinuePrimaryKey = _cursorContinuePrimaryKey.bind(cursor);\n var _cursorAdvance = cursor.advance.bind(cursor);\n var doThrowCursorIsNotStarted = function () {\n throw new Error(\"Cursor not started\");\n };\n var doThrowCursorIsStopped = function () {\n throw new Error(\"Cursor not stopped\");\n };\n cursor.trans = trans;\n cursor.stop = cursor.continue = cursor.continuePrimaryKey = cursor.advance = doThrowCursorIsNotStarted;\n cursor.fail = wrap(reject);\n cursor.next = function () {\n var _this = this;\n var gotOne = 1;\n return this.start(function () {\n return gotOne-- ? _this.continue() : _this.stop();\n }).then(function () {\n return _this;\n });\n };\n cursor.start = function (callback) {\n var iterationPromise = new Promise(function (resolveIteration, rejectIteration) {\n resolveIteration = wrap(resolveIteration);\n req.onerror = eventRejectHandler(rejectIteration);\n cursor.fail = rejectIteration;\n cursor.stop = function (value) {\n cursor.stop = cursor.continue = cursor.continuePrimaryKey = cursor.advance = doThrowCursorIsStopped;\n resolveIteration(value);\n };\n });\n var guardedCallback = function () {\n if (req.result) {\n try {\n callback();\n } catch (err) {\n cursor.fail(err);\n }\n } else {\n cursor.done = true;\n cursor.start = function () {\n throw new Error(\"Cursor behind last entry\");\n };\n cursor.stop();\n }\n };\n req.onsuccess = wrap(function (ev) {\n req.onsuccess = guardedCallback;\n guardedCallback();\n });\n cursor.continue = _cursorContinue;\n cursor.continuePrimaryKey = _cursorContinuePrimaryKey;\n cursor.advance = _cursorAdvance;\n guardedCallback();\n return iterationPromise;\n };\n resolve(cursor);\n }, reject);\n });\n }\n function query(hasGetAll) {\n return function (request) {\n return new Promise(function (resolve, reject) {\n resolve = wrap(resolve);\n var trans = request.trans,\n values = request.values,\n limit = request.limit,\n query = request.query;\n var nonInfinitLimit = limit === Infinity ? undefined : limit;\n var index = query.index,\n range = query.range;\n var store = trans.objectStore(tableName);\n var source = index.isPrimaryKey ? store : store.index(index.name);\n var idbKeyRange = makeIDBKeyRange(range);\n if (limit === 0) return resolve({\n result: []\n });\n if (hasGetAll) {\n var req = values ? source.getAll(idbKeyRange, nonInfinitLimit) : source.getAllKeys(idbKeyRange, nonInfinitLimit);\n req.onsuccess = function (event) {\n return resolve({\n result: event.target.result\n });\n };\n req.onerror = eventRejectHandler(reject);\n } else {\n var count_1 = 0;\n var req_1 = values || !('openKeyCursor' in source) ? source.openCursor(idbKeyRange) : source.openKeyCursor(idbKeyRange);\n var result_1 = [];\n req_1.onsuccess = function (event) {\n var cursor = req_1.result;\n if (!cursor) return resolve({\n result: result_1\n });\n result_1.push(values ? cursor.value : cursor.primaryKey);\n if (++count_1 === limit) return resolve({\n result: result_1\n });\n cursor.continue();\n };\n req_1.onerror = eventRejectHandler(reject);\n }\n });\n };\n }\n return {\n name: tableName,\n schema: tableSchema,\n mutate: mutate,\n getMany: function (_a) {\n var trans = _a.trans,\n keys = _a.keys;\n return new Promise(function (resolve, reject) {\n resolve = wrap(resolve);\n var store = trans.objectStore(tableName);\n var length = keys.length;\n var result = new Array(length);\n var keyCount = 0;\n var callbackCount = 0;\n var req;\n var successHandler = function (event) {\n var req = event.target;\n if ((result[req._pos] = req.result) != null) ;\n if (++callbackCount === keyCount) resolve(result);\n };\n var errorHandler = eventRejectHandler(reject);\n for (var i = 0; i < length; ++i) {\n var key = keys[i];\n if (key != null) {\n req = store.get(keys[i]);\n req._pos = i;\n req.onsuccess = successHandler;\n req.onerror = errorHandler;\n ++keyCount;\n }\n }\n if (keyCount === 0) resolve(result);\n });\n },\n get: function (_a) {\n var trans = _a.trans,\n key = _a.key;\n return new Promise(function (resolve, reject) {\n resolve = wrap(resolve);\n var store = trans.objectStore(tableName);\n var req = store.get(key);\n req.onsuccess = function (event) {\n return resolve(event.target.result);\n };\n req.onerror = eventRejectHandler(reject);\n });\n },\n query: query(hasGetAll),\n openCursor: openCursor,\n count: function (_a) {\n var query = _a.query,\n trans = _a.trans;\n var index = query.index,\n range = query.range;\n return new Promise(function (resolve, reject) {\n var store = trans.objectStore(tableName);\n var source = index.isPrimaryKey ? store : store.index(index.name);\n var idbKeyRange = makeIDBKeyRange(range);\n var req = idbKeyRange ? source.count(idbKeyRange) : source.count();\n req.onsuccess = wrap(function (ev) {\n return resolve(ev.target.result);\n });\n req.onerror = eventRejectHandler(reject);\n });\n }\n };\n }\n var _a = extractSchema(db, tmpTrans),\n schema = _a.schema,\n hasGetAll = _a.hasGetAll;\n var tables = schema.tables.map(function (tableSchema) {\n return createDbCoreTable(tableSchema);\n });\n var tableMap = {};\n tables.forEach(function (table) {\n return tableMap[table.name] = table;\n });\n return {\n stack: \"dbcore\",\n transaction: db.transaction.bind(db),\n table: function (name) {\n var result = tableMap[name];\n if (!result) throw new Error(\"Table '\".concat(name, \"' not found\"));\n return tableMap[name];\n },\n MIN_KEY: -Infinity,\n MAX_KEY: getMaxKey(IdbKeyRange),\n schema: schema\n };\n }\n function createMiddlewareStack(stackImpl, middlewares) {\n return middlewares.reduce(function (down, _a) {\n var create = _a.create;\n return __assign(__assign({}, down), create(down));\n }, stackImpl);\n }\n function createMiddlewareStacks(middlewares, idbdb, _a, tmpTrans) {\n var IDBKeyRange = _a.IDBKeyRange;\n _a.indexedDB;\n var dbcore = createMiddlewareStack(createDBCore(idbdb, IDBKeyRange, tmpTrans), middlewares.dbcore);\n return {\n dbcore: dbcore\n };\n }\n function generateMiddlewareStacks(db, tmpTrans) {\n var idbdb = tmpTrans.db;\n var stacks = createMiddlewareStacks(db._middlewares, idbdb, db._deps, tmpTrans);\n db.core = stacks.dbcore;\n db.tables.forEach(function (table) {\n var tableName = table.name;\n if (db.core.schema.tables.some(function (tbl) {\n return tbl.name === tableName;\n })) {\n table.core = db.core.table(tableName);\n if (db[tableName] instanceof db.Table) {\n db[tableName].core = table.core;\n }\n }\n });\n }\n function setApiOnPlace(db, objs, tableNames, dbschema) {\n tableNames.forEach(function (tableName) {\n var schema = dbschema[tableName];\n objs.forEach(function (obj) {\n var propDesc = getPropertyDescriptor(obj, tableName);\n if (!propDesc || \"value\" in propDesc && propDesc.value === undefined) {\n if (obj === db.Transaction.prototype || obj instanceof db.Transaction) {\n setProp(obj, tableName, {\n get: function () {\n return this.table(tableName);\n },\n set: function (value) {\n defineProperty(this, tableName, {\n value: value,\n writable: true,\n configurable: true,\n enumerable: true\n });\n }\n });\n } else {\n obj[tableName] = new db.Table(tableName, schema);\n }\n }\n });\n });\n }\n function removeTablesApi(db, objs) {\n objs.forEach(function (obj) {\n for (var key in obj) {\n if (obj[key] instanceof db.Table) delete obj[key];\n }\n });\n }\n function lowerVersionFirst(a, b) {\n return a._cfg.version - b._cfg.version;\n }\n function runUpgraders(db, oldVersion, idbUpgradeTrans, reject) {\n var globalSchema = db._dbSchema;\n if (idbUpgradeTrans.objectStoreNames.contains('$meta') && !globalSchema.$meta) {\n globalSchema.$meta = createTableSchema(\"$meta\", parseIndexSyntax(\"\")[0], []);\n db._storeNames.push('$meta');\n }\n var trans = db._createTransaction('readwrite', db._storeNames, globalSchema);\n trans.create(idbUpgradeTrans);\n trans._completion.catch(reject);\n var rejectTransaction = trans._reject.bind(trans);\n var transless = PSD.transless || PSD;\n newScope(function () {\n PSD.trans = trans;\n PSD.transless = transless;\n if (oldVersion === 0) {\n keys(globalSchema).forEach(function (tableName) {\n createTable(idbUpgradeTrans, tableName, globalSchema[tableName].primKey, globalSchema[tableName].indexes);\n });\n generateMiddlewareStacks(db, idbUpgradeTrans);\n DexiePromise.follow(function () {\n return db.on.populate.fire(trans);\n }).catch(rejectTransaction);\n } else {\n generateMiddlewareStacks(db, idbUpgradeTrans);\n return getExistingVersion(db, trans, oldVersion).then(function (oldVersion) {\n return updateTablesAndIndexes(db, oldVersion, trans, idbUpgradeTrans);\n }).catch(rejectTransaction);\n }\n });\n }\n function patchCurrentVersion(db, idbUpgradeTrans) {\n createMissingTables(db._dbSchema, idbUpgradeTrans);\n if (idbUpgradeTrans.db.version % 10 === 0 && !idbUpgradeTrans.objectStoreNames.contains('$meta')) {\n idbUpgradeTrans.db.createObjectStore('$meta').add(Math.ceil(idbUpgradeTrans.db.version / 10 - 1), 'version');\n }\n var globalSchema = buildGlobalSchema(db, db.idbdb, idbUpgradeTrans);\n adjustToExistingIndexNames(db, db._dbSchema, idbUpgradeTrans);\n var diff = getSchemaDiff(globalSchema, db._dbSchema);\n var _loop_1 = function (tableChange) {\n if (tableChange.change.length || tableChange.recreate) {\n console.warn(\"Unable to patch indexes of table \".concat(tableChange.name, \" because it has changes on the type of index or primary key.\"));\n return {\n value: void 0\n };\n }\n var store = idbUpgradeTrans.objectStore(tableChange.name);\n tableChange.add.forEach(function (idx) {\n if (debug) console.debug(\"Dexie upgrade patch: Creating missing index \".concat(tableChange.name, \".\").concat(idx.src));\n addIndex(store, idx);\n });\n };\n for (var _i = 0, _a = diff.change; _i < _a.length; _i++) {\n var tableChange = _a[_i];\n var state_1 = _loop_1(tableChange);\n if (typeof state_1 === \"object\") return state_1.value;\n }\n }\n function getExistingVersion(db, trans, oldVersion) {\n if (trans.storeNames.includes('$meta')) {\n return trans.table('$meta').get('version').then(function (metaVersion) {\n return metaVersion != null ? metaVersion : oldVersion;\n });\n } else {\n return DexiePromise.resolve(oldVersion);\n }\n }\n function updateTablesAndIndexes(db, oldVersion, trans, idbUpgradeTrans) {\n var queue = [];\n var versions = db._versions;\n var globalSchema = db._dbSchema = buildGlobalSchema(db, db.idbdb, idbUpgradeTrans);\n var versToRun = versions.filter(function (v) {\n return v._cfg.version >= oldVersion;\n });\n if (versToRun.length === 0) {\n return DexiePromise.resolve();\n }\n versToRun.forEach(function (version) {\n queue.push(function () {\n var oldSchema = globalSchema;\n var newSchema = version._cfg.dbschema;\n adjustToExistingIndexNames(db, oldSchema, idbUpgradeTrans);\n adjustToExistingIndexNames(db, newSchema, idbUpgradeTrans);\n globalSchema = db._dbSchema = newSchema;\n var diff = getSchemaDiff(oldSchema, newSchema);\n diff.add.forEach(function (tuple) {\n createTable(idbUpgradeTrans, tuple[0], tuple[1].primKey, tuple[1].indexes);\n });\n diff.change.forEach(function (change) {\n if (change.recreate) {\n throw new exceptions.Upgrade(\"Not yet support for changing primary key\");\n } else {\n var store_1 = idbUpgradeTrans.objectStore(change.name);\n change.add.forEach(function (idx) {\n return addIndex(store_1, idx);\n });\n change.change.forEach(function (idx) {\n store_1.deleteIndex(idx.name);\n addIndex(store_1, idx);\n });\n change.del.forEach(function (idxName) {\n return store_1.deleteIndex(idxName);\n });\n }\n });\n var contentUpgrade = version._cfg.contentUpgrade;\n if (contentUpgrade && version._cfg.version > oldVersion) {\n generateMiddlewareStacks(db, idbUpgradeTrans);\n trans._memoizedTables = {};\n var upgradeSchema_1 = shallowClone(newSchema);\n diff.del.forEach(function (table) {\n upgradeSchema_1[table] = oldSchema[table];\n });\n removeTablesApi(db, [db.Transaction.prototype]);\n setApiOnPlace(db, [db.Transaction.prototype], keys(upgradeSchema_1), upgradeSchema_1);\n trans.schema = upgradeSchema_1;\n var contentUpgradeIsAsync_1 = isAsyncFunction(contentUpgrade);\n if (contentUpgradeIsAsync_1) {\n incrementExpectedAwaits();\n }\n var returnValue_1;\n var promiseFollowed = DexiePromise.follow(function () {\n returnValue_1 = contentUpgrade(trans);\n if (returnValue_1) {\n if (contentUpgradeIsAsync_1) {\n var decrementor = decrementExpectedAwaits.bind(null, null);\n returnValue_1.then(decrementor, decrementor);\n }\n }\n });\n return returnValue_1 && typeof returnValue_1.then === 'function' ? DexiePromise.resolve(returnValue_1) : promiseFollowed.then(function () {\n return returnValue_1;\n });\n }\n });\n queue.push(function (idbtrans) {\n var newSchema = version._cfg.dbschema;\n deleteRemovedTables(newSchema, idbtrans);\n removeTablesApi(db, [db.Transaction.prototype]);\n setApiOnPlace(db, [db.Transaction.prototype], db._storeNames, db._dbSchema);\n trans.schema = db._dbSchema;\n });\n queue.push(function (idbtrans) {\n if (db.idbdb.objectStoreNames.contains('$meta')) {\n if (Math.ceil(db.idbdb.version / 10) === version._cfg.version) {\n db.idbdb.deleteObjectStore('$meta');\n delete db._dbSchema.$meta;\n db._storeNames = db._storeNames.filter(function (name) {\n return name !== '$meta';\n });\n } else {\n idbtrans.objectStore('$meta').put(version._cfg.version, 'version');\n }\n }\n });\n });\n function runQueue() {\n return queue.length ? DexiePromise.resolve(queue.shift()(trans.idbtrans)).then(runQueue) : DexiePromise.resolve();\n }\n return runQueue().then(function () {\n createMissingTables(globalSchema, idbUpgradeTrans);\n });\n }\n function getSchemaDiff(oldSchema, newSchema) {\n var diff = {\n del: [],\n add: [],\n change: []\n };\n var table;\n for (table in oldSchema) {\n if (!newSchema[table]) diff.del.push(table);\n }\n for (table in newSchema) {\n var oldDef = oldSchema[table],\n newDef = newSchema[table];\n if (!oldDef) {\n diff.add.push([table, newDef]);\n } else {\n var change = {\n name: table,\n def: newDef,\n recreate: false,\n del: [],\n add: [],\n change: []\n };\n if ('' + (oldDef.primKey.keyPath || '') !== '' + (newDef.primKey.keyPath || '') || oldDef.primKey.auto !== newDef.primKey.auto) {\n change.recreate = true;\n diff.change.push(change);\n } else {\n var oldIndexes = oldDef.idxByName;\n var newIndexes = newDef.idxByName;\n var idxName = void 0;\n for (idxName in oldIndexes) {\n if (!newIndexes[idxName]) change.del.push(idxName);\n }\n for (idxName in newIndexes) {\n var oldIdx = oldIndexes[idxName],\n newIdx = newIndexes[idxName];\n if (!oldIdx) change.add.push(newIdx);else if (oldIdx.src !== newIdx.src) change.change.push(newIdx);\n }\n if (change.del.length > 0 || change.add.length > 0 || change.change.length > 0) {\n diff.change.push(change);\n }\n }\n }\n }\n return diff;\n }\n function createTable(idbtrans, tableName, primKey, indexes) {\n var store = idbtrans.db.createObjectStore(tableName, primKey.keyPath ? {\n keyPath: primKey.keyPath,\n autoIncrement: primKey.auto\n } : {\n autoIncrement: primKey.auto\n });\n indexes.forEach(function (idx) {\n return addIndex(store, idx);\n });\n return store;\n }\n function createMissingTables(newSchema, idbtrans) {\n keys(newSchema).forEach(function (tableName) {\n if (!idbtrans.db.objectStoreNames.contains(tableName)) {\n if (debug) console.debug('Dexie: Creating missing table', tableName);\n createTable(idbtrans, tableName, newSchema[tableName].primKey, newSchema[tableName].indexes);\n }\n });\n }\n function deleteRemovedTables(newSchema, idbtrans) {\n [].slice.call(idbtrans.db.objectStoreNames).forEach(function (storeName) {\n return newSchema[storeName] == null && idbtrans.db.deleteObjectStore(storeName);\n });\n }\n function addIndex(store, idx) {\n store.createIndex(idx.name, idx.keyPath, {\n unique: idx.unique,\n multiEntry: idx.multi\n });\n }\n function buildGlobalSchema(db, idbdb, tmpTrans) {\n var globalSchema = {};\n var dbStoreNames = slice(idbdb.objectStoreNames, 0);\n dbStoreNames.forEach(function (storeName) {\n var store = tmpTrans.objectStore(storeName);\n var keyPath = store.keyPath;\n var primKey = createIndexSpec(nameFromKeyPath(keyPath), keyPath || \"\", true, false, !!store.autoIncrement, keyPath && typeof keyPath !== \"string\", true);\n var indexes = [];\n for (var j = 0; j < store.indexNames.length; ++j) {\n var idbindex = store.index(store.indexNames[j]);\n keyPath = idbindex.keyPath;\n var index = createIndexSpec(idbindex.name, keyPath, !!idbindex.unique, !!idbindex.multiEntry, false, keyPath && typeof keyPath !== \"string\", false);\n indexes.push(index);\n }\n globalSchema[storeName] = createTableSchema(storeName, primKey, indexes);\n });\n return globalSchema;\n }\n function readGlobalSchema(db, idbdb, tmpTrans) {\n db.verno = idbdb.version / 10;\n var globalSchema = db._dbSchema = buildGlobalSchema(db, idbdb, tmpTrans);\n db._storeNames = slice(idbdb.objectStoreNames, 0);\n setApiOnPlace(db, [db._allTables], keys(globalSchema), globalSchema);\n }\n function verifyInstalledSchema(db, tmpTrans) {\n var installedSchema = buildGlobalSchema(db, db.idbdb, tmpTrans);\n var diff = getSchemaDiff(installedSchema, db._dbSchema);\n return !(diff.add.length || diff.change.some(function (ch) {\n return ch.add.length || ch.change.length;\n }));\n }\n function adjustToExistingIndexNames(db, schema, idbtrans) {\n var storeNames = idbtrans.db.objectStoreNames;\n for (var i = 0; i < storeNames.length; ++i) {\n var storeName = storeNames[i];\n var store = idbtrans.objectStore(storeName);\n db._hasGetAll = 'getAll' in store;\n for (var j = 0; j < store.indexNames.length; ++j) {\n var indexName = store.indexNames[j];\n var keyPath = store.index(indexName).keyPath;\n var dexieName = typeof keyPath === 'string' ? keyPath : \"[\" + slice(keyPath).join('+') + \"]\";\n if (schema[storeName]) {\n var indexSpec = schema[storeName].idxByName[dexieName];\n if (indexSpec) {\n indexSpec.name = indexName;\n delete schema[storeName].idxByName[dexieName];\n schema[storeName].idxByName[indexName] = indexSpec;\n }\n }\n }\n }\n if (typeof navigator !== 'undefined' && /Safari/.test(navigator.userAgent) && !/(Chrome\\/|Edge\\/)/.test(navigator.userAgent) && _global.WorkerGlobalScope && _global instanceof _global.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\\/(\\d*)/))[1] < 604) {\n db._hasGetAll = false;\n }\n }\n function parseIndexSyntax(primKeyAndIndexes) {\n return primKeyAndIndexes.split(',').map(function (index, indexNum) {\n index = index.trim();\n var name = index.replace(/([&*]|\\+\\+)/g, \"\");\n var keyPath = /^\\[/.test(name) ? name.match(/^\\[(.*)\\]$/)[1].split('+') : name;\n return createIndexSpec(name, keyPath || null, /\\&/.test(index), /\\*/.test(index), /\\+\\+/.test(index), isArray(keyPath), indexNum === 0);\n });\n }\n var Version = function () {\n function Version() {}\n Version.prototype._parseStoresSpec = function (stores, outSchema) {\n keys(stores).forEach(function (tableName) {\n if (stores[tableName] !== null) {\n var indexes = parseIndexSyntax(stores[tableName]);\n var primKey = indexes.shift();\n primKey.unique = true;\n if (primKey.multi) throw new exceptions.Schema(\"Primary key cannot be multi-valued\");\n indexes.forEach(function (idx) {\n if (idx.auto) throw new exceptions.Schema(\"Only primary key can be marked as autoIncrement (++)\");\n if (!idx.keyPath) throw new exceptions.Schema(\"Index must have a name and cannot be an empty string\");\n });\n outSchema[tableName] = createTableSchema(tableName, primKey, indexes);\n }\n });\n };\n Version.prototype.stores = function (stores) {\n var db = this.db;\n this._cfg.storesSource = this._cfg.storesSource ? extend(this._cfg.storesSource, stores) : stores;\n var versions = db._versions;\n var storesSpec = {};\n var dbschema = {};\n versions.forEach(function (version) {\n extend(storesSpec, version._cfg.storesSource);\n dbschema = version._cfg.dbschema = {};\n version._parseStoresSpec(storesSpec, dbschema);\n });\n db._dbSchema = dbschema;\n removeTablesApi(db, [db._allTables, db, db.Transaction.prototype]);\n setApiOnPlace(db, [db._allTables, db, db.Transaction.prototype, this._cfg.tables], keys(dbschema), dbschema);\n db._storeNames = keys(dbschema);\n return this;\n };\n Version.prototype.upgrade = function (upgradeFunction) {\n this._cfg.contentUpgrade = promisableChain(this._cfg.contentUpgrade || nop, upgradeFunction);\n return this;\n };\n return Version;\n }();\n function createVersionConstructor(db) {\n return makeClassConstructor(Version.prototype, function Version(versionNumber) {\n this.db = db;\n this._cfg = {\n version: versionNumber,\n storesSource: null,\n dbschema: {},\n tables: {},\n contentUpgrade: null\n };\n });\n }\n function getDbNamesTable(indexedDB, IDBKeyRange) {\n var dbNamesDB = indexedDB[\"_dbNamesDB\"];\n if (!dbNamesDB) {\n dbNamesDB = indexedDB[\"_dbNamesDB\"] = new Dexie$1(DBNAMES_DB, {\n addons: [],\n indexedDB: indexedDB,\n IDBKeyRange: IDBKeyRange\n });\n dbNamesDB.version(1).stores({\n dbnames: \"name\"\n });\n }\n return dbNamesDB.table(\"dbnames\");\n }\n function hasDatabasesNative(indexedDB) {\n return indexedDB && typeof indexedDB.databases === \"function\";\n }\n function getDatabaseNames(_a) {\n var indexedDB = _a.indexedDB,\n IDBKeyRange = _a.IDBKeyRange;\n return hasDatabasesNative(indexedDB) ? Promise.resolve(indexedDB.databases()).then(function (infos) {\n return infos.map(function (info) {\n return info.name;\n }).filter(function (name) {\n return name !== DBNAMES_DB;\n });\n }) : getDbNamesTable(indexedDB, IDBKeyRange).toCollection().primaryKeys();\n }\n function _onDatabaseCreated(_a, name) {\n var indexedDB = _a.indexedDB,\n IDBKeyRange = _a.IDBKeyRange;\n !hasDatabasesNative(indexedDB) && name !== DBNAMES_DB && getDbNamesTable(indexedDB, IDBKeyRange).put({\n name: name\n }).catch(nop);\n }\n function _onDatabaseDeleted(_a, name) {\n var indexedDB = _a.indexedDB,\n IDBKeyRange = _a.IDBKeyRange;\n !hasDatabasesNative(indexedDB) && name !== DBNAMES_DB && getDbNamesTable(indexedDB, IDBKeyRange).delete(name).catch(nop);\n }\n function vip(fn) {\n return newScope(function () {\n PSD.letThrough = true;\n return fn();\n });\n }\n function idbReady() {\n var isSafari = !navigator.userAgentData && /Safari\\//.test(navigator.userAgent) && !/Chrom(e|ium)\\//.test(navigator.userAgent);\n if (!isSafari || !indexedDB.databases) return Promise.resolve();\n var intervalId;\n return new Promise(function (resolve) {\n var tryIdb = function () {\n return indexedDB.databases().finally(resolve);\n };\n intervalId = setInterval(tryIdb, 100);\n tryIdb();\n }).finally(function () {\n return clearInterval(intervalId);\n });\n }\n var _a;\n function isEmptyRange(node) {\n return !(\"from\" in node);\n }\n var RangeSet = function (fromOrTree, to) {\n if (this) {\n extend(this, arguments.length ? {\n d: 1,\n from: fromOrTree,\n to: arguments.length > 1 ? to : fromOrTree\n } : {\n d: 0\n });\n } else {\n var rv = new RangeSet();\n if (fromOrTree && \"d\" in fromOrTree) {\n extend(rv, fromOrTree);\n }\n return rv;\n }\n };\n props(RangeSet.prototype, (_a = {\n add: function (rangeSet) {\n mergeRanges(this, rangeSet);\n return this;\n },\n addKey: function (key) {\n addRange(this, key, key);\n return this;\n },\n addKeys: function (keys) {\n var _this = this;\n keys.forEach(function (key) {\n return addRange(_this, key, key);\n });\n return this;\n },\n hasKey: function (key) {\n var node = getRangeSetIterator(this).next(key).value;\n return node && cmp(node.from, key) <= 0 && cmp(node.to, key) >= 0;\n }\n }, _a[iteratorSymbol] = function () {\n return getRangeSetIterator(this);\n }, _a));\n function addRange(target, from, to) {\n var diff = cmp(from, to);\n if (isNaN(diff)) return;\n if (diff > 0) throw RangeError();\n if (isEmptyRange(target)) return extend(target, {\n from: from,\n to: to,\n d: 1\n });\n var left = target.l;\n var right = target.r;\n if (cmp(to, target.from) < 0) {\n left ? addRange(left, from, to) : target.l = {\n from: from,\n to: to,\n d: 1,\n l: null,\n r: null\n };\n return rebalance(target);\n }\n if (cmp(from, target.to) > 0) {\n right ? addRange(right, from, to) : target.r = {\n from: from,\n to: to,\n d: 1,\n l: null,\n r: null\n };\n return rebalance(target);\n }\n if (cmp(from, target.from) < 0) {\n target.from = from;\n target.l = null;\n target.d = right ? right.d + 1 : 1;\n }\n if (cmp(to, target.to) > 0) {\n target.to = to;\n target.r = null;\n target.d = target.l ? target.l.d + 1 : 1;\n }\n var rightWasCutOff = !target.r;\n if (left && !target.l) {\n mergeRanges(target, left);\n }\n if (right && rightWasCutOff) {\n mergeRanges(target, right);\n }\n }\n function mergeRanges(target, newSet) {\n function _addRangeSet(target, _a) {\n var from = _a.from,\n to = _a.to,\n l = _a.l,\n r = _a.r;\n addRange(target, from, to);\n if (l) _addRangeSet(target, l);\n if (r) _addRangeSet(target, r);\n }\n if (!isEmptyRange(newSet)) _addRangeSet(target, newSet);\n }\n function rangesOverlap(rangeSet1, rangeSet2) {\n var i1 = getRangeSetIterator(rangeSet2);\n var nextResult1 = i1.next();\n if (nextResult1.done) return false;\n var a = nextResult1.value;\n var i2 = getRangeSetIterator(rangeSet1);\n var nextResult2 = i2.next(a.from);\n var b = nextResult2.value;\n while (!nextResult1.done && !nextResult2.done) {\n if (cmp(b.from, a.to) <= 0 && cmp(b.to, a.from) >= 0) return true;\n cmp(a.from, b.from) < 0 ? a = (nextResult1 = i1.next(b.from)).value : b = (nextResult2 = i2.next(a.from)).value;\n }\n return false;\n }\n function getRangeSetIterator(node) {\n var state = isEmptyRange(node) ? null : {\n s: 0,\n n: node\n };\n return {\n next: function (key) {\n var keyProvided = arguments.length > 0;\n while (state) {\n switch (state.s) {\n case 0:\n state.s = 1;\n if (keyProvided) {\n while (state.n.l && cmp(key, state.n.from) < 0) state = {\n up: state,\n n: state.n.l,\n s: 1\n };\n } else {\n while (state.n.l) state = {\n up: state,\n n: state.n.l,\n s: 1\n };\n }\n case 1:\n state.s = 2;\n if (!keyProvided || cmp(key, state.n.to) <= 0) return {\n value: state.n,\n done: false\n };\n case 2:\n if (state.n.r) {\n state.s = 3;\n state = {\n up: state,\n n: state.n.r,\n s: 0\n };\n continue;\n }\n case 3:\n state = state.up;\n }\n }\n return {\n done: true\n };\n }\n };\n }\n function rebalance(target) {\n var _a, _b;\n var diff = (((_a = target.r) === null || _a === void 0 ? void 0 : _a.d) || 0) - (((_b = target.l) === null || _b === void 0 ? void 0 : _b.d) || 0);\n var r = diff > 1 ? \"r\" : diff < -1 ? \"l\" : \"\";\n if (r) {\n var l = r === \"r\" ? \"l\" : \"r\";\n var rootClone = __assign({}, target);\n var oldRootRight = target[r];\n target.from = oldRootRight.from;\n target.to = oldRootRight.to;\n target[r] = oldRootRight[r];\n rootClone[r] = oldRootRight[l];\n target[l] = rootClone;\n rootClone.d = computeDepth(rootClone);\n }\n target.d = computeDepth(target);\n }\n function computeDepth(_a) {\n var r = _a.r,\n l = _a.l;\n return (r ? l ? Math.max(r.d, l.d) : r.d : l ? l.d : 0) + 1;\n }\n function extendObservabilitySet(target, newSet) {\n keys(newSet).forEach(function (part) {\n if (target[part]) mergeRanges(target[part], newSet[part]);else target[part] = cloneSimpleObjectTree(newSet[part]);\n });\n return target;\n }\n function obsSetsOverlap(os1, os2) {\n return os1.all || os2.all || Object.keys(os1).some(function (key) {\n return os2[key] && rangesOverlap(os2[key], os1[key]);\n });\n }\n var cache = {};\n var unsignaledParts = {};\n var isTaskEnqueued = false;\n function signalSubscribersLazily(part, optimistic) {\n extendObservabilitySet(unsignaledParts, part);\n if (!isTaskEnqueued) {\n isTaskEnqueued = true;\n setTimeout(function () {\n isTaskEnqueued = false;\n var parts = unsignaledParts;\n unsignaledParts = {};\n signalSubscribersNow(parts, false);\n }, 0);\n }\n }\n function signalSubscribersNow(updatedParts, deleteAffectedCacheEntries) {\n if (deleteAffectedCacheEntries === void 0) {\n deleteAffectedCacheEntries = false;\n }\n var queriesToSignal = new Set();\n if (updatedParts.all) {\n for (var _i = 0, _a = Object.values(cache); _i < _a.length; _i++) {\n var tblCache = _a[_i];\n collectTableSubscribers(tblCache, updatedParts, queriesToSignal, deleteAffectedCacheEntries);\n }\n } else {\n for (var key in updatedParts) {\n var parts = /^idb\\:\\/\\/(.*)\\/(.*)\\//.exec(key);\n if (parts) {\n var dbName = parts[1],\n tableName = parts[2];\n var tblCache = cache[\"idb://\".concat(dbName, \"/\").concat(tableName)];\n if (tblCache) collectTableSubscribers(tblCache, updatedParts, queriesToSignal, deleteAffectedCacheEntries);\n }\n }\n }\n queriesToSignal.forEach(function (requery) {\n return requery();\n });\n }\n function collectTableSubscribers(tblCache, updatedParts, outQueriesToSignal, deleteAffectedCacheEntries) {\n var updatedEntryLists = [];\n for (var _i = 0, _a = Object.entries(tblCache.queries.query); _i < _a.length; _i++) {\n var _b = _a[_i],\n indexName = _b[0],\n entries = _b[1];\n var filteredEntries = [];\n for (var _c = 0, entries_1 = entries; _c < entries_1.length; _c++) {\n var entry = entries_1[_c];\n if (obsSetsOverlap(updatedParts, entry.obsSet)) {\n entry.subscribers.forEach(function (requery) {\n return outQueriesToSignal.add(requery);\n });\n } else if (deleteAffectedCacheEntries) {\n filteredEntries.push(entry);\n }\n }\n if (deleteAffectedCacheEntries) updatedEntryLists.push([indexName, filteredEntries]);\n }\n if (deleteAffectedCacheEntries) {\n for (var _d = 0, updatedEntryLists_1 = updatedEntryLists; _d < updatedEntryLists_1.length; _d++) {\n var _e = updatedEntryLists_1[_d],\n indexName = _e[0],\n filteredEntries = _e[1];\n tblCache.queries.query[indexName] = filteredEntries;\n }\n }\n }\n function dexieOpen(db) {\n var state = db._state;\n var indexedDB = db._deps.indexedDB;\n if (state.isBeingOpened || db.idbdb) return state.dbReadyPromise.then(function () {\n return state.dbOpenError ? rejection(state.dbOpenError) : db;\n });\n state.isBeingOpened = true;\n state.dbOpenError = null;\n state.openComplete = false;\n var openCanceller = state.openCanceller;\n var nativeVerToOpen = Math.round(db.verno * 10);\n var schemaPatchMode = false;\n function throwIfCancelled() {\n if (state.openCanceller !== openCanceller) throw new exceptions.DatabaseClosed('db.open() was cancelled');\n }\n var resolveDbReady = state.dbReadyResolve,\n upgradeTransaction = null,\n wasCreated = false;\n var tryOpenDB = function () {\n return new DexiePromise(function (resolve, reject) {\n throwIfCancelled();\n if (!indexedDB) throw new exceptions.MissingAPI();\n var dbName = db.name;\n var req = state.autoSchema || !nativeVerToOpen ? indexedDB.open(dbName) : indexedDB.open(dbName, nativeVerToOpen);\n if (!req) throw new exceptions.MissingAPI();\n req.onerror = eventRejectHandler(reject);\n req.onblocked = wrap(db._fireOnBlocked);\n req.onupgradeneeded = wrap(function (e) {\n upgradeTransaction = req.transaction;\n if (state.autoSchema && !db._options.allowEmptyDB) {\n req.onerror = preventDefault;\n upgradeTransaction.abort();\n req.result.close();\n var delreq = indexedDB.deleteDatabase(dbName);\n delreq.onsuccess = delreq.onerror = wrap(function () {\n reject(new exceptions.NoSuchDatabase(\"Database \".concat(dbName, \" doesnt exist\")));\n });\n } else {\n upgradeTransaction.onerror = eventRejectHandler(reject);\n var oldVer = e.oldVersion > Math.pow(2, 62) ? 0 : e.oldVersion;\n wasCreated = oldVer < 1;\n db.idbdb = req.result;\n if (schemaPatchMode) {\n patchCurrentVersion(db, upgradeTransaction);\n }\n runUpgraders(db, oldVer / 10, upgradeTransaction, reject);\n }\n }, reject);\n req.onsuccess = wrap(function () {\n upgradeTransaction = null;\n var idbdb = db.idbdb = req.result;\n var objectStoreNames = slice(idbdb.objectStoreNames);\n if (objectStoreNames.length > 0) try {\n var tmpTrans = idbdb.transaction(safariMultiStoreFix(objectStoreNames), 'readonly');\n if (state.autoSchema) readGlobalSchema(db, idbdb, tmpTrans);else {\n adjustToExistingIndexNames(db, db._dbSchema, tmpTrans);\n if (!verifyInstalledSchema(db, tmpTrans) && !schemaPatchMode) {\n console.warn(\"Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this.\");\n idbdb.close();\n nativeVerToOpen = idbdb.version + 1;\n schemaPatchMode = true;\n return resolve(tryOpenDB());\n }\n }\n generateMiddlewareStacks(db, tmpTrans);\n } catch (e) {}\n connections.push(db);\n idbdb.onversionchange = wrap(function (ev) {\n state.vcFired = true;\n db.on(\"versionchange\").fire(ev);\n });\n idbdb.onclose = wrap(function (ev) {\n db.on(\"close\").fire(ev);\n });\n if (wasCreated) _onDatabaseCreated(db._deps, dbName);\n resolve();\n }, reject);\n }).catch(function (err) {\n switch (err === null || err === void 0 ? void 0 : err.name) {\n case \"UnknownError\":\n if (state.PR1398_maxLoop > 0) {\n state.PR1398_maxLoop--;\n console.warn('Dexie: Workaround for Chrome UnknownError on open()');\n return tryOpenDB();\n }\n break;\n case \"VersionError\":\n if (nativeVerToOpen > 0) {\n nativeVerToOpen = 0;\n return tryOpenDB();\n }\n break;\n }\n return DexiePromise.reject(err);\n });\n };\n return DexiePromise.race([openCanceller, (typeof navigator === 'undefined' ? DexiePromise.resolve() : idbReady()).then(tryOpenDB)]).then(function () {\n throwIfCancelled();\n state.onReadyBeingFired = [];\n return DexiePromise.resolve(vip(function () {\n return db.on.ready.fire(db.vip);\n })).then(function fireRemainders() {\n if (state.onReadyBeingFired.length > 0) {\n var remainders_1 = state.onReadyBeingFired.reduce(promisableChain, nop);\n state.onReadyBeingFired = [];\n return DexiePromise.resolve(vip(function () {\n return remainders_1(db.vip);\n })).then(fireRemainders);\n }\n });\n }).finally(function () {\n if (state.openCanceller === openCanceller) {\n state.onReadyBeingFired = null;\n state.isBeingOpened = false;\n }\n }).catch(function (err) {\n state.dbOpenError = err;\n try {\n upgradeTransaction && upgradeTransaction.abort();\n } catch (_a) {}\n if (openCanceller === state.openCanceller) {\n db._close();\n }\n return rejection(err);\n }).finally(function () {\n state.openComplete = true;\n resolveDbReady();\n }).then(function () {\n if (wasCreated) {\n var everything_1 = {};\n db.tables.forEach(function (table) {\n table.schema.indexes.forEach(function (idx) {\n if (idx.name) everything_1[\"idb://\".concat(db.name, \"/\").concat(table.name, \"/\").concat(idx.name)] = new RangeSet(-Infinity, [[[]]]);\n });\n everything_1[\"idb://\".concat(db.name, \"/\").concat(table.name, \"/\")] = everything_1[\"idb://\".concat(db.name, \"/\").concat(table.name, \"/:dels\")] = new RangeSet(-Infinity, [[[]]]);\n });\n globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME).fire(everything_1);\n signalSubscribersNow(everything_1, true);\n }\n return db;\n });\n }\n function awaitIterator(iterator) {\n var callNext = function (result) {\n return iterator.next(result);\n },\n doThrow = function (error) {\n return iterator.throw(error);\n },\n onSuccess = step(callNext),\n onError = step(doThrow);\n function step(getNext) {\n return function (val) {\n var next = getNext(val),\n value = next.value;\n return next.done ? value : !value || typeof value.then !== 'function' ? isArray(value) ? Promise.all(value).then(onSuccess, onError) : onSuccess(value) : value.then(onSuccess, onError);\n };\n }\n return step(callNext)();\n }\n function extractTransactionArgs(mode, _tableArgs_, scopeFunc) {\n var i = arguments.length;\n if (i < 2) throw new exceptions.InvalidArgument(\"Too few arguments\");\n var args = new Array(i - 1);\n while (--i) args[i - 1] = arguments[i];\n scopeFunc = args.pop();\n var tables = flatten(args);\n return [mode, tables, scopeFunc];\n }\n function enterTransactionScope(db, mode, storeNames, parentTransaction, scopeFunc) {\n return DexiePromise.resolve().then(function () {\n var transless = PSD.transless || PSD;\n var trans = db._createTransaction(mode, storeNames, db._dbSchema, parentTransaction);\n trans.explicit = true;\n var zoneProps = {\n trans: trans,\n transless: transless\n };\n if (parentTransaction) {\n trans.idbtrans = parentTransaction.idbtrans;\n } else {\n try {\n trans.create();\n trans.idbtrans._explicit = true;\n db._state.PR1398_maxLoop = 3;\n } catch (ex) {\n if (ex.name === errnames.InvalidState && db.isOpen() && --db._state.PR1398_maxLoop > 0) {\n console.warn('Dexie: Need to reopen db');\n db.close({\n disableAutoOpen: false\n });\n return db.open().then(function () {\n return enterTransactionScope(db, mode, storeNames, null, scopeFunc);\n });\n }\n return rejection(ex);\n }\n }\n var scopeFuncIsAsync = isAsyncFunction(scopeFunc);\n if (scopeFuncIsAsync) {\n incrementExpectedAwaits();\n }\n var returnValue;\n var promiseFollowed = DexiePromise.follow(function () {\n returnValue = scopeFunc.call(trans, trans);\n if (returnValue) {\n if (scopeFuncIsAsync) {\n var decrementor = decrementExpectedAwaits.bind(null, null);\n returnValue.then(decrementor, decrementor);\n } else if (typeof returnValue.next === 'function' && typeof returnValue.throw === 'function') {\n returnValue = awaitIterator(returnValue);\n }\n }\n }, zoneProps);\n return (returnValue && typeof returnValue.then === 'function' ? DexiePromise.resolve(returnValue).then(function (x) {\n return trans.active ? x : rejection(new exceptions.PrematureCommit(\"Transaction committed too early. See http://bit.ly/2kdckMn\"));\n }) : promiseFollowed.then(function () {\n return returnValue;\n })).then(function (x) {\n if (parentTransaction) trans._resolve();\n return trans._completion.then(function () {\n return x;\n });\n }).catch(function (e) {\n trans._reject(e);\n return rejection(e);\n });\n });\n }\n function pad(a, value, count) {\n var result = isArray(a) ? a.slice() : [a];\n for (var i = 0; i < count; ++i) result.push(value);\n return result;\n }\n function createVirtualIndexMiddleware(down) {\n return __assign(__assign({}, down), {\n table: function (tableName) {\n var table = down.table(tableName);\n var schema = table.schema;\n var indexLookup = {};\n var allVirtualIndexes = [];\n function addVirtualIndexes(keyPath, keyTail, lowLevelIndex) {\n var keyPathAlias = getKeyPathAlias(keyPath);\n var indexList = indexLookup[keyPathAlias] = indexLookup[keyPathAlias] || [];\n var keyLength = keyPath == null ? 0 : typeof keyPath === 'string' ? 1 : keyPath.length;\n var isVirtual = keyTail > 0;\n var virtualIndex = __assign(__assign({}, lowLevelIndex), {\n name: isVirtual ? \"\".concat(keyPathAlias, \"(virtual-from:\").concat(lowLevelIndex.name, \")\") : lowLevelIndex.name,\n lowLevelIndex: lowLevelIndex,\n isVirtual: isVirtual,\n keyTail: keyTail,\n keyLength: keyLength,\n extractKey: getKeyExtractor(keyPath),\n unique: !isVirtual && lowLevelIndex.unique\n });\n indexList.push(virtualIndex);\n if (!virtualIndex.isPrimaryKey) {\n allVirtualIndexes.push(virtualIndex);\n }\n if (keyLength > 1) {\n var virtualKeyPath = keyLength === 2 ? keyPath[0] : keyPath.slice(0, keyLength - 1);\n addVirtualIndexes(virtualKeyPath, keyTail + 1, lowLevelIndex);\n }\n indexList.sort(function (a, b) {\n return a.keyTail - b.keyTail;\n });\n return virtualIndex;\n }\n var primaryKey = addVirtualIndexes(schema.primaryKey.keyPath, 0, schema.primaryKey);\n indexLookup[\":id\"] = [primaryKey];\n for (var _i = 0, _a = schema.indexes; _i < _a.length; _i++) {\n var index = _a[_i];\n addVirtualIndexes(index.keyPath, 0, index);\n }\n function findBestIndex(keyPath) {\n var result = indexLookup[getKeyPathAlias(keyPath)];\n return result && result[0];\n }\n function translateRange(range, keyTail) {\n return {\n type: range.type === 1 ? 2 : range.type,\n lower: pad(range.lower, range.lowerOpen ? down.MAX_KEY : down.MIN_KEY, keyTail),\n lowerOpen: true,\n upper: pad(range.upper, range.upperOpen ? down.MIN_KEY : down.MAX_KEY, keyTail),\n upperOpen: true\n };\n }\n function translateRequest(req) {\n var index = req.query.index;\n return index.isVirtual ? __assign(__assign({}, req), {\n query: {\n index: index.lowLevelIndex,\n range: translateRange(req.query.range, index.keyTail)\n }\n }) : req;\n }\n var result = __assign(__assign({}, table), {\n schema: __assign(__assign({}, schema), {\n primaryKey: primaryKey,\n indexes: allVirtualIndexes,\n getIndexByKeyPath: findBestIndex\n }),\n count: function (req) {\n return table.count(translateRequest(req));\n },\n query: function (req) {\n return table.query(translateRequest(req));\n },\n openCursor: function (req) {\n var _a = req.query.index,\n keyTail = _a.keyTail,\n isVirtual = _a.isVirtual,\n keyLength = _a.keyLength;\n if (!isVirtual) return table.openCursor(req);\n function createVirtualCursor(cursor) {\n function _continue(key) {\n key != null ? cursor.continue(pad(key, req.reverse ? down.MAX_KEY : down.MIN_KEY, keyTail)) : req.unique ? cursor.continue(cursor.key.slice(0, keyLength).concat(req.reverse ? down.MIN_KEY : down.MAX_KEY, keyTail)) : cursor.continue();\n }\n var virtualCursor = Object.create(cursor, {\n continue: {\n value: _continue\n },\n continuePrimaryKey: {\n value: function (key, primaryKey) {\n cursor.continuePrimaryKey(pad(key, down.MAX_KEY, keyTail), primaryKey);\n }\n },\n primaryKey: {\n get: function () {\n return cursor.primaryKey;\n }\n },\n key: {\n get: function () {\n var key = cursor.key;\n return keyLength === 1 ? key[0] : key.slice(0, keyLength);\n }\n },\n value: {\n get: function () {\n return cursor.value;\n }\n }\n });\n return virtualCursor;\n }\n return table.openCursor(translateRequest(req)).then(function (cursor) {\n return cursor && createVirtualCursor(cursor);\n });\n }\n });\n return result;\n }\n });\n }\n var virtualIndexMiddleware = {\n stack: \"dbcore\",\n name: \"VirtualIndexMiddleware\",\n level: 1,\n create: createVirtualIndexMiddleware\n };\n function getObjectDiff(a, b, rv, prfx) {\n rv = rv || {};\n prfx = prfx || '';\n keys(a).forEach(function (prop) {\n if (!hasOwn(b, prop)) {\n rv[prfx + prop] = undefined;\n } else {\n var ap = a[prop],\n bp = b[prop];\n if (typeof ap === 'object' && typeof bp === 'object' && ap && bp) {\n var apTypeName = toStringTag(ap);\n var bpTypeName = toStringTag(bp);\n if (apTypeName !== bpTypeName) {\n rv[prfx + prop] = b[prop];\n } else if (apTypeName === 'Object') {\n getObjectDiff(ap, bp, rv, prfx + prop + '.');\n } else if (ap !== bp) {\n rv[prfx + prop] = b[prop];\n }\n } else if (ap !== bp) rv[prfx + prop] = b[prop];\n }\n });\n keys(b).forEach(function (prop) {\n if (!hasOwn(a, prop)) {\n rv[prfx + prop] = b[prop];\n }\n });\n return rv;\n }\n function getEffectiveKeys(primaryKey, req) {\n if (req.type === 'delete') return req.keys;\n return req.keys || req.values.map(primaryKey.extractKey);\n }\n var hooksMiddleware = {\n stack: \"dbcore\",\n name: \"HooksMiddleware\",\n level: 2,\n create: function (downCore) {\n return __assign(__assign({}, downCore), {\n table: function (tableName) {\n var downTable = downCore.table(tableName);\n var primaryKey = downTable.schema.primaryKey;\n var tableMiddleware = __assign(__assign({}, downTable), {\n mutate: function (req) {\n var dxTrans = PSD.trans;\n var _a = dxTrans.table(tableName).hook,\n deleting = _a.deleting,\n creating = _a.creating,\n updating = _a.updating;\n switch (req.type) {\n case 'add':\n if (creating.fire === nop) break;\n return dxTrans._promise('readwrite', function () {\n return addPutOrDelete(req);\n }, true);\n case 'put':\n if (creating.fire === nop && updating.fire === nop) break;\n return dxTrans._promise('readwrite', function () {\n return addPutOrDelete(req);\n }, true);\n case 'delete':\n if (deleting.fire === nop) break;\n return dxTrans._promise('readwrite', function () {\n return addPutOrDelete(req);\n }, true);\n case 'deleteRange':\n if (deleting.fire === nop) break;\n return dxTrans._promise('readwrite', function () {\n return deleteRange(req);\n }, true);\n }\n return downTable.mutate(req);\n function addPutOrDelete(req) {\n var dxTrans = PSD.trans;\n var keys = req.keys || getEffectiveKeys(primaryKey, req);\n if (!keys) throw new Error(\"Keys missing\");\n req = req.type === 'add' || req.type === 'put' ? __assign(__assign({}, req), {\n keys: keys\n }) : __assign({}, req);\n if (req.type !== 'delete') req.values = __spreadArray([], req.values, true);\n if (req.keys) req.keys = __spreadArray([], req.keys, true);\n return getExistingValues(downTable, req, keys).then(function (existingValues) {\n var contexts = keys.map(function (key, i) {\n var existingValue = existingValues[i];\n var ctx = {\n onerror: null,\n onsuccess: null\n };\n if (req.type === 'delete') {\n deleting.fire.call(ctx, key, existingValue, dxTrans);\n } else if (req.type === 'add' || existingValue === undefined) {\n var generatedPrimaryKey = creating.fire.call(ctx, key, req.values[i], dxTrans);\n if (key == null && generatedPrimaryKey != null) {\n key = generatedPrimaryKey;\n req.keys[i] = key;\n if (!primaryKey.outbound) {\n setByKeyPath(req.values[i], primaryKey.keyPath, key);\n }\n }\n } else {\n var objectDiff = getObjectDiff(existingValue, req.values[i]);\n var additionalChanges_1 = updating.fire.call(ctx, objectDiff, key, existingValue, dxTrans);\n if (additionalChanges_1) {\n var requestedValue_1 = req.values[i];\n Object.keys(additionalChanges_1).forEach(function (keyPath) {\n if (hasOwn(requestedValue_1, keyPath)) {\n requestedValue_1[keyPath] = additionalChanges_1[keyPath];\n } else {\n setByKeyPath(requestedValue_1, keyPath, additionalChanges_1[keyPath]);\n }\n });\n }\n }\n return ctx;\n });\n return downTable.mutate(req).then(function (_a) {\n var failures = _a.failures,\n results = _a.results,\n numFailures = _a.numFailures,\n lastResult = _a.lastResult;\n for (var i = 0; i < keys.length; ++i) {\n var primKey = results ? results[i] : keys[i];\n var ctx = contexts[i];\n if (primKey == null) {\n ctx.onerror && ctx.onerror(failures[i]);\n } else {\n ctx.onsuccess && ctx.onsuccess(req.type === 'put' && existingValues[i] ? req.values[i] : primKey);\n }\n }\n return {\n failures: failures,\n results: results,\n numFailures: numFailures,\n lastResult: lastResult\n };\n }).catch(function (error) {\n contexts.forEach(function (ctx) {\n return ctx.onerror && ctx.onerror(error);\n });\n return Promise.reject(error);\n });\n });\n }\n function deleteRange(req) {\n return deleteNextChunk(req.trans, req.range, 10000);\n }\n function deleteNextChunk(trans, range, limit) {\n return downTable.query({\n trans: trans,\n values: false,\n query: {\n index: primaryKey,\n range: range\n },\n limit: limit\n }).then(function (_a) {\n var result = _a.result;\n return addPutOrDelete({\n type: 'delete',\n keys: result,\n trans: trans\n }).then(function (res) {\n if (res.numFailures > 0) return Promise.reject(res.failures[0]);\n if (result.length < limit) {\n return {\n failures: [],\n numFailures: 0,\n lastResult: undefined\n };\n } else {\n return deleteNextChunk(trans, __assign(__assign({}, range), {\n lower: result[result.length - 1],\n lowerOpen: true\n }), limit);\n }\n });\n });\n }\n }\n });\n return tableMiddleware;\n }\n });\n }\n };\n function getExistingValues(table, req, effectiveKeys) {\n return req.type === \"add\" ? Promise.resolve([]) : table.getMany({\n trans: req.trans,\n keys: effectiveKeys,\n cache: \"immutable\"\n });\n }\n function getFromTransactionCache(keys, cache, clone) {\n try {\n if (!cache) return null;\n if (cache.keys.length < keys.length) return null;\n var result = [];\n for (var i = 0, j = 0; i < cache.keys.length && j < keys.length; ++i) {\n if (cmp(cache.keys[i], keys[j]) !== 0) continue;\n result.push(clone ? deepClone(cache.values[i]) : cache.values[i]);\n ++j;\n }\n return result.length === keys.length ? result : null;\n } catch (_a) {\n return null;\n }\n }\n var cacheExistingValuesMiddleware = {\n stack: \"dbcore\",\n level: -1,\n create: function (core) {\n return {\n table: function (tableName) {\n var table = core.table(tableName);\n return __assign(__assign({}, table), {\n getMany: function (req) {\n if (!req.cache) {\n return table.getMany(req);\n }\n var cachedResult = getFromTransactionCache(req.keys, req.trans[\"_cache\"], req.cache === \"clone\");\n if (cachedResult) {\n return DexiePromise.resolve(cachedResult);\n }\n return table.getMany(req).then(function (res) {\n req.trans[\"_cache\"] = {\n keys: req.keys,\n values: req.cache === \"clone\" ? deepClone(res) : res\n };\n return res;\n });\n },\n mutate: function (req) {\n if (req.type !== \"add\") req.trans[\"_cache\"] = null;\n return table.mutate(req);\n }\n });\n }\n };\n }\n };\n function isCachableContext(ctx, table) {\n return ctx.trans.mode === 'readonly' && !!ctx.subscr && !ctx.trans.explicit && ctx.trans.db._options.cache !== 'disabled' && !table.schema.primaryKey.outbound;\n }\n function isCachableRequest(type, req) {\n switch (type) {\n case 'query':\n return req.values && !req.unique;\n case 'get':\n return false;\n case 'getMany':\n return false;\n case 'count':\n return false;\n case 'openCursor':\n return false;\n }\n }\n var observabilityMiddleware = {\n stack: \"dbcore\",\n level: 0,\n name: \"Observability\",\n create: function (core) {\n var dbName = core.schema.name;\n var FULL_RANGE = new RangeSet(core.MIN_KEY, core.MAX_KEY);\n return __assign(__assign({}, core), {\n transaction: function (stores, mode, options) {\n if (PSD.subscr && mode !== 'readonly') {\n throw new exceptions.ReadOnly(\"Readwrite transaction in liveQuery context. Querier source: \".concat(PSD.querier));\n }\n return core.transaction(stores, mode, options);\n },\n table: function (tableName) {\n var table = core.table(tableName);\n var schema = table.schema;\n var primaryKey = schema.primaryKey,\n indexes = schema.indexes;\n var extractKey = primaryKey.extractKey,\n outbound = primaryKey.outbound;\n var indexesWithAutoIncPK = primaryKey.autoIncrement && indexes.filter(function (index) {\n return index.compound && index.keyPath.includes(primaryKey.keyPath);\n });\n var tableClone = __assign(__assign({}, table), {\n mutate: function (req) {\n var _a, _b;\n var trans = req.trans;\n var mutatedParts = req.mutatedParts || (req.mutatedParts = {});\n var getRangeSet = function (indexName) {\n var part = \"idb://\".concat(dbName, \"/\").concat(tableName, \"/\").concat(indexName);\n return mutatedParts[part] || (mutatedParts[part] = new RangeSet());\n };\n var pkRangeSet = getRangeSet(\"\");\n var delsRangeSet = getRangeSet(\":dels\");\n var type = req.type;\n var _c = req.type === \"deleteRange\" ? [req.range] : req.type === \"delete\" ? [req.keys] : req.values.length < 50 ? [getEffectiveKeys(primaryKey, req).filter(function (id) {\n return id;\n }), req.values] : [],\n keys = _c[0],\n newObjs = _c[1];\n var oldCache = req.trans[\"_cache\"];\n if (isArray(keys)) {\n pkRangeSet.addKeys(keys);\n var oldObjs = type === 'delete' || keys.length === newObjs.length ? getFromTransactionCache(keys, oldCache) : null;\n if (!oldObjs) {\n delsRangeSet.addKeys(keys);\n }\n if (oldObjs || newObjs) {\n trackAffectedIndexes(getRangeSet, schema, oldObjs, newObjs);\n }\n } else if (keys) {\n var range = {\n from: (_a = keys.lower) !== null && _a !== void 0 ? _a : core.MIN_KEY,\n to: (_b = keys.upper) !== null && _b !== void 0 ? _b : core.MAX_KEY\n };\n delsRangeSet.add(range);\n pkRangeSet.add(range);\n } else {\n pkRangeSet.add(FULL_RANGE);\n delsRangeSet.add(FULL_RANGE);\n schema.indexes.forEach(function (idx) {\n return getRangeSet(idx.name).add(FULL_RANGE);\n });\n }\n return table.mutate(req).then(function (res) {\n if (keys && (req.type === 'add' || req.type === 'put')) {\n pkRangeSet.addKeys(res.results);\n if (indexesWithAutoIncPK) {\n indexesWithAutoIncPK.forEach(function (idx) {\n var idxVals = req.values.map(function (v) {\n return idx.extractKey(v);\n });\n var pkPos = idx.keyPath.findIndex(function (prop) {\n return prop === primaryKey.keyPath;\n });\n for (var i = 0, len = res.results.length; i < len; ++i) {\n idxVals[i][pkPos] = res.results[i];\n }\n getRangeSet(idx.name).addKeys(idxVals);\n });\n }\n }\n trans.mutatedParts = extendObservabilitySet(trans.mutatedParts || {}, mutatedParts);\n return res;\n });\n }\n });\n var getRange = function (_a) {\n var _b, _c;\n var _d = _a.query,\n index = _d.index,\n range = _d.range;\n return [index, new RangeSet((_b = range.lower) !== null && _b !== void 0 ? _b : core.MIN_KEY, (_c = range.upper) !== null && _c !== void 0 ? _c : core.MAX_KEY)];\n };\n var readSubscribers = {\n get: function (req) {\n return [primaryKey, new RangeSet(req.key)];\n },\n getMany: function (req) {\n return [primaryKey, new RangeSet().addKeys(req.keys)];\n },\n count: getRange,\n query: getRange,\n openCursor: getRange\n };\n keys(readSubscribers).forEach(function (method) {\n tableClone[method] = function (req) {\n var subscr = PSD.subscr;\n var isLiveQuery = !!subscr;\n var cachable = isCachableContext(PSD, table) && isCachableRequest(method, req);\n var obsSet = cachable ? req.obsSet = {} : subscr;\n if (isLiveQuery) {\n var getRangeSet = function (indexName) {\n var part = \"idb://\".concat(dbName, \"/\").concat(tableName, \"/\").concat(indexName);\n return obsSet[part] || (obsSet[part] = new RangeSet());\n };\n var pkRangeSet_1 = getRangeSet(\"\");\n var delsRangeSet_1 = getRangeSet(\":dels\");\n var _a = readSubscribers[method](req),\n queriedIndex = _a[0],\n queriedRanges = _a[1];\n if (method === 'query' && queriedIndex.isPrimaryKey && !req.values) {\n delsRangeSet_1.add(queriedRanges);\n } else {\n getRangeSet(queriedIndex.name || \"\").add(queriedRanges);\n }\n if (!queriedIndex.isPrimaryKey) {\n if (method === \"count\") {\n delsRangeSet_1.add(FULL_RANGE);\n } else {\n var keysPromise_1 = method === \"query\" && outbound && req.values && table.query(__assign(__assign({}, req), {\n values: false\n }));\n return table[method].apply(this, arguments).then(function (res) {\n if (method === \"query\") {\n if (outbound && req.values) {\n return keysPromise_1.then(function (_a) {\n var resultingKeys = _a.result;\n pkRangeSet_1.addKeys(resultingKeys);\n return res;\n });\n }\n var pKeys = req.values ? res.result.map(extractKey) : res.result;\n if (req.values) {\n pkRangeSet_1.addKeys(pKeys);\n } else {\n delsRangeSet_1.addKeys(pKeys);\n }\n } else if (method === \"openCursor\") {\n var cursor_1 = res;\n var wantValues_1 = req.values;\n return cursor_1 && Object.create(cursor_1, {\n key: {\n get: function () {\n delsRangeSet_1.addKey(cursor_1.primaryKey);\n return cursor_1.key;\n }\n },\n primaryKey: {\n get: function () {\n var pkey = cursor_1.primaryKey;\n delsRangeSet_1.addKey(pkey);\n return pkey;\n }\n },\n value: {\n get: function () {\n wantValues_1 && pkRangeSet_1.addKey(cursor_1.primaryKey);\n return cursor_1.value;\n }\n }\n });\n }\n return res;\n });\n }\n }\n }\n return table[method].apply(this, arguments);\n };\n });\n return tableClone;\n }\n });\n }\n };\n function trackAffectedIndexes(getRangeSet, schema, oldObjs, newObjs) {\n function addAffectedIndex(ix) {\n var rangeSet = getRangeSet(ix.name || \"\");\n function extractKey(obj) {\n return obj != null ? ix.extractKey(obj) : null;\n }\n var addKeyOrKeys = function (key) {\n return ix.multiEntry && isArray(key) ? key.forEach(function (key) {\n return rangeSet.addKey(key);\n }) : rangeSet.addKey(key);\n };\n (oldObjs || newObjs).forEach(function (_, i) {\n var oldKey = oldObjs && extractKey(oldObjs[i]);\n var newKey = newObjs && extractKey(newObjs[i]);\n if (cmp(oldKey, newKey) !== 0) {\n if (oldKey != null) addKeyOrKeys(oldKey);\n if (newKey != null) addKeyOrKeys(newKey);\n }\n });\n }\n schema.indexes.forEach(addAffectedIndex);\n }\n function adjustOptimisticFromFailures(tblCache, req, res) {\n if (res.numFailures === 0) return req;\n if (req.type === 'deleteRange') {\n return null;\n }\n var numBulkOps = req.keys ? req.keys.length : 'values' in req && req.values ? req.values.length : 1;\n if (res.numFailures === numBulkOps) {\n return null;\n }\n var clone = __assign({}, req);\n if (isArray(clone.keys)) {\n clone.keys = clone.keys.filter(function (_, i) {\n return !(i in res.failures);\n });\n }\n if ('values' in clone && isArray(clone.values)) {\n clone.values = clone.values.filter(function (_, i) {\n return !(i in res.failures);\n });\n }\n return clone;\n }\n function isAboveLower(key, range) {\n return range.lower === undefined ? true : range.lowerOpen ? cmp(key, range.lower) > 0 : cmp(key, range.lower) >= 0;\n }\n function isBelowUpper(key, range) {\n return range.upper === undefined ? true : range.upperOpen ? cmp(key, range.upper) < 0 : cmp(key, range.upper) <= 0;\n }\n function isWithinRange(key, range) {\n return isAboveLower(key, range) && isBelowUpper(key, range);\n }\n function applyOptimisticOps(result, req, ops, table, cacheEntry, immutable) {\n if (!ops || ops.length === 0) return result;\n var index = req.query.index;\n var multiEntry = index.multiEntry;\n var queryRange = req.query.range;\n var primaryKey = table.schema.primaryKey;\n var extractPrimKey = primaryKey.extractKey;\n var extractIndex = index.extractKey;\n var extractLowLevelIndex = (index.lowLevelIndex || index).extractKey;\n var finalResult = ops.reduce(function (result, op) {\n var modifedResult = result;\n var includedValues = [];\n if (op.type === 'add' || op.type === 'put') {\n var includedPKs = new RangeSet();\n for (var i = op.values.length - 1; i >= 0; --i) {\n var value = op.values[i];\n var pk = extractPrimKey(value);\n if (includedPKs.hasKey(pk)) continue;\n var key = extractIndex(value);\n if (multiEntry && isArray(key) ? key.some(function (k) {\n return isWithinRange(k, queryRange);\n }) : isWithinRange(key, queryRange)) {\n includedPKs.addKey(pk);\n includedValues.push(value);\n }\n }\n }\n switch (op.type) {\n case 'add':\n {\n var existingKeys_1 = new RangeSet().addKeys(req.values ? result.map(function (v) {\n return extractPrimKey(v);\n }) : result);\n modifedResult = result.concat(req.values ? includedValues.filter(function (v) {\n var key = extractPrimKey(v);\n if (existingKeys_1.hasKey(key)) return false;\n existingKeys_1.addKey(key);\n return true;\n }) : includedValues.map(function (v) {\n return extractPrimKey(v);\n }).filter(function (k) {\n if (existingKeys_1.hasKey(k)) return false;\n existingKeys_1.addKey(k);\n return true;\n }));\n break;\n }\n case 'put':\n {\n var keySet_1 = new RangeSet().addKeys(op.values.map(function (v) {\n return extractPrimKey(v);\n }));\n modifedResult = result.filter(function (item) {\n return !keySet_1.hasKey(req.values ? extractPrimKey(item) : item);\n }).concat(req.values ? includedValues : includedValues.map(function (v) {\n return extractPrimKey(v);\n }));\n break;\n }\n case 'delete':\n var keysToDelete_1 = new RangeSet().addKeys(op.keys);\n modifedResult = result.filter(function (item) {\n return !keysToDelete_1.hasKey(req.values ? extractPrimKey(item) : item);\n });\n break;\n case 'deleteRange':\n var range_1 = op.range;\n modifedResult = result.filter(function (item) {\n return !isWithinRange(extractPrimKey(item), range_1);\n });\n break;\n }\n return modifedResult;\n }, result);\n if (finalResult === result) return result;\n finalResult.sort(function (a, b) {\n return cmp(extractLowLevelIndex(a), extractLowLevelIndex(b)) || cmp(extractPrimKey(a), extractPrimKey(b));\n });\n if (req.limit && req.limit < Infinity) {\n if (finalResult.length > req.limit) {\n finalResult.length = req.limit;\n } else if (result.length === req.limit && finalResult.length < req.limit) {\n cacheEntry.dirty = true;\n }\n }\n return immutable ? Object.freeze(finalResult) : finalResult;\n }\n function areRangesEqual(r1, r2) {\n return cmp(r1.lower, r2.lower) === 0 && cmp(r1.upper, r2.upper) === 0 && !!r1.lowerOpen === !!r2.lowerOpen && !!r1.upperOpen === !!r2.upperOpen;\n }\n function compareLowers(lower1, lower2, lowerOpen1, lowerOpen2) {\n if (lower1 === undefined) return lower2 !== undefined ? -1 : 0;\n if (lower2 === undefined) return 1;\n var c = cmp(lower1, lower2);\n if (c === 0) {\n if (lowerOpen1 && lowerOpen2) return 0;\n if (lowerOpen1) return 1;\n if (lowerOpen2) return -1;\n }\n return c;\n }\n function compareUppers(upper1, upper2, upperOpen1, upperOpen2) {\n if (upper1 === undefined) return upper2 !== undefined ? 1 : 0;\n if (upper2 === undefined) return -1;\n var c = cmp(upper1, upper2);\n if (c === 0) {\n if (upperOpen1 && upperOpen2) return 0;\n if (upperOpen1) return -1;\n if (upperOpen2) return 1;\n }\n return c;\n }\n function isSuperRange(r1, r2) {\n return compareLowers(r1.lower, r2.lower, r1.lowerOpen, r2.lowerOpen) <= 0 && compareUppers(r1.upper, r2.upper, r1.upperOpen, r2.upperOpen) >= 0;\n }\n function findCompatibleQuery(dbName, tableName, type, req) {\n var tblCache = cache[\"idb://\".concat(dbName, \"/\").concat(tableName)];\n if (!tblCache) return [];\n var queries = tblCache.queries[type];\n if (!queries) return [null, false, tblCache, null];\n var indexName = req.query ? req.query.index.name : null;\n var entries = queries[indexName || ''];\n if (!entries) return [null, false, tblCache, null];\n switch (type) {\n case 'query':\n var equalEntry = entries.find(function (entry) {\n return entry.req.limit === req.limit && entry.req.values === req.values && areRangesEqual(entry.req.query.range, req.query.range);\n });\n if (equalEntry) return [equalEntry, true, tblCache, entries];\n var superEntry = entries.find(function (entry) {\n var limit = 'limit' in entry.req ? entry.req.limit : Infinity;\n return limit >= req.limit && (req.values ? entry.req.values : true) && isSuperRange(entry.req.query.range, req.query.range);\n });\n return [superEntry, false, tblCache, entries];\n case 'count':\n var countQuery = entries.find(function (entry) {\n return areRangesEqual(entry.req.query.range, req.query.range);\n });\n return [countQuery, !!countQuery, tblCache, entries];\n }\n }\n function subscribeToCacheEntry(cacheEntry, container, requery, signal) {\n cacheEntry.subscribers.add(requery);\n signal.addEventListener(\"abort\", function () {\n cacheEntry.subscribers.delete(requery);\n if (cacheEntry.subscribers.size === 0) {\n enqueForDeletion(cacheEntry, container);\n }\n });\n }\n function enqueForDeletion(cacheEntry, container) {\n setTimeout(function () {\n if (cacheEntry.subscribers.size === 0) {\n delArrayItem(container, cacheEntry);\n }\n }, 3000);\n }\n var cacheMiddleware = {\n stack: 'dbcore',\n level: 0,\n name: 'Cache',\n create: function (core) {\n var dbName = core.schema.name;\n var coreMW = __assign(__assign({}, core), {\n transaction: function (stores, mode, options) {\n var idbtrans = core.transaction(stores, mode, options);\n if (mode === 'readwrite') {\n var ac_1 = new AbortController();\n var signal = ac_1.signal;\n var endTransaction = function (wasCommitted) {\n return function () {\n ac_1.abort();\n if (mode === 'readwrite') {\n var affectedSubscribers_1 = new Set();\n for (var _i = 0, stores_1 = stores; _i < stores_1.length; _i++) {\n var storeName = stores_1[_i];\n var tblCache = cache[\"idb://\".concat(dbName, \"/\").concat(storeName)];\n if (tblCache) {\n var table = core.table(storeName);\n var ops = tblCache.optimisticOps.filter(function (op) {\n return op.trans === idbtrans;\n });\n if (idbtrans._explicit && wasCommitted && idbtrans.mutatedParts) {\n for (var _a = 0, _b = Object.values(tblCache.queries.query); _a < _b.length; _a++) {\n var entries = _b[_a];\n for (var _c = 0, _d = entries.slice(); _c < _d.length; _c++) {\n var entry = _d[_c];\n if (obsSetsOverlap(entry.obsSet, idbtrans.mutatedParts)) {\n delArrayItem(entries, entry);\n entry.subscribers.forEach(function (requery) {\n return affectedSubscribers_1.add(requery);\n });\n }\n }\n }\n } else if (ops.length > 0) {\n tblCache.optimisticOps = tblCache.optimisticOps.filter(function (op) {\n return op.trans !== idbtrans;\n });\n for (var _e = 0, _f = Object.values(tblCache.queries.query); _e < _f.length; _e++) {\n var entries = _f[_e];\n for (var _g = 0, _h = entries.slice(); _g < _h.length; _g++) {\n var entry = _h[_g];\n if (entry.res != null && idbtrans.mutatedParts) {\n if (wasCommitted && !entry.dirty) {\n var freezeResults = Object.isFrozen(entry.res);\n var modRes = applyOptimisticOps(entry.res, entry.req, ops, table, entry, freezeResults);\n if (entry.dirty) {\n delArrayItem(entries, entry);\n entry.subscribers.forEach(function (requery) {\n return affectedSubscribers_1.add(requery);\n });\n } else if (modRes !== entry.res) {\n entry.res = modRes;\n entry.promise = DexiePromise.resolve({\n result: modRes\n });\n }\n } else {\n if (entry.dirty) {\n delArrayItem(entries, entry);\n }\n entry.subscribers.forEach(function (requery) {\n return affectedSubscribers_1.add(requery);\n });\n }\n }\n }\n }\n }\n }\n }\n affectedSubscribers_1.forEach(function (requery) {\n return requery();\n });\n }\n };\n };\n idbtrans.addEventListener('abort', endTransaction(false), {\n signal: signal\n });\n idbtrans.addEventListener('error', endTransaction(false), {\n signal: signal\n });\n idbtrans.addEventListener('complete', endTransaction(true), {\n signal: signal\n });\n }\n return idbtrans;\n },\n table: function (tableName) {\n var downTable = core.table(tableName);\n var primKey = downTable.schema.primaryKey;\n var tableMW = __assign(__assign({}, downTable), {\n mutate: function (req) {\n var trans = PSD.trans;\n if (primKey.outbound || trans.db._options.cache === 'disabled' || trans.explicit || trans.idbtrans.mode !== 'readwrite') {\n return downTable.mutate(req);\n }\n var tblCache = cache[\"idb://\".concat(dbName, \"/\").concat(tableName)];\n if (!tblCache) return downTable.mutate(req);\n var promise = downTable.mutate(req);\n if ((req.type === 'add' || req.type === 'put') && (req.values.length >= 50 || getEffectiveKeys(primKey, req).some(function (key) {\n return key == null;\n }))) {\n promise.then(function (res) {\n var reqWithResolvedKeys = __assign(__assign({}, req), {\n values: req.values.map(function (value, i) {\n var _a;\n if (res.failures[i]) return value;\n var valueWithKey = ((_a = primKey.keyPath) === null || _a === void 0 ? void 0 : _a.includes('.')) ? deepClone(value) : __assign({}, value);\n setByKeyPath(valueWithKey, primKey.keyPath, res.results[i]);\n return valueWithKey;\n })\n });\n var adjustedReq = adjustOptimisticFromFailures(tblCache, reqWithResolvedKeys, res);\n tblCache.optimisticOps.push(adjustedReq);\n queueMicrotask(function () {\n return req.mutatedParts && signalSubscribersLazily(req.mutatedParts);\n });\n });\n } else {\n tblCache.optimisticOps.push(req);\n req.mutatedParts && signalSubscribersLazily(req.mutatedParts);\n promise.then(function (res) {\n if (res.numFailures > 0) {\n delArrayItem(tblCache.optimisticOps, req);\n var adjustedReq = adjustOptimisticFromFailures(tblCache, req, res);\n if (adjustedReq) {\n tblCache.optimisticOps.push(adjustedReq);\n }\n req.mutatedParts && signalSubscribersLazily(req.mutatedParts);\n }\n });\n promise.catch(function () {\n delArrayItem(tblCache.optimisticOps, req);\n req.mutatedParts && signalSubscribersLazily(req.mutatedParts);\n });\n }\n return promise;\n },\n query: function (req) {\n var _a;\n if (!isCachableContext(PSD, downTable) || !isCachableRequest(\"query\", req)) return downTable.query(req);\n var freezeResults = ((_a = PSD.trans) === null || _a === void 0 ? void 0 : _a.db._options.cache) === 'immutable';\n var _b = PSD,\n requery = _b.requery,\n signal = _b.signal;\n var _c = findCompatibleQuery(dbName, tableName, 'query', req),\n cacheEntry = _c[0],\n exactMatch = _c[1],\n tblCache = _c[2],\n container = _c[3];\n if (cacheEntry && exactMatch) {\n cacheEntry.obsSet = req.obsSet;\n } else {\n var promise = downTable.query(req).then(function (res) {\n var result = res.result;\n if (cacheEntry) cacheEntry.res = result;\n if (freezeResults) {\n for (var i = 0, l = result.length; i < l; ++i) {\n Object.freeze(result[i]);\n }\n Object.freeze(result);\n } else {\n res.result = deepClone(result);\n }\n return res;\n }).catch(function (error) {\n if (container && cacheEntry) delArrayItem(container, cacheEntry);\n return Promise.reject(error);\n });\n cacheEntry = {\n obsSet: req.obsSet,\n promise: promise,\n subscribers: new Set(),\n type: 'query',\n req: req,\n dirty: false\n };\n if (container) {\n container.push(cacheEntry);\n } else {\n container = [cacheEntry];\n if (!tblCache) {\n tblCache = cache[\"idb://\".concat(dbName, \"/\").concat(tableName)] = {\n queries: {\n query: {},\n count: {}\n },\n objs: new Map(),\n optimisticOps: [],\n unsignaledParts: {}\n };\n }\n tblCache.queries.query[req.query.index.name || ''] = container;\n }\n }\n subscribeToCacheEntry(cacheEntry, container, requery, signal);\n return cacheEntry.promise.then(function (res) {\n return {\n result: applyOptimisticOps(res.result, req, tblCache === null || tblCache === void 0 ? void 0 : tblCache.optimisticOps, downTable, cacheEntry, freezeResults)\n };\n });\n }\n });\n return tableMW;\n }\n });\n return coreMW;\n }\n };\n function vipify(target, vipDb) {\n return new Proxy(target, {\n get: function (target, prop, receiver) {\n if (prop === 'db') return vipDb;\n return Reflect.get(target, prop, receiver);\n }\n });\n }\n var Dexie$1 = function () {\n function Dexie(name, options) {\n var _this = this;\n this._middlewares = {};\n this.verno = 0;\n var deps = Dexie.dependencies;\n this._options = options = __assign({\n addons: Dexie.addons,\n autoOpen: true,\n indexedDB: deps.indexedDB,\n IDBKeyRange: deps.IDBKeyRange,\n cache: 'cloned'\n }, options);\n this._deps = {\n indexedDB: options.indexedDB,\n IDBKeyRange: options.IDBKeyRange\n };\n var addons = options.addons;\n this._dbSchema = {};\n this._versions = [];\n this._storeNames = [];\n this._allTables = {};\n this.idbdb = null;\n this._novip = this;\n var state = {\n dbOpenError: null,\n isBeingOpened: false,\n onReadyBeingFired: null,\n openComplete: false,\n dbReadyResolve: nop,\n dbReadyPromise: null,\n cancelOpen: nop,\n openCanceller: null,\n autoSchema: true,\n PR1398_maxLoop: 3,\n autoOpen: options.autoOpen\n };\n state.dbReadyPromise = new DexiePromise(function (resolve) {\n state.dbReadyResolve = resolve;\n });\n state.openCanceller = new DexiePromise(function (_, reject) {\n state.cancelOpen = reject;\n });\n this._state = state;\n this.name = name;\n this.on = Events(this, \"populate\", \"blocked\", \"versionchange\", \"close\", {\n ready: [promisableChain, nop]\n });\n this.on.ready.subscribe = override(this.on.ready.subscribe, function (subscribe) {\n return function (subscriber, bSticky) {\n Dexie.vip(function () {\n var state = _this._state;\n if (state.openComplete) {\n if (!state.dbOpenError) DexiePromise.resolve().then(subscriber);\n if (bSticky) subscribe(subscriber);\n } else if (state.onReadyBeingFired) {\n state.onReadyBeingFired.push(subscriber);\n if (bSticky) subscribe(subscriber);\n } else {\n subscribe(subscriber);\n var db_1 = _this;\n if (!bSticky) subscribe(function unsubscribe() {\n db_1.on.ready.unsubscribe(subscriber);\n db_1.on.ready.unsubscribe(unsubscribe);\n });\n }\n });\n };\n });\n this.Collection = createCollectionConstructor(this);\n this.Table = createTableConstructor(this);\n this.Transaction = createTransactionConstructor(this);\n this.Version = createVersionConstructor(this);\n this.WhereClause = createWhereClauseConstructor(this);\n this.on(\"versionchange\", function (ev) {\n if (ev.newVersion > 0) console.warn(\"Another connection wants to upgrade database '\".concat(_this.name, \"'. Closing db now to resume the upgrade.\"));else console.warn(\"Another connection wants to delete database '\".concat(_this.name, \"'. Closing db now to resume the delete request.\"));\n _this.close({\n disableAutoOpen: false\n });\n });\n this.on(\"blocked\", function (ev) {\n if (!ev.newVersion || ev.newVersion < ev.oldVersion) console.warn(\"Dexie.delete('\".concat(_this.name, \"') was blocked\"));else console.warn(\"Upgrade '\".concat(_this.name, \"' blocked by other connection holding version \").concat(ev.oldVersion / 10));\n });\n this._maxKey = getMaxKey(options.IDBKeyRange);\n this._createTransaction = function (mode, storeNames, dbschema, parentTransaction) {\n return new _this.Transaction(mode, storeNames, dbschema, _this._options.chromeTransactionDurability, parentTransaction);\n };\n this._fireOnBlocked = function (ev) {\n _this.on(\"blocked\").fire(ev);\n connections.filter(function (c) {\n return c.name === _this.name && c !== _this && !c._state.vcFired;\n }).map(function (c) {\n return c.on(\"versionchange\").fire(ev);\n });\n };\n this.use(cacheExistingValuesMiddleware);\n this.use(cacheMiddleware);\n this.use(observabilityMiddleware);\n this.use(virtualIndexMiddleware);\n this.use(hooksMiddleware);\n var vipDB = new Proxy(this, {\n get: function (_, prop, receiver) {\n if (prop === '_vip') return true;\n if (prop === 'table') return function (tableName) {\n return vipify(_this.table(tableName), vipDB);\n };\n var rv = Reflect.get(_, prop, receiver);\n if (rv instanceof Table) return vipify(rv, vipDB);\n if (prop === 'tables') return rv.map(function (t) {\n return vipify(t, vipDB);\n });\n if (prop === '_createTransaction') return function () {\n var tx = rv.apply(this, arguments);\n return vipify(tx, vipDB);\n };\n return rv;\n }\n });\n this.vip = vipDB;\n addons.forEach(function (addon) {\n return addon(_this);\n });\n }\n Dexie.prototype.version = function (versionNumber) {\n if (isNaN(versionNumber) || versionNumber < 0.1) throw new exceptions.Type(\"Given version is not a positive number\");\n versionNumber = Math.round(versionNumber * 10) / 10;\n if (this.idbdb || this._state.isBeingOpened) throw new exceptions.Schema(\"Cannot add version when database is open\");\n this.verno = Math.max(this.verno, versionNumber);\n var versions = this._versions;\n var versionInstance = versions.filter(function (v) {\n return v._cfg.version === versionNumber;\n })[0];\n if (versionInstance) return versionInstance;\n versionInstance = new this.Version(versionNumber);\n versions.push(versionInstance);\n versions.sort(lowerVersionFirst);\n versionInstance.stores({});\n this._state.autoSchema = false;\n return versionInstance;\n };\n Dexie.prototype._whenReady = function (fn) {\n var _this = this;\n return this.idbdb && (this._state.openComplete || PSD.letThrough || this._vip) ? fn() : new DexiePromise(function (resolve, reject) {\n if (_this._state.openComplete) {\n return reject(new exceptions.DatabaseClosed(_this._state.dbOpenError));\n }\n if (!_this._state.isBeingOpened) {\n if (!_this._state.autoOpen) {\n reject(new exceptions.DatabaseClosed());\n return;\n }\n _this.open().catch(nop);\n }\n _this._state.dbReadyPromise.then(resolve, reject);\n }).then(fn);\n };\n Dexie.prototype.use = function (_a) {\n var stack = _a.stack,\n create = _a.create,\n level = _a.level,\n name = _a.name;\n if (name) this.unuse({\n stack: stack,\n name: name\n });\n var middlewares = this._middlewares[stack] || (this._middlewares[stack] = []);\n middlewares.push({\n stack: stack,\n create: create,\n level: level == null ? 10 : level,\n name: name\n });\n middlewares.sort(function (a, b) {\n return a.level - b.level;\n });\n return this;\n };\n Dexie.prototype.unuse = function (_a) {\n var stack = _a.stack,\n name = _a.name,\n create = _a.create;\n if (stack && this._middlewares[stack]) {\n this._middlewares[stack] = this._middlewares[stack].filter(function (mw) {\n return create ? mw.create !== create : name ? mw.name !== name : false;\n });\n }\n return this;\n };\n Dexie.prototype.open = function () {\n var _this = this;\n return usePSD(globalPSD, function () {\n return dexieOpen(_this);\n });\n };\n Dexie.prototype._close = function () {\n var state = this._state;\n var idx = connections.indexOf(this);\n if (idx >= 0) connections.splice(idx, 1);\n if (this.idbdb) {\n try {\n this.idbdb.close();\n } catch (e) {}\n this.idbdb = null;\n }\n if (!state.isBeingOpened) {\n state.dbReadyPromise = new DexiePromise(function (resolve) {\n state.dbReadyResolve = resolve;\n });\n state.openCanceller = new DexiePromise(function (_, reject) {\n state.cancelOpen = reject;\n });\n }\n };\n Dexie.prototype.close = function (_a) {\n var _b = _a === void 0 ? {\n disableAutoOpen: true\n } : _a,\n disableAutoOpen = _b.disableAutoOpen;\n var state = this._state;\n if (disableAutoOpen) {\n if (state.isBeingOpened) {\n state.cancelOpen(new exceptions.DatabaseClosed());\n }\n this._close();\n state.autoOpen = false;\n state.dbOpenError = new exceptions.DatabaseClosed();\n } else {\n this._close();\n state.autoOpen = this._options.autoOpen || state.isBeingOpened;\n state.openComplete = false;\n state.dbOpenError = null;\n }\n };\n Dexie.prototype.delete = function (closeOptions) {\n var _this = this;\n if (closeOptions === void 0) {\n closeOptions = {\n disableAutoOpen: true\n };\n }\n var hasInvalidArguments = arguments.length > 0 && typeof arguments[0] !== 'object';\n var state = this._state;\n return new DexiePromise(function (resolve, reject) {\n var doDelete = function () {\n _this.close(closeOptions);\n var req = _this._deps.indexedDB.deleteDatabase(_this.name);\n req.onsuccess = wrap(function () {\n _onDatabaseDeleted(_this._deps, _this.name);\n resolve();\n });\n req.onerror = eventRejectHandler(reject);\n req.onblocked = _this._fireOnBlocked;\n };\n if (hasInvalidArguments) throw new exceptions.InvalidArgument(\"Invalid closeOptions argument to db.delete()\");\n if (state.isBeingOpened) {\n state.dbReadyPromise.then(doDelete);\n } else {\n doDelete();\n }\n });\n };\n Dexie.prototype.backendDB = function () {\n return this.idbdb;\n };\n Dexie.prototype.isOpen = function () {\n return this.idbdb !== null;\n };\n Dexie.prototype.hasBeenClosed = function () {\n var dbOpenError = this._state.dbOpenError;\n return dbOpenError && dbOpenError.name === 'DatabaseClosed';\n };\n Dexie.prototype.hasFailed = function () {\n return this._state.dbOpenError !== null;\n };\n Dexie.prototype.dynamicallyOpened = function () {\n return this._state.autoSchema;\n };\n Object.defineProperty(Dexie.prototype, \"tables\", {\n get: function () {\n var _this = this;\n return keys(this._allTables).map(function (name) {\n return _this._allTables[name];\n });\n },\n enumerable: false,\n configurable: true\n });\n Dexie.prototype.transaction = function () {\n var args = extractTransactionArgs.apply(this, arguments);\n return this._transaction.apply(this, args);\n };\n Dexie.prototype._transaction = function (mode, tables, scopeFunc) {\n var _this = this;\n var parentTransaction = PSD.trans;\n if (!parentTransaction || parentTransaction.db !== this || mode.indexOf('!') !== -1) parentTransaction = null;\n var onlyIfCompatible = mode.indexOf('?') !== -1;\n mode = mode.replace('!', '').replace('?', '');\n var idbMode, storeNames;\n try {\n storeNames = tables.map(function (table) {\n var storeName = table instanceof _this.Table ? table.name : table;\n if (typeof storeName !== 'string') throw new TypeError(\"Invalid table argument to Dexie.transaction(). Only Table or String are allowed\");\n return storeName;\n });\n if (mode == \"r\" || mode === READONLY) idbMode = READONLY;else if (mode == \"rw\" || mode == READWRITE) idbMode = READWRITE;else throw new exceptions.InvalidArgument(\"Invalid transaction mode: \" + mode);\n if (parentTransaction) {\n if (parentTransaction.mode === READONLY && idbMode === READWRITE) {\n if (onlyIfCompatible) {\n parentTransaction = null;\n } else throw new exceptions.SubTransaction(\"Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY\");\n }\n if (parentTransaction) {\n storeNames.forEach(function (storeName) {\n if (parentTransaction && parentTransaction.storeNames.indexOf(storeName) === -1) {\n if (onlyIfCompatible) {\n parentTransaction = null;\n } else throw new exceptions.SubTransaction(\"Table \" + storeName + \" not included in parent transaction.\");\n }\n });\n }\n if (onlyIfCompatible && parentTransaction && !parentTransaction.active) {\n parentTransaction = null;\n }\n }\n } catch (e) {\n return parentTransaction ? parentTransaction._promise(null, function (_, reject) {\n reject(e);\n }) : rejection(e);\n }\n var enterTransaction = enterTransactionScope.bind(null, this, idbMode, storeNames, parentTransaction, scopeFunc);\n return parentTransaction ? parentTransaction._promise(idbMode, enterTransaction, \"lock\") : PSD.trans ? usePSD(PSD.transless, function () {\n return _this._whenReady(enterTransaction);\n }) : this._whenReady(enterTransaction);\n };\n Dexie.prototype.table = function (tableName) {\n if (!hasOwn(this._allTables, tableName)) {\n throw new exceptions.InvalidTable(\"Table \".concat(tableName, \" does not exist\"));\n }\n return this._allTables[tableName];\n };\n return Dexie;\n }();\n var symbolObservable = typeof Symbol !== \"undefined\" && \"observable\" in Symbol ? Symbol.observable : \"@@observable\";\n var Observable = function () {\n function Observable(subscribe) {\n this._subscribe = subscribe;\n }\n Observable.prototype.subscribe = function (x, error, complete) {\n return this._subscribe(!x || typeof x === \"function\" ? {\n next: x,\n error: error,\n complete: complete\n } : x);\n };\n Observable.prototype[symbolObservable] = function () {\n return this;\n };\n return Observable;\n }();\n var domDeps;\n try {\n domDeps = {\n indexedDB: _global.indexedDB || _global.mozIndexedDB || _global.webkitIndexedDB || _global.msIndexedDB,\n IDBKeyRange: _global.IDBKeyRange || _global.webkitIDBKeyRange\n };\n } catch (e) {\n domDeps = {\n indexedDB: null,\n IDBKeyRange: null\n };\n }\n function liveQuery(querier) {\n var hasValue = false;\n var currentValue;\n var observable = new Observable(function (observer) {\n var scopeFuncIsAsync = isAsyncFunction(querier);\n function execute(ctx) {\n var wasRootExec = beginMicroTickScope();\n try {\n if (scopeFuncIsAsync) {\n incrementExpectedAwaits();\n }\n var rv = newScope(querier, ctx);\n if (scopeFuncIsAsync) {\n rv = rv.finally(decrementExpectedAwaits);\n }\n return rv;\n } finally {\n wasRootExec && endMicroTickScope();\n }\n }\n var closed = false;\n var abortController;\n var accumMuts = {};\n var currentObs = {};\n var subscription = {\n get closed() {\n return closed;\n },\n unsubscribe: function () {\n if (closed) return;\n closed = true;\n if (abortController) abortController.abort();\n if (startedListening) globalEvents.storagemutated.unsubscribe(mutationListener);\n }\n };\n observer.start && observer.start(subscription);\n var startedListening = false;\n var doQuery = function () {\n return execInGlobalContext(_doQuery);\n };\n function shouldNotify() {\n return obsSetsOverlap(currentObs, accumMuts);\n }\n var mutationListener = function (parts) {\n extendObservabilitySet(accumMuts, parts);\n if (shouldNotify()) {\n doQuery();\n }\n };\n var _doQuery = function () {\n if (closed || !domDeps.indexedDB) {\n return;\n }\n accumMuts = {};\n var subscr = {};\n if (abortController) abortController.abort();\n abortController = new AbortController();\n var ctx = {\n subscr: subscr,\n signal: abortController.signal,\n requery: doQuery,\n querier: querier,\n trans: null\n };\n var ret = execute(ctx);\n Promise.resolve(ret).then(function (result) {\n hasValue = true;\n currentValue = result;\n if (closed || ctx.signal.aborted) {\n return;\n }\n accumMuts = {};\n currentObs = subscr;\n if (!objectIsEmpty(currentObs) && !startedListening) {\n globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, mutationListener);\n startedListening = true;\n }\n execInGlobalContext(function () {\n return !closed && observer.next && observer.next(result);\n });\n }, function (err) {\n hasValue = false;\n if (!['DatabaseClosedError', 'AbortError'].includes(err === null || err === void 0 ? void 0 : err.name)) {\n if (!closed) execInGlobalContext(function () {\n if (closed) return;\n observer.error && observer.error(err);\n });\n }\n });\n };\n setTimeout(doQuery, 0);\n return subscription;\n });\n observable.hasValue = function () {\n return hasValue;\n };\n observable.getValue = function () {\n return currentValue;\n };\n return observable;\n }\n var Dexie = Dexie$1;\n props(Dexie, __assign(__assign({}, fullNameExceptions), {\n delete: function (databaseName) {\n var db = new Dexie(databaseName, {\n addons: []\n });\n return db.delete();\n },\n exists: function (name) {\n return new Dexie(name, {\n addons: []\n }).open().then(function (db) {\n db.close();\n return true;\n }).catch('NoSuchDatabaseError', function () {\n return false;\n });\n },\n getDatabaseNames: function (cb) {\n try {\n return getDatabaseNames(Dexie.dependencies).then(cb);\n } catch (_a) {\n return rejection(new exceptions.MissingAPI());\n }\n },\n defineClass: function () {\n function Class(content) {\n extend(this, content);\n }\n return Class;\n },\n ignoreTransaction: function (scopeFunc) {\n return PSD.trans ? usePSD(PSD.transless, scopeFunc) : scopeFunc();\n },\n vip: vip,\n async: function (generatorFn) {\n return function () {\n try {\n var rv = awaitIterator(generatorFn.apply(this, arguments));\n if (!rv || typeof rv.then !== 'function') return DexiePromise.resolve(rv);\n return rv;\n } catch (e) {\n return rejection(e);\n }\n };\n },\n spawn: function (generatorFn, args, thiz) {\n try {\n var rv = awaitIterator(generatorFn.apply(thiz, args || []));\n if (!rv || typeof rv.then !== 'function') return DexiePromise.resolve(rv);\n return rv;\n } catch (e) {\n return rejection(e);\n }\n },\n currentTransaction: {\n get: function () {\n return PSD.trans || null;\n }\n },\n waitFor: function (promiseOrFunction, optionalTimeout) {\n var promise = DexiePromise.resolve(typeof promiseOrFunction === 'function' ? Dexie.ignoreTransaction(promiseOrFunction) : promiseOrFunction).timeout(optionalTimeout || 60000);\n return PSD.trans ? PSD.trans.waitFor(promise) : promise;\n },\n Promise: DexiePromise,\n debug: {\n get: function () {\n return debug;\n },\n set: function (value) {\n setDebug(value);\n }\n },\n derive: derive,\n extend: extend,\n props: props,\n override: override,\n Events: Events,\n on: globalEvents,\n liveQuery: liveQuery,\n extendObservabilitySet: extendObservabilitySet,\n getByKeyPath: getByKeyPath,\n setByKeyPath: setByKeyPath,\n delByKeyPath: delByKeyPath,\n shallowClone: shallowClone,\n deepClone: deepClone,\n getObjectDiff: getObjectDiff,\n cmp: cmp,\n asap: asap$1,\n minKey: minKey,\n addons: [],\n connections: connections,\n errnames: errnames,\n dependencies: domDeps,\n cache: cache,\n semVer: DEXIE_VERSION,\n version: DEXIE_VERSION.split('.').map(function (n) {\n return parseInt(n);\n }).reduce(function (p, c, i) {\n return p + c / Math.pow(10, i * 2);\n })\n }));\n Dexie.maxKey = getMaxKey(Dexie.dependencies.IDBKeyRange);\n if (typeof dispatchEvent !== 'undefined' && typeof addEventListener !== 'undefined') {\n globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, function (updatedParts) {\n if (!propagatingLocally) {\n var event_1;\n event_1 = new CustomEvent(STORAGE_MUTATED_DOM_EVENT_NAME, {\n detail: updatedParts\n });\n propagatingLocally = true;\n dispatchEvent(event_1);\n propagatingLocally = false;\n }\n });\n addEventListener(STORAGE_MUTATED_DOM_EVENT_NAME, function (_a) {\n var detail = _a.detail;\n if (!propagatingLocally) {\n propagateLocally(detail);\n }\n });\n }\n function propagateLocally(updateParts) {\n var wasMe = propagatingLocally;\n try {\n propagatingLocally = true;\n globalEvents.storagemutated.fire(updateParts);\n signalSubscribersNow(updateParts, true);\n } finally {\n propagatingLocally = wasMe;\n }\n }\n var propagatingLocally = false;\n var bc;\n var createBC = function () {};\n if (typeof BroadcastChannel !== 'undefined') {\n createBC = function () {\n bc = new BroadcastChannel(STORAGE_MUTATED_DOM_EVENT_NAME);\n bc.onmessage = function (ev) {\n return ev.data && propagateLocally(ev.data);\n };\n };\n createBC();\n if (typeof bc.unref === 'function') {\n bc.unref();\n }\n globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, function (changedParts) {\n if (!propagatingLocally) {\n bc.postMessage(changedParts);\n }\n });\n }\n if (typeof addEventListener !== 'undefined') {\n addEventListener('pagehide', function (event) {\n if (!Dexie$1.disableBfCache && event.persisted) {\n if (debug) console.debug('Dexie: handling persisted pagehide');\n bc === null || bc === void 0 ? void 0 : bc.close();\n for (var _i = 0, connections_1 = connections; _i < connections_1.length; _i++) {\n var db = connections_1[_i];\n db.close({\n disableAutoOpen: false\n });\n }\n }\n });\n addEventListener('pageshow', function (event) {\n if (!Dexie$1.disableBfCache && event.persisted) {\n if (debug) console.debug('Dexie: handling persisted pageshow');\n createBC();\n propagateLocally({\n all: new RangeSet(-Infinity, [[]])\n });\n }\n });\n }\n function add(value) {\n return new PropModification({\n add: value\n });\n }\n function remove(value) {\n return new PropModification({\n remove: value\n });\n }\n function replacePrefix(a, b) {\n return new PropModification({\n replacePrefix: [a, b]\n });\n }\n DexiePromise.rejectionMapper = mapError;\n setDebug(debug);\n var namedExports = /*#__PURE__*/Object.freeze({\n __proto__: null,\n Dexie: Dexie$1,\n liveQuery: liveQuery,\n Entity: Entity,\n cmp: cmp,\n PropModSymbol: PropModSymbol,\n PropModification: PropModification,\n replacePrefix: replacePrefix,\n add: add,\n remove: remove,\n 'default': Dexie$1,\n RangeSet: RangeSet,\n mergeRanges: mergeRanges,\n rangesOverlap: rangesOverlap\n });\n __assign(Dexie$1, namedExports, {\n default: Dexie$1\n });\n return Dexie$1;\n});\n","/* @preserve\n * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com\n * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.leaflet = {}));\n})(this, function (exports) {\n 'use strict';\n\n var version = \"1.9.4\";\n\n /*\r\n * @namespace Util\r\n *\r\n * Various utility functions, used by Leaflet internally.\r\n */\n\n // @function extend(dest: Object, src?: Object): Object\n // Merges the properties of the `src` object (or multiple objects) into `dest` object and returns the latter. Has an `L.extend` shortcut.\n function extend(dest) {\n var i, j, len, src;\n for (j = 1, len = arguments.length; j < len; j++) {\n src = arguments[j];\n for (i in src) {\n dest[i] = src[i];\n }\n }\n return dest;\n }\n\n // @function create(proto: Object, properties?: Object): Object\n // Compatibility polyfill for [Object.create](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/create)\n var create$2 = Object.create || function () {\n function F() {}\n return function (proto) {\n F.prototype = proto;\n return new F();\n };\n }();\n\n // @function bind(fn: Function, …): Function\n // Returns a new function bound to the arguments passed, like [Function.prototype.bind](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).\n // Has a `L.bind()` shortcut.\n function bind(fn, obj) {\n var slice = Array.prototype.slice;\n if (fn.bind) {\n return fn.bind.apply(fn, slice.call(arguments, 1));\n }\n var args = slice.call(arguments, 2);\n return function () {\n return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments);\n };\n }\n\n // @property lastId: Number\n // Last unique ID used by [`stamp()`](#util-stamp)\n var lastId = 0;\n\n // @function stamp(obj: Object): Number\n // Returns the unique ID of an object, assigning it one if it doesn't have it.\n function stamp(obj) {\n if (!('_leaflet_id' in obj)) {\n obj['_leaflet_id'] = ++lastId;\n }\n return obj._leaflet_id;\n }\n\n // @function throttle(fn: Function, time: Number, context: Object): Function\n // Returns a function which executes function `fn` with the given scope `context`\n // (so that the `this` keyword refers to `context` inside `fn`'s code). The function\n // `fn` will be called no more than one time per given amount of `time`. The arguments\n // received by the bound function will be any arguments passed when binding the\n // function, followed by any arguments passed when invoking the bound function.\n // Has an `L.throttle` shortcut.\n function throttle(fn, time, context) {\n var lock, args, wrapperFn, later;\n later = function () {\n // reset lock and call if queued\n lock = false;\n if (args) {\n wrapperFn.apply(context, args);\n args = false;\n }\n };\n wrapperFn = function () {\n if (lock) {\n // called too soon, queue to call later\n args = arguments;\n } else {\n // call and lock until later\n fn.apply(context, arguments);\n setTimeout(later, time);\n lock = true;\n }\n };\n return wrapperFn;\n }\n\n // @function wrapNum(num: Number, range: Number[], includeMax?: Boolean): Number\n // Returns the number `num` modulo `range` in such a way so it lies within\n // `range[0]` and `range[1]`. The returned value will be always smaller than\n // `range[1]` unless `includeMax` is set to `true`.\n function wrapNum(x, range, includeMax) {\n var max = range[1],\n min = range[0],\n d = max - min;\n return x === max && includeMax ? x : ((x - min) % d + d) % d + min;\n }\n\n // @function falseFn(): Function\n // Returns a function which always returns `false`.\n function falseFn() {\n return false;\n }\n\n // @function formatNum(num: Number, precision?: Number|false): Number\n // Returns the number `num` rounded with specified `precision`.\n // The default `precision` value is 6 decimal places.\n // `false` can be passed to skip any processing (can be useful to avoid round-off errors).\n function formatNum(num, precision) {\n if (precision === false) {\n return num;\n }\n var pow = Math.pow(10, precision === undefined ? 6 : precision);\n return Math.round(num * pow) / pow;\n }\n\n // @function trim(str: String): String\n // Compatibility polyfill for [String.prototype.trim](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)\n function trim(str) {\n return str.trim ? str.trim() : str.replace(/^\\s+|\\s+$/g, '');\n }\n\n // @function splitWords(str: String): String[]\n // Trims and splits the string on whitespace and returns the array of parts.\n function splitWords(str) {\n return trim(str).split(/\\s+/);\n }\n\n // @function setOptions(obj: Object, options: Object): Object\n // Merges the given properties to the `options` of the `obj` object, returning the resulting options. See `Class options`. Has an `L.setOptions` shortcut.\n function setOptions(obj, options) {\n if (!Object.prototype.hasOwnProperty.call(obj, 'options')) {\n obj.options = obj.options ? create$2(obj.options) : {};\n }\n for (var i in options) {\n obj.options[i] = options[i];\n }\n return obj.options;\n }\n\n // @function getParamString(obj: Object, existingUrl?: String, uppercase?: Boolean): String\n // Converts an object into a parameter URL string, e.g. `{a: \"foo\", b: \"bar\"}`\n // translates to `'?a=foo&b=bar'`. If `existingUrl` is set, the parameters will\n // be appended at the end. If `uppercase` is `true`, the parameter names will\n // be uppercased (e.g. `'?A=foo&B=bar'`)\n function getParamString(obj, existingUrl, uppercase) {\n var params = [];\n for (var i in obj) {\n params.push(encodeURIComponent(uppercase ? i.toUpperCase() : i) + '=' + encodeURIComponent(obj[i]));\n }\n return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&');\n }\n var templateRe = /\\{ *([\\w_ -]+) *\\}/g;\n\n // @function template(str: String, data: Object): String\n // Simple templating facility, accepts a template string of the form `'Hello {a}, {b}'`\n // and a data object like `{a: 'foo', b: 'bar'}`, returns evaluated string\n // `('Hello foo, bar')`. You can also specify functions instead of strings for\n // data values — they will be evaluated passing `data` as an argument.\n function template(str, data) {\n return str.replace(templateRe, function (str, key) {\n var value = data[key];\n if (value === undefined) {\n throw new Error('No value provided for variable ' + str);\n } else if (typeof value === 'function') {\n value = value(data);\n }\n return value;\n });\n }\n\n // @function isArray(obj): Boolean\n // Compatibility polyfill for [Array.isArray](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray)\n var isArray = Array.isArray || function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n };\n\n // @function indexOf(array: Array, el: Object): Number\n // Compatibility polyfill for [Array.prototype.indexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)\n function indexOf(array, el) {\n for (var i = 0; i < array.length; i++) {\n if (array[i] === el) {\n return i;\n }\n }\n return -1;\n }\n\n // @property emptyImageUrl: String\n // Data URI string containing a base64-encoded empty GIF image.\n // Used as a hack to free memory from unused images on WebKit-powered\n // mobile devices (by setting image `src` to this string).\n var emptyImageUrl = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';\n\n // inspired by https://paulirish.com/2011/requestanimationframe-for-smart-animating/\n\n function getPrefixed(name) {\n return window['webkit' + name] || window['moz' + name] || window['ms' + name];\n }\n var lastTime = 0;\n\n // fallback for IE 7-8\n function timeoutDefer(fn) {\n var time = +new Date(),\n timeToCall = Math.max(0, 16 - (time - lastTime));\n lastTime = time + timeToCall;\n return window.setTimeout(fn, timeToCall);\n }\n var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer;\n var cancelFn = window.cancelAnimationFrame || getPrefixed('CancelAnimationFrame') || getPrefixed('CancelRequestAnimationFrame') || function (id) {\n window.clearTimeout(id);\n };\n\n // @function requestAnimFrame(fn: Function, context?: Object, immediate?: Boolean): Number\n // Schedules `fn` to be executed when the browser repaints. `fn` is bound to\n // `context` if given. When `immediate` is set, `fn` is called immediately if\n // the browser doesn't have native support for\n // [`window.requestAnimationFrame`](https://developer.mozilla.org/docs/Web/API/window/requestAnimationFrame),\n // otherwise it's delayed. Returns a request ID that can be used to cancel the request.\n function requestAnimFrame(fn, context, immediate) {\n if (immediate && requestFn === timeoutDefer) {\n fn.call(context);\n } else {\n return requestFn.call(window, bind(fn, context));\n }\n }\n\n // @function cancelAnimFrame(id: Number): undefined\n // Cancels a previous `requestAnimFrame`. See also [window.cancelAnimationFrame](https://developer.mozilla.org/docs/Web/API/window/cancelAnimationFrame).\n function cancelAnimFrame(id) {\n if (id) {\n cancelFn.call(window, id);\n }\n }\n var Util = {\n __proto__: null,\n extend: extend,\n create: create$2,\n bind: bind,\n get lastId() {\n return lastId;\n },\n stamp: stamp,\n throttle: throttle,\n wrapNum: wrapNum,\n falseFn: falseFn,\n formatNum: formatNum,\n trim: trim,\n splitWords: splitWords,\n setOptions: setOptions,\n getParamString: getParamString,\n template: template,\n isArray: isArray,\n indexOf: indexOf,\n emptyImageUrl: emptyImageUrl,\n requestFn: requestFn,\n cancelFn: cancelFn,\n requestAnimFrame: requestAnimFrame,\n cancelAnimFrame: cancelAnimFrame\n };\n\n // @class Class\n // @aka L.Class\n\n // @section\n // @uninheritable\n\n // Thanks to John Resig and Dean Edwards for inspiration!\n\n function Class() {}\n Class.extend = function (props) {\n // @function extend(props: Object): Function\n // [Extends the current class](#class-inheritance) given the properties to be included.\n // Returns a Javascript function that is a class constructor (to be called with `new`).\n var NewClass = function () {\n setOptions(this);\n\n // call the constructor\n if (this.initialize) {\n this.initialize.apply(this, arguments);\n }\n\n // call all constructor hooks\n this.callInitHooks();\n };\n var parentProto = NewClass.__super__ = this.prototype;\n var proto = create$2(parentProto);\n proto.constructor = NewClass;\n NewClass.prototype = proto;\n\n // inherit parent's statics\n for (var i in this) {\n if (Object.prototype.hasOwnProperty.call(this, i) && i !== 'prototype' && i !== '__super__') {\n NewClass[i] = this[i];\n }\n }\n\n // mix static properties into the class\n if (props.statics) {\n extend(NewClass, props.statics);\n }\n\n // mix includes into the prototype\n if (props.includes) {\n checkDeprecatedMixinEvents(props.includes);\n extend.apply(null, [proto].concat(props.includes));\n }\n\n // mix given properties into the prototype\n extend(proto, props);\n delete proto.statics;\n delete proto.includes;\n\n // merge options\n if (proto.options) {\n proto.options = parentProto.options ? create$2(parentProto.options) : {};\n extend(proto.options, props.options);\n }\n proto._initHooks = [];\n\n // add method for calling all hooks\n proto.callInitHooks = function () {\n if (this._initHooksCalled) {\n return;\n }\n if (parentProto.callInitHooks) {\n parentProto.callInitHooks.call(this);\n }\n this._initHooksCalled = true;\n for (var i = 0, len = proto._initHooks.length; i < len; i++) {\n proto._initHooks[i].call(this);\n }\n };\n return NewClass;\n };\n\n // @function include(properties: Object): this\n // [Includes a mixin](#class-includes) into the current class.\n Class.include = function (props) {\n var parentOptions = this.prototype.options;\n extend(this.prototype, props);\n if (props.options) {\n this.prototype.options = parentOptions;\n this.mergeOptions(props.options);\n }\n return this;\n };\n\n // @function mergeOptions(options: Object): this\n // [Merges `options`](#class-options) into the defaults of the class.\n Class.mergeOptions = function (options) {\n extend(this.prototype.options, options);\n return this;\n };\n\n // @function addInitHook(fn: Function): this\n // Adds a [constructor hook](#class-constructor-hooks) to the class.\n Class.addInitHook = function (fn) {\n // (Function) || (String, args...)\n var args = Array.prototype.slice.call(arguments, 1);\n var init = typeof fn === 'function' ? fn : function () {\n this[fn].apply(this, args);\n };\n this.prototype._initHooks = this.prototype._initHooks || [];\n this.prototype._initHooks.push(init);\n return this;\n };\n function checkDeprecatedMixinEvents(includes) {\n /* global L: true */\n if (typeof L === 'undefined' || !L || !L.Mixin) {\n return;\n }\n includes = isArray(includes) ? includes : [includes];\n for (var i = 0; i < includes.length; i++) {\n if (includes[i] === L.Mixin.Events) {\n console.warn('Deprecated include of L.Mixin.Events: ' + 'this property will be removed in future releases, ' + 'please inherit from L.Evented instead.', new Error().stack);\n }\n }\n }\n\n /*\r\n * @class Evented\r\n * @aka L.Evented\r\n * @inherits Class\r\n *\r\n * A set of methods shared between event-powered classes (like `Map` and `Marker`). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire `'click'` event).\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * map.on('click', function(e) {\r\n * \talert(e.latlng);\r\n * } );\r\n * ```\r\n *\r\n * Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function:\r\n *\r\n * ```js\r\n * function onClick(e) { ... }\r\n *\r\n * map.on('click', onClick);\r\n * map.off('click', onClick);\r\n * ```\r\n */\n\n var Events = {\n /* @method on(type: String, fn: Function, context?: Object): this\r\n * Adds a listener function (`fn`) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. `'click dblclick'`).\r\n *\r\n * @alternative\r\n * @method on(eventMap: Object): this\r\n * Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`\r\n */\n on: function (types, fn, context) {\n // types can be a map of types/handlers\n if (typeof types === 'object') {\n for (var type in types) {\n // we don't process space-separated events here for performance;\n // it's a hot path since Layer uses the on(obj) syntax\n this._on(type, types[type], fn);\n }\n } else {\n // types can be a string of space-separated words\n types = splitWords(types);\n for (var i = 0, len = types.length; i < len; i++) {\n this._on(types[i], fn, context);\n }\n }\n return this;\n },\n /* @method off(type: String, fn?: Function, context?: Object): this\r\n * Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to `on`, you must pass the same context to `off` in order to remove the listener.\r\n *\r\n * @alternative\r\n * @method off(eventMap: Object): this\r\n * Removes a set of type/listener pairs.\r\n *\r\n * @alternative\r\n * @method off: this\r\n * Removes all listeners to all events on the object. This includes implicitly attached events.\r\n */\n off: function (types, fn, context) {\n if (!arguments.length) {\n // clear all listeners if called without arguments\n delete this._events;\n } else if (typeof types === 'object') {\n for (var type in types) {\n this._off(type, types[type], fn);\n }\n } else {\n types = splitWords(types);\n var removeAll = arguments.length === 1;\n for (var i = 0, len = types.length; i < len; i++) {\n if (removeAll) {\n this._off(types[i]);\n } else {\n this._off(types[i], fn, context);\n }\n }\n }\n return this;\n },\n // attach listener (without syntactic sugar now)\n _on: function (type, fn, context, _once) {\n if (typeof fn !== 'function') {\n console.warn('wrong listener type: ' + typeof fn);\n return;\n }\n\n // check if fn already there\n if (this._listens(type, fn, context) !== false) {\n return;\n }\n if (context === this) {\n // Less memory footprint.\n context = undefined;\n }\n var newListener = {\n fn: fn,\n ctx: context\n };\n if (_once) {\n newListener.once = true;\n }\n this._events = this._events || {};\n this._events[type] = this._events[type] || [];\n this._events[type].push(newListener);\n },\n _off: function (type, fn, context) {\n var listeners, i, len;\n if (!this._events) {\n return;\n }\n listeners = this._events[type];\n if (!listeners) {\n return;\n }\n if (arguments.length === 1) {\n // remove all\n if (this._firingCount) {\n // Set all removed listeners to noop\n // so they are not called if remove happens in fire\n for (i = 0, len = listeners.length; i < len; i++) {\n listeners[i].fn = falseFn;\n }\n }\n // clear all listeners for a type if function isn't specified\n delete this._events[type];\n return;\n }\n if (typeof fn !== 'function') {\n console.warn('wrong listener type: ' + typeof fn);\n return;\n }\n\n // find fn and remove it\n var index = this._listens(type, fn, context);\n if (index !== false) {\n var listener = listeners[index];\n if (this._firingCount) {\n // set the removed listener to noop so that's not called if remove happens in fire\n listener.fn = falseFn;\n\n /* copy array in case events are being fired */\n this._events[type] = listeners = listeners.slice();\n }\n listeners.splice(index, 1);\n }\n },\n // @method fire(type: String, data?: Object, propagate?: Boolean): this\n // Fires an event of the specified type. You can optionally provide a data\n // object — the first argument of the listener function will contain its\n // properties. The event can optionally be propagated to event parents.\n fire: function (type, data, propagate) {\n if (!this.listens(type, propagate)) {\n return this;\n }\n var event = extend({}, data, {\n type: type,\n target: this,\n sourceTarget: data && data.sourceTarget || this\n });\n if (this._events) {\n var listeners = this._events[type];\n if (listeners) {\n this._firingCount = this._firingCount + 1 || 1;\n for (var i = 0, len = listeners.length; i < len; i++) {\n var l = listeners[i];\n // off overwrites l.fn, so we need to copy fn to a var\n var fn = l.fn;\n if (l.once) {\n this.off(type, fn, l.ctx);\n }\n fn.call(l.ctx || this, event);\n }\n this._firingCount--;\n }\n }\n if (propagate) {\n // propagate the event to parents (set with addEventParent)\n this._propagateEvent(event);\n }\n return this;\n },\n // @method listens(type: String, propagate?: Boolean): Boolean\n // @method listens(type: String, fn: Function, context?: Object, propagate?: Boolean): Boolean\n // Returns `true` if a particular event type has any listeners attached to it.\n // The verification can optionally be propagated, it will return `true` if parents have the listener attached to it.\n listens: function (type, fn, context, propagate) {\n if (typeof type !== 'string') {\n console.warn('\"string\" type argument expected');\n }\n\n // we don't overwrite the input `fn` value, because we need to use it for propagation\n var _fn = fn;\n if (typeof fn !== 'function') {\n propagate = !!fn;\n _fn = undefined;\n context = undefined;\n }\n var listeners = this._events && this._events[type];\n if (listeners && listeners.length) {\n if (this._listens(type, _fn, context) !== false) {\n return true;\n }\n }\n if (propagate) {\n // also check parents for listeners if event propagates\n for (var id in this._eventParents) {\n if (this._eventParents[id].listens(type, fn, context, propagate)) {\n return true;\n }\n }\n }\n return false;\n },\n // returns the index (number) or false\n _listens: function (type, fn, context) {\n if (!this._events) {\n return false;\n }\n var listeners = this._events[type] || [];\n if (!fn) {\n return !!listeners.length;\n }\n if (context === this) {\n // Less memory footprint.\n context = undefined;\n }\n for (var i = 0, len = listeners.length; i < len; i++) {\n if (listeners[i].fn === fn && listeners[i].ctx === context) {\n return i;\n }\n }\n return false;\n },\n // @method once(…): this\n // Behaves as [`on(…)`](#evented-on), except the listener will only get fired once and then removed.\n once: function (types, fn, context) {\n // types can be a map of types/handlers\n if (typeof types === 'object') {\n for (var type in types) {\n // we don't process space-separated events here for performance;\n // it's a hot path since Layer uses the on(obj) syntax\n this._on(type, types[type], fn, true);\n }\n } else {\n // types can be a string of space-separated words\n types = splitWords(types);\n for (var i = 0, len = types.length; i < len; i++) {\n this._on(types[i], fn, context, true);\n }\n }\n return this;\n },\n // @method addEventParent(obj: Evented): this\n // Adds an event parent - an `Evented` that will receive propagated events\n addEventParent: function (obj) {\n this._eventParents = this._eventParents || {};\n this._eventParents[stamp(obj)] = obj;\n return this;\n },\n // @method removeEventParent(obj: Evented): this\n // Removes an event parent, so it will stop receiving propagated events\n removeEventParent: function (obj) {\n if (this._eventParents) {\n delete this._eventParents[stamp(obj)];\n }\n return this;\n },\n _propagateEvent: function (e) {\n for (var id in this._eventParents) {\n this._eventParents[id].fire(e.type, extend({\n layer: e.target,\n propagatedFrom: e.target\n }, e), true);\n }\n }\n };\n\n // aliases; we should ditch those eventually\n\n // @method addEventListener(…): this\n // Alias to [`on(…)`](#evented-on)\n Events.addEventListener = Events.on;\n\n // @method removeEventListener(…): this\n // Alias to [`off(…)`](#evented-off)\n\n // @method clearAllEventListeners(…): this\n // Alias to [`off()`](#evented-off)\n Events.removeEventListener = Events.clearAllEventListeners = Events.off;\n\n // @method addOneTimeEventListener(…): this\n // Alias to [`once(…)`](#evented-once)\n Events.addOneTimeEventListener = Events.once;\n\n // @method fireEvent(…): this\n // Alias to [`fire(…)`](#evented-fire)\n Events.fireEvent = Events.fire;\n\n // @method hasEventListeners(…): Boolean\n // Alias to [`listens(…)`](#evented-listens)\n Events.hasEventListeners = Events.listens;\n var Evented = Class.extend(Events);\n\n /*\r\n * @class Point\r\n * @aka L.Point\r\n *\r\n * Represents a point with `x` and `y` coordinates in pixels.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var point = L.point(200, 300);\r\n * ```\r\n *\r\n * All Leaflet methods and options that accept `Point` objects also accept them in a simple Array form (unless noted otherwise), so these lines are equivalent:\r\n *\r\n * ```js\r\n * map.panBy([200, 300]);\r\n * map.panBy(L.point(200, 300));\r\n * ```\r\n *\r\n * Note that `Point` does not inherit from Leaflet's `Class` object,\r\n * which means new classes can't inherit from it, and new methods\r\n * can't be added to it with the `include` function.\r\n */\n\n function Point(x, y, round) {\n // @property x: Number; The `x` coordinate of the point\n this.x = round ? Math.round(x) : x;\n // @property y: Number; The `y` coordinate of the point\n this.y = round ? Math.round(y) : y;\n }\n var trunc = Math.trunc || function (v) {\n return v > 0 ? Math.floor(v) : Math.ceil(v);\n };\n Point.prototype = {\n // @method clone(): Point\n // Returns a copy of the current point.\n clone: function () {\n return new Point(this.x, this.y);\n },\n // @method add(otherPoint: Point): Point\n // Returns the result of addition of the current and the given points.\n add: function (point) {\n // non-destructive, returns a new point\n return this.clone()._add(toPoint(point));\n },\n _add: function (point) {\n // destructive, used directly for performance in situations where it's safe to modify existing point\n this.x += point.x;\n this.y += point.y;\n return this;\n },\n // @method subtract(otherPoint: Point): Point\n // Returns the result of subtraction of the given point from the current.\n subtract: function (point) {\n return this.clone()._subtract(toPoint(point));\n },\n _subtract: function (point) {\n this.x -= point.x;\n this.y -= point.y;\n return this;\n },\n // @method divideBy(num: Number): Point\n // Returns the result of division of the current point by the given number.\n divideBy: function (num) {\n return this.clone()._divideBy(num);\n },\n _divideBy: function (num) {\n this.x /= num;\n this.y /= num;\n return this;\n },\n // @method multiplyBy(num: Number): Point\n // Returns the result of multiplication of the current point by the given number.\n multiplyBy: function (num) {\n return this.clone()._multiplyBy(num);\n },\n _multiplyBy: function (num) {\n this.x *= num;\n this.y *= num;\n return this;\n },\n // @method scaleBy(scale: Point): Point\n // Multiply each coordinate of the current point by each coordinate of\n // `scale`. In linear algebra terms, multiply the point by the\n // [scaling matrix](https://en.wikipedia.org/wiki/Scaling_%28geometry%29#Matrix_representation)\n // defined by `scale`.\n scaleBy: function (point) {\n return new Point(this.x * point.x, this.y * point.y);\n },\n // @method unscaleBy(scale: Point): Point\n // Inverse of `scaleBy`. Divide each coordinate of the current point by\n // each coordinate of `scale`.\n unscaleBy: function (point) {\n return new Point(this.x / point.x, this.y / point.y);\n },\n // @method round(): Point\n // Returns a copy of the current point with rounded coordinates.\n round: function () {\n return this.clone()._round();\n },\n _round: function () {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n return this;\n },\n // @method floor(): Point\n // Returns a copy of the current point with floored coordinates (rounded down).\n floor: function () {\n return this.clone()._floor();\n },\n _floor: function () {\n this.x = Math.floor(this.x);\n this.y = Math.floor(this.y);\n return this;\n },\n // @method ceil(): Point\n // Returns a copy of the current point with ceiled coordinates (rounded up).\n ceil: function () {\n return this.clone()._ceil();\n },\n _ceil: function () {\n this.x = Math.ceil(this.x);\n this.y = Math.ceil(this.y);\n return this;\n },\n // @method trunc(): Point\n // Returns a copy of the current point with truncated coordinates (rounded towards zero).\n trunc: function () {\n return this.clone()._trunc();\n },\n _trunc: function () {\n this.x = trunc(this.x);\n this.y = trunc(this.y);\n return this;\n },\n // @method distanceTo(otherPoint: Point): Number\n // Returns the cartesian distance between the current and the given points.\n distanceTo: function (point) {\n point = toPoint(point);\n var x = point.x - this.x,\n y = point.y - this.y;\n return Math.sqrt(x * x + y * y);\n },\n // @method equals(otherPoint: Point): Boolean\n // Returns `true` if the given point has the same coordinates.\n equals: function (point) {\n point = toPoint(point);\n return point.x === this.x && point.y === this.y;\n },\n // @method contains(otherPoint: Point): Boolean\n // Returns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).\n contains: function (point) {\n point = toPoint(point);\n return Math.abs(point.x) <= Math.abs(this.x) && Math.abs(point.y) <= Math.abs(this.y);\n },\n // @method toString(): String\n // Returns a string representation of the point for debugging purposes.\n toString: function () {\n return 'Point(' + formatNum(this.x) + ', ' + formatNum(this.y) + ')';\n }\n };\n\n // @factory L.point(x: Number, y: Number, round?: Boolean)\n // Creates a Point object with the given `x` and `y` coordinates. If optional `round` is set to true, rounds the `x` and `y` values.\n\n // @alternative\n // @factory L.point(coords: Number[])\n // Expects an array of the form `[x, y]` instead.\n\n // @alternative\n // @factory L.point(coords: Object)\n // Expects a plain object of the form `{x: Number, y: Number}` instead.\n function toPoint(x, y, round) {\n if (x instanceof Point) {\n return x;\n }\n if (isArray(x)) {\n return new Point(x[0], x[1]);\n }\n if (x === undefined || x === null) {\n return x;\n }\n if (typeof x === 'object' && 'x' in x && 'y' in x) {\n return new Point(x.x, x.y);\n }\n return new Point(x, y, round);\n }\n\n /*\r\n * @class Bounds\r\n * @aka L.Bounds\r\n *\r\n * Represents a rectangular area in pixel coordinates.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var p1 = L.point(10, 10),\r\n * p2 = L.point(40, 60),\r\n * bounds = L.bounds(p1, p2);\r\n * ```\r\n *\r\n * All Leaflet methods that accept `Bounds` objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:\r\n *\r\n * ```js\r\n * otherBounds.intersects([[10, 10], [40, 60]]);\r\n * ```\r\n *\r\n * Note that `Bounds` does not inherit from Leaflet's `Class` object,\r\n * which means new classes can't inherit from it, and new methods\r\n * can't be added to it with the `include` function.\r\n */\n\n function Bounds(a, b) {\n if (!a) {\n return;\n }\n var points = b ? [a, b] : a;\n for (var i = 0, len = points.length; i < len; i++) {\n this.extend(points[i]);\n }\n }\n Bounds.prototype = {\n // @method extend(point: Point): this\n // Extends the bounds to contain the given point.\n\n // @alternative\n // @method extend(otherBounds: Bounds): this\n // Extend the bounds to contain the given bounds\n extend: function (obj) {\n var min2, max2;\n if (!obj) {\n return this;\n }\n if (obj instanceof Point || typeof obj[0] === 'number' || 'x' in obj) {\n min2 = max2 = toPoint(obj);\n } else {\n obj = toBounds(obj);\n min2 = obj.min;\n max2 = obj.max;\n if (!min2 || !max2) {\n return this;\n }\n }\n\n // @property min: Point\n // The top left corner of the rectangle.\n // @property max: Point\n // The bottom right corner of the rectangle.\n if (!this.min && !this.max) {\n this.min = min2.clone();\n this.max = max2.clone();\n } else {\n this.min.x = Math.min(min2.x, this.min.x);\n this.max.x = Math.max(max2.x, this.max.x);\n this.min.y = Math.min(min2.y, this.min.y);\n this.max.y = Math.max(max2.y, this.max.y);\n }\n return this;\n },\n // @method getCenter(round?: Boolean): Point\n // Returns the center point of the bounds.\n getCenter: function (round) {\n return toPoint((this.min.x + this.max.x) / 2, (this.min.y + this.max.y) / 2, round);\n },\n // @method getBottomLeft(): Point\n // Returns the bottom-left point of the bounds.\n getBottomLeft: function () {\n return toPoint(this.min.x, this.max.y);\n },\n // @method getTopRight(): Point\n // Returns the top-right point of the bounds.\n getTopRight: function () {\n // -> Point\n return toPoint(this.max.x, this.min.y);\n },\n // @method getTopLeft(): Point\n // Returns the top-left point of the bounds (i.e. [`this.min`](#bounds-min)).\n getTopLeft: function () {\n return this.min; // left, top\n },\n // @method getBottomRight(): Point\n // Returns the bottom-right point of the bounds (i.e. [`this.max`](#bounds-max)).\n getBottomRight: function () {\n return this.max; // right, bottom\n },\n // @method getSize(): Point\n // Returns the size of the given bounds\n getSize: function () {\n return this.max.subtract(this.min);\n },\n // @method contains(otherBounds: Bounds): Boolean\n // Returns `true` if the rectangle contains the given one.\n // @alternative\n // @method contains(point: Point): Boolean\n // Returns `true` if the rectangle contains the given point.\n contains: function (obj) {\n var min, max;\n if (typeof obj[0] === 'number' || obj instanceof Point) {\n obj = toPoint(obj);\n } else {\n obj = toBounds(obj);\n }\n if (obj instanceof Bounds) {\n min = obj.min;\n max = obj.max;\n } else {\n min = max = obj;\n }\n return min.x >= this.min.x && max.x <= this.max.x && min.y >= this.min.y && max.y <= this.max.y;\n },\n // @method intersects(otherBounds: Bounds): Boolean\n // Returns `true` if the rectangle intersects the given bounds. Two bounds\n // intersect if they have at least one point in common.\n intersects: function (bounds) {\n // (Bounds) -> Boolean\n bounds = toBounds(bounds);\n var min = this.min,\n max = this.max,\n min2 = bounds.min,\n max2 = bounds.max,\n xIntersects = max2.x >= min.x && min2.x <= max.x,\n yIntersects = max2.y >= min.y && min2.y <= max.y;\n return xIntersects && yIntersects;\n },\n // @method overlaps(otherBounds: Bounds): Boolean\n // Returns `true` if the rectangle overlaps the given bounds. Two bounds\n // overlap if their intersection is an area.\n overlaps: function (bounds) {\n // (Bounds) -> Boolean\n bounds = toBounds(bounds);\n var min = this.min,\n max = this.max,\n min2 = bounds.min,\n max2 = bounds.max,\n xOverlaps = max2.x > min.x && min2.x < max.x,\n yOverlaps = max2.y > min.y && min2.y < max.y;\n return xOverlaps && yOverlaps;\n },\n // @method isValid(): Boolean\n // Returns `true` if the bounds are properly initialized.\n isValid: function () {\n return !!(this.min && this.max);\n },\n // @method pad(bufferRatio: Number): Bounds\n // Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.\n // For example, a ratio of 0.5 extends the bounds by 50% in each direction.\n // Negative values will retract the bounds.\n pad: function (bufferRatio) {\n var min = this.min,\n max = this.max,\n heightBuffer = Math.abs(min.x - max.x) * bufferRatio,\n widthBuffer = Math.abs(min.y - max.y) * bufferRatio;\n return toBounds(toPoint(min.x - heightBuffer, min.y - widthBuffer), toPoint(max.x + heightBuffer, max.y + widthBuffer));\n },\n // @method equals(otherBounds: Bounds): Boolean\n // Returns `true` if the rectangle is equivalent to the given bounds.\n equals: function (bounds) {\n if (!bounds) {\n return false;\n }\n bounds = toBounds(bounds);\n return this.min.equals(bounds.getTopLeft()) && this.max.equals(bounds.getBottomRight());\n }\n };\n\n // @factory L.bounds(corner1: Point, corner2: Point)\n // Creates a Bounds object from two corners coordinate pairs.\n // @alternative\n // @factory L.bounds(points: Point[])\n // Creates a Bounds object from the given array of points.\n function toBounds(a, b) {\n if (!a || a instanceof Bounds) {\n return a;\n }\n return new Bounds(a, b);\n }\n\n /*\r\n * @class LatLngBounds\r\n * @aka L.LatLngBounds\r\n *\r\n * Represents a rectangular geographical area on a map.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var corner1 = L.latLng(40.712, -74.227),\r\n * corner2 = L.latLng(40.774, -74.125),\r\n * bounds = L.latLngBounds(corner1, corner2);\r\n * ```\r\n *\r\n * All Leaflet methods that accept LatLngBounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:\r\n *\r\n * ```js\r\n * map.fitBounds([\r\n * \t[40.712, -74.227],\r\n * \t[40.774, -74.125]\r\n * ]);\r\n * ```\r\n *\r\n * Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners _outside_ the [-180, 180] degrees longitude range.\r\n *\r\n * Note that `LatLngBounds` does not inherit from Leaflet's `Class` object,\r\n * which means new classes can't inherit from it, and new methods\r\n * can't be added to it with the `include` function.\r\n */\n\n function LatLngBounds(corner1, corner2) {\n // (LatLng, LatLng) or (LatLng[])\n if (!corner1) {\n return;\n }\n var latlngs = corner2 ? [corner1, corner2] : corner1;\n for (var i = 0, len = latlngs.length; i < len; i++) {\n this.extend(latlngs[i]);\n }\n }\n LatLngBounds.prototype = {\n // @method extend(latlng: LatLng): this\n // Extend the bounds to contain the given point\n\n // @alternative\n // @method extend(otherBounds: LatLngBounds): this\n // Extend the bounds to contain the given bounds\n extend: function (obj) {\n var sw = this._southWest,\n ne = this._northEast,\n sw2,\n ne2;\n if (obj instanceof LatLng) {\n sw2 = obj;\n ne2 = obj;\n } else if (obj instanceof LatLngBounds) {\n sw2 = obj._southWest;\n ne2 = obj._northEast;\n if (!sw2 || !ne2) {\n return this;\n }\n } else {\n return obj ? this.extend(toLatLng(obj) || toLatLngBounds(obj)) : this;\n }\n if (!sw && !ne) {\n this._southWest = new LatLng(sw2.lat, sw2.lng);\n this._northEast = new LatLng(ne2.lat, ne2.lng);\n } else {\n sw.lat = Math.min(sw2.lat, sw.lat);\n sw.lng = Math.min(sw2.lng, sw.lng);\n ne.lat = Math.max(ne2.lat, ne.lat);\n ne.lng = Math.max(ne2.lng, ne.lng);\n }\n return this;\n },\n // @method pad(bufferRatio: Number): LatLngBounds\n // Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.\n // For example, a ratio of 0.5 extends the bounds by 50% in each direction.\n // Negative values will retract the bounds.\n pad: function (bufferRatio) {\n var sw = this._southWest,\n ne = this._northEast,\n heightBuffer = Math.abs(sw.lat - ne.lat) * bufferRatio,\n widthBuffer = Math.abs(sw.lng - ne.lng) * bufferRatio;\n return new LatLngBounds(new LatLng(sw.lat - heightBuffer, sw.lng - widthBuffer), new LatLng(ne.lat + heightBuffer, ne.lng + widthBuffer));\n },\n // @method getCenter(): LatLng\n // Returns the center point of the bounds.\n getCenter: function () {\n return new LatLng((this._southWest.lat + this._northEast.lat) / 2, (this._southWest.lng + this._northEast.lng) / 2);\n },\n // @method getSouthWest(): LatLng\n // Returns the south-west point of the bounds.\n getSouthWest: function () {\n return this._southWest;\n },\n // @method getNorthEast(): LatLng\n // Returns the north-east point of the bounds.\n getNorthEast: function () {\n return this._northEast;\n },\n // @method getNorthWest(): LatLng\n // Returns the north-west point of the bounds.\n getNorthWest: function () {\n return new LatLng(this.getNorth(), this.getWest());\n },\n // @method getSouthEast(): LatLng\n // Returns the south-east point of the bounds.\n getSouthEast: function () {\n return new LatLng(this.getSouth(), this.getEast());\n },\n // @method getWest(): Number\n // Returns the west longitude of the bounds\n getWest: function () {\n return this._southWest.lng;\n },\n // @method getSouth(): Number\n // Returns the south latitude of the bounds\n getSouth: function () {\n return this._southWest.lat;\n },\n // @method getEast(): Number\n // Returns the east longitude of the bounds\n getEast: function () {\n return this._northEast.lng;\n },\n // @method getNorth(): Number\n // Returns the north latitude of the bounds\n getNorth: function () {\n return this._northEast.lat;\n },\n // @method contains(otherBounds: LatLngBounds): Boolean\n // Returns `true` if the rectangle contains the given one.\n\n // @alternative\n // @method contains (latlng: LatLng): Boolean\n // Returns `true` if the rectangle contains the given point.\n contains: function (obj) {\n // (LatLngBounds) or (LatLng) -> Boolean\n if (typeof obj[0] === 'number' || obj instanceof LatLng || 'lat' in obj) {\n obj = toLatLng(obj);\n } else {\n obj = toLatLngBounds(obj);\n }\n var sw = this._southWest,\n ne = this._northEast,\n sw2,\n ne2;\n if (obj instanceof LatLngBounds) {\n sw2 = obj.getSouthWest();\n ne2 = obj.getNorthEast();\n } else {\n sw2 = ne2 = obj;\n }\n return sw2.lat >= sw.lat && ne2.lat <= ne.lat && sw2.lng >= sw.lng && ne2.lng <= ne.lng;\n },\n // @method intersects(otherBounds: LatLngBounds): Boolean\n // Returns `true` if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.\n intersects: function (bounds) {\n bounds = toLatLngBounds(bounds);\n var sw = this._southWest,\n ne = this._northEast,\n sw2 = bounds.getSouthWest(),\n ne2 = bounds.getNorthEast(),\n latIntersects = ne2.lat >= sw.lat && sw2.lat <= ne.lat,\n lngIntersects = ne2.lng >= sw.lng && sw2.lng <= ne.lng;\n return latIntersects && lngIntersects;\n },\n // @method overlaps(otherBounds: LatLngBounds): Boolean\n // Returns `true` if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.\n overlaps: function (bounds) {\n bounds = toLatLngBounds(bounds);\n var sw = this._southWest,\n ne = this._northEast,\n sw2 = bounds.getSouthWest(),\n ne2 = bounds.getNorthEast(),\n latOverlaps = ne2.lat > sw.lat && sw2.lat < ne.lat,\n lngOverlaps = ne2.lng > sw.lng && sw2.lng < ne.lng;\n return latOverlaps && lngOverlaps;\n },\n // @method toBBoxString(): String\n // Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data.\n toBBoxString: function () {\n return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(',');\n },\n // @method equals(otherBounds: LatLngBounds, maxMargin?: Number): Boolean\n // Returns `true` if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting `maxMargin` to a small number.\n equals: function (bounds, maxMargin) {\n if (!bounds) {\n return false;\n }\n bounds = toLatLngBounds(bounds);\n return this._southWest.equals(bounds.getSouthWest(), maxMargin) && this._northEast.equals(bounds.getNorthEast(), maxMargin);\n },\n // @method isValid(): Boolean\n // Returns `true` if the bounds are properly initialized.\n isValid: function () {\n return !!(this._southWest && this._northEast);\n }\n };\n\n // TODO International date line?\n\n // @factory L.latLngBounds(corner1: LatLng, corner2: LatLng)\n // Creates a `LatLngBounds` object by defining two diagonally opposite corners of the rectangle.\n\n // @alternative\n // @factory L.latLngBounds(latlngs: LatLng[])\n // Creates a `LatLngBounds` object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with [`fitBounds`](#map-fitbounds).\n function toLatLngBounds(a, b) {\n if (a instanceof LatLngBounds) {\n return a;\n }\n return new LatLngBounds(a, b);\n }\n\n /* @class LatLng\r\n * @aka L.LatLng\r\n *\r\n * Represents a geographical point with a certain latitude and longitude.\r\n *\r\n * @example\r\n *\r\n * ```\r\n * var latlng = L.latLng(50.5, 30.5);\r\n * ```\r\n *\r\n * All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise), so these lines are equivalent:\r\n *\r\n * ```\r\n * map.panTo([50, 30]);\r\n * map.panTo({lon: 30, lat: 50});\r\n * map.panTo({lat: 50, lng: 30});\r\n * map.panTo(L.latLng(50, 30));\r\n * ```\r\n *\r\n * Note that `LatLng` does not inherit from Leaflet's `Class` object,\r\n * which means new classes can't inherit from it, and new methods\r\n * can't be added to it with the `include` function.\r\n */\n\n function LatLng(lat, lng, alt) {\n if (isNaN(lat) || isNaN(lng)) {\n throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')');\n }\n\n // @property lat: Number\n // Latitude in degrees\n this.lat = +lat;\n\n // @property lng: Number\n // Longitude in degrees\n this.lng = +lng;\n\n // @property alt: Number\n // Altitude in meters (optional)\n if (alt !== undefined) {\n this.alt = +alt;\n }\n }\n LatLng.prototype = {\n // @method equals(otherLatLng: LatLng, maxMargin?: Number): Boolean\n // Returns `true` if the given `LatLng` point is at the same position (within a small margin of error). The margin of error can be overridden by setting `maxMargin` to a small number.\n equals: function (obj, maxMargin) {\n if (!obj) {\n return false;\n }\n obj = toLatLng(obj);\n var margin = Math.max(Math.abs(this.lat - obj.lat), Math.abs(this.lng - obj.lng));\n return margin <= (maxMargin === undefined ? 1.0E-9 : maxMargin);\n },\n // @method toString(): String\n // Returns a string representation of the point (for debugging purposes).\n toString: function (precision) {\n return 'LatLng(' + formatNum(this.lat, precision) + ', ' + formatNum(this.lng, precision) + ')';\n },\n // @method distanceTo(otherLatLng: LatLng): Number\n // Returns the distance (in meters) to the given `LatLng` calculated using the [Spherical Law of Cosines](https://en.wikipedia.org/wiki/Spherical_law_of_cosines).\n distanceTo: function (other) {\n return Earth.distance(this, toLatLng(other));\n },\n // @method wrap(): LatLng\n // Returns a new `LatLng` object with the longitude wrapped so it's always between -180 and +180 degrees.\n wrap: function () {\n return Earth.wrapLatLng(this);\n },\n // @method toBounds(sizeInMeters: Number): LatLngBounds\n // Returns a new `LatLngBounds` object in which each boundary is `sizeInMeters/2` meters apart from the `LatLng`.\n toBounds: function (sizeInMeters) {\n var latAccuracy = 180 * sizeInMeters / 40075017,\n lngAccuracy = latAccuracy / Math.cos(Math.PI / 180 * this.lat);\n return toLatLngBounds([this.lat - latAccuracy, this.lng - lngAccuracy], [this.lat + latAccuracy, this.lng + lngAccuracy]);\n },\n clone: function () {\n return new LatLng(this.lat, this.lng, this.alt);\n }\n };\n\n // @factory L.latLng(latitude: Number, longitude: Number, altitude?: Number): LatLng\n // Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude).\n\n // @alternative\n // @factory L.latLng(coords: Array): LatLng\n // Expects an array of the form `[Number, Number]` or `[Number, Number, Number]` instead.\n\n // @alternative\n // @factory L.latLng(coords: Object): LatLng\n // Expects an plain object of the form `{lat: Number, lng: Number}` or `{lat: Number, lng: Number, alt: Number}` instead.\n\n function toLatLng(a, b, c) {\n if (a instanceof LatLng) {\n return a;\n }\n if (isArray(a) && typeof a[0] !== 'object') {\n if (a.length === 3) {\n return new LatLng(a[0], a[1], a[2]);\n }\n if (a.length === 2) {\n return new LatLng(a[0], a[1]);\n }\n return null;\n }\n if (a === undefined || a === null) {\n return a;\n }\n if (typeof a === 'object' && 'lat' in a) {\n return new LatLng(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);\n }\n if (b === undefined) {\n return null;\n }\n return new LatLng(a, b, c);\n }\n\n /*\r\n * @namespace CRS\r\n * @crs L.CRS.Base\r\n * Object that defines coordinate reference systems for projecting\r\n * geographical points into pixel (screen) coordinates and back (and to\r\n * coordinates in other units for [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services). See\r\n * [spatial reference system](https://en.wikipedia.org/wiki/Spatial_reference_system).\r\n *\r\n * Leaflet defines the most usual CRSs by default. If you want to use a\r\n * CRS not defined by default, take a look at the\r\n * [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) plugin.\r\n *\r\n * Note that the CRS instances do not inherit from Leaflet's `Class` object,\r\n * and can't be instantiated. Also, new classes can't inherit from them,\r\n * and methods can't be added to them with the `include` function.\r\n */\n\n var CRS = {\n // @method latLngToPoint(latlng: LatLng, zoom: Number): Point\n // Projects geographical coordinates into pixel coordinates for a given zoom.\n latLngToPoint: function (latlng, zoom) {\n var projectedPoint = this.projection.project(latlng),\n scale = this.scale(zoom);\n return this.transformation._transform(projectedPoint, scale);\n },\n // @method pointToLatLng(point: Point, zoom: Number): LatLng\n // The inverse of `latLngToPoint`. Projects pixel coordinates on a given\n // zoom into geographical coordinates.\n pointToLatLng: function (point, zoom) {\n var scale = this.scale(zoom),\n untransformedPoint = this.transformation.untransform(point, scale);\n return this.projection.unproject(untransformedPoint);\n },\n // @method project(latlng: LatLng): Point\n // Projects geographical coordinates into coordinates in units accepted for\n // this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).\n project: function (latlng) {\n return this.projection.project(latlng);\n },\n // @method unproject(point: Point): LatLng\n // Given a projected coordinate returns the corresponding LatLng.\n // The inverse of `project`.\n unproject: function (point) {\n return this.projection.unproject(point);\n },\n // @method scale(zoom: Number): Number\n // Returns the scale used when transforming projected coordinates into\n // pixel coordinates for a particular zoom. For example, it returns\n // `256 * 2^zoom` for Mercator-based CRS.\n scale: function (zoom) {\n return 256 * Math.pow(2, zoom);\n },\n // @method zoom(scale: Number): Number\n // Inverse of `scale()`, returns the zoom level corresponding to a scale\n // factor of `scale`.\n zoom: function (scale) {\n return Math.log(scale / 256) / Math.LN2;\n },\n // @method getProjectedBounds(zoom: Number): Bounds\n // Returns the projection's bounds scaled and transformed for the provided `zoom`.\n getProjectedBounds: function (zoom) {\n if (this.infinite) {\n return null;\n }\n var b = this.projection.bounds,\n s = this.scale(zoom),\n min = this.transformation.transform(b.min, s),\n max = this.transformation.transform(b.max, s);\n return new Bounds(min, max);\n },\n // @method distance(latlng1: LatLng, latlng2: LatLng): Number\n // Returns the distance between two geographical coordinates.\n\n // @property code: String\n // Standard code name of the CRS passed into WMS services (e.g. `'EPSG:3857'`)\n //\n // @property wrapLng: Number[]\n // An array of two numbers defining whether the longitude (horizontal) coordinate\n // axis wraps around a given range and how. Defaults to `[-180, 180]` in most\n // geographical CRSs. If `undefined`, the longitude axis does not wrap around.\n //\n // @property wrapLat: Number[]\n // Like `wrapLng`, but for the latitude (vertical) axis.\n\n // wrapLng: [min, max],\n // wrapLat: [min, max],\n\n // @property infinite: Boolean\n // If true, the coordinate space will be unbounded (infinite in both axes)\n infinite: false,\n // @method wrapLatLng(latlng: LatLng): LatLng\n // Returns a `LatLng` where lat and lng has been wrapped according to the\n // CRS's `wrapLat` and `wrapLng` properties, if they are outside the CRS's bounds.\n wrapLatLng: function (latlng) {\n var lng = this.wrapLng ? wrapNum(latlng.lng, this.wrapLng, true) : latlng.lng,\n lat = this.wrapLat ? wrapNum(latlng.lat, this.wrapLat, true) : latlng.lat,\n alt = latlng.alt;\n return new LatLng(lat, lng, alt);\n },\n // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds\n // Returns a `LatLngBounds` with the same size as the given one, ensuring\n // that its center is within the CRS's bounds.\n // Only accepts actual `L.LatLngBounds` instances, not arrays.\n wrapLatLngBounds: function (bounds) {\n var center = bounds.getCenter(),\n newCenter = this.wrapLatLng(center),\n latShift = center.lat - newCenter.lat,\n lngShift = center.lng - newCenter.lng;\n if (latShift === 0 && lngShift === 0) {\n return bounds;\n }\n var sw = bounds.getSouthWest(),\n ne = bounds.getNorthEast(),\n newSw = new LatLng(sw.lat - latShift, sw.lng - lngShift),\n newNe = new LatLng(ne.lat - latShift, ne.lng - lngShift);\n return new LatLngBounds(newSw, newNe);\n }\n };\n\n /*\n * @namespace CRS\n * @crs L.CRS.Earth\n *\n * Serves as the base for CRS that are global such that they cover the earth.\n * Can only be used as the base for other CRS and cannot be used directly,\n * since it does not have a `code`, `projection` or `transformation`. `distance()` returns\n * meters.\n */\n\n var Earth = extend({}, CRS, {\n wrapLng: [-180, 180],\n // Mean Earth Radius, as recommended for use by\n // the International Union of Geodesy and Geophysics,\n // see https://rosettacode.org/wiki/Haversine_formula\n R: 6371000,\n // distance between two geographical points using spherical law of cosines approximation\n distance: function (latlng1, latlng2) {\n var rad = Math.PI / 180,\n lat1 = latlng1.lat * rad,\n lat2 = latlng2.lat * rad,\n sinDLat = Math.sin((latlng2.lat - latlng1.lat) * rad / 2),\n sinDLon = Math.sin((latlng2.lng - latlng1.lng) * rad / 2),\n a = sinDLat * sinDLat + Math.cos(lat1) * Math.cos(lat2) * sinDLon * sinDLon,\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n return this.R * c;\n }\n });\n\n /*\r\n * @namespace Projection\r\n * @projection L.Projection.SphericalMercator\r\n *\r\n * Spherical Mercator projection — the most common projection for online maps,\r\n * used by almost all free and commercial tile providers. Assumes that Earth is\r\n * a sphere. Used by the `EPSG:3857` CRS.\r\n */\n\n var earthRadius = 6378137;\n var SphericalMercator = {\n R: earthRadius,\n MAX_LATITUDE: 85.0511287798,\n project: function (latlng) {\n var d = Math.PI / 180,\n max = this.MAX_LATITUDE,\n lat = Math.max(Math.min(max, latlng.lat), -max),\n sin = Math.sin(lat * d);\n return new Point(this.R * latlng.lng * d, this.R * Math.log((1 + sin) / (1 - sin)) / 2);\n },\n unproject: function (point) {\n var d = 180 / Math.PI;\n return new LatLng((2 * Math.atan(Math.exp(point.y / this.R)) - Math.PI / 2) * d, point.x * d / this.R);\n },\n bounds: function () {\n var d = earthRadius * Math.PI;\n return new Bounds([-d, -d], [d, d]);\n }()\n };\n\n /*\r\n * @class Transformation\r\n * @aka L.Transformation\r\n *\r\n * Represents an affine transformation: a set of coefficients `a`, `b`, `c`, `d`\r\n * for transforming a point of a form `(x, y)` into `(a*x + b, c*y + d)` and doing\r\n * the reverse. Used by Leaflet in its projections code.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var transformation = L.transformation(2, 5, -1, 10),\r\n * \tp = L.point(1, 2),\r\n * \tp2 = transformation.transform(p), // L.point(7, 8)\r\n * \tp3 = transformation.untransform(p2); // L.point(1, 2)\r\n * ```\r\n */\n\n // factory new L.Transformation(a: Number, b: Number, c: Number, d: Number)\n // Creates a `Transformation` object with the given coefficients.\n function Transformation(a, b, c, d) {\n if (isArray(a)) {\n // use array properties\n this._a = a[0];\n this._b = a[1];\n this._c = a[2];\n this._d = a[3];\n return;\n }\n this._a = a;\n this._b = b;\n this._c = c;\n this._d = d;\n }\n Transformation.prototype = {\n // @method transform(point: Point, scale?: Number): Point\n // Returns a transformed point, optionally multiplied by the given scale.\n // Only accepts actual `L.Point` instances, not arrays.\n transform: function (point, scale) {\n // (Point, Number) -> Point\n return this._transform(point.clone(), scale);\n },\n // destructive transform (faster)\n _transform: function (point, scale) {\n scale = scale || 1;\n point.x = scale * (this._a * point.x + this._b);\n point.y = scale * (this._c * point.y + this._d);\n return point;\n },\n // @method untransform(point: Point, scale?: Number): Point\n // Returns the reverse transformation of the given point, optionally divided\n // by the given scale. Only accepts actual `L.Point` instances, not arrays.\n untransform: function (point, scale) {\n scale = scale || 1;\n return new Point((point.x / scale - this._b) / this._a, (point.y / scale - this._d) / this._c);\n }\n };\n\n // factory L.transformation(a: Number, b: Number, c: Number, d: Number)\n\n // @factory L.transformation(a: Number, b: Number, c: Number, d: Number)\n // Instantiates a Transformation object with the given coefficients.\n\n // @alternative\n // @factory L.transformation(coefficients: Array): Transformation\n // Expects an coefficients array of the form\n // `[a: Number, b: Number, c: Number, d: Number]`.\n\n function toTransformation(a, b, c, d) {\n return new Transformation(a, b, c, d);\n }\n\n /*\r\n * @namespace CRS\r\n * @crs L.CRS.EPSG3857\r\n *\r\n * The most common CRS for online maps, used by almost all free and commercial\r\n * tile providers. Uses Spherical Mercator projection. Set in by default in\r\n * Map's `crs` option.\r\n */\n\n var EPSG3857 = extend({}, Earth, {\n code: 'EPSG:3857',\n projection: SphericalMercator,\n transformation: function () {\n var scale = 0.5 / (Math.PI * SphericalMercator.R);\n return toTransformation(scale, 0.5, -scale, 0.5);\n }()\n });\n var EPSG900913 = extend({}, EPSG3857, {\n code: 'EPSG:900913'\n });\n\n // @namespace SVG; @section\n // There are several static functions which can be called without instantiating L.SVG:\n\n // @function create(name: String): SVGElement\n // Returns a instance of [SVGElement](https://developer.mozilla.org/docs/Web/API/SVGElement),\n // corresponding to the class name passed. For example, using 'line' will return\n // an instance of [SVGLineElement](https://developer.mozilla.org/docs/Web/API/SVGLineElement).\n function svgCreate(name) {\n return document.createElementNS('http://www.w3.org/2000/svg', name);\n }\n\n // @function pointsToPath(rings: Point[], closed: Boolean): String\n // Generates a SVG path string for multiple rings, with each ring turning\n // into \"M..L..L..\" instructions\n function pointsToPath(rings, closed) {\n var str = '',\n i,\n j,\n len,\n len2,\n points,\n p;\n for (i = 0, len = rings.length; i < len; i++) {\n points = rings[i];\n for (j = 0, len2 = points.length; j < len2; j++) {\n p = points[j];\n str += (j ? 'L' : 'M') + p.x + ' ' + p.y;\n }\n\n // closes the ring for polygons; \"x\" is VML syntax\n str += closed ? Browser.svg ? 'z' : 'x' : '';\n }\n\n // SVG complains about empty path strings\n return str || 'M0 0';\n }\n\n /*\r\n * @namespace Browser\r\n * @aka L.Browser\r\n *\r\n * A namespace with static properties for browser/feature detection used by Leaflet internally.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * if (L.Browser.ielt9) {\r\n * alert('Upgrade your browser, dude!');\r\n * }\r\n * ```\r\n */\n\n var style = document.documentElement.style;\n\n // @property ie: Boolean; `true` for all Internet Explorer versions (not Edge).\n var ie = 'ActiveXObject' in window;\n\n // @property ielt9: Boolean; `true` for Internet Explorer versions less than 9.\n var ielt9 = ie && !document.addEventListener;\n\n // @property edge: Boolean; `true` for the Edge web browser.\n var edge = 'msLaunchUri' in navigator && !('documentMode' in document);\n\n // @property webkit: Boolean;\n // `true` for webkit-based browsers like Chrome and Safari (including mobile versions).\n var webkit = userAgentContains('webkit');\n\n // @property android: Boolean\n // **Deprecated.** `true` for any browser running on an Android platform.\n var android = userAgentContains('android');\n\n // @property android23: Boolean; **Deprecated.** `true` for browsers running on Android 2 or Android 3.\n var android23 = userAgentContains('android 2') || userAgentContains('android 3');\n\n /* See https://stackoverflow.com/a/17961266 for details on detecting stock Android */\n var webkitVer = parseInt(/WebKit\\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10); // also matches AppleWebKit\n // @property androidStock: Boolean; **Deprecated.** `true` for the Android stock browser (i.e. not Chrome)\n var androidStock = android && userAgentContains('Google') && webkitVer < 537 && !('AudioNode' in window);\n\n // @property opera: Boolean; `true` for the Opera browser\n var opera = !!window.opera;\n\n // @property chrome: Boolean; `true` for the Chrome browser.\n var chrome = !edge && userAgentContains('chrome');\n\n // @property gecko: Boolean; `true` for gecko-based browsers like Firefox.\n var gecko = userAgentContains('gecko') && !webkit && !opera && !ie;\n\n // @property safari: Boolean; `true` for the Safari browser.\n var safari = !chrome && userAgentContains('safari');\n var phantom = userAgentContains('phantom');\n\n // @property opera12: Boolean\n // `true` for the Opera browser supporting CSS transforms (version 12 or later).\n var opera12 = 'OTransition' in style;\n\n // @property win: Boolean; `true` when the browser is running in a Windows platform\n var win = navigator.platform.indexOf('Win') === 0;\n\n // @property ie3d: Boolean; `true` for all Internet Explorer versions supporting CSS transforms.\n var ie3d = ie && 'transition' in style;\n\n // @property webkit3d: Boolean; `true` for webkit-based browsers supporting CSS transforms.\n var webkit3d = 'WebKitCSSMatrix' in window && 'm11' in new window.WebKitCSSMatrix() && !android23;\n\n // @property gecko3d: Boolean; `true` for gecko-based browsers supporting CSS transforms.\n var gecko3d = 'MozPerspective' in style;\n\n // @property any3d: Boolean\n // `true` for all browsers supporting CSS transforms.\n var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom;\n\n // @property mobile: Boolean; `true` for all browsers running in a mobile device.\n var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile');\n\n // @property mobileWebkit: Boolean; `true` for all webkit-based browsers in a mobile device.\n var mobileWebkit = mobile && webkit;\n\n // @property mobileWebkit3d: Boolean\n // `true` for all webkit-based browsers in a mobile device supporting CSS transforms.\n var mobileWebkit3d = mobile && webkit3d;\n\n // @property msPointer: Boolean\n // `true` for browsers implementing the Microsoft touch events model (notably IE10).\n var msPointer = !window.PointerEvent && window.MSPointerEvent;\n\n // @property pointer: Boolean\n // `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx).\n var pointer = !!(window.PointerEvent || msPointer);\n\n // @property touchNative: Boolean\n // `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).\n // **This does not necessarily mean** that the browser is running in a computer with\n // a touchscreen, it only means that the browser is capable of understanding\n // touch events.\n var touchNative = 'ontouchstart' in window || !!window.TouchEvent;\n\n // @property touch: Boolean\n // `true` for all browsers supporting either [touch](#browser-touch) or [pointer](#browser-pointer) events.\n // Note: pointer events will be preferred (if available), and processed for all `touch*` listeners.\n var touch = !window.L_NO_TOUCH && (touchNative || pointer);\n\n // @property mobileOpera: Boolean; `true` for the Opera browser in a mobile device.\n var mobileOpera = mobile && opera;\n\n // @property mobileGecko: Boolean\n // `true` for gecko-based browsers running in a mobile device.\n var mobileGecko = mobile && gecko;\n\n // @property retina: Boolean\n // `true` for browsers on a high-resolution \"retina\" screen or on any screen when browser's display zoom is more than 100%.\n var retina = (window.devicePixelRatio || window.screen.deviceXDPI / window.screen.logicalXDPI) > 1;\n\n // @property passiveEvents: Boolean\n // `true` for browsers that support passive events.\n var passiveEvents = function () {\n var supportsPassiveOption = false;\n try {\n var opts = Object.defineProperty({}, 'passive', {\n get: function () {\n // eslint-disable-line getter-return\n supportsPassiveOption = true;\n }\n });\n window.addEventListener('testPassiveEventSupport', falseFn, opts);\n window.removeEventListener('testPassiveEventSupport', falseFn, opts);\n } catch (e) {\n // Errors can safely be ignored since this is only a browser support test.\n }\n return supportsPassiveOption;\n }();\n\n // @property canvas: Boolean\n // `true` when the browser supports [``](https://developer.mozilla.org/docs/Web/API/Canvas_API).\n var canvas$1 = function () {\n return !!document.createElement('canvas').getContext;\n }();\n\n // @property svg: Boolean\n // `true` when the browser supports [SVG](https://developer.mozilla.org/docs/Web/SVG).\n var svg$1 = !!(document.createElementNS && svgCreate('svg').createSVGRect);\n var inlineSvg = !!svg$1 && function () {\n var div = document.createElement('div');\n div.innerHTML = '';\n return (div.firstChild && div.firstChild.namespaceURI) === 'http://www.w3.org/2000/svg';\n }();\n\n // @property vml: Boolean\n // `true` if the browser supports [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language).\n var vml = !svg$1 && function () {\n try {\n var div = document.createElement('div');\n div.innerHTML = '';\n var shape = div.firstChild;\n shape.style.behavior = 'url(#default#VML)';\n return shape && typeof shape.adj === 'object';\n } catch (e) {\n return false;\n }\n }();\n\n // @property mac: Boolean; `true` when the browser is running in a Mac platform\n var mac = navigator.platform.indexOf('Mac') === 0;\n\n // @property mac: Boolean; `true` when the browser is running in a Linux platform\n var linux = navigator.platform.indexOf('Linux') === 0;\n function userAgentContains(str) {\n return navigator.userAgent.toLowerCase().indexOf(str) >= 0;\n }\n var Browser = {\n ie: ie,\n ielt9: ielt9,\n edge: edge,\n webkit: webkit,\n android: android,\n android23: android23,\n androidStock: androidStock,\n opera: opera,\n chrome: chrome,\n gecko: gecko,\n safari: safari,\n phantom: phantom,\n opera12: opera12,\n win: win,\n ie3d: ie3d,\n webkit3d: webkit3d,\n gecko3d: gecko3d,\n any3d: any3d,\n mobile: mobile,\n mobileWebkit: mobileWebkit,\n mobileWebkit3d: mobileWebkit3d,\n msPointer: msPointer,\n pointer: pointer,\n touch: touch,\n touchNative: touchNative,\n mobileOpera: mobileOpera,\n mobileGecko: mobileGecko,\n retina: retina,\n passiveEvents: passiveEvents,\n canvas: canvas$1,\n svg: svg$1,\n vml: vml,\n inlineSvg: inlineSvg,\n mac: mac,\n linux: linux\n };\n\n /*\n * Extends L.DomEvent to provide touch support for Internet Explorer and Windows-based devices.\n */\n\n var POINTER_DOWN = Browser.msPointer ? 'MSPointerDown' : 'pointerdown';\n var POINTER_MOVE = Browser.msPointer ? 'MSPointerMove' : 'pointermove';\n var POINTER_UP = Browser.msPointer ? 'MSPointerUp' : 'pointerup';\n var POINTER_CANCEL = Browser.msPointer ? 'MSPointerCancel' : 'pointercancel';\n var pEvent = {\n touchstart: POINTER_DOWN,\n touchmove: POINTER_MOVE,\n touchend: POINTER_UP,\n touchcancel: POINTER_CANCEL\n };\n var handle = {\n touchstart: _onPointerStart,\n touchmove: _handlePointer,\n touchend: _handlePointer,\n touchcancel: _handlePointer\n };\n var _pointers = {};\n var _pointerDocListener = false;\n\n // Provides a touch events wrapper for (ms)pointer events.\n // ref https://www.w3.org/TR/pointerevents/ https://www.w3.org/Bugs/Public/show_bug.cgi?id=22890\n\n function addPointerListener(obj, type, handler) {\n if (type === 'touchstart') {\n _addPointerDocListener();\n }\n if (!handle[type]) {\n console.warn('wrong event specified:', type);\n return falseFn;\n }\n handler = handle[type].bind(this, handler);\n obj.addEventListener(pEvent[type], handler, false);\n return handler;\n }\n function removePointerListener(obj, type, handler) {\n if (!pEvent[type]) {\n console.warn('wrong event specified:', type);\n return;\n }\n obj.removeEventListener(pEvent[type], handler, false);\n }\n function _globalPointerDown(e) {\n _pointers[e.pointerId] = e;\n }\n function _globalPointerMove(e) {\n if (_pointers[e.pointerId]) {\n _pointers[e.pointerId] = e;\n }\n }\n function _globalPointerUp(e) {\n delete _pointers[e.pointerId];\n }\n function _addPointerDocListener() {\n // need to keep track of what pointers and how many are active to provide e.touches emulation\n if (!_pointerDocListener) {\n // we listen document as any drags that end by moving the touch off the screen get fired there\n document.addEventListener(POINTER_DOWN, _globalPointerDown, true);\n document.addEventListener(POINTER_MOVE, _globalPointerMove, true);\n document.addEventListener(POINTER_UP, _globalPointerUp, true);\n document.addEventListener(POINTER_CANCEL, _globalPointerUp, true);\n _pointerDocListener = true;\n }\n }\n function _handlePointer(handler, e) {\n if (e.pointerType === (e.MSPOINTER_TYPE_MOUSE || 'mouse')) {\n return;\n }\n e.touches = [];\n for (var i in _pointers) {\n e.touches.push(_pointers[i]);\n }\n e.changedTouches = [e];\n handler(e);\n }\n function _onPointerStart(handler, e) {\n // IE10 specific: MsTouch needs preventDefault. See #2000\n if (e.MSPOINTER_TYPE_TOUCH && e.pointerType === e.MSPOINTER_TYPE_TOUCH) {\n preventDefault(e);\n }\n _handlePointer(handler, e);\n }\n\n /*\r\n * Extends the event handling code with double tap support for mobile browsers.\r\n *\r\n * Note: currently most browsers fire native dblclick, with only a few exceptions\r\n * (see https://github.com/Leaflet/Leaflet/issues/7012#issuecomment-595087386)\r\n */\n\n function makeDblclick(event) {\n // in modern browsers `type` cannot be just overridden:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only\n var newEvent = {},\n prop,\n i;\n for (i in event) {\n prop = event[i];\n newEvent[i] = prop && prop.bind ? prop.bind(event) : prop;\n }\n event = newEvent;\n newEvent.type = 'dblclick';\n newEvent.detail = 2;\n newEvent.isTrusted = false;\n newEvent._simulated = true; // for debug purposes\n return newEvent;\n }\n var delay = 200;\n function addDoubleTapListener(obj, handler) {\n // Most browsers handle double tap natively\n obj.addEventListener('dblclick', handler);\n\n // On some platforms the browser doesn't fire native dblclicks for touch events.\n // It seems that in all such cases `detail` property of `click` event is always `1`.\n // So here we rely on that fact to avoid excessive 'dblclick' simulation when not needed.\n var last = 0,\n detail;\n function simDblclick(e) {\n if (e.detail !== 1) {\n detail = e.detail; // keep in sync to avoid false dblclick in some cases\n return;\n }\n if (e.pointerType === 'mouse' || e.sourceCapabilities && !e.sourceCapabilities.firesTouchEvents) {\n return;\n }\n\n // When clicking on an , the browser generates a click on its\n //